]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-eval/const_panic.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / const_panic.rs
CommitLineData
b7449926 1#![feature(const_panic)]
136023e0 2#![allow(non_fmt_panics)]
a1dfa0c6 3#![crate_type = "lib"]
94b46f34 4
29967ef6
XL
5const MSG: &str = "hello";
6
7const Z: () = std::panic!("cheese");
136023e0 8//~^ ERROR evaluation of constant value failed
29967ef6
XL
9
10const Z2: () = std::panic!();
136023e0 11//~^ ERROR evaluation of constant value failed
29967ef6
XL
12
13const Y: () = std::unreachable!();
136023e0 14//~^ ERROR evaluation of constant value failed
29967ef6
XL
15
16const X: () = std::unimplemented!();
136023e0 17//~^ ERROR evaluation of constant value failed
29967ef6
XL
18//
19const W: () = std::panic!(MSG);
136023e0 20//~^ ERROR evaluation of constant value failed
29967ef6
XL
21
22const Z_CORE: () = core::panic!("cheese");
136023e0 23//~^ ERROR evaluation of constant value failed
29967ef6
XL
24
25const Z2_CORE: () = core::panic!();
136023e0 26//~^ ERROR evaluation of constant value failed
29967ef6
XL
27
28const Y_CORE: () = core::unreachable!();
136023e0 29//~^ ERROR evaluation of constant value failed
94b46f34 30
29967ef6 31const X_CORE: () = core::unimplemented!();
136023e0 32//~^ ERROR evaluation of constant value failed
94b46f34 33
29967ef6 34const W_CORE: () = core::panic!(MSG);
136023e0 35//~^ ERROR evaluation of constant value failed