consolidate tests

This commit is contained in:
James Dietz 2024-02-18 12:31:03 -05:00
parent d8b00690ec
commit 03f095f9f2
23 changed files with 1169 additions and 1184 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,8 @@ const BITS: usize = 32;
#[cfg(target_pointer_width = "64")]
const BITS: usize = 64;
use std::thread;
fn main() {
// Shift left
let _n = 1u8 << 8; //~ ERROR: arithmetic operation will overflow
@ -59,8 +61,15 @@ fn main() {
let _n = 1_usize << BITS; //~ ERROR: arithmetic operation will overflow
let _n = &(1_usize << BITS); //~ ERROR: arithmetic operation will overflow
let _n = 1 << -1; //~ ERROR: arithmetic operation will overflow
let _n = &(1 << -1); //~ ERROR: arithmetic operation will overflow
// Shift right
let _n = -1_i64 >> 64; //~ ERROR: arithmetic operation will overflow
let _n = -1_i32 >> 32; //~ ERROR: arithmetic operation will overflow
let _n = -1_i32 >> -1; //~ ERROR: arithmetic operation will overflow
let _n = 1u8 >> 8; //~ ERROR: arithmetic operation will overflow
let _n = &(1u8 >> 8); //~ ERROR: arithmetic operation will overflow
@ -97,6 +106,8 @@ fn main() {
let _n = 1_usize >> BITS; //~ ERROR: arithmetic operation will overflow
let _n = &(1_usize >> BITS); //~ ERROR: arithmetic operation will overflow
let _n = 1i64 >> [64][0]; //~ ERROR: arithmetic operation will overflow
let _n = &(1i64 >> [64][0]); //~ ERROR: arithmetic operation will overflow
// Addition
let _n = 1u8 + u8::MAX; //~ ERROR: arithmetic operation will overflow
@ -211,6 +222,9 @@ fn main() {
let _n = usize::MAX * 5; //~ ERROR: arithmetic operation will overflow
let _n = &(usize::MAX * 5); //~ ERROR: arithmetic operation will overflow
let _x = -i8::MIN; //~ ERROR this arithmetic operation will overflow
let _x = &(-i8::MIN); //~ ERROR this arithmetic operation will overflow
// Division
let _n = 1u8 / 0; //~ ERROR: this operation will panic at runtime
@ -291,4 +305,55 @@ fn main() {
// Out of bounds access
let _n = [1, 2, 3][4]; //~ ERROR: this operation will panic at runtime
let _n = &([1, 2, 3][4]); //~ ERROR: this operation will panic at runtime
// issue-8460-const
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
//~^ ERROR operation will panic
}

View File

@ -1,148 +0,0 @@
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:11:36
|
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
|
= note: `#[deny(unconditional_panic)]` on by default
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:13:36
|
LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:15:36
|
LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:17:36
|
LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:19:36
|
LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:21:36
|
LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:23:36
|
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
| ^^^^^^^^^^ attempt to divide `1_isize` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:25:36
|
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
| ^^^^^^^ attempt to divide `1_i8` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:27:36
|
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide `1_i16` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:29:36
|
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide `1_i32` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:31:36
|
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide `1_i64` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:33:36
|
LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
| ^^^^^^^^^ attempt to divide `1_i128` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:35:36
|
LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:37:36
|
LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:39:36
|
LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:41:36
|
LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:43:36
|
LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:45:36
|
LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:47:36
|
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
| ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:49:36
|
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
| ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:51:36
|
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:53:36
|
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:55:36
|
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:57:36
|
LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
| ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
error: aborting due to 24 previous errors

View File

@ -1,148 +0,0 @@
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:11:36
|
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
|
= note: `#[deny(unconditional_panic)]` on by default
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:13:36
|
LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:15:36
|
LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:17:36
|
LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:19:36
|
LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:21:36
|
LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:23:36
|
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
| ^^^^^^^^^^ attempt to divide `1_isize` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:25:36
|
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
| ^^^^^^^ attempt to divide `1_i8` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:27:36
|
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide `1_i16` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:29:36
|
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide `1_i32` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:31:36
|
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide `1_i64` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:33:36
|
LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
| ^^^^^^^^^ attempt to divide `1_i128` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:35:36
|
LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:37:36
|
LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:39:36
|
LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:41:36
|
LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:43:36
|
LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:45:36
|
LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:47:36
|
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
| ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:49:36
|
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
| ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:51:36
|
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:53:36
|
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:55:36
|
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:57:36
|
LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
| ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
error: aborting due to 24 previous errors

View File

@ -1,148 +0,0 @@
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:11:36
|
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
|
= note: `#[deny(unconditional_panic)]` on by default
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:13:36
|
LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:15:36
|
LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:17:36
|
LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:19:36
|
LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:21:36
|
LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:23:36
|
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
| ^^^^^^^^^^ attempt to divide `1_isize` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:25:36
|
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
| ^^^^^^^ attempt to divide `1_i8` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:27:36
|
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide `1_i16` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:29:36
|
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide `1_i32` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:31:36
|
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide `1_i64` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:33:36
|
LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
| ^^^^^^^^^ attempt to divide `1_i128` by zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:35:36
|
LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:37:36
|
LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:39:36
|
LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:41:36
|
LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:43:36
|
LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:45:36
|
LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:47:36
|
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
| ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:49:36
|
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
| ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:51:36
|
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:53:36
|
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:55:36
|
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:57:36
|
LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
| ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
error: aborting due to 24 previous errors

View File

@ -1,59 +0,0 @@
//@ 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
use std::thread;
fn main() {
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
//~^ ERROR operation will panic
}

View File

@ -1,9 +0,0 @@
//@ build-fail
//@ compile-flags: -C debug-assertions
#![deny(arithmetic_overflow)]
fn main() {
let _x = 1_i32 << 32;
//~^ ERROR: this arithmetic operation will overflow
}

View File

@ -1,14 +0,0 @@
error: this arithmetic operation will overflow
--> $DIR/overflowing-lsh-1.rs:7:14
|
LL | let _x = 1_i32 << 32;
| ^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow
|
note: the lint level is defined here
--> $DIR/overflowing-lsh-1.rs:4:9
|
LL | #![deny(arithmetic_overflow)]
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error

View File

@ -1,9 +0,0 @@
//@ build-fail
//@ compile-flags: -C debug-assertions
#![deny(arithmetic_overflow)]
fn main() {
let _x = 1 << -1;
//~^ ERROR: this arithmetic operation will overflow
}

View File

@ -1,14 +0,0 @@
error: this arithmetic operation will overflow
--> $DIR/overflowing-lsh-2.rs:7:14
|
LL | let _x = 1 << -1;
| ^^^^^^^ attempt to shift left by `-1_i32`, which would overflow
|
note: the lint level is defined here
--> $DIR/overflowing-lsh-2.rs:4:9
|
LL | #![deny(arithmetic_overflow)]
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error

View File

@ -1,9 +0,0 @@
//@ build-fail
//@ compile-flags: -C debug-assertions
#![deny(arithmetic_overflow)]
fn main() {
let _x = 1_u64 << 64;
//~^ ERROR: this arithmetic operation will overflow
}

View File

@ -1,14 +0,0 @@
error: this arithmetic operation will overflow
--> $DIR/overflowing-lsh-3.rs:7:14
|
LL | let _x = 1_u64 << 64;
| ^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow
|
note: the lint level is defined here
--> $DIR/overflowing-lsh-3.rs:4:9
|
LL | #![deny(arithmetic_overflow)]
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error

View File

@ -1,10 +0,0 @@
//@ run-fail
//@ error-pattern:attempt to negate with overflow
//@ ignore-emscripten no processes
//@ compile-flags: -C debug-assertions
#![allow(arithmetic_overflow)]
fn main() {
let _x = -i8::MIN;
}

View File

@ -1,9 +0,0 @@
//@ build-fail
//@ compile-flags: -C debug-assertions
#![deny(arithmetic_overflow)]
fn main() {
let _x = -1_i32 >> 32;
//~^ ERROR: this arithmetic operation will overflow
}

View File

@ -1,14 +0,0 @@
error: this arithmetic operation will overflow
--> $DIR/overflowing-rsh-1.rs:7:14
|
LL | let _x = -1_i32 >> 32;
| ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow
|
note: the lint level is defined here
--> $DIR/overflowing-rsh-1.rs:4:9
|
LL | #![deny(arithmetic_overflow)]
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error

View File

@ -1,9 +0,0 @@
//@ build-fail
//@ compile-flags: -C debug-assertions
#![deny(arithmetic_overflow)]
fn main() {
let _x = -1_i32 >> -1;
//~^ ERROR: this arithmetic operation will overflow
}

View File

@ -1,14 +0,0 @@
error: this arithmetic operation will overflow
--> $DIR/overflowing-rsh-2.rs:7:14
|
LL | let _x = -1_i32 >> -1;
| ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow
|
note: the lint level is defined here
--> $DIR/overflowing-rsh-2.rs:4:9
|
LL | #![deny(arithmetic_overflow)]
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error

View File

@ -1,9 +0,0 @@
//@ build-fail
//@ compile-flags: -C debug-assertions
#![deny(arithmetic_overflow)]
fn main() {
let _x = -1_i64 >> 64;
//~^ ERROR: this arithmetic operation will overflow
}

View File

@ -1,14 +0,0 @@
error: this arithmetic operation will overflow
--> $DIR/overflowing-rsh-3.rs:7:14
|
LL | let _x = -1_i64 >> 64;
| ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
|
note: the lint level is defined here
--> $DIR/overflowing-rsh-3.rs:4:9
|
LL | #![deny(arithmetic_overflow)]
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error

View File

@ -1,9 +0,0 @@
//@ build-fail
//@ compile-flags: -C debug-assertions
#![deny(arithmetic_overflow)]
fn main() {
let _n = 1i64 >> [64][0];
//~^ ERROR: this arithmetic operation will overflow
}

View File

@ -1,14 +0,0 @@
error: this arithmetic operation will overflow
--> $DIR/overflowing-rsh-5.rs:7:14
|
LL | let _n = 1i64 >> [64][0];
| ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
|
note: the lint level is defined here
--> $DIR/overflowing-rsh-5.rs:4:9
|
LL | #![deny(arithmetic_overflow)]
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error