Fix format
This commit is contained in:
parent
54d9ffc0b9
commit
8d651013e4
1 changed files with 96 additions and 91 deletions
|
@ -1570,9 +1570,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
format!("does not implement `{}`", trait_ref.print_only_trait_path())
|
format!("does not implement `{}`", trait_ref.print_only_trait_path())
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut explain_yield = |interior_span: Span,
|
let mut explain_yield =
|
||||||
yield_span: Span,
|
|interior_span: Span, yield_span: Span, scope_span: Option<Span>| {
|
||||||
scope_span: Option<Span>| {
|
|
||||||
let mut span = MultiSpan::from_span(yield_span);
|
let mut span = MultiSpan::from_span(yield_span);
|
||||||
if let Ok(snippet) = source_map.span_to_snippet(interior_span) {
|
if let Ok(snippet) = source_map.span_to_snippet(interior_span) {
|
||||||
// #70935: If snippet contains newlines, display "the value" instead
|
// #70935: If snippet contains newlines, display "the value" instead
|
||||||
|
@ -1630,10 +1629,16 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if source_map.is_multiline(interior_span) {
|
if source_map.is_multiline(interior_span) {
|
||||||
err.span_note(scope_span, &format!("{} is later dropped here", snippet));
|
err.span_note(
|
||||||
|
scope_span,
|
||||||
|
&format!("{} is later dropped here", snippet),
|
||||||
|
);
|
||||||
err.span_note(
|
err.span_note(
|
||||||
interior_span,
|
interior_span,
|
||||||
&format!("this has type `{}` which {}", target_ty, trait_explanation),
|
&format!(
|
||||||
|
"this has type `{}` which {}",
|
||||||
|
target_ty, trait_explanation
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
let mut span = MultiSpan::from_span(scope_span);
|
let mut span = MultiSpan::from_span(scope_span);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue