1 // Retagging (from Stacked Borrows) relies on the array index being a fresh
2 // temporary, so that side-effects cannot change it.
3 // Test that this is indeed the case.
5 unsafe fn foo(z: *mut usize) -> u32 {
11 // EMIT_MIR array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
13 let mut x = [42, 43, 44];
15 let z: *mut usize = &mut y;
16 x[y] = unsafe { foo(z) };