@@ -2245,7 +2245,9 @@ impl<T: Clone, A: Allocator + Clone> Arc<T, A> {
22452245 // either unique to begin with, or became one upon cloning the contents.
22462246 unsafe { Self :: get_mut_unchecked ( this) }
22472247 }
2248+ }
22482249
2250+ impl < T : Clone , A : Allocator > Arc < T , A > {
22492251 /// If we have the only reference to `T` then unwrap it. Otherwise, clone `T` and return the
22502252 /// clone.
22512253 ///
@@ -2591,6 +2593,13 @@ impl<T> Weak<T> {
25912593}
25922594
25932595impl < T , A : Allocator > Weak < T , A > {
2596+ /// Returns a reference to the underlying allocator.
2597+ #[ inline]
2598+ #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
2599+ pub fn allocator ( & self ) -> & A {
2600+ & self . alloc
2601+ }
2602+
25942603 /// Constructs a new `Weak<T, A>`, without allocating any memory, technically in the provided
25952604 /// allocator.
25962605 /// Calling [`upgrade`] on the return value always gives [`None`].
@@ -3479,7 +3488,7 @@ impl<T: ?Sized, A: Allocator> From<Box<T, A>> for Arc<T, A> {
34793488
34803489#[ cfg( not( no_global_oom_handling) ) ]
34813490#[ stable( feature = "shared_from_slice" , since = "1.21.0" ) ]
3482- impl < T , A : Allocator + Clone > From < Vec < T , A > > for Arc < [ T ] , A > {
3491+ impl < T , A : Allocator > From < Vec < T , A > > for Arc < [ T ] , A > {
34833492 /// Allocate a reference-counted slice and move `v`'s items into it.
34843493 ///
34853494 /// # Example
0 commit comments