From fa3156ec427192d3ebe3992f1c49b542d3d1179a Mon Sep 17 00:00:00 2001 From: rhysd Date: Fri, 15 Jul 2022 17:05:50 +0900 Subject: add `#[must_use]` to `Box::from_raw` --- library/alloc/src/boxed.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'library/alloc') diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index d83bab7bbbd..c1ceeb0deb8 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -949,6 +949,7 @@ impl Box { /// [`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`"] pub unsafe fn from_raw(raw: *mut T) -> Self { unsafe { Self::from_raw_in(raw, Global) } } -- cgit 1.4.1-3-g733a5