diff --git a/src/test/ui/consts/const-err2.debug.stderr b/src/test/ui/consts/const-err2.default.stderr similarity index 100% rename from src/test/ui/consts/const-err2.debug.stderr rename to src/test/ui/consts/const-err2.default.stderr diff --git a/src/test/ui/consts/const-err2.noopt.stderr b/src/test/ui/consts/const-err2.noopt.stderr new file mode 100644 index 00000000000..226874c29da --- /dev/null +++ b/src/test/ui/consts/const-err2.noopt.stderr @@ -0,0 +1,48 @@ +error: this arithmetic operation will overflow + --> $DIR/const-err2.rs:19:13 + | +LL | let a = -std::i8::MIN; + | ^^^^^^^^^^^^^ attempt to negate with overflow + | + = note: `#[deny(overflow)]` on by default + +error: this arithmetic operation will overflow + --> $DIR/const-err2.rs:21:18 + | +LL | let a_i128 = -std::i128::MIN; + | ^^^^^^^^^^^^^^^ attempt to negate with overflow + +error: this arithmetic operation will overflow + --> $DIR/const-err2.rs:23:13 + | +LL | let b = 200u8 + 200u8 + 200u8; + | ^^^^^^^^^^^^^ attempt to add with overflow + +error: this arithmetic operation will overflow + --> $DIR/const-err2.rs:25:18 + | +LL | let b_i128 = std::i128::MIN - std::i128::MAX; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to subtract with overflow + +error: this arithmetic operation will overflow + --> $DIR/const-err2.rs:27:13 + | +LL | let c = 200u8 * 4; + | ^^^^^^^^^ attempt to multiply with overflow + +error: this arithmetic operation will overflow + --> $DIR/const-err2.rs:29:13 + | +LL | let d = 42u8 - (42u8 + 1); + | ^^^^^^^^^^^^^^^^^ attempt to subtract with overflow + +error: this operation will panic at runtime + --> $DIR/const-err2.rs:31:14 + | +LL | let _e = [5u8][1]; + | ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 + | + = note: `#[deny(panic)]` on by default + +error: aborting due to 7 previous errors + diff --git a/src/test/ui/consts/const-err2.rs b/src/test/ui/consts/const-err2.rs index 6ef4e17df83..2c0cae0e451 100644 --- a/src/test/ui/consts/const-err2.rs +++ b/src/test/ui/consts/const-err2.rs @@ -2,8 +2,8 @@ // optimized compilation and unoptimized compilation and thus would // lead to different lints being emitted -// revisions: debug opt opt_with_overflow_checks -//[debug]compile-flags: -C opt-level=0 +// revisions: default 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 diff --git a/src/test/ui/consts/const-eval/promoted_errors.default.stderr b/src/test/ui/consts/const-eval/promoted_errors.default.stderr new file mode 100644 index 00000000000..8f21ce53715 --- /dev/null +++ b/src/test/ui/consts/const-eval/promoted_errors.default.stderr @@ -0,0 +1,72 @@ +warning: this arithmetic operation will overflow + --> $DIR/promoted_errors.rs:14:14 + | +LL | let _x = 0u32 - 1; + | ^^^^^^^^ attempt to subtract with overflow + | +note: the lint level is defined here + --> $DIR/promoted_errors.rs:9:20 + | +LL | #![warn(const_err, overflow, panic)] + | ^^^^^^^^ + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ attempt to divide by zero + | +note: the lint level is defined here + --> $DIR/promoted_errors.rs:9:30 + | +LL | #![warn(const_err, overflow, panic)] + | ^^^^^ + +warning: reaching this expression at runtime will panic or abort + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ dividing by zero + | +note: the lint level is defined here + --> $DIR/promoted_errors.rs:9:9 + | +LL | #![warn(const_err, overflow, panic)] + | ^^^^^^^^^ + +warning: erroneous constant used + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ referenced constant has errors + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:20:14 + | +LL | let _x = 1 / (1 - 1); + | ^^^^^^^^^^^ attempt to divide by zero + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ attempt to divide by zero + +warning: reaching this expression at runtime will panic or abort + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ dividing by zero + +warning: erroneous constant used + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ referenced constant has errors + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:26:14 + | +LL | let _x = 1 / (false as u32); + | ^^^^^^^^^^^^^^^^^^ attempt to divide by zero + diff --git a/src/test/ui/consts/const-eval/promoted_errors.debug.stderr b/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr similarity index 100% rename from src/test/ui/consts/const-eval/promoted_errors.debug.stderr rename to src/test/ui/consts/const-eval/promoted_errors.noopt.stderr diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs index 5a4c7a66bf5..3133e9b380b 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.rs +++ b/src/test/ui/consts/const-eval/promoted_errors.rs @@ -1,5 +1,5 @@ -// revisions: debug opt opt_with_overflow_checks -//[debug]compile-flags: -C opt-level=0 +// revisions: default 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 @@ -10,7 +10,7 @@ fn main() { println!("{}", 0u32 - 1); - //[opt_with_overflow_checks,debug]~^ WARN [overflow] + //[opt_with_overflow_checks,noopt]~^ WARN [overflow] let _x = 0u32 - 1; //~^ WARN [overflow] println!("{}", 1 / (1 - 1)); diff --git a/src/test/ui/consts/issue-64059-2.rs b/src/test/ui/consts/issue-64059-2.rs deleted file mode 100644 index 38911c3dcf6..00000000000 --- a/src/test/ui/consts/issue-64059-2.rs +++ /dev/null @@ -1,6 +0,0 @@ -// compile-flags: -C overflow-checks=on -O -// run-pass - -fn main() { - let _ = -(-0.0); -} diff --git a/src/test/ui/consts/issue-64059.rs b/src/test/ui/consts/issue-64059.rs index c4c895fef66..16bfda3b961 100644 --- a/src/test/ui/consts/issue-64059.rs +++ b/src/test/ui/consts/issue-64059.rs @@ -1,3 +1,8 @@ +// revisions: default 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 + // run-pass fn main() { diff --git a/src/test/ui/issues/issue-8460-const.debug.stderr b/src/test/ui/issues/issue-8460-const.default.stderr similarity index 100% rename from src/test/ui/issues/issue-8460-const.debug.stderr rename to src/test/ui/issues/issue-8460-const.default.stderr diff --git a/src/test/ui/issues/issue-8460-const.noopt.stderr b/src/test/ui/issues/issue-8460-const.noopt.stderr new file mode 100644 index 00000000000..33d846e3e91 --- /dev/null +++ b/src/test/ui/issues/issue-8460-const.noopt.stderr @@ -0,0 +1,150 @@ +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:14:36 + | +LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^^^ attempt to divide with overflow + | + = note: `#[deny(overflow)]` on by default + +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:16:36 + | +LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^ attempt to divide with overflow + +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:18:36 + | +LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to divide with overflow + +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:20:36 + | +LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to divide with overflow + +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:22:36 + | +LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to divide with overflow + +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:24:36 + | +LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^^ attempt to divide with overflow + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:26:36 + | +LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); + | ^^^^^^^^^^ attempt to divide by zero + | + = note: `#[deny(panic)]` on by default + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:28:36 + | +LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); + | ^^^^^^^ attempt to divide by zero + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:30:36 + | +LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide by zero + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:32:36 + | +LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide by zero + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:34:36 + | +LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide by zero + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:36:36 + | +LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); + | ^^^^^^^^^ attempt to divide by zero + +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:38:36 + | +LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^^^ attempt to calculate the remainder with overflow + +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:40:36 + | +LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^ attempt to calculate the remainder with overflow + +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:42:36 + | +LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow + +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:44:36 + | +LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow + +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:46:36 + | +LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow + +error: this arithmetic operation will overflow + --> $DIR/issue-8460-const.rs:48:36 + | +LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^^ attempt to calculate the remainder with overflow + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:50:36 + | +LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); + | ^^^^^^^^^^ attempt to calculate the remainder with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:52:36 + | +LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); + | ^^^^^^^ attempt to calculate the remainder with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:54:36 + | +LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:56:36 + | +LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:58:36 + | +LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/issue-8460-const.rs:60:36 + | +LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); + | ^^^^^^^^^ attempt to calculate the remainder with a divisor of zero + +error: aborting due to 24 previous errors + diff --git a/src/test/ui/issues/issue-8460-const.rs b/src/test/ui/issues/issue-8460-const.rs index 3ab873952e2..d7276af40a7 100644 --- a/src/test/ui/issues/issue-8460-const.rs +++ b/src/test/ui/issues/issue-8460-const.rs @@ -1,5 +1,5 @@ -// revisions: debug opt opt_with_overflow_checks -//[debug]compile-flags: -C opt-level=0 +// revisions: default 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