about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/str.rs1
-rw-r--r--library/alloc/src/string.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs
index 2900d01d9bd..ac7f2304456 100644
--- a/library/alloc/src/str.rs
+++ b/library/alloc/src/str.rs
@@ -595,6 +595,7 @@ impl str {
 /// assert_eq!("☺", &*smile);
 /// ```
 #[stable(feature = "str_box_extras", since = "1.20.0")]
+#[must_use]
 #[inline]
 pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box<str> {
     unsafe { Box::from_raw(Box::into_raw(v) as *mut str) }
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs
index d88b8e39898..0c383b8bdb6 100644
--- a/library/alloc/src/string.rs
+++ b/library/alloc/src/string.rs
@@ -761,6 +761,7 @@ impl String {
     /// assert_eq!("💖", sparkle_heart);
     /// ```
     #[inline]
+    #[must_use]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub unsafe fn from_utf8_unchecked(bytes: Vec<u8>) -> String {
         String { vec: bytes }