mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Clarify/add must_use
message for Rc/Arc/Weak::into_raw.
This commit is contained in:
parent
61223975d4
commit
261da5fc4b
@ -1329,6 +1329,7 @@ impl<T: ?Sized, A: Allocator> Rc<T, A> {
|
||||
/// let x_ptr = Rc::into_raw(x);
|
||||
/// assert_eq!(unsafe { &*x_ptr }, "hello");
|
||||
/// ```
|
||||
#[must_use = "losing the pointer will leak memory"]
|
||||
#[stable(feature = "rc_raw", since = "1.17.0")]
|
||||
#[rustc_never_returns_null_ptr]
|
||||
pub fn into_raw(this: Self) -> *const T {
|
||||
@ -2966,7 +2967,7 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
|
||||
///
|
||||
/// [`from_raw`]: Weak::from_raw
|
||||
/// [`as_ptr`]: Weak::as_ptr
|
||||
#[must_use = "`self` will be dropped if the result is not used"]
|
||||
#[must_use = "losing the pointer will leak memory"]
|
||||
#[stable(feature = "weak_into_raw", since = "1.45.0")]
|
||||
pub fn into_raw(self) -> *const T {
|
||||
let result = self.as_ptr();
|
||||
|
@ -2715,7 +2715,7 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
|
||||
///
|
||||
/// [`from_raw`]: Weak::from_raw
|
||||
/// [`as_ptr`]: Weak::as_ptr
|
||||
#[must_use = "`self` will be dropped if the result is not used"]
|
||||
#[must_use = "losing the pointer will leak memory"]
|
||||
#[stable(feature = "weak_into_raw", since = "1.45.0")]
|
||||
pub fn into_raw(self) -> *const T {
|
||||
let result = self.as_ptr();
|
||||
|
Loading…
Reference in New Issue
Block a user