]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/consts/const-err2.rs
Update tests to remove old numeric constants
[rust.git] / src / test / ui / consts / const-err2.rs
index 7c5aaedda35fa484baf97b385a8e70f465037b60..db49ec25aaaeb70ff10d269bd0400355f5ca9aaf 100644 (file)
@@ -2,33 +2,34 @@
 // optimized compilation and unoptimized compilation and thus would
 // lead to different lints being emitted
 
+// revisions: noopt opt opt_with_overflow_checks
+//[noopt]compile-flags: -C opt-level=0
+//[opt]compile-flags: -O
+//[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O
+
 // build-fail
-// compile-flags: -O
 
 #![feature(rustc_attrs)]
-#![allow(exceeding_bitshifts)]
-
-#![deny(const_err)]
 
 fn black_box<T>(_: T) {
     unimplemented!()
 }
 
 fn main() {
-    let a = -std::i8::MIN;
-    //~^ ERROR const_err
-    let a_i128 = -std::i128::MIN;
-    //~^ ERROR const_err
+    let a = -i8::MIN;
+    //~^ ERROR arithmetic operation will overflow
+    let a_i128 = -i128::MIN;
+    //~^ ERROR arithmetic operation will overflow
     let b = 200u8 + 200u8 + 200u8;
-    //~^ ERROR const_err
-    let b_i128 = std::i128::MIN - std::i128::MAX;
-    //~^ ERROR const_err
+    //~^ ERROR arithmetic operation will overflow
+    let b_i128 = i128::MIN - i128::MAX;
+    //~^ ERROR arithmetic operation will overflow
     let c = 200u8 * 4;
-    //~^ ERROR const_err
+    //~^ ERROR arithmetic operation will overflow
     let d = 42u8 - (42u8 + 1);
-    //~^ ERROR const_err
+    //~^ ERROR arithmetic operation will overflow
     let _e = [5u8][1];
-    //~^ ERROR const_err
+    //~^ ERROR operation will panic
     black_box(a);
     black_box(a_i128);
     black_box(b);