Uh oh!
There was an error while loading. Please reload this page.
Suggest cfg(false) instead of cfg(FALSE) - #149792
Conversation
rustbot
commented
Dec 8, 2025
Some changes occurred in check-cfg diagnostics cc @Urgau |
rustbot
commented
Dec 8, 2025
joshtriplett
commented
Dec 8, 2025
LGTM. r=me once CI passes. @bors delegate+ |
bors
commented
Dec 8, 2025
✌️ @clubby789, you can now approve this pull request! If @joshtriplett told you to " |
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
hm, have you seen @scrabsha's work on uppercase/lowercase suggestions in the parser? I think it'd be cool if we could suggest against all mis-capitalizations here and maybe do that in a general enough way that all attribute parsers can benefit from it instead of a cfg-specific lint. At least, could you take a quick look if we can re-use the parsing infra for it? I like it when the error messages are consistent :) |
rustbot
commented
Dec 9, 2025
Reminder, once the PR becomes ready for a review, use |
jdonszelmann
commented
Dec 9, 2025
@bors delegate- |
I've spent a while looking into this and I'm not sure it makes sense to factor out the exact machinery from parsing, especially as the attr parsing machinery is some distance from the check-cfg lint. |
jdonszelmann
commented
Dec 11, 2025
ok, but this wouldn't trigger on any other mis-capitalization of false. I think it's reasonable to at least also detect |
jdonszelmann
commented
Dec 11, 2025
@rustbot author |
clubby789
commented
Dec 11, 2025
@rustbot ready |
jdonszelmann
commented
Dec 11, 2025
one last thing, could you explain that replacing it with false doesn't mean the cfg named false, but like, it literally means false. like, with this it seems like false is just another defined cfg name. Something like:
and similar for true. |
| //~| HELP: write it in lowercase (notice the capitalization) | ||
| pub fn b() {} | ||
| #[cfg(r#false)] |
There was a problem hiding this comment.
We may want to have a test for r#False.
There was a problem hiding this comment.
This currently raises the suggestion on r#False. I switched to just checking if the source code has r# to prevent this.
clubby789
commented
Dec 11, 2025
Extended to support |
jdonszelmann
commented
Dec 11, 2025
I like it. Thanks @clubby789 ! Sorry I kept having smol things to fix. @bors r+ rollup |
bors
commented
Dec 11, 2025
Suggest `cfg(false)` instead of `cfg(FALSE)` Split from rust-lang#149791 cc `@Urgau`
Suggest `cfg(false)` instead of `cfg(FALSE)` Split from rust-lang#149791 cc ``@Urgau``
Suggest `cfg(false)` instead of `cfg(FALSE)` Split from rust-lang#149791 cc ```@Urgau```
Suggest `cfg(false)` instead of `cfg(FALSE)` Split from rust-lang#149791 cc ````@Urgau````
Suggest `cfg(false)` instead of `cfg(FALSE)` Split from rust-lang#149791 cc `````@Urgau`````
Rollup of 7 pull requests Successful merges: - #149655 (bootstrap: add rustc-dev install target) - #149789 (Cleanup in the attribute parsers) - #149791 (Remove uses of `cfg({any()/all()})`) - #149792 (Suggest `cfg(false)` instead of `cfg(FALSE)`) - #149883 (add regression test for `proc_macro` error subdiagnostics) - #149884 (Clippy subtree update) - #149896 (Add myself(makai410) to the review rotation) r? `@ghost` `@rustbot` modify labels: rollup
Uh oh!
There was an error while loading. Please reload this page.
Rollup of 7 pull requests Successful merges: - rust-lang/rust#149655 (bootstrap: add rustc-dev install target) - rust-lang/rust#149789 (Cleanup in the attribute parsers) - rust-lang/rust#149791 (Remove uses of `cfg({any()/all()})`) - rust-lang/rust#149792 (Suggest `cfg(false)` instead of `cfg(FALSE)`) - rust-lang/rust#149883 (add regression test for `proc_macro` error subdiagnostics) - rust-lang/rust#149884 (Clippy subtree update) - rust-lang/rust#149896 (Add myself(makai410) to the review rotation) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 7 pull requests Successful merges: - rust-lang/rust#149655 (bootstrap: add rustc-dev install target) - rust-lang/rust#149789 (Cleanup in the attribute parsers) - rust-lang/rust#149791 (Remove uses of `cfg({any()/all()})`) - rust-lang/rust#149792 (Suggest `cfg(false)` instead of `cfg(FALSE)`) - rust-lang/rust#149883 (add regression test for `proc_macro` error subdiagnostics) - rust-lang/rust#149884 (Clippy subtree update) - rust-lang/rust#149896 (Add myself(makai410) to the review rotation) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 7 pull requests Successful merges: - rust-lang/rust#149655 (bootstrap: add rustc-dev install target) - rust-lang/rust#149789 (Cleanup in the attribute parsers) - rust-lang/rust#149791 (Remove uses of `cfg({any()/all()})`) - rust-lang/rust#149792 (Suggest `cfg(false)` instead of `cfg(FALSE)`) - rust-lang/rust#149883 (add regression test for `proc_macro` error subdiagnostics) - rust-lang/rust#149884 (Clippy subtree update) - rust-lang/rust#149896 (Add myself(makai410) to the review rotation) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 7 pull requests Successful merges: - rust-lang/rust#149655 (bootstrap: add rustc-dev install target) - rust-lang/rust#149789 (Cleanup in the attribute parsers) - rust-lang/rust#149791 (Remove uses of `cfg({any()/all()})`) - rust-lang/rust#149792 (Suggest `cfg(false)` instead of `cfg(FALSE)`) - rust-lang/rust#149883 (add regression test for `proc_macro` error subdiagnostics) - rust-lang/rust#149884 (Clippy subtree update) - rust-lang/rust#149896 (Add myself(makai410) to the review rotation) r? `@ghost` `@rustbot` modify labels: rollup
Split from #149791
cc @Urgau