]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-8460-const.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / issues / issue-8460-const.rs
CommitLineData
e1599b0c
XL
1// compile-flags: -O
2
b039eaaf
SL
3#![deny(const_err)]
4
c34b1796 5use std::{isize, i8, i16, i32, i64};
85aaf69f
SL
6use std::thread;
7
8fn main() {
c34b1796 9 assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
5bcae85e 10 //~^ ERROR attempt to divide with overflow
94b46f34 11 //~| ERROR this expression will panic at runtime
85aaf69f 12 assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
5bcae85e 13 //~^ ERROR attempt to divide with overflow
94b46f34 14 //~| ERROR this expression will panic at runtime
85aaf69f 15 assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
5bcae85e 16 //~^ ERROR attempt to divide with overflow
94b46f34 17 //~| ERROR this expression will panic at runtime
85aaf69f 18 assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
5bcae85e 19 //~^ ERROR attempt to divide with overflow
94b46f34 20 //~| ERROR this expression will panic at runtime
85aaf69f 21 assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
5bcae85e 22 //~^ ERROR attempt to divide with overflow
94b46f34 23 //~| ERROR this expression will panic at runtime
85aaf69f 24 assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
5bcae85e 25 //~^ ERROR attempt to divide by zero
85aaf69f 26 assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
5bcae85e 27 //~^ ERROR attempt to divide by zero
85aaf69f 28 assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
5bcae85e 29 //~^ ERROR attempt to divide by zero
85aaf69f 30 assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
5bcae85e 31 //~^ ERROR attempt to divide by zero
85aaf69f 32 assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
5bcae85e 33 //~^ ERROR attempt to divide by zero
c34b1796 34 assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
5bcae85e 35 //~^ ERROR attempt to calculate the remainder with overflow
94b46f34 36 //~| ERROR this expression will panic at runtime
85aaf69f 37 assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
5bcae85e 38 //~^ ERROR attempt to calculate the remainder with overflow
94b46f34 39 //~| ERROR this expression will panic at runtime
85aaf69f 40 assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
5bcae85e 41 //~^ ERROR attempt to calculate the remainder with overflow
94b46f34 42 //~| ERROR this expression will panic at runtime
85aaf69f 43 assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
5bcae85e 44 //~^ ERROR attempt to calculate the remainder with overflow
94b46f34 45 //~| ERROR this expression will panic at runtime
85aaf69f 46 assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
5bcae85e 47 //~^ ERROR attempt to calculate the remainder with overflow
94b46f34 48 //~| ERROR this expression will panic at runtime
85aaf69f 49 assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
5bcae85e 50 //~^ ERROR attempt to calculate the remainder with a divisor of zero
85aaf69f 51 assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
5bcae85e 52 //~^ ERROR attempt to calculate the remainder with a divisor of zero
85aaf69f 53 assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
5bcae85e 54 //~^ ERROR attempt to calculate the remainder with a divisor of zero
85aaf69f 55 assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
5bcae85e 56 //~^ ERROR attempt to calculate the remainder with a divisor of zero
85aaf69f 57 assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
5bcae85e 58 //~^ ERROR attempt to calculate the remainder with a divisor of zero
85aaf69f 59}