summary refs log tree commit diff
path: root/tests/ui/numbers-arithmetic/int-abs-overflow.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/numbers-arithmetic/int-abs-overflow.rs')
-rw-r--r--tests/ui/numbers-arithmetic/int-abs-overflow.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/numbers-arithmetic/int-abs-overflow.rs b/tests/ui/numbers-arithmetic/int-abs-overflow.rs
new file mode 100644
index 00000000000..d63ba8cb03e
--- /dev/null
+++ b/tests/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());
+}