Skip to content

Commit e45bed2

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

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/raw/mod.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,12 @@ 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.
60+
// FIXME: use strict provenance functions once they are stable.
61+
// Implement it with a transmute for now.
6462
#[cfg(not(feature = "nightly"))]
6563
#[inline(always)]
6664
fn invalid_mut<T>(addr: usize) -> *mut T {
67-
addr as *mut T
65+
unsafe { core::mem::transmute(addr) }
6866
}
6967

7068
#[inline]

0 commit comments

Comments
 (0)