We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e34caaf commit 86dbcb5Copy full SHA for 86dbcb5
tests/codegen/inherit_overflow.rs
@@ -0,0 +1,14 @@
1
+// compile-flags: -Zmir-enable-passes=+Inline,+ConstProp --crate-type lib
2
+// revisions: ASSERT NOASSERT
3
+//[ASSERT] compile-flags: -Coverflow-checks=on
4
+//[NOASSERT] compile-flags: -Coverflow-checks=off
5
+
6
+// CHECK-LABEL: define{{.*}} @assertion
7
+// ASSERT: tail call void @_ZN4core9panicking5panic17h
8
+// NOASSERT: ret i8 0
9
+#[no_mangle]
10
+pub fn assertion() -> u8 {
11
+ // Optimized MIR will replace this `CheckedBinaryOp` by `const (0, true)`.
12
+ // Verify that codegen does or does not emit the panic.
13
+ <u8 as std::ops::Add>::add(255, 1)
14
+}
0 commit comments