Fix tests again
This commit is contained in:
parent
0cd9c1623f
commit
a937d8cdeb
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![allow(exceeding_bitshifts)]
|
#![allow(exceeding_bitshifts)]
|
||||||
// compile-flags: -C overflow-checks=on -O
|
|
||||||
|
|
||||||
#![deny(const_err)]
|
#![deny(const_err)]
|
||||||
|
|
||||||
@ -23,7 +22,7 @@ fn main() {
|
|||||||
let d = 42u8 - (42u8 + 1);
|
let d = 42u8 - (42u8 + 1);
|
||||||
//~^ ERROR const_err
|
//~^ ERROR const_err
|
||||||
let _e = [5u8][1];
|
let _e = [5u8][1];
|
||||||
//~^ ERROR const_err
|
//~^ ERROR index out of bounds
|
||||||
black_box(a);
|
black_box(a);
|
||||||
black_box(b);
|
black_box(b);
|
||||||
black_box(c);
|
black_box(c);
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
error: attempt to negate with overflow
|
error: this expression will panic at runtime
|
||||||
--> $DIR/const-err2.rs:17:13
|
--> $DIR/const-err2.rs:16:13
|
||||||
|
|
|
|
||||||
LL | let a = -std::i8::MIN;
|
LL | let a = -std::i8::MIN;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^ attempt to negate with overflow
|
||||||
|
|
|
|
||||||
note: lint level defined here
|
note: lint level defined here
|
||||||
--> $DIR/const-err2.rs:10:9
|
--> $DIR/const-err2.rs:9:9
|
||||||
|
|
|
|
||||||
LL | #![deny(const_err)]
|
LL | #![deny(const_err)]
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: attempt to add with overflow
|
error: this expression will panic at runtime
|
||||||
--> $DIR/const-err2.rs:19:13
|
--> $DIR/const-err2.rs:18:13
|
||||||
|
|
|
|
||||||
LL | let b = 200u8 + 200u8 + 200u8;
|
LL | let b = 200u8 + 200u8 + 200u8;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^ attempt to add with overflow
|
||||||
|
|
||||||
error: attempt to multiply with overflow
|
error: this expression will panic at runtime
|
||||||
--> $DIR/const-err2.rs:21:13
|
--> $DIR/const-err2.rs:20:13
|
||||||
|
|
|
|
||||||
LL | let c = 200u8 * 4;
|
LL | let c = 200u8 * 4;
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^ attempt to multiply with overflow
|
||||||
|
|
||||||
error: attempt to subtract with overflow
|
error: this expression will panic at runtime
|
||||||
--> $DIR/const-err2.rs:23:13
|
--> $DIR/const-err2.rs:22:13
|
||||||
|
|
|
|
||||||
LL | let d = 42u8 - (42u8 + 1);
|
LL | let d = 42u8 - (42u8 + 1);
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^ attempt to subtract with overflow
|
||||||
|
|
||||||
error: index out of bounds: the len is 1 but the index is 1
|
error: index out of bounds: the len is 1 but the index is 1
|
||||||
--> $DIR/const-err2.rs:25:14
|
--> $DIR/const-err2.rs:24:14
|
||||||
|
|
|
|
||||||
LL | let _e = [5u8][1];
|
LL | let _e = [5u8][1];
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
30
src/test/ui/consts/const-err3.rs
Normal file
30
src/test/ui/consts/const-err3.rs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// needed because negating int::MIN will behave differently between
|
||||||
|
// optimized compilation and unoptimized compilation and thus would
|
||||||
|
// lead to different lints being emitted
|
||||||
|
// compile-flags: -C overflow-checks=on -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 b = 200u8 + 200u8 + 200u8;
|
||||||
|
//~^ ERROR const_err
|
||||||
|
let c = 200u8 * 4;
|
||||||
|
//~^ ERROR const_err
|
||||||
|
let d = 42u8 - (42u8 + 1);
|
||||||
|
//~^ ERROR const_err
|
||||||
|
let _e = [5u8][1];
|
||||||
|
//~^ ERROR const_err
|
||||||
|
black_box(a);
|
||||||
|
black_box(b);
|
||||||
|
black_box(c);
|
||||||
|
black_box(d);
|
||||||
|
}
|
38
src/test/ui/consts/const-err3.stderr
Normal file
38
src/test/ui/consts/const-err3.stderr
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
error: attempt to negate with overflow
|
||||||
|
--> $DIR/const-err3.rs:16:13
|
||||||
|
|
|
||||||
|
LL | let a = -std::i8::MIN;
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
note: lint level defined here
|
||||||
|
--> $DIR/const-err3.rs:9:9
|
||||||
|
|
|
||||||
|
LL | #![deny(const_err)]
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to add with overflow
|
||||||
|
--> $DIR/const-err3.rs:18:13
|
||||||
|
|
|
||||||
|
LL | let b = 200u8 + 200u8 + 200u8;
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to multiply with overflow
|
||||||
|
--> $DIR/const-err3.rs:20:13
|
||||||
|
|
|
||||||
|
LL | let c = 200u8 * 4;
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to subtract with overflow
|
||||||
|
--> $DIR/const-err3.rs:22:13
|
||||||
|
|
|
||||||
|
LL | let d = 42u8 - (42u8 + 1);
|
||||||
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: index out of bounds: the len is 1 but the index is 1
|
||||||
|
--> $DIR/const-err3.rs:24:14
|
||||||
|
|
|
||||||
|
LL | let _e = [5u8][1];
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 5 previous errors
|
||||||
|
|
@ -1,12 +1,11 @@
|
|||||||
// compile-flags: -C overflow-checks=on -O
|
// compile-flags: -O
|
||||||
|
|
||||||
#![deny(const_err)]
|
#![deny(const_err)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("{}", 0u32 - 1);
|
println!("{}", 0u32 - 1);
|
||||||
//~^ ERROR attempt to subtract with overflow
|
|
||||||
let _x = 0u32 - 1;
|
let _x = 0u32 - 1;
|
||||||
//~^ ERROR attempt to subtract with overflow
|
//~^ ERROR const_err
|
||||||
println!("{}", 1/(1-1));
|
println!("{}", 1/(1-1));
|
||||||
//~^ ERROR attempt to divide by zero [const_err]
|
//~^ ERROR attempt to divide by zero [const_err]
|
||||||
//~| ERROR reaching this expression at runtime will panic or abort [const_err]
|
//~| ERROR reaching this expression at runtime will panic or abort [const_err]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
error: attempt to subtract with overflow
|
error: this expression will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:6:20
|
--> $DIR/promoted_errors.rs:7:14
|
||||||
|
|
|
|
||||||
LL | println!("{}", 0u32 - 1);
|
LL | let _x = 0u32 - 1;
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^ attempt to subtract with overflow
|
||||||
|
|
|
|
||||||
note: lint level defined here
|
note: lint level defined here
|
||||||
--> $DIR/promoted_errors.rs:3:9
|
--> $DIR/promoted_errors.rs:3:9
|
||||||
@ -10,59 +10,53 @@ note: lint level defined here
|
|||||||
LL | #![deny(const_err)]
|
LL | #![deny(const_err)]
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: attempt to subtract with overflow
|
|
||||||
--> $DIR/promoted_errors.rs:8:14
|
|
||||||
|
|
|
||||||
LL | let _x = 0u32 - 1;
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
||||||
error: attempt to divide by zero
|
error: attempt to divide by zero
|
||||||
--> $DIR/promoted_errors.rs:10:20
|
--> $DIR/promoted_errors.rs:9:20
|
||||||
|
|
|
|
||||||
LL | println!("{}", 1/(1-1));
|
LL | println!("{}", 1/(1-1));
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: reaching this expression at runtime will panic or abort
|
error: reaching this expression at runtime will panic or abort
|
||||||
--> $DIR/promoted_errors.rs:10:20
|
--> $DIR/promoted_errors.rs:9:20
|
||||||
|
|
|
|
||||||
LL | println!("{}", 1/(1-1));
|
LL | println!("{}", 1/(1-1));
|
||||||
| ^^^^^^^ attempt to divide by zero
|
| ^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
error: attempt to divide by zero
|
error: attempt to divide by zero
|
||||||
--> $DIR/promoted_errors.rs:13:14
|
--> $DIR/promoted_errors.rs:12:14
|
||||||
|
|
|
|
||||||
LL | let _x = 1/(1-1);
|
LL | let _x = 1/(1-1);
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
error: this expression will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:13:14
|
--> $DIR/promoted_errors.rs:12:14
|
||||||
|
|
|
|
||||||
LL | let _x = 1/(1-1);
|
LL | let _x = 1/(1-1);
|
||||||
| ^^^^^^^ attempt to divide by zero
|
| ^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
error: attempt to divide by zero
|
error: attempt to divide by zero
|
||||||
--> $DIR/promoted_errors.rs:16:20
|
--> $DIR/promoted_errors.rs:15:20
|
||||||
|
|
|
|
||||||
LL | println!("{}", 1/(false as u32));
|
LL | println!("{}", 1/(false as u32));
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: reaching this expression at runtime will panic or abort
|
error: reaching this expression at runtime will panic or abort
|
||||||
--> $DIR/promoted_errors.rs:16:20
|
--> $DIR/promoted_errors.rs:15:20
|
||||||
|
|
|
|
||||||
LL | println!("{}", 1/(false as u32));
|
LL | println!("{}", 1/(false as u32));
|
||||||
| ^^^^^^^^^^^^^^^^ attempt to divide by zero
|
| ^^^^^^^^^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
error: attempt to divide by zero
|
error: attempt to divide by zero
|
||||||
--> $DIR/promoted_errors.rs:19:14
|
--> $DIR/promoted_errors.rs:18:14
|
||||||
|
|
|
|
||||||
LL | let _x = 1/(false as u32);
|
LL | let _x = 1/(false as u32);
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
error: this expression will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:19:14
|
--> $DIR/promoted_errors.rs:18:14
|
||||||
|
|
|
|
||||||
LL | let _x = 1/(false as u32);
|
LL | let _x = 1/(false as u32);
|
||||||
| ^^^^^^^^^^^^^^^^ attempt to divide by zero
|
| ^^^^^^^^^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
error: aborting due to 10 previous errors
|
error: aborting due to 9 previous errors
|
||||||
|
|
||||||
|
22
src/test/ui/consts/const-eval/promoted_errors2.rs
Normal file
22
src/test/ui/consts/const-eval/promoted_errors2.rs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// compile-flags: -C overflow-checks=on -O
|
||||||
|
|
||||||
|
#![deny(const_err)]
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("{}", 0u32 - 1);
|
||||||
|
//~^ ERROR attempt to subtract with overflow
|
||||||
|
let _x = 0u32 - 1;
|
||||||
|
//~^ ERROR attempt to subtract with overflow
|
||||||
|
println!("{}", 1/(1-1));
|
||||||
|
//~^ ERROR attempt to divide by zero [const_err]
|
||||||
|
//~| ERROR reaching this expression at runtime will panic or abort [const_err]
|
||||||
|
let _x = 1/(1-1);
|
||||||
|
//~^ ERROR const_err
|
||||||
|
//~| ERROR const_err
|
||||||
|
println!("{}", 1/(false as u32));
|
||||||
|
//~^ ERROR attempt to divide by zero [const_err]
|
||||||
|
//~| ERROR reaching this expression at runtime will panic or abort [const_err]
|
||||||
|
let _x = 1/(false as u32);
|
||||||
|
//~^ ERROR const_err
|
||||||
|
//~| ERROR const_err
|
||||||
|
}
|
68
src/test/ui/consts/const-eval/promoted_errors2.stderr
Normal file
68
src/test/ui/consts/const-eval/promoted_errors2.stderr
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
error: attempt to subtract with overflow
|
||||||
|
--> $DIR/promoted_errors2.rs:6:20
|
||||||
|
|
|
||||||
|
LL | println!("{}", 0u32 - 1);
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
|
||||||
|
note: lint level defined here
|
||||||
|
--> $DIR/promoted_errors2.rs:3:9
|
||||||
|
|
|
||||||
|
LL | #![deny(const_err)]
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to subtract with overflow
|
||||||
|
--> $DIR/promoted_errors2.rs:8:14
|
||||||
|
|
|
||||||
|
LL | let _x = 0u32 - 1;
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to divide by zero
|
||||||
|
--> $DIR/promoted_errors2.rs:10:20
|
||||||
|
|
|
||||||
|
LL | println!("{}", 1/(1-1));
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: reaching this expression at runtime will panic or abort
|
||||||
|
--> $DIR/promoted_errors2.rs:10:20
|
||||||
|
|
|
||||||
|
LL | println!("{}", 1/(1-1));
|
||||||
|
| ^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
|
error: attempt to divide by zero
|
||||||
|
--> $DIR/promoted_errors2.rs:13:14
|
||||||
|
|
|
||||||
|
LL | let _x = 1/(1-1);
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/promoted_errors2.rs:13:14
|
||||||
|
|
|
||||||
|
LL | let _x = 1/(1-1);
|
||||||
|
| ^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
|
error: attempt to divide by zero
|
||||||
|
--> $DIR/promoted_errors2.rs:16:20
|
||||||
|
|
|
||||||
|
LL | println!("{}", 1/(false as u32));
|
||||||
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: reaching this expression at runtime will panic or abort
|
||||||
|
--> $DIR/promoted_errors2.rs:16:20
|
||||||
|
|
|
||||||
|
LL | println!("{}", 1/(false as u32));
|
||||||
|
| ^^^^^^^^^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
|
error: attempt to divide by zero
|
||||||
|
--> $DIR/promoted_errors2.rs:19:14
|
||||||
|
|
|
||||||
|
LL | let _x = 1/(false as u32);
|
||||||
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/promoted_errors2.rs:19:14
|
||||||
|
|
|
||||||
|
LL | let _x = 1/(false as u32);
|
||||||
|
| ^^^^^^^^^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
|
error: aborting due to 10 previous errors
|
||||||
|
|
6
src/test/ui/consts/issue-64059-2.rs
Normal file
6
src/test/ui/consts/issue-64059-2.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// compile-flags: -C overflow-checks=on -O
|
||||||
|
// run-pass
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let _ = -(-0.0);
|
||||||
|
}
|
@ -1,4 +1,3 @@
|
|||||||
// compile-flags: -C overflow-checks=on -O
|
|
||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// compile-flags: -C overflow-checks=on -O
|
|
||||||
|
|
||||||
#![deny(const_err)]
|
#![deny(const_err)]
|
||||||
|
|
||||||
use std::{isize, i8, i16, i32, i64};
|
use std::{isize, i8, i16, i32, i64};
|
||||||
@ -8,14 +6,19 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
|
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
|
||||||
//~^ ERROR attempt to divide with overflow
|
//~^ ERROR attempt to divide with overflow
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
||||||
//~^ ERROR attempt to divide with overflow
|
//~^ ERROR attempt to divide with overflow
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
||||||
//~^ ERROR attempt to divide with overflow
|
//~^ ERROR attempt to divide with overflow
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
||||||
//~^ ERROR attempt to divide with overflow
|
//~^ ERROR attempt to divide with overflow
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
||||||
//~^ ERROR attempt to divide with overflow
|
//~^ ERROR attempt to divide with overflow
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
||||||
//~^ ERROR attempt to divide by zero
|
//~^ ERROR attempt to divide by zero
|
||||||
//~| ERROR this expression will panic at runtime
|
//~| ERROR this expression will panic at runtime
|
||||||
@ -33,14 +36,19 @@ fn main() {
|
|||||||
//~| ERROR this expression will panic at runtime
|
//~| ERROR this expression will panic at runtime
|
||||||
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
||||||
//~^ ERROR attempt to calculate the remainder with overflow
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
|
||||||
//~^ ERROR attempt to calculate the remainder with overflow
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
||||||
//~^ ERROR attempt to calculate the remainder with overflow
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
||||||
//~^ ERROR attempt to calculate the remainder with overflow
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
||||||
//~^ ERROR attempt to calculate the remainder with overflow
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
||||||
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||||
//~| ERROR this expression will panic at runtime
|
//~| ERROR this expression will panic at runtime
|
||||||
|
@ -1,188 +1,248 @@
|
|||||||
error: attempt to divide with overflow
|
error: attempt to divide with overflow
|
||||||
--> $DIR/issue-8460-const.rs:9:36
|
--> $DIR/issue-8460-const.rs:7:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: lint level defined here
|
note: lint level defined here
|
||||||
--> $DIR/issue-8460-const.rs:3:9
|
--> $DIR/issue-8460-const.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(const_err)]
|
LL | #![deny(const_err)]
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const.rs:7:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^^^ attempt to divide with overflow
|
||||||
|
|
||||||
error: attempt to divide with overflow
|
error: attempt to divide with overflow
|
||||||
--> $DIR/issue-8460-const.rs:11:36
|
--> $DIR/issue-8460-const.rs:10:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const.rs:10:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^ attempt to divide with overflow
|
||||||
|
|
||||||
error: attempt to divide with overflow
|
error: attempt to divide with overflow
|
||||||
--> $DIR/issue-8460-const.rs:13:36
|
--> $DIR/issue-8460-const.rs:13:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const.rs:13:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^ attempt to divide with overflow
|
||||||
|
|
||||||
error: attempt to divide with overflow
|
error: attempt to divide with overflow
|
||||||
--> $DIR/issue-8460-const.rs:15:36
|
--> $DIR/issue-8460-const.rs:16:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const.rs:16:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^ attempt to divide with overflow
|
||||||
|
|
||||||
error: attempt to divide with overflow
|
error: attempt to divide with overflow
|
||||||
--> $DIR/issue-8460-const.rs:17:36
|
--> $DIR/issue-8460-const.rs:19:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: attempt to divide by zero
|
error: this expression will panic at runtime
|
||||||
--> $DIR/issue-8460-const.rs:19:36
|
--> $DIR/issue-8460-const.rs:19:36
|
||||||
|
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^ attempt to divide with overflow
|
||||||
|
|
||||||
|
error: attempt to divide by zero
|
||||||
|
--> $DIR/issue-8460-const.rs:22:36
|
||||||
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
error: this expression will panic at runtime
|
||||||
--> $DIR/issue-8460-const.rs:19:36
|
--> $DIR/issue-8460-const.rs:22:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
||||||
| ^^^^^^^^^^ attempt to divide by zero
|
| ^^^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
error: attempt to divide by zero
|
error: attempt to divide by zero
|
||||||
--> $DIR/issue-8460-const.rs:22:36
|
--> $DIR/issue-8460-const.rs:25:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
error: this expression will panic at runtime
|
||||||
--> $DIR/issue-8460-const.rs:22:36
|
--> $DIR/issue-8460-const.rs:25:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
||||||
| ^^^^^^^ attempt to divide by zero
|
| ^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
error: attempt to divide by zero
|
error: attempt to divide by zero
|
||||||
--> $DIR/issue-8460-const.rs:25:36
|
--> $DIR/issue-8460-const.rs:28:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
error: this expression will panic at runtime
|
||||||
--> $DIR/issue-8460-const.rs:25:36
|
--> $DIR/issue-8460-const.rs:28:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
||||||
| ^^^^^^^^ attempt to divide by zero
|
| ^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
error: attempt to divide by zero
|
|
||||||
--> $DIR/issue-8460-const.rs:28:36
|
|
||||||
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
|
||||||
--> $DIR/issue-8460-const.rs:28:36
|
|
||||||
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
|
||||||
| ^^^^^^^^ attempt to divide by zero
|
|
||||||
|
|
||||||
error: attempt to divide by zero
|
error: attempt to divide by zero
|
||||||
--> $DIR/issue-8460-const.rs:31:36
|
--> $DIR/issue-8460-const.rs:31:36
|
||||||
|
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const.rs:31:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
|
error: attempt to divide by zero
|
||||||
|
--> $DIR/issue-8460-const.rs:34:36
|
||||||
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
error: this expression will panic at runtime
|
||||||
--> $DIR/issue-8460-const.rs:31:36
|
--> $DIR/issue-8460-const.rs:34:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
||||||
| ^^^^^^^^ attempt to divide by zero
|
| ^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
error: attempt to calculate the remainder with overflow
|
error: attempt to calculate the remainder with overflow
|
||||||
--> $DIR/issue-8460-const.rs:34:36
|
--> $DIR/issue-8460-const.rs:37:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: attempt to calculate the remainder with overflow
|
error: this expression will panic at runtime
|
||||||
--> $DIR/issue-8460-const.rs:36:36
|
--> $DIR/issue-8460-const.rs:37:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^ attempt to calculate the remainder with overflow
|
||||||
|
|
||||||
error: attempt to calculate the remainder with overflow
|
|
||||||
--> $DIR/issue-8460-const.rs:38:36
|
|
||||||
|
|
|
||||||
LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
|
||||||
| ^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: attempt to calculate the remainder with overflow
|
error: attempt to calculate the remainder with overflow
|
||||||
--> $DIR/issue-8460-const.rs:40:36
|
--> $DIR/issue-8460-const.rs:40:36
|
||||||
|
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $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: attempt to calculate the remainder with overflow
|
||||||
|
--> $DIR/issue-8460-const.rs:43:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const.rs:43:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow
|
||||||
|
|
||||||
|
error: attempt to calculate the remainder with overflow
|
||||||
|
--> $DIR/issue-8460-const.rs:46:36
|
||||||
|
|
|
||||||
LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const.rs:46:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow
|
||||||
|
|
||||||
error: attempt to calculate the remainder with overflow
|
error: attempt to calculate the remainder with overflow
|
||||||
--> $DIR/issue-8460-const.rs:42:36
|
--> $DIR/issue-8460-const.rs:49:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const.rs:49:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow
|
||||||
|
|
||||||
error: attempt to calculate the remainder with a divisor of zero
|
error: attempt to calculate the remainder with a divisor of zero
|
||||||
--> $DIR/issue-8460-const.rs:44:36
|
--> $DIR/issue-8460-const.rs:52:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
error: this expression will panic at runtime
|
||||||
--> $DIR/issue-8460-const.rs:44:36
|
--> $DIR/issue-8460-const.rs:52:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
||||||
| ^^^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
| ^^^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
||||||
|
|
||||||
error: attempt to calculate the remainder with a divisor of zero
|
error: attempt to calculate the remainder with a divisor of zero
|
||||||
--> $DIR/issue-8460-const.rs:47:36
|
--> $DIR/issue-8460-const.rs:55:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
error: this expression will panic at runtime
|
||||||
--> $DIR/issue-8460-const.rs:47:36
|
--> $DIR/issue-8460-const.rs:55:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
||||||
| ^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
| ^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
||||||
|
|
||||||
error: attempt to calculate the remainder with a divisor of zero
|
error: attempt to calculate the remainder with a divisor of zero
|
||||||
--> $DIR/issue-8460-const.rs:50:36
|
--> $DIR/issue-8460-const.rs:58:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
error: this expression will panic at runtime
|
||||||
--> $DIR/issue-8460-const.rs:50:36
|
--> $DIR/issue-8460-const.rs:58:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
||||||
| ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
| ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
||||||
|
|
||||||
error: attempt to calculate the remainder with a divisor of zero
|
error: attempt to calculate the remainder with a divisor of zero
|
||||||
--> $DIR/issue-8460-const.rs:53:36
|
--> $DIR/issue-8460-const.rs:61:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
error: this expression will panic at runtime
|
||||||
--> $DIR/issue-8460-const.rs:53:36
|
--> $DIR/issue-8460-const.rs:61:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
||||||
| ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
| ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
||||||
|
|
||||||
error: attempt to calculate the remainder with a divisor of zero
|
error: attempt to calculate the remainder with a divisor of zero
|
||||||
--> $DIR/issue-8460-const.rs:56:36
|
--> $DIR/issue-8460-const.rs:64:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: this expression will panic at runtime
|
error: this expression will panic at runtime
|
||||||
--> $DIR/issue-8460-const.rs:56:36
|
--> $DIR/issue-8460-const.rs:64:36
|
||||||
|
|
|
|
||||||
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
||||||
| ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
| ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
||||||
|
|
||||||
error: aborting due to 30 previous errors
|
error: aborting due to 40 previous errors
|
||||||
|
|
||||||
|
59
src/test/ui/issues/issue-8460-const2.rs
Normal file
59
src/test/ui/issues/issue-8460-const2.rs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// compile-flags: -C overflow-checks=on -O
|
||||||
|
|
||||||
|
#![deny(const_err)]
|
||||||
|
|
||||||
|
use std::{isize, i8, i16, i32, i64};
|
||||||
|
use std::thread;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to divide with overflow
|
||||||
|
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to divide with overflow
|
||||||
|
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to divide with overflow
|
||||||
|
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to divide with overflow
|
||||||
|
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to divide with overflow
|
||||||
|
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to divide by zero
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
|
assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to divide by zero
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
|
assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to divide by zero
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
|
assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to divide by zero
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
|
assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to divide by zero
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
|
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
|
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
|
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
|
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
|
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
|
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
|
assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
|
assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
|
assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
|
assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
||||||
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||||
|
//~| ERROR this expression will panic at runtime
|
||||||
|
}
|
188
src/test/ui/issues/issue-8460-const2.stderr
Normal file
188
src/test/ui/issues/issue-8460-const2.stderr
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
error: attempt to divide with overflow
|
||||||
|
--> $DIR/issue-8460-const2.rs:9:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
note: lint level defined here
|
||||||
|
--> $DIR/issue-8460-const2.rs:3:9
|
||||||
|
|
|
||||||
|
LL | #![deny(const_err)]
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to divide with overflow
|
||||||
|
--> $DIR/issue-8460-const2.rs:11:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to divide with overflow
|
||||||
|
--> $DIR/issue-8460-const2.rs:13:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to divide with overflow
|
||||||
|
--> $DIR/issue-8460-const2.rs:15:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to divide with overflow
|
||||||
|
--> $DIR/issue-8460-const2.rs:17:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to divide by zero
|
||||||
|
--> $DIR/issue-8460-const2.rs:19:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const2.rs:19:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
|
error: attempt to divide by zero
|
||||||
|
--> $DIR/issue-8460-const2.rs:22:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const2.rs:22:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
|
error: attempt to divide by zero
|
||||||
|
--> $DIR/issue-8460-const2.rs:25:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const2.rs:25:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
|
error: attempt to divide by zero
|
||||||
|
--> $DIR/issue-8460-const2.rs:28:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const2.rs:28:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
|
error: attempt to divide by zero
|
||||||
|
--> $DIR/issue-8460-const2.rs:31:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const2.rs:31:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^ attempt to divide by zero
|
||||||
|
|
||||||
|
error: attempt to calculate the remainder with overflow
|
||||||
|
--> $DIR/issue-8460-const2.rs:34:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to calculate the remainder with overflow
|
||||||
|
--> $DIR/issue-8460-const2.rs:36:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to calculate the remainder with overflow
|
||||||
|
--> $DIR/issue-8460-const2.rs:38:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to calculate the remainder with overflow
|
||||||
|
--> $DIR/issue-8460-const2.rs:40:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to calculate the remainder with overflow
|
||||||
|
--> $DIR/issue-8460-const2.rs:42:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: attempt to calculate the remainder with a divisor of zero
|
||||||
|
--> $DIR/issue-8460-const2.rs:44:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const2.rs:44:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
||||||
|
|
||||||
|
error: attempt to calculate the remainder with a divisor of zero
|
||||||
|
--> $DIR/issue-8460-const2.rs:47:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const2.rs:47:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
||||||
|
| ^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
||||||
|
|
||||||
|
error: attempt to calculate the remainder with a divisor of zero
|
||||||
|
--> $DIR/issue-8460-const2.rs:50:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const2.rs:50:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
||||||
|
|
||||||
|
error: attempt to calculate the remainder with a divisor of zero
|
||||||
|
--> $DIR/issue-8460-const2.rs:53:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const2.rs:53:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
||||||
|
|
||||||
|
error: attempt to calculate the remainder with a divisor of zero
|
||||||
|
--> $DIR/issue-8460-const2.rs:56:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: this expression will panic at runtime
|
||||||
|
--> $DIR/issue-8460-const2.rs:56:36
|
||||||
|
|
|
||||||
|
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
||||||
|
| ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
|
||||||
|
|
||||||
|
error: aborting due to 30 previous errors
|
||||||
|
|
Loading…
Reference in New Issue
Block a user