mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
37d2ea2fa0
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.
66 lines
1.9 KiB
Plaintext
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`.
|