2020-07-30 12:32:20 -07:00
|
|
|
//@ check-fail
|
2024-10-01 17:11:48 -04:00
|
|
|
// Verify that panicking `const_option` methods do the correct thing
|
2020-07-30 12:32:20 -07:00
|
|
|
|
|
|
|
const FOO: i32 = Some(42i32).unwrap();
|
|
|
|
|
2021-07-09 15:21:58 +02:00
|
|
|
const BAR: i32 = Option::<i32>::None.unwrap();
|
2024-10-01 17:11:48 -04:00
|
|
|
//~^ ERROR: evaluation of constant value failed
|
|
|
|
//~| NOTE: the evaluated program panicked
|
|
|
|
|
|
|
|
const BAZ: i32 = Option::<i32>::None.expect("absolutely not!");
|
|
|
|
//~^ ERROR: evaluation of constant value failed
|
|
|
|
//~| NOTE: absolutely not!
|
2020-07-30 12:32:20 -07:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
println!("{}", FOO);
|
|
|
|
println!("{}", BAR);
|
|
|
|
}
|