2025-01-24 18:22:43 +01:00
|
|
|
// This test check that #[allow(unexpected_cfgs)] **doesn't work**
|
|
|
|
// when put on the same level as the #[cfg] attribute.
|
|
|
|
//
|
|
|
|
// It should work, but due to interactions between how #[cfg]s are
|
|
|
|
// expanded, the lint machinery and the check-cfg impl, we
|
2025-03-09 18:31:14 +08:00
|
|
|
// miss the #[allow], althrough we probably shouldn't.
|
2025-01-24 18:22:43 +01:00
|
|
|
//
|
|
|
|
// cf. https://github.com/rust-lang/rust/issues/124735
|
2022-02-27 22:26:24 +01:00
|
|
|
//
|
|
|
|
//@ check-pass
|
2024-04-09 14:07:30 +02:00
|
|
|
//@ no-auto-check-cfg
|
2025-01-24 18:22:43 +01:00
|
|
|
//@ compile-flags: --check-cfg=cfg() --cfg=unknown_but_active_cfg
|
2022-02-27 22:26:24 +01:00
|
|
|
|
|
|
|
#[allow(unexpected_cfgs)]
|
2025-03-29 17:24:03 +00:00
|
|
|
#[cfg(unknown_and_inactive_cfg)]
|
2022-02-27 22:26:24 +01:00
|
|
|
//~^ WARNING unexpected `cfg` condition name
|
|
|
|
fn bar() {}
|
|
|
|
|
2025-01-24 18:22:43 +01:00
|
|
|
#[allow(unexpected_cfgs)]
|
|
|
|
#[cfg(unknown_but_active_cfg)]
|
|
|
|
//~^ WARNING unexpected `cfg` condition name
|
|
|
|
fn bar() {}
|
|
|
|
|
2022-02-27 22:26:24 +01:00
|
|
|
fn main() {}
|