//@ run-pass #![feature(repr_simd, intrinsics)] extern "rust-intrinsic" { fn simd_cast_ptr(x: T) -> U; fn simd_expose_provenance(x: T) -> U; fn simd_with_exposed_provenance(x: T) -> U; } #[derive(Copy, Clone)] #[repr(simd)] struct V([T; 2]); fn main() { unsafe { let mut foo = 4i8; let ptr = &mut foo as *mut i8; let ptrs = V::<*mut i8>([ptr, core::ptr::null_mut()]); // change constness and type let const_ptrs: V<*const u8> = simd_cast_ptr(ptrs); let exposed_addr: V = simd_expose_provenance(const_ptrs); let with_exposed_provenance: V<*mut i8> = simd_with_exposed_provenance(exposed_addr); assert!(const_ptrs.0 == [ptr as *const u8, core::ptr::null()]); assert!(exposed_addr.0 == [ptr as usize, 0]); assert!(with_exposed_provenance.0 == ptrs.0); } }