@@ -677,16 +677,6 @@ impl<T> Arc<T> {
677
677
}
678
678
679
679
impl < 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
- }
690
680
/// Constructs a new `Arc<T>` in the provided allocator.
691
681
///
692
682
/// # Examples
@@ -1433,6 +1423,17 @@ impl<T: ?Sized> Arc<T> {
1433
1423
}
1434
1424
1435
1425
impl < 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
+
1436
1437
/// Consumes the `Arc`, returning the wrapped pointer.
1437
1438
///
1438
1439
/// To avoid a memory leak the pointer must be converted back to an `Arc` using
@@ -2619,6 +2620,13 @@ impl<T: ?Sized> Weak<T> {
2619
2620
}
2620
2621
2621
2622
impl < 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
+
2622
2630
/// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`.
2623
2631
///
2624
2632
/// The pointer is valid only if there are some strong references. The pointer may be dangling,
0 commit comments