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
|
|
|
|
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | let _: u8 = s[4];
|
2019-01-14 13:10:45 +00:00
|
|
|
| ^^^^ string indices are ranges of `usize`
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
2019-01-05 02:56:23 +00:00
|
|
|
= note: you can use `.chars().nth()` or `.bytes().nth()`
|
2020-09-05 02:17:22 +00:00
|
|
|
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
|
2020-09-02 07:40:56 +00:00
|
|
|
= note: required because of the requirements on the impl of `Index<{integer}>` for `str`
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2019-01-14 13:10:45 +00:00
|
|
|
error[E0277]: the type `str` cannot be indexed by `{integer}`
|
2019-09-16 04:58:20 +00:00
|
|
|
--> $DIR/str-idx.rs:4:19
|
2019-01-14 13:10:45 +00:00
|
|
|
|
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | let _ = s.get(4);
|
2021-09-07 11:30:53 +00:00
|
|
|
| --- ^ string indices are ranges of `usize`
|
|
|
|
| |
|
|
|
|
| required by a bound introduced by this call
|
2019-01-14 13:10:45 +00:00
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
2019-01-14 13:10:45 +00:00
|
|
|
= note: you can use `.chars().nth()` or `.bytes().nth()`
|
2020-09-05 02:17:22 +00:00
|
|
|
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
|
2021-10-05 23:04:09 +00:00
|
|
|
note: required by a bound in `core::str::<impl str>::get`
|
|
|
|
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
|
|
|
|
|
2022-03-06 03:00:12 +00:00
|
|
|
LL | pub const fn get<I: ~const SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get`
|
2019-01-14 13:10:45 +00:00
|
|
|
|
|
|
|
error[E0277]: the type `str` cannot be indexed by `{integer}`
|
2019-09-16 04:58:20 +00:00
|
|
|
--> $DIR/str-idx.rs:5:29
|
2019-01-14 13:10:45 +00:00
|
|
|
|
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | let _ = s.get_unchecked(4);
|
2021-09-07 11:30:53 +00:00
|
|
|
| ------------- ^ string indices are ranges of `usize`
|
|
|
|
| |
|
|
|
|
| required by a bound introduced by this call
|
2019-01-14 13:10:45 +00:00
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
2019-01-14 13:10:45 +00:00
|
|
|
= note: you can use `.chars().nth()` or `.bytes().nth()`
|
2020-09-05 02:17:22 +00:00
|
|
|
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
|
2021-10-05 23:04:09 +00:00
|
|
|
note: required by a bound in `core::str::<impl str>::get_unchecked`
|
|
|
|
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
|
|
|
|
|
2022-03-06 03:00:12 +00:00
|
|
|
LL | pub const unsafe fn get_unchecked<I: ~const SliceIndex<str>>(&self, i: I) -> &I::Output {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked`
|
2019-01-14 13:10:45 +00:00
|
|
|
|
|
|
|
error[E0277]: the type `str` cannot be indexed by `char`
|
|
|
|
--> $DIR/str-idx.rs:6:17
|
|
|
|
|
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | let _: u8 = s['c'];
|
2019-01-14 13:10:45 +00:00
|
|
|
| ^^^^^^ string indices are ranges of `usize`
|
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
= help: the trait `SliceIndex<str>` is not implemented for `char`
|
|
|
|
= note: required because of the requirements on the impl of `Index<char>` for `str`
|
2019-01-14 13:10:45 +00:00
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|