diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2019-08-17 15:39:21 +0200 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2019-08-17 17:01:04 +0200 |
| commit | b79ce1b1b10d6de1dac516d5e129f8251725ebe2 (patch) | |
| tree | 349ac4ba889292137c0ee4d34398a97a00f219da /src/liballoc/sync.rs | |
| parent | ba0328327c8ce94f7bf380223d655c70de584e93 (diff) | |
| download | rust-b79ce1b1b10d6de1dac516d5e129f8251725ebe2.tar.gz rust-b79ce1b1b10d6de1dac516d5e129f8251725ebe2.zip | |
Rename private helper method allocate_for_unsized to allocate_for_layout
Diffstat (limited to 'src/liballoc/sync.rs')
| -rw-r--r-- | src/liballoc/sync.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index ffab842c769..341172136e2 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -335,7 +335,7 @@ impl<T> Arc<T> { #[unstable(feature = "new_uninit", issue = "63291")] pub fn new_uninit() -> Arc<mem::MaybeUninit<T>> { unsafe { - Arc::from_ptr(Arc::allocate_for_unsized( + Arc::from_ptr(Arc::allocate_for_layout( Layout::new::<T>(), |mem| mem as *mut ArcInner<mem::MaybeUninit<T>>, )) @@ -736,11 +736,11 @@ impl<T: ?Sized> Arc<T> { impl<T: ?Sized> Arc<T> { /// Allocates an `ArcInner<T>` with sufficient space for - /// an unsized value where the value has the layout provided. + /// a possibly-unsized value where the value has the layout provided. /// /// The function `mem_to_arcinner` is called with the data pointer /// and must return back a (potentially fat)-pointer for the `ArcInner<T>`. - unsafe fn allocate_for_unsized( + unsafe fn allocate_for_layout( value_layout: Layout, mem_to_arcinner: impl FnOnce(*mut u8) -> *mut ArcInner<T> ) -> *mut ArcInner<T> { @@ -768,7 +768,7 @@ impl<T: ?Sized> Arc<T> { /// Allocates an `ArcInner<T>` with sufficient space for an unsized value. unsafe fn allocate_for_ptr(ptr: *const T) -> *mut ArcInner<T> { // Allocate for the `ArcInner<T>` using the given value. - Self::allocate_for_unsized( + Self::allocate_for_layout( Layout::for_value(&*ptr), |mem| set_data_ptr(ptr as *mut T, mem) as *mut ArcInner<T>, ) @@ -799,7 +799,7 @@ impl<T: ?Sized> Arc<T> { impl<T> Arc<[T]> { /// Allocates an `ArcInner<[T]>` with the given length. unsafe fn allocate_for_slice(len: usize) -> *mut ArcInner<[T]> { - Self::allocate_for_unsized( + Self::allocate_for_layout( Layout::array::<T>(len).unwrap(), |mem| ptr::slice_from_raw_parts_mut(mem as *mut T, len) as *mut ArcInner<[T]>, ) |
