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
22 // _3 = &raw mut (*_4);
25 // _5 = const foo(move _6) -> bb1;
33 // assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2;
41 // END rustc.main.EraseRegions.after.mir