@@ -211,7 +211,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
211
211
expr : & hir:: Expr < ' _ > ,
212
212
error : Option < TypeError < ' tcx > > ,
213
213
) {
214
- let parent = self . tcx . hir ( ) . get_parent_node ( expr. hir_id ) ;
214
+ let parent = self . tcx . hir ( ) . parent_id ( expr. hir_id ) ;
215
215
match ( self . tcx . hir ( ) . find ( parent) , error) {
216
216
( Some ( hir:: Node :: Local ( hir:: Local { ty : Some ( ty) , init : Some ( init) , .. } ) ) , _)
217
217
if init. hir_id == expr. hir_id =>
@@ -258,7 +258,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
258
258
hir:: Path { res : hir:: def:: Res :: Local ( hir_id) , .. } ,
259
259
) ) => {
260
260
if let Some ( hir:: Node :: Pat ( pat) ) = self . tcx . hir ( ) . find ( * hir_id) {
261
- let parent = self . tcx . hir ( ) . get_parent_node ( pat. hir_id ) ;
261
+ let parent = self . tcx . hir ( ) . parent_id ( pat. hir_id ) ;
262
262
primary_span = pat. span ;
263
263
secondary_span = pat. span ;
264
264
match self . tcx . hir ( ) . find ( parent) {
@@ -326,7 +326,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
326
326
expr : & hir:: Expr < ' _ > ,
327
327
error : Option < TypeError < ' tcx > > ,
328
328
) {
329
- let parent = self . tcx . hir ( ) . get_parent_node ( expr. hir_id ) ;
329
+ let parent = self . tcx . hir ( ) . parent_id ( expr. hir_id ) ;
330
330
let Some ( TypeError :: Sorts ( ExpectedFound { expected, .. } ) ) = error else { return ; } ;
331
331
let Some ( hir:: Node :: Expr ( hir:: Expr {
332
332
kind : hir:: ExprKind :: Assign ( lhs, rhs, _) , ..
@@ -510,7 +510,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
510
510
511
511
// Unroll desugaring, to make sure this works for `for` loops etc.
512
512
loop {
513
- parent = self . tcx . hir ( ) . get_parent_node ( id) ;
513
+ parent = self . tcx . hir ( ) . parent_id ( id) ;
514
514
if let Some ( parent_span) = self . tcx . hir ( ) . opt_span ( parent) {
515
515
if parent_span. find_ancestor_inside ( expr. span ) . is_some ( ) {
516
516
// The parent node is part of the same span, so is the result of the
@@ -790,12 +790,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
790
790
return None ;
791
791
} ;
792
792
793
- let local_parent = self . tcx . hir ( ) . get_parent_node ( local_id) ;
793
+ let local_parent = self . tcx . hir ( ) . parent_id ( local_id) ;
794
794
let Some ( Node :: Param ( hir:: Param { hir_id : param_hir_id, .. } ) ) = self . tcx . hir ( ) . find ( local_parent) else {
795
795
return None ;
796
796
} ;
797
797
798
- let param_parent = self . tcx . hir ( ) . get_parent_node ( * param_hir_id) ;
798
+ let param_parent = self . tcx . hir ( ) . parent_id ( * param_hir_id) ;
799
799
let Some ( Node :: Expr ( hir:: Expr {
800
800
hir_id : expr_hir_id,
801
801
kind : hir:: ExprKind :: Closure ( hir:: Closure { fn_decl : closure_fn_decl, .. } ) ,
@@ -804,7 +804,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
804
804
return None ;
805
805
} ;
806
806
807
- let expr_parent = self . tcx . hir ( ) . get_parent_node ( * expr_hir_id) ;
807
+ let expr_parent = self . tcx . hir ( ) . parent_id ( * expr_hir_id) ;
808
808
let hir = self . tcx . hir ( ) . find ( expr_parent) ;
809
809
let closure_params_len = closure_fn_decl. inputs . len ( ) ;
810
810
let (
@@ -857,7 +857,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
857
857
_ => None ,
858
858
} ?;
859
859
860
- match hir. find ( hir. get_parent_node ( expr. hir_id ) ) ? {
860
+ match hir. find ( hir. parent_id ( expr. hir_id ) ) ? {
861
861
Node :: ExprField ( field) => {
862
862
if field. ident . name == local. name && field. is_shorthand {
863
863
return Some ( local. name ) ;
@@ -883,7 +883,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
883
883
/// Returns whether the given expression is an `else if`.
884
884
pub ( crate ) fn is_else_if_block ( & self , expr : & hir:: Expr < ' _ > ) -> bool {
885
885
if let hir:: ExprKind :: If ( ..) = expr. kind {
886
- let parent_id = self . tcx . hir ( ) . get_parent_node ( expr. hir_id ) ;
886
+ let parent_id = self . tcx . hir ( ) . parent_id ( expr. hir_id ) ;
887
887
if let Some ( Node :: Expr ( hir:: Expr {
888
888
kind : hir:: ExprKind :: If ( _, _, Some ( else_expr) ) ,
889
889
..
@@ -1040,7 +1040,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1040
1040
if let Some ( hir:: Node :: Expr ( hir:: Expr {
1041
1041
kind : hir:: ExprKind :: Assign ( ..) ,
1042
1042
..
1043
- } ) ) = self . tcx . hir ( ) . find ( self . tcx . hir ( ) . get_parent_node ( expr. hir_id ) )
1043
+ } ) ) = self . tcx . hir ( ) . find ( self . tcx . hir ( ) . parent_id ( expr. hir_id ) )
1044
1044
{
1045
1045
if mutability. is_mut ( ) {
1046
1046
// Suppressing this diagnostic, we'll properly print it in `check_expr_assign`
@@ -1268,7 +1268,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1268
1268
let mut sugg = vec ! [ ] ;
1269
1269
1270
1270
if let Some ( hir:: Node :: ExprField ( field) ) =
1271
- self . tcx . hir ( ) . find ( self . tcx . hir ( ) . get_parent_node ( expr. hir_id ) )
1271
+ self . tcx . hir ( ) . find ( self . tcx . hir ( ) . parent_id ( expr. hir_id ) )
1272
1272
{
1273
1273
// `expr` is a literal field for a struct, only suggest if appropriate
1274
1274
if field. is_shorthand {
@@ -1625,7 +1625,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1625
1625
[ start, end] ,
1626
1626
_,
1627
1627
) = expr. kind else { return ; } ;
1628
- let parent = self . tcx . hir ( ) . get_parent_node ( expr. hir_id ) ;
1628
+ let parent = self . tcx . hir ( ) . parent_id ( expr. hir_id ) ;
1629
1629
if let Some ( hir:: Node :: ExprField ( _) ) = self . tcx . hir ( ) . find ( parent) {
1630
1630
// Ignore `Foo { field: a..Default::default() }`
1631
1631
return ;
0 commit comments