]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/if-then-neeing-semi.stderr
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / suggestions / if-then-neeing-semi.stderr
1 error[E0308]: `if` and `else` have incompatible types
2   --> $DIR/if-then-neeing-semi.rs:37:9
3    |
4 LL |       let _ = if true {
5    |  _____________-
6 LL | |
7 LL | |         async_dummy();
8    | |         -------------- expected because of this
9 LL | |
10 LL | |     } else {
11 LL | |         async_dummy()
12    | |         ^^^^^^^^^^^^^ expected `()`, found opaque type
13 ...  |
14 LL | |
15 LL | |     };
16    | |_____- `if` and `else` have incompatible types
17    |
18 note: while checking the return type of the `async fn`
19   --> $DIR/if-then-neeing-semi.rs:18:24
20    |
21 LL | async fn async_dummy() {}
22    |                        ^ checked the `Output` of this `async fn`, found opaque type
23    = note: expected unit type `()`
24             found opaque type `impl Future<Output = ()>`
25 help: consider `await`ing on the `Future`
26    |
27 LL |         async_dummy().await
28    |                      ++++++
29 help: consider removing this semicolon
30    |
31 LL -         async_dummy();
32 LL +         async_dummy()
33    |
34
35 error[E0308]: `if` and `else` have incompatible types
36   --> $DIR/if-then-neeing-semi.rs:50:9
37    |
38 LL |       let _ = if true {
39    |  _____________-
40 LL | |
41 LL | |         async_dummy();
42    | |         -------------- expected because of this
43 LL | |
44 LL | |     } else {
45 LL | |         async_dummy2()
46    | |         ^^^^^^^^^^^^^^ expected `()`, found opaque type
47 ...  |
48 LL | |
49 LL | |     };
50    | |_____- `if` and `else` have incompatible types
51    |
52 note: while checking the return type of the `async fn`
53   --> $DIR/if-then-neeing-semi.rs:24:25
54    |
55 LL | async fn async_dummy2() {}
56    |                         ^ checked the `Output` of this `async fn`, found opaque type
57    = note: expected unit type `()`
58             found opaque type `impl Future<Output = ()>`
59 help: consider `await`ing on the `Future`
60    |
61 LL |         async_dummy2().await
62    |                       ++++++
63 help: consider removing this semicolon and boxing the expressions
64    |
65 LL ~         Box::new(async_dummy())
66 LL |
67 LL |     } else {
68 LL ~         Box::new(async_dummy2())
69    |
70
71 error[E0308]: `if` and `else` have incompatible types
72   --> $DIR/if-then-neeing-semi.rs:63:9
73    |
74 LL |       let _ = if true {
75    |  _____________-
76 LL | |
77 LL | |         async_dummy()
78    | |         ------------- expected because of this
79 LL | |
80 LL | |     } else {
81 LL | |         async_dummy2()
82    | |         ^^^^^^^^^^^^^^ expected opaque type, found a different opaque type
83 ...  |
84 LL | |
85 LL | |     };
86    | |_____- `if` and `else` have incompatible types
87    |
88 note: while checking the return type of the `async fn`
89   --> $DIR/if-then-neeing-semi.rs:18:24
90    |
91 LL | async fn async_dummy() {}
92    |                        ^ checked the `Output` of this `async fn`, expected opaque type
93 note: while checking the return type of the `async fn`
94   --> $DIR/if-then-neeing-semi.rs:24:25
95    |
96 LL | async fn async_dummy2() {}
97    |                         ^ checked the `Output` of this `async fn`, found opaque type
98    = note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:18:24>)
99               found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:24:25>)
100    = note: distinct uses of `impl Trait` result in different opaque types
101 help: consider `await`ing on both `Future`s
102    |
103 LL ~         async_dummy().await
104 LL |
105 LL |     } else {
106 LL ~         async_dummy2().await
107    |
108
109 error[E0308]: `if` and `else` have incompatible types
110   --> $DIR/if-then-neeing-semi.rs:13:9
111    |
112 LL |       let _ = if true {
113    |  _____________-
114 LL | |
115 LL | |         dummy();
116    | |         --------
117    | |         |      |
118    | |         |      help: consider removing this semicolon
119    | |         expected because of this
120 LL | |
121 LL | |     } else {
122 LL | |         dummy()
123    | |         ^^^^^^^ expected `()`, found `i32`
124 LL | |
125 LL | |     };
126    | |_____- `if` and `else` have incompatible types
127
128 error: aborting due to 4 previous errors
129
130 For more information about this error, try `rustc --explain E0308`.