]> git.lizzy.rs Git - rust.git/commitdiff
Add "this has type `{}` which {}" note
authorYuki Okushi <huyuumi.dev@gmail.com>
Thu, 22 Oct 2020 05:15:40 +0000 (14:15 +0900)
committerYuki Okushi <huyuumi.dev@gmail.com>
Mon, 2 Nov 2020 06:53:59 +0000 (15:53 +0900)
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
src/test/ui/async-await/issue-70935-complex-spans.stderr
src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr

index e0c46a65b56a057c4d191a642d8df1e580c54591..83ce7f1f55e9afadbda4a5e923285a8c195b41ad 100644 (file)
@@ -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,
index 6b599b5d603d914740c6b13580463ea7ed5c9e24..8451fb840992cad7fc4246df8503bba889159691 100644 (file)
@@ -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
 
index 9d3b10c86639160628e257170029785b83964d59..b733437a51da386922a77f6fe52b28634216960b 100644 (file)
@@ -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
    |