]> git.proxmox.com Git - rustc.git/blob - tests/mir-opt/const_prop/aggregate.rs
62cd3dd688982ea0b5e91c67832297771a7a555c
[rustc.git] / tests / mir-opt / const_prop / aggregate.rs
1 // EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2 // unit-test: ConstProp
3 // compile-flags: -O
4
5 // EMIT_MIR aggregate.main.ConstProp.diff
6 // EMIT_MIR aggregate.main.PreCodegen.after.mir
7 fn main() {
8 let x = (0, 1, 2).1 + 0;
9 foo(x);
10 }
11
12 // EMIT_MIR aggregate.foo.ConstProp.diff
13 // EMIT_MIR aggregate.foo.PreCodegen.after.mir
14 fn foo(x: u8) {
15 // Verify that we still propagate if part of the aggregate is not known.
16 let first = (0, x).0 + 1;
17 let second = (x, 1).1 + 2;
18 }