Add compile flag

This commit is contained in:
Yuki Okushi 2019-09-04 18:32:00 +09:00
parent a937d8cdeb
commit 41deb83549
2 changed files with 43 additions and 41 deletions

View file

@ -1,3 +1,5 @@
// compile-flags: -O
#![deny(const_err)]
use std::{isize, i8, i16, i32, i64};

View file

@ -1,245 +1,245 @@
error: attempt to divide with overflow
--> $DIR/issue-8460-const.rs:7:36
--> $DIR/issue-8460-const.rs:9:36
|
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/issue-8460-const.rs:1:9
--> $DIR/issue-8460-const.rs:3:9
|
LL | #![deny(const_err)]
| ^^^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:7:36
--> $DIR/issue-8460-const.rs:9:36
|
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to divide with overflow
error: attempt to divide with overflow
--> $DIR/issue-8460-const.rs:10:36
--> $DIR/issue-8460-const.rs:12:36
|
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
--> $DIR/issue-8460-const.rs:12:36
|
LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to divide with overflow
error: attempt to divide with overflow
--> $DIR/issue-8460-const.rs:13:36
--> $DIR/issue-8460-const.rs:15:36
|
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
--> $DIR/issue-8460-const.rs:15:36
|
LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to divide with overflow
error: attempt to divide with overflow
--> $DIR/issue-8460-const.rs:16:36
--> $DIR/issue-8460-const.rs:18:36
|
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
--> $DIR/issue-8460-const.rs:18:36
|
LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to divide with overflow
error: attempt to divide with overflow
--> $DIR/issue-8460-const.rs:19:36
--> $DIR/issue-8460-const.rs:21:36
|
LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:19:36
--> $DIR/issue-8460-const.rs:21: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
--> $DIR/issue-8460-const.rs:24:36
|
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
| ^^^^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:22:36
--> $DIR/issue-8460-const.rs:24: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-const.rs:25:36
--> $DIR/issue-8460-const.rs:27:36
|
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
| ^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:25:36
--> $DIR/issue-8460-const.rs:27: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-const.rs:28:36
--> $DIR/issue-8460-const.rs:30:36
|
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
| ^^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:28:36
--> $DIR/issue-8460-const.rs:30: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-const.rs:31:36
--> $DIR/issue-8460-const.rs:33: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
--> $DIR/issue-8460-const.rs:33: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
--> $DIR/issue-8460-const.rs:36:36
|
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
| ^^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:34:36
--> $DIR/issue-8460-const.rs:36: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-const.rs:37:36
--> $DIR/issue-8460-const.rs:39:36
|
LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:37:36
--> $DIR/issue-8460-const.rs:39:36
|
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:40:36
--> $DIR/issue-8460-const.rs:42: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
--> $DIR/issue-8460-const.rs:42: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
--> $DIR/issue-8460-const.rs:45: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
--> $DIR/issue-8460-const.rs:45: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
--> $DIR/issue-8460-const.rs:48:36
|
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
--> $DIR/issue-8460-const.rs:48: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
--> $DIR/issue-8460-const.rs:49:36
--> $DIR/issue-8460-const.rs:51:36
|
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
--> $DIR/issue-8460-const.rs:51: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
--> $DIR/issue-8460-const.rs:52:36
--> $DIR/issue-8460-const.rs:54:36
|
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
| ^^^^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:52:36
--> $DIR/issue-8460-const.rs:54: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-const.rs:55:36
--> $DIR/issue-8460-const.rs:57:36
|
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
| ^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:55:36
--> $DIR/issue-8460-const.rs:57: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-const.rs:58:36
--> $DIR/issue-8460-const.rs:60:36
|
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
| ^^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:58:36
--> $DIR/issue-8460-const.rs:60: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-const.rs:61:36
--> $DIR/issue-8460-const.rs:63:36
|
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
| ^^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:61:36
--> $DIR/issue-8460-const.rs:63: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-const.rs:64:36
--> $DIR/issue-8460-const.rs:66:36
|
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
| ^^^^^^^^
error: this expression will panic at runtime
--> $DIR/issue-8460-const.rs:64:36
--> $DIR/issue-8460-const.rs:66:36
|
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder with a divisor of zero