about summary refs log tree commit diff
path: root/tests/ui/or-patterns/const-fn.rs
blob: 92894aa4d1718c0e1f36ab3da8e630fbbb359288 (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
//@ check-pass

const fn foo((Ok(a) | Err(a)): Result<i32, i32>) {
    let x = Ok(3);
    let (Ok(y) | Err(y)) = x;
}

const X: () = {
    let x = Ok(3);
    let (Ok(y) | Err(y)) = x;
};

static Y: () = {
    let x = Ok(3);
    let (Ok(y) | Err(y)) = x;
};

static mut Z: () = {
    let x = Ok(3);
    let (Ok(y) | Err(y)) = x;
};

fn main() {
    let _: [(); {
        let x = Ok(3);
        let (Ok(y) | Err(y)) = x;
        2
    }];
}