rust/tests/ui/numbers-arithmetic/int-abs-overflow.rs

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

15 lines
461 B
Rust
Raw Normal View History

//@ run-pass
//@ compile-flags: -C overflow-checks=on
//@ ignore-emscripten no threads support
//@ needs-unwind
use std::thread;
fn main() {
2020-06-02 07:59:11 +00:00
assert!(thread::spawn(|| i8::MIN.abs()).join().is_err());
assert!(thread::spawn(|| i16::MIN.abs()).join().is_err());
assert!(thread::spawn(|| i32::MIN.abs()).join().is_err());
assert!(thread::spawn(|| i64::MIN.abs()).join().is_err());
assert!(thread::spawn(|| isize::MIN.abs()).join().is_err());
}