summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-07-16 17:53:03 +0900
committerGitHub <noreply@github.com>2022-07-16 17:53:03 +0900
commit96474a718be0d7d660e2f3835bac9f4c7572f993 (patch)
tree89416844e8a5078f341ab377564aec4f86c33814 /library/alloc/src
parent8a64529763a5dbe876ecf3bb6ee6771aa0a19669 (diff)
parentfa3156ec427192d3ebe3992f1c49b542d3d1179a (diff)
downloadrust-96474a718be0d7d660e2f3835bac9f4c7572f993.tar.gz
rust-96474a718be0d7d660e2f3835bac9f4c7572f993.zip
Rollup merge of #99270 - rhysd:issue-99269, r=Mark-Simulacrum
Add `#[must_use]` to `Box::from_raw`

Fixes #99269
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) }
     }