Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename cfg_match! to cfg_select! #137198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tgross35
Copy link
Contributor

@Nemo157 pointed out that cfg_match! syntax does not actually align well with match syntax, which is a possible source of confusion. The comment points out that usage is instead more similar to ecosystem select! macros. Rename cfg_match! to cfg_select! to match this.

Tracking issue: #115585

At [1] it was pointed out that `cfg_match!` syntax does not actually
align well with match syntax, which is a possible source of confusion.
The comment points out that usage is instead more similar to ecosystem
`select!` macros. Rename `cfg_match!` to `cfg_select!` to match this.

Tracking issue: rust-lang#115585

[1]: rust-lang#115585 (comment)
@rustbot
Copy link
Collaborator

rustbot commented Feb 18, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 18, 2025

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@tgross35
Copy link
Contributor Author

r? libs-api

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 18, 2025
@rustbot rustbot assigned m-ou-se and unassigned Mark-Simulacrum Feb 18, 2025
@tgross35 tgross35 mentioned this pull request Feb 18, 2025
3 tasks
@joshtriplett joshtriplett added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Feb 19, 2025
@joshtriplett
Copy link
Member

Nominating for discussion.

@joshtriplett
Copy link
Member

Speaking for myself only: not in favor of this rename.

@bors
Copy link
Contributor

bors commented Feb 23, 2025

☔ The latest upstream changes (presumably #137237) made this pull request unmergeable. Please resolve the merge conflicts.

@tgross35
Copy link
Contributor Author

From the meeting notes, TC mentioned cfg_cond as an alternative.

@traviscross
Copy link
Contributor

traviscross commented Feb 26, 2025

That is what I always called the macro myself, in my versions. It's probably the most correct PL theory name for the construct.

cond is what you get in Rust if you write:

match () {
    _ if predicate1 => ..,
    _ if predicate2 => ..,
    _ if predicate3 => ..,
    _ => ..,
}

(That is, as if let .. = .. else if let .. is to match, if .. else if .. is to cond.)

So it's in that sense that I think cfg_match! is fine too, as this is a kind of match that's been stripped down that way. But... yes, cfg_cond! is probably more correct.

@ChrisDenton
Copy link
Member

I don't have a strong opinion here only that having "match" in the name when it is notably different to match is less than ideal. On the other hand it's not the end of the world if I have to teach and explain that this match is a bit different to that match. It's just kinda awkward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-libs-api-nominated Nominated for discussion during a libs-api team meeting. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants