1 #![allow(unused_macros)] 2 3 mod macros_cant_escape_fns { f()4 fn f() { 5 macro_rules! m { () => { 3 + 4 } } 6 } g() -> i327 fn g() -> i32 { m!() } 8 //~^ ERROR cannot find macro 9 } 10 11 mod macros_cant_escape_mods { 12 mod f { 13 macro_rules! m { () => { 3 + 4 } } 14 } g() -> i3215 fn g() -> i32 { m!() } 16 //~^ ERROR cannot find macro 17 } 18 19 mod macros_can_escape_flattened_mods_test { 20 #[macro_use] 21 mod f { 22 macro_rules! m { () => { 3 + 4 } } 23 } g() -> i3224 fn g() -> i32 { m!() } 25 } 26 macro_tokens_should_match()27fn macro_tokens_should_match() { 28 macro_rules! m { (a) => { 13 } } 29 m!(a); 30 } 31 32 // should be able to use a bound identifier as a literal in a macro definition: self_macro_parsing()33fn self_macro_parsing() { 34 macro_rules! foo { (zz) => { 287; } } 35 fn f(zz: i32) { 36 foo!(zz); 37 } 38 } 39 main()40fn main() {} 41