Closed
Description
The #[cfg_attr]
attribute doesn't work correctly for crate-level attributes. It seems to work in other cases as an inner attribute, but for crate-level attributes it yields the same warning that you'd see if you used the crate attribute on a non-root module:
#![cfg_attr(foo, crate_type="lib")]
fn main() {}
When compiled with rustc --cfg foo
:
unnamed.rs:1:18: 1:35 warning: unused attribute, #[warn(unused_attributes)] on by default unnamed.rs:1 #![cfg_attr(foo, crate_type="lib")] ^~~~~~~~~~~~~~~~~ unnamed.rs:1:18: 1:35 warning: crate-level attribute should be in the root module, #[warn(unused_attributes)] on by default unnamed.rs:1 #![cfg_attr(foo, crate_type="lib")] ^~~~~~~~~~~~~~~~~