You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unsure of a better title for this, but I don't see why it's invalid to do. It makes adding some additional debug logging inside macros quite tedious. This example is a simple modification of one of the macros defined in the rust book (just above the introduction to recursive macros).
macro_rules! foo {($v:ident) => (let $v = 3;
println!("{}", $v);// If you comment this then it's fine.);}fnmain(){foo!(x);println!("{}", x);}
Expected:
print 3 (the value of x) twice
Actual:
<anon>:4:24: 4:26 error: unresolved name `x`
<anon>:4 println!("{}", $v); // If you comment this then it's fine.
^~
note: in expansion of format_args!
<std macros>:2:25: 2:56 note: expansion site
<std macros>:1:1: 2:62 note: in expansion of print!
<std macros>:3:1: 3:54 note: expansion site
<std macros>:1:1: 3:58 note: in expansion of println!
<anon>:4:9: 4:27 note: expansion site
<anon>:1:1: 6:2 note: in expansion of foo!
<anon>:9:5: 9:13 note: expansion site
Unsure of a better title for this, but I don't see why it's invalid to do. It makes adding some additional debug logging inside macros quite tedious. This example is a simple modification of one of the macros defined in the rust book (just above the introduction to recursive macros).
Expected:
print
3
(the value of x) twiceActual:
playpen link
cc @jbclements
The text was updated successfully, but these errors were encountered: