Skip to content

Commit

Permalink
Rollup merge of #104024 - noeddl:unused-must-use, r=compiler-errors
Browse files Browse the repository at this point in the history
Fix `unused_must_use` warning for `Box::from_raw`
  • Loading branch information
fee1-dead authored Dec 28, 2022
2 parents d1193ad + 3b8b0ac commit 58233e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/lint/unused/must-use-box-from-raw.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
|
Expand Down

0 comments on commit 58233e9

Please sign in to comment.