@@ -2892,17 +2892,6 @@ impl<T: ?Sized> !Send for NonNull<T> { }
2892
2892
impl < T : ?Sized > !Sync for NonNull < T > { }
2893
2893
2894
2894
impl < T : Sized > NonNull < T > {
2895
- /// No docs here
2896
- #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2897
- #[ inline]
2898
- #[ cfg( stage0) ]
2899
- pub fn dangling ( ) -> Self {
2900
- unsafe {
2901
- let ptr = mem:: align_of :: < T > ( ) as * mut T ;
2902
- NonNull :: new_unchecked ( ptr)
2903
- }
2904
- }
2905
-
2906
2895
/// Creates a new `NonNull` that is dangling, but well-aligned.
2907
2896
///
2908
2897
/// This is useful for initializing types which lazily allocate, like
@@ -2914,8 +2903,7 @@ impl<T: Sized> NonNull<T> {
2914
2903
/// some other means.
2915
2904
#[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2916
2905
#[ inline]
2917
- #[ cfg( not( stage0) ) ]
2918
- #[ rustc_const_unstable( feature = "const_ptr_nonnull" ) ]
2906
+ #[ cfg_attr( not( stage0) , rustc_const_unstable( feature = "const_ptr_nonnull" ) ) ]
2919
2907
pub const fn dangling ( ) -> Self {
2920
2908
unsafe {
2921
2909
let ptr = mem:: align_of :: < T > ( ) as * mut T ;
@@ -2976,21 +2964,10 @@ impl<T: ?Sized> NonNull<T> {
2976
2964
& mut * self . as_ptr ( )
2977
2965
}
2978
2966
2979
- /// No docs here
2980
- #[ stable( feature = "nonnull_cast" , since = "1.27.0" ) ]
2981
- #[ inline]
2982
- #[ cfg( stage0) ]
2983
- pub fn cast < U > ( self ) -> NonNull < U > {
2984
- unsafe {
2985
- NonNull :: new_unchecked ( self . as_ptr ( ) as * mut U )
2986
- }
2987
- }
2988
-
2989
2967
/// Cast to a pointer of another type
2990
2968
#[ stable( feature = "nonnull_cast" , since = "1.27.0" ) ]
2991
2969
#[ inline]
2992
- #[ cfg( not( stage0) ) ]
2993
- #[ rustc_const_unstable( feature = "const_ptr_nonnull" ) ]
2970
+ #[ cfg_attr( not( stage0) , rustc_const_unstable( feature = "const_ptr_nonnull" ) ) ]
2994
2971
pub const fn cast < U > ( self ) -> NonNull < U > {
2995
2972
unsafe {
2996
2973
NonNull :: new_unchecked ( self . as_ptr ( ) as * mut U )
0 commit comments