about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-10-22 19:03:36 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-10-23 08:06:41 -0700
commitc5485115dcbbb5a0837c2ac8cabd5ead8a3b8a66 (patch)
tree41cfd5db62ca776080533a6ce4126e281b760ceb /src/test/ui
parent1829b4a887553797d6fa018ae2518ca0d45b67ea (diff)
downloadrust-c5485115dcbbb5a0837c2ac8cabd5ead8a3b8a66.tar.gz
rust-c5485115dcbbb5a0837c2ac8cabd5ead8a3b8a66.zip
Add more `.await` suggestions on E0308
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/async-await/dont-suggest-missing-await.stderr4
-rw-r--r--src/test/ui/async-await/issue-61076.stderr4
-rw-r--r--src/test/ui/async-await/suggest-missing-await.fixed30
-rw-r--r--src/test/ui/async-await/suggest-missing-await.rs1
-rw-r--r--src/test/ui/async-await/suggest-missing-await.stderr12
-rw-r--r--src/test/ui/suggestions/match-prev-arm-needing-semi.rs1
-rw-r--r--src/test/ui/suggestions/match-prev-arm-needing-semi.stderr23
-rw-r--r--src/test/ui/suggestions/opaque-type-error.stderr6
8 files changed, 35 insertions, 46 deletions
diff --git a/src/test/ui/async-await/dont-suggest-missing-await.stderr b/src/test/ui/async-await/dont-suggest-missing-await.stderr
index e70ed9badbd..14e72c2b1e7 100644
--- a/src/test/ui/async-await/dont-suggest-missing-await.stderr
+++ b/src/test/ui/async-await/dont-suggest-missing-await.stderr
@@ -9,6 +9,10 @@ LL |         take_u32(x)
    |
    = note:     expected type `u32`
            found opaque type `impl Future`
+help: consider `await`ing on the `Future`
+   |
+LL |         take_u32(x.await)
+   |                   ^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/async-await/issue-61076.stderr b/src/test/ui/async-await/issue-61076.stderr
index afba889f014..df54ac88ace 100644
--- a/src/test/ui/async-await/issue-61076.stderr
+++ b/src/test/ui/async-await/issue-61076.stderr
@@ -53,6 +53,10 @@ LL |         Tuple(_) => {}
    |
    = note: expected opaque type `impl Future`
                    found struct `Tuple`
