@@ -198,7 +198,7 @@ impl str {
198198 /// Basic usage:
199199 ///
200200 /// ```
201- /// use std::str;
201+ /// #![feature(inherent_str_constructors)]
202202 ///
203203 /// // some bytes, in a vector
204204 /// let sparkle_heart = vec![240, 159, 146, 150];
@@ -207,13 +207,13 @@ impl str {
207207 /// let sparkle_heart = str::from_utf8(&sparkle_heart)?;
208208 ///
209209 /// assert_eq!("💖", sparkle_heart);
210- /// # Ok::<_, str::Utf8Error>(())
210+ /// # Ok::<_, std:: str::Utf8Error>(())
211211 /// ```
212212 ///
213213 /// Incorrect bytes:
214214 ///
215215 /// ```
216- /// use std::str;
216+ /// #![feature(inherent_str_constructors)]
217217 ///
218218 /// // some invalid bytes, in a vector
219219 /// let sparkle_heart = vec![0, 159, 146, 150];
@@ -227,7 +227,7 @@ impl str {
227227 /// A "stack allocated string":
228228 ///
229229 /// ```
230- /// use std::str;
230+ /// #![feature(inherent_str_constructors)]
231231 ///
232232 /// // some bytes, in a stack-allocated array
233233 /// let sparkle_heart = [240, 159, 146, 150];
@@ -238,6 +238,7 @@ impl str {
238238 /// assert_eq!("💖", sparkle_heart);
239239 /// ```
240240 #[ unstable( feature = "inherent_str_constructors" , issue = "131114" ) ]
241+ #[ rustc_diagnostic_item = "str_inherent_from_utf8" ]
241242 pub const fn from_utf8 ( v : & [ u8 ] ) -> Result < & str , Utf8Error > {
242243 converts:: from_utf8 ( v)
243244 }
@@ -249,7 +250,7 @@ impl str {
249250 /// Basic usage:
250251 ///
251252 /// ```
252- /// use std::str;
253+ /// #![feature(inherent_str_constructors)]
253254 ///
254255 /// // "Hello, Rust!" as a mutable vector
255256 /// let mut hellorust = vec![72, 101, 108, 108, 111, 44, 32, 82, 117, 115, 116, 33];
@@ -263,7 +264,7 @@ impl str {
263264 /// Incorrect bytes:
264265 ///
265266 /// ```
266- /// use std::str;
267+ /// #![feature(inherent_str_constructors)]
267268 ///
268269 /// // Some invalid bytes in a mutable vector
269270 /// let mut invalid = vec![128, 223];
@@ -274,6 +275,7 @@ impl str {
274275 /// errors that can be returned.
275276 #[ unstable( feature = "inherent_str_constructors" , issue = "131114" ) ]
276277 #[ rustc_const_unstable( feature = "const_str_from_utf8" , issue = "91006" ) ]
278+ #[ rustc_diagnostic_item = "str_inherent_from_utf8_mut" ]
277279 pub const fn from_utf8_mut ( v : & mut [ u8 ] ) -> Result < & mut str , Utf8Error > {
278280 converts:: from_utf8_mut ( v)
279281 }
@@ -292,7 +294,7 @@ impl str {
292294 /// Basic usage:
293295 ///
294296 /// ```
295- /// use std::str;
297+ /// #![feature(inherent_str_constructors)]
296298 ///
297299 /// // some bytes, in a vector
298300 /// let sparkle_heart = vec![240, 159, 146, 150];
@@ -306,6 +308,7 @@ impl str {
306308 #[ inline]
307309 #[ must_use]
308310 #[ unstable( feature = "inherent_str_constructors" , issue = "131114" ) ]
311+ #[ rustc_diagnostic_item = "str_inherent_from_utf8_unchecked" ]
309312 pub const unsafe fn from_utf8_unchecked ( v : & [ u8 ] ) -> & str {
310313 // SAFETY: converts::from_utf8_unchecked has the same safety requirements as this function.
311314 unsafe { converts:: from_utf8_unchecked ( v) }
@@ -321,7 +324,7 @@ impl str {
321324 /// Basic usage:
322325 ///
323326 /// ```
324- /// use std::str;
327+ /// #![feature(inherent_str_constructors)]
325328 ///
326329 /// let mut heart = vec![240, 159, 146, 150];
327330 /// let heart = unsafe { str::from_utf8_unchecked_mut(&mut heart) };
@@ -331,6 +334,7 @@ impl str {
331334 #[ inline]
332335 #[ must_use]
333336 #[ unstable( feature = "inherent_str_constructors" , issue = "131114" ) ]
337+ #[ rustc_diagnostic_item = "str_inherent_from_utf8_unchecked_mut" ]
334338 pub const unsafe fn from_utf8_unchecked_mut ( v : & mut [ u8 ] ) -> & mut str {
335339 // SAFETY: converts::from_utf8_unchecked_mut has the same safety requirements as this function.
336340 unsafe { converts:: from_utf8_unchecked_mut ( v) }
0 commit comments