Skip to content

Commit 58233e9

Browse files
authored
Rollup merge of #104024 - noeddl:unused-must-use, r=compiler-errors
Fix `unused_must_use` warning for `Box::from_raw`
2 parents d1193ad + 3b8b0ac commit 58233e9

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
@@ -954,7 +954,7 @@ impl<T: ?Sized> Box<T> {
954954
/// [`Layout`]: crate::Layout
955955
#[stable(feature = "box_raw", since = "1.4.0")]
956956
#[inline]
957-
#[must_use = "call `drop(from_raw(ptr))` if you intend to drop the `Box`"]
957+
#[must_use = "call `drop(Box::from_raw(ptr))` if you intend to drop the `Box`"]
958958
pub unsafe fn from_raw(raw: *mut T) -> Self {
959959
unsafe { Self::from_raw_in(raw, Global) }
960960
}

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)