rust/tests/mir-opt/dataflow-const-prop/array_index.rs
2024-01-20 08:09:14 -08:00

22 lines
696 B
Rust

// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR array_index.main.DataflowConstProp.diff
// CHECK-LABEL: fn main() -> () {
fn main() {
// CHECK: let mut [[array_lit:_.*]]: [u32; 4];
// CHECK: debug x => [[x:_.*]];
// CHECK: [[array_lit]] = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
// CHECK-NOT: {{_.*}} = Len(
// CHECK-NOT: {{_.*}} = Lt(
// CHECK-NOT: assert(move _
// CHECK: {{_.*}} = const 4_usize;
// CHECK: {{_.*}} = const true;
// CHECK: assert(const true
// CHECK: [[x]] = [[array_lit]][2 of 3];
let x: u32 = [0, 1, 2, 3][2];
}