]> git.lizzy.rs Git - rust.git/commitdiff
also test div-by-minus-1
authorRalf Jung <post@ralfj.de>
Thu, 6 Feb 2020 10:24:38 +0000 (11:24 +0100)
committerRalf Jung <post@ralfj.de>
Thu, 6 Feb 2020 10:24:38 +0000 (11:24 +0100)
tests/compile-fail/unchecked_div1.rs [new file with mode: 0644]

diff --git a/tests/compile-fail/unchecked_div1.rs b/tests/compile-fail/unchecked_div1.rs
new file mode 100644 (file)
index 0000000..1d1bbb0
--- /dev/null
@@ -0,0 +1,5 @@
+#![feature(core_intrinsics)]
+fn main() {
+    // MIN/-1 cannot be represented
+    unsafe { std::intrinsics::unchecked_div(i16::min_value(), -1); } //~ ERROR Overflow executing `unchecked_div`
+}