rust/tests/ui/consts/const-unwrap.rs

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

14 lines
242 B
Rust
Raw Normal View History

//@ check-fail
#![feature(const_option)]
const FOO: i32 = Some(42i32).unwrap();
const BAR: i32 = Option::<i32>::None.unwrap();
//~^ERROR: evaluation of constant value failed
fn main() {
println!("{}", FOO);
println!("{}", BAR);
}