more revisions and use them for another test
This commit is contained in:
parent
bd48522314
commit
9c7639492f
48
src/test/ui/consts/const-err2.noopt.stderr
Normal file
48
src/test/ui/consts/const-err2.noopt.stderr
Normal file
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
72
src/test/ui/consts/const-eval/promoted_errors.default.stderr
Normal file
72
src/test/ui/consts/const-eval/promoted_errors.default.stderr
Normal file
@ -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
|
||||
|
@ -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));
|
||||
|
@ -1,6 +0,0 @@
|
||||
// compile-flags: -C overflow-checks=on -O
|
||||
// run-pass
|
||||
|
||||
fn main() {
|
||||
let _ = -(-0.0);
|
||||
}
|
@ -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() {
|
||||
|
150
src/test/ui/issues/issue-8460-const.noopt.stderr
Normal file
150
src/test/ui/issues/issue-8460-const.noopt.stderr
Normal file
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user