-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #73300 - crlf0710:crate_level_only_check, r=petrochenkov
Implement crate-level-only lints checking. This implements a crate_level_only flag on lints, and when it is true, it becomes an error when user tries to specify this flag upon nodes other than crate node. This also turns on this flag for all non_ascii_ident lints.
- Loading branch information
Showing
8 changed files
with
148 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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,22 @@ | ||
#![deny(uncommon_codepoints, unused_attributes)] | ||
|
||
mod foo { | ||
#![allow(uncommon_codepoints)] | ||
//~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] | ||
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] | ||
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] | ||
|
||
#[allow(uncommon_codepoints)] | ||
//~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] | ||
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] | ||
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] | ||
const BAR: f64 = 0.000001; | ||
|
||
} | ||
|
||
#[allow(uncommon_codepoints)] | ||
//~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] | ||
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] | ||
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] | ||
fn main() { | ||
} |
This file contains 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,62 @@ | ||
error: allow(uncommon_codepoints) is ignored unless specified at crate level | ||
--> $DIR/crate_level_only_lint.rs:4:10 | ||
| | ||
LL | #![allow(uncommon_codepoints)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/crate_level_only_lint.rs:1:30 | ||
| | ||
LL | #![deny(uncommon_codepoints, unused_attributes)] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: allow(uncommon_codepoints) is ignored unless specified at crate level | ||
--> $DIR/crate_level_only_lint.rs:9:9 | ||
| | ||
LL | #[allow(uncommon_codepoints)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: allow(uncommon_codepoints) is ignored unless specified at crate level | ||
--> $DIR/crate_level_only_lint.rs:17:9 | ||
| | ||
LL | #[allow(uncommon_codepoints)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: allow(uncommon_codepoints) is ignored unless specified at crate level | ||
--> $DIR/crate_level_only_lint.rs:4:10 | ||
| | ||
LL | #![allow(uncommon_codepoints)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: allow(uncommon_codepoints) is ignored unless specified at crate level | ||
--> $DIR/crate_level_only_lint.rs:9:9 | ||
| | ||
LL | #[allow(uncommon_codepoints)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: allow(uncommon_codepoints) is ignored unless specified at crate level | ||
--> $DIR/crate_level_only_lint.rs:17:9 | ||
| | ||
LL | #[allow(uncommon_codepoints)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: allow(uncommon_codepoints) is ignored unless specified at crate level | ||
--> $DIR/crate_level_only_lint.rs:4:10 | ||
| | ||
LL | #![allow(uncommon_codepoints)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: allow(uncommon_codepoints) is ignored unless specified at crate level | ||
--> $DIR/crate_level_only_lint.rs:9:9 | ||
| | ||
LL | #[allow(uncommon_codepoints)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: allow(uncommon_codepoints) is ignored unless specified at crate level | ||
--> $DIR/crate_level_only_lint.rs:17:9 | ||
| | ||
LL | #[allow(uncommon_codepoints)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 9 previous errors | ||
|