]>
Commit | Line | Data |
---|---|---|
9fa01778 | 1 | error[E0277]: the type `[{integer}]` cannot be indexed by `u8` |
0731742a | 2 | --> $DIR/indexing-requires-a-uint.rs:6:5 |
b7449926 | 3 | | |
532ac7d7 | 4 | LL | [0][0u8]; |
b7449926 XL |
5 | | ^^^^^^^^ slice indices are of type `usize` or ranges of `usize` |
6 | | | |
1b1a35ee XL |
7 | = help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8` |
8 | = note: required because of the requirements on the impl of `Index<u8>` for `[{integer}]` | |
b7449926 XL |
9 | |
10 | error[E0308]: mismatched types | |
0731742a | 11 | --> $DIR/indexing-requires-a-uint.rs:12:18 |
b7449926 XL |
12 | | |
13 | LL | bar::<isize>(i); // i should not be re-coerced back to an isize | |
60c5eb7d | 14 | | ^ expected `isize`, found `usize` |
e74abb32 | 15 | | |
29967ef6 | 16 | help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit |
48663c56 XL |
17 | | |
18 | LL | bar::<isize>(i.try_into().unwrap()); // i should not be re-coerced back to an isize | |
94222f64 | 19 | | ~~~~~~~~~~~~~~~~~~~~~ |
b7449926 XL |
20 | |
21 | error: aborting due to 2 previous errors | |
22 | ||
48663c56 | 23 | Some errors have detailed explanations: E0277, E0308. |
b7449926 | 24 | For more information about an error, try `rustc --explain E0277`. |