File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1545,7 +1545,8 @@ impl<T: ?Sized> UnsafeCell<T> {
1545
1545
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1546
1546
pub const fn get ( & self ) -> * mut T {
1547
1547
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
1548
- // #[repr(transparent)]
1548
+ // #[repr(transparent)]. This exploits libstd's special status, there is
1549
+ // no guarantee for user code that this will work in future versions of the compiler!
1549
1550
self as * const UnsafeCell < T > as * const T as * mut T
1550
1551
}
1551
1552
@@ -1572,10 +1573,11 @@ impl<T: ?Sized> UnsafeCell<T> {
1572
1573
/// assert_eq!(uc.into_inner(), 5);
1573
1574
/// ```
1574
1575
#[ inline]
1575
- #[ unstable( feature = "unsafe_cell_raw_get" , issue = "0 " ) ]
1576
+ #[ unstable( feature = "unsafe_cell_raw_get" , issue = "66358 " ) ]
1576
1577
pub const fn raw_get ( self : * const Self ) -> * mut T {
1577
1578
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
1578
- // #[repr(transparent)]
1579
+ // #[repr(transparent)]. This exploits libstd's special status, there is
1580
+ // no guarantee for user code that this will work in future versions of the compiler!
1579
1581
self as * const T as * mut T
1580
1582
}
1581
1583
}
You can’t perform that action at this time.
0 commit comments