fork/rust

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

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

master
4.0 KiB138 linesraw
1error[E0308]: mismatched types
2  --> $DIR/suggest-missing-await.rs:12:14
3   |
4LL |     take_u32(x)
5   |     -------- ^ expected `u32`, found future
6   |     |
7   |     arguments to this function are incorrect
8   |
9note: calling an async function returns a future
10  --> $DIR/suggest-missing-await.rs:12:14
11   |
12LL |     take_u32(x)
13   |              ^
14note: function defined here
15  --> $DIR/suggest-missing-await.rs:3:4
16   |
17LL | fn take_u32(_x: u32) {}
18   |    ^^^^^^^^ -------
19help: consider `await`ing on the `Future`
20   |
21LL |     take_u32(x.await)
22   |               ++++++
23
24error[E0308]: mismatched types
25  --> $DIR/suggest-missing-await.rs:22:5
26   |
27LL |     dummy()
28   |     ^^^^^^^ expected `()`, found future
29   |
30note: calling an async function returns a future
31  --> $DIR/suggest-missing-await.rs:22:5
32   |
33LL |     dummy()
34   |     ^^^^^^^
35help: consider `await`ing on the `Future`
36   |
37LL |     dummy().await
38   |            ++++++
39help: consider using a semicolon here
40   |
41LL |     dummy();
42   |            +
43
44error[E0308]: `if` and `else` have incompatible types
45  --> $DIR/suggest-missing-await.rs:35:9
46   |
47LL |       let _x = if true {
48   |  ______________-
49LL | |         dummy()
50   | |         ------- expected because of this
51LL | |
52LL | |     } else {
53LL | |         dummy().await
54   | |         ^^^^^^^^^^^^^ expected future, found `()`
55LL | |
56LL | |     };
57   | |_____- `if` and `else` have incompatible types
58   |
59   = note: expected opaque type `impl Future<Output = ()>`
60                found unit type `()`
61help: consider `await`ing on the `Future`
62   |
63LL |         dummy().await
64   |                ++++++
65
66error[E0308]: `match` arms have incompatible types
67  --> $DIR/suggest-missing-await.rs:45:14
68   |
69LL |       let _x = match 0usize {
70   |  ______________-
71LL | |         0 => dummy(),
72   | |              ------- this is found to be of type `impl Future<Output = ()>`
73LL | |         1 => dummy(),
74   | |              ------- this is found to be of type `impl Future<Output = ()>`
75LL | |         2 => dummy().await,
76   | |              ^^^^^^^^^^^^^ expected future, found `()`
77LL | |
78LL | |     };
79   | |_____- `match` arms have incompatible types
80   |
81   = note: expected opaque type `impl Future<Output = ()>`
82                found unit type `()`
83help: consider `await`ing on the `Future`
84   |
85LL ~         0 => dummy().await,
86LL ~         1 => dummy().await,
87   |
88
89error[E0308]: mismatched types
90  --> $DIR/suggest-missing-await.rs:53:9
91   |
92LL |     let _x = match dummy() {
93   |                    ------- this expression has type `impl Future<Output = ()>`
94LL |         () => {}
95   |         ^^ expected future, found `()`
96   |
97   = note: expected opaque type `impl Future<Output = ()>`
98                found unit type `()`
99help: consider `await`ing on the `Future`
100   |
101LL |     let _x = match dummy().await {
102   |                           ++++++
103
104error[E0308]: mismatched types
105  --> $DIR/suggest-missing-await.rs:67:9
106   |
107LL |     match dummy_result() {
108   |           -------------- this expression has type `impl Future<Output = Result<(), ()>>`
109...
110LL |         Ok(_) => {}
111   |         ^^^^^ expected future, found `Result<_, _>`
112   |
113   = note: expected opaque type `impl Future<Output = Result<(), ()>>`
114                     found enum `Result<_, _>`
115help: consider `await`ing on the `Future`
116   |
117LL |     match dummy_result().await {
118   |                         ++++++
119
120error[E0308]: mismatched types
121  --> $DIR/suggest-missing-await.rs:69:9
122   |
123LL |     match dummy_result() {
124   |           -------------- this expression has type `impl Future<Output = Result<(), ()>>`
125...
126LL |         Err(_) => {}
127   |         ^^^^^^ expected future, found `Result<_, _>`
128   |
129   = note: expected opaque type `impl Future<Output = Result<(), ()>>`
130                     found enum `Result<_, _>`
131help: consider `await`ing on the `Future`
132   |
133LL |     match dummy_result().await {
134   |                         ++++++
135
136error: aborting due to 7 previous errors
137
138For more information about this error, try `rustc --explain E0308`.