1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![allow(unused_macros)]
13 mod macros_cant_escape_fns {
15 macro_rules! m { () => { 3 + 4 } }
17 fn g() -> i32 { m!() }
18 //~^ ERROR cannot find macro
21 mod macros_cant_escape_mods {
23 macro_rules! m { () => { 3 + 4 } }
25 fn g() -> i32 { m!() }
26 //~^ ERROR cannot find macro
29 mod macros_can_escape_flattened_mods_test {
32 macro_rules! m { () => { 3 + 4 } }
34 fn g() -> i32 { m!() }
37 fn macro_tokens_should_match() {
38 macro_rules! m { (a) => { 13 } }
42 // should be able to use a bound identifier as a literal in a macro definition:
43 fn self_macro_parsing() {
44 macro_rules! foo { (zz) => { 287; } }