Skip to content

Commit 39cb3b0

Browse files
committed
avoid using unstable ptr::invalid_mut
1 parent 778e235 commit 39cb3b0

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/raw/mod.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,11 @@ use core::convert::identity as unlikely;
5757
#[cfg(feature = "nightly")]
5858
use core::intrinsics::{likely, unlikely};
5959

60-
// Use strict provenance functions if available.
61-
#[cfg(feature = "nightly")]
62-
use core::ptr::invalid_mut;
63-
// Implement it with a cast otherwise.
64-
#[cfg(not(feature = "nightly"))]
60+
// FIXME: use strict provenance functions once they are stable.
61+
// Implement it with a transmute for now.
6562
#[inline(always)]
6663
fn invalid_mut<T>(addr: usize) -> *mut T {
67-
addr as *mut T
64+
unsafe { core::mem::transmute(addr) }
6865
}
6966

7067
#[inline]

0 commit comments

Comments
 (0)