Skip to content

Commit 4fc7d6b

Browse files
committed
make internal_into_inner_with_allocator an associated fn to prevent name collisions
1 parent c412131 commit 4fc7d6b

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
}
@@ -2440,7 +2440,7 @@ impl<A: Allocator> Arc<dyn Any + Send + Sync, A> {
24402440
{
24412441
if (*self).is::<T>() {
24422442
unsafe {
2443-
let (ptr, alloc) = self.internal_into_inner_with_allocator();
2443+
let (ptr, alloc) = Arc::into_inner_with_allocator(self);
24442444
Ok(Arc::from_inner_in(ptr.cast(), alloc))
24452445
}
24462446
} else {
@@ -2481,7 +2481,7 @@ impl<A: Allocator> Arc<dyn Any + Send + Sync, A> {
24812481
T: Any + Send + Sync,
24822482
{
24832483
unsafe {
2484-
let (ptr, alloc) = self.internal_into_inner_with_allocator();
2484+
let (ptr, alloc) = Arc::into_inner_with_allocator(self);
24852485
Arc::from_inner_in(ptr.cast(), alloc)
24862486
}
24872487
}
@@ -3443,7 +3443,7 @@ impl<T, A: Allocator, const N: usize> TryFrom<Arc<[T], A>> for Arc<[T; N], A> {
34433443

34443444
fn try_from(boxed_slice: Arc<[T], A>) -> Result<Self, Self::Error> {
34453445
if boxed_slice.len() == N {
3446-
let (ptr, alloc) = boxed_slice.internal_into_inner_with_allocator();
3446+
let (ptr, alloc) = Arc::into_inner_with_allocator(boxed_slice);
34473447
Ok(unsafe { Arc::from_inner_in(ptr.cast(), alloc) })
34483448
} else {
34493449
Err(boxed_slice)

0 commit comments

Comments
 (0)