@@ -672,11 +672,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
672672 } ;
673673 (
674674 true ,
675- td. as_local ( ) . and_then ( |tld| match self . infcx . tcx . opt_hir_node_by_def_id ( tld) {
676- Some ( Node :: Item ( hir:: Item {
677- kind : hir:: ItemKind :: Trait ( _, _, _, _, items) ,
678- ..
679- } ) ) => {
675+ td. as_local ( ) . and_then ( |tld| match self . infcx . tcx . hir_node_by_def_id ( tld) {
676+ Node :: Item ( hir:: Item { kind : hir:: ItemKind :: Trait ( _, _, _, _, items) , .. } ) => {
680677 let mut f_in_trait_opt = None ;
681678 for hir:: TraitItemRef { id : fi, kind : k, .. } in * items {
682679 let hi = fi. hir_id ( ) ;
@@ -1475,11 +1472,9 @@ fn get_mut_span_in_struct_field<'tcx>(
14751472 if let ty:: Ref ( _, ty, _) = ty. kind ( )
14761473 && let ty:: Adt ( def, _) = ty. kind ( )
14771474 && let field = def. all_fields ( ) . nth ( field. index ( ) ) ?
1478- // Use the HIR types to construct the diagnostic message.
1479- && let node = tcx. opt_hir_node_by_def_id ( field. did . as_local ( ) ?) ?
14801475 // Now we're dealing with the actual struct that we're going to suggest a change to,
14811476 // we can expect a field that is an immutable reference to a type.
1482- && let hir:: Node :: Field ( field) = node
1477+ && let hir:: Node :: Field ( field) = tcx . hir_node_by_def_id ( field . did . as_local ( ) ? )
14831478 && let hir:: TyKind :: Ref ( lt, hir:: MutTy { mutbl : hir:: Mutability :: Not , ty } ) = field. ty . kind
14841479 {
14851480 return Some ( lt. ident . span . between ( ty. span ) ) ;
0 commit comments