]> git.proxmox.com Git - rustc.git/blame - src/test/ui/indexing-requires-a-uint.stderr
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / indexing-requires-a-uint.stderr
CommitLineData
9fa01778 1error[E0277]: the type `[{integer}]` cannot be indexed by `u8`
0731742a 2 --> $DIR/indexing-requires-a-uint.rs:6:5
b7449926 3 |
532ac7d7 4LL | [0][0u8];
b7449926
XL
5 | ^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
6 |
1b1a35ee 7 = help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8`
04454e1e 8 = help: the trait `SliceIndex<[T]>` is implemented for `usize`
1b1a35ee 9 = note: required because of the requirements on the impl of `Index<u8>` for `[{integer}]`
b7449926
XL
10
11error[E0308]: mismatched types
0731742a 12 --> $DIR/indexing-requires-a-uint.rs:12:18
b7449926
XL
13 |
14LL | bar::<isize>(i); // i should not be re-coerced back to an isize
923072b8
FG
15 | ------------ ^ expected `isize`, found `usize`
16 | |
17 | arguments to this function are incorrect
e74abb32 18 |
923072b8
FG
19note: function defined here
20 --> $DIR/indexing-requires-a-uint.rs:5:8
21 |
22LL | fn bar<T>(_: T) {}
23 | ^^^ ----
29967ef6 24help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
48663c56
XL
25 |
26LL | bar::<isize>(i.try_into().unwrap()); // i should not be re-coerced back to an isize
c295e0f8 27 | ++++++++++++++++++++
b7449926
XL
28
29error: aborting due to 2 previous errors
30
48663c56 31Some errors have detailed explanations: E0277, E0308.
b7449926 32For more information about an error, try `rustc --explain E0277`.