fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.3 KiB33 linesraw
1error[E0277]: the type `[{integer}]` cannot be indexed by `u8`
2  --> $DIR/indexing-requires-a-uint.rs:6:9
3   |
4LL |     [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
12error[E0308]: mismatched types
13  --> $DIR/indexing-requires-a-uint.rs:12:18
14   |
15LL |     bar::<isize>(i);  // i should not be re-coerced back to an isize
16   |     ------------ ^ expected `isize`, found `usize`
17   |     |
18   |     arguments to this function are incorrect
19   |
20note: function defined here
21  --> $DIR/indexing-requires-a-uint.rs:5:8
22   |
23LL |     fn bar<T>(_: T) {}
24   |        ^^^    ----
25help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
26   |
27LL |     bar::<isize>(i.try_into().unwrap());  // i should not be re-coerced back to an isize
28   |                   ++++++++++++++++++++
29
30error: aborting due to 2 previous errors
31
32Some errors have detailed explanations: E0277, E0308.
33For more information about an error, try `rustc --explain E0277`.