@@ -2256,7 +2256,9 @@ impl<T: Clone, A: Allocator + Clone> Arc<T, A> {
22562256 // either unique to begin with, or became one upon cloning the contents.
22572257 unsafe { Self :: get_mut_unchecked ( this) }
22582258 }
2259+ }
22592260
2261+ impl < T : Clone , A : Allocator > Arc < T , A > {
22602262 /// If we have the only reference to `T` then unwrap it. Otherwise, clone `T` and return the
22612263 /// clone.
22622264 ///
@@ -2690,6 +2692,13 @@ impl<T: ?Sized> Weak<T> {
26902692}
26912693
26922694impl < T : ?Sized , A : Allocator > Weak < T , A > {
2695+ /// Returns a reference to the underlying allocator.
2696+ #[ inline]
2697+ #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
2698+ pub fn allocator ( & self ) -> & A {
2699+ & self . alloc
2700+ }
2701+
26932702 /// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`.
26942703 ///
26952704 /// The pointer is valid only if there are some strong references. The pointer may be dangling,
@@ -3494,7 +3503,7 @@ impl<T: ?Sized, A: Allocator> From<Box<T, A>> for Arc<T, A> {
34943503
34953504#[ cfg( not( no_global_oom_handling) ) ]
34963505#[ stable( feature = "shared_from_slice" , since = "1.21.0" ) ]
3497- impl < T , A : Allocator + Clone > From < Vec < T , A > > for Arc < [ T ] , A > {
3506+ impl < T , A : Allocator > From < Vec < T , A > > for Arc < [ T ] , A > {
34983507 /// Allocate a reference-counted slice and move `v`'s items into it.
34993508 ///
35003509 /// # Example
0 commit comments