rust/tests/ui/lint/inert-attr-macro.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
497 B
Rust
Raw Normal View History

//@ check-pass
#![warn(unused)]
macro_rules! foo {
() => {}
}
fn main() {
#[inline] foo!(); //~ WARN unused attribute `inline`
// This does nothing, since `#[allow(warnings)]` is itself
// an inert attribute on a macro call
#[allow(warnings)] #[inline] foo!(); //~ WARN unused attribute `allow`
//~^ WARN unused attribute `inline`
// This does work, since the attribute is on a parent
// of the macro invocation.
#[allow(warnings)] { #[inline] foo!(); }
}