2015-04-03 21:58:41 -05:00
|
|
|
// In expression position, but not statement position, when we expand a macro,
|
|
|
|
// we replace the span of the expanded expression with that of the call site.
|
|
|
|
|
|
|
|
macro_rules! nested_expr {
|
2017-11-20 06:13:27 -06:00
|
|
|
() => (fake) //~ ERROR cannot find
|
|
|
|
//~^ ERROR cannot find
|
2015-04-03 21:58:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! call_nested_expr {
|
2016-08-17 09:20:04 -05:00
|
|
|
() => (nested_expr!())
|
2015-04-03 21:58:41 -05:00
|
|
|
}
|
|
|
|
|
2015-09-10 15:25:28 -05:00
|
|
|
macro_rules! call_nested_expr_sum {
|
2016-08-17 09:20:04 -05:00
|
|
|
() => { 1 + nested_expr!(); }
|
2015-04-03 21:58:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2016-08-17 09:20:04 -05:00
|
|
|
1 + call_nested_expr!();
|
|
|
|
call_nested_expr_sum!();
|
2015-04-03 21:58:41 -05:00
|
|
|
}
|