@@ -543,6 +543,7 @@ impl<T: ?Sized> Cell<T> {
543543 #[ inline]
544544 #[ stable( feature = "cell_as_ptr" , since = "1.12.0" ) ]
545545 #[ rustc_const_stable( feature = "const_cell_as_ptr" , since = "1.32.0" ) ]
546+ #[ cfg_attr( not( bootstrap) , rustc_never_returns_null_ptr) ]
546547 pub const fn as_ptr ( & self ) -> * mut T {
547548 self . value . get ( )
548549 }
@@ -1076,6 +1077,7 @@ impl<T: ?Sized> RefCell<T> {
10761077 /// ```
10771078 #[ inline]
10781079 #[ stable( feature = "cell_as_ptr" , since = "1.12.0" ) ]
1080+ #[ cfg_attr( not( bootstrap) , rustc_never_returns_null_ptr) ]
10791081 pub fn as_ptr ( & self ) -> * mut T {
10801082 self . value . get ( )
10811083 }
@@ -2071,6 +2073,7 @@ impl<T: ?Sized> UnsafeCell<T> {
20712073 #[ inline( always) ]
20722074 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
20732075 #[ rustc_const_stable( feature = "const_unsafecell_get" , since = "1.32.0" ) ]
2076+ #[ cfg_attr( not( bootstrap) , rustc_never_returns_null_ptr) ]
20742077 pub const fn get ( & self ) -> * mut T {
20752078 // We can just cast the pointer from `UnsafeCell<T>` to `T` because of
20762079 // #[repr(transparent)]. This exploits std's special status, there is
@@ -2213,6 +2216,7 @@ impl<T: ?Sized> SyncUnsafeCell<T> {
22132216 /// when casting to `&mut T`, and ensure that there are no mutations
22142217 /// or mutable aliases going on when casting to `&T`
22152218 #[ inline]
2219+ #[ cfg_attr( not( bootstrap) , rustc_never_returns_null_ptr) ]
22162220 pub const fn get ( & self ) -> * mut T {
22172221 self . value . get ( )
22182222 }
0 commit comments