This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -661,10 +661,14 @@ impl<T> Rc<T> {
661661
662662impl < T , A : Allocator > Rc < T , A > {
663663 /// Returns a reference to the underlying allocator.
664+ ///
665+ /// Note: this is an associated function, which means that you have
666+ /// to call it as `Rc::allocator(&r)` instead of `r.allocator()`. This
667+ /// is so that there is no conflict with a method on the inner type.
664668 #[ inline]
665669 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
666- pub fn allocator ( & self ) -> & A {
667- & self . alloc
670+ pub fn allocator ( this : & Self ) -> & A {
671+ & this . alloc
668672 }
669673 /// Constructs a new `Rc` in the provided allocator.
670674 ///
Original file line number Diff line number Diff line change @@ -678,10 +678,14 @@ impl<T> Arc<T> {
678678
679679impl < T , A : Allocator > Arc < T , A > {
680680 /// 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.
681685 #[ inline]
682686 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
683- pub fn allocator ( & self ) -> & A {
684- & self . alloc
687+ pub fn allocator ( this : & Self ) -> & A {
688+ & this . alloc
685689 }
686690 /// Constructs a new `Arc<T>` in the provided allocator.
687691 ///
You can’t perform that action at this time.
0 commit comments