rust/tests/ui/or-patterns/const-fn.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
438 B
Rust
Raw Normal View History

2020-05-21 14:49:38 -05:00
// 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
}];
}