@@ -9,10 +9,7 @@ use rustc_middle::mir::{Mutability, Place, PlaceRef, ProjectionElem};
99use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
1010use rustc_middle:: {
1111 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 } ,
1613} ;
1714use rustc_span:: source_map:: DesugaringKind ;
1815use rustc_span:: symbol:: { kw, Symbol } ;
@@ -312,7 +309,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
312309 && !matches ! (
313310 decl. local_info,
314311 Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: ImplicitSelf (
315- ImplicitSelfKind :: MutRef
312+ hir :: ImplicitSelfKind :: MutRef
316313 ) ) ) )
317314 )
318315 {
@@ -973,6 +970,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
973970
974971 let hir = self . infcx . tcx . hir ( ) ;
975972 let closure_id = self . mir_hir_id ( ) ;
973+ let closure_span = self . infcx . tcx . def_span ( self . mir_def_id ( ) ) ;
976974 let fn_call_id = hir. get_parent_node ( closure_id) ;
977975 let node = hir. get ( fn_call_id) ;
978976 let def_id = hir. enclosing_body_owner ( fn_call_id) ;
@@ -1024,7 +1022,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
10241022 if let Some ( span) = arg {
10251023 err. span_label ( span, "change this to accept `FnMut` instead of `Fn`" ) ;
10261024 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" ) ;
10281026 look_at_return = false ;
10291027 }
10301028 }
@@ -1050,7 +1048,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
10501048 sig. decl . output . span ( ) ,
10511049 "change this to return `FnMut` instead of `Fn`" ,
10521050 ) ;
1053- err. span_label ( self . body . span , "in this closure" ) ;
1051+ err. span_label ( closure_span , "in this closure" ) ;
10541052 }
10551053 _ => { }
10561054 }
@@ -1074,7 +1072,7 @@ fn mut_borrow_of_mutable_ref(local_decl: &LocalDecl<'_>, local_name: Option<Symb
10741072 //
10751073 // Deliberately fall into this case for all implicit self types,
10761074 // so that we don't fall in to the next case with them.
1077- * kind == mir :: ImplicitSelfKind :: MutRef
1075+ * kind == hir :: ImplicitSelfKind :: MutRef
10781076 }
10791077 _ if Some ( kw:: SelfLower ) == local_name => {
10801078 // Otherwise, check if the name is the `self` keyword - in which case
0 commit comments