about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-10-22 14:15:40 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2020-11-02 15:53:59 +0900
commit2da86a1bfd77f5fa99d94cf33c868a74172eeac2 (patch)
treec05641e880a99d1d474b4481e0aec1095a528985
parent66226ca1574fb936743a32f8b584fcfd1712a385 (diff)
downloadrust-2da86a1bfd77f5fa99d94cf33c868a74172eeac2.tar.gz
rust-2da86a1bfd77f5fa99d94cf33c868a74172eeac2.zip
Add "this has type `{}` which {}" note
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs4
-rw-r--r--src/test/ui/async-await/issue-70935-complex-spans.stderr8
-rw-r--r--src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr5
3 files changed, 17 insertions, 0 deletions
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 @@ 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 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
    |