mirror of
https://git.proxmox.com/git/rustc
synced 2025-08-15 02:31:20 +00:00
18 lines
467 B
Rust
18 lines
467 B
Rust
//@ check-fail
|
|
// Verify that panicking `const_option` methods do the correct thing
|
|
|
|
const FOO: i32 = Some(42i32).unwrap();
|
|
|
|
const BAR: i32 = Option::<i32>::None.unwrap();
|
|
//~^ 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!
|
|
|
|
fn main() {
|
|
println!("{}", FOO);
|
|
println!("{}", BAR);
|
|
}
|