Only separate notes if span is multiline
This commit is contained in:
parent
2da86a1bfd
commit
54d9ffc0b9
2 changed files with 17 additions and 11 deletions
|
@ -1629,11 +1629,20 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
future_or_generator, trait_explanation, an_await_or_yield
|
future_or_generator, trait_explanation, an_await_or_yield
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
err.span_note(scope_span, &format!("{} is later dropped here", snippet));
|
if source_map.is_multiline(interior_span) {
|
||||||
err.span_note(
|
err.span_note(scope_span, &format!("{} is later dropped here", snippet));
|
||||||
interior_span,
|
err.span_note(
|
||||||
&format!("this has type `{}` which {}", target_ty, trait_explanation),
|
interior_span,
|
||||||
);
|
&format!("this has type `{}` which {}", target_ty, trait_explanation),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
let mut span = MultiSpan::from_span(scope_span);
|
||||||
|
span.push_span_label(
|
||||||
|
interior_span,
|
||||||
|
format!("has type `{}` which {}", target_ty, trait_explanation),
|
||||||
|
);
|
||||||
|
err.span_note(span, &format!("{} is later dropped here", snippet));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
span.push_span_label(
|
span.push_span_label(
|
||||||
yield_span,
|
yield_span,
|
||||||
|
|
|
@ -17,12 +17,9 @@ note: `std::ptr::null()` is later dropped here
|
||||||
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:41
|
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:41
|
||||||
|
|
|
|
||||||
LL | bar(Foo(std::ptr::null())).await;
|
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
|
| has type `*const u8` which is not `Send`
|
||||||
|
|
|
||||||
LL | bar(Foo(std::ptr::null())).await;
|
|
||||||
| ^^^^^^^^^^^^^^^^
|
|
||||||
help: consider moving this into a `let` binding to create a shorter lived borrow
|
help: consider moving this into a `let` binding to create a shorter lived borrow
|
||||||
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:13
|
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:13
|
||||||
|
|
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue