@@ -543,6 +543,7 @@ impl<T: ?Sized> Cell<T> {
543
543
#[ inline]
544
544
#[ stable( feature = "cell_as_ptr" , since = "1.12.0" ) ]
545
545
#[ rustc_const_stable( feature = "const_cell_as_ptr" , since = "1.32.0" ) ]
546
+ #[ cfg_attr( not( bootstrap) , rustc_never_returns_null_ptr) ]
546
547
pub const fn as_ptr ( & self ) -> * mut T {
547
548
self . value . get ( )
548
549
}
@@ -1076,6 +1077,7 @@ impl<T: ?Sized> RefCell<T> {
1076
1077
/// ```
1077
1078
#[ inline]
1078
1079
#[ stable( feature = "cell_as_ptr" , since = "1.12.0" ) ]
1080
+ #[ cfg_attr( not( bootstrap) , rustc_never_returns_null_ptr) ]
1079
1081
pub fn as_ptr ( & self ) -> * mut T {
1080
1082
self . value . get ( )
1081
1083
}
@@ -2071,6 +2073,7 @@ impl<T: ?Sized> UnsafeCell<T> {
2071
2073
#[ inline( always) ]
2072
2074
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2073
2075
#[ rustc_const_stable( feature = "const_unsafecell_get" , since = "1.32.0" ) ]
2076
+ #[ cfg_attr( not( bootstrap) , rustc_never_returns_null_ptr) ]
2074
2077
pub const fn get ( & self ) -> * mut T {
2075
2078
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
2076
2079
// #[repr(transparent)]. This exploits std's special status, there is
@@ -2213,6 +2216,7 @@ impl<T: ?Sized> SyncUnsafeCell<T> {
2213
2216
/// when casting to `&mut T`, and ensure that there are no mutations
2214
2217
/// or mutable aliases going on when casting to `&T`
2215
2218
#[ inline]
2219
+ #[ cfg_attr( not( bootstrap) , rustc_never_returns_null_ptr) ]
2216
2220
pub const fn get ( & self ) -> * mut T {
2217
2221
self . value . get ( )
2218
2222
}
0 commit comments