about summary refs log tree commit diff
path: root/library/core/src/slice
diff options
context:
space:
mode:
authorRageking8 <tomleetyt@gmail.com>2023-06-26 20:40:06 +0800
committerRageking8 <tomleetyt@gmail.com>2023-06-27 18:13:24 +0800
commit48544c1b12b50ab5fd6a772060c17bdb8b5a32d2 (patch)
tree0041c26fbd014cf1c68b61c32b217b337f1000a6 /library/core/src/slice
parent25b5af1b3a0b9e2c0c57b223b2d0e3e203869b2c (diff)
downloadrust-48544c1b12b50ab5fd6a772060c17bdb8b5a32d2.tar.gz
rust-48544c1b12b50ab5fd6a772060c17bdb8b5a32d2.zip
Make `rustc_on_unimplemented` std-agnostic
Diffstat (limited to 'library/core/src/slice')
-rw-r--r--library/core/src/slice/index.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/library/core/src/slice/index.rs b/library/core/src/slice/index.rs
index 6ef9f9c95e8..e1e3bcc05e7 100644
--- a/library/core/src/slice/index.rs
+++ b/library/core/src/slice/index.rs
@@ -152,7 +152,10 @@ mod private_slice_index {
 #[rustc_on_unimplemented(
     on(T = "str", label = "string indices are ranges of `usize`",),
     on(
-        all(any(T = "str", T = "&str", T = "std::string::String"), _Self = "{integer}"),
+        all(
+            any(T = "str", T = "&str", T = "alloc::string::String", T = "std::string::String"),
+            _Self = "{integer}"
+        ),
         note = "you can use `.chars().nth()` or `.bytes().nth()`\n\
                 for more information, see chapter 8 in The Book: \
                 <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>"