Skip to content

Commit

Permalink
address Centril's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-i-m committed Sep 14, 2019
1 parent 5b09358 commit 2a774b1
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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],
}

Expand Down Expand Up @@ -319,7 +327,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
);

let errctx = ErrorReportingCtx {
rinfcx: self,
region_infcx: self,
infcx,
mir_def_id,
body,
Expand All @@ -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),
}
}

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 2a774b1

Please sign in to comment.