File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 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> {
21162116#[ stable( feature = "pin" , since = "1.33.0" ) ]
21172117impl < T : ?Sized > Unpin for Rc < T > { }
21182118
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.
21192129unsafe fn data_offset < T : ?Sized > ( ptr : * const T ) -> isize {
21202130 // Align the unsized value to the end of the `RcBox`.
21212131 // 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> {
22732273#[ stable( feature = "pin" , since = "1.33.0" ) ]
22742274impl < T : ?Sized > Unpin for Arc < T > { }
22752275
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.
22772286unsafe fn data_offset < T : ?Sized > ( ptr : * const T ) -> isize {
22782287 // Align the unsized value to the end of the `ArcInner`.
22792288 // 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