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 let mut x = [42, 43, 44];
13 let z: *mut usize = &mut y;
14 x[y] = unsafe { foo(z) };
18 // START rustc.main.EraseRegions.after.mir
23 // _3 = move _4 as *mut usize (Misc);
26 // _6 = const foo(move _7) -> bb1;
34 // assert(move _10, "index out of bounds: the len is move _9 but the index is _8") -> bb2;
42 // END rustc.main.EraseRegions.after.mir