+help: consider `await`ing on the `Future`
+   |
+LL |     match tuple().await {
+   |                  ^^^^^^
 
 error: aborting due to 6 previous errors
 
diff --git a/src/test/ui/async-await/suggest-missing-await.fixed b/src/test/ui/async-await/suggest-missing-await.fixed
deleted file mode 100644
index e548fda7cb4..00000000000
--- a/src/test/ui/async-await/suggest-missing-await.fixed
+++ /dev/null
@@ -1,30 +0,0 @@
-// edition:2018
-// run-rustfix
-
-fn take_u32(_x: u32) {}
-
-async fn make_u32() -> u32 {
-    22
-}
-
-#[allow(unused)]
-async fn suggest_await_in_async_fn() {
-    let x = make_u32();
-    take_u32(x.await)
-    //~^ ERROR mismatched types [E0308]
-    //~| HELP consider `await`ing on the `Future`
-    //~| SUGGESTION .await
-}
-
-async fn dummy() {}
-
-#[allow(unused)]
-async fn suggest_await_in_async_fn_return() {
-    dummy().await;
-    //~^ ERROR mismatched types [E0308]
-    //~| HELP try adding a semicolon
-    //~| HELP consider `await`ing on the `Future`
-    //~| SUGGESTION .await
-}
-
-fn main() {}
diff --git a/src/test/ui/async-await/suggest-missing-await.rs b/src/test/ui/async-await/suggest-missing-await.rs
index 464a9602119..d629054911d 100644
--- a/src/test/ui/async-await/suggest-missing-await.rs
+++ b/src/test/ui/async-await/suggest-missing-await.rs
@@ -1,5 +1,4 @@
 // edition:2018
-// run-rustfix
 
 fn take_u32(_x: u32) {}
 
diff --git a/src/test/ui/async-await/suggest-missing-await.stderr b/src/test/ui/async-await/suggest-missing-await.stderr
index d729420e930..46615dae7e2 100644
--- a/src/test/ui/async-await/suggest-missing-await.stderr
+++ b/src/test/ui/async-await/suggest-missing-await.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/suggest-missing-await.rs:13:14
+  --> $DIR/suggest-missing-await.rs:12:14
    |
 LL | async fn make_u32() -> u32 {
    |                        --- the `Output` of this `async fn`'s found opaque type
@@ -15,7 +15,7 @@ LL |     take_u32(x.await)
    |               ^^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/suggest-missing-await.rs:23:5
+  --> $DIR/suggest-missing-await.rs:22:5
    |
 LL | async fn dummy() {}
    |                  - the `Output` of this `async fn`'s found opaque type
@@ -25,14 +25,14 @@ LL |     dummy()
    |
    = note: expected unit type `()`
             found opaque type `impl Future`
-help: try adding a semicolon
-   |
-LL |     dummy();
-   |            ^
 help: consider `await`ing on the `Future`
    |
 LL |     dummy().await
    |            ^^^^^^
+help: try adding a semicolon
+   |
+LL |     dummy();
+   |            ^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/suggestions/match-prev-arm-needing-semi.rs b/src/test/ui/suggestions/match-prev-arm-needing-semi.rs
index 81e6abf7d7b..b8ac030b0bb 100644
--- a/src/test/ui/suggestions/match-prev-arm-needing-semi.rs
+++ b/src/test/ui/suggestions/match-prev-arm-needing-semi.rs
@@ -46,6 +46,7 @@ async fn async_extra_semicolon_different() {
 async fn async_different_futures() {
     let _ = match true { //~ NOTE `match` arms have incompatible types
         true => async_dummy(), //~ NOTE this is found to be
+        //~| HELP consider `await`ing on both `Future`s
         false => async_dummy2(), //~ ERROR `match` arms have incompatible types
         //~^ NOTE expected opaque type, found a different opaque type
         //~| NOTE expected type `impl Future`
diff --git a/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr b/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr
index 8f4b860589e..7a4f74a1994 100644
--- a/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr
+++ b/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr
@@ -20,14 +20,14 @@ LL | |     };
    |
    = note:     expected type `()`
            found opaque type `impl Future`
-help: consider removing this semicolon and boxing the expression
-   |
-LL |             async_dummy()
-   |                         --
 help: consider `await`ing on the `Future`
    |
 LL |         false => async_dummy().await,
    |                               ^^^^^^
+help: consider removing this semicolon and boxing the expression
+   |
+LL |             async_dummy()
+   |                         --
 
 error[E0308]: `match` arms have incompatible types
   --> $DIR/match-prev-arm-needing-semi.rs:39:18
@@ -51,17 +51,17 @@ LL | |     };
    |
    = note:     expected type `()`
            found opaque type `impl Future`
-help: consider removing this semicolon and boxing the expression
-   |
-LL |             async_dummy()
-   |                         --
 help: consider `await`ing on the `Future`
    |
 LL |         false => async_dummy2().await,
    |                                ^^^^^^
+help: consider removing this semicolon and boxing the expression
+   |
+LL |             async_dummy()
+   |                         --
 
 error[E0308]: `match` arms have incompatible types
-  --> $DIR/match-prev-arm-needing-semi.rs:49:18
+  --> $DIR/match-prev-arm-needing-semi.rs:50:18
    |
 LL |   async fn async_dummy2() {}
    |                           - the `Output` of this `async fn`'s found opaque type
@@ -81,6 +81,11 @@ LL | |     };
    = note:     expected type `impl Future` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>)
            found opaque type `impl Future` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:17:25>)
    = note: distinct uses of `impl Trait` result in different opaque types
+help: consider `await`ing on both `Future`s
+   |
+LL |         true => async_dummy().await,
+LL |         false => async_dummy2().await,
+   |
 
 error[E0308]: `match` arms have incompatible types
   --> $DIR/match-prev-arm-needing-semi.rs:11:18
diff --git a/src/test/ui/suggestions/opaque-type-error.stderr b/src/test/ui/suggestions/opaque-type-error.stderr
index a7c2b82942f..d74076cbc9b 100644
--- a/src/test/ui/suggestions/opaque-type-error.stderr
+++ b/src/test/ui/suggestions/opaque-type-error.stderr
@@ -16,6 +16,12 @@ LL | |     }.await
    = note:     expected type `impl Future` (opaque type at <$DIR/opaque-type-error.rs:8:19>)
            found opaque type `impl Future` (opaque type at <$DIR/opaque-type-error.rs:12:19>)
    = note: distinct uses of `impl Trait` result in different opaque types
+help: consider `await`ing on both `Future`s
+   |
+LL |         thing_one().await
+LL |     } else {
+LL |         thing_two().await
+   |
 
 error: aborting due to previous error