@@ -9,10 +9,7 @@ use rustc_middle::mir::{Mutability, Place, PlaceRef, ProjectionElem};
9
9
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
10
10
use rustc_middle:: {
11
11
hir:: place:: PlaceBase ,
12
- mir:: {
13
- self , BindingForm , ClearCrossCrate , ImplicitSelfKind , Local , LocalDecl , LocalInfo ,
14
- LocalKind , Location ,
15
- } ,
12
+ mir:: { self , BindingForm , ClearCrossCrate , Local , LocalDecl , LocalInfo , LocalKind , Location } ,
16
13
} ;
17
14
use rustc_span:: source_map:: DesugaringKind ;
18
15
use rustc_span:: symbol:: { kw, Symbol } ;
@@ -312,7 +309,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
312
309
&& !matches ! (
313
310
decl. local_info,
314
311
Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: ImplicitSelf (
315
- ImplicitSelfKind :: MutRef
312
+ hir :: ImplicitSelfKind :: MutRef
316
313
) ) ) )
317
314
)
318
315
{
@@ -973,6 +970,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
973
970
974
971
let hir = self . infcx . tcx . hir ( ) ;
975
972
let closure_id = self . mir_hir_id ( ) ;
973
+ let closure_span = self . infcx . tcx . def_span ( self . mir_def_id ( ) ) ;
976
974
let fn_call_id = hir. get_parent_node ( closure_id) ;
977
975
let node = hir. get ( fn_call_id) ;
978
976
let def_id = hir. enclosing_body_owner ( fn_call_id) ;
@@ -1024,7 +1022,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
1024
1022
if let Some ( span) = arg {
1025
1023
err. span_label ( span, "change this to accept `FnMut` instead of `Fn`" ) ;
1026
1024
err. span_label ( func. span , "expects `Fn` instead of `FnMut`" ) ;
1027
- err. span_label ( self . body . span , "in this closure" ) ;
1025
+ err. span_label ( closure_span , "in this closure" ) ;
1028
1026
look_at_return = false ;
1029
1027
}
1030
1028
}
@@ -1050,7 +1048,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
1050
1048
sig. decl . output . span ( ) ,
1051
1049
"change this to return `FnMut` instead of `Fn`" ,
1052
1050
) ;
1053
- err. span_label ( self . body . span , "in this closure" ) ;
1051
+ err. span_label ( closure_span , "in this closure" ) ;
1054
1052
}
1055
1053
_ => { }
1056
1054
}
@@ -1074,7 +1072,7 @@ fn mut_borrow_of_mutable_ref(local_decl: &LocalDecl<'_>, local_name: Option<Symb
1074
1072
//
1075
1073
// Deliberately fall into this case for all implicit self types,
1076
1074
// so that we don't fall in to the next case with them.
1077
- * kind == mir :: ImplicitSelfKind :: MutRef
1075
+ * kind == hir :: ImplicitSelfKind :: MutRef
1078
1076
}
1079
1077
_ if Some ( kw:: SelfLower ) == local_name => {
1080
1078
// Otherwise, check if the name is the `self` keyword - in which case
0 commit comments