diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ca7f34..4a95e90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,4 +54,6 @@ jobs: rustup override set nightly cargo miri setup - name: Test with Miri - run: cargo miri test --features nightly + run: | + cargo miri test + cargo miri test --features nightly diff --git a/src/sptr.rs b/src/sptr.rs index 8763842..78cb233 100644 --- a/src/sptr.rs +++ b/src/sptr.rs @@ -21,7 +21,7 @@ mod implementation { } pub fn without_provenance_mut(addr: usize) -> *mut T { - addr as _ + unsafe { core::mem::transmute(addr) } } pub fn with_metadata_of(ptr: *const T, meta: *const U) -> *const U { @@ -29,8 +29,8 @@ mod implementation { } pub fn with_metadata_of_mut(ptr: *mut T, mut meta: *const U) -> *mut U { - let meta_ptr = addr_of_mut!(meta).cast::(); - unsafe { meta_ptr.write(ptr.cast::() as usize) } + let meta_ptr = addr_of_mut!(meta).cast::<*mut u8>(); + unsafe { meta_ptr.write(ptr.cast::()) } cast_to_mut(meta) } }