From d08bd72e977d05f7fe6d1140e10d7311f64f0f21 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 24 Jun 2019 09:46:38 +0200 Subject: [PATCH] HIR: rename get_parent_node_by_hir_id to get_parent_node --- src/librustc/hir/map/blocks.rs | 2 +- src/librustc/hir/map/mod.rs | 14 +++++++------- src/librustc/middle/resolve_lifetime.rs | 4 ++-- src/librustc/traits/error_reporting.rs | 4 ++-- src/librustc/ty/context.rs | 4 ++-- .../borrowck/gather_loans/gather_moves.rs | 2 +- src/librustc_borrowck/borrowck/mod.rs | 4 ++-- src/librustc_driver/pretty.rs | 2 +- src/librustc_lint/types.rs | 4 ++-- src/librustc_mir/hair/cx/expr.rs | 2 +- src/librustc_mir/transform/check_unsafety.rs | 2 +- src/librustc_privacy/lib.rs | 6 +++--- src/librustc_save_analysis/lib.rs | 2 +- src/librustc_typeck/astconv.rs | 4 ++-- src/librustc_typeck/check/_match.rs | 12 ++++++------ src/librustc_typeck/check/callee.rs | 2 +- src/librustc_typeck/check/coercion.rs | 4 ++-- src/librustc_typeck/check/demand.rs | 10 +++++----- src/librustc_typeck/check/method/suggest.rs | 4 ++-- src/librustc_typeck/check/mod.rs | 4 ++-- src/librustc_typeck/collect.rs | 2 +- 21 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/librustc/hir/map/blocks.rs b/src/librustc/hir/map/blocks.rs index 8c5fa97d4b7..351f5818f7e 100644 --- a/src/librustc/hir/map/blocks.rs +++ b/src/librustc/hir/map/blocks.rs @@ -87,7 +87,7 @@ impl<'a> Code<'a> { match map.get(id) { map::Node::Block(_) => { // Use the parent, hopefully an expression node. - Code::from_node(map, map.get_parent_node_by_hir_id(id)) + Code::from_node(map, map.get_parent_node(id)) } map::Node::Expr(expr) => Some(Code::Expr(expr)), node => FnLikeNode::from_node(node).map(Code::FnLike) diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index b31941f2839..bb39f85e1c3 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -347,7 +347,7 @@ impl<'hir> Map<'hir> { if variant_data.ctor_hir_id().is_none() { return None; } - let ctor_of = match self.find_by_hir_id(self.get_parent_node_by_hir_id(hir_id)) { + let ctor_of = match self.find_by_hir_id(self.get_parent_node(hir_id)) { Some(Node::Item(..)) => def::CtorOf::Struct, Some(Node::Variant(..)) => def::CtorOf::Variant, _ => unreachable!(), @@ -424,7 +424,7 @@ impl<'hir> Map<'hir> { /// which this is the body of, i.e., a `fn`, `const` or `static` /// item (possibly associated), a closure, or a `hir::AnonConst`. pub fn body_owner(&self, BodyId { hir_id }: BodyId) -> HirId { - let parent = self.get_parent_node_by_hir_id(hir_id); + let parent = self.get_parent_node(hir_id); assert!(self.lookup(parent).map_or(false, |e| e.is_body_owner(hir_id))); parent } @@ -485,7 +485,7 @@ impl<'hir> Map<'hir> { match self.get(id) { Node::Item(&Item { node: ItemKind::Trait(..), .. }) | Node::Item(&Item { node: ItemKind::TraitAlias(..), .. }) => id, - Node::GenericParam(_) => self.get_parent_node_by_hir_id(id), + Node::GenericParam(_) => self.get_parent_node(id), _ => bug!("ty_param_owner: {} not a type parameter", self.node_to_string(id)) } } @@ -625,7 +625,7 @@ impl<'hir> Map<'hir> { /// never appear as the parent node. Thus, you can always walk the parent nodes /// from a node to the root of the HIR (unless you get back the same ID here, /// which can happen if the ID is not in the map itself or is just weird). - pub fn get_parent_node_by_hir_id(&self, hir_id: HirId) -> HirId { + pub fn get_parent_node(&self, hir_id: HirId) -> HirId { if self.dep_graph.is_fully_enabled() { let hir_id_owner = hir_id.owner; let def_path_hash = self.definitions.def_path_hash(hir_id_owner); @@ -644,7 +644,7 @@ impl<'hir> Map<'hir> { Some(Node::Binding(_)) => (), _ => return false, } - match self.find_by_hir_id(self.get_parent_node_by_hir_id(id)) { + match self.find_by_hir_id(self.get_parent_node(id)) { Some(Node::Item(_)) | Some(Node::TraitItem(_)) | Some(Node::ImplItem(_)) => true, @@ -680,7 +680,7 @@ impl<'hir> Map<'hir> { { let mut id = start_id; loop { - let parent_id = self.get_parent_node_by_hir_id(id); + let parent_id = self.get_parent_node(id); if parent_id == CRATE_HIR_ID { return Ok(CRATE_HIR_ID); } @@ -1022,7 +1022,7 @@ impl<'hir> Map<'hir> { Some(Node::Arm(arm)) => arm.span, Some(Node::Block(block)) => block.span, Some(Node::Ctor(..)) => match self.find_by_hir_id( - self.get_parent_node_by_hir_id(hir_id)) + self.get_parent_node(hir_id)) { Some(Node::Item(item)) => item.span, Some(Node::Variant(variant)) => variant.span, diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index b8e7db99d07..ac2124f4a16 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -662,7 +662,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { if let Some(Region::LateBound(_, def_id, _)) = def { if let Some(hir_id) = self.tcx.hir().as_local_hir_id(def_id) { // Ensure that the parent of the def is an item, not HRTB - let parent_id = self.tcx.hir().get_parent_node_by_hir_id(hir_id); + let parent_id = self.tcx.hir().get_parent_node(hir_id); let parent_impl_id = hir::ImplItemId { hir_id: parent_id }; let parent_trait_id = hir::TraitItemId { hir_id: parent_id }; let krate = self.tcx.hir().forest.krate(); @@ -2051,7 +2051,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { // and whether there's a `self` argument (treated specially). let mut assoc_item_kind = None; let mut impl_self = None; - let parent = self.tcx.hir().get_parent_node_by_hir_id(output.hir_id); + let parent = self.tcx.hir().get_parent_node(output.hir_id); let body = match self.tcx.hir().get(parent) { // `fn` definitions and methods. Node::Item(&hir::Item { diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index b433098c1b2..f99d6846976 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -938,7 +938,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { err: &mut DiagnosticBuilder<'tcx>, ) { if let &ObligationCauseCode::VariableType(hir_id) = code { - let parent_node = self.tcx.hir().get_parent_node_by_hir_id(hir_id); + let parent_node = self.tcx.hir().get_parent_node(hir_id); if let Some(Node::Local(ref local)) = self.tcx.hir().find_by_hir_id(parent_node) { if let Some(ref expr) = local.init { if let hir::ExprKind::Index(_, _) = expr.node { @@ -1013,7 +1013,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { trait_ref: &ty::Binder>, ) { let hir = self.tcx.hir(); - let parent_node = hir.get_parent_node_by_hir_id(obligation.cause.body_id); + let parent_node = hir.get_parent_node(obligation.cause.body_id); let node = hir.find_by_hir_id(parent_node); if let Some(hir::Node::Item(hir::Item { node: hir::ItemKind::Fn(decl, _, _, body_id), diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 28399ed5439..45822fcba7b 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -2880,7 +2880,7 @@ impl<'tcx> TyCtxt<'tcx> { if lint::maybe_lint_level_root(self, id) { return id; } - let next = self.hir().get_parent_node_by_hir_id(id); + let next = self.hir().get_parent_node(id); if next == id { bug!("lint traversal reached the root of the crate"); } @@ -2898,7 +2898,7 @@ impl<'tcx> TyCtxt<'tcx> { if let Some(pair) = sets.level_and_source(lint, id, self.sess) { return pair } - let next = self.hir().get_parent_node_by_hir_id(id); + let next = self.hir().get_parent_node(id); if next == id { bug!("lint traversal reached the root of the crate"); } diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index fa286632dac..658e4307348 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -47,7 +47,7 @@ pub enum PatternSource<'tcx> { /// with a reference to the let fn get_pattern_source<'tcx>(tcx: TyCtxt<'tcx>, pat: &Pat) -> PatternSource<'tcx> { - let parent = tcx.hir().get_parent_node_by_hir_id(pat.hir_id); + let parent = tcx.hir().get_parent_node(pat.hir_id); match tcx.hir().get(parent) { Node::Expr(ref e) => { diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 87c0b8563ca..4ff669ddad9 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -1189,7 +1189,7 @@ impl BorrowckCtxt<'_, 'tcx> { } fn local_ty(&self, hir_id: hir::HirId) -> (Option<&hir::Ty>, bool) { - let parent = self.tcx.hir().get_parent_node_by_hir_id(hir_id); + let parent = self.tcx.hir().get_parent_node(hir_id); let parent_node = self.tcx.hir().get(parent); // The parent node is like a fn @@ -1287,7 +1287,7 @@ impl BorrowckCtxt<'_, 'tcx> { }, )) = ty.map(|t| &t.node) { - let borrow_expr_id = self.tcx.hir().get_parent_node_by_hir_id(borrowed_hir_id); + let borrow_expr_id = self.tcx.hir().get_parent_node(borrowed_hir_id); db.span_suggestion( self.tcx.hir().span(borrow_expr_id), "consider removing the `&mut`, as it is an \ diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 03016618249..1b78f77e4f9 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -631,7 +631,7 @@ fn print_flowgraph<'tcx, W: Write>( if let Some(n) = hir::map::blocks::FnLikeNode::from_node(node) { break n.body(); } - let parent = tcx.hir().get_parent_node_by_hir_id(hir_id); + let parent = tcx.hir().get_parent_node(hir_id); assert_ne!(hir_id, parent); hir_id = parent; } diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 2fb534e8228..d0258ca30c5 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -275,7 +275,7 @@ fn lint_int_literal<'a, 'tcx>( return; } - let par_id = cx.tcx.hir().get_parent_node_by_hir_id(e.hir_id); + let par_id = cx.tcx.hir().get_parent_node(e.hir_id); if let Node::Expr(par_e) = cx.tcx.hir().get(par_id) { if let hir::ExprKind::Struct(..) = par_e.node { if is_range_literal(cx.sess(), par_e) @@ -314,7 +314,7 @@ fn lint_uint_literal<'a, 'tcx>( _ => bug!(), }; if lit_val < min || lit_val > max { - let parent_id = cx.tcx.hir().get_parent_node_by_hir_id(e.hir_id); + let parent_id = cx.tcx.hir().get_parent_node(e.hir_id); if let Node::Expr(par_e) = cx.tcx.hir().get(parent_id) { match par_e.node { hir::ExprKind::Cast(..) => { diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 597f172da67..94b4f6e8dd1 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -909,7 +909,7 @@ fn convert_path_expr<'a, 'tcx>( Res::Def(DefKind::ConstParam, def_id) => { let hir_id = cx.tcx.hir().as_local_hir_id(def_id).unwrap(); - let item_id = cx.tcx.hir().get_parent_node_by_hir_id(hir_id); + let item_id = cx.tcx.hir().get_parent_node(hir_id); let item_def_id = cx.tcx.hir().local_def_id_from_hir_id(item_id); let generics = cx.tcx.generics_of(item_def_id); let local_def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id); diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 9c78d761cb2..545336a5906 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -570,7 +570,7 @@ fn is_enclosed( used_unsafe: &FxHashSet, id: hir::HirId, ) -> Option<(String, hir::HirId)> { - let parent_id = tcx.hir().get_parent_node_by_hir_id(id); + let parent_id = tcx.hir().get_parent_node(id); if parent_id != id { if used_unsafe.contains(&parent_id) { Some(("block".to_string(), parent_id)) diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 0fdc9ac8903..e95911bbec2 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -247,7 +247,7 @@ fn def_id_visibility<'tcx>( } } Node::Ctor(vdata) => { - let parent_hir_id = tcx.hir().get_parent_node_by_hir_id(hir_id); + let parent_hir_id = tcx.hir().get_parent_node(hir_id); match tcx.hir().get(parent_hir_id) { Node::Variant(..) => { let parent_did = tcx.hir().local_def_id_from_hir_id(parent_hir_id); @@ -784,7 +784,7 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> { if module_id == hir::CRATE_HIR_ID { break } - module_id = self.tcx.hir().get_parent_node_by_hir_id(module_id); + module_id = self.tcx.hir().get_parent_node(module_id); } } } @@ -1674,7 +1674,7 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { has_old_errors = true; break; } - let parent = self.tcx.hir().get_parent_node_by_hir_id(id); + let parent = self.tcx.hir().get_parent_node(id); if parent == id { break; } diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index edee8eeaeb3..750222451db 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -622,7 +622,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { match seg.res { Some(res) if res != Res::Err => res, _ => { - let parent_node = self.tcx.hir().get_parent_node_by_hir_id(hir_id); + let parent_node = self.tcx.hir().get_parent_node(hir_id); self.get_path_res(self.tcx.hir().hir_to_node_id(parent_node)) }, } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 33d9b1ff0c6..0375ad4a08f 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -2000,7 +2000,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { self.prohibit_generics(&path.segments); let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let item_id = tcx.hir().get_parent_node_by_hir_id(hir_id); + let item_id = tcx.hir().get_parent_node(hir_id); let item_def_id = tcx.hir().local_def_id_from_hir_id(item_id); let generics = tcx.generics_of(item_def_id); let index = generics.param_def_id_to_index[&def_id]; @@ -2190,7 +2190,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { // Find the name and index of the const parameter by indexing the generics of the // parent item and construct a `ParamConst`. let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let item_id = tcx.hir().get_parent_node_by_hir_id(hir_id); + let item_id = tcx.hir().get_parent_node(hir_id); let item_def_id = tcx.hir().local_def_id_from_hir_id(item_id); let generics = tcx.generics_of(item_def_id); let index = generics.param_def_id_to_index[&tcx.hir().local_def_id_from_hir_id(hir_id)]; diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 293b68c8711..b435c99ad01 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -546,7 +546,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) { let tcx = self.tcx; if let PatKind::Binding(..) = inner.node { - let parent_id = tcx.hir().get_parent_node_by_hir_id(pat.hir_id); + let parent_id = tcx.hir().get_parent_node(pat.hir_id); let parent = tcx.hir().get(parent_id); debug!("inner {:?} pat {:?} parent {:?}", inner, pat, parent); match parent { @@ -808,16 +808,16 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); use hir::Node::{Block, Item, Local}; let hir = self.tcx.hir(); - let arm_id = hir.get_parent_node_by_hir_id(hir_id); - let match_id = hir.get_parent_node_by_hir_id(arm_id); - let containing_id = hir.get_parent_node_by_hir_id(match_id); + let arm_id = hir.get_parent_node(hir_id); + let match_id = hir.get_parent_node(arm_id); + let containing_id = hir.get_parent_node(match_id); let node = hir.get(containing_id); if let Block(block) = node { // check that the body's parent is an fn let parent = hir.get( - hir.get_parent_node_by_hir_id( - hir.get_parent_node_by_hir_id(block.hir_id), + hir.get_parent_node( + hir.get_parent_node(block.hir_id), ), ); if let (Some(expr), Item(hir::Item { diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 87807ad91a2..e6999f9e3ac 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -244,7 +244,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { callee_node: &hir::ExprKind, callee_span: Span, ) { - let hir_id = self.tcx.hir().get_parent_node_by_hir_id(hir_id); + let hir_id = self.tcx.hir().get_parent_node(hir_id); let parent_node = self.tcx.hir().get(hir_id); if let ( hir::Node::Expr(hir::Expr { node: hir::ExprKind::Closure(_, _, _, sp, ..), .. }), diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 71a0ca090b0..4bd2f216224 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -1231,7 +1231,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> { db.span_label(cause.span, "return type is not `()`"); } ObligationCauseCode::BlockTailExpression(blk_id) => { - let parent_id = fcx.tcx.hir().get_parent_node_by_hir_id(blk_id); + let parent_id = fcx.tcx.hir().get_parent_node(blk_id); db = self.report_return_mismatched_types( cause, expected, @@ -1281,7 +1281,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> { // Verify that this is a tail expression of a function, otherwise the // label pointing out the cause for the type coercion will be wrong // as prior return coercions would not be relevant (#57664). - let parent_id = fcx.tcx.hir().get_parent_node_by_hir_id(id); + let parent_id = fcx.tcx.hir().get_parent_node(id); let fn_decl = if let Some((expr, blk_id)) = expression { pointing_at_return_type = fcx.suggest_mismatched_types_on_tail( &mut db, diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index aff8eba3130..180b1eadd68 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -236,13 +236,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) -> Option<(Span, &'static str, String)> { if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = expr.node { if let hir::def::Res::Local(id) = path.res { - let parent = self.tcx.hir().get_parent_node_by_hir_id(id); + let parent = self.tcx.hir().get_parent_node(id); if let Some(Node::Expr(hir::Expr { hir_id, node: hir::ExprKind::Closure(_, decl, ..), .. })) = self.tcx.hir().find_by_hir_id(parent) { - let parent = self.tcx.hir().get_parent_node_by_hir_id(*hir_id); + let parent = self.tcx.hir().get_parent_node(*hir_id); if let (Some(Node::Expr(hir::Expr { node: hir::ExprKind::MethodCall(path, span, expr), .. @@ -276,7 +276,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { sp: Span, ) -> bool { let cm = self.sess().source_map(); - let parent_id = self.tcx.hir().get_parent_node_by_hir_id(hir_id); + let parent_id = self.tcx.hir().get_parent_node(hir_id); if let Some(parent) = self.tcx.hir().find_by_hir_id(parent_id) { // Account for fields if let Node::Expr(hir::Expr { @@ -422,7 +422,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { node: hir::ExprKind::Assign(left_expr, _), .. })) = self.tcx.hir().find_by_hir_id( - self.tcx.hir().get_parent_node_by_hir_id(expr.hir_id), + self.tcx.hir().get_parent_node(expr.hir_id), ) { if mutability == hir::Mutability::MutMutable { // Found the following case: @@ -551,7 +551,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let Some(hir::Node::Expr(hir::Expr { node: hir::ExprKind::Struct(_, fields, _), .. - })) = self.tcx.hir().find_by_hir_id(self.tcx.hir().get_parent_node_by_hir_id(expr.hir_id)) { + })) = self.tcx.hir().find_by_hir_id(self.tcx.hir().get_parent_node(expr.hir_id)) { // `expr` is a literal field for a struct, only suggest if appropriate for field in fields { if field.expr.hir_id == expr.hir_id && field.is_shorthand { diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 8ad67c2adc0..fa1b07d2dcf 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -269,7 +269,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let filename = tcx.sess.source_map().span_to_filename(span); let parent_node = self.tcx.hir().get( - self.tcx.hir().get_parent_node_by_hir_id(hir_id), + self.tcx.hir().get_parent_node(hir_id), ); let msg = format!( "you must specify a type for this binding, like `{}`", @@ -390,7 +390,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); } else { let call_expr = self.tcx.hir().expect_expr( - self.tcx.hir().get_parent_node_by_hir_id(expr.hir_id), + self.tcx.hir().get_parent_node(expr.hir_id), ); if let Some(span) = call_expr.span.trim_start(item_name.span) { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 0ec5c9763a0..2da761f6d37 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -4259,7 +4259,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // If our calling expression is indeed the function itself, we're good! // If not, generate an error that this can only be called directly. if let Node::Expr(expr) = self.tcx.hir().get( - self.tcx.hir().get_parent_node_by_hir_id(hir_id)) + self.tcx.hir().get_parent_node(hir_id)) { if let ExprKind::Call(ref callee, ..) = expr.node { if callee.hir_id == hir_id { @@ -4334,7 +4334,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let mut contained_in_place = false; while let hir::Node::Expr(parent_expr) = - self.tcx.hir().get(self.tcx.hir().get_parent_node_by_hir_id(expr_id)) + self.tcx.hir().get(self.tcx.hir().get_parent_node(expr_id)) { match &parent_expr.node { hir::ExprKind::Assign(lhs, ..) | hir::ExprKind::AssignOp(_, lhs, ..) => { diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 301168aefd2..87e1166b7c0 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1298,7 +1298,7 @@ pub fn checked_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, fail: bool) -> Op } Node::AnonConst(_) => { - let parent_node = tcx.hir().get(tcx.hir().get_parent_node_by_hir_id(hir_id)); + let parent_node = tcx.hir().get(tcx.hir().get_parent_node(hir_id)); match parent_node { Node::Ty(&hir::Ty { node: hir::TyKind::Array(_, ref constant),