| //@compile-flags: -Zmiri-permissive-provenance |
| /// This manually makes sure that we have a pointer with the proper alignment. |
| let base_addr = x as *mut _ as usize; |
| let base_addr_aligned = if base_addr % 2 == 0 { base_addr } else { base_addr + 1 }; |
| let u16_ptr = base_addr_aligned as *mut u16; |
| /// Test standard library `align_to`. |
| let (l, m, r) = unsafe { buf.align_to::<i32>() }; |
| assert!(m.len() * 4 >= LEN - 4); |
| assert!(l.len() + r.len() <= 4); |
| // Do this a couple times in a loop because it may work "by chance". |