Skip to content

Commit 3b8b0ac

Browse files
committed
Fix unused_must_use warning for Box::from_raw
1 parent 6b8d9dd commit 3b8b0ac

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

library/alloc/src/boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ impl<T: ?Sized> Box<T> {
952952
/// [`Layout`]: crate::Layout
953953
#[stable(feature = "box_raw", since = "1.4.0")]
954954
#[inline]
955-
#[must_use = "call `drop(from_raw(ptr))` if you intend to drop the `Box`"]
955+
#[must_use = "call `drop(Box::from_raw(ptr))` if you intend to drop the `Box`"]
956956
pub unsafe fn from_raw(raw: *mut T) -> Self {
957957
unsafe { Self::from_raw_in(raw, Global) }
958958
}

src/test/ui/lint/unused/must-use-box-from-raw.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: unused return value of `Box::<T>::from_raw` that must be used
44
LL | Box::from_raw(ptr);
55
| ^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: call `drop(from_raw(ptr))` if you intend to drop the `Box`
7+
= note: call `drop(Box::from_raw(ptr))` if you intend to drop the `Box`
88
note: the lint level is defined here
99
--> $DIR/must-use-box-from-raw.rs:5:9
1010
|

0 commit comments

Comments
 (0)