diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index d736d45a5a48..8a444b8d4526 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -1340,16 +1340,18 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { err.span_label( *sp, format!( - "{}the {} {}{}{}", - if count > 1 { "one of " } else { "" }, - target, - key, - pluralize!(count), + "{}{}{} {}{}", if sp.is_desugaring(DesugaringKind::Async) { - " in the `Output` of this `async fn`" + "the `Output` of this `async fn`'s " + } else if count == 1 { + "the " } else { "" }, + if count > 1 { "one of the " } else { "" }, + target, + key, + pluralize!(count), ), ); } 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 5c9b1d2c4d71..dc3a4752fb1f 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 found opaque type in the `Output` of this `async fn` + | --- the `Output` of this `async fn`'s found opaque type ... LL | take_u32(x) | ^ expected `u32`, found opaque type 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 5926c8351ff3..2703cec581dd 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 found opaque type in the `Output` of this `async fn` + | --- the `Output` of this `async fn`'s found opaque type ... LL | take_u32(x) | ^ diff --git a/src/test/ui/async-await/suggest-missing-await.stderr b/src/test/ui/async-await/suggest-missing-await.stderr index c0dc32b83fb0..6ac05a87aae8 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:13:14 | LL | async fn make_u32() -> u32 { - | --- the found opaque type in the `Output` of this `async fn` + | --- the `Output` of this `async fn`'s found opaque type ... LL | take_u32(x) | ^ @@ -17,7 +17,7 @@ error[E0308]: mismatched types --> $DIR/suggest-missing-await.rs:23:5 | LL | async fn dummy() {} - | - the found opaque type in the `Output` of this `async fn` + | - the `Output` of this `async fn`'s found opaque type ... LL | dummy() | ^^^^^^^ expected `()`, found opaque type