Skip to content

Commit fcd56f7

Browse files
committed
add #[must_use] to Box::from_raw
1 parent f44864e commit fcd56f7

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)