]>
Commit | Line | Data |
---|---|---|
9346a6ac AL |
1 | // Copyright 2015 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. | |
4 | // | |
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. | |
10 | ||
11 | // In expression position, but not statement position, when we expand a macro, | |
12 | // we replace the span of the expanded expression with that of the call site. | |
13 | ||
14 | macro_rules! nested_expr { | |
15 | () => (fake) | |
16 | } | |
17 | ||
18 | macro_rules! call_nested_expr { | |
19 | () => (nested_expr!()) | |
20 | } | |
21 | ||
e9174d1e | 22 | macro_rules! call_nested_expr_sum { |
9346a6ac | 23 | () => { 1 + nested_expr!(); } //~ ERROR unresolved name |
54a0048b | 24 | //~^ NOTE in this expansion of nested_expr! |
9346a6ac AL |
25 | } |
26 | ||
27 | fn main() { | |
28 | 1 + call_nested_expr!(); //~ ERROR unresolved name | |
54a0048b | 29 | //~^ NOTE in this expansion of call_nested_expr! |
e9174d1e | 30 | call_nested_expr_sum!(); //~ NOTE in this expansion of |
9346a6ac | 31 | } |