File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -2116,6 +2116,16 @@ impl<T: ?Sized> AsRef<T> for Rc<T> {
2116
2116
#[ stable( feature = "pin" , since = "1.33.0" ) ]
2117
2117
impl < T : ?Sized > Unpin for Rc < T > { }
2118
2118
2119
+ /// Get the offset within an `ArcInner` for
2120
+ /// a payload of type described by a pointer.
2121
+ ///
2122
+ /// # Safety
2123
+ ///
2124
+ /// This has the same safety requirements as `align_of_val_raw`. In effect:
2125
+ ///
2126
+ /// - This function is safe for any argument if `T` is sized, and
2127
+ /// - if `T` is unsized, the pointer must have appropriate pointer metadata
2128
+ /// aquired from the real instance that you are getting this offset for.
2119
2129
unsafe fn data_offset < T : ?Sized > ( ptr : * const T ) -> isize {
2120
2130
// Align the unsized value to the end of the `RcBox`.
2121
2131
// Because it is ?Sized, it will always be the last field in memory.
Original file line number Diff line number Diff line change @@ -2273,7 +2273,16 @@ impl<T: ?Sized> AsRef<T> for Arc<T> {
2273
2273
#[ stable( feature = "pin" , since = "1.33.0" ) ]
2274
2274
impl < T : ?Sized > Unpin for Arc < T > { }
2275
2275
2276
- /// Computes the offset of the data field within `ArcInner`.
2276
+ /// Get the offset within an `ArcInner` for
2277
+ /// a payload of type described by a pointer.
2278
+ ///
2279
+ /// # Safety
2280
+ ///
2281
+ /// This has the same safety requirements as `align_of_val_raw`. In effect:
2282
+ ///
2283
+ /// - This function is safe for any argument if `T` is sized, and
2284
+ /// - if `T` is unsized, the pointer must have appropriate pointer metadata
2285
+ /// aquired from the real instance that you are getting this offset for.
2277
2286
unsafe fn data_offset < T : ?Sized > ( ptr : * const T ) -> isize {
2278
2287
// Align the unsized value to the end of the `ArcInner`.
2279
2288
// Because it is `?Sized`, it will always be the last field in memory.
You can’t perform that action at this time.
0 commit comments