Rollup merge of #104024 - noeddl:unused-must-use, r=compiler-errors

Fix `unused_must_use` warning for `Box::from_raw`
This commit is contained in:
fee1-dead 2022-12-28 15:51:39 +08:00 committed by GitHub
commit 58233e90b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

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

View File

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