@@ -289,7 +289,7 @@ struct RcInner<T: ?Sized> {
289289}
290290
291291/// Calculate layout for `RcInner<T>` using the inner value's layout
292- fn rcbox_layout_for_value_layout ( layout : Layout ) -> Layout {
292+ fn rc_inner_layout_for_value_layout ( layout : Layout ) -> Layout {
293293 // Calculate layout using the given value layout.
294294 // Previously, layout was calculated on the expression
295295 // `&*(ptr as *const RcInner<T>)`, but this created a misaligned
@@ -2009,17 +2009,17 @@ impl<T: ?Sized> Rc<T> {
20092009 /// Allocates an `RcInner<T>` with sufficient space for
20102010 /// a possibly-unsized inner value where the value has the layout provided.
20112011 ///
2012- /// The function `mem_to_rcbox ` is called with the data pointer
2012+ /// The function `mem_to_rc_inner ` is called with the data pointer
20132013 /// and must return back a (potentially fat)-pointer for the `RcInner<T>`.
20142014 #[ cfg( not( no_global_oom_handling) ) ]
20152015 unsafe fn allocate_for_layout (
20162016 value_layout : Layout ,
20172017 allocate : impl FnOnce ( Layout ) -> Result < NonNull < [ u8 ] > , AllocError > ,
2018- mem_to_rcbox : impl FnOnce ( * mut u8 ) -> * mut RcInner < T > ,
2018+ mem_to_rc_inner : impl FnOnce ( * mut u8 ) -> * mut RcInner < T > ,
20192019 ) -> * mut RcInner < T > {
2020- let layout = rcbox_layout_for_value_layout ( value_layout) ;
2020+ let layout = rc_inner_layout_for_value_layout ( value_layout) ;
20212021 unsafe {
2022- Rc :: try_allocate_for_layout ( value_layout, allocate, mem_to_rcbox )
2022+ Rc :: try_allocate_for_layout ( value_layout, allocate, mem_to_rc_inner )
20232023 . unwrap_or_else ( |_| handle_alloc_error ( layout) )
20242024 }
20252025 }
@@ -2028,21 +2028,21 @@ impl<T: ?Sized> Rc<T> {
20282028 /// a possibly-unsized inner value where the value has the layout provided,
20292029 /// returning an error if allocation fails.
20302030 ///
2031- /// The function `mem_to_rcbox ` is called with the data pointer
2031+ /// The function `mem_to_rc_inner ` is called with the data pointer
20322032 /// and must return back a (potentially fat)-pointer for the `RcInner<T>`.
20332033 #[ inline]
20342034 unsafe fn try_allocate_for_layout (
20352035 value_layout : Layout ,
20362036 allocate : impl FnOnce ( Layout ) -> Result < NonNull < [ u8 ] > , AllocError > ,
2037- mem_to_rcbox : impl FnOnce ( * mut u8 ) -> * mut RcInner < T > ,
2037+ mem_to_rc_inner : impl FnOnce ( * mut u8 ) -> * mut RcInner < T > ,
20382038 ) -> Result < * mut RcInner < T > , AllocError > {
2039- let layout = rcbox_layout_for_value_layout ( value_layout) ;
2039+ let layout = rc_inner_layout_for_value_layout ( value_layout) ;
20402040
20412041 // Allocate for the layout.
20422042 let ptr = allocate ( layout) ?;
20432043
20442044 // Initialize the RcInner
2045- let inner = mem_to_rcbox ( ptr. as_non_null_ptr ( ) . as_ptr ( ) ) ;
2045+ let inner = mem_to_rc_inner ( ptr. as_non_null_ptr ( ) . as_ptr ( ) ) ;
20462046 unsafe {
20472047 debug_assert_eq ! ( Layout :: for_value_raw( inner) , layout) ;
20482048
@@ -3784,7 +3784,7 @@ impl<T: ?Sized, A: Allocator> UniqueRcUninit<T, A> {
37843784 let ptr = unsafe {
37853785 Rc :: allocate_for_layout (
37863786 layout,
3787- |layout_for_rcbox | alloc. allocate ( layout_for_rcbox ) ,
3787+ |layout_for_rc_inner | alloc. allocate ( layout_for_rc_inner ) ,
37883788 |mem| mem. with_metadata_of ( ptr:: from_ref ( for_value) as * const RcInner < T > ) ,
37893789 )
37903790 } ;
@@ -3823,7 +3823,7 @@ impl<T: ?Sized, A: Allocator> Drop for UniqueRcUninit<T, A> {
38233823 self . alloc
38243824 . take ( )
38253825 . unwrap ( )
3826- . deallocate ( self . ptr . cast ( ) , rcbox_layout_for_value_layout ( self . layout_for_value ) ) ;
3826+ . deallocate ( self . ptr . cast ( ) , rc_inner_layout_for_value_layout ( self . layout_for_value ) ) ;
38273827 }
38283828 }
38293829}
0 commit comments