From 5718cc2f9b32290dc34ce320076f92d90c00fb7d Mon Sep 17 00:00:00 2001 From: Tomasz Miąsko Date: Tue, 29 Dec 2020 00:00:00 +0000 Subject: Make forget intrinsic safe --- library/core/src/mem/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'library') diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index e84014c68a6..87956787242 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -151,9 +151,14 @@ pub const fn forget(t: T) { #[inline] #[unstable(feature = "forget_unsized", issue = "none")] pub fn forget_unsized(t: T) { + #[cfg(bootstrap)] // SAFETY: the forget intrinsic could be safe, but there's no point in making it safe since // we'll be implementing this function soon via `ManuallyDrop` - unsafe { intrinsics::forget(t) } + unsafe { + intrinsics::forget(t) + } + #[cfg(not(bootstrap))] + intrinsics::forget(t) } /// Returns the size of a type in bytes. -- cgit 1.4.1-3-g733a5