2020-02-19 11:25:41 +01:00
|
|
|
// revisions: noopt opt opt_with_overflow_checks
|
2020-02-15 10:51:51 +01:00
|
|
|
//[noopt]compile-flags: -C opt-level=0
|
2020-02-15 10:47:27 +01:00
|
|
|
//[opt]compile-flags: -O
|
|
|
|
//[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O
|
|
|
|
|
2019-12-14 04:28:32 +01:00
|
|
|
// build-fail
|
2019-09-04 18:32:00 +09:00
|
|
|
|
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());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2020-02-10 11:23:04 +01:00
|
|
|
assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-18 05:42:01 -05:00
|
|
|
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2020-02-10 11:23:04 +01:00
|
|
|
assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-27 01:43:55 +01:00
|
|
|
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2020-02-10 11:23:04 +01:00
|
|
|
assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
|
2022-03-01 20:02:59 -05:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-18 05:42:01 -05:00
|
|
|
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2015-02-17 15:24:34 -08:00
|
|
|
assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2020-02-10 11:23:04 +01:00
|
|
|
assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
|
2020-02-15 10:47:27 +01:00
|
|
|
//~^ ERROR operation will panic
|
2015-01-29 14:03:34 +02:00
|
|
|
}
|