The following should print 1, but it currently prints 0:
fn main() {
let x = 0;
macro_rules! foo { () => {
let x = 1;
macro_rules! bar { () => {x} }
println!("{}", bar!());
}}
foo! {};
}
For comparison, the following correctly prints 1:
fn main() {
let x = 0;
macro_rules! foo { () => {{ //< note the added brace here
let x = 1;
macro_rules! bar { () => {x} }
println!("{}", bar!());
}}}
foo! {};
}
The following should print
1, but it currently prints0:For comparison, the following correctly prints
1: