]> git.proxmox.com Git - rustc.git/blame - src/test/ui/str/str-idx.stderr
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / str / str-idx.stderr
CommitLineData
b7449926 1error[E0277]: the type `str` cannot be indexed by `{integer}`
0731742a 2 --> $DIR/str-idx.rs:3:17
b7449926 3 |
532ac7d7 4LL | let _: u8 = s[4];
9fa01778 5 | ^^^^ string indices are ranges of `usize`
b7449926 6 |
9fa01778
XL
7 = help: the trait `std::slice::SliceIndex<str>` is not implemented for `{integer}`
8 = note: you can use `.chars().nth()` or `.bytes().nth()`
9 see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
10 = note: required because of the requirements on the impl of `std::ops::Index<{integer}>` for `str`
b7449926 11
9fa01778 12error[E0277]: the type `str` cannot be indexed by `{integer}`
e1599b0c 13 --> $DIR/str-idx.rs:4:19
9fa01778 14 |
532ac7d7 15LL | let _ = s.get(4);
e1599b0c 16 | ^ string indices are ranges of `usize`
9fa01778
XL
17 |
18 = help: the trait `std::slice::SliceIndex<str>` is not implemented for `{integer}`
19 = note: you can use `.chars().nth()` or `.bytes().nth()`
20 see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
21
22error[E0277]: the type `str` cannot be indexed by `{integer}`
e1599b0c 23 --> $DIR/str-idx.rs:5:29
9fa01778 24 |
532ac7d7 25LL | let _ = s.get_unchecked(4);
e1599b0c 26 | ^ string indices are ranges of `usize`
9fa01778
XL
27 |
28 = help: the trait `std::slice::SliceIndex<str>` is not implemented for `{integer}`
29 = note: you can use `.chars().nth()` or `.bytes().nth()`
30 see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
31
32error[E0277]: the type `str` cannot be indexed by `char`
33 --> $DIR/str-idx.rs:6:17
34 |
532ac7d7 35LL | let _: u8 = s['c'];
9fa01778
XL
36 | ^^^^^^ string indices are ranges of `usize`
37 |
38 = help: the trait `std::slice::SliceIndex<str>` is not implemented for `char`
39 = note: required because of the requirements on the impl of `std::ops::Index<char>` for `str`
40
41error: aborting due to 4 previous errors
b7449926
XL
42
43For more information about this error, try `rustc --explain E0277`.