|
| 1 | +// compile-flags: -C overflow-checks=on -O |
| 2 | + |
| 3 | +#![deny(const_err)] |
| 4 | + |
| 5 | +use std::{isize, i8, i16, i32, i64}; |
| 6 | +use std::thread; |
| 7 | + |
| 8 | +fn main() { |
| 9 | + assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); |
| 10 | + //~^ ERROR attempt to divide with overflow |
| 11 | + assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); |
| 12 | + //~^ ERROR attempt to divide with overflow |
| 13 | + assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); |
| 14 | + //~^ ERROR attempt to divide with overflow |
| 15 | + assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); |
| 16 | + //~^ ERROR attempt to divide with overflow |
| 17 | + assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); |
| 18 | + //~^ ERROR attempt to divide with overflow |
| 19 | + assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); |
| 20 | + //~^ ERROR attempt to divide by zero |
| 21 | + //~| ERROR this expression will panic at runtime |
| 22 | + assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); |
| 23 | + //~^ ERROR attempt to divide by zero |
| 24 | + //~| ERROR this expression will panic at runtime |
| 25 | + assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); |
| 26 | + //~^ ERROR attempt to divide by zero |
| 27 | + //~| ERROR this expression will panic at runtime |
| 28 | + assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); |
| 29 | + //~^ ERROR attempt to divide by zero |
| 30 | + //~| ERROR this expression will panic at runtime |
| 31 | + assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); |
| 32 | + //~^ ERROR attempt to divide by zero |
| 33 | + //~| ERROR this expression will panic at runtime |
| 34 | + assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); |
| 35 | + //~^ ERROR attempt to calculate the remainder with overflow |
| 36 | + assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); |
| 37 | + //~^ ERROR attempt to calculate the remainder with overflow |
| 38 | + assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); |
| 39 | + //~^ ERROR attempt to calculate the remainder with overflow |
| 40 | + assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); |
| 41 | + //~^ ERROR attempt to calculate the remainder with overflow |
| 42 | + assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); |
| 43 | + //~^ ERROR attempt to calculate the remainder with overflow |
| 44 | + assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); |
| 45 | + //~^ ERROR attempt to calculate the remainder with a divisor of zero |
| 46 | + //~| ERROR this expression will panic at runtime |
| 47 | + assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); |
| 48 | + //~^ ERROR attempt to calculate the remainder with a divisor of zero |
| 49 | + //~| ERROR this expression will panic at runtime |
| 50 | + assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); |
| 51 | + //~^ ERROR attempt to calculate the remainder with a divisor of zero |
| 52 | + //~| ERROR this expression will panic at runtime |
| 53 | + assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); |
| 54 | + //~^ ERROR attempt to calculate the remainder with a divisor of zero |
| 55 | + //~| ERROR this expression will panic at runtime |
| 56 | + assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); |
| 57 | + //~^ ERROR attempt to calculate the remainder with a divisor of zero |
| 58 | + //~| ERROR this expression will panic at runtime |
| 59 | +} |
0 commit comments