2015-10-02 10:36:45 +02:00
|
|
|
#![deny(const_err)]
|
|
|
|
|
2015-02-27 01:43:55 +01:00
|
|
|
use std::{isize, i8, i16, i32, i64};
|
2015-02-17 15:10:25 -08:00
|
|
|
use std::thread;
|
2015-01-29 14:03:34 +02:00
|
|
|
|
|
|
|
fn main() {
|
2015-02-27 01:43:55 +01:00
|
|
|
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to divide with overflow
|
2019-09-02 05:01:39 +09:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to divide with overflow
|
2019-09-02 05:01:39 +09:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to divide with overflow
|
2019-09-02 05:01:39 +09:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to divide with overflow
|
2019-09-02 05:01:39 +09:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to divide with overflow
|
2019-09-02 05:01:39 +09:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-18 05:42:01 -05:00
|
|
|
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to divide by zero
|
2018-06-02 23:38:57 +02:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to divide by zero
|
2018-06-02 23:38:57 +02:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to divide by zero
|
2018-06-02 23:38:57 +02:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to divide by zero
|
2018-06-02 23:38:57 +02:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to divide by zero
|
2018-06-02 23:38:57 +02:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-27 01:43:55 +01:00
|
|
|
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to calculate the remainder with overflow
|
2019-09-02 05:01:39 +09:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to calculate the remainder with overflow
|
2019-09-02 05:01:39 +09:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to calculate the remainder with overflow
|
2019-09-02 05:01:39 +09:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to calculate the remainder with overflow
|
2019-09-02 05:01:39 +09:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to calculate the remainder with overflow
|
2019-09-02 05:01:39 +09:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-18 05:42:01 -05:00
|
|
|
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
2018-06-02 23:38:57 +02:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
2018-06-02 23:38:57 +02:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
2018-06-02 23:38:57 +02:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
2018-06-02 23:38:57 +02:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
2018-03-06 12:43:02 +01:00
|
|
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
2018-06-02 23:38:57 +02:00
|
|
|
//~| ERROR this expression will panic at runtime
|
2015-01-29 14:03:34 +02:00
|
|
|
}
|