]> git.proxmox.com Git - rustc.git/blob - tests/ui/indexing/indexing-requires-a-uint.stderr
New upstream version 1.76.0+dfsg1
[rustc.git] / tests / ui / indexing / indexing-requires-a-uint.stderr
1 error[E0277]: the type `[{integer}]` cannot be indexed by `u8`
2 --> $DIR/indexing-requires-a-uint.rs:6:9
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<[{integer}]>` is implemented for `usize`
9 = help: for that trait implementation, expected `usize`, found `u8`
10 = note: required for `[{integer}]` to implement `Index<u8>`
11 = note: 1 redundant requirement hidden
12 = note: required for `[{integer}; 1]` to implement `Index<u8>`
13
14 error[E0308]: mismatched types
15 --> $DIR/indexing-requires-a-uint.rs:12:18
16 |
17 LL | bar::<isize>(i); // i should not be re-coerced back to an isize
18 | ------------ ^ expected `isize`, found `usize`
19 | |
20 | arguments to this function are incorrect
21 |
22 note: function defined here
23 --> $DIR/indexing-requires-a-uint.rs:5:8
24 |
25 LL | fn bar<T>(_: T) {}
26 | ^^^ ----
27 help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
28 |
29 LL | bar::<isize>(i.try_into().unwrap()); // i should not be re-coerced back to an isize
30 | ++++++++++++++++++++
31
32 error: aborting due to 2 previous errors
33
34 Some errors have detailed explanations: E0277, E0308.
35 For more information about an error, try `rustc --explain E0277`.