Skip to content

Commit 1769765

Browse files
authored
Rollup merge of #99270 - rhysd:issue-99269, r=Mark-Simulacrum
Add `#[must_use]` to `Box::from_raw` Fixes #99269
2 parents 30ddd4f + fcd56f7 commit 1769765

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

alloc/src/boxed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ impl<T: ?Sized> Box<T> {
949949
/// [`Layout`]: crate::Layout
950950
#[stable(feature = "box_raw", since = "1.4.0")]
951951
#[inline]
952+
#[must_use = "call `drop(from_raw(ptr))` if you intend to drop the `Box`"]
952953
pub unsafe fn from_raw(raw: *mut T) -> Self {
953954
unsafe { Self::from_raw_in(raw, Global) }
954955
}

0 commit comments

Comments
 (0)