summaryrefslogtreecommitdiffstats
path: root/src/test/ui/numbers-arithmetic/int-abs-overflow.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/numbers-arithmetic/int-abs-overflow.rs')
-rw-r--r--src/test/ui/numbers-arithmetic/int-abs-overflow.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/numbers-arithmetic/int-abs-overflow.rs b/src/test/ui/numbers-arithmetic/int-abs-overflow.rs
new file mode 100644
index 000000000..d63ba8cb0
--- /dev/null
+++ b/src/test/ui/numbers-arithmetic/int-abs-overflow.rs
@@ -0,0 +1,14 @@
+// run-pass
+// compile-flags: -C overflow-checks=on
+// ignore-emscripten no threads support
+// needs-unwind
+
+use std::thread;
+
+fn main() {
+ 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());
+}