A short post on how variable names can leak out of macros if there is a name collision with a constant. I thought this was a delightful read!
You must log in or # to comment.
Maybe a good idea for a post. But the amount of reaches required makes this icky.
- Pretending people write:
instead oflet Ok(x) = read_input() else { return Err(Error) };
let x = read_input().map_err(|_| ...)?;
- Pretending people write:
instead ofconst x: &str = "...";
const X: &str = "...";
- Pretending there exist people who have such knowledge of rust macros hygiene, ident namespaces, etc, but somehow don’t know about how macro code expands (the “shock” about the compile error).
Maybe there is a reason after all why almost no one (maybe no one, period) was ever in that situation.
Also:
A short post on how variable names can leak out of macros
I don’t think you understood the blog OP!
- Pretending people write: