-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Enabling keyword_idents
lints doesn't warn about violations in other files
#132218
Comments
I can reproduce this on 1.81-stable and 1.84-nightly/dev. No idea how old it is. It seems to affect all of If I put |
Discovered while investigating CI failures in #132167. |
Thanks for the report! To clarify, the example should probably be built with edition 2015 (otherwise, the lint intentionally doesn't fire in editions >= when the keyword was added). In general, this isn't a problem for edition migrations because it works correctly when the lint is passed on the command-line (which is how It looks like the pre-expansion lint pass is not able to propagate attribute-based lint level changes to nested modules. It does not have all the machinery that the normal lint passes have for propagating levels like that. For example, here it only passes in the attributes on the module. cc @compiler-errors. Unless this seems like it would be easy to fix, I personally would lean towards not fixing it and documenting the limitation of pre-expansion lints, and to further emphasize in comments and the documentation (like it does here) that pre-expansion lints should be avoided unless absolutely necessary. Pre-expansion lints are soft deprecated since they have known limitations. |
Yes, though I should explicitly note that |
…youxu Known-bug test for `keyword_idents` lint not propagating to other files Known-bug test for `keyword_idents` lint not propagating to other files when configured via attribute (rust-lang#132218).
Rollup merge of rust-lang#132253 - Zalathar:keyword-idents-bug, r=jieyouxu Known-bug test for `keyword_idents` lint not propagating to other files Known-bug test for `keyword_idents` lint not propagating to other files when configured via attribute (rust-lang#132218).
@rustbot labels -A-edition-2024 This isn't particularly related to Rust 2024, so we're going to drop that label. |
Consider this tiny two-file crate:
Building this crate should fail with several violations of the
keyword_idents_2018
andkeyword_idents_2024
lints. But instead, building unexpectedly succeeds!(This particular example requires Rust 2015, but the same issue can be observed in 2018/2021 regarding the
gen
keyword only.)The text was updated successfully, but these errors were encountered: