Skip to content

Commit f9d7307

Browse files
committed
make internal_into_inner_with_allocator an associated fn to prevent name collisions
1 parent f05b63b commit f9d7307

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

library/alloc/src/sync.rs

Lines changed: 7 additions & 7 deletions
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

@@ -1290,7 +1290,7 @@ impl<T, A: Allocator> Arc<mem::MaybeUninit<T>, A> {
12901290
#[must_use = "`self` will be dropped if the result is not used"]
12911291
#[inline]
12921292
pub unsafe fn assume_init(self) -> Arc<T, A> {
1293-
let (ptr, alloc) = self.internal_into_inner_with_allocator();
1293+
let (ptr, alloc) = Arc::into_inner_with_allocator(self);
12941294
unsafe { Arc::from_inner_in(ptr.cast(), alloc) }
12951295
}
12961296
}
@@ -1332,7 +1332,7 @@ impl<T, A: Allocator> Arc<[mem::MaybeUninit<T>], A> {
13321332
#[must_use = "`self` will be dropped if the result is not used"]
13331333
#[inline]
13341334
pub unsafe fn assume_init(self) -> Arc<[T], A> {
1335-
let (ptr, alloc) = self.internal_into_inner_with_allocator();
1335+
let (ptr, alloc) = Arc::into_inner_with_allocator(self);
13361336
unsafe { Arc::from_ptr_in(ptr.as_ptr() as _, alloc) }
13371337
}
13381338
}
@@ -2499,7 +2499,7 @@ impl<A: Allocator> Arc<dyn Any + Send + Sync, A> {
24992499
{
25002500
if (*self).is::<T>() {
25012501
unsafe {
2502-
let (ptr, alloc) = self.internal_into_inner_with_allocator();
2502+
let (ptr, alloc) = Arc::into_inner_with_allocator(self);
25032503
Ok(Arc::from_inner_in(ptr.cast(), alloc))
25042504
}
25052505
} else {
@@ -2540,7 +2540,7 @@ impl<A: Allocator> Arc<dyn Any + Send + Sync, A> {
25402540
T: Any + Send + Sync,
25412541
{
25422542
unsafe {
2543-
let (ptr, alloc) = self.internal_into_inner_with_allocator();
2543+
let (ptr, alloc) = Arc::into_inner_with_allocator(self);
25442544
Arc::from_inner_in(ptr.cast(), alloc)
25452545
}
25462546
}
@@ -3506,7 +3506,7 @@ impl<T, A: Allocator, const N: usize> TryFrom<Arc<[T], A>> for Arc<[T; N], A> {
35063506

35073507
fn try_from(boxed_slice: Arc<[T], A>) -> Result<Self, Self::Error> {
35083508
if boxed_slice.len() == N {
3509-
let (ptr, alloc) = boxed_slice.internal_into_inner_with_allocator();
3509+
let (ptr, alloc) = Arc::into_inner_with_allocator(boxed_slice);
35103510
Ok(unsafe { Arc::from_inner_in(ptr.cast(), alloc) })
35113511
} else {
35123512
Err(boxed_slice)

0 commit comments

Comments
 (0)