rust/src/test/ui/consts/const-unwrap.rs
Mara Bos 0a4b53f57d Use #[track_caller] in const panic diagnostics.
It was already used for the message. This also uses it for the spans
used for the error and backtrace.
2021-07-09 15:23:27 +02:00

13 lines
241 B
Rust

// 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);
}