Skip to content

Commit 2a774b1

Browse files
committed
address Centril's comments
1 parent 5b09358 commit 2a774b1

File tree

1 file changed

+14
-13
lines changed
  • src/librustc_mir/borrow_check/nll/region_infer/error_reporting

1 file changed

+14
-13
lines changed

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,20 @@ enum Trace {
5656

5757
/// Various pieces of state used when reporting borrow checker errors.
5858
pub struct ErrorReportingCtx<'a, 'b, 'tcx> {
59+
/// The region inference context used for borrow chekcing this MIR body.
5960
#[allow(dead_code)] // FIXME(mark-i-m): used by outlives suggestions
60-
rinfcx: &'b RegionInferenceContext<'tcx>,
61+
region_infcx: &'b RegionInferenceContext<'tcx>,
62+
63+
/// The inference context used for type checking.
6164
infcx: &'b InferCtxt<'a, 'tcx>,
6265

66+
/// The MIR def we are reporting errors on.
6367
mir_def_id: DefId,
68+
69+
/// The MIR body we are reporting errors on (for convenience).
6470
body: &'b Body<'tcx>,
71+
72+
/// Any upvars for the MIR body we have kept track of during borrow checking.
6573
upvars: &'b [Upvar],
6674
}
6775

@@ -319,7 +327,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
319327
);
320328

321329
let errctx = ErrorReportingCtx {
322-
rinfcx: self,
330+
region_infcx: self,
323331
infcx,
324332
mir_def_id,
325333
body,
@@ -335,16 +343,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
335343
self.report_fnmut_error(&errctx, &errci, renctx)
336344
}
337345
(ConstraintCategory::Assignment, true, false)
338-
| (ConstraintCategory::CallArgument, true, false) => {
339-
let db = self.report_escaping_data_error(&errctx, &errci, renctx);
340-
341-
db
342-
}
343-
_ => {
344-
let db = self.report_general_error(&errctx, &errci, renctx);
345-
346-
db
347-
}
346+
| (ConstraintCategory::CallArgument, true, false) =>
347+
self.report_escaping_data_error(&errctx, &errci, renctx),
348+
_ => self.report_general_error(&errctx, &errci, renctx),
348349
}
349350
}
350351

@@ -714,7 +715,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
714715
let mut renctx = RegionErrorNamingCtx::new();
715716
let errctx = ErrorReportingCtx {
716717
infcx, body, upvars, mir_def_id,
717-
rinfcx: self,
718+
region_infcx: self,
718719
};
719720
let outlived_fr_name = self.give_region_a_name(&errctx, &mut renctx, outlived_region);
720721

0 commit comments

Comments
 (0)