]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | error[E0277]: the type `str` cannot be indexed by `{integer}` |
064997fb | 2 | --> $DIR/str-idx.rs:3:19 |
b7449926 | 3 | | |
532ac7d7 | 4 | LL | let _: u8 = s[4]; |
064997fb | 5 | | ^ string indices are ranges of `usize` |
b7449926 | 6 | | |
1b1a35ee | 7 | = help: the trait `SliceIndex<str>` is not implemented for `{integer}` |
9fa01778 | 8 | = note: you can use `.chars().nth()` or `.bytes().nth()` |
1b1a35ee | 9 | for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> |
04454e1e | 10 | = help: the trait `SliceIndex<[T]>` is implemented for `usize` |
f2b60f7d | 11 | = note: required for `str` to implement `Index<{integer}>` |
b7449926 | 12 | |
9fa01778 | 13 | error[E0277]: the type `str` cannot be indexed by `{integer}` |
e1599b0c | 14 | --> $DIR/str-idx.rs:4:19 |
9fa01778 | 15 | | |
532ac7d7 | 16 | LL | let _ = s.get(4); |
c295e0f8 XL |
17 | | --- ^ string indices are ranges of `usize` |
18 | | | | |
19 | | required by a bound introduced by this call | |
9fa01778 | 20 | | |
1b1a35ee | 21 | = help: the trait `SliceIndex<str>` is not implemented for `{integer}` |
9fa01778 | 22 | = note: you can use `.chars().nth()` or `.bytes().nth()` |
1b1a35ee | 23 | for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> |
04454e1e | 24 | = help: the trait `SliceIndex<[T]>` is implemented for `usize` |
3c0e092e XL |
25 | note: required by a bound in `core::str::<impl str>::get` |
26 | --> $SRC_DIR/core/src/str/mod.rs:LL:COL | |
27 | | | |
5e7ed085 FG |
28 | LL | pub const fn get<I: ~const SliceIndex<str>>(&self, i: I) -> Option<&I::Output> { |
29 | | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get` | |
9fa01778 XL |
30 | |
31 | error[E0277]: the type `str` cannot be indexed by `{integer}` | |
e1599b0c | 32 | --> $DIR/str-idx.rs:5:29 |
9fa01778 | 33 | | |
532ac7d7 | 34 | LL | let _ = s.get_unchecked(4); |
c295e0f8 XL |
35 | | ------------- ^ string indices are ranges of `usize` |
36 | | | | |
37 | | required by a bound introduced by this call | |
9fa01778 | 38 | | |
1b1a35ee | 39 | = help: the trait `SliceIndex<str>` is not implemented for `{integer}` |
9fa01778 | 40 | = note: you can use `.chars().nth()` or `.bytes().nth()` |
1b1a35ee | 41 | for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> |
04454e1e | 42 | = help: the trait `SliceIndex<[T]>` is implemented for `usize` |
3c0e092e XL |
43 | note: required by a bound in `core::str::<impl str>::get_unchecked` |
44 | --> $SRC_DIR/core/src/str/mod.rs:LL:COL | |
45 | | | |
5e7ed085 FG |
46 | LL | pub const unsafe fn get_unchecked<I: ~const SliceIndex<str>>(&self, i: I) -> &I::Output { |
47 | | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked` | |
9fa01778 XL |
48 | |
49 | error[E0277]: the type `str` cannot be indexed by `char` | |
064997fb | 50 | --> $DIR/str-idx.rs:6:19 |
9fa01778 | 51 | | |
532ac7d7 | 52 | LL | let _: u8 = s['c']; |
064997fb | 53 | | ^^^ string indices are ranges of `usize` |
9fa01778 | 54 | | |
1b1a35ee | 55 | = help: the trait `SliceIndex<str>` is not implemented for `char` |
f2b60f7d | 56 | = note: required for `str` to implement `Index<char>` |
9fa01778 XL |
57 | |
58 | error: aborting due to 4 previous errors | |
b7449926 XL |
59 | |
60 | For more information about this error, try `rustc --explain E0277`. |