]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-15167.rs
Merge commit '0eff589afc83e21a03a168497bbab6b4dfbb4ef6' into clippyup
[rust.git] / src / test / ui / issues / issue-15167.rs
1 // macro f should not be able to inject a reference to 'n'.
2
3 macro_rules! f { () => (n) }
4 //~^ ERROR cannot find value `n` in this scope
5 //~| ERROR cannot find value `n` in this scope
6 //~| ERROR cannot find value `n` in this scope
7 //~| ERROR cannot find value `n` in this scope
8
9 fn main() -> (){
10     for n in 0..1 {
11         println!("{}", f!());
12     }
13
14     if let Some(n) = None {
15         println!("{}", f!());
16     }
17
18     if false {
19     } else if let Some(n) = None {
20         println!("{}", f!());
21     }
22
23     while let Some(n) = None {
24         println!("{}", f!());
25     }
26 }