From 68d9cc73fe314c32545c5e2691015dbe1790960b Mon Sep 17 00:00:00 2001 From: Nell Shamrell Date: Sun, 10 Jan 2021 16:37:53 -0800 Subject: [PATCH 1/3] adds a small clarification for when an async function's output is opaque Signed-off-by: Nell Shamrell --- compiler/rustc_infer/src/infer/error_reporting/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index d1d6cb43fc74c..1d35bdf0b93ec 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -1490,7 +1490,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { format!( "{}{}{} {}{}", if sp.is_desugaring(DesugaringKind::Async) { - "the `Output` of this `async fn`'s " + "checked the output of this `async fn`, " } else if count == 1 { "the " } else { From 5f7d9dd75b80189329a759145cd360ac19696d61 Mon Sep 17 00:00:00 2001 From: Nell Shamrell Date: Mon, 18 Jan 2021 16:42:05 -0800 Subject: [PATCH 2/3] slight clarification to error message Signed-off-by: Nell Shamrell --- compiler/rustc_infer/src/infer/error_reporting/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 1d35bdf0b93ec..fa3ee97293f22 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -1490,7 +1490,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { format!( "{}{}{} {}{}", if sp.is_desugaring(DesugaringKind::Async) { - "checked the output of this `async fn`, " + "checked the return type of this `async fn`, " } else if count == 1 { "the " } else { From 38806c6e64c2250b3e0c3a873dd3ed8e3d4741d8 Mon Sep 17 00:00:00 2001 From: Nell Shamrell Date: Sun, 14 Feb 2021 18:25:47 -0800 Subject: [PATCH 3/3] work in progress --- src/test/ui/async-await/dont-suggest-missing-await.stderr | 2 +- src/test/ui/async-await/issue-61076.stderr | 2 +- .../ui/async-await/suggest-missing-await-closure.stderr | 2 +- src/test/ui/async-await/suggest-missing-await.stderr | 4 ++-- src/test/ui/parser/fn-header-semantic-fail.stderr | 4 ++-- .../issue-70736-async-fn-no-body-def-collector.stderr | 2 +- src/test/ui/suggestions/match-prev-arm-needing-semi.stderr | 6 +++--- 7 files changed, 11 insertions(+), 11 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 14e72c2b1e7e2..1cf1afb6d3646 100644 --- a/src/test/ui/async-await/dont-suggest-missing-await.stderr +++ b/src/test/ui/async-await/dont-suggest-missing-await.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/dont-suggest-missing-await.rs:14:18 | LL | async fn make_u32() -> u32 { - | --- the `Output` of this `async fn`'s found opaque type + | --- checked the return type of this `async fn`, found opaque type ... LL | take_u32(x) | ^ expected `u32`, found opaque type diff --git a/src/test/ui/async-await/issue-61076.stderr b/src/test/ui/async-await/issue-61076.stderr index db6dc3ea00a8d..d3eaeb7101a3b 100644 --- a/src/test/ui/async-await/issue-61076.stderr +++ b/src/test/ui/async-await/issue-61076.stderr @@ -61,7 +61,7 @@ error[E0308]: mismatched types --> $DIR/issue-61076.rs:92:9 | LL | async fn tuple() -> Tuple { - | ----- the `Output` of this `async fn`'s expected opaque type + | ----- checked the return type of this `async fn`, expected opaque type ... LL | Tuple(_) => {} | ^^^^^^^^ expected opaque type, found struct `Tuple` diff --git a/src/test/ui/async-await/suggest-missing-await-closure.stderr b/src/test/ui/async-await/suggest-missing-await-closure.stderr index 2151057aa7fc0..93f5d2e224ce6 100644 --- a/src/test/ui/async-await/suggest-missing-await-closure.stderr +++ b/src/test/ui/async-await/suggest-missing-await-closure.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/suggest-missing-await-closure.rs:16:18 | LL | async fn make_u32() -> u32 { - | --- the `Output` of this `async fn`'s found opaque type + | --- checked the return type of this `async fn`, found opaque type ... LL | take_u32(x) | ^ expected `u32`, found opaque type diff --git a/src/test/ui/async-await/suggest-missing-await.stderr b/src/test/ui/async-await/suggest-missing-await.stderr index 46615dae7e2ba..1c6245265c818 100644 --- a/src/test/ui/async-await/suggest-missing-await.stderr +++ b/src/test/ui/async-await/suggest-missing-await.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/suggest-missing-await.rs:12:14 | LL | async fn make_u32() -> u32 { - | --- the `Output` of this `async fn`'s found opaque type + | --- checked the return type of this `async fn`, found opaque type ... LL | take_u32(x) | ^ expected `u32`, found opaque type @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/suggest-missing-await.rs:22:5 | LL | async fn dummy() {} - | - the `Output` of this `async fn`'s found opaque type + | - checked the return type of this `async fn`, found opaque type ... LL | dummy() | ^^^^^^^ expected `()`, found opaque type diff --git a/src/test/ui/parser/fn-header-semantic-fail.stderr b/src/test/ui/parser/fn-header-semantic-fail.stderr index 2f11f95bf4a7f..a2806dce15e68 100644 --- a/src/test/ui/parser/fn-header-semantic-fail.stderr +++ b/src/test/ui/parser/fn-header-semantic-fail.stderr @@ -189,7 +189,7 @@ LL | async fn ft1(); LL | async fn ft1() {} | ^ | | - | the `Output` of this `async fn`'s found opaque type + | checked the return type of this `async fn`, found opaque type | expected `()`, found opaque type | = note: expected fn pointer `fn()` @@ -204,7 +204,7 @@ LL | const async unsafe extern "C" fn ft5(); LL | const async unsafe extern "C" fn ft5() {} | ^ | | - | the `Output` of this `async fn`'s found opaque type + | checked the return type of this `async fn`, found opaque type | expected `()`, found opaque type | = note: expected fn pointer `unsafe extern "C" fn()` diff --git a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr index 9b59e41501102..447c4ee5095e8 100644 --- a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr +++ b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr @@ -53,7 +53,7 @@ LL | async fn associated(); LL | async fn associated(); | ^ | | - | the `Output` of this `async fn`'s found opaque type + | checked the return type of this `async fn`, found opaque type | expected `()`, found opaque type | = note: expected fn pointer `fn()` 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 e9803a78f94b3..f6d0041157edc 100644 --- a/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr +++ b/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr @@ -2,7 +2,7 @@ error[E0308]: `match` arms have incompatible types --> $DIR/match-prev-arm-needing-semi.rs:26:18 | LL | async fn async_dummy() {} - | - the `Output` of this `async fn`'s found opaque type + | - checked the return type of this `async fn`, found opaque type ... LL | let _ = match true { | _____________- @@ -36,7 +36,7 @@ error[E0308]: `match` arms have incompatible types --> $DIR/match-prev-arm-needing-semi.rs:39:18 | LL | async fn async_dummy2() {} - | - the `Output` of this `async fn`'s found opaque type + | - checked the return type of this `async fn`, found opaque type ... LL | let _ = match true { | _____________- @@ -70,7 +70,7 @@ error[E0308]: `match` arms have incompatible types --> $DIR/match-prev-arm-needing-semi.rs:50:18 | LL | async fn async_dummy2() {} - | - the `Output` of this `async fn`'s found opaque type + | - checked the return type of this `async fn`, found opaque type ... LL | let _ = match true { | _____________-