summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/const_prop/aggregate.rs
blob: aa123b7a8664dfb839013275b03e6b92f55d22f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// unit-test: ConstProp
// compile-flags: -O

// EMIT_MIR aggregate.main.ConstProp.diff
// 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;
}