summary refs log tree commit diff
path: root/src/test/ui/consts/const-unwrap.rs
blob: 6ed60ed87bf7690048f68452d5e8709ce3070a5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// check-fail

#![feature(const_option)]

const FOO: i32 = Some(42i32).unwrap();

// This causes an error, but it is attributed to the `panic` *inside* `Option::unwrap` (maybe due
// to `track_caller`?). A note points to the originating `const`.
const BAR: i32 = Option::<i32>::None.unwrap(); //~ NOTE

fn main() {
    println!("{}", FOO);
    println!("{}", BAR);
}