-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Make weird name lints trigger behind cfg_attr #97266
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
error: unknown lint: `nonex_lint_top_level` | ||
--> $DIR/issue-97094.rs:14:26 | ||
| | ||
LL | #![cfg_attr(all(), allow(nonex_lint_top_level))] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/issue-97094.rs:10:9 | ||
| | ||
LL | #![deny(warnings)] | ||
| ^^^^^^^^ | ||
= note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]` | ||
|
||
error: lint `bare_trait_object` has been renamed to `bare_trait_objects` | ||
--> $DIR/issue-97094.rs:16:26 | ||
| | ||
LL | #![cfg_attr(all(), allow(bare_trait_object))] | ||
| ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects` | ||
| | ||
= note: `#[deny(renamed_and_removed_lints)]` implied by `#[deny(warnings)]` | ||
|
||
error: unknown lint: `nonex_lint_mod` | ||
--> $DIR/issue-97094.rs:19:25 | ||
| | ||
LL | #[cfg_attr(all(), allow(nonex_lint_mod))] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: unknown lint: `nonex_lint_mod_inner` | ||
--> $DIR/issue-97094.rs:22:30 | ||
| | ||
LL | #![cfg_attr(all(), allow(nonex_lint_mod_inner))] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: unknown lint: `nonex_lint_fn` | ||
--> $DIR/issue-97094.rs:26:25 | ||
| | ||
LL | #[cfg_attr(all(), allow(nonex_lint_fn))] | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: unknown lint: `nonex_lint_in_macro` | ||
--> $DIR/issue-97094.rs:37:29 | ||
| | ||
LL | #[cfg_attr(all(), allow(nonex_lint_in_macro))] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: unknown lint: `nonex_lint_fn` | ||
--> $DIR/issue-97094.rs:56:13 | ||
| | ||
LL | #[allow(nonex_lint_fn)] | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 7 previous errors | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
error: unknown lint: `nonex_lint_top_level` | ||
--> $DIR/issue-97094.rs:14:26 | ||
| | ||
LL | #![cfg_attr(all(), allow(nonex_lint_top_level))] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/issue-97094.rs:10:9 | ||
| | ||
LL | #![deny(warnings)] | ||
| ^^^^^^^^ | ||
= note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]` | ||
|
||
error: lint `bare_trait_object` has been renamed to `bare_trait_objects` | ||
--> $DIR/issue-97094.rs:16:26 | ||
| | ||
LL | #![cfg_attr(all(), allow(bare_trait_object))] | ||
| ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects` | ||
| | ||
= note: `#[deny(renamed_and_removed_lints)]` implied by `#[deny(warnings)]` | ||
|
||
error: unknown lint: `nonex_lint_mod` | ||
--> $DIR/issue-97094.rs:19:25 | ||
| | ||
LL | #[cfg_attr(all(), allow(nonex_lint_mod))] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: unknown lint: `nonex_lint_mod_inner` | ||
--> $DIR/issue-97094.rs:22:30 | ||
| | ||
LL | #![cfg_attr(all(), allow(nonex_lint_mod_inner))] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: unknown lint: `nonex_lint_fn` | ||
--> $DIR/issue-97094.rs:26:25 | ||
| | ||
LL | #[cfg_attr(all(), allow(nonex_lint_fn))] | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: unknown lint: `nonex_lint_in_macro` | ||
--> $DIR/issue-97094.rs:37:29 | ||
| | ||
LL | #[cfg_attr(all(), allow(nonex_lint_in_macro))] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: unknown lint: `nonex_lint_fn` | ||
--> $DIR/issue-97094.rs:56:13 | ||
| | ||
LL | #[allow(nonex_lint_fn)] | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 7 previous errors | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// revisions: interleaved nointerleaved | ||
// [nointerleaved]compile-flags: -Z no-interleave-lints | ||
|
||
// This test has two revisions because the logic change | ||
// needed to make this test pass had to be adjusted | ||
// for no-interleave-lints. Should the debug option | ||
// be removed one day, please don't remove this | ||
// test entirely, just remove the revision from it. | ||
|
||
#![deny(warnings)] | ||
|
||
// Ensure that unknown lints inside cfg-attr's are linted for | ||
|
||
#![cfg_attr(all(), allow(nonex_lint_top_level))] | ||
//~^ ERROR unknown lint | ||
#![cfg_attr(all(), allow(bare_trait_object))] | ||
//~^ ERROR has been renamed | ||
|
||
#[cfg_attr(all(), allow(nonex_lint_mod))] | ||
//~^ ERROR unknown lint | ||
mod baz { | ||
#![cfg_attr(all(), allow(nonex_lint_mod_inner))] | ||
//~^ ERROR unknown lint | ||
} | ||
|
||
#[cfg_attr(all(), allow(nonex_lint_fn))] | ||
//~^ ERROR unknown lint | ||
pub fn main() {} | ||
|
||
macro_rules! bar { | ||
($($t:tt)*) => { | ||
$($t)* | ||
}; | ||
} | ||
|
||
bar!( | ||
#[cfg_attr(all(), allow(nonex_lint_in_macro))] | ||
//~^ ERROR unknown lint | ||
pub fn _bar() {} | ||
); | ||
|
||
// No warning for non-applying cfg | ||
#[cfg_attr(any(), allow(nonex_lint_fn))] | ||
pub fn _foo() {} | ||
|
||
// Allowing unknown lints works if inside cfg_attr | ||
#[cfg_attr(all(), allow(unknown_lints))] | ||
est31 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mod bar_allowed { | ||
#[allow(nonex_lint_fn)] | ||
fn _foo() {} | ||
} | ||
|
||
// ... but not if the cfg_attr doesn't evaluate | ||
#[cfg_attr(any(), allow(unknown_lints))] | ||
mod bar_not_allowed { | ||
#[allow(nonex_lint_fn)] | ||
//~^ ERROR unknown lint | ||
fn _foo() {} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.