@@ -677,16 +677,6 @@ impl<T> Arc<T> {
677677}
678678
679679impl < T , A : Allocator > Arc < T , A > {
680- /// Returns a reference to the underlying allocator.
681- ///
682- /// Note: this is an associated function, which means that you have
683- /// to call it as `Arc::allocator(&a)` instead of `a.allocator()`. This
684- /// is so that there is no conflict with a method on the inner type.
685- #[ inline]
686- #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
687- pub fn allocator ( this : & Self ) -> & A {
688- & this. alloc
689- }
690680 /// Constructs a new `Arc<T>` in the provided allocator.
691681 ///
692682 /// # Examples
@@ -1433,6 +1423,17 @@ impl<T: ?Sized> Arc<T> {
14331423}
14341424
14351425impl < T : ?Sized , A : Allocator > Arc < T , A > {
1426+ /// Returns a reference to the underlying allocator.
1427+ ///
1428+ /// Note: this is an associated function, which means that you have
1429+ /// to call it as `Arc::allocator(&a)` instead of `a.allocator()`. This
1430+ /// is so that there is no conflict with a method on the inner type.
1431+ #[ inline]
1432+ #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1433+ pub fn allocator ( this : & Self ) -> & A {
1434+ & this. alloc
1435+ }
1436+
14361437 /// Consumes the `Arc`, returning the wrapped pointer.
14371438 ///
14381439 /// To avoid a memory leak the pointer must be converted back to an `Arc` using
@@ -2619,6 +2620,13 @@ impl<T: ?Sized> Weak<T> {
26192620}
26202621
26212622impl < T : ?Sized , A : Allocator > Weak < T , A > {
2623+ /// Returns a reference to the underlying allocator.
2624+ #[ inline]
2625+ #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
2626+ pub fn allocator ( & self ) -> & A {
2627+ & self . alloc
2628+ }
2629+
26222630 /// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`.
26232631 ///
26242632 /// The pointer is valid only if there are some strong references. The pointer may be dangling,
0 commit comments