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