@@ -228,11 +228,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
228
228
) -> Option < RegionName > {
229
229
let error_region = self . to_error_region ( fr) ?;
230
230
231
+ let tcx = mbcx. infcx . tcx ;
232
+
231
233
debug ! ( "give_region_a_name: error_region = {:?}" , error_region) ;
232
234
match error_region {
233
235
ty:: ReEarlyBound ( ebr) => {
234
236
if ebr. has_name ( ) {
235
- let span = mbcx . infcx . tcx . hir ( ) . span_if_local ( ebr. def_id ) . unwrap_or ( DUMMY_SP ) ;
237
+ let span = tcx. hir ( ) . span_if_local ( ebr. def_id ) . unwrap_or ( DUMMY_SP ) ;
236
238
Some ( RegionName {
237
239
name : ebr. name ,
238
240
source : RegionNameSource :: NamedEarlyBoundRegion ( span) ,
@@ -249,8 +251,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
249
251
ty:: ReFree ( free_region) => match free_region. bound_region {
250
252
ty:: BoundRegion :: BrNamed ( region_def_id, name) => {
251
253
// Get the span to point to, even if we don't use the name.
252
- let span =
253
- mbcx. infcx . tcx . hir ( ) . span_if_local ( region_def_id) . unwrap_or ( DUMMY_SP ) ;
254
+ let span = tcx. hir ( ) . span_if_local ( region_def_id) . unwrap_or ( DUMMY_SP ) ;
254
255
debug ! (
255
256
"bound region named: {:?}, is_named: {:?}" ,
256
257
name,
@@ -285,15 +286,15 @@ impl<'tcx> RegionInferenceContext<'tcx> {
285
286
286
287
if let DefiningTy :: Closure ( def_id, substs) = def_ty {
287
288
let args_span = if let hir:: ExprKind :: Closure ( _, _, _, span, _) =
288
- mbcx . infcx . tcx . hir ( ) . expect_expr ( mir_hir_id) . kind
289
+ tcx. hir ( ) . expect_expr ( mir_hir_id) . kind
289
290
{
290
291
span
291
292
} else {
292
293
bug ! ( "Closure is not defined by a closure expr" ) ;
293
294
} ;
294
295
let region_name = renctx. synthesize_region_name ( ) ;
295
296
296
- let closure_kind_ty = substs. as_closure ( ) . kind_ty ( def_id, mbcx . infcx . tcx ) ;
297
+ let closure_kind_ty = substs. as_closure ( ) . kind_ty ( def_id, tcx) ;
297
298
let note = match closure_kind_ty. to_opt_closure_kind ( ) {
298
299
Some ( ty:: ClosureKind :: Fn ) => {
299
300
"closure implements `Fn`, so references to captured variables \
0 commit comments