]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/const-eval/const_panic.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / const_panic.rs
1 #![allow(non_fmt_panics)]
2 #![crate_type = "lib"]
3
4 const MSG: &str = "hello";
5
6 const Z: () = std::panic!("cheese");
7 //~^ ERROR evaluation of constant value failed
8
9 const Z2: () = std::panic!();
10 //~^ ERROR evaluation of constant value failed
11
12 const Y: () = std::unreachable!();
13 //~^ ERROR evaluation of constant value failed
14
15 const X: () = std::unimplemented!();
16 //~^ ERROR evaluation of constant value failed
17
18 const W: () = std::panic!(MSG);
19 //~^ ERROR evaluation of constant value failed
20
21 const W2: () = std::panic!("{}", MSG);
22 //~^ ERROR evaluation of constant value failed
23
24 const Z_CORE: () = core::panic!("cheese");
25 //~^ ERROR evaluation of constant value failed
26
27 const Z2_CORE: () = core::panic!();
28 //~^ ERROR evaluation of constant value failed
29
30 const Y_CORE: () = core::unreachable!();
31 //~^ ERROR evaluation of constant value failed
32
33 const X_CORE: () = core::unimplemented!();
34 //~^ ERROR evaluation of constant value failed
35
36 const W_CORE: () = core::panic!(MSG);
37 //~^ ERROR evaluation of constant value failed
38
39 const W2_CORE: () = core::panic!("{}", MSG);
40 //~^ ERROR evaluation of constant value failed