Skip to content

Commit 2da86a1

Browse files
committed
Add "this has type {} which {}" note
1 parent 66226ca commit 2da86a1

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1630,6 +1630,10 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
16301630
),
16311631
);
16321632
err.span_note(scope_span, &format!("{} is later dropped here", snippet));
1633+
err.span_note(
1634+
interior_span,
1635+
&format!("this has type `{}` which {}", target_ty, trait_explanation),
1636+
);
16331637
} else {
16341638
span.push_span_label(
16351639
yield_span,

src/test/ui/async-await/issue-70935-complex-spans.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ note: the value is later dropped here
1717
|
1818
LL | }).await;
1919
| ^
20+
note: this has type `[closure@$DIR/issue-70935-complex-spans.rs:13:13: 15:10]` which is not `Send`
21+
--> $DIR/issue-70935-complex-spans.rs:13:13
22+
|
23+
LL | baz(|| async{
24+
| _____________^
25+
LL | | foo(tx.clone());
26+
LL | | }).await;
27+
| |_________^
2028

2129
error: aborting due to previous error
2230

src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ note: `std::ptr::null()` is later dropped here
1818
|
1919
LL | bar(Foo(std::ptr::null())).await;
2020
| ^
21+
note: this has type `*const u8` which is not `Send`
22+
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:17
23+
|
24+
LL | bar(Foo(std::ptr::null())).await;
25+
| ^^^^^^^^^^^^^^^^
2126
help: consider moving this into a `let` binding to create a shorter lived borrow
2227
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:13
2328
|

0 commit comments

Comments
 (0)