mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 18:27:37 +00:00
28 lines
754 B
Rust
28 lines
754 B
Rust
//@ check-pass
|
|
|
|
#![feature(rustc_attrs)]
|
|
#![warn(unused)]
|
|
|
|
macro_rules! foo {
|
|
() => {}
|
|
}
|
|
|
|
fn main() {
|
|
#[rustc_dummy] foo!(); //~ WARN unused attribute `rustc_dummy`
|
|
|
|
// This does nothing, since `#[allow(warnings)]` is itself
|
|
// an inert attribute on a macro call
|
|
#[allow(warnings)] #[rustc_dummy] foo!(); //~ WARN unused attribute `allow`
|
|
//~^ WARN unused attribute `rustc_dummy`
|
|
|
|
// This does work, since the attribute is on a parent
|
|
// of the macro invocation.
|
|
#[allow(warnings)] { #[rustc_dummy] foo!(); }
|
|
|
|
// Ok, `cfg` and `cfg_attr` are expanded eagerly and do not warn.
|
|
#[cfg(true)] foo!();
|
|
#[cfg(false)] foo!();
|
|
#[cfg_attr(true, cfg(true))] foo!();
|
|
#[cfg_attr(false, nonexistent)] foo!();
|
|
}
|