-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Remove uses of cfg({any()/all()})
#149791
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
base: main
Are you sure you want to change the base?
Conversation
|
Some changes occurred in check-cfg diagnostics cc @Urgau Some changes occurred in compiler/rustc_attr_parsing |
|
r? @chenyukang rustbot has assigned @chenyukang. Use |
This comment has been minimized.
This comment has been minimized.
d418aea to
cb5acfc
Compare
|
r? jdonszelmann |
|
Can you split-off the As for the warning it should probably be a lint (so it can be enabled and disabled), but either way the warning will need to go through T-lang first, with a nomination and maybe a crater run. |
cb5acfc to
cf79ee7
Compare
|
With my T-lang hat on, this seems reasonable. Nominating for discussion of the new lint. |
This comment has been minimized.
This comment has been minimized.
|
Running into the above error where (@__items ($($not:meta,)*) ; ( ($($m:meta),*) ($($tokens:tt)*) ), $($rest:tt)*) => {
#[cfg(all($($m,)* not(any($($not),*))))] cfg_if! { @__identity $($tokens)* }
cfg_if! { @__items ($($not,)* $($m,)*) ; $($rest)* }
};is invoked with no |
cf79ee7 to
06d836b
Compare
|
This PR modifies Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
|
Implemented as a pre-expansion early lint |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I'm not T-lang, I agree with josh that this is a good lint to add. Just got some comments about the implementation but nothing too major. Just gotta clean some things up :)
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
fd0e2e8 to
f298592
Compare
|
Moved back to an attribute lint as ignoring spans from expansions resolves the above issue, and addressed the other comments |
f298592 to
a463515
Compare
|
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
cfg_boolean_literal warningscfg({any()/all()})
This comment has been minimized.
This comment has been minimized.
a463515 to
70bb85a
Compare
| } else if list.is_empty() && meta.has_name(sym::all) { | ||
| span_lint_and_then( | ||
| cx, | ||
| NON_MINIMAL_CFG, | ||
| meta.span, | ||
| "unneeded sub `cfg` when there is no condition", | ||
| |_| {}, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed an overlapping case from Clippy
This comment has been minimized.
This comment has been minimized.
|
Alright, @rust-lang/lang r=me if you agree to accept this one |
70bb85a to
b8e8bbf
Compare
This comment has been minimized.
This comment has been minimized.
|
And ci passes haha |
b8e8bbf to
3beb3e5
Compare
|
rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer The Miri subtree was changed cc @rust-lang/miri |
|
There is really no reason for the rust-analyzer changes, please revert them. |
3beb3e5 to
2a27f5c
Compare
|
My understanding was that the diagnostic changes would cause downstream failures; reverted 🙂 |
|
It's not real Rust code, it's a string used for testing and parsed by r-a. |
|
We discussed this in today's @rust-lang/lang meeting. We observed that applying this change would raise the MSRV of the code. Clippy has a mechanism for noting the MSRV of code and (optionally) not making suggestions that would raise it. rustc doesn't have that mechanism. We felt we didn't want to add this without such a mechanism. (Separately, some folks felt that it should stay in clippy and not rustc even with a mechanism; that is a subject of ongoing discussion.) |
|
I think for now I'll open a PR folding this into |
2a27f5c to
c96ff2d
Compare
cfg({any()/all()})cfg({any()/all()})
|
MSRV'd version of the lint in #149870 |
This implements the followup warning suggested in rust-lang/rfcs#3695Lint against an emptycfg(any/all), suggest the boolean literal equivalents.#149791 (comment)
Tracking issue: #131204