summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/const_prop/inherit_overflow.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mir-opt/const_prop/inherit_overflow.rs')
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/mir-opt/const_prop/inherit_overflow.rs b/tests/mir-opt/const_prop/inherit_overflow.rs
new file mode 100644
index 000000000..541a8c5c3
--- /dev/null
+++ b/tests/mir-opt/const_prop/inherit_overflow.rs
@@ -0,0 +1,9 @@
+// unit-test: ConstProp
+// compile-flags: -Zmir-enable-passes=+Inline
+
+// EMIT_MIR inherit_overflow.main.ConstProp.diff
+fn main() {
+ // After inlining, this will contain a `CheckedBinaryOp`.
+ // Propagating the overflow is ok as codegen will just skip emitting the panic.
+ let _ = <u8 as std::ops::Add>::add(255, 1);
+}