summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorrhysd <lin90162@yahoo.co.jp>2022-07-15 17:05:50 +0900
committerrhysd <lin90162@yahoo.co.jp>2022-07-15 17:05:50 +0900
commitfa3156ec427192d3ebe3992f1c49b542d3d1179a (patch)
treeb28c8d2bded02cc665c4c7091a92dedb585bab97 /library/alloc/src
parent30243dd87e7dbd17d68e1a1d16ba066a7d2cebe5 (diff)
downloadrust-fa3156ec427192d3ebe3992f1c49b542d3d1179a.tar.gz
rust-fa3156ec427192d3ebe3992f1c49b542d3d1179a.zip
add `#[must_use]` to `Box::from_raw`
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/boxed.rs1
1 files changed, 1 insertions, 0 deletions
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<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`"]
     pub unsafe fn from_raw(raw: *mut T) -> Self {
         unsafe { Self::from_raw_in(raw, Global) }
     }