2014-06-24 20:49:19 -05:00
|
|
|
// macro f should not be able to inject a reference to 'n'.
|
|
|
|
|
2015-01-02 16:44:21 -06:00
|
|
|
macro_rules! f { () => (n) }
|
2017-01-11 16:18:08 -06:00
|
|
|
//~^ ERROR cannot find value `n` in this scope
|
|
|
|
//~| ERROR cannot find value `n` in this scope
|
|
|
|
//~| ERROR cannot find value `n` in this scope
|
|
|
|
//~| ERROR cannot find value `n` in this scope
|
2014-06-24 20:49:19 -05:00
|
|
|
|
|
|
|
fn main() -> (){
|
2015-01-31 10:23:42 -06:00
|
|
|
for n in 0..1 {
|
2016-05-18 06:26:54 -05:00
|
|
|
println!("{}", f!());
|
2014-06-24 20:49:19 -05:00
|
|
|
}
|
2015-09-29 18:19:45 -05:00
|
|
|
|
|
|
|
if let Some(n) = None {
|
2016-05-18 06:26:54 -05:00
|
|
|
println!("{}", f!());
|
2015-09-29 18:19:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if false {
|
|
|
|
} else if let Some(n) = None {
|
2016-05-18 06:26:54 -05:00
|
|
|
println!("{}", f!());
|
2015-09-29 18:19:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
while let Some(n) = None {
|
2016-05-18 06:26:54 -05:00
|
|
|
println!("{}", f!());
|
2015-09-29 18:19:45 -05:00
|
|
|
}
|
2014-06-24 20:49:19 -05:00
|
|
|
}
|