|
51 | 51 | /// ```
|
52 | 52 | #[lang = "index"]
|
53 | 53 | #[rustc_on_unimplemented(
|
| 54 | + on( |
| 55 | + _Self="&str", |
| 56 | + note="you can use `.chars().nth()` or `.bytes().nth()` |
| 57 | +see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>" |
| 58 | + ), |
| 59 | + on( |
| 60 | + _Self="str", |
| 61 | + note="you can use `.chars().nth()` or `.bytes().nth()` |
| 62 | +see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>" |
| 63 | + ), |
| 64 | + on( |
| 65 | + _Self="std::string::String", |
| 66 | + note="you can use `.chars().nth()` or `.bytes().nth()` |
| 67 | +see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>" |
| 68 | + ), |
54 | 69 | message="the type `{Self}` cannot be indexed by `{Idx}`",
|
55 | 70 | label="`{Self}` cannot be indexed by `{Idx}`",
|
56 | 71 | )]
|
@@ -141,6 +156,21 @@ pub trait Index<Idx: ?Sized> {
|
141 | 156 | /// ```
|
142 | 157 | #[lang = "index_mut"]
|
143 | 158 | #[rustc_on_unimplemented(
|
| 159 | + on( |
| 160 | + _Self="&str", |
| 161 | + note="you can use `.chars().nth()` or `.bytes().nth()` |
| 162 | +see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>" |
| 163 | + ), |
| 164 | + on( |
| 165 | + _Self="str", |
| 166 | + note="you can use `.chars().nth()` or `.bytes().nth()` |
| 167 | +see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>" |
| 168 | + ), |
| 169 | + on( |
| 170 | + _Self="std::string::String", |
| 171 | + note="you can use `.chars().nth()` or `.bytes().nth()` |
| 172 | +see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>" |
| 173 | + ), |
144 | 174 | message="the type `{Self}` cannot be mutably indexed by `{Idx}`",
|
145 | 175 | label="`{Self}` cannot be mutably indexed by `{Idx}`",
|
146 | 176 | )]
|
|
0 commit comments