blob: 9f21aaaebad58ea2e9b1e1fe318cb4fd02946d5d [file] [log] [blame]
error[E0277]: the type `str` cannot be indexed by `{integer}`
--> $DIR/str-idx.rs:3:17
|
LL | let _: u8 = s[4];
| ^^^^ string indices are ranges of `usize`
|
= help: the trait `std::slice::SliceIndex<str>` is not implemented for `{integer}`
= 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>
= note: required because of the requirements on the impl of `std::ops::Index<{integer}>` for `str`
error[E0277]: the type `str` cannot be indexed by `{integer}`
--> $DIR/str-idx.rs:4:19
|
LL | let _ = s.get(4);
| ^ string indices are ranges of `usize`
|
= help: the trait `std::slice::SliceIndex<str>` is not implemented for `{integer}`
= 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>
error[E0277]: the type `str` cannot be indexed by `{integer}`
--> $DIR/str-idx.rs:5:29
|
LL | let _ = s.get_unchecked(4);
| ^ string indices are ranges of `usize`
|
= help: the trait `std::slice::SliceIndex<str>` is not implemented for `{integer}`
= 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>
error[E0277]: the type `str` cannot be indexed by `char`
--> $DIR/str-idx.rs:6:17
|
LL | let _: u8 = s['c'];
| ^^^^^^ string indices are ranges of `usize`
|
= help: the trait `std::slice::SliceIndex<str>` is not implemented for `char`
= note: required because of the requirements on the impl of `std::ops::Index<char>` for `str`
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.