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
In quiz 35 we use colored-local-vars analogy for both variables inside and outside macros, and in quiz 24 we mentioned consts are uncolored. From these, I thought local variables inside macros would still be safe from collision because they are "colored". But that's not the case. Maybe it worths another quiz, or could we expanding quiz 24?
fnmain(){macro_rules! m {() => {// could also be `let foo = 42;` but it would give a compile error.matchSome(42i32){Some(foo) => println!("some"),
_ => println!("other"),
}};}{m!();}{const foo:i32 = 24;m!();}{let foo = 24;m!();}}
This code prints:
some
other
some
The text was updated successfully, but these errors were encountered:
In quiz 35 we use colored-local-vars analogy for both variables inside and outside macros, and in quiz 24 we mentioned consts are uncolored. From these, I thought local variables inside macros would still be safe from collision because they are "colored". But that's not the case. Maybe it worths another quiz, or could we expanding quiz 24?
This code prints:
The text was updated successfully, but these errors were encountered: