rust/src/test/ui/str/str-idx.stderr

14 lines
607 B
Plaintext
Raw Normal View History

2018-08-08 12:28:26 +00:00
error[E0277]: the type `str` cannot be indexed by `{integer}`
2018-12-25 15:56:47 +00:00
--> $DIR/str-idx.rs:3:17
2018-08-08 12:28:26 +00:00
|
LL | let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}`
| ^^^^ `str` cannot be indexed by `{integer}`
|
= help: the trait `std::ops::Index<{integer}>` is not implemented for `str`
= note: you can use `.chars().nth()` or `.bytes().nth()`
see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
2018-08-08 12:28:26 +00:00
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.