]> git.lizzy.rs Git - rust.git/commitdiff
Alpha-rename `BorrowExplanation::emit` to `BorrowExplanation::add_explanation_to_diag...
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Fri, 28 Sep 2018 10:19:28 +0000 (12:19 +0200)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Fri, 5 Oct 2018 08:43:14 +0000 (10:43 +0200)
(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.)

src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs

index 1589d62300cab3f0d8e16710b0953d5c315d459b..45435c64749e2edcb4f41dcaee95514085b0d90e 100644 (file)
@@ -262,7 +262,7 @@ pub(super) fn report_move_out_while_borrowed(
         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 @@ pub(super) fn report_use_while_mutably_borrowed(
         });
 
         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 @@ pub(super) fn report_conflicting_borrow(
         }
 
         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 @@ fn report_local_value_does_not_live_long_enough(
 
             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 @@ fn report_local_value_does_not_live_long_enough(
 
             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 @@ pub(super) fn report_borrow_conflicts_with_destructor(
             _ => {}
         }
 
-        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 @@ fn report_temporary_value_does_not_live_long_enough(
             }
             _ => {}
         }
-        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 @@ pub(super) fn report_illegal_mutation_of_borrowed(
         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);
     }
index 5092cd4a8b924307f365a70c85882fad9a2e033e..d2f707ed2e8e9cc76880b5563a72df3b57ccf4b3 100644 (file)
@@ -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<'_>,