Add regression test for nested cfgs
This commit is contained in:
parent
e7df90412c
commit
01576a6de1
2 changed files with 31 additions and 0 deletions
8
tests/ui/check-cfg/nested-cfg.rs
Normal file
8
tests/ui/check-cfg/nested-cfg.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
//@ check-pass
|
||||
|
||||
#[cfg(unknown)] //~ WARN unexpected `cfg` condition name
|
||||
#[cfg(false)]
|
||||
#[cfg(unknown)] // Should not warn
|
||||
fn foo() {}
|
||||
|
||||
fn main() {}
|
||||
23
tests/ui/check-cfg/nested-cfg.stderr
Normal file
23
tests/ui/check-cfg/nested-cfg.stderr
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
warning: unexpected `cfg` condition name: `unknown`
|
||||
--> $DIR/nested-cfg.rs:3:7
|
||||
|
|
||||
LL | #[cfg(unknown)]
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: expected names are: `FALSE` and `test` and 31 more
|
||||
= help: to expect this configuration use `--check-cfg=cfg(unknown)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
help: found config with similar value
|
||||
|
|
||||
LL - #[cfg(unknown)]
|
||||
LL + #[cfg(target_os = "unknown")]
|
||||
|
|
||||
help: found config with similar value
|
||||
|
|
||||
LL - #[cfg(unknown)]
|
||||
LL + #[cfg(target_vendor = "unknown")]
|
||||
|
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue