@@ -56,12 +56,20 @@ enum Trace {
56
56
57
57
/// Various pieces of state used when reporting borrow checker errors.
58
58
pub struct ErrorReportingCtx < ' a , ' b , ' tcx > {
59
+ /// The region inference context used for borrow chekcing this MIR body.
59
60
#[ 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.
61
64
infcx : & ' b InferCtxt < ' a , ' tcx > ,
62
65
66
+ /// The MIR def we are reporting errors on.
63
67
mir_def_id : DefId ,
68
+
69
+ /// The MIR body we are reporting errors on (for convenience).
64
70
body : & ' b Body < ' tcx > ,
71
+
72
+ /// Any upvars for the MIR body we have kept track of during borrow checking.
65
73
upvars : & ' b [ Upvar ] ,
66
74
}
67
75
@@ -319,7 +327,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
319
327
) ;
320
328
321
329
let errctx = ErrorReportingCtx {
322
- rinfcx : self ,
330
+ region_infcx : self ,
323
331
infcx,
324
332
mir_def_id,
325
333
body,
@@ -335,16 +343,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
335
343
self . report_fnmut_error ( & errctx, & errci, renctx)
336
344
}
337
345
( 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) ,
348
349
}
349
350
}
350
351
@@ -714,7 +715,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
714
715
let mut renctx = RegionErrorNamingCtx :: new ( ) ;
715
716
let errctx = ErrorReportingCtx {
716
717
infcx, body, upvars, mir_def_id,
717
- rinfcx : self ,
718
+ region_infcx : self ,
718
719
} ;
719
720
let outlived_fr_name = self . give_region_a_name ( & errctx, & mut renctx, outlived_region) ;
720
721
0 commit comments