@@ -2718,6 +2718,8 @@ impl<T: ?Sized> PartialOrd for *mut T {
27182718 (if you also use #[may_dangle]), Send, and/or Sync") ]
27192719#[ doc( hidden) ]
27202720#[ repr( transparent) ]
2721+ // FIXME: the rustc_layout_scalar_valid_range_start attr is marked as unused
2722+ #[ cfg_attr( stage0, allow( unused_attributes) ) ]
27212723#[ rustc_layout_scalar_valid_range_start( 1 ) ]
27222724pub struct Unique < T : ?Sized > {
27232725 pointer : * const T ,
@@ -2783,6 +2785,8 @@ impl<T: ?Sized> Unique<T> {
27832785 /// Creates a new `Unique` if `ptr` is non-null.
27842786 pub fn new ( ptr : * mut T ) -> Option < Self > {
27852787 if !ptr. is_null ( ) {
2788+ // FIXME: this unsafe block is actually needed
2789+ #[ cfg_attr( stage0, allow( unused_unsafe) ) ]
27862790 Some ( unsafe { Unique { pointer : ptr as _ , _marker : PhantomData } } )
27872791 } else {
27882792 None
@@ -2839,20 +2843,26 @@ impl<T: ?Sized> fmt::Pointer for Unique<T> {
28392843#[ unstable( feature = "ptr_internals" , issue = "0" ) ]
28402844impl < ' a , T : ?Sized > From < & ' a mut T > for Unique < T > {
28412845 fn from ( reference : & ' a mut T ) -> Self {
2846+ // FIXME: this unsafe block is actually needed
2847+ #[ cfg_attr( stage0, allow( unused_unsafe) ) ]
28422848 unsafe { Unique { pointer : reference as * mut T , _marker : PhantomData } }
28432849 }
28442850}
28452851
28462852#[ unstable( feature = "ptr_internals" , issue = "0" ) ]
28472853impl < ' a , T : ?Sized > From < & ' a T > for Unique < T > {
28482854 fn from ( reference : & ' a T ) -> Self {
2855+ // FIXME: this unsafe block is actually needed
2856+ #[ cfg_attr( stage0, allow( unused_unsafe) ) ]
28492857 unsafe { Unique { pointer : reference as * const T , _marker : PhantomData } }
28502858 }
28512859}
28522860
28532861#[ unstable( feature = "ptr_internals" , issue = "0" ) ]
28542862impl < ' a , T : ?Sized > From < NonNull < T > > for Unique < T > {
28552863 fn from ( p : NonNull < T > ) -> Self {
2864+ // FIXME: this unsafe block is actually needed
2865+ #[ cfg_attr( stage0, allow( unused_unsafe) ) ]
28562866 unsafe { Unique { pointer : p. pointer , _marker : PhantomData } }
28572867 }
28582868}
@@ -3042,6 +3052,8 @@ impl<T: ?Sized> hash::Hash for NonNull<T> {
30423052impl < T : ?Sized > From < Unique < T > > for NonNull < T > {
30433053 #[ inline]
30443054 fn from ( unique : Unique < T > ) -> Self {
3055+ // FIXME: this unsafe block is actually needed
3056+ #[ cfg_attr( stage0, allow( unused_unsafe) ) ]
30453057 unsafe { NonNull { pointer : unique. pointer } }
30463058 }
30473059}
@@ -3050,6 +3062,8 @@ impl<T: ?Sized> From<Unique<T>> for NonNull<T> {
30503062impl < ' a , T : ?Sized > From < & ' a mut T > for NonNull < T > {
30513063 #[ inline]
30523064 fn from ( reference : & ' a mut T ) -> Self {
3065+ // FIXME: this unsafe block is actually needed
3066+ #[ cfg_attr( stage0, allow( unused_unsafe) ) ]
30533067 unsafe { NonNull { pointer : reference as * mut T } }
30543068 }
30553069}
@@ -3058,6 +3072,8 @@ impl<'a, T: ?Sized> From<&'a mut T> for NonNull<T> {
30583072impl < ' a , T : ?Sized > From < & ' a T > for NonNull < T > {
30593073 #[ inline]
30603074 fn from ( reference : & ' a T ) -> Self {
3075+ // FIXME: this unsafe block is actually needed
3076+ #[ cfg_attr( stage0, allow( unused_unsafe) ) ]
30613077 unsafe { NonNull { pointer : reference as * const T } }
30623078 }
30633079}
0 commit comments