2015-04-04 02:58:41 +00: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 12:13:27 +00:00
|
|
|
() => (fake) //~ ERROR cannot find
|
|
|
|
//~^ ERROR cannot find
|
2015-04-04 02:58:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! call_nested_expr {
|
2016-08-17 14:20:04 +00:00
|
|
|
() => (nested_expr!())
|
2015-04-04 02:58:41 +00:00
|
|
|
}
|
|
|
|
|
2015-09-10 20:25:28 +00:00
|
|
|
macro_rules! call_nested_expr_sum {
|
2016-08-17 14:20:04 +00:00
|
|
|
() => { 1 + nested_expr!(); }
|
2015-04-04 02:58:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2016-08-17 14:20:04 +00:00
|
|
|
1 + call_nested_expr!();
|
|
|
|
call_nested_expr_sum!();
|
2015-04-04 02:58:41 +00:00
|
|
|
}
|