about summary refs log tree commit diff
path: root/library/core/src/str/mod.rs
diff options
context:
space:
mode:
authorPavel Grigorenko <GrigorenkoPV@ya.ru>2025-02-16 00:40:25 +0300
committerPavel Grigorenko <GrigorenkoPV@ya.ru>2025-02-16 16:34:51 +0300
commitf53d0f502dba3b378d8baef159b97e685ba40f33 (patch)
tree3bdd1cb0596dc0872e9aa0a8d9442971c53a24e1 /library/core/src/str/mod.rs
parent4229b80f506d5c1e6267f27e69f10fa3bd3c8f9e (diff)
downloadrust-f53d0f502dba3b378d8baef159b97e685ba40f33.tar.gz
rust-f53d0f502dba3b378d8baef159b97e685ba40f33.zip
invalid_from_utf8[_unchecked]: also lint inherent methods
Diffstat (limited to 'library/core/src/str/mod.rs')
-rw-r--r--library/core/src/str/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs
index 05c16791ce7..fd2cd59f88e 100644
--- a/library/core/src/str/mod.rs
+++ b/library/core/src/str/mod.rs
@@ -238,6 +238,7 @@ impl str {
     /// assert_eq!("💖", sparkle_heart);
     /// ```
     #[unstable(feature = "inherent_str_constructors", issue = "131114")]
+    #[rustc_diagnostic_item = "str_inherent_from_utf8"]
     pub const fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
         converts::from_utf8(v)
     }
@@ -274,6 +275,7 @@ impl str {
     /// errors that can be returned.
     #[unstable(feature = "inherent_str_constructors", issue = "131114")]
     #[rustc_const_unstable(feature = "const_str_from_utf8", issue = "91006")]
+    #[rustc_diagnostic_item = "str_inherent_from_utf8_mut"]
     pub const fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
         converts::from_utf8_mut(v)
     }
@@ -306,6 +308,7 @@ impl str {
     #[inline]
     #[must_use]
     #[unstable(feature = "inherent_str_constructors", issue = "131114")]
+    #[rustc_diagnostic_item = "str_inherent_from_utf8_unchecked"]
     pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
         // SAFETY: converts::from_utf8_unchecked has the same safety requirements as this function.
         unsafe { converts::from_utf8_unchecked(v) }
@@ -331,6 +334,7 @@ impl str {
     #[inline]
     #[must_use]
     #[unstable(feature = "inherent_str_constructors", issue = "131114")]
+    #[rustc_diagnostic_item = "str_inherent_from_utf8_unchecked_mut"]
     pub const unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
         // SAFETY: converts::from_utf8_unchecked_mut has the same safety requirements as this function.
         unsafe { converts::from_utf8_unchecked_mut(v) }