1 // run-pass 2 #![allow(dead_code)] 3 // compile-flags: --cfg foo 4 5 macro_rules! compiles_fine { 6 ($at:meta) => { 7 #[cfg($at)] 8 static MISTYPED: () = "foo"; 9 } 10 } 11 macro_rules! emit { 12 ($at:meta) => { 13 #[cfg($at)] 14 static MISTYPED: &'static str = "foo"; 15 } 16 } 17 18 // item 19 compiles_fine!(bar); 20 emit!(foo); 21 foo()22fn foo() { 23 println!("{}", MISTYPED); 24 } 25 main()26pub fn main() { 27 // statement 28 compiles_fine!(baz); 29 emit!(baz); 30 println!("{}", MISTYPED); 31 } 32