fork/rust

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

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

master
2.6 KiB74 linesraw
1error[E0277]: cannot add `u32` to `i32`
2  --> $DIR/ufcs-qpath-self-mismatch.rs:4:6
3   |
4LL |     <i32 as Add<u32>>::add(1, 2);
5   |      ^^^ no implementation for `i32 + u32`
6   |
7   = help: the trait `Add<u32>` is not implemented for `i32`
8   = help: the following other types implement trait `Add<Rhs>`:
9             <i32 as Add>
10             <i32 as Add<&i32>>
11             <&'a i32 as Add<i32>>
12             <&i32 as Add<&i32>>
13
14error[E0308]: mismatched types
15  --> $DIR/ufcs-qpath-self-mismatch.rs:7:28
16   |
17LL |     <i32 as Add<i32>>::add(1u32, 2);
18   |     ---------------------- ^^^^ expected `i32`, found `u32`
19   |     |
20   |     arguments to this function are incorrect
21   |
22help: the return type of this call is `u32` due to the type of the argument passed
23  --> $DIR/ufcs-qpath-self-mismatch.rs:7:5
24   |
25LL |     <i32 as Add<i32>>::add(1u32, 2);
26   |     ^^^^^^^^^^^^^^^^^^^^^^^----^^^^
27   |                            |
28   |                            this argument influences the return type of `Add`
29note: method defined here
30  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
31help: change the type of the numeric literal from `u32` to `i32`
32   |
33LL |     <i32 as Add<i32>>::add(1i32, 2);
34   |                             ~~~
35
36error[E0308]: mismatched types
37  --> $DIR/ufcs-qpath-self-mismatch.rs:9:31
38   |
39LL |     <i32 as Add<i32>>::add(1, 2u32);
40   |     ----------------------    ^^^^ expected `i32`, found `u32`
41   |     |
42   |     arguments to this function are incorrect
43   |
44help: the return type of this call is `u32` due to the type of the argument passed
45  --> $DIR/ufcs-qpath-self-mismatch.rs:9:5
46   |
47LL |     <i32 as Add<i32>>::add(1, 2u32);
48   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^----^
49   |                               |
50   |                               this argument influences the return type of `Add`
51note: method defined here
52  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
53help: change the type of the numeric literal from `u32` to `i32`
54   |
55LL |     <i32 as Add<i32>>::add(1, 2i32);
56   |                                ~~~
57
58error[E0277]: cannot add `u32` to `i32`
59  --> $DIR/ufcs-qpath-self-mismatch.rs:4:5
60   |
61LL |     <i32 as Add<u32>>::add(1, 2);
62   |     ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32`
63   |
64   = help: the trait `Add<u32>` is not implemented for `i32`
65   = help: the following other types implement trait `Add<Rhs>`:
66             <i32 as Add>
67             <i32 as Add<&i32>>
68             <&'a i32 as Add<i32>>
69             <&i32 as Add<&i32>>
70
71error: aborting due to 4 previous errors
72
73Some errors have detailed explanations: E0277, E0308.
74For more information about an error, try `rustc --explain E0277`.