]> git.lizzy.rs Git - rust.git/blob - src/test/ui/indexing-requires-a-uint.stderr
Auto merge of #95450 - jyn514:faster-doc, r=Mark-Simulacrum
[rust.git] / src / test / ui / indexing-requires-a-uint.stderr
1 error[E0277]: the type `[{integer}]` cannot be indexed by `u8`
2   --> $DIR/indexing-requires-a-uint.rs:6:5
3    |
4 LL |     [0][0u8];
5    |     ^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
6    |
7    = help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8`
8    = help: the trait `SliceIndex<[T]>` is implemented for `usize`
9    = note: required because of the requirements on the impl of `Index<u8>` for `[{integer}]`
10
11 error[E0308]: mismatched types
12   --> $DIR/indexing-requires-a-uint.rs:12:18
13    |
14 LL |     bar::<isize>(i);  // i should not be re-coerced back to an isize
15    |                  ^ expected `isize`, found `usize`
16    |
17 help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
18    |
19 LL |     bar::<isize>(i.try_into().unwrap());  // i should not be re-coerced back to an isize
20    |                   ++++++++++++++++++++
21
22 error: aborting due to 2 previous errors
23
24 Some errors have detailed explanations: E0277, E0308.
25 For more information about an error, try `rustc --explain E0277`.