File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -2176,18 +2176,19 @@ impl<T: ?Sized> AsRef<T> for Rc<T> {
2176
2176
impl < T : ?Sized > Unpin for Rc < T > { }
2177
2177
2178
2178
unsafe fn data_offset < T : ?Sized > ( ptr : * const T ) -> isize {
2179
- // Align the unsized value to the end of the RcBox.
2179
+ // Align the unsized value to the end of the ` RcBox` .
2180
2180
// Because it is ?Sized, it will always be the last field in memory.
2181
- let align = align_of_val ( & * ptr) ;
2182
- let layout = Layout :: new :: < RcBox < ( ) > > ( ) ;
2183
- ( layout. size ( ) + layout. padding_needed_for ( align) ) as isize
2181
+ data_offset_align ( align_of_val ( & * ptr) )
2184
2182
}
2185
2183
2186
- /// Computes the offset of the data field within ArcInner .
2184
+ /// Computes the offset of the data field within `RcBox` .
2187
2185
///
2188
2186
/// Unlike [`data_offset`], this doesn't need the pointer, but it works only on `T: Sized`.
2189
2187
fn data_offset_sized < T > ( ) -> isize {
2190
- let align = align_of :: < T > ( ) ;
2188
+ data_offset_align ( align_of :: < T > ( ) )
2189
+ }
2190
+
2191
+ fn data_offset_align ( align : usize ) -> isize {
2191
2192
let layout = Layout :: new :: < RcBox < ( ) > > ( ) ;
2192
2193
( layout. size ( ) + layout. padding_needed_for ( align) ) as isize
2193
2194
}
You can’t perform that action at this time.
0 commit comments