hir: remove NodeId from Item

This commit is contained in:
ljedrz 2019-02-27 17:35:24 +01:00
parent 3c25193f3f
commit 77fa041fc1
42 changed files with 208 additions and 212 deletions

View file

@ -94,7 +94,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
/// Checks any attribute.
fn check_attributes(&self, item: &hir::Item, target: Target) {
if target == Target::Fn || target == Target::Const {
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.id));
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id_from_hir_id(item.hir_id));
} else if let Some(a) = item.attrs.iter().find(|a| a.check_name("target_feature")) {
self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function")
.span_label(item.span, "not a function")

View file

@ -1414,7 +1414,6 @@ fn lower_existential_impl_trait(
trace!("exist ty def index: {:#?}", exist_ty_def_index);
let exist_ty_item = hir::Item {
id: exist_ty_id.node_id,
hir_id: exist_ty_id.hir_id,
ident: keywords::Invalid.ident(),
attrs: Default::default(),
@ -3128,7 +3127,6 @@ fn lower_use_tree(
this.insert_item(
new_id.node_id,
hir::Item {
id: new_id.node_id,
hir_id: new_id.hir_id,
ident,
attrs: attrs.clone(),
@ -3234,7 +3232,6 @@ fn lower_use_tree(
this.insert_item(
new_id,
hir::Item {
id: new_id,
hir_id: new_hir_id,
ident,
attrs: attrs.clone(),
@ -3534,10 +3531,9 @@ pub fn lower_item(&mut self, i: &Item) -> Option<hir::Item> {
let node = self.lower_item_kind(i.id, &mut ident, &attrs, &mut vis, &i.node);
let LoweredNodeId { node_id, hir_id } = self.lower_node_id(i.id);
let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(i.id);
Some(hir::Item {
id: node_id,
hir_id,
ident,
attrs,

View file

@ -356,7 +356,7 @@ fn visit_nested_body(&mut self, id: BodyId) {
fn visit_item(&mut self, i: &'hir Item) {
debug!("visit_item: {:?}", i);
debug_assert_eq!(i.hir_id.owner,
self.definitions.opt_def_index(i.id).unwrap());
self.definitions.opt_def_index(self.hir_to_node_id[&i.hir_id]).unwrap());
self.with_dep_node_owner(i.hir_id.owner, i, |this| {
this.insert(i.span, i.hir_id, Node::Item(i));
this.with_parent(i.hir_id, |this| {

View file

@ -319,7 +319,7 @@ pub fn describe_def(&self, node_id: NodeId) -> Option<Def> {
match node {
Node::Item(item) => {
let def_id = || self.local_def_id(item.id);
let def_id = || self.local_def_id_from_hir_id(item.hir_id);
match item.node {
ItemKind::Static(_, m, _) => Some(Def::Static(def_id(), m == MutMutable)),

View file

@ -2221,7 +2221,6 @@ pub struct ItemId {
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct Item {
pub ident: Ident,
pub id: NodeId,
pub hir_id: HirId,
pub attrs: HirVec<Attribute>,
pub node: ItemKind,

View file

@ -856,7 +856,6 @@ fn hash_stable<W: StableHasherResult>(&self,
let hir::Item {
ident,
ref attrs,
id: _,
hir_id: _,
ref node,
ref vis,

View file

@ -152,7 +152,7 @@ fn visit_node(&mut self, node: Node<'tcx>) {
Node::Item(item) => {
match item.node {
hir::ItemKind::Struct(..) | hir::ItemKind::Union(..) => {
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let def = self.tcx.adt_def(def_id);
self.repr_has_repr_c = def.repr.c();

View file

@ -2,11 +2,10 @@
use crate::hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE};
use crate::session::{config, Session};
use crate::session::config::EntryFnType;
use syntax::ast::NodeId;
use syntax::attr;
use syntax::entry::EntryPointType;
use syntax_pos::Span;
use crate::hir::{Item, ItemKind, ImplItem, TraitItem};
use crate::hir::{HirId, Item, ItemKind, ImplItem, TraitItem};
use crate::hir::itemlikevisit::ItemLikeVisitor;
use crate::ty::TyCtxt;
use crate::ty::query::Providers;
@ -17,22 +16,22 @@ struct EntryContext<'a, 'tcx: 'a> {
map: &'a hir_map::Map<'tcx>,
// The top-level function called 'main'
main_fn: Option<(NodeId, Span)>,
main_fn: Option<(HirId, Span)>,
// The function that has attribute named 'main'
attr_main_fn: Option<(NodeId, Span)>,
attr_main_fn: Option<(HirId, Span)>,
// The function that has the attribute 'start' on it
start_fn: Option<(NodeId, Span)>,
start_fn: Option<(HirId, Span)>,
// The functions that one might think are 'main' but aren't, e.g.
// main functions not defined at the top level. For diagnostics.
non_main_fns: Vec<(NodeId, Span)> ,
non_main_fns: Vec<(HirId, Span)> ,
}
impl<'a, 'tcx> ItemLikeVisitor<'tcx> for EntryContext<'a, 'tcx> {
fn visit_item(&mut self, item: &'tcx Item) {
let def_id = self.map.local_def_id(item.id);
let def_id = self.map.local_def_id_from_hir_id(item.hir_id);
let def_key = self.map.def_key(def_id);
let at_root = def_key.parent == Some(CRATE_DEF_INDEX);
find_item(item, self, at_root);
@ -106,18 +105,18 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
match entry_point_type(item, at_root) {
EntryPointType::MainNamed => {
if ctxt.main_fn.is_none() {
ctxt.main_fn = Some((item.id, item.span));
ctxt.main_fn = Some((item.hir_id, item.span));
} else {
span_err!(ctxt.session, item.span, E0136,
"multiple 'main' functions");
}
},
EntryPointType::OtherMain => {
ctxt.non_main_fns.push((item.id, item.span));
ctxt.non_main_fns.push((item.hir_id, item.span));
},
EntryPointType::MainAttr => {
if ctxt.attr_main_fn.is_none() {
ctxt.attr_main_fn = Some((item.id, item.span));
ctxt.attr_main_fn = Some((item.hir_id, item.span));
} else {
struct_span_err!(ctxt.session, item.span, E0137,
"multiple functions with a #[main] attribute")
@ -128,7 +127,7 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
},
EntryPointType::Start => {
if ctxt.start_fn.is_none() {
ctxt.start_fn = Some((item.id, item.span));
ctxt.start_fn = Some((item.hir_id, item.span));
} else {
struct_span_err!(ctxt.session, item.span, E0138, "multiple 'start' functions")
.span_label(ctxt.start_fn.unwrap().1, "previous `start` function here")
@ -144,12 +143,12 @@ fn configure_main(
tcx: TyCtxt<'_, '_, '_>,
visitor: &EntryContext<'_, '_>,
) -> Option<(DefId, EntryFnType)> {
if let Some((node_id, _)) = visitor.start_fn {
Some((tcx.hir().local_def_id(node_id), EntryFnType::Start))
} else if let Some((node_id, _)) = visitor.attr_main_fn {
Some((tcx.hir().local_def_id(node_id), EntryFnType::Main))
} else if let Some((node_id, _)) = visitor.main_fn {
Some((tcx.hir().local_def_id(node_id), EntryFnType::Main))
if let Some((hir_id, _)) = visitor.start_fn {
Some((tcx.hir().local_def_id_from_hir_id(hir_id), EntryFnType::Start))
} else if let Some((hir_id, _)) = visitor.attr_main_fn {
Some((tcx.hir().local_def_id_from_hir_id(hir_id), EntryFnType::Main))
} else if let Some((hir_id, _)) = visitor.main_fn {
Some((tcx.hir().local_def_id_from_hir_id(hir_id), EntryFnType::Main))
} else {
// No main function
let mut err = struct_err!(tcx.sess, E0601,

View file

@ -98,7 +98,7 @@ fn visit_item(&mut self, item: &hir::Item) {
match self.item_refs.get(&*value.as_str()).cloned() {
// Known lang item with attribute on correct target.
Some((item_index, expected_target)) if actual_target == expected_target => {
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
self.collect_item(item_index, def_id);
},
// Known lang item with attribute on incorrect target.

View file

@ -36,7 +36,7 @@ fn item_might_be_inlined(tcx: TyCtxt<'a, 'tcx, 'tcx>,
match item.node {
hir::ItemKind::Impl(..) |
hir::ItemKind::Fn(..) => {
let generics = tcx.generics_of(tcx.hir().local_def_id(item.id));
let generics = tcx.generics_of(tcx.hir().local_def_id_from_hir_id(item.hir_id));
generics.requires_monomorphization(tcx)
}
_ => false,
@ -344,7 +344,7 @@ fn visit_item(&mut self, item: &hir::Item) {
// Anything which has custom linkage gets thrown on the worklist no
// matter where it is in the crate, along with "special std symbols"
// which are currently akin to allocator symbols.
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let codegen_attrs = self.tcx.codegen_fn_attrs(def_id);
if codegen_attrs.contains_extern_indicator() ||
codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL) {

View file

@ -13,7 +13,7 @@
use crate::rustc::lint;
use crate::session::Session;
use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet, NodeMap};
use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet};
use errors::{Applicability, DiagnosticBuilder};
use rustc_data_structures::sync::Lrc;
use std::borrow::Cow;
@ -204,7 +204,7 @@ struct NamedRegionMap {
// For each type and trait definition, maps type parameters
// to the trait object lifetime defaults computed from them.
pub object_lifetime_defaults: NodeMap<Vec<ObjectLifetimeDefault>>,
pub object_lifetime_defaults: HirIdMap<Vec<ObjectLifetimeDefault>>,
}
/// See [`NamedRegionMap`].
@ -395,8 +395,7 @@ fn resolve_lifetimes<'tcx>(
.or_default();
Lrc::get_mut(map).unwrap().insert(hir_id.local_id);
}
for (k, v) in named_region_map.object_lifetime_defaults {
let hir_id = tcx.hir().node_to_hir_id(k);
for (hir_id, v) in named_region_map.object_lifetime_defaults {
let map = rl.object_lifetime_defaults
.entry(hir_id.owner_local_def_id())
.or_default();
@ -1266,8 +1265,8 @@ fn check_if_label_shadows_lifetime(
fn compute_object_lifetime_defaults(
tcx: TyCtxt<'_, '_, '_>,
) -> NodeMap<Vec<ObjectLifetimeDefault>> {
let mut map = NodeMap::default();
) -> HirIdMap<Vec<ObjectLifetimeDefault>> {
let mut map = HirIdMap::default();
for item in tcx.hir().krate().items.values() {
match item.node {
hir::ItemKind::Struct(_, ref generics)
@ -1311,7 +1310,7 @@ fn compute_object_lifetime_defaults(
tcx.sess.span_err(item.span, &object_lifetime_default_reprs);
}
map.insert(item.id, result);
map.insert(item.hir_id, result);
}
_ => {}
}
@ -1959,7 +1958,7 @@ fn visit_segment_args(&mut self, def: Def, depth: usize, generic_args: &'tcx hir
};
let map = &self.map;
let unsubst = if let Some(id) = self.tcx.hir().as_local_node_id(def_id) {
let unsubst = if let Some(id) = self.tcx.hir().as_local_hir_id(def_id) {
&map.object_lifetime_defaults[&id]
} else {
let tcx = self.tcx;

View file

@ -761,7 +761,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
// compiler-generated `extern crate` items have a dummy span.
if item.span.is_dummy() { return }
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let cnum = match self.tcx.extern_mod_stmt_cnum(def_id) {
Some(cnum) => cnum,
None => return,
@ -791,7 +791,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
// There's no good place to insert stability check for non-Copy unions,
// so semi-randomly perform it here in stability.rs
hir::ItemKind::Union(..) if !self.tcx.features().untagged_unions => {
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let adt_def = self.tcx.adt_def(def_id);
let ty = self.tcx.type_of(def_id);

View file

@ -260,7 +260,7 @@ fn parent(self, id: DefId) -> Option<DefId> {
}
impl Visibility {
pub fn from_hir(visibility: &hir::Visibility, id: NodeId, tcx: TyCtxt<'_, '_, '_>) -> Self {
pub fn from_hir(visibility: &hir::Visibility, id: hir::HirId, tcx: TyCtxt<'_, '_, '_>) -> Self {
match visibility.node {
hir::VisibilityKind::Public => Visibility::Public,
hir::VisibilityKind::Crate(_) => Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)),
@ -271,7 +271,7 @@ pub fn from_hir(visibility: &hir::Visibility, id: NodeId, tcx: TyCtxt<'_, '_, '_
def => Visibility::Restricted(def.def_id()),
},
hir::VisibilityKind::Inherited => {
Visibility::Restricted(tcx.hir().get_module_parent(id))
Visibility::Restricted(tcx.hir().get_module_parent_by_hir_id(id))
}
}
}
@ -2737,11 +2737,13 @@ fn associated_item_from_trait_item_ref(self,
hir::AssociatedItemKind::Existential => bug!("only impls can have existentials"),
};
let hir_id = self.hir().node_to_hir_id(trait_item_ref.id.node_id);
AssociatedItem {
ident: trait_item_ref.ident,
kind,
// Visibility of trait items is inherited from their traits.
vis: Visibility::from_hir(parent_vis, trait_item_ref.id.node_id, self),
vis: Visibility::from_hir(parent_vis, hir_id, self),
defaultness: trait_item_ref.defaultness,
def_id,
container: TraitContainer(parent_def_id),
@ -2763,11 +2765,13 @@ fn associated_item_from_impl_item_ref(self,
hir::AssociatedItemKind::Existential => (ty::AssociatedKind::Existential, false),
};
let hir_id = self.hir().node_to_hir_id(impl_item_ref.id.node_id);
AssociatedItem {
ident: impl_item_ref.ident,
kind,
// Visibility of trait impl items doesn't matter.
vis: ty::Visibility::from_hir(&impl_item_ref.vis, impl_item_ref.id.node_id, self),
vis: ty::Visibility::from_hir(&impl_item_ref.vis, hir_id, self),
defaultness: impl_item_ref.defaultness,
def_id,
container: ImplContainer(parent_def_id),

View file

@ -408,8 +408,8 @@ fn post(&self, s: &mut pprust_hir::State, node: pprust_hir::AnnNode) -> io::Resu
pprust_hir::AnnNode::Name(_) => Ok(()),
pprust_hir::AnnNode::Item(item) => {
s.s.space()?;
s.synth_comment(format!("node_id: {} hir local_id: {}",
item.id, item.hir_id.local_id.as_u32()))
s.synth_comment(format!("hir_id: {} hir local_id: {}",
item.hir_id, item.hir_id.local_id.as_u32()))
}
pprust_hir::AnnNode::SubItem(id) => {
s.s.space()?;

View file

@ -3,7 +3,6 @@
use rustc::hir;
use rustc::ty::TyCtxt;
use rustc::ty::query::Providers;
use syntax::ast;
use syntax::attr;
pub fn find<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> Option<DefId> {
@ -19,17 +18,17 @@ fn proc_macro_decls_static<'tcx>(
let mut finder = Finder { decls: None };
tcx.hir().krate().visit_all_item_likes(&mut finder);
finder.decls.map(|id| tcx.hir().local_def_id(id))
finder.decls.map(|id| tcx.hir().local_def_id_from_hir_id(id))
}
struct Finder {
decls: Option<ast::NodeId>,
decls: Option<hir::HirId>,
}
impl<'v> ItemLikeVisitor<'v> for Finder {
fn visit_item(&mut self, item: &hir::Item) {
if attr::contains_name(&item.attrs, "rustc_proc_macro_decls") {
self.decls = Some(item.id);
self.decls = Some(item.hir_id);
}
}

View file

@ -26,7 +26,7 @@
use rustc::ty::{self, Ty};
use rustc::{lint, util};
use hir::Node;
use util::nodemap::NodeSet;
use util::nodemap::HirIdSet;
use lint::{LateContext, LintContext, LintArray};
use lint::{LintPass, LateLintPass, EarlyLintPass, EarlyContext};
@ -137,7 +137,7 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
hir::ItemKind::Enum(..) |
hir::ItemKind::Struct(..) |
hir::ItemKind::Union(..) => {
let def_id = cx.tcx.hir().local_def_id(it.id);
let def_id = cx.tcx.hir().local_def_id_from_hir_id(it.hir_id);
self.check_heap_type(cx, it.span, cx.tcx.type_of(def_id))
}
_ => ()
@ -569,21 +569,21 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
if !ast_generics.params.is_empty() {
return;
}
let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id(item.id));
let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id_from_hir_id(item.hir_id));
(def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[])))
}
hir::ItemKind::Union(_, ref ast_generics) => {
if !ast_generics.params.is_empty() {
return;
}
let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id(item.id));
let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id_from_hir_id(item.hir_id));
(def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[])))
}
hir::ItemKind::Enum(_, ref ast_generics) => {
if !ast_generics.params.is_empty() {
return;
}
let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id(item.id));
let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id_from_hir_id(item.hir_id));
(def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[])))
}
_ => return,
@ -611,7 +611,7 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
}
pub struct MissingDebugImplementations {
impling_types: Option<NodeSet>,
impling_types: Option<HirIdSet>,
}
impl MissingDebugImplementations {
@ -650,11 +650,11 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
};
if self.impling_types.is_none() {
let mut impls = NodeSet::default();
let mut impls = HirIdSet::default();
cx.tcx.for_each_impl(debug, |d| {
if let Some(ty_def) = cx.tcx.type_of(d).ty_adt_def() {
if let Some(node_id) = cx.tcx.hir().as_local_node_id(ty_def.did) {
impls.insert(node_id);
if let Some(hir_id) = cx.tcx.hir().as_local_hir_id(ty_def.did) {
impls.insert(hir_id);
}
}
});
@ -663,7 +663,7 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
debug!("{:?}", self.impling_types);
}
if !self.impling_types.as_ref().unwrap().contains(&item.id) {
if !self.impling_types.as_ref().unwrap().contains(&item.hir_id) {
cx.span_lint(MISSING_DEBUG_IMPLEMENTATIONS,
item.span,
"type does not implement `fmt::Debug`; consider adding #[derive(Debug)] \
@ -860,7 +860,7 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
_ => return,
};
let def_id = cx.tcx.hir().local_def_id(it.id);
let def_id = cx.tcx.hir().local_def_id_from_hir_id(it.hir_id);
let prfn = match cx.tcx.extern_mod_stmt_cnum(def_id) {
Some(cnum) => cx.tcx.plugin_registrar_fn(cnum),
None => {
@ -1360,7 +1360,7 @@ fn check_item(
if cx.tcx.features().trivial_bounds {
let def_id = cx.tcx.hir().local_def_id(item.id);
let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let predicates = cx.tcx.predicates_of(def_id);
for &(predicate, span) in &predicates.predicates {
let predicate_kind_name = match predicate {
@ -1500,14 +1500,14 @@ fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(&P<Expr>, &P<Expr>, Span)> {
}
pub struct UnnameableTestItems {
boundary: ast::NodeId, // NodeId of the item under which things are not nameable
boundary: hir::HirId, // HirId of the item under which things are not nameable
items_nameable: bool,
}
impl UnnameableTestItems {
pub fn new() -> Self {
Self {
boundary: ast::DUMMY_NODE_ID,
boundary: hir::DUMMY_HIR_ID,
items_nameable: true
}
}
@ -1529,7 +1529,7 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
if let hir::ItemKind::Mod(..) = it.node {}
else {
self.items_nameable = false;
self.boundary = it.id;
self.boundary = it.hir_id;
}
return;
}
@ -1544,7 +1544,7 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
}
fn check_item_post(&mut self, _cx: &LateContext<'_, '_>, it: &hir::Item) {
if !self.items_nameable && self.boundary == it.id {
if !self.items_nameable && self.boundary == it.hir_id {
self.items_nameable = true;
}
}
@ -1794,7 +1794,7 @@ fn consolidate_outlives_bound_spans(
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
let infer_static = cx.tcx.features().infer_static_outlives_requirements;
let def_id = cx.tcx.hir().local_def_id(item.id);
let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
if let hir::ItemKind::Struct(_, ref generics) = item.node {
let mut bound_count = 0;
let mut lint_spans = Vec::new();

View file

@ -839,7 +839,7 @@ fn get_lints(&self) -> LintArray {
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for VariantSizeDifferences {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
if let hir::ItemKind::Enum(ref enum_definition, _) = it.node {
let item_def_id = cx.tcx.hir().local_def_id(it.id);
let item_def_id = cx.tcx.hir().local_def_id_from_hir_id(it.hir_id);
let t = cx.tcx.type_of(item_def_id);
let ty = cx.tcx.erase_regions(&t);
match cx.layout_of(ty) {

View file

@ -29,7 +29,7 @@
use std::path::Path;
use rustc_data_structures::sync::Lrc;
use std::u32;
use syntax::ast::{self, CRATE_NODE_ID};
use syntax::ast;
use syntax::attr;
use syntax::source_map::Spanned;
use syntax::symbol::keywords;
@ -314,7 +314,7 @@ fn encode_info_for_items(&mut self) -> Index {
let vis = Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Public };
index.record(DefId::local(CRATE_DEF_INDEX),
IsolatedEncoder::encode_info_for_mod,
FromId(CRATE_NODE_ID, (&krate.module, &krate.attrs, &vis)));
FromId(hir::CRATE_HIR_ID, (&krate.module, &krate.attrs, &vis)));
let mut visitor = EncodeVisitor { index };
krate.visit_all_item_likes(&mut visitor.as_deep_visitor());
for macro_def in &krate.exported_macros {
@ -588,8 +588,8 @@ fn encode_enum_variant_info(&mut self,
}
};
let enum_id = tcx.hir().as_local_node_id(enum_did).unwrap();
let enum_vis = &tcx.hir().expect_item(enum_id).vis;
let enum_id = tcx.hir().as_local_hir_id(enum_did).unwrap();
let enum_vis = &tcx.hir().expect_item_by_hir_id(enum_id).vis;
Entry {
kind: EntryKind::Variant(self.lazy(&data)),
@ -624,7 +624,7 @@ fn encode_info_for_mod(&mut self,
&hir::Visibility)>)
-> Entry<'tcx> {
let tcx = self.tcx;
let def_id = tcx.hir().local_def_id(id);
let def_id = tcx.hir().local_def_id_from_hir_id(id);
debug!("IsolatedEncoder::encode_info_for_mod({:?})", def_id);
let data = ModData {
@ -714,8 +714,8 @@ fn encode_struct_ctor(&mut self, (adt_def_id, def_id): (DefId, DefId)) -> Entry<
}
};
let struct_id = tcx.hir().as_local_node_id(adt_def_id).unwrap();
let struct_vis = &tcx.hir().expect_item(struct_id).vis;
let struct_id = tcx.hir().as_local_hir_id(adt_def_id).unwrap();
let struct_vis = &tcx.hir().expect_item_by_hir_id(struct_id).vis;
let mut ctor_vis = ty::Visibility::from_hir(struct_vis, struct_id, tcx);
for field in &variant.fields {
if ctor_vis.is_at_least(field.vis, tcx) {
@ -1055,7 +1055,7 @@ fn encode_info_for_item(&mut self, (def_id, item): (DefId, &'tcx hir::Item)) ->
EntryKind::Fn(self.lazy(&data))
}
hir::ItemKind::Mod(ref m) => {
return self.encode_info_for_mod(FromId(item.id, (m, &item.attrs, &item.vis)));
return self.encode_info_for_mod(FromId(item.hir_id, (m, &item.attrs, &item.vis)));
}
hir::ItemKind::ForeignMod(_) => EntryKind::ForeignMod,
hir::ItemKind::GlobalAsm(..) => EntryKind::GlobalAsm,
@ -1154,7 +1154,7 @@ fn encode_info_for_item(&mut self, (def_id, item): (DefId, &'tcx hir::Item)) ->
Entry {
kind,
visibility: self.lazy(&ty::Visibility::from_hir(&item.vis, item.id, tcx)),
visibility: self.lazy(&ty::Visibility::from_hir(&item.vis, item.hir_id, tcx)),
span: self.lazy(&item.span),
attributes: self.encode_attributes(&item.attrs),
children: match item.node {
@ -1608,11 +1608,9 @@ fn encode_info_for_foreign_item(&mut self,
hir::ForeignItemKind::Type => EntryKind::ForeignType,
};
let node_id = self.tcx.hir().hir_to_node_id(nitem.hir_id);
Entry {
kind,
visibility: self.lazy(&ty::Visibility::from_hir(&nitem.vis, node_id, tcx)),
visibility: self.lazy(&ty::Visibility::from_hir(&nitem.vis, nitem.hir_id, tcx)),
span: self.lazy(&nitem.span),
attributes: self.encode_attributes(&nitem.attrs),
children: LazySeq::empty(),
@ -1648,7 +1646,7 @@ fn visit_expr(&mut self, ex: &'tcx hir::Expr) {
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
intravisit::walk_item(self, item);
let def_id = self.index.tcx.hir().local_def_id(item.id);
let def_id = self.index.tcx.hir().local_def_id_from_hir_id(item.hir_id);
match item.node {
hir::ItemKind::ExternCrate(_) |
hir::ItemKind::Use(..) => (), // ignore these
@ -1744,7 +1742,7 @@ fn encode_info_for_expr(&mut self, expr: &hir::Expr) {
/// so it's easier to do that here then to wait until we would encounter
/// normally in the visitor walk.
fn encode_addl_info_for_item(&mut self, item: &hir::Item) {
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
match item.node {
hir::ItemKind::Static(..) |
hir::ItemKind::Const(..) |
@ -1809,7 +1807,7 @@ struct ImplVisitor<'a, 'tcx: 'a> {
impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'a, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
if let hir::ItemKind::Impl(..) = item.node {
let impl_id = self.tcx.hir().local_def_id(item.id);
let impl_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
if let Some(trait_ref) = self.tcx.impl_trait_ref(impl_id) {
self.impls
.entry(trait_ref.def_id)

View file

@ -29,7 +29,7 @@ fn visit_item(&mut self, it: &'tcx hir::Item) {
.collect();
self.modules.push(ForeignModule {
foreign_items,
def_id: self.tcx.hir().local_def_id(it.id),
def_id: self.tcx.hir().local_def_id_from_hir_id(it.hir_id),
});
}

View file

@ -215,10 +215,10 @@ fn read(&self, _tcx: TyCtxt<'_, '_, '_>) {}
/// HIR node that doesn't carry its own ID. This will allow an
/// arbitrary `T` to be passed in, but register a read on the given
/// `NodeId`.
pub struct FromId<T>(pub ast::NodeId, pub T);
pub struct FromId<T>(pub hir::HirId, pub T);
impl<T> DepGraphRead for FromId<T> {
fn read(&self, tcx: TyCtxt<'_, '_, '_>) {
tcx.hir().read(self.0);
tcx.hir().read_by_hir_id(self.0);
}
}

View file

@ -56,7 +56,7 @@ fn visit_item(&mut self, it: &'tcx hir::Item) {
name: None,
kind: cstore::NativeUnknown,
cfg: None,
foreign_module: Some(self.tcx.hir().local_def_id(it.id)),
foreign_module: Some(self.tcx.hir().local_def_id_from_hir_id(it.hir_id)),
wasm_import_module: None,
};
let mut kind_specified = false;

View file

@ -952,7 +952,7 @@ fn visit_item(&mut self, item: &'v hir::Item) {
hir::ItemKind::Union(_, ref generics) => {
if generics.params.is_empty() {
if self.mode == MonoItemCollectionMode::Eager {
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
debug!("RootCollector: ADT drop-glue for {}",
def_id_to_string(self.tcx, def_id));
@ -964,11 +964,12 @@ fn visit_item(&mut self, item: &'v hir::Item) {
hir::ItemKind::GlobalAsm(..) => {
debug!("RootCollector: ItemKind::GlobalAsm({})",
def_id_to_string(self.tcx,
self.tcx.hir().local_def_id(item.id)));
self.output.push(MonoItem::GlobalAsm(item.id));
self.tcx.hir().local_def_id_from_hir_id(item.hir_id)));
let node_id = self.tcx.hir().hir_to_node_id(item.hir_id);
self.output.push(MonoItem::GlobalAsm(node_id));
}
hir::ItemKind::Static(..) => {
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
debug!("RootCollector: ItemKind::Static({})",
def_id_to_string(self.tcx, def_id));
self.output.push(MonoItem::Static(def_id));
@ -978,7 +979,7 @@ fn visit_item(&mut self, item: &'v hir::Item) {
// actually used somewhere. Just declaring them is insufficient.
// but even just declaring them must collect the items they refer to
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let instance = Instance::mono(self.tcx, def_id);
let cid = GlobalId {
@ -992,7 +993,7 @@ fn visit_item(&mut self, item: &'v hir::Item) {
}
}
hir::ItemKind::Fn(..) => {
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
self.push_if_root(def_id);
}
}
@ -1097,7 +1098,7 @@ fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
}
let impl_def_id = tcx.hir().local_def_id(item.id);
let impl_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id);
debug!("create_mono_items_for_default_impls(item={})",
def_id_to_string(tcx, impl_def_id));

View file

@ -27,7 +27,7 @@ struct VarianceTest<'a, 'tcx: 'a> {
impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
let item_def_id = self.tcx.hir().local_def_id(item.id);
let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
if let ItemKind::Ty(..) = item.node {
for attr in self.tcx.get_attrs(item_def_id).iter() {

View file

@ -1,6 +1,5 @@
//! Used by `rustc` when compiling a plugin crate.
use syntax::ast;
use syntax::attr;
use syntax_pos::Span;
use rustc::hir::itemlikevisit::ItemLikeVisitor;
@ -10,7 +9,7 @@
use rustc::ty::query::Providers;
struct RegistrarFinder {
registrars: Vec<(ast::NodeId, Span)> ,
registrars: Vec<(hir::HirId, Span)> ,
}
impl<'v> ItemLikeVisitor<'v> for RegistrarFinder {
@ -18,7 +17,7 @@ fn visit_item(&mut self, item: &hir::Item) {
if let hir::ItemKind::Fn(..) = item.node {
if attr::contains_name(&item.attrs,
"plugin_registrar") {
self.registrars.push((item.id, item.span));
self.registrars.push((item.hir_id, item.span));
}
}
}
@ -47,8 +46,8 @@ fn plugin_registrar_fn<'tcx>(
match finder.registrars.len() {
0 => None,
1 => {
let (node_id, _) = finder.registrars.pop().unwrap();
Some(tcx.hir().local_def_id(node_id))
let (hir_id, _) = finder.registrars.pop().unwrap();
Some(tcx.hir().local_def_id_from_hir_id(hir_id))
},
_ => {
let diagnostic = tcx.sess.diagnostic();

View file

@ -220,16 +220,16 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
-> (ty::Visibility, Span, &'static str) {
match tcx.hir().as_local_node_id(def_id) {
Some(node_id) => {
let vis = match tcx.hir().get(node_id) {
match tcx.hir().as_local_hir_id(def_id) {
Some(hir_id) => {
let vis = match tcx.hir().get_by_hir_id(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(node_id));
return def_id_visibility(tcx, tcx.hir().get_parent_did_by_hir_id(hir_id));
}
Node::ImplItem(impl_item) => {
match tcx.hir().get(tcx.hir().get_parent(node_id)) {
match tcx.hir().get_by_hir_id(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), _, _)
@ -240,16 +240,16 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
}
}
Node::StructCtor(vdata) => {
let struct_node_id = tcx.hir().get_parent(node_id);
let item = match tcx.hir().get(struct_node_id) {
let struct_hir_id = tcx.hir().get_parent_item(hir_id);
let item = match tcx.hir().get_by_hir_id(struct_hir_id) {
Node::Item(item) => item,
node => bug!("unexpected node kind: {:?}", node),
};
let (mut ctor_vis, mut span, mut descr) =
(ty::Visibility::from_hir(&item.vis, struct_node_id, tcx),
(ty::Visibility::from_hir(&item.vis, struct_hir_id, tcx),
item.vis.span, item.vis.node.descr());
for field in vdata.fields() {
let field_vis = ty::Visibility::from_hir(&field.vis, node_id, tcx);
let field_vis = ty::Visibility::from_hir(&field.vis, hir_id, tcx);
if ctor_vis.is_at_least(field_vis, tcx) {
ctor_vis = field_vis;
span = field.vis.span;
@ -260,7 +260,7 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
// If the structure is marked as non_exhaustive then lower the
// visibility to within the crate.
if ctor_vis == ty::Visibility::Public {
let adt_def = tcx.adt_def(tcx.hir().get_parent_did(node_id));
let adt_def = tcx.adt_def(tcx.hir().get_parent_did_by_hir_id(hir_id));
if adt_def.non_enum_variant().is_field_list_non_exhaustive() {
ctor_vis = ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX));
span = attr::find_by_name(&item.attrs, "non_exhaustive").unwrap().span;
@ -277,7 +277,7 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
}
node => bug!("unexpected node kind: {:?}", node)
};
(ty::Visibility::from_hir(vis, node_id, tcx), vis.span, vis.node.descr())
(ty::Visibility::from_hir(vis, hir_id, tcx), vis.span, vis.node.descr())
}
None => {
let vis = tcx.visibility(def_id);
@ -1679,7 +1679,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
let tcx = self.tcx;
let item_visibility = ty::Visibility::from_hir(&item.vis, item.id, tcx);
let item_visibility = ty::Visibility::from_hir(&item.vis, item.hir_id, tcx);
match item.node {
// Crates are always public.
@ -1724,7 +1724,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
// Subitems of foreign modules have their own publicity.
hir::ItemKind::ForeignMod(ref foreign_mod) => {
for foreign_item in &foreign_mod.items {
let vis = ty::Visibility::from_hir(&foreign_item.vis, item.id, tcx);
let vis = ty::Visibility::from_hir(&foreign_item.vis, item.hir_id, tcx);
self.check(foreign_item.hir_id, vis).generics().predicates().ty();
}
}
@ -1734,7 +1734,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
self.check(item.hir_id, item_visibility).generics().predicates();
for field in struct_def.fields() {
let field_visibility = ty::Visibility::from_hir(&field.vis, item.id, tcx);
let field_visibility = ty::Visibility::from_hir(&field.vis, item.hir_id, tcx);
self.check(field.hir_id, min(item_visibility, field_visibility, tcx)).ty();
}
}
@ -1748,7 +1748,9 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
for impl_item_ref in impl_item_refs {
let impl_item = tcx.hir().impl_item(impl_item_ref.id);
let impl_item_vis = if trait_ref.is_none() {
min(ty::Visibility::from_hir(&impl_item.vis, item.id, tcx), impl_vis, tcx)
min(ty::Visibility::from_hir(&impl_item.vis, item.hir_id, tcx),
impl_vis,
tcx)
} else {
impl_vis
};

View file

@ -732,7 +732,7 @@ struct Visitor<'a, 'tcx: 'a> {
impl<'v, 'a, 'tcx> itemlikevisit::ItemLikeVisitor<'v> for Visitor<'a, 'tcx> {
fn visit_item(&mut self, i: &'v hir::Item) {
if let hir::ItemKind::Trait(..) = i.node {
let def_id = self.map.local_def_id(i.id);
let def_id = self.map.local_def_id_from_hir_id(i.hir_id);
self.traits.push(def_id);
}
}

View file

@ -1289,9 +1289,9 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
}
fn check_struct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
id: ast::NodeId,
id: hir::HirId,
span: Span) {
let def_id = tcx.hir().local_def_id(id);
let def_id = tcx.hir().local_def_id_from_hir_id(id);
let def = tcx.adt_def(def_id);
def.destructor(tcx); // force the destructor to be evaluated
check_representable(tcx, span, def_id);
@ -1305,9 +1305,9 @@ fn check_struct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
fn check_union<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
id: ast::NodeId,
id: hir::HirId,
span: Span) {
let def_id = tcx.hir().local_def_id(id);
let def_id = tcx.hir().local_def_id_from_hir_id(id);
let def = tcx.adt_def(def_id);
def.destructor(tcx); // force the destructor to be evaluated
check_representable(tcx, span, def_id);
@ -1338,28 +1338,28 @@ fn check_opaque<'a, 'tcx>(
pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Item) {
debug!(
"check_item_type(it.id={}, it.name={})",
it.id,
tcx.item_path_str(tcx.hir().local_def_id(it.id))
"check_item_type(it.hir_id={}, it.name={})",
it.hir_id,
tcx.item_path_str(tcx.hir().local_def_id_from_hir_id(it.hir_id))
);
let _indenter = indenter();
match it.node {
// Consts can play a role in type-checking, so they are included here.
hir::ItemKind::Static(..) => {
let def_id = tcx.hir().local_def_id(it.id);
let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id);
tcx.typeck_tables_of(def_id);
maybe_check_static_with_link_section(tcx, def_id, it.span);
}
hir::ItemKind::Const(..) => {
tcx.typeck_tables_of(tcx.hir().local_def_id(it.id));
tcx.typeck_tables_of(tcx.hir().local_def_id_from_hir_id(it.hir_id));
}
hir::ItemKind::Enum(ref enum_definition, _) => {
check_enum(tcx, it.span, &enum_definition.variants, it.id);
check_enum(tcx, it.span, &enum_definition.variants, it.hir_id);
}
hir::ItemKind::Fn(..) => {} // entirely within check_item_body
hir::ItemKind::Impl(.., ref impl_item_refs) => {
debug!("ItemKind::Impl {} with id {}", it.ident, it.id);
let impl_def_id = tcx.hir().local_def_id(it.id);
debug!("ItemKind::Impl {} with id {}", it.ident, it.hir_id);
let impl_def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id);
if let Some(impl_trait_ref) = tcx.impl_trait_ref(impl_def_id) {
check_impl_items_against_trait(
tcx,
@ -1373,23 +1373,23 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite
}
}
hir::ItemKind::Trait(..) => {
let def_id = tcx.hir().local_def_id(it.id);
let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id);
check_on_unimplemented(tcx, def_id, it);
}
hir::ItemKind::Struct(..) => {
check_struct(tcx, it.id, it.span);
check_struct(tcx, it.hir_id, it.span);
}
hir::ItemKind::Union(..) => {
check_union(tcx, it.id, it.span);
check_union(tcx, it.hir_id, it.span);
}
hir::ItemKind::Existential(..) => {
let def_id = tcx.hir().local_def_id(it.id);
let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id);
let substs = InternalSubsts::identity_for_item(tcx, def_id);
check_opaque(tcx, def_id, substs, it.span);
}
hir::ItemKind::Ty(..) => {
let def_id = tcx.hir().local_def_id(it.id);
let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id);
let pty_ty = tcx.type_of(def_id);
let generics = tcx.generics_of(def_id);
check_bounds_are_used(tcx, &generics, pty_ty);
@ -1476,7 +1476,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_, '_>, id: DefId, span
fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
trait_def_id: DefId,
item: &hir::Item) {
let item_def_id = tcx.hir().local_def_id(item.id);
let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id);
// an error would be reported if this fails.
let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id);
}
@ -1842,8 +1842,8 @@ fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: De
pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
sp: Span,
vs: &'tcx [hir::Variant],
id: ast::NodeId) {
let def_id = tcx.hir().local_def_id(id);
id: hir::HirId) {
let def_id = tcx.hir().local_def_id_from_hir_id(id);
let def = tcx.adt_def(def_id);
def.destructor(tcx); // force the destructor to be evaluated

View file

@ -241,7 +241,7 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
{
for_item(tcx, item).with_fcx(|fcx, fcx_tcx| {
let variants = lookup_fields(fcx);
let def_id = fcx.tcx.hir().local_def_id(item.id);
let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let packed = fcx.tcx.adt_def(def_id).repr.packed();
for variant in &variants {
@ -302,9 +302,9 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) {
debug!("check_trait: {:?}", item.id);
debug!("check_trait: {:?}", item.hir_id);
let trait_def_id = tcx.hir().local_def_id(item.id);
let trait_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id);
let trait_def = tcx.trait_def(trait_def_id);
if trait_def.is_marker {
@ -326,7 +326,7 @@ fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) {
fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) {
for_item(tcx, item).with_fcx(|fcx, tcx| {
let def_id = fcx.tcx.hir().local_def_id(item.id);
let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let sig = fcx.tcx.fn_sig(def_id);
let sig = fcx.normalize_associated_types_in(item.span, &sig);
let mut implied_bounds = vec![];
@ -376,7 +376,7 @@ fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
debug!("check_impl: {:?}", item);
for_item(tcx, item).with_fcx(|fcx, tcx| {
let item_def_id = fcx.tcx.hir().local_def_id(item.id);
let item_def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
match *ast_trait_ref {
Some(ref ast_trait_ref) => {
@ -887,7 +887,7 @@ fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
item: &hir::Item,
hir_generics: &hir::Generics)
{
let item_def_id = tcx.hir().local_def_id(item.id);
let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id);
let ty = tcx.type_of(item_def_id);
if tcx.has_error_field(ty) {
return;
@ -1018,7 +1018,7 @@ pub fn new(tcx: TyCtxt<'a, 'gcx, 'gcx>)
impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'a, 'tcx> {
fn visit_item(&mut self, i: &'tcx hir::Item) {
debug!("visit_item: {:?}", i);
let def_id = self.tcx.hir().local_def_id(i.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(i.hir_id);
self.tcx.ensure().check_item_well_formed(def_id);
}

View file

@ -212,7 +212,7 @@ struct ExternCrateToLint {
impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CollectExternCrateVisitor<'a, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
if let hir::ItemKind::ExternCrate(orig_name) = item.node {
let extern_crate_def_id = self.tcx.hir().local_def_id(item.id);
let extern_crate_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
self.crates_to_lint.push(
ExternCrateToLint {
def_id: extern_crate_def_id,

View file

@ -85,7 +85,7 @@ fn visit_item(&mut self, item: &hir::Item) {
_ => return
};
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let self_ty = self.tcx.type_of(def_id);
let lang_items = self.tcx.lang_items();
match self_ty.sty {
@ -288,7 +288,7 @@ fn check_def_id(&mut self, item: &hir::Item, def_id: DefId) {
// Add the implementation to the mapping from implementation to base
// type def ID, if there is a base type for this implementation and
// the implementation does not have any associated traits.
let impl_def_id = self.tcx.hir().local_def_id(item.id);
let impl_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let mut rc_vec = self.impls_map.inherent_impls
.entry(def_id)
.or_default();

View file

@ -120,7 +120,7 @@ fn visit_item(&mut self, item: &'v hir::Item) {
hir::ItemKind::Struct(..) |
hir::ItemKind::Trait(..) |
hir::ItemKind::Union(..) => {
let type_def_id = self.tcx.hir().local_def_id(item.id);
let type_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
self.check_for_overlapping_inherent_impls(type_def_id);
}
_ => {}

View file

@ -22,11 +22,11 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> {
/// to prevent inundating the user with a bunch of similar error
/// reports.
fn visit_item(&mut self, item: &hir::Item) {
let def_id = self.tcx.hir().local_def_id(item.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
// "Trait" impl
if let hir::ItemKind::Impl(.., Some(_), _, _) = item.node {
debug!("coherence2::orphan check: trait impl {}",
self.tcx.hir().node_to_string(item.id));
self.tcx.hir().hir_to_string(item.hir_id));
let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap();
let trait_def_id = trait_ref.def_id;
let cm = self.tcx.sess.source_map();

View file

@ -21,7 +21,8 @@ fn check_unsafety_coherence(&mut self,
unsafety: hir::Unsafety,
polarity: hir::ImplPolarity)
{
if let Some(trait_ref) = self.tcx.impl_trait_ref(self.tcx.hir().local_def_id(item.id)) {
let local_did = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
if let Some(trait_ref) = self.tcx.impl_trait_ref(local_did) {
let trait_def = self.tcx.trait_def(trait_ref.def_id);
let unsafe_attr = impl_generics.and_then(|generics| {
generics.params.iter().find(|p| p.pure_wrt_drop).map(|_| "may_dangle")

View file

@ -118,7 +118,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
convert_item(self.tcx, item.id);
convert_item(self.tcx, item.hir_id);
intravisit::walk_item(self, item);
}
@ -397,10 +397,10 @@ fn is_param<'a, 'tcx>(
}
}
fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) {
let it = tcx.hir().expect_item(item_id);
debug!("convert: item {} with id {}", it.ident, it.id);
let def_id = tcx.hir().local_def_id(item_id);
fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: hir::HirId) {
let it = tcx.hir().expect_item_by_hir_id(item_id);
debug!("convert: item {} with id {}", it.ident, it.hir_id);
let def_id = tcx.hir().local_def_id_from_hir_id(item_id);
match it.node {
// These don't define types.
hir::ItemKind::ExternCrate(_)
@ -577,7 +577,7 @@ fn convert_variant<'a, 'tcx>(
attribute_def_id: DefId
) -> ty::VariantDef {
let mut seen_fields: FxHashMap<ast::Ident, Span> = Default::default();
let node_id = tcx.hir().as_local_node_id(did).unwrap();
let hir_id = tcx.hir().as_local_hir_id(did).unwrap();
let fields = def
.fields()
.iter()
@ -601,7 +601,7 @@ fn convert_variant<'a, 'tcx>(
ty::FieldDef {
did: fid,
ident: f.ident,
vis: ty::Visibility::from_hir(&f.vis, node_id, tcx),
vis: ty::Visibility::from_hir(&f.vis, hir_id, tcx),
}
})
.collect();
@ -937,12 +937,12 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty
//
// Something of a hack: use the node id for the trait, also as
// the node id for the Self type parameter.
let param_id = item.id;
let param_id = item.hir_id;
opt_self = Some(ty::GenericParamDef {
index: 0,
name: keywords::SelfUpper.name().as_interned_str(),
def_id: tcx.hir().local_def_id(param_id),
def_id: tcx.hir().local_def_id_from_hir_id(param_id),
pure_wrt_drop: false,
kind: ty::GenericParamDefKind::Type {
has_default: false,
@ -1477,7 +1477,7 @@ fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'thi
intravisit::NestedVisitorMap::All(&self.tcx.hir())
}
fn visit_item(&mut self, it: &'tcx Item) {
let def_id = self.tcx.hir().local_def_id(it.id);
let def_id = self.tcx.hir().local_def_id_from_hir_id(it.hir_id);
// the existential type itself or its children are not within its reveal scope
if def_id != self.def_id {
self.check(def_id);

View file

@ -79,7 +79,7 @@ struct ImplWfCheck<'a, 'tcx: 'a> {
impl<'a, 'tcx> ItemLikeVisitor<'tcx> for ImplWfCheck<'a, 'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
if let hir::ItemKind::Impl(.., ref impl_item_refs) = item.node {
let impl_def_id = self.tcx.hir().local_def_id(item.id);
let impl_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
enforce_impl_params_are_constrained(self.tcx,
impl_def_id,
impl_item_refs);

View file

@ -52,16 +52,16 @@ pub struct InferVisitor<'cx, 'tcx: 'cx> {
impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
let item_did = self.tcx.hir().local_def_id(item.id);
let item_did = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
debug!("InferVisitor::visit_item(item={:?})", item_did);
let node_id = self
let hir_id = self
.tcx
.hir()
.as_local_node_id(item_did)
.as_local_hir_id(item_did)
.expect("expected local def-id");
let item = match self.tcx.hir().get(node_id) {
let item = match self.tcx.hir().get_by_hir_id(hir_id) {
Node::Item(item) => item,
_ => bug!(),
};

View file

@ -14,7 +14,7 @@ struct OutlivesTest<'a, 'tcx: 'a> {
impl<'a, 'tcx> ItemLikeVisitor<'tcx> for OutlivesTest<'a, 'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
let item_def_id = self.tcx.hir().local_def_id(item.id);
let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
// For unit testing: check for a special "rustc_outlives"
// attribute and report an error with various results if found.

View file

@ -128,7 +128,7 @@ fn add_inferreds_for_item(&mut self, id: hir::HirId) {
impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for TermsContext<'a, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
debug!("add_inferreds for item {}",
self.tcx.hir().node_to_string(item.id));
self.tcx.hir().hir_to_string(item.hir_id));
match item.node {
hir::ItemKind::Struct(ref struct_def, _) |

View file

@ -12,7 +12,7 @@ struct VarianceTest<'a, 'tcx: 'a> {
impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
let item_def_id = self.tcx.hir().local_def_id(item.id);
let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
// For unit testing: check for a special "rustc_variance"
// attribute and report an error with various results if found.

View file

@ -1725,7 +1725,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
(self.generics.clean(cx), (&self.decl, self.body).clean(cx))
});
let did = cx.tcx.hir().local_def_id(self.id);
let did = cx.tcx.hir().local_def_id_from_hir_id(self.id);
let constness = if cx.tcx.is_min_const_fn(did) {
hir::Constness::Const
} else {
@ -1932,7 +1932,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
name: Some(self.name.clean(cx)),
attrs: attrs,
source: self.whence.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id),
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
@ -1962,7 +1962,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
name: Some(self.name.clean(cx)),
attrs,
source: self.whence.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id),
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
@ -2994,7 +2994,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
name: Some(self.name.clean(cx)),
attrs: self.attrs.clean(cx),
source: self.whence.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id),
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
@ -3014,7 +3014,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
name: Some(self.name.clean(cx)),
attrs: self.attrs.clean(cx),
source: self.whence.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id),
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
@ -3061,7 +3061,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
name: Some(self.name.clean(cx)),
attrs: self.attrs.clean(cx),
source: self.whence.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id),
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
@ -3377,7 +3377,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
name: Some(self.name.clean(cx)),
attrs: self.attrs.clean(cx),
source: self.whence.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id.clone()),
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
@ -3401,7 +3401,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
name: Some(self.name.clean(cx)),
attrs: self.attrs.clean(cx),
source: self.whence.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id.clone()),
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
@ -3452,7 +3452,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
name: Some(self.name.clean(cx)),
attrs: self.attrs.clean(cx),
source: self.whence.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id),
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
@ -3477,7 +3477,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
name: Some(self.name.clean(cx)),
attrs: self.attrs.clean(cx),
source: self.whence.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id),
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
@ -3591,7 +3591,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec<Item> {
name: None,
attrs: self.attrs.clean(cx),
source: self.whence.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id),
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
@ -4038,7 +4038,7 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
visibility: Some(Public),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id),
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
inner: ProcMacroItem(ProcMacro {
kind: self.kind,
helpers: self.helpers.clean(cx),

View file

@ -89,7 +89,7 @@ pub struct Struct {
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
pub depr: Option<attr::Deprecation>,
pub id: NodeId,
pub id: hir::HirId,
pub struct_type: StructType,
pub name: Name,
pub generics: hir::Generics,
@ -102,7 +102,7 @@ pub struct Union {
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
pub depr: Option<attr::Deprecation>,
pub id: NodeId,
pub id: hir::HirId,
pub struct_type: StructType,
pub name: Name,
pub generics: hir::Generics,
@ -118,7 +118,7 @@ pub struct Enum {
pub variants: hir::HirVec<Variant>,
pub generics: hir::Generics,
pub attrs: hir::HirVec<ast::Attribute>,
pub id: NodeId,
pub id: hir::HirId,
pub whence: Span,
pub name: Name,
}
@ -135,7 +135,7 @@ pub struct Variant {
pub struct Function {
pub decl: hir::FnDecl,
pub attrs: hir::HirVec<ast::Attribute>,
pub id: NodeId,
pub id: hir::HirId,
pub name: Name,
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
@ -150,7 +150,7 @@ pub struct Typedef {
pub ty: P<hir::Ty>,
pub gen: hir::Generics,
pub name: Name,
pub id: ast::NodeId,
pub id: hir::HirId,
pub attrs: hir::HirVec<ast::Attribute>,
pub whence: Span,
pub vis: hir::Visibility,
@ -161,7 +161,7 @@ pub struct Typedef {
pub struct Existential {
pub exist_ty: hir::ExistTy,
pub name: Name,
pub id: ast::NodeId,
pub id: hir::HirId,
pub attrs: hir::HirVec<ast::Attribute>,
pub whence: Span,
pub vis: hir::Visibility,
@ -179,7 +179,7 @@ pub struct Static {
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
pub depr: Option<attr::Deprecation>,
pub id: ast::NodeId,
pub id: hir::HirId,
pub whence: Span,
}
@ -191,7 +191,7 @@ pub struct Constant {
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
pub depr: Option<attr::Deprecation>,
pub id: ast::NodeId,
pub id: hir::HirId,
pub whence: Span,
}
@ -203,7 +203,7 @@ pub struct Trait {
pub generics: hir::Generics,
pub bounds: hir::HirVec<hir::GenericBound>,
pub attrs: hir::HirVec<ast::Attribute>,
pub id: ast::NodeId,
pub id: hir::HirId,
pub whence: Span,
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
@ -215,7 +215,7 @@ pub struct TraitAlias {
pub generics: hir::Generics,
pub bounds: hir::HirVec<hir::GenericBound>,
pub attrs: hir::HirVec<ast::Attribute>,
pub id: ast::NodeId,
pub id: hir::HirId,
pub whence: Span,
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
@ -236,7 +236,7 @@ pub struct Impl {
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
pub depr: Option<attr::Deprecation>,
pub id: ast::NodeId,
pub id: hir::HirId,
}
// For Macro we store the DefId instead of the NodeId, since we also create
@ -263,7 +263,7 @@ pub struct ExternCrate {
pub struct Import {
pub name: Name,
pub id: NodeId,
pub id: hir::HirId,
pub vis: hir::Visibility,
pub attrs: hir::HirVec<ast::Attribute>,
pub path: hir::Path,
@ -273,7 +273,7 @@ pub struct Import {
pub struct ProcMacro {
pub name: Name,
pub id: NodeId,
pub id: hir::HirId,
pub kind: MacroKind,
pub helpers: Vec<Name>,
pub attrs: hir::HirVec<ast::Attribute>,

View file

@ -101,7 +101,7 @@ pub fn visit_variant_data(&mut self, item: &hir::Item,
debug!("Visiting struct");
let struct_type = struct_type_from_def(&*sd);
Struct {
id: item.id,
id: item.hir_id,
struct_type,
name,
vis: item.vis.clone(),
@ -120,7 +120,7 @@ pub fn visit_union_data(&mut self, item: &hir::Item,
debug!("Visiting union");
let struct_type = struct_type_from_def(&*sd);
Union {
id: item.id,
id: item.hir_id,
struct_type,
name,
vis: item.vis.clone(),
@ -152,7 +152,7 @@ pub fn visit_enum_def(&mut self, it: &hir::Item,
depr: self.deprecation(it.hir_id),
generics: params.clone(),
attrs: it.attrs.clone(),
id: it.id,
id: it.hir_id,
whence: it.span,
}
}
@ -202,7 +202,7 @@ pub fn visit_fn(&mut self, om: &mut Module, item: &hir::Item,
om.proc_macros.push(ProcMacro {
name,
id: item.id,
id: item.hir_id,
kind,
helpers,
attrs: item.attrs.clone(),
@ -213,7 +213,7 @@ pub fn visit_fn(&mut self, om: &mut Module, item: &hir::Item,
}
None => {
om.fns.push(Function {
id: item.id,
id: item.hir_id,
vis: item.vis.clone(),
stab: self.stability(item.hir_id),
depr: self.deprecation(item.hir_id),
@ -262,7 +262,7 @@ pub fn visit_mod_contents(&mut self, span: Span, attrs: hir::HirVec<ast::Attribu
///
/// Returns `true` if the target has been inlined.
fn maybe_inline_local(&mut self,
id: ast::NodeId,
id: hir::HirId,
def: Def,
renamed: Option<ast::Ident>,
glob: bool,
@ -291,7 +291,7 @@ fn inherits_doc_hidden(cx: &core::DocContext<'_, '_, '_>, mut node: ast::NodeId)
return false;
};
let use_attrs = tcx.hir().attrs(id);
let use_attrs = tcx.hir().attrs_by_hir_id(id);
// Don't inline `doc(hidden)` imports so they can be stripped at a later stage.
let is_no_inline = use_attrs.lists("doc").has_word("no_inline") ||
use_attrs.lists("doc").has_word("hidden");
@ -381,7 +381,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
let ident = renamed.unwrap_or(item.ident);
if item.vis.node.is_pub() {
let def_id = self.cx.tcx.hir().local_def_id(item.id);
let def_id = self.cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
self.store_path(def_id);
}
@ -401,7 +401,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
_ if self.inlining && !item.vis.node.is_pub() => {}
hir::ItemKind::GlobalAsm(..) => {}
hir::ItemKind::ExternCrate(orig_name) => {
let def_id = self.cx.tcx.hir().local_def_id(item.id);
let def_id = self.cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
om.extern_crates.push(ExternCrate {
cnum: self.cx.tcx.extern_mod_stmt_cnum(def_id)
.unwrap_or(LOCAL_CRATE),
@ -436,7 +436,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
}
});
let ident = if is_glob { None } else { Some(ident) };
if self.maybe_inline_local(item.id,
if self.maybe_inline_local(item.hir_id,
path.def,
ident,
is_glob,
@ -448,7 +448,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
om.imports.push(Import {
name: ident.name,
id: item.id,
id: item.hir_id,
vis: item.vis.clone(),
attrs: item.attrs.clone(),
path: (**path).clone(),
@ -477,7 +477,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
ty: ty.clone(),
gen: gen.clone(),
name: ident.name,
id: item.id,
id: item.hir_id,
attrs: item.attrs.clone(),
whence: item.span,
vis: item.vis.clone(),
@ -490,7 +490,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
let t = Existential {
exist_ty: exist_ty.clone(),
name: ident.name,
id: item.id,
id: item.hir_id,
attrs: item.attrs.clone(),
whence: item.span,
vis: item.vis.clone(),
@ -504,7 +504,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
type_: ty.clone(),
mutability: mut_.clone(),
expr: exp.clone(),
id: item.id,
id: item.hir_id,
name: ident.name,
attrs: item.attrs.clone(),
whence: item.span,
@ -518,7 +518,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
let s = Constant {
type_: ty.clone(),
expr: exp.clone(),
id: item.id,
id: item.hir_id,
name: ident.name,
attrs: item.attrs.clone(),
whence: item.span,
@ -539,7 +539,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
items,
generics: gen.clone(),
bounds: b.iter().cloned().collect(),
id: item.id,
id: item.hir_id,
attrs: item.attrs.clone(),
whence: item.span,
vis: item.vis.clone(),
@ -553,7 +553,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
name: ident.name,
generics: gen.clone(),
bounds: b.iter().cloned().collect(),
id: item.id,
id: item.hir_id,
attrs: item.attrs.clone(),
whence: item.span,
vis: item.vis.clone(),
@ -585,7 +585,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
for_: ty.clone(),
items,
attrs: item.attrs.clone(),
id: item.id,
id: item.hir_id,
whence: item.span,
vis: item.vis.clone(),
stab: self.stability(item.hir_id),