blob: 2ef5537db60ad84776675f15b930770ea429f155 [file] [log] [blame]
#![feature(or_patterns)]
const fn foo((Ok(a) | Err(a)): Result<i32, i32>) {
//~^ ERROR or-pattern is not allowed in a `const fn`
let x = Ok(3);
let Ok(y) | Err(y) = x;
//~^ ERROR or-pattern is not allowed in a `const fn`
}
const X: () = {
let x = Ok(3);
let Ok(y) | Err(y) = x;
//~^ ERROR or-pattern is not allowed in a `const`
};
static Y: () = {
let x = Ok(3);
let Ok(y) | Err(y) = x;
//~^ ERROR or-pattern is not allowed in a `static`
};
static mut Z: () = {
let x = Ok(3);
let Ok(y) | Err(y) = x;
//~^ ERROR or-pattern is not allowed in a `static mut`
};
fn main() {
let _: [(); {
let x = Ok(3);
let Ok(y) | Err(y) = x;
//~^ ERROR or-pattern is not allowed in a `const`
//~| ERROR constant contains unimplemented expression type
//~| ERROR constant contains unimplemented expression type
2
}];
}