Skip to content

Commit 1920ce9

Browse files
committed
make internal_into_inner_with_allocator an associated fn to prevent name collisions
1 parent 56ce17d commit 1920ce9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

library/alloc/src/sync.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ impl<T: ?Sized> Arc<T> {
280280

281281
impl<T: ?Sized, A: Allocator> Arc<T, A> {
282282
#[inline]
283-
fn internal_into_inner_with_allocator(self) -> (NonNull<ArcInner<T>>, A) {
284-
let this = mem::ManuallyDrop::new(self);
283+
fn into_inner_with_allocator(this: Self) -> (NonNull<ArcInner<T>>, A) {
284+
let this = mem::ManuallyDrop::new(this);
285285
(this.ptr, unsafe { ptr::read(&this.alloc) })
286286
}
287287

@@ -1282,7 +1282,7 @@ impl<T, A: Allocator> Arc<mem::MaybeUninit<T>, A> {
12821282
#[must_use = "`self` will be dropped if the result is not used"]
12831283
#[inline]
12841284
pub unsafe fn assume_init(self) -> Arc<T, A> {
1285-
let (ptr, alloc) = self.internal_into_inner_with_allocator();
1285+
let (ptr, alloc) = Arc::into_inner_with_allocator(self);
12861286
unsafe { Arc::from_inner_in(ptr.cast(), alloc) }
12871287
}
12881288
}
@@ -1324,7 +1324,7 @@ impl<T, A: Allocator> Arc<[mem::MaybeUninit<T>], A> {
13241324
#[must_use = "`self` will be dropped if the result is not used"]
13251325
#[inline]
13261326
pub unsafe fn assume_init(self) -> Arc<[T], A> {
1327-
let (ptr, alloc) = self.internal_into_inner_with_allocator();
1327+
let (ptr, alloc) = Arc::into_inner_with_allocator(self);
13281328
unsafe { Arc::from_ptr_in(ptr.as_ptr() as _, alloc) }
13291329
}
13301330
}
@@ -2488,7 +2488,7 @@ impl<A: Allocator> Arc<dyn Any + Send + Sync, A> {
24882488
{
24892489
if (*self).is::<T>() {
24902490
unsafe {
2491-
let (ptr, alloc) = self.internal_into_inner_with_allocator();
2491+
let (ptr, alloc) = Arc::into_inner_with_allocator(self);
24922492
Ok(Arc::from_inner_in(ptr.cast(), alloc))
24932493
}
24942494
} else {
@@ -2529,7 +2529,7 @@ impl<A: Allocator> Arc<dyn Any + Send + Sync, A> {
25292529
T: Any + Send + Sync,
25302530
{
25312531
unsafe {
2532-
let (ptr, alloc) = self.internal_into_inner_with_allocator();
2532+
let (ptr, alloc) = Arc::into_inner_with_allocator(self);
25332533
Arc::from_inner_in(ptr.cast(), alloc)
25342534
}
25352535
}
@@ -3491,7 +3491,7 @@ impl<T, A: Allocator, const N: usize> TryFrom<Arc<[T], A>> for Arc<[T; N], A> {
34913491

34923492
fn try_from(boxed_slice: Arc<[T], A>) -> Result<Self, Self::Error> {
34933493
if boxed_slice.len() == N {
3494-
let (ptr, alloc) = boxed_slice.internal_into_inner_with_allocator();
3494+
let (ptr, alloc) = Arc::into_inner_with_allocator(boxed_slice);
34953495
Ok(unsafe { Arc::from_inner_in(ptr.cast(), alloc) })
34963496
} else {
34973497
Err(boxed_slice)

0 commit comments

Comments
 (0)