From: Yuki Okushi Date: Thu, 22 Oct 2020 05:15:40 +0000 (+0900) Subject: Add "this has type `{}` which {}" note X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=2da86a1bfd77f5fa99d94cf33c868a74172eeac2;p=rust.git Add "this has type `{}` which {}" note --- 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 e0c46a65b56..83ce7f1f55e 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 @@ fn note_obligation_cause_for_async_await( ), ); 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 6b599b5d603..8451fb84099 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 9d3b10c8663..b733437a51d 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 |