@@ -683,16 +683,6 @@ impl<T> Arc<T> {
683
683
}
684
684
685
685
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
- }
696
686
/// Constructs a new `Arc<T>` in the provided allocator.
697
687
///
698
688
/// # Examples
@@ -1473,6 +1463,17 @@ impl<T: ?Sized> Arc<T> {
1473
1463
}
1474
1464
1475
1465
impl < T : ?Sized , A : Allocator > Arc < T , A > {
1466
+ /// Returns a reference to the underlying allocator.
1467
+ ///
1468
+ /// Note: this is an associated function, which means that you have
1469
+ /// to call it as `Arc::allocator(&a)` instead of `a.allocator()`. This
1470
+ /// is so that there is no conflict with a method on the inner type.
1471
+ #[ inline]
1472
+ #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1473
+ pub fn allocator ( this : & Self ) -> & A {
1474
+ & this. alloc
1475
+ }
1476
+
1476
1477
/// Consumes the `Arc`, returning the wrapped pointer.
1477
1478
///
1478
1479
/// To avoid a memory leak the pointer must be converted back to an `Arc` using
@@ -2661,6 +2662,13 @@ impl<T: ?Sized> Weak<T> {
2661
2662
}
2662
2663
2663
2664
impl < T : ?Sized , A : Allocator > Weak < T , A > {
2665
+ /// Returns a reference to the underlying allocator.
2666
+ #[ inline]
2667
+ #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
2668
+ pub fn allocator ( & self ) -> & A {
2669
+ & self . alloc
2670
+ }
2671
+
2664
2672
/// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`.
2665
2673
///
2666
2674
/// The pointer is valid only if there are some strong references. The pointer may be dangling,
0 commit comments