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 // _4 = move _5 as *mut usize (Misc);
27 // _7 = const foo(move _8) -> bb1;
35 // assert(move _11, "index out of bounds: the len is move _10 but the index is _9") -> bb2;
43 // END rustc.main.EraseRegions.after.mir