From 2da86a1bfd77f5fa99d94cf33c868a74172eeac2 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 22 Oct 2020 14:15:40 +0900 Subject: [PATCH] Add "this has type `{}` which {}" note --- .../src/traits/error_reporting/suggestions.rs | 4 ++++ src/test/ui/async-await/issue-70935-complex-spans.stderr | 8 ++++++++ .../issues/issue-65436-raw-ptr-not-send.stderr | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index e0c46a65b56a..83ce7f1f55e9 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1630,6 +1630,10 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { ), ); err.span_note(scope_span, &format!("{} is later dropped here", snippet)); + err.span_note( + interior_span, + &format!("this has type `{}` which {}", target_ty, trait_explanation), + ); } else { span.push_span_label( yield_span, diff --git a/src/test/ui/async-await/issue-70935-complex-spans.stderr b/src/test/ui/async-await/issue-70935-complex-spans.stderr index 6b599b5d603d..8451fb840992 100644 --- a/src/test/ui/async-await/issue-70935-complex-spans.stderr +++ b/src/test/ui/async-await/issue-70935-complex-spans.stderr @@ -17,6 +17,14 @@ note: the value is later dropped here | LL | }).await; | ^ +note: this has type `[closure@$DIR/issue-70935-complex-spans.rs:13:13: 15:10]` which is not `Send` + --> $DIR/issue-70935-complex-spans.rs:13:13 + | +LL | baz(|| async{ + | _____________^ +LL | | foo(tx.clone()); +LL | | }).await; + | |_________^ error: aborting due to previous error diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr index 9d3b10c86639..b733437a51da 100644 --- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr +++ b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr @@ -18,6 +18,11 @@ note: `std::ptr::null()` is later dropped here | LL | bar(Foo(std::ptr::null())).await; | ^ +note: this has type `*const u8` which is not `Send` + --> $DIR/issue-65436-raw-ptr-not-send.rs:14:17 + | +LL | bar(Foo(std::ptr::null())).await; + | ^^^^^^^^^^^^^^^^ help: consider moving this into a `let` binding to create a shorter lived borrow --> $DIR/issue-65436-raw-ptr-not-send.rs:14:13 |