@@ -386,7 +386,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
386
386
}
387
387
}
388
388
let tcx = self . infcx . tcx ;
389
- let hir = self . infcx . tcx . hir ( ) ;
390
389
if let Some ( body) = tcx. hir_maybe_body_owned_by ( self . mir_def_id ( ) ) {
391
390
let expr = body. value ;
392
391
let place = & self . move_data . move_paths [ mpi] . place ;
@@ -402,7 +401,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
402
401
if let Some ( span) = span
403
402
&& let Some ( expr) = finder. expr
404
403
{
405
- for ( _, expr) in hir . parent_iter ( expr. hir_id ) {
404
+ for ( _, expr) in tcx . hir_parent_iter ( expr. hir_id ) {
406
405
if let hir:: Node :: Expr ( expr) = expr {
407
406
if expr. span . contains ( span) {
408
407
// If the let binding occurs within the same loop, then that
@@ -969,7 +968,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
969
968
let mut parent = None ;
970
969
// The top-most loop where the moved expression could be moved to a new binding.
971
970
let mut outer_most_loop: Option < & hir:: Expr < ' _ > > = None ;
972
- for ( _, node) in tcx. hir ( ) . parent_iter ( expr. hir_id ) {
971
+ for ( _, node) in tcx. hir_parent_iter ( expr. hir_id ) {
973
972
let e = match node {
974
973
hir:: Node :: Expr ( e) => e,
975
974
hir:: Node :: LetStmt ( hir:: LetStmt { els : Some ( els) , .. } ) => {
@@ -1021,8 +1020,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1021
1020
}
1022
1021
}
1023
1022
let loop_count: usize = tcx
1024
- . hir ( )
1025
- . parent_iter ( expr. hir_id )
1023
+ . hir_parent_iter ( expr. hir_id )
1026
1024
. map ( |( _, node) | match node {
1027
1025
hir:: Node :: Expr ( hir:: Expr { kind : hir:: ExprKind :: Loop ( ..) , .. } ) => 1 ,
1028
1026
_ => 0 ,
@@ -1048,8 +1046,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1048
1046
. collect :: < Vec < Span > > ( ) ;
1049
1047
// All of the spans for the loops above the expression with the move error.
1050
1048
let loop_spans: Vec < _ > = tcx
1051
- . hir ( )
1052
- . parent_iter ( expr. hir_id )
1049
+ . hir_parent_iter ( expr. hir_id )
1053
1050
. filter_map ( |( _, node) | match node {
1054
1051
hir:: Node :: Expr ( hir:: Expr { span, kind : hir:: ExprKind :: Loop ( ..) , .. } ) => {
1055
1052
Some ( * span)
@@ -1334,7 +1331,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1334
1331
}
1335
1332
1336
1333
fn in_move_closure ( & self , expr : & hir:: Expr < ' _ > ) -> bool {
1337
- for ( _, node) in self . infcx . tcx . hir ( ) . parent_iter ( expr. hir_id ) {
1334
+ for ( _, node) in self . infcx . tcx . hir_parent_iter ( expr. hir_id ) {
1338
1335
if let hir:: Node :: Expr ( hir:: Expr { kind : hir:: ExprKind :: Closure ( closure) , .. } ) = node
1339
1336
&& let hir:: CaptureBy :: Value { .. } = closure. capture_clause
1340
1337
{
@@ -2118,7 +2115,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
2118
2115
issued_span : Span ,
2119
2116
) {
2120
2117
let tcx = self . infcx . tcx ;
2121
- let hir = tcx. hir ( ) ;
2122
2118
2123
2119
let has_split_at_mut = |ty : Ty < ' tcx > | {
2124
2120
let ty = ty. peel_refs ( ) ;
@@ -2171,7 +2167,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
2171
2167
return ;
2172
2168
} ;
2173
2169
2174
- let Some ( object) = hir . parent_id_iter ( index1. hir_id ) . find_map ( |id| {
2170
+ let Some ( object) = tcx . hir_parent_id_iter ( index1. hir_id ) . find_map ( |id| {
2175
2171
if let hir:: Node :: Expr ( expr) = tcx. hir_node ( id)
2176
2172
&& let hir:: ExprKind :: Index ( obj, ..) = expr. kind
2177
2173
{
@@ -2189,7 +2185,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
2189
2185
return ;
2190
2186
} ;
2191
2187
2192
- let Some ( swap_call) = hir . parent_id_iter ( object. hir_id ) . find_map ( |id| {
2188
+ let Some ( swap_call) = tcx . hir_parent_id_iter ( object. hir_id ) . find_map ( |id| {
2193
2189
if let hir:: Node :: Expr ( call) = tcx. hir_node ( id)
2194
2190
&& let hir:: ExprKind :: Call ( callee, ..) = call. kind
2195
2191
&& let hir:: ExprKind :: Path ( qpath) = callee. kind
0 commit comments