@@ -289,7 +289,7 @@ struct RcInner<T: ?Sized> {
289
289
}
290
290
291
291
/// 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 {
293
293
// Calculate layout using the given value layout.
294
294
// Previously, layout was calculated on the expression
295
295
// `&*(ptr as *const RcInner<T>)`, but this created a misaligned
@@ -2009,17 +2009,17 @@ impl<T: ?Sized> Rc<T> {
2009
2009
/// Allocates an `RcInner<T>` with sufficient space for
2010
2010
/// a possibly-unsized inner value where the value has the layout provided.
2011
2011
///
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
2013
2013
/// and must return back a (potentially fat)-pointer for the `RcInner<T>`.
2014
2014
#[ cfg( not( no_global_oom_handling) ) ]
2015
2015
unsafe fn allocate_for_layout (
2016
2016
value_layout : Layout ,
2017
2017
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 > ,
2019
2019
) -> * mut RcInner < T > {
2020
- let layout = rcbox_layout_for_value_layout ( value_layout) ;
2020
+ let layout = rc_inner_layout_for_value_layout ( value_layout) ;
2021
2021
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 )
2023
2023
. unwrap_or_else ( |_| handle_alloc_error ( layout) )
2024
2024
}
2025
2025
}
@@ -2028,21 +2028,21 @@ impl<T: ?Sized> Rc<T> {
2028
2028
/// a possibly-unsized inner value where the value has the layout provided,
2029
2029
/// returning an error if allocation fails.
2030
2030
///
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
2032
2032
/// and must return back a (potentially fat)-pointer for the `RcInner<T>`.
2033
2033
#[ inline]
2034
2034
unsafe fn try_allocate_for_layout (
2035
2035
value_layout : Layout ,
2036
2036
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 > ,
2038
2038
) -> 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) ;
2040
2040
2041
2041
// Allocate for the layout.
2042
2042
let ptr = allocate ( layout) ?;
2043
2043
2044
2044
// 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 ( ) ) ;
2046
2046
unsafe {
2047
2047
debug_assert_eq ! ( Layout :: for_value_raw( inner) , layout) ;
2048
2048
@@ -3784,7 +3784,7 @@ impl<T: ?Sized, A: Allocator> UniqueRcUninit<T, A> {
3784
3784
let ptr = unsafe {
3785
3785
Rc :: allocate_for_layout (
3786
3786
layout,
3787
- |layout_for_rcbox | alloc. allocate ( layout_for_rcbox ) ,
3787
+ |layout_for_rc_inner | alloc. allocate ( layout_for_rc_inner ) ,
3788
3788
|mem| mem. with_metadata_of ( ptr:: from_ref ( for_value) as * const RcInner < T > ) ,
3789
3789
)
3790
3790
} ;
@@ -3823,7 +3823,7 @@ impl<T: ?Sized, A: Allocator> Drop for UniqueRcUninit<T, A> {
3823
3823
self . alloc
3824
3824
. take ( )
3825
3825
. 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 ) ) ;
3827
3827
}
3828
3828
}
3829
3829
}
0 commit comments