I tried this code:
#![deny(warnings)]
#![cfg_attr(all(), allow(lint1))]
#[cfg_attr(all(), allow(lint2))]
mod baz {
#![cfg_attr(all(), allow(lint3))]
}
#[cfg_attr(all(), allow(lint4))]
pub fn test() {}
Playground Link
I expected attributs in all 4 positions to cause compiler errors, but just the first one (inner attribute on the root module) does. When using allow without cfg_attr I get all 4 errors. Came across this while debugging why adding #![cfg_attr(feature = "name", allow(unused_macro_rules))] didn't introduce new warnings on stable in a module.
Meta
This happens in at least:
1.60.0
1.61.0-beta.7
nightly-2022-05-15
which are the versions currently on the playground
I tried this code:
Playground Link
I expected attributs in all 4 positions to cause compiler errors, but just the first one (inner attribute on the root module) does. When using
allowwithoutcfg_attrI get all 4 errors. Came across this while debugging why adding#![cfg_attr(feature = "name", allow(unused_macro_rules))]didn't introduce new warnings onstablein a module.Meta
This happens in at least:
1.60.01.61.0-beta.7nightly-2022-05-15which are the versions currently on the playground