about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_trait_selection/traits/error_reporting/suggestions.rs7
-rw-r--r--src/test/ui/async-await/async-fn-nonsend.stderr4
-rw-r--r--src/test/ui/async-await/issue-68112.stderr2
-rw-r--r--src/test/ui/generator/issue-68112.stderr2
4 files changed, 10 insertions, 5 deletions
diff --git a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs
index 7d43a2273fe..7c293153523 100644
--- a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs
+++ b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs
@@ -1353,7 +1353,12 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
             format!("{} occurs here, with `{}` maybe used later", await_or_yield, snippet),
         );
 
-        span.push_span_label(target_span, format!("has type `{}`", target_ty));
+        if target_ty.is_impl_trait() {
+            // It's not very useful to tell the user the type if it's opaque.
+            span.push_span_label(target_span, "created here".to_string());
+        } else {
+            span.push_span_label(target_span, format!("has type `{}`", target_ty));
+        }
 
         // If available, use the scope span to annotate the drop location.
         if let Some(scope_span) = scope_span {
diff --git a/src/test/ui/async-await/async-fn-nonsend.stderr b/src/test/ui/async-await/async-fn-nonsend.stderr
index 04df6203e43..176c62fcd7d 100644
--- a/src/test/ui/async-await/async-fn-nonsend.stderr
+++ b/src/test/ui/async-await/async-fn-nonsend.stderr
@@ -12,7 +12,7 @@ note: future is not `Send` as this value is used across an await
   --> $DIR/async-fn-nonsend.rs:24:5
    |
 LL |     let x = non_send();
-   |         - has type `impl std::fmt::Debug`
+   |         - created here
 LL |     drop(x);
 LL |     fut().await;
    |     ^^^^^^^^^^^ await occurs here, with `x` maybe used later
@@ -33,7 +33,7 @@ note: future is not `Send` as this value is used across an await
   --> $DIR/async-fn-nonsend.rs:33:20
    |
 LL |     match Some(non_send()) {
-   |                ---------- has type `impl std::fmt::Debug`
+   |                ---------- created here
 LL |         Some(_) => fut().await,
    |                    ^^^^^^^^^^^ await occurs here, with `non_send()` maybe used later
 ...
diff --git a/src/test/ui/async-await/issue-68112.stderr b/src/test/ui/async-await/issue-68112.stderr
index 9f901901e20..eec2171024a 100644
--- a/src/test/ui/async-await/issue-68112.stderr
+++ b/src/test/ui/async-await/issue-68112.stderr
@@ -12,7 +12,7 @@ note: future is not `Send` as this value is used across an await
   --> $DIR/issue-68112.rs:32:9
    |
 LL |         let non_send_fut = make_non_send_future1();
-   |             ------------ has type `impl std::future::Future`
+   |             ------------ created here
 LL |         let _ = non_send_fut.await;
 LL |         ready(0).await;
    |         ^^^^^^^^ await occurs here, with `non_send_fut` maybe used later
diff --git a/src/test/ui/generator/issue-68112.stderr b/src/test/ui/generator/issue-68112.stderr
index 8950ff707d4..273fec082cf 100644
--- a/src/test/ui/generator/issue-68112.stderr
+++ b/src/test/ui/generator/issue-68112.stderr
@@ -12,7 +12,7 @@ note: future is not `Send` as this value is used across an yield
   --> $DIR/issue-68112.rs:31:9
    |
 LL |         let _non_send_gen = make_non_send_generator();
-   |             ------------- has type `impl std::ops::Generator`
+   |             ------------- created here
 LL |         yield;
    |         ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
 LL |     };