diff --git a/src/librustc/hir/map/blocks.rs b/src/librustc/hir/map/blocks.rs index dd11bd15db845..8c5fa97d4b72d 100644 --- a/src/librustc/hir/map/blocks.rs +++ b/src/librustc/hir/map/blocks.rs @@ -84,7 +84,7 @@ impl<'a> Code<'a> { /// Attempts to construct a Code from presumed FnLike or Expr node input. pub fn from_node(map: &map::Map<'a>, id: ast::HirId) -> Option> { - match map.get_by_hir_id(id) { + 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)) diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 0cd4c98ec6c84..0b8b69be0a480 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -458,7 +458,7 @@ impl<'hir> Map<'hir> { } pub fn body_owner_kind(&self, id: HirId) -> BodyOwnerKind { - match self.get_by_hir_id(id) { + match self.get(id) { Node::Item(&Item { node: ItemKind::Const(..), .. }) | Node::TraitItem(&TraitItem { node: TraitItemKind::Const(..), .. }) | Node::ImplItem(&ImplItem { node: ImplItemKind::Const(..), .. }) | @@ -482,7 +482,7 @@ impl<'hir> Map<'hir> { } pub fn ty_param_owner(&self, id: HirId) -> HirId { - match self.get_by_hir_id(id) { + 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), @@ -491,7 +491,7 @@ impl<'hir> Map<'hir> { } pub fn ty_param_name(&self, id: HirId) -> Name { - match self.get_by_hir_id(id) { + match self.get(id) { Node::Item(&Item { node: ItemKind::Trait(..), .. }) | Node::Item(&Item { node: ItemKind::TraitAlias(..), .. }) => kw::SelfUpper, Node::GenericParam(param) => param.name.ident().name, @@ -561,14 +561,14 @@ impl<'hir> Map<'hir> { } /// Retrieves the `Node` corresponding to `id`, panicking if it cannot be found. - pub fn get_by_hir_id(&self, id: HirId) -> Node<'hir> { + pub fn get(&self, id: HirId) -> Node<'hir> { // read recorded by `find` self.find_by_hir_id(id).unwrap_or_else(|| bug!("couldn't find hir id {} in the HIR map", id)) } pub fn get_if_local(&self, id: DefId) -> Option> { - self.as_local_hir_id(id).map(|id| self.get_by_hir_id(id)) // read recorded by `get` + self.as_local_hir_id(id).map(|id| self.get(id)) // read recorded by `get` } pub fn get_generics(&self, id: DefId) -> Option<&'hir Generics> { @@ -840,7 +840,7 @@ impl<'hir> Map<'hir> { if scope == CRATE_HIR_ID { return Some(CRATE_HIR_ID); } - match self.get_by_hir_id(scope) { + match self.get(scope) { Node::Item(i) => { match i.node { ItemKind::Existential(ExistTy { impl_trait_fn: None, .. }) => {} @@ -929,7 +929,7 @@ impl<'hir> Map<'hir> { } pub fn name(&self, id: HirId) -> Name { - match self.get_by_hir_id(id) { + match self.get(id) { Node::Item(i) => i.ident.name, Node::ForeignItem(fi) => fi.ident.name, Node::ImplItem(ii) => ii.ident.name, @@ -1061,7 +1061,7 @@ impl<'hir> Map<'hir> { } pub fn hir_to_pretty_string(&self, id: HirId) -> String { - print::to_string(self, |s| s.print_node(self.get_by_hir_id(id))) + print::to_string(self, |s| s.print_node(self.get(id))) } } diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 18a2bc45385db..d1e32b1dbad36 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -1335,7 +1335,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { // We do this to avoid suggesting code that ends up as `T: 'a'b`, // instead we suggest `T: 'a + 'b` in that case. let mut has_bounds = false; - if let Node::GenericParam(ref param) = hir.get_by_hir_id(id) { + if let Node::GenericParam(ref param) = hir.get(id) { has_bounds = !param.bounds.is_empty(); } let sp = hir.span(id); diff --git a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs index 78d1d56993e06..283af94b89b48 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs @@ -29,7 +29,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { if let Some(anon_reg) = self.tcx().is_suitable_region(region) { let def_id = anon_reg.def_id; if let Some(hir_id) = self.tcx().hir().as_local_hir_id(def_id) { - let fndecl = match self.tcx().hir().get_by_hir_id(hir_id) { + let fndecl = match self.tcx().hir().get(hir_id) { Node::Item(&hir::Item { node: hir::ItemKind::Fn(ref fndecl, ..), .. diff --git a/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs b/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs index 6ed2b67556ddc..f5a4dac2c2cb8 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs @@ -52,7 +52,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { if let Node::Expr(Expr { node: Closure(_, _, _, closure_span, None), .. - }) = hir.get_by_hir_id(hir_id) { + }) = hir.get(hir_id) { let sup_sp = sup_origin.span(); let origin_sp = origin.span(); let mut err = self.tcx().sess.struct_span_err( diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index 60554a30060bb..a687b0e459100 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -945,8 +945,8 @@ pub fn may_define_existential_type( let mut hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); trace!( "may_define_existential_type(def={:?}, opaque_node={:?})", - tcx.hir().get_by_hir_id(hir_id), - tcx.hir().get_by_hir_id(opaque_hir_id) + tcx.hir().get(hir_id), + tcx.hir().get(opaque_hir_id) ); // Named existential types can be defined by any siblings or children of siblings. diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index bf054d68b704a..0d59e32b09818 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -1630,7 +1630,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { ); if self.ir.variable_is_shorthand(var) { - if let Node::Binding(pat) = self.ir.tcx.hir().get_by_hir_id(hir_id) { + if let Node::Binding(pat) = self.ir.tcx.hir().get(hir_id) { // Handle `ref` and `ref mut`. let spans = spans.iter() .map(|_span| (pat.span, format!("{}: _", name))) diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index c0f56a33eec8f..10796abe5d4c4 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -344,7 +344,7 @@ impl MutabilityCategory { tables: &ty::TypeckTables<'_>, id: hir::HirId, ) -> MutabilityCategory { - let ret = match tcx.hir().get_by_hir_id(id) { + let ret = match tcx.hir().get(id) { Node::Binding(p) => match p.node { PatKind::Binding(..) => { let bm = *tables.pat_binding_modes() diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 93cb6ab96f883..d9ccb9d42f236 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -190,7 +190,7 @@ impl Scope { } let span = tcx.hir().span(hir_id); if let ScopeData::Remainder(first_statement_index) = self.data { - if let Node::Block(ref blk) = tcx.hir().get_by_hir_id(hir_id) { + if let Node::Block(ref blk) = tcx.hir().get(hir_id) { // Want span for scope starting after the // indexed statement and ending at end of // `blk`; reuse span of `blk` and shift `lo` @@ -1368,7 +1368,7 @@ fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ScopeTree // If the item is an associated const or a method, // record its impl/trait parent, as it can also have // lifetime parameters free in this body. - match tcx.hir().get_by_hir_id(id) { + match tcx.hir().get(id) { Node::ImplItem(_) | Node::TraitItem(_) => { visitor.scope_tree.root_parent = Some(tcx.hir().get_parent_item(id)); diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index f68e18c2bb85b..b8e7db99d071c 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -1488,7 +1488,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } } }; - if let Node::Lifetime(hir_lifetime) = self.tcx.hir().get_by_hir_id(lifetime.hir_id) { + if let Node::Lifetime(hir_lifetime) = self.tcx.hir().get(lifetime.hir_id) { if let Some(parent) = self.tcx.hir().find_by_hir_id( self.tcx.hir().get_parent_item(hir_lifetime.hir_id)) { @@ -1569,7 +1569,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { Some(LifetimeUseSet::One(lifetime)) => { let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap(); debug!("hir id first={:?}", hir_id); - if let Some((id, span, name)) = match self.tcx.hir().get_by_hir_id(hir_id) { + if let Some((id, span, name)) = match self.tcx.hir().get(hir_id) { Node::Lifetime(hir_lifetime) => Some(( hir_lifetime.hir_id, hir_lifetime.span, @@ -1620,7 +1620,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } None => { let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap(); - if let Some((id, span, name)) = match self.tcx.hir().get_by_hir_id(hir_id) { + if let Some((id, span, name)) = match self.tcx.hir().get(hir_id) { Node::Lifetime(hir_lifetime) => Some(( hir_lifetime.hir_id, hir_lifetime.span, @@ -1823,7 +1823,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { // Do not free early-bound regions, only late-bound ones. } else if let Some(body_id) = outermost_body { let fn_id = self.tcx.hir().body_owner(body_id); - match self.tcx.hir().get_by_hir_id(fn_id) { + match self.tcx.hir().get(fn_id) { Node::Item(&hir::Item { node: hir::ItemKind::Fn(..), .. @@ -2052,7 +2052,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { 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 body = match self.tcx.hir().get_by_hir_id(parent) { + let body = match self.tcx.hir().get(parent) { // `fn` definitions and methods. Node::Item(&hir::Item { node: hir::ItemKind::Fn(.., body), diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 5a1e5212f8657..38df4060652b7 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -580,7 +580,7 @@ impl<'tcx> TyCtxt<'tcx> { let mut diag = self.struct_span_lint_hir(lint, id, span, &msg); if let Some(suggestion) = suggestion { - if let hir::Node::Expr(_) = self.hir().get_by_hir_id(id) { + if let hir::Node::Expr(_) = self.hir().get(id) { diag.span_suggestion( span, "replace the use of the deprecated item", diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index 65b83224ae521..80d97b7bc774f 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -73,7 +73,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { let hir_id = tcx.hir().as_local_hir_id(def_id) .expect("Non-local call to local provider is_const_fn"); - let node = tcx.hir().get_by_hir_id(hir_id); + let node = tcx.hir().get(hir_id); if let Some(fn_like) = FnLikeNode::from_node(node) { fn_like.constness() == hir::Constness::Const } else if let hir::Node::Ctor(_) = node { diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index b84ebd8afe885..f0452befed8e2 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1610,7 +1610,7 @@ impl<'tcx> TyCtxt<'tcx> { ) -> Option> { // HACK: `type_of_def_id()` will fail on these (#55796), so return None let hir_id = self.hir().as_local_hir_id(scope_def_id).unwrap(); - match self.hir().get_by_hir_id(hir_id) { + match self.hir().get(hir_id) { Node::Item(item) => { match item.node { ItemKind::Fn(..) => { /* type_of_def_id() will work */ } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index e8b75be27e585..a3cb9d17cd20d 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -2791,7 +2791,7 @@ impl<'tcx> TyCtxt<'tcx> { pub fn opt_associated_item(self, def_id: DefId) -> Option { let is_associated_item = if let Some(hir_id) = self.hir().as_local_hir_id(def_id) { - match self.hir().get_by_hir_id(hir_id) { + match self.hir().get(hir_id) { Node::TraitItem(_) | Node::ImplItem(_) => true, _ => false, } @@ -3213,7 +3213,7 @@ fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option { /// Yields the parent function's `DefId` if `def_id` is an `impl Trait` definition. pub fn is_impl_trait_defn(tcx: TyCtxt<'_>, def_id: DefId) -> Option { if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) { - if let Node::Item(item) = tcx.hir().get_by_hir_id(hir_id) { + if let Node::Item(item) = tcx.hir().get(hir_id) { if let hir::ItemKind::Existential(ref exist_ty) = item.node { return exist_ty.impl_trait_fn; } diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index ace44421d3757..714b7c27200e3 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -191,7 +191,7 @@ pub fn check_loans<'a, 'tcx>( let def_id = bccx.tcx.hir().body_owner_def_id(body.id()); let hir_id = bccx.tcx.hir().as_local_hir_id(def_id).unwrap(); - let movable_generator = !match bccx.tcx.hir().get_by_hir_id(hir_id) { + let movable_generator = !match bccx.tcx.hir().get(hir_id) { Node::Expr(&hir::Expr { node: hir::ExprKind::Closure(.., Some(hir::GeneratorMovability::Static)), .. diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index 05c0a22900a0b..fa286632dac84 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -49,7 +49,7 @@ 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); - match tcx.hir().get_by_hir_id(parent) { + match tcx.hir().get(parent) { Node::Expr(ref e) => { // the enclosing expression must be a `match` or something else assert!(match e.node { diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index b22a8412ac828..87c0b8563cadb 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -80,7 +80,7 @@ fn borrowck<'tcx>(tcx: TyCtxt<'tcx>, owner_def_id: DefId) -> &'tcx BorrowCheckRe let owner_id = tcx.hir().as_local_hir_id(owner_def_id).unwrap(); - match tcx.hir().get_by_hir_id(owner_id) { + match tcx.hir().get(owner_id) { Node::Ctor(..) => { // We get invoked with anything that has MIR, but some of // those things (notably the synthesized constructors from @@ -390,7 +390,7 @@ pub enum LoanPathElem<'tcx> { fn closure_to_block(closure_id: LocalDefId, tcx: TyCtxt<'_>) -> HirId { let closure_id = tcx.hir().local_def_id_to_hir_id(closure_id); - match tcx.hir().get_by_hir_id(closure_id) { + match tcx.hir().get(closure_id) { Node::Expr(expr) => match expr.node { hir::ExprKind::Closure(.., body_id, _, _) => { body_id.hir_id @@ -896,7 +896,7 @@ impl BorrowckCtxt<'_, 'tcx> { // to implement two traits for "one operator" is not very intuitive for // many programmers. if err.cmt.note == mc::NoteIndex { - let node = self.tcx.hir().get_by_hir_id(err.cmt.hir_id); + let node = self.tcx.hir().get(err.cmt.hir_id); // This pattern probably always matches. if let Node::Expr( @@ -1172,7 +1172,7 @@ impl BorrowckCtxt<'_, 'tcx> { } fn local_binding_mode(&self, hir_id: hir::HirId) -> ty::BindingMode { - let pat = match self.tcx.hir().get_by_hir_id(hir_id) { + let pat = match self.tcx.hir().get(hir_id) { Node::Binding(pat) => pat, node => bug!("bad node for local: {:?}", node) }; @@ -1190,7 +1190,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_node = self.tcx.hir().get_by_hir_id(parent); + let parent_node = self.tcx.hir().get(parent); // The parent node is like a fn if let Some(fn_like) = FnLikeNode::from_node(parent_node) { @@ -1255,7 +1255,7 @@ impl BorrowckCtxt<'_, 'tcx> { None => return }; - if let Node::Field(ref field) = self.tcx.hir().get_by_hir_id(hir_id) { + if let Node::Field(ref field) = self.tcx.hir().get(hir_id) { if let Some(msg) = self.suggest_mut_for_immutable(&field.ty, false) { db.span_label(field.ty.span, msg); } diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index 4bf91bbed60ea..ef8ca6f7a06cf 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -208,7 +208,7 @@ impl CodegenCx<'ll, 'tcx> { let g = if let Some(id) = self.tcx.hir().as_local_hir_id(def_id) { let llty = self.layout_of(ty).llvm_type(self); - let (g, attrs) = match self.tcx.hir().get_by_hir_id(id) { + let (g, attrs) = match self.tcx.hir().get(id) { Node::Item(&hir::Item { ref attrs, span, node: hir::ItemKind::Static(..), .. }) => { diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index aeff73c7e5216..b9ee82f108ae3 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -82,7 +82,7 @@ fn reachable_non_generics_provider<'tcx>( // // As a result, if this id is an FFI item (foreign item) then we only // let it through if it's included statically. - match tcx.hir().get_by_hir_id(hir_id) { + match tcx.hir().get(hir_id) { Node::ForeignItem(..) => { let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); if tcx.is_statically_included_foreign_item(def_id) { diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index ba74f79eba302..7ccd024769f75 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -135,7 +135,7 @@ fn symbol_name(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> InternedString { // FIXME(eddyb) Precompute a custom symbol name based on attributes. let is_foreign = if let Some(id) = hir_id { - match tcx.hir().get_by_hir_id(id) { + match tcx.hir().get(id) { Node::ForeignItem(_) => true, _ => false, } diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 7b2c70a3cad4a..030166182490b 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -627,7 +627,7 @@ fn print_flowgraph<'tcx, W: Write>( // Find the function this expression is from. let mut hir_id = expr.hir_id; loop { - let node = tcx.hir().get_by_hir_id(hir_id); + let node = tcx.hir().get(hir_id); if let Some(n) = hir::map::blocks::FnLikeNode::from_node(node) { break n.body(); } @@ -831,7 +831,7 @@ pub fn print_after_hir_lowering<'tcx>( annotation.pp_ann()); for node_id in uii.all_matching_node_ids(hir_map) { let hir_id = tcx.hir().node_to_hir_id(node_id); - let node = hir_map.get_by_hir_id(hir_id); + let node = hir_map.get(hir_id); pp_state.print_node(node)?; pp_state.s.space()?; let path = annotation.node_path(node_id) @@ -849,7 +849,7 @@ pub fn print_after_hir_lowering<'tcx>( debug!("pretty printing source code {:?}", s); for node_id in uii.all_matching_node_ids(tcx.hir()) { let hir_id = tcx.hir().node_to_hir_id(node_id); - let node = tcx.hir().get_by_hir_id(hir_id); + let node = tcx.hir().get(hir_id); write!(out, "{:#?}", node)?; } Ok(()) diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index e2e4a4ebcb056..5296ed0ffd0b8 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -322,7 +322,7 @@ impl DirtyCleanVisitor<'tcx> { /// Return all DepNode labels that should be asserted for this item. /// index=0 is the "name" used for error messages fn auto_labels(&mut self, item_id: hir::HirId, attr: &Attribute) -> (&'static str, Labels) { - let node = self.tcx.hir().get_by_hir_id(item_id); + let node = self.tcx.hir().get(item_id); let (name, labels) = match node { HirNode::Item(item) => { match item.node { diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 5f052f65333bb..cd4eecf26387f 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -276,7 +276,7 @@ fn lint_int_literal<'a, 'tcx>( } let par_id = cx.tcx.hir().get_parent_node_by_hir_id(e.hir_id); - if let Node::Expr(par_e) = cx.tcx.hir().get_by_hir_id(par_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) && lint_overflowing_range_endpoint(cx, lit, v, max, e, par_e, t) @@ -315,7 +315,7 @@ fn lint_uint_literal<'a, 'tcx>( }; if lit_val < min || lit_val > max { let parent_id = cx.tcx.hir().get_parent_node_by_hir_id(e.hir_id); - if let Node::Expr(par_e) = cx.tcx.hir().get_by_hir_id(parent_id) { + if let Node::Expr(par_e) = cx.tcx.hir().get(parent_id) { match par_e.node { hir::ExprKind::Cast(..) => { if let ty::Char = cx.tables.expr_ty(par_e).sty { diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index a78bf0356d12a..919ed5ccaba1e 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -230,7 +230,7 @@ fn do_mir_borrowck<'a, 'tcx>( |bd, i| DebugFormatted::new(&bd.move_data().inits[i]), )); - let movable_generator = match tcx.hir().get_by_hir_id(id) { + let movable_generator = match tcx.hir().get(id) { Node::Expr(&hir::Expr { node: hir::ExprKind::Closure(.., Some(hir::GeneratorMovability::Static)), .. diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs index 3dc0a99c78b89..3f5b2f4bce78b 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs @@ -698,7 +698,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { let mir_hir_id = tcx.hir().as_local_hir_id(mir_def_id).expect("non-local mir"); - let (return_span, mir_description) = match tcx.hir().get_by_hir_id(mir_hir_id) { + let (return_span, mir_description) = match tcx.hir().get(mir_hir_id) { hir::Node::Expr(hir::Expr { node: hir::ExprKind::Closure(_, return_ty, _, span, gen_move), .. @@ -761,7 +761,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { let mir_hir_id = tcx.hir().as_local_hir_id(mir_def_id).expect("non-local mir"); - let yield_span = match tcx.hir().get_by_hir_id(mir_hir_id) { + let yield_span = match tcx.hir().get(mir_hir_id) { hir::Node::Expr(hir::Expr { node: hir::ExprKind::Closure(_, _, _, span, _), .. diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index f7958434afa64..66064221b391c 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -26,7 +26,7 @@ pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Body<'tcx> { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); // Figure out what primary body this item has. - let (body_id, return_ty_span) = match tcx.hir().get_by_hir_id(id) { + let (body_id, return_ty_span) = match tcx.hir().get(id) { Node::Expr(hir::Expr { node: hir::ExprKind::Closure(_, decl, body_id, _, _), .. }) | Node::Item(hir::Item { node: hir::ItemKind::Fn(decl, _, _, body_id), .. }) | Node::ImplItem( diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index 4e197f1ed4ecf..a21d900cf5e5e 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -155,7 +155,7 @@ impl<'a, 'tcx> Cx<'a, 'tcx> { pub fn pattern_from_hir(&mut self, p: &hir::Pat) -> Pattern<'tcx> { let tcx = self.tcx.global_tcx(); - let p = match tcx.hir().get_by_hir_id(p.hir_id) { + let p = match tcx.hir().get(p.hir_id) { Node::Pat(p) | Node::Binding(p) => p, node => bug!("pattern became {:?}", node) }; diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index d747eddd8d7ba..e42c667fec9ef 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -193,7 +193,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M // Sometimes the index is beyond the number of upvars (seen // for a generator). if let Some((&var_hir_id, _)) = upvars.get_index(field) { - let node = self.ecx.tcx.hir().get_by_hir_id(var_hir_id); + let node = self.ecx.tcx.hir().get(var_hir_id); if let hir::Node::Binding(pat) = node { if let hir::PatKind::Binding(_, _, ident, _) = pat.node { name = Some(ident.name); diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index a7120888742d0..8c815a51b5d65 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -10,7 +10,7 @@ use rustc::ty::subst::InternalSubsts; pub fn check(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - if let Some(fn_like_node) = FnLikeNode::from_node(tcx.hir().get_by_hir_id(hir_id)) { + if let Some(fn_like_node) = FnLikeNode::from_node(tcx.hir().get(hir_id)) { check_fn_for_unconditional_recursion(tcx, fn_like_node.kind(), body, def_id); } } diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 5b567512a7b6f..9092cf2c45796 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -41,7 +41,7 @@ impl MirPass for ConstProp { let hir_id = tcx.hir().as_local_hir_id(source.def_id()) .expect("Non-local call to local provider is_const_fn"); - let is_fn_like = FnLikeNode::from_node(tcx.hir().get_by_hir_id(hir_id)).is_some(); + let is_fn_like = FnLikeNode::from_node(tcx.hir().get(hir_id)).is_some(); let is_assoc_const = match tcx.def_kind(source.def_id()) { Some(DefKind::AssocConst) => true, _ => false, diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index ba834bf09aa84..0fdc9ac890350 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -229,14 +229,14 @@ fn def_id_visibility<'tcx>( ) -> (ty::Visibility, Span, &'static str) { match tcx.hir().as_local_hir_id(def_id) { Some(hir_id) => { - let vis = match tcx.hir().get_by_hir_id(hir_id) { + let vis = match tcx.hir().get(hir_id) { Node::Item(item) => &item.vis, Node::ForeignItem(foreign_item) => &foreign_item.vis, Node::TraitItem(..) | Node::Variant(..) => { return def_id_visibility(tcx, tcx.hir().get_parent_did(hir_id)); } Node::ImplItem(impl_item) => { - match tcx.hir().get_by_hir_id(tcx.hir().get_parent_item(hir_id)) { + match tcx.hir().get(tcx.hir().get_parent_item(hir_id)) { Node::Item(item) => match &item.node { hir::ItemKind::Impl(.., None, _, _) => &impl_item.vis, hir::ItemKind::Impl(.., Some(trait_ref), _, _) @@ -248,7 +248,7 @@ fn def_id_visibility<'tcx>( } Node::Ctor(vdata) => { let parent_hir_id = tcx.hir().get_parent_node_by_hir_id(hir_id); - match tcx.hir().get_by_hir_id(parent_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); let (mut ctor_vis, mut span, mut descr) = def_id_visibility( @@ -274,7 +274,7 @@ fn def_id_visibility<'tcx>( return (ctor_vis, span, descr); } Node::Item(..) => { - let item = match tcx.hir().get_by_hir_id(parent_hir_id) { + let item = match tcx.hir().get(parent_hir_id) { Node::Item(item) => item, node => bug!("unexpected node kind: {:?}", node), }; diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 231fbac1f95d5..27e312f65ce24 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -607,7 +607,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { } pub fn get_path_res(&self, hir_id: hir::HirId) -> Res { - match self.tcx.hir().get_by_hir_id(hir_id) { + match self.tcx.hir().get(hir_id) { Node::TraitRef(tr) => tr.path.res, Node::Item(&hir::Item { diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index d1bad6b4d1ee2..0173685583148 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -185,7 +185,7 @@ crate fn environment<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Environment<'tcx .map(Clause::ForAll); let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let node = tcx.hir().get_by_hir_id(hir_id); + let node = tcx.hir().get(hir_id); enum NodeKind { TraitImpl, diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 65a36d9230641..293b68c871131 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -547,7 +547,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 = tcx.hir().get_by_hir_id(parent_id); + let parent = tcx.hir().get(parent_id); debug!("inner {:?} pat {:?} parent {:?}", inner, pat, parent); match parent { hir::Node::Item(hir::Item { node: hir::ItemKind::Fn(..), .. }) | @@ -812,10 +812,10 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); 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 node = hir.get_by_hir_id(containing_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_by_hir_id( + let parent = hir.get( hir.get_parent_node_by_hir_id( hir.get_parent_node_by_hir_id(block.hir_id), ), diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 42c7ff607c55a..87807ad91a27d 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -245,7 +245,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { callee_span: Span, ) { let hir_id = self.tcx.hir().get_parent_node_by_hir_id(hir_id); - let parent_node = self.tcx.hir().get_by_hir_id(hir_id); + let parent_node = self.tcx.hir().get(hir_id); if let ( hir::Node::Expr(hir::Expr { node: hir::ExprKind::Closure(_, _, _, sp, ..), .. }), hir::ExprKind::Block(..), diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index a56196ccf82f5..71a0ca090b0d8 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -1291,7 +1291,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> { cause.span, blk_id, ); - let parent = fcx.tcx.hir().get_by_hir_id(parent_id); + let parent = fcx.tcx.hir().get(parent_id); fcx.get_node_fn_decl(parent).map(|(fn_decl, _, is_main)| (fn_decl, is_main)) } else { fcx.get_fn_decl(parent_id) diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 10efae59867bd..8ad67c2adc035 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -268,7 +268,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let snippet = tcx.sess.source_map().span_to_snippet(span); let filename = tcx.sess.source_map().span_to_filename(span); - let parent_node = self.tcx.hir().get_by_hir_id( + let parent_node = self.tcx.hir().get( self.tcx.hir().get_parent_node_by_hir_id(hir_id), ); let msg = format!( diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 0fee2f063b8f4..bddbebb4e1566 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -759,7 +759,7 @@ fn primary_body_of<'tcx>( tcx: TyCtxt<'tcx>, id: hir::HirId, ) -> Option<(hir::BodyId, Option<&'tcx hir::FnDecl>)> { - match tcx.hir().get_by_hir_id(id) { + match tcx.hir().get(id) { Node::Item(item) => { match item.node { hir::ItemKind::Const(_, body) | @@ -1213,7 +1213,7 @@ fn check_fn<'a, 'tcx>( ); } - if let Node::Item(item) = fcx.tcx.hir().get_by_hir_id(fn_id) { + if let Node::Item(item) = fcx.tcx.hir().get(fn_id) { if let ItemKind::Fn(_, _, ref generics, _) = item.node { if !generics.params.is_empty() { fcx.tcx.sess.span_err( @@ -1261,7 +1261,7 @@ fn check_fn<'a, 'tcx>( ); } - if let Node::Item(item) = fcx.tcx.hir().get_by_hir_id(fn_id) { + if let Node::Item(item) = fcx.tcx.hir().get(fn_id) { if let ItemKind::Fn(_, _, ref generics, _) = item.node { if !generics.params.is_empty() { fcx.tcx.sess.span_err( @@ -3676,7 +3676,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } fn parent_item_span(&self, id: hir::HirId) -> Option { - let node = self.tcx.hir().get_by_hir_id(self.tcx.hir().get_parent_item(id)); + let node = self.tcx.hir().get(self.tcx.hir().get_parent_item(id)); match node { Node::Item(&hir::Item { node: hir::ItemKind::Fn(_, _, _, body_id), .. @@ -3696,7 +3696,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// Given a function block's `HirId`, returns its `FnDecl` if it exists, or `None` otherwise. fn get_parent_fn_decl(&self, blk_id: hir::HirId) -> Option<(&'tcx hir::FnDecl, ast::Ident)> { - let parent = self.tcx.hir().get_by_hir_id(self.tcx.hir().get_parent_item(blk_id)); + let parent = self.tcx.hir().get(self.tcx.hir().get_parent_item(blk_id)); self.get_node_fn_decl(parent).map(|(fn_decl, ident, _)| (fn_decl, ident)) } @@ -3731,7 +3731,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Get enclosing Fn, if it is a function or a trait method, unless there's a `loop` or // `while` before reaching it, as block tail returns are not available in them. self.tcx.hir().get_return_block(blk_id).and_then(|blk_id| { - let parent = self.tcx.hir().get_by_hir_id(blk_id); + let parent = self.tcx.hir().get(blk_id); self.get_node_fn_decl(parent).map(|(fn_decl, _, is_main)| (fn_decl, is_main)) }) } @@ -4258,7 +4258,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_by_hir_id( + if let Node::Expr(expr) = self.tcx.hir().get( self.tcx.hir().get_parent_node_by_hir_id(hir_id)) { if let ExprKind::Call(ref callee, ..) = expr.node { @@ -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_by_hir_id(self.tcx.hir().get_parent_node_by_hir_id(expr_id)) + self.tcx.hir().get(self.tcx.hir().get_parent_node_by_hir_id(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 52cda4ac3c628..301168aefd203 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -284,7 +284,7 @@ fn type_param_predicates<'tcx>( let mut extend = None; let item_hir_id = tcx.hir().as_local_hir_id(item_def_id).unwrap(); - let ast_generics = match tcx.hir().get_by_hir_id(item_hir_id) { + let ast_generics = match tcx.hir().get(item_hir_id) { Node::TraitItem(item) => &item.generics, Node::ImplItem(item) => &item.generics, @@ -623,7 +623,7 @@ fn adt_def<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { use rustc::hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let item = match tcx.hir().get_by_hir_id(hir_id) { + let item = match tcx.hir().get(hir_id) { Node::Item(item) => item, _ => bug!(), }; @@ -693,7 +693,7 @@ fn super_predicates_of<'tcx>( debug!("super_predicates(trait_def_id={:?})", trait_def_id); let trait_hir_id = tcx.hir().as_local_hir_id(trait_def_id).unwrap(); - let item = match tcx.hir().get_by_hir_id(trait_hir_id) { + let item = match tcx.hir().get(trait_hir_id) { Node::Item(item) => item, _ => bug!("trait_node_id {} is not an item", trait_hir_id), }; @@ -884,7 +884,7 @@ fn generics_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::Generics { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let node = tcx.hir().get_by_hir_id(hir_id); + let node = tcx.hir().get(hir_id); let parent_def_id = match node { Node::ImplItem(_) | Node::TraitItem(_) | Node::Variant(_) | Node::Ctor(..) | Node::Field(_) => { @@ -1154,7 +1154,7 @@ pub fn checked_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, fail: bool) -> Op let icx = ItemCtxt::new(tcx, def_id); - Some(match tcx.hir().get_by_hir_id(hir_id) { + Some(match tcx.hir().get(hir_id) { Node::TraitItem(item) => match item.node { TraitItemKind::Method(..) => { let substs = InternalSubsts::identity_for_item(tcx, def_id); @@ -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_by_hir_id(tcx.hir().get_parent_node_by_hir_id(hir_id)); + let parent_node = tcx.hir().get(tcx.hir().get_parent_node_by_hir_id(hir_id)); match parent_node { Node::Ty(&hir::Ty { node: hir::TyKind::Array(_, ref constant), @@ -1660,8 +1660,8 @@ fn find_existential_constraints<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Ty<'t if scope == hir::CRATE_HIR_ID { intravisit::walk_crate(&mut locator, tcx.hir().krate()); } else { - debug!("find_existential_constraints: scope={:?}", tcx.hir().get_by_hir_id(scope)); - match tcx.hir().get_by_hir_id(scope) { + debug!("find_existential_constraints: scope={:?}", tcx.hir().get(scope)); + match tcx.hir().get(scope) { Node::Item(ref it) => intravisit::walk_item(&mut locator, it), Node::ImplItem(ref it) => intravisit::walk_impl_item(&mut locator, it), Node::TraitItem(ref it) => intravisit::walk_trait_item(&mut locator, it), @@ -1690,7 +1690,7 @@ fn fn_sig<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> { let icx = ItemCtxt::new(tcx, def_id); - match tcx.hir().get_by_hir_id(hir_id) { + match tcx.hir().get(hir_id) { TraitItem(hir::TraitItem { node: TraitItemKind::Method(sig, _), .. @@ -1903,7 +1903,7 @@ fn explicit_predicates_of<'tcx>( Some(hir_id) => hir_id, None => return tcx.predicates_of(def_id), }; - let node = tcx.hir().get_by_hir_id(hir_id); + let node = tcx.hir().get(hir_id); let mut is_trait = None; let mut is_default_impl_trait = None; diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index 1c2bb8c2f0b28..f2661b46b8b0c 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -61,7 +61,7 @@ impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> { .hir() .as_local_hir_id(item_did) .expect("expected local def-id"); - let item = match self.tcx.hir().get_by_hir_id(hir_id) { + let item = match self.tcx.hir().get(hir_id) { Node::Item(item) => item, _ => bug!(), }; diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index ad538b0effedf..63e41e01fbff5 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -29,7 +29,7 @@ fn inferred_outlives_of<'tcx>( .as_local_hir_id(item_def_id) .expect("expected local def-id"); - match tcx.hir().get_by_hir_id(id) { + match tcx.hir().get(id) { Node::Item(item) => match item.node { hir::ItemKind::Struct(..) | hir::ItemKind::Enum(..) | hir::ItemKind::Union(..) => { let crate_map = tcx.inferred_outlives_crate(LOCAL_CRATE); diff --git a/src/librustc_typeck/variance/mod.rs b/src/librustc_typeck/variance/mod.rs index 5dbd667485e98..1a8871a3da9da 100644 --- a/src/librustc_typeck/variance/mod.rs +++ b/src/librustc_typeck/variance/mod.rs @@ -48,7 +48,7 @@ fn variances_of<'tcx>(tcx: TyCtxt<'tcx>, item_def_id: DefId) -> &'tcx [ty::Varia // Variance not relevant. span_bug!(tcx.hir().span(id), "asked to compute variance for wrong kind of item") }; - match tcx.hir().get_by_hir_id(id) { + match tcx.hir().get(id) { Node::Item(item) => match item.node { hir::ItemKind::Enum(..) | hir::ItemKind::Struct(..) | diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index c94149d31020a..781e62c3b274c 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -337,7 +337,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { if !self.view_item_stack.insert(res_hir_id) { return false } - let ret = match tcx.hir().get_by_hir_id(res_hir_id) { + let ret = match tcx.hir().get(res_hir_id) { Node::Item(&hir::Item { node: hir::ItemKind::Mod(ref m), .. }) if glob => { let prev = mem::replace(&mut self.inlining, true); for i in &m.item_ids { diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs b/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs index 76554eaba9c92..64b795af9267f 100644 --- a/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs @@ -43,7 +43,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingWhitelistedAttrPass { span: source_map::Span, id: hir::HirId) { - let item = match cx.tcx.hir().get_by_hir_id(id) { + let item = match cx.tcx.hir().get(id) { Node::Item(item) => item, _ => cx.tcx.hir().expect_item(cx.tcx.hir().get_parent_item(id)), };