]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/const-eval/promoted_errors.rs
1 // revisions: noopt opt opt_with_overflow_checks
2 //[noopt]compile-flags: -C opt-level=0
3 //[opt]compile-flags: -O
4 //[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O
7 // ignore-pass (test emits codegen-time warnings and verifies that they are not errors)
9 #![warn(const_err, arithmetic_overflow, unconditional_panic)]
12 println
!("{}", 0u32 - 1);
13 //[opt_with_overflow_checks,noopt]~^ WARN [arithmetic_overflow]
15 //~^ WARN [arithmetic_overflow]
16 println
!("{}", 1 / (1 - 1));
17 //~^ WARN [unconditional_panic]
18 //~| WARN panic or abort [const_err]
19 //~| WARN erroneous constant used [const_err]
21 //~^ WARN [unconditional_panic]
22 println
!("{}", 1 / (false as u32));
23 //~^ WARN [unconditional_panic]
24 //~| WARN panic or abort [const_err]
25 //~| WARN erroneous constant used [const_err]
26 let _x
= 1 / (false as u32);
27 //~^ WARN [unconditional_panic]