@@ -648,10 +648,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
648
648
}
649
649
}
650
650
}
651
- let hir_map = self . infcx . tcx . hir ( ) ;
652
651
let def_id = self . body . source . def_id ( ) ;
653
652
let Some ( local_def_id) = def_id. as_local ( ) else { return } ;
654
- let Some ( body) = hir_map . maybe_body_owned_by ( local_def_id) else { return } ;
653
+ let Some ( body) = self . infcx . tcx . hir_maybe_body_owned_by ( local_def_id) else { return } ;
655
654
656
655
let mut v = SuggestIndexOperatorAlternativeVisitor {
657
656
assign_span : span,
@@ -749,7 +748,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
749
748
// `fn foo(&x: &i32)` -> `fn foo(&(mut x): &i32)`
750
749
let def_id = self . body . source . def_id ( ) ;
751
750
if let Some ( local_def_id) = def_id. as_local ( )
752
- && let Some ( body) = self . infcx . tcx . hir ( ) . maybe_body_owned_by ( local_def_id)
751
+ && let Some ( body) = self . infcx . tcx . hir_maybe_body_owned_by ( local_def_id)
753
752
&& let Some ( hir_id) = ( BindingFinder { span : pat_span } ) . visit_body ( & body) . break_value ( )
754
753
&& let node = self . infcx . tcx . hir_node ( hir_id)
755
754
&& let hir:: Node :: LetStmt ( hir:: LetStmt {
@@ -856,7 +855,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
856
855
use hir:: ExprKind :: { AddrOf , Block , Call , MethodCall } ;
857
856
use hir:: { BorrowKind , Expr } ;
858
857
859
- let hir_map = self . infcx . tcx . hir ( ) ;
858
+ let tcx = self . infcx . tcx ;
860
859
struct Finder {
861
860
span : Span ,
862
861
}
@@ -871,7 +870,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
871
870
}
872
871
}
873
872
}
874
- if let Some ( body) = hir_map . maybe_body_owned_by ( self . mir_def_id ( ) )
873
+ if let Some ( body) = tcx . hir_maybe_body_owned_by ( self . mir_def_id ( ) )
875
874
&& let Block ( block, _) = body. value . kind
876
875
{
877
876
// `span` corresponds to the expression being iterated, find the `for`-loop desugared
@@ -884,17 +883,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
884
883
MethodCall ( path_segment, _, _, span) => {
885
884
// We have `for _ in iter.read_only_iter()`, try to
886
885
// suggest `for _ in iter.mutable_iter()` instead.
887
- let opt_suggestions = self
888
- . infcx
889
- . tcx
886
+ let opt_suggestions = tcx
890
887
. typeck ( path_segment. hir_id . owner . def_id )
891
888
. type_dependent_def_id ( expr. hir_id )
892
- . and_then ( |def_id| self . infcx . tcx . impl_of_method ( def_id) )
893
- . map ( |def_id| self . infcx . tcx . associated_items ( def_id) )
889
+ . and_then ( |def_id| tcx. impl_of_method ( def_id) )
890
+ . map ( |def_id| tcx. associated_items ( def_id) )
894
891
. map ( |assoc_items| {
895
892
assoc_items
896
893
. in_definition_order ( )
897
- . map ( |assoc_item_def| assoc_item_def. ident ( self . infcx . tcx ) )
894
+ . map ( |assoc_item_def| assoc_item_def. ident ( tcx) )
898
895
. filter ( |& ident| {
899
896
let original_method_ident = path_segment. ident ;
900
897
original_method_ident != ident
@@ -942,7 +939,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
942
939
let closure_span = tcx. def_span ( self . mir_def_id ( ) ) ;
943
940
let fn_call_id = tcx. parent_hir_id ( closure_id) ;
944
941
let node = tcx. hir_node ( fn_call_id) ;
945
- let def_id = hir . enclosing_body_owner ( fn_call_id) ;
942
+ let def_id = tcx . hir_enclosing_body_owner ( fn_call_id) ;
946
943
let mut look_at_return = true ;
947
944
948
945
// If the HIR node is a function or method call gets the def ID
@@ -1275,7 +1272,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1275
1272
} ) => {
1276
1273
let def_id = self . body . source . def_id ( ) ;
1277
1274
let hir_id = if let Some ( local_def_id) = def_id. as_local ( )
1278
- && let Some ( body) = self . infcx . tcx . hir ( ) . maybe_body_owned_by ( local_def_id)
1275
+ && let Some ( body) = self . infcx . tcx . hir_maybe_body_owned_by ( local_def_id)
1279
1276
{
1280
1277
BindingFinder { span : err_label_span } . visit_body ( & body) . break_value ( )
1281
1278
} else {
0 commit comments