diff options
| author | mark <markm@cs.wisc.edu> | 2019-09-14 11:26:59 -0500 |
|---|---|---|
| committer | mark <markm@cs.wisc.edu> | 2019-09-14 11:26:59 -0500 |
| commit | 2a774b1e6bfda649f75dcc6d32502100f8420a3a (patch) | |
| tree | 1b7c9f0e1e6eab8f4163cd359dbe8a5673dfb584 | |
| parent | 5b093585922f670ccd0f010c234a325b814d48a9 (diff) | |
| download | rust-2a774b1e6bfda649f75dcc6d32502100f8420a3a.tar.gz rust-2a774b1e6bfda649f75dcc6d32502100f8420a3a.zip | |
address Centril's comments
| -rw-r--r-- | src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs index 660f510ac19..26a89b4e7a8 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs @@ -56,12 +56,20 @@ enum Trace { /// Various pieces of state used when reporting borrow checker errors. pub struct ErrorReportingCtx<'a, 'b, 'tcx> { + /// The region inference context used for borrow chekcing this MIR body. #[allow(dead_code)] // FIXME(mark-i-m): used by outlives suggestions - rinfcx: &'b RegionInferenceContext<'tcx>, + region_infcx: &'b RegionInferenceContext<'tcx>, + + /// The inference context used for type checking. infcx: &'b InferCtxt<'a, 'tcx>, + /// The MIR def we are reporting errors on. mir_def_id: DefId, + + /// The MIR body we are reporting errors on (for convenience). body: &'b Body<'tcx>, + + /// Any upvars for the MIR body we have kept track of during borrow checking. upvars: &'b [Upvar], } @@ -319,7 +327,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { ); let errctx = ErrorReportingCtx { - rinfcx: self, + region_infcx: self, infcx, mir_def_id, body, @@ -335,16 +343,9 @@ impl<'tcx> RegionInferenceContext<'tcx> { self.report_fnmut_error(&errctx, &errci, renctx) } (ConstraintCategory::Assignment, true, false) - | (ConstraintCategory::CallArgument, true, false) => { - let db = self.report_escaping_data_error(&errctx, &errci, renctx); - - db - } - _ => { - let db = self.report_general_error(&errctx, &errci, renctx); - - db - } + | (ConstraintCategory::CallArgument, true, false) => + self.report_escaping_data_error(&errctx, &errci, renctx), + _ => self.report_general_error(&errctx, &errci, renctx), } } @@ -714,7 +715,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { let mut renctx = RegionErrorNamingCtx::new(); let errctx = ErrorReportingCtx { infcx, body, upvars, mir_def_id, - rinfcx: self, + region_infcx: self, }; let outlived_fr_name = self.give_region_a_name(&errctx, &mut renctx, outlived_region); |
