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" {
959
959
#[ rustc_safe_intrinsic]
960
960
pub fn assert_zero_valid < T > ( ) ;
961
961
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.
964
964
///
965
965
/// This intrinsic does not have a stable counterpart.
966
966
#[ rustc_const_unstable( feature = "const_assert_type2" , issue = "none" ) ]
967
967
#[ rustc_safe_intrinsic]
968
- pub fn assert_uninit_valid < T > ( ) ;
968
+ #[ cfg( not( bootstrap) ) ]
969
+ pub fn assert_mem_uninitialized_valid < T > ( ) ;
969
970
970
971
/// Gets a reference to a static `Location` indicating where it was called.
971
972
///
Original file line number Diff line number Diff line change @@ -682,7 +682,8 @@ pub unsafe fn zeroed<T>() -> T {
682
682
pub unsafe fn uninitialized < T > ( ) -> T {
683
683
// SAFETY: the caller must guarantee that an uninitialized value is valid for `T`.
684
684
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 > ( ) ;
686
687
let mut val = MaybeUninit :: < T > :: uninit ( ) ;
687
688
688
689
// 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