Skip to content

Commit b072838

Browse files
committed
hir: Remove hir::Map::{opt_parent_id,parent_id,get_parent,find_parent}
1 parent e46e3e7 commit b072838

File tree

78 files changed

+233
-318
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+233
-318
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
403403
}
404404
}
405405
let typeck = self.infcx.tcx.typeck(self.mir_def_id());
406-
let hir_id = hir.parent_id(expr.hir_id);
407-
let parent = self.infcx.tcx.hir_node(hir_id);
406+
let parent = self.infcx.tcx.parent_hir_node(expr.hir_id);
408407
let (def_id, args, offset) = if let hir::Node::Expr(parent_expr) = parent
409408
&& let hir::ExprKind::MethodCall(_, _, args, _) = parent_expr.kind
410409
&& let Some(def_id) = typeck.type_dependent_def_id(parent_expr.hir_id)
@@ -1660,8 +1659,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16601659

16611660
// Check that the parent of the closure is a method call,
16621661
// with receiver matching with local's type (modulo refs)
1663-
let parent = hir.parent_id(closure_expr.hir_id);
1664-
if let hir::Node::Expr(parent) = tcx.hir_node(parent) {
1662+
if let hir::Node::Expr(parent) = tcx.parent_hir_node(closure_expr.hir_id) {
16651663
if let hir::ExprKind::MethodCall(_, recv, ..) = parent.kind {
16661664
let recv_ty = typeck_results.expr_ty(recv);
16671665

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
944944
let hir = self.infcx.tcx.hir();
945945
let closure_id = self.mir_hir_id();
946946
let closure_span = self.infcx.tcx.def_span(self.mir_def_id());
947-
let fn_call_id = hir.parent_id(closure_id);
947+
let fn_call_id = self.infcx.tcx.parent_hir_id(closure_id);
948948
let node = self.infcx.tcx.hir_node(fn_call_id);
949949
let def_id = hir.enclosing_body_owner(fn_call_id);
950950
let mut look_at_return = true;
@@ -1034,7 +1034,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
10341034
if let InstanceDef::Item(def_id) = source.instance
10351035
&& let Some(Node::Expr(hir::Expr { hir_id, kind, .. })) = hir.get_if_local(def_id)
10361036
&& let ExprKind::Closure(hir::Closure { kind: hir::ClosureKind::Closure, .. }) = kind
1037-
&& let Some(Node::Expr(expr)) = hir.find_parent(*hir_id)
1037+
&& let Node::Expr(expr) = self.infcx.tcx.parent_hir_node(*hir_id)
10381038
{
10391039
let mut cur_expr = expr;
10401040
while let ExprKind::MethodCall(path_segment, recv, _, _) = cur_expr.kind {

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,11 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
214214
if let Some(id) = placeholder.bound.kind.get_id()
215215
&& let Some(placeholder_id) = id.as_local()
216216
&& let gat_hir_id = self.infcx.tcx.local_def_id_to_hir_id(placeholder_id)
217-
&& let Some(generics_impl) =
218-
hir.get_parent(hir.parent_id(gat_hir_id)).generics()
217+
&& let Some(generics_impl) = self
218+
.infcx
219+
.tcx
220+
.parent_hir_node(self.infcx.tcx.parent_hir_id(gat_hir_id))
221+
.generics()
219222
{
220223
Some((gat_hir_id, generics_impl))
221224
} else {

compiler/rustc_const_eval/src/transform/check_consts/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,10 @@ fn is_parent_const_stable_trait(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
131131
let local_def_id = def_id.expect_local();
132132
let hir_id = tcx.local_def_id_to_hir_id(local_def_id);
133133

134-
let Some(parent) = tcx.hir().opt_parent_id(hir_id) else { return false };
135-
136-
if !tcx.is_const_trait_impl_raw(parent.owner.def_id.to_def_id()) {
134+
let parent_owner_id = tcx.parent_hir_id(hir_id).owner;
135+
if !tcx.is_const_trait_impl_raw(parent_owner_id.to_def_id()) {
137136
return false;
138137
}
139138

140-
tcx.lookup_const_stability(parent.owner).is_some_and(|stab| stab.is_const_stable())
139+
tcx.lookup_const_stability(parent_owner_id).is_some_and(|stab| stab.is_const_stable())
141140
}

compiler/rustc_hir/src/hir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3508,7 +3508,7 @@ impl<'hir> Node<'hir> {
35083508
/// ```ignore (illustrative)
35093509
/// ctor
35103510
/// .ctor_hir_id()
3511-
/// .and_then(|ctor_id| tcx.hir().find_parent(ctor_id))
3511+
/// .map(|ctor_id| tcx.parent_hir_node(ctor_id))
35123512
/// .and_then(|parent| parent.ident())
35133513
/// ```
35143514
pub fn ident(&self) -> Option<Ident> {

compiler/rustc_hir_analysis/src/astconv/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -2749,14 +2749,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
27492749
arg_idx: Option<usize>,
27502750
) -> Option<Ty<'tcx>> {
27512751
let tcx = self.tcx();
2752-
let hir = tcx.hir();
2753-
27542752
let hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(..), ident, .. }) =
27552753
tcx.hir_node(fn_hir_id)
27562754
else {
27572755
return None;
27582756
};
2759-
let i = hir.get_parent(fn_hir_id).expect_item().expect_impl();
2757+
let i = tcx.parent_hir_node(fn_hir_id).expect_item().expect_impl();
27602758

27612759
let trait_ref =
27622760
self.instantiate_mono_trait_ref(i.of_trait.as_ref()?, self.ast_ty_to_ty(i.self_ty));

compiler/rustc_hir_analysis/src/collect.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,8 @@ pub(crate) fn placeholder_type_error_diag<'tcx>(
224224
is_fn = true;
225225

226226
// Check if parent is const or static
227-
let parent_id = tcx.hir().parent_id(hir_ty.hir_id);
228-
let parent_node = tcx.hir_node(parent_id);
229-
230227
is_const_or_static = matches!(
231-
parent_node,
228+
tcx.parent_hir_node(hir_ty.hir_id),
232229
Node::Item(&hir::Item {
233230
kind: hir::ItemKind::Const(..) | hir::ItemKind::Static(..),
234231
..
@@ -1085,7 +1082,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<ty::PolyFnSig<
10851082

10861083
ImplItem(hir::ImplItem { kind: ImplItemKind::Fn(sig, _), generics, .. }) => {
10871084
// Do not try to infer the return type for a impl method coming from a trait
1088-
if let Item(hir::Item { kind: ItemKind::Impl(i), .. }) = tcx.hir().get_parent(hir_id)
1085+
if let Item(hir::Item { kind: ItemKind::Impl(i), .. }) = tcx.parent_hir_node(hir_id)
10891086
&& i.of_trait.is_some()
10901087
{
10911088
icx.astconv().ty_of_fn(

compiler/rustc_hir_analysis/src/collect/generics_of.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
5151
// of a const parameter type, e.g. `struct Foo<const N: usize, const M: [u8; N]>` is not allowed.
5252
None
5353
} else if tcx.features().generic_const_exprs {
54-
let parent_node = tcx.hir().get_parent(hir_id);
54+
let parent_node = tcx.parent_hir_node(hir_id);
5555
if let Node::Variant(Variant { disr_expr: Some(constant), .. }) = parent_node
5656
&& constant.hir_id == hir_id
5757
{
@@ -113,7 +113,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
113113
Some(parent_def_id.to_def_id())
114114
}
115115
} else {
116-
let parent_node = tcx.hir().get_parent(hir_id);
116+
let parent_node = tcx.parent_hir_node(hir_id);
117117
match parent_node {
118118
// HACK(eddyb) this provides the correct generics for repeat
119119
// expressions' count (i.e. `N` in `[x; N]`), and explicit

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
315315
// We create bi-directional Outlives predicates between the original
316316
// and the duplicated parameter, to ensure that they do not get out of sync.
317317
if let Node::Item(&Item { kind: ItemKind::OpaqueTy(..), .. }) = node {
318-
let opaque_ty_id = tcx.hir().parent_id(hir_id);
319-
let opaque_ty_node = tcx.hir_node(opaque_ty_id);
318+
let opaque_ty_node = tcx.parent_hir_node(hir_id);
320319
let Node::Ty(&Ty { kind: TyKind::OpaqueDef(_, lifetimes, _), .. }) = opaque_ty_node else {
321320
bug!("unexpected {opaque_ty_node:?}")
322321
};

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
732732
let Some(def_id) = def_id.as_local() else { continue };
733733
let hir_id = self.tcx.local_def_id_to_hir_id(def_id);
734734
// Ensure that the parent of the def is an item, not HRTB
735-
let parent_id = self.tcx.hir().parent_id(hir_id);
735+
let parent_id = self.tcx.parent_hir_id(hir_id);
736736
if !parent_id.is_owner() {
737737
struct_span_code_err!(
738738
self.tcx.dcx(),

compiler/rustc_hir_analysis/src/collect/type_of.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn anon_const_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx> {
3030
);
3131
};
3232

33-
let parent_node_id = tcx.hir().parent_id(hir_id);
33+
let parent_node_id = tcx.parent_hir_id(hir_id);
3434
let parent_node = tcx.hir_node(parent_node_id);
3535

3636
let (generics, arg_idx) = match parent_node {
@@ -79,7 +79,7 @@ fn anon_const_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx> {
7979
}
8080

8181
Node::TypeBinding(binding @ &TypeBinding { hir_id: binding_id, .. })
82-
if let Node::TraitRef(trait_ref) = tcx.hir_node(tcx.hir().parent_id(binding_id)) =>
82+
if let Node::TraitRef(trait_ref) = tcx.parent_hir_node(binding_id) =>
8383
{
8484
let Some(trait_def_id) = trait_ref.trait_def_id() else {
8585
return Ty::new_error_with_message(

compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
135135
// Here we check if the reference to the generic type
136136
// is from the 'of_trait' field of the enclosing impl
137137

138-
let parent = self.tcx.hir().get_parent(self.path_segment.hir_id);
138+
let parent = self.tcx.parent_hir_node(self.path_segment.hir_id);
139139
let parent_item = self.tcx.hir_node_by_def_id(
140140
self.tcx.hir().get_parent_item(self.path_segment.hir_id).def_id,
141141
);
@@ -770,9 +770,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
770770
num = num_trait_generics_except_self,
771771
);
772772

773-
if let Some(parent_node) = self.tcx.hir().opt_parent_id(self.path_segment.hir_id)
774-
&& let hir::Node::Expr(expr) = self.tcx.hir_node(parent_node)
775-
{
773+
if let hir::Node::Expr(expr) = self.tcx.parent_hir_node(self.path_segment.hir_id) {
776774
match &expr.kind {
777775
hir::ExprKind::Path(qpath) => self
778776
.suggest_moving_args_from_assoc_fn_to_trait_for_qualified_path(

compiler/rustc_hir_typeck/src/_match.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
287287
{
288288
// If this `if` expr is the parent's function return expr,
289289
// the cause of the type coercion is the return type, point at it. (#25228)
290-
let hir_id = self.tcx.hir().parent_id(self.tcx.hir().parent_id(then_expr.hir_id));
290+
let hir_id = self.tcx.parent_hir_id(self.tcx.parent_hir_id(then_expr.hir_id));
291291
let ret_reason = self.maybe_get_coercion_reason(hir_id, if_span);
292292
let cause = self.cause(if_span, ObligationCauseCode::IfExpressionWithNoElse);
293293
let mut error = false;
@@ -396,7 +396,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
396396
let node = self.tcx.hir_node(hir_id);
397397
if let hir::Node::Block(block) = node {
398398
// check that the body's parent is an fn
399-
let parent = self.tcx.hir().get_parent(self.tcx.hir().parent_id(block.hir_id));
399+
let parent = self.tcx.parent_hir_node(self.tcx.parent_hir_id(block.hir_id));
400400
if let (Some(expr), hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(..), .. })) =
401401
(&block.expr, parent)
402402
{

compiler/rustc_hir_typeck/src/callee.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
344344
let fn_decl_span = if let hir::Node::Expr(hir::Expr {
345345
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }),
346346
..
347-
}) = hir.get_parent(hir_id)
347+
}) = self.tcx.parent_hir_node(hir_id)
348348
{
349349
fn_decl_span
350350
} else if let Some((
@@ -366,11 +366,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
366366
{
367367
// Actually need to unwrap one more layer of HIR to get to
368368
// the _real_ closure...
369-
let async_closure = hir.parent_id(parent_hir_id);
370369
if let hir::Node::Expr(hir::Expr {
371370
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }),
372371
..
373-
}) = self.tcx.hir_node(async_closure)
372+
}) = self.tcx.parent_hir_node(parent_hir_id)
374373
{
375374
fn_decl_span
376375
} else {
@@ -398,8 +397,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
398397
call_expr: &'tcx hir::Expr<'tcx>,
399398
callee_expr: &'tcx hir::Expr<'tcx>,
400399
) -> bool {
401-
let hir_id = self.tcx.hir().parent_id(call_expr.hir_id);
402-
let parent_node = self.tcx.hir_node(hir_id);
400+
let parent_node = self.tcx.parent_hir_node(call_expr.hir_id);
403401
if let (
404402
hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Array(_), .. }),
405403
hir::ExprKind::Tup(exp),

compiler/rustc_hir_typeck/src/coercion.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
16051605
err.span_label(cause.span, "return type is not `()`");
16061606
}
16071607
ObligationCauseCode::BlockTailExpression(blk_id, ..) => {
1608-
let parent_id = fcx.tcx.hir().parent_id(blk_id);
1608+
let parent_id = fcx.tcx.parent_hir_id(blk_id);
16091609
err = self.report_return_mismatched_types(
16101610
cause,
16111611
expected,
@@ -1796,7 +1796,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
17961796
) -> DiagnosticBuilder<'a> {
17971797
let mut err = fcx.err_ctxt().report_mismatched_types(cause, expected, found, ty_err);
17981798

1799-
let parent_id = fcx.tcx.hir().parent_id(id);
1799+
let parent_id = fcx.tcx.parent_hir_id(id);
18001800
let parent = fcx.tcx.hir_node(parent_id);
18011801
if let Some(expr) = expression
18021802
&& let hir::Node::Expr(hir::Expr {

compiler/rustc_hir_typeck/src/demand.rs

+15-17
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
298298
let hir::Node::Pat(pat) = self.tcx.hir_node(local_hir_id) else {
299299
return false;
300300
};
301-
let (init_ty_hir_id, init) = match hir.get_parent(pat.hir_id) {
301+
let (init_ty_hir_id, init) = match self.tcx.parent_hir_node(pat.hir_id) {
302302
hir::Node::Local(hir::Local { ty: Some(ty), init, .. }) => (ty.hir_id, *init),
303303
hir::Node::Local(hir::Local { init: Some(init), .. }) => (init.hir_id, Some(*init)),
304304
_ => return false,
@@ -445,7 +445,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
445445
continue;
446446
}
447447

448-
if let hir::Node::Expr(parent_expr) = hir.get_parent(binding.hir_id)
448+
if let hir::Node::Expr(parent_expr) = self.tcx.parent_hir_node(binding.hir_id)
449449
&& let hir::ExprKind::MethodCall(segment, rcvr, args, _) = parent_expr.kind
450450
&& rcvr.hir_id == binding.hir_id
451451
{
@@ -557,7 +557,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
557557
let Some(TypeError::Sorts(ExpectedFound { expected, .. })) = error else {
558558
return;
559559
};
560-
let mut parent_id = self.tcx.hir().parent_id(expr.hir_id);
560+
let mut parent_id = self.tcx.parent_hir_id(expr.hir_id);
561561
let mut parent;
562562
'outer: loop {
563563
// Climb the HIR tree to see if the current `Expr` is part of a `break;` statement.
@@ -568,7 +568,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
568568
break;
569569
};
570570
parent = p;
571-
parent_id = self.tcx.hir().parent_id(parent_id);
571+
parent_id = self.tcx.parent_hir_id(parent_id);
572572
let hir::ExprKind::Break(destination, _) = parent.kind else {
573573
continue;
574574
};
@@ -578,19 +578,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
578578
// Climb the HIR tree to find the (desugared) `loop` this `break` corresponds to.
579579
let parent = match self.tcx.hir_node(parent_id) {
580580
hir::Node::Expr(&ref parent) => {
581-
parent_id = self.tcx.hir().parent_id(parent.hir_id);
581+
parent_id = self.tcx.parent_hir_id(parent.hir_id);
582582
parent
583583
}
584584
hir::Node::Stmt(hir::Stmt {
585585
hir_id,
586586
kind: hir::StmtKind::Semi(&ref parent) | hir::StmtKind::Expr(&ref parent),
587587
..
588588
}) => {
589-
parent_id = self.tcx.hir().parent_id(*hir_id);
589+
parent_id = self.tcx.parent_hir_id(*hir_id);
590590
parent
591591
}
592592
hir::Node::Block(_) => {
593-
parent_id = self.tcx.hir().parent_id(parent_id);
593+
parent_id = self.tcx.parent_hir_id(parent_id);
594594
parent
595595
}
596596
_ => break,
@@ -677,8 +677,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
677677
expr: &hir::Expr<'_>,
678678
error: Option<TypeError<'tcx>>,
679679
) {
680-
let parent = self.tcx.hir().parent_id(expr.hir_id);
681-
match (self.tcx.hir_node(parent), error) {
680+
match (self.tcx.parent_hir_node(expr.hir_id), error) {
682681
(hir::Node::Local(hir::Local { ty: Some(ty), init: Some(init), .. }), _)
683682
if init.hir_id == expr.hir_id =>
684683
{
@@ -724,16 +723,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
724723
if let hir::Node::Pat(pat) = self.tcx.hir_node(*hir_id) {
725724
primary_span = pat.span;
726725
secondary_span = pat.span;
727-
match self.tcx.hir().find_parent(pat.hir_id) {
728-
Some(hir::Node::Local(hir::Local { ty: Some(ty), .. })) => {
726+
match self.tcx.parent_hir_node(pat.hir_id) {
727+
hir::Node::Local(hir::Local { ty: Some(ty), .. }) => {
729728
primary_span = ty.span;
730729
post_message = " type";
731730
}
732-
Some(hir::Node::Local(hir::Local { init: Some(init), .. })) => {
731+
hir::Node::Local(hir::Local { init: Some(init), .. }) => {
733732
primary_span = init.span;
734733
post_message = " value";
735734
}
736-
Some(hir::Node::Param(hir::Param { ty_span, .. })) => {
735+
hir::Node::Param(hir::Param { ty_span, .. }) => {
737736
primary_span = *ty_span;
738737
post_message = " parameter type";
739738
}
@@ -787,12 +786,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
787786
expr: &hir::Expr<'_>,
788787
error: Option<TypeError<'tcx>>,
789788
) {
790-
let parent = self.tcx.hir().parent_id(expr.hir_id);
791789
let Some(TypeError::Sorts(ExpectedFound { expected, .. })) = error else {
792790
return;
793791
};
794792
let hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Assign(lhs, rhs, _), .. }) =
795-
self.tcx.hir_node(parent)
793+
self.tcx.parent_hir_node(expr.hir_id)
796794
else {
797795
return;
798796
};
@@ -1017,7 +1015,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10171015
)) = expr.kind
10181016
{
10191017
let bind = self.tcx.hir_node(*bind_hir_id);
1020-
let parent = self.tcx.hir_node(self.tcx.hir().parent_id(*bind_hir_id));
1018+
let parent = self.tcx.parent_hir_node(*bind_hir_id);
10211019
if let hir::Node::Pat(hir::Pat {
10221020
kind: hir::PatKind::Binding(_, _hir_id, _, _), ..
10231021
}) = bind
@@ -1088,7 +1086,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10881086
expr: &hir::Expr<'_>,
10891087
checked_ty: Ty<'tcx>,
10901088
) {
1091-
let Some(hir::Node::Expr(parent_expr)) = self.tcx.hir().find_parent(expr.hir_id) else {
1089+
let hir::Node::Expr(parent_expr) = self.tcx.parent_hir_node(expr.hir_id) else {
10921090
return;
10931091
};
10941092
enum CallableKind {

0 commit comments

Comments
 (0)