forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve allowness of the unexpected_cfgs lint
- Loading branch information
Showing
14 changed files
with
122 additions
and
26 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
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,14 @@ | ||
// This test check that local #[allow(unexpected_cfgs)] works | ||
// | ||
// check-pass | ||
// compile-flags:--check-cfg=names() -Z unstable-options | ||
|
||
#[allow(unexpected_cfgs)] | ||
fn foo() { | ||
if cfg!(FALSE) {} | ||
} | ||
|
||
fn main() { | ||
#[allow(unexpected_cfgs)] | ||
if cfg!(FALSE) {} | ||
} |
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,11 @@ | ||
// This test check that #[allow(unexpected_cfgs)] doesn't work if put on the same level | ||
// | ||
// check-pass | ||
// compile-flags:--check-cfg=names() -Z unstable-options | ||
|
||
#[allow(unexpected_cfgs)] | ||
#[cfg(FALSE)] | ||
//~^ WARNING unexpected `cfg` condition name | ||
fn bar() {} | ||
|
||
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,10 @@ | ||
warning: unexpected `cfg` condition name | ||
--> $DIR/allow-same-level.rs:7:7 | ||
| | ||
LL | #[cfg(FALSE)] | ||
| ^^^^^ | ||
| | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: 1 warning emitted | ||
|
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,15 @@ | ||
// This test check that a top-level #![allow(unexpected_cfgs)] works | ||
// | ||
// check-pass | ||
// compile-flags:--check-cfg=names() -Z unstable-options | ||
|
||
#![allow(unexpected_cfgs)] | ||
|
||
#[cfg(FALSE)] | ||
fn bar() {} | ||
|
||
fn foo() { | ||
if cfg!(FALSE) {} | ||
} | ||
|
||
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,12 @@ | ||
// This test check that #[allow(unexpected_cfgs)] work if put on an upper level | ||
// | ||
// check-pass | ||
// compile-flags:--check-cfg=names() -Z unstable-options | ||
|
||
#[allow(unexpected_cfgs)] | ||
mod aa { | ||
#[cfg(FALSE)] | ||
fn bar() {} | ||
} | ||
|
||
fn main() {} |