Skip to content

Commit e49d30e

Browse files
committed
FileCheck array_index_is_temporary.rs
1 parent 9c20f83 commit e49d30e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/mir-opt/array_index_is_temporary.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// skip-filecheck
1+
// unit-test: SimplifyCfg-elaborate-drops
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33
// Retagging (from Stacked Borrows) relies on the array index being a fresh
44
// temporary, so that side-effects cannot change it.
@@ -12,6 +12,12 @@ unsafe fn foo(z: *mut usize) -> u32 {
1212

1313
// EMIT_MIR array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
1414
fn main() {
15+
// CHECK-LABEL: fn main(
16+
// CHECK: debug x => [[x:_.*]];
17+
// CHECK: debug y => [[y:_.*]];
18+
// CHECK: [[y]] = const 1_usize;
19+
// CHECK: [[tmp:_.*]] = [[y]];
20+
// CHECK: [[x]][[[tmp]]] =
1521
let mut x = [42, 43, 44];
1622
let mut y = 1;
1723
let z: *mut usize = &mut y;

0 commit comments

Comments
 (0)