You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configuration options are either names or key-value pairs, and are either set or unset.
but rustc's behavior for #[cfg(foo)] is if its set and a name.
A minimal reproduction:
#!/usr/bin/env -S cargo +nightly -Zscript
---
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(foo,values(any()))']}
---
fn main(){println!("Hello from the control grup!");#[cfg(foo)]println!("Hello from `foo`");#[cfg(foo = "value")]println!("Hello, from `foo=value`");}
$ RUSTFLAGS='' ./check-cfg-exists.rs # unsetHello from the control grup!
$ RUSTFLAGS='--cfg=foo' ./check-cfg-exists.rs # set with nameHello from the control grup!Hello from `foo`
$ RUSTFLAGS='--cfg=foo="value"' ./check-cfg-exists.rs # set with key-value pairHello from the control grup!Hello, from `foo=value`