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