about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2019-08-17 15:39:21 +0200
committerSimon Sapin <simon.sapin@exyr.org>2019-08-17 17:01:04 +0200
commitb79ce1b1b10d6de1dac516d5e129f8251725ebe2 (patch)
tree349ac4ba889292137c0ee4d34398a97a00f219da /src/liballoc
parentba0328327c8ce94f7bf380223d655c70de584e93 (diff)
downloadrust-b79ce1b1b10d6de1dac516d5e129f8251725ebe2.tar.gz
rust-b79ce1b1b10d6de1dac516d5e129f8251725ebe2.zip
Rename private helper method allocate_for_unsized to allocate_for_layout
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/rc.rs10
-rw-r--r--src/liballoc/sync.rs10
2 files changed, 10 insertions, 10 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index 7183336ba53..2b222caf13f 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -351,7 +351,7 @@ impl<T> Rc<T> {
     #[unstable(feature = "new_uninit", issue = "63291")]
     pub fn new_uninit() -> Rc<mem::MaybeUninit<T>> {
         unsafe {
-            Rc::from_ptr(Rc::allocate_for_unsized(
+            Rc::from_ptr(Rc::allocate_for_layout(
                 Layout::new::<T>(),
                 |mem| mem as *mut RcBox<mem::MaybeUninit<T>>,
             ))
@@ -880,11 +880,11 @@ impl Rc<dyn Any> {
 
 impl<T: ?Sized> Rc<T> {
     /// Allocates an `RcBox<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_rcbox` is called with the data pointer
     /// and must return back a (potentially fat)-pointer for the `RcBox<T>`.
-    unsafe fn allocate_for_unsized(
+    unsafe fn allocate_for_layout(
         value_layout: Layout,
         mem_to_rcbox: impl FnOnce(*mut u8) -> *mut RcBox<T>
     ) -> *mut RcBox<T> {
@@ -913,7 +913,7 @@ impl<T: ?Sized> Rc<T> {
     /// Allocates an `RcBox<T>` with sufficient space for an unsized value
     unsafe fn allocate_for_ptr(ptr: *const T) -> *mut RcBox<T> {
         // Allocate for the `RcBox<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 RcBox<T>,
         )
@@ -944,7 +944,7 @@ impl<T: ?Sized> Rc<T> {
 impl<T> Rc<[T]> {
     /// Allocates an `RcBox<[T]>` with the given length.
     unsafe fn allocate_for_slice(len: usize) -> *mut RcBox<[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 RcBox<[T]>,
         )
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]>,
         )