summaryrefslogtreecommitdiffstats
path: root/tests/ui/or-patterns/for-loop.rs
blob: 11b61cb69f1d2c9d4739bb1f717d360ff6742b79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Check that or patterns are lowered correctly in `for` loops.
// run-pass

fn main() {
    let v = vec![Ok(2), Err(3), Ok(5)];
    let mut w = Vec::new();
    for &(Ok(i) | Err(i)) in &v {
        w.push(i);
    }
    let mut u = Vec::new();
    for Ok(i) | Err(i) in v {
        u.push(i);
    }
    assert_eq!(w, [2, 3, 5]);
    assert_eq!(u, [2, 3, 5]);
}