mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
20 lines
490 B
Rust
20 lines
490 B
Rust
// skip-filecheck
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
|
// 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;
|
|
}
|