-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Make weird name lints trigger behind cfg_attr #97266
Conversation
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
9e171e8
to
2dfdf7b
Compare
Do we want that, considering that in the future one might write |
@lcnr it will only lint if the condition inside the cfg evaluates to true. If the condition is false, it won't lint. See the last entry in the added test. I've also edited the PR description to make this clearer. Making it peek inside all |
2dfdf7b
to
ab6357b
Compare
This comment has been minimized.
This comment has been minimized.
606c093
to
e9f26c0
Compare
I'm now using |
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.
one nit, then r=me
@lcnr your understanding is correct, yes. To make sure, I've removed the |
2b0ff53
to
7a36d24
Compare
re-r? @lcnr |
@bors r+ |
📌 Commit 7a36d24d93d00569c7907228f96d259f38a6f571 has been approved by |
Previously, we were emitting weird name lints (for renamed or unknown lints) before expansion, most importantly before cfg expansion. This meant that the weird name lints would not fire for lint attributes hidden inside cfg_attr. The same applied for lint level specifications of those lints. By moving the lints for the lint names to the post-expansion phase, these issues are resolved.
7a36d24
to
2a8b60f
Compare
Sorry for pinging you again, @lcnr I've improved the last two tests a little to not have a |
@bors r+ |
📌 Commit 2a8b60f has been approved by |
Rollup of 6 pull requests Successful merges: - rust-lang#93966 (document expectations for Waker::wake) - rust-lang#97266 (Make weird name lints trigger behind cfg_attr) - rust-lang#97355 (Remove unused brush image) - rust-lang#97358 (Update minifier-rs version to 0.1.0) - rust-lang#97363 (Fix a small mistake in `SliceIndex`'s documentation) - rust-lang#97364 (Fix weird indentation in continue_keyword docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…compiler-errors Add test for unknown_lints from another file. This adds a test for rust-lang#84936 which was incidentally fixed via rust-lang#97266. It is a strange issue where `#![allow(unknown_lints)]` at the crate root was not applying to unknown lints that fired in a non-inline-module. I did not dig further into how rust-lang#97266 fixed it, but I did verify it. I couldn't find any existing tests which did anything similar. Closes rust-lang#84936
The weird name lints (
unknown_lints
,renamed_and_removed_lints
), the lints that lint the linting, were previously not firing for lint level declarations behindcfg_attr
, as they were only running before expansion.Now, this will give a
unknown_lints
warning:Lint level declarations behind a
cfg_attr
whose condition is not applying are still ignored. So this still won't give a warning:Furthermore, this PR also makes the weird name lints respect level delcarations for them that were hidden by
cfg_attr
, making them consistent to other lints. So this will now not issue a warning:Fixes #97094