Alpha-rename BorrowExplanation::emit
to BorrowExplanation::add_explanation_to_diagnostic
.
(I found it confusing to have calls to an `emit` method in our error_reporting module where that `emit` method *wasn't* the `DiagnosticBuffer::emit` method.)
This commit is contained in:
parent
74f8263032
commit
8532c1896d
@ -262,7 +262,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
move_spans.var_span_label(&mut err, "move occurs due to use in closure");
|
||||
|
||||
self.explain_why_borrow_contains_point(context, borrow, None)
|
||||
.emit(self.infcx.tcx, &mut err, String::new());
|
||||
.add_explanation_to_diagnostic(self.infcx.tcx, &mut err, String::new());
|
||||
err.buffer(&mut self.errors_buffer);
|
||||
}
|
||||
|
||||
@ -299,7 +299,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
});
|
||||
|
||||
self.explain_why_borrow_contains_point(context, borrow, None)
|
||||
.emit(self.infcx.tcx, &mut err, String::new());
|
||||
.add_explanation_to_diagnostic(self.infcx.tcx, &mut err, String::new());
|
||||
err.buffer(&mut self.errors_buffer);
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
self.explain_why_borrow_contains_point(context, issued_borrow, None)
|
||||
.emit(self.infcx.tcx, &mut err, first_borrow_desc.to_string());
|
||||
.add_explanation_to_diagnostic(self.infcx.tcx, &mut err, first_borrow_desc.to_string());
|
||||
|
||||
err.buffer(&mut self.errors_buffer);
|
||||
}
|
||||
@ -638,7 +638,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
|
||||
if let BorrowExplanation::MustBeValidFor(..) = explanation {
|
||||
} else {
|
||||
explanation.emit(self.infcx.tcx, &mut err, String::new());
|
||||
explanation.add_explanation_to_diagnostic(self.infcx.tcx, &mut err, String::new());
|
||||
}
|
||||
} else {
|
||||
err.span_label(borrow_span, "borrowed value does not live long enough");
|
||||
@ -649,7 +649,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
|
||||
borrow_spans.args_span_label(&mut err, "value captured here");
|
||||
|
||||
explanation.emit(self.infcx.tcx, &mut err, String::new());
|
||||
explanation.add_explanation_to_diagnostic(self.infcx.tcx, &mut err, String::new());
|
||||
}
|
||||
|
||||
err
|
||||
@ -709,7 +709,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
explanation.emit(self.infcx.tcx, &mut err, String::new());
|
||||
explanation.add_explanation_to_diagnostic(self.infcx.tcx, &mut err, String::new());
|
||||
|
||||
err.buffer(&mut self.errors_buffer);
|
||||
}
|
||||
@ -776,7 +776,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
explanation.emit(self.infcx.tcx, &mut err, String::new());
|
||||
explanation.add_explanation_to_diagnostic(self.infcx.tcx, &mut err, String::new());
|
||||
|
||||
borrow_spans.args_span_label(&mut err, "value captured here");
|
||||
|
||||
@ -913,7 +913,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
loan_spans.var_span_label(&mut err, "borrow occurs due to use in closure");
|
||||
|
||||
self.explain_why_borrow_contains_point(context, loan, None)
|
||||
.emit(self.infcx.tcx, &mut err, String::new());
|
||||
.add_explanation_to_diagnostic(self.infcx.tcx, &mut err, String::new());
|
||||
|
||||
err.buffer(&mut self.errors_buffer);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ pub(in borrow_check) enum LaterUseKind {
|
||||
}
|
||||
|
||||
impl<'tcx> BorrowExplanation<'tcx> {
|
||||
pub(in borrow_check) fn emit<'cx, 'gcx>(
|
||||
pub(in borrow_check) fn add_explanation_to_diagnostic<'cx, 'gcx>(
|
||||
&self,
|
||||
tcx: TyCtxt<'cx, 'gcx, 'tcx>,
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user