summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/const_prop/aggregate.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mir-opt/const_prop/aggregate.rs')
-rw-r--r--tests/mir-opt/const_prop/aggregate.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/mir-opt/const_prop/aggregate.rs b/tests/mir-opt/const_prop/aggregate.rs
index 6a3080384..aa123b7a8 100644
--- a/tests/mir-opt/const_prop/aggregate.rs
+++ b/tests/mir-opt/const_prop/aggregate.rs
@@ -5,4 +5,13 @@
// EMIT_MIR aggregate.main.PreCodegen.after.mir
fn main() {
let x = (0, 1, 2).1 + 0;
+ foo(x);
+}
+
+// EMIT_MIR aggregate.foo.ConstProp.diff
+// EMIT_MIR aggregate.foo.PreCodegen.after.mir
+fn foo(x: u8) {
+ // Verify that we still propagate if part of the aggregate is not known.
+ let first = (0, x).0 + 1;
+ let second = (x, 1).1 + 2;
}