2014-06-25 01:49:19 +00:00
|
|
|
// macro f should not be able to inject a reference to 'n'.
|
|
|
|
|
2015-01-02 22:44:21 +00:00
|
|
|
macro_rules! f { () => (n) }
|
2017-01-11 22:18:08 +00: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-25 01:49:19 +00:00
|
|
|
|
|
|
|
fn main() -> (){
|
2015-01-31 16:23:42 +00:00
|
|
|
for n in 0..1 {
|
2016-05-18 11:26:54 +00:00
|
|
|
println!("{}", f!());
|
2014-06-25 01:49:19 +00:00
|
|
|
}
|
2015-09-29 23:19:45 +00:00
|
|
|
|
|
|
|
if let Some(n) = None {
|
2016-05-18 11:26:54 +00:00
|
|
|
println!("{}", f!());
|
2015-09-29 23:19:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if false {
|
|
|
|
} else if let Some(n) = None {
|
2016-05-18 11:26:54 +00:00
|
|
|
println!("{}", f!());
|
2015-09-29 23:19:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while let Some(n) = None {
|
2016-05-18 11:26:54 +00:00
|
|
|
println!("{}", f!());
|
2015-09-29 23:19:45 +00:00
|
|
|
}
|
2014-06-25 01:49:19 +00:00
|
|
|
}
|