Skip to content

Commit 5c258c4

Browse files
committed
Make forget intrinsic safe
1 parent 5de54d1 commit 5c258c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/src/mem/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,14 @@ pub const fn forget<T>(t: T) {
151151
#[inline]
152152
#[unstable(feature = "forget_unsized", issue = "none")]
153153
pub fn forget_unsized<T: ?Sized>(t: T) {
154+
#[cfg(bootstrap)]
154155
// SAFETY: the forget intrinsic could be safe, but there's no point in making it safe since
155156
// we'll be implementing this function soon via `ManuallyDrop`
156-
unsafe { intrinsics::forget(t) }
157+
unsafe {
158+
intrinsics::forget(t)
159+
}
160+
#[cfg(not(bootstrap))]
161+
intrinsics::forget(t)
157162
}
158163

159164
/// Returns the size of a type in bytes.

0 commit comments

Comments
 (0)