Skip to content

Commit 888f0cf

Browse files
committed
Move Arc::allocator to T: ?Sized
1 parent 4fc7d6b commit 888f0cf

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

library/alloc/src/sync.rs

+11-10
Original file line numberDiff line numberDiff line change
@@ -683,16 +683,6 @@ impl<T> Arc<T> {
683683
}
684684

685685
impl<T, A: Allocator> Arc<T, A> {
686-
/// Returns a reference to the underlying allocator.
687-
///
688-
/// Note: this is an associated function, which means that you have
689-
/// to call it as `Arc::allocator(&a)` instead of `a.allocator()`. This
690-
/// is so that there is no conflict with a method on the inner type.
691-
#[inline]
692-
#[unstable(feature = "allocator_api", issue = "32838")]
693-
pub fn allocator(this: &Self) -> &A {
694-
&this.alloc
695-
}
696686
/// Constructs a new `Arc<T>` in the provided allocator.
697687
///
698688
/// # Examples
@@ -1443,6 +1433,17 @@ impl<T: ?Sized> Arc<T> {
14431433
}
14441434

14451435
impl<T: ?Sized, A: Allocator> Arc<T, A> {
1436+
/// Returns a reference to the underlying allocator.
1437+
///
1438+
/// Note: this is an associated function, which means that you have
1439+
/// to call it as `Arc::allocator(&a)` instead of `a.allocator()`. This
1440+
/// is so that there is no conflict with a method on the inner type.
1441+
#[inline]
1442+
#[unstable(feature = "allocator_api", issue = "32838")]
1443+
pub fn allocator(this: &Self) -> &A {
1444+
&this.alloc
1445+
}
1446+
14461447
/// Consumes the `Arc`, returning the wrapped pointer.
14471448
///
14481449
/// To avoid a memory leak the pointer must be converted back to an `Arc` using

0 commit comments

Comments
 (0)