Closed
Description
I think (hope) this is an easy fix; I'm creating the issue so I can refer to it in code.
Currently, macros defined by macro_rules! escape from the contexts in which they're defined; I'm assuming that's an accident. So, for instance,
// regular definition of add1
macro_rules! add1 (
($x:expr) => ($x + 1)
)
fn boring () -> uint {
// sneaky redefinition...
macro_rules! add1 (
($x:expr) => ($x + 2)
)
3
}
fn scary () -> uint {
// which definition is live?
add1!(3)
}
#[test] fn t1 () {
assert scary() == 4;
}
...fails the test, because the bogus definition from the boring() function is still in effect.