rust/tests/ui/loops/dont-suggest-break-thru-item.stderr
Esteban Küber 37d2ea2fa0 Properly handle async blocks and fns in if exprs without else
When encountering a tail expression in the then arm of an `if` expression
without an `else` arm, account for `async fn` and `async` blocks to
suggest `return`ing the value and pointing at the return type of the
`async fn`.

We now also account for AFIT when looking for the return type to point at.

Fix #115405.
2024-02-12 20:26:34 +00:00

66 lines
1.9 KiB
Plaintext

error[E0308]: mismatched types
--> $DIR/dont-suggest-break-thru-item.rs:9:17
|
LL | / if true {
LL | | Err(1)
| | ^^^^^^ expected `()`, found `Result<_, {integer}>`
LL | |
LL | |
LL | | }
| |_____________- expected this to be `()`
|
= note: expected unit type `()`
found enum `Result<_, {integer}>`
help: you might have meant to return this value
|
LL | return Err(1);
| ++++++ +
error[E0308]: mismatched types
--> $DIR/dont-suggest-break-thru-item.rs:23:17
|
LL | / if true {
LL | | Err(1)
| | ^^^^^^ expected `()`, found `Result<_, {integer}>`
LL | |
LL | |
LL | | }
| |_____________- expected this to be `()`
|
= note: expected unit type `()`
found enum `Result<_, {integer}>`
help: you might have meant to return this value
|
LL | return Err(1);
| ++++++ +
error[E0308]: mismatched types
--> $DIR/dont-suggest-break-thru-item.rs:37:17
|
LL | / if true {
LL | | Err(1)
| | ^^^^^^ expected `()`, found `Result<_, {integer}>`
LL | |
LL | | }
| |_____________- expected this to be `()`
|
= note: expected unit type `()`
found enum `Result<_, {integer}>`
error[E0308]: mismatched types
--> $DIR/dont-suggest-break-thru-item.rs:49:17
|
LL | / if true {
LL | | Err(1)
| | ^^^^^^ expected `()`, found `Result<_, {integer}>`
LL | |
LL | | }
| |_____________- expected this to be `()`
|
= note: expected unit type `()`
found enum `Result<_, {integer}>`
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0308`.