File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -959,13 +959,14 @@ extern "rust-intrinsic" {
959959 #[ rustc_safe_intrinsic]
960960 pub fn assert_zero_valid < T > ( ) ;
961961
962- /// A guard for unsafe functions that cannot ever be executed if `T` has invalid
963- /// bit patterns : This will statically either panic, or do nothing.
962+ /// A guard for `std::mem::uninitialized`. Checks whether a repeated bit pattern `0x01`
963+ /// is legal for `T` : This will statically either panic, or do nothing.
964964 ///
965965 /// This intrinsic does not have a stable counterpart.
966966 #[ rustc_const_unstable( feature = "const_assert_type2" , issue = "none" ) ]
967967 #[ rustc_safe_intrinsic]
968- pub fn assert_uninit_valid < T > ( ) ;
968+ #[ cfg( not( bootstrap) ) ]
969+ pub fn assert_mem_uninitialized_valid < T > ( ) ;
969970
970971 /// Gets a reference to a static `Location` indicating where it was called.
971972 ///
Original file line number Diff line number Diff line change @@ -682,7 +682,8 @@ pub unsafe fn zeroed<T>() -> T {
682682pub unsafe fn uninitialized < T > ( ) -> T {
683683 // SAFETY: the caller must guarantee that an uninitialized value is valid for `T`.
684684 unsafe {
685- intrinsics:: assert_uninit_valid :: < T > ( ) ;
685+ #[ cfg( not( bootstrap) ) ] // If the compiler hits this itself then it deserves the UB.
686+ intrinsics:: assert_mem_uninitialized_valid :: < T > ( ) ;
686687 let mut val = MaybeUninit :: < T > :: uninit ( ) ;
687688
688689 // Fill memory with 0x01, as an imperfect mitigation for old code that uses this function on
You can’t perform that action at this time.
0 commit comments