about summary refs log tree commit diff
path: root/tests/ui/impl-trait
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-02-06 03:30:16 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-02-12 20:26:34 +0000
commit37d2ea2fa064411de78ec24a178a05dc02517673 (patch)
treee9f50135d04c2fc484cd435bf07704a751a8b468 /tests/ui/impl-trait
parentbdc15928c8119a86d15e2946cb54851264607842 (diff)
downloadrust-37d2ea2fa064411de78ec24a178a05dc02517673.tar.gz
rust-37d2ea2fa064411de78ec24a178a05dc02517673.zip
Properly handle `async` blocks and `fn`s 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.
Diffstat (limited to 'tests/ui/impl-trait')
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
index 77f6945f064..9fa73d817ca 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
@@ -1,6 +1,8 @@
 error[E0308]: mismatched types
   --> $DIR/default-body-type-err-2.rs:7:9
    |
+LL |     async fn woopsie_async(&self) -> String {
+   |                                      ------ expected `String` because of return type
 LL |         42
    |         ^^- help: try using a conversion method: `.to_string()`
    |         |