rust/tests/ui/numbers-arithmetic/issue-8460-const.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
2.7 KiB
Rust
Raw Normal View History

2020-02-19 11:25:41 +01:00
// revisions: noopt opt opt_with_overflow_checks
//[noopt]compile-flags: -C opt-level=0
//[opt]compile-flags: -O
//[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O
// build-fail
2019-09-04 18:32:00 +09:00
2015-02-17 15:10:25 -08:00
use std::thread;
fn main() {
2015-02-27 01:43:55 +01:00
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
2020-02-10 11:23:04 +01:00
assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
//~^ ERROR operation will panic
2020-02-10 11:23:04 +01:00
assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
//~^ ERROR operation will panic
2015-02-27 01:43:55 +01:00
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
2020-02-10 11:23:04 +01:00
assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
//~^ ERROR operation will panic
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
//~^ ERROR operation will panic
2015-02-17 15:24:34 -08:00
assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
//~^ ERROR operation will panic
2020-02-10 11:23:04 +01:00
assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
//~^ ERROR operation will panic
}