Rollup merge of #124980 - zachs18:rc-allocator, r=Amanieu · model-checking/verify-rust-std@1e5cd21 (original) (raw)
`@@ -665,16 +665,6 @@ impl Rc {
`
665
665
`}
`
666
666
``
667
667
`impl<T, A: Allocator> Rc<T, A> {
`
668
``
`-
/// Returns a reference to the underlying allocator.
`
669
``
`-
///
`
670
``
`-
/// Note: this is an associated function, which means that you have
`
671
``
`` -
/// to call it as Rc::allocator(&r)
instead of r.allocator()
. This
``
672
``
`-
/// is so that there is no conflict with a method on the inner type.
`
673
``
`-
#[inline]
`
674
``
`-
#[unstable(feature = "allocator_api", issue = "32838")]
`
675
``
`-
pub fn allocator(this: &Self) -> &A {
`
676
``
`-
&this.alloc
`
677
``
`-
}
`
678
668
`` /// Constructs a new Rc
in the provided allocator.
``
679
669
`///
`
680
670
`/// # Examples
`
`@@ -1331,6 +1321,17 @@ impl<T: ?Sized> Rc {
`
1331
1321
`}
`
1332
1322
``
1333
1323
`impl<T: ?Sized, A: Allocator> Rc<T, A> {
`
``
1324
`+
/// Returns a reference to the underlying allocator.
`
``
1325
`+
///
`
``
1326
`+
/// Note: this is an associated function, which means that you have
`
``
1327
`` +
/// to call it as Rc::allocator(&r)
instead of r.allocator()
. This
``
``
1328
`+
/// is so that there is no conflict with a method on the inner type.
`
``
1329
`+
#[inline]
`
``
1330
`+
#[unstable(feature = "allocator_api", issue = "32838")]
`
``
1331
`+
pub fn allocator(this: &Self) -> &A {
`
``
1332
`+
&this.alloc
`
``
1333
`+
}
`
``
1334
+
1334
1335
`` /// Consumes the Rc
, returning the wrapped pointer.
``
1335
1336
`///
`
1336
1337
`` /// To avoid a memory leak the pointer must be converted back to an Rc
using
``
`@@ -2994,6 +2995,13 @@ impl<T: ?Sized> Weak {
`
2994
2995
`}
`
2995
2996
``
2996
2997
`impl<T: ?Sized, A: Allocator> Weak<T, A> {
`
``
2998
`+
/// Returns a reference to the underlying allocator.
`
``
2999
`+
#[inline]
`
``
3000
`+
#[unstable(feature = "allocator_api", issue = "32838")]
`
``
3001
`+
pub fn allocator(&self) -> &A {
`
``
3002
`+
&self.alloc
`
``
3003
`+
}
`
``
3004
+
2997
3005
`` /// Returns a raw pointer to the object T
pointed to by this Weak<T>
.
``
2998
3006
`///
`
2999
3007
`/// The pointer is valid only if there are some strong references. The pointer may be dangling,
`