]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const-eval/const_panic_2021.rs
Rollup merge of #106638 - RalfJung:realstd, r=thomcc
[rust.git] / tests / ui / consts / const-eval / const_panic_2021.rs
1 // edition:2021
2 #![crate_type = "lib"]
3
4 const MSG: &str = "hello";
5
6 const A: () = std::panic!("blĂ„haj");
7 //~^ ERROR evaluation of constant value failed
8
9 const B: () = std::panic!();
10 //~^ ERROR evaluation of constant value failed
11
12 const C: () = std::unreachable!();
13 //~^ ERROR evaluation of constant value failed
14
15 const D: () = std::unimplemented!();
16 //~^ ERROR evaluation of constant value failed
17
18 const E: () = std::panic!("{}", MSG);
19 //~^ ERROR evaluation of constant value failed
20
21 const A_CORE: () = core::panic!("shark");
22 //~^ ERROR evaluation of constant value failed
23
24 const B_CORE: () = core::panic!();
25 //~^ ERROR evaluation of constant value failed
26
27 const C_CORE: () = core::unreachable!();
28 //~^ ERROR evaluation of constant value failed
29
30 const D_CORE: () = core::unimplemented!();
31 //~^ ERROR evaluation of constant value failed
32
33 const E_CORE: () = core::panic!("{}", MSG);
34 //~^ ERROR evaluation of constant value failed