summaryrefslogtreecommitdiffstats
path: root/tests/ui/for-loop-while/while-let-2.rs
blob: b9a49b47c8ff5911594d7b805de37357742f3d5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// run-pass

#[allow(dead_code)]
fn macros() {
    macro_rules! foo{
        ($p:pat, $e:expr, $b:block) => {{
            while let $p = $e $b
            //~^ WARN irrefutable `while let`
            //~| WARN irrefutable `while let`
        }}
    }
    macro_rules! bar{
        ($p:pat, $e:expr, $b:block) => {{
            foo!($p, $e, $b)
        }}
    }

    foo!(_a, 1, {
        println!("irrefutable pattern");
    });
    bar!(_a, 1, {
        println!("irrefutable pattern");
    });
}

pub fn main() {
    while let _a = 1 { //~ WARN irrefutable `while let`
        println!("irrefutable pattern");
        break;
    }
}