rename hir::map::local_def_id_from_hir_id to local_def_id
This commit is contained in:
parent
4f7ba515c2
commit
37d7e1f22a
@ -95,7 +95,7 @@ impl CheckAttrVisitor<'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_from_hir_id(item.hir_id));
|
||||
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.hir_id));
|
||||
} else if let Some(a) = item.attrs.iter().find(|a| a.check_name(sym::target_feature)) {
|
||||
self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function")
|
||||
.span_label(item.span, "not a function")
|
||||
|
@ -80,7 +80,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> {
|
||||
hir_id: HirId,
|
||||
walk: F) {
|
||||
assert!(self.owner_def_index.is_none());
|
||||
let owner_def_index = self.hir_map.local_def_id_from_hir_id(hir_id).index;
|
||||
let owner_def_index = self.hir_map.local_def_id(hir_id).index;
|
||||
self.owner_def_index = Some(owner_def_index);
|
||||
walk(self);
|
||||
|
||||
|
@ -240,9 +240,9 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn local_def_id_from_hir_id(&self, hir_id: HirId) -> DefId {
|
||||
self.opt_local_def_id_from_hir_id(hir_id).unwrap_or_else(|| {
|
||||
bug!("local_def_id_from_hir_id: no entry for `{:?}`, which has a map of `{:?}`",
|
||||
pub fn local_def_id(&self, hir_id: HirId) -> DefId {
|
||||
self.opt_local_def_id(hir_id).unwrap_or_else(|| {
|
||||
bug!("local_def_id: no entry for `{:?}`, which has a map of `{:?}`",
|
||||
hir_id, self.find_entry(hir_id))
|
||||
})
|
||||
}
|
||||
@ -427,7 +427,7 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
|
||||
pub fn body_owner_def_id(&self, id: BodyId) -> DefId {
|
||||
self.local_def_id_from_hir_id(self.body_owner(id))
|
||||
self.local_def_id(self.body_owner(id))
|
||||
}
|
||||
|
||||
/// Given a `HirId`, returns the `BodyId` associated with it,
|
||||
@ -763,7 +763,7 @@ impl<'hir> Map<'hir> {
|
||||
/// Returns the `DefId` of `id`'s nearest module parent, or `id` itself if no
|
||||
/// module parent is in this map.
|
||||
pub fn get_module_parent(&self, id: HirId) -> DefId {
|
||||
self.local_def_id_from_hir_id(self.get_module_parent_node(id))
|
||||
self.local_def_id(self.get_module_parent_node(id))
|
||||
}
|
||||
|
||||
/// Returns the `HirId` of `id`'s nearest module parent, or `id` itself if no
|
||||
@ -839,7 +839,7 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
|
||||
pub fn get_parent_did(&self, id: HirId) -> DefId {
|
||||
self.local_def_id_from_hir_id(self.get_parent_item(id))
|
||||
self.local_def_id(self.get_parent_item(id))
|
||||
}
|
||||
|
||||
pub fn get_foreign_abi(&self, hir_id: HirId) -> Abi {
|
||||
@ -1245,7 +1245,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
|
||||
// the user-friendly path, otherwise fall back to stringifying DefPath.
|
||||
crate::ty::tls::with_opt(|tcx| {
|
||||
if let Some(tcx) = tcx {
|
||||
let def_id = map.local_def_id_from_hir_id(id);
|
||||
let def_id = map.local_def_id(id);
|
||||
tcx.def_path_str(def_id)
|
||||
} else if let Some(path) = map.def_path_from_hir_id(id) {
|
||||
path.data.into_iter().map(|elem| {
|
||||
|
@ -83,7 +83,7 @@ impl Visitor<'tcx> for CaptureCollector<'a, 'tcx> {
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
|
||||
if let hir::ExprKind::Closure(..) = expr.node {
|
||||
let closure_def_id = self.tcx.hir().local_def_id_from_hir_id(expr.hir_id);
|
||||
let closure_def_id = self.tcx.hir().local_def_id(expr.hir_id);
|
||||
if let Some(upvars) = self.tcx.upvars(closure_def_id) {
|
||||
// Every capture of a closure expression is a local in scope,
|
||||
// that is moved/copied/borrowed into the closure value, and
|
||||
|
@ -951,8 +951,8 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
|
||||
let parent_def_id = self.parent_def_id;
|
||||
let def_scope_default = || {
|
||||
let opaque_parent_hir_id = tcx.hir().get_parent_item(opaque_hir_id);
|
||||
parent_def_id
|
||||
== tcx.hir().local_def_id_from_hir_id(opaque_parent_hir_id)
|
||||
parent_def_id == tcx.hir()
|
||||
.local_def_id(opaque_parent_hir_id)
|
||||
};
|
||||
let (in_definition_scope, origin) = match tcx.hir().find(opaque_hir_id) {
|
||||
Some(Node::Item(item)) => match item.node {
|
||||
|
@ -926,7 +926,7 @@ impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> LateContextAndPass<'a, 'tcx, T> {
|
||||
{
|
||||
let old_param_env = self.context.param_env;
|
||||
self.context.param_env = self.context.tcx.param_env(
|
||||
self.context.tcx.hir().local_def_id_from_hir_id(id)
|
||||
self.context.tcx.hir().local_def_id(id)
|
||||
);
|
||||
f(self);
|
||||
self.context.param_env = old_param_env;
|
||||
|
@ -161,7 +161,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
|
||||
Node::Item(item) => {
|
||||
match item.node {
|
||||
hir::ItemKind::Struct(..) | hir::ItemKind::Union(..) => {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
let def = self.tcx.adt_def(def_id);
|
||||
self.repr_has_repr_c = def.repr.c();
|
||||
|
||||
@ -325,7 +325,7 @@ fn has_allow_dead_code_or_lang_attr(
|
||||
return true;
|
||||
}
|
||||
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
let cg_attrs = tcx.codegen_fn_attrs(def_id);
|
||||
|
||||
// #[used], #[no_mangle], #[export_name], etc also keeps the item alive
|
||||
@ -494,7 +494,7 @@ impl DeadVisitor<'tcx> {
|
||||
}
|
||||
|
||||
fn should_warn_about_field(&mut self, field: &hir::StructField) -> bool {
|
||||
let field_type = self.tcx.type_of(self.tcx.hir().local_def_id_from_hir_id(field.hir_id));
|
||||
let field_type = self.tcx.type_of(self.tcx.hir().local_def_id(field.hir_id));
|
||||
!field.is_positional()
|
||||
&& !self.symbol_is_live(field.hir_id)
|
||||
&& !field_type.is_phantom_data()
|
||||
@ -525,7 +525,7 @@ impl DeadVisitor<'tcx> {
|
||||
// This is done to handle the case where, for example, the static
|
||||
// method of a private type is used, but the type itself is never
|
||||
// called directly.
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = self.tcx.hir().local_def_id(id);
|
||||
let inherent_impls = self.tcx.inherent_impls(def_id);
|
||||
for &impl_did in inherent_impls.iter() {
|
||||
for &item_did in &self.tcx.associated_item_def_ids(impl_did)[..] {
|
||||
|
@ -32,7 +32,7 @@ struct EntryContext<'a, 'tcx> {
|
||||
|
||||
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_from_hir_id(item.hir_id);
|
||||
let def_id = self.map.local_def_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);
|
||||
@ -142,11 +142,11 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
|
||||
|
||||
fn configure_main(tcx: TyCtxt<'_>, visitor: &EntryContext<'_, '_>) -> Option<(DefId, EntryFnType)> {
|
||||
if let Some((hir_id, _)) = visitor.start_fn {
|
||||
Some((tcx.hir().local_def_id_from_hir_id(hir_id), EntryFnType::Start))
|
||||
Some((tcx.hir().local_def_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))
|
||||
Some((tcx.hir().local_def_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))
|
||||
Some((tcx.hir().local_def_id(hir_id), EntryFnType::Main))
|
||||
} else {
|
||||
// No main function
|
||||
let mut err = struct_err!(tcx.sess, E0601,
|
||||
|
@ -930,7 +930,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
|
||||
fn walk_captures(&mut self, closure_expr: &hir::Expr, fn_decl_span: Span) {
|
||||
debug!("walk_captures({:?})", closure_expr);
|
||||
|
||||
let closure_def_id = self.tcx().hir().local_def_id_from_hir_id(closure_expr.hir_id);
|
||||
let closure_def_id = self.tcx().hir().local_def_id(closure_expr.hir_id);
|
||||
if let Some(upvars) = self.tcx().upvars(closure_def_id) {
|
||||
for (&var_id, upvar) in upvars.iter() {
|
||||
let upvar_id = ty::UpvarId {
|
||||
|
@ -118,7 +118,7 @@ impl ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> {
|
||||
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_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
self.collect_item(item_index, def_id);
|
||||
},
|
||||
// Known lang item with attribute on incorrect target.
|
||||
|
@ -363,7 +363,7 @@ fn visit_fn<'tcx>(
|
||||
debug!("visit_fn");
|
||||
|
||||
// swap in a new set of IR maps for this function body:
|
||||
let def_id = ir.tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = ir.tcx.hir().local_def_id(id);
|
||||
let mut fn_maps = IrMaps::new(ir.tcx, def_id);
|
||||
|
||||
// Don't run unused pass for #[derive()]
|
||||
@ -494,7 +494,7 @@ fn visit_expr<'tcx>(ir: &mut IrMaps<'tcx>, expr: &'tcx Expr) {
|
||||
// in better error messages than just pointing at the closure
|
||||
// construction site.
|
||||
let mut call_caps = Vec::new();
|
||||
let closure_def_id = ir.tcx.hir().local_def_id_from_hir_id(expr.hir_id);
|
||||
let closure_def_id = ir.tcx.hir().local_def_id(expr.hir_id);
|
||||
if let Some(upvars) = ir.tcx.upvars(closure_def_id) {
|
||||
let parent_upvars = ir.tcx.upvars(ir.body_owner);
|
||||
call_caps.extend(upvars.iter().filter_map(|(&var_id, upvar)| {
|
||||
|
@ -35,7 +35,7 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item, attrs: CodegenFnAt
|
||||
match item.node {
|
||||
hir::ItemKind::Impl(..) |
|
||||
hir::ItemKind::Fn(..) => {
|
||||
let generics = tcx.generics_of(tcx.hir().local_def_id_from_hir_id(item.hir_id));
|
||||
let generics = tcx.generics_of(tcx.hir().local_def_id(item.hir_id));
|
||||
generics.requires_monomorphization(tcx)
|
||||
}
|
||||
_ => false,
|
||||
@ -48,7 +48,7 @@ fn method_might_be_inlined(
|
||||
impl_src: DefId,
|
||||
) -> bool {
|
||||
let codegen_fn_attrs = tcx.codegen_fn_attrs(impl_item.hir_id.owner_def_id());
|
||||
let generics = tcx.generics_of(tcx.hir().local_def_id_from_hir_id(impl_item.hir_id));
|
||||
let generics = tcx.generics_of(tcx.hir().local_def_id(impl_item.hir_id));
|
||||
if codegen_fn_attrs.requests_inline() || generics.requires_monomorphization(tcx) {
|
||||
return true
|
||||
}
|
||||
@ -222,7 +222,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
|
||||
} else {
|
||||
false
|
||||
};
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
let codegen_attrs = self.tcx.codegen_fn_attrs(def_id);
|
||||
let is_extern = codegen_attrs.contains_extern_indicator();
|
||||
let std_internal = codegen_attrs.flags.contains(
|
||||
@ -243,7 +243,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
|
||||
Node::Item(item) => {
|
||||
match item.node {
|
||||
hir::ItemKind::Fn(.., body) => {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
if item_might_be_inlined(self.tcx,
|
||||
&item,
|
||||
self.tcx.codegen_fn_attrs(def_id)) {
|
||||
@ -345,7 +345,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, 'tcx
|
||||
// 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_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_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) {
|
||||
|
@ -675,7 +675,7 @@ impl<'tcx> ScopeTree {
|
||||
&format!("free_scope: {:?} not recognized by the \
|
||||
region scope tree for {:?} / {:?}",
|
||||
param_owner,
|
||||
self.root_parent.map(|id| tcx.hir().local_def_id_from_hir_id(id)),
|
||||
self.root_parent.map(|id| tcx.hir().local_def_id(id)),
|
||||
self.root_body.map(|hir_id| DefId::local(hir_id.owner))));
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ impl Region {
|
||||
fn early(hir_map: &Map<'_>, index: &mut u32, param: &GenericParam) -> (ParamName, Region) {
|
||||
let i = *index;
|
||||
*index += 1;
|
||||
let def_id = hir_map.local_def_id_from_hir_id(param.hir_id);
|
||||
let def_id = hir_map.local_def_id(param.hir_id);
|
||||
let origin = LifetimeDefOrigin::from_param(param);
|
||||
debug!("Region::early: index={} def_id={:?}", i, def_id);
|
||||
(param.name.modern(), Region::EarlyBound(i, def_id, origin))
|
||||
@ -91,7 +91,7 @@ impl Region {
|
||||
|
||||
fn late(hir_map: &Map<'_>, param: &GenericParam) -> (ParamName, Region) {
|
||||
let depth = ty::INNERMOST;
|
||||
let def_id = hir_map.local_def_id_from_hir_id(param.hir_id);
|
||||
let def_id = hir_map.local_def_id(param.hir_id);
|
||||
let origin = LifetimeDefOrigin::from_param(param);
|
||||
debug!(
|
||||
"Region::late: param={:?} depth={:?} def_id={:?} origin={:?}",
|
||||
@ -1326,7 +1326,7 @@ fn object_lifetime_defaults_for_item(
|
||||
|
||||
add_bounds(&mut set, ¶m.bounds);
|
||||
|
||||
let param_def_id = tcx.hir().local_def_id_from_hir_id(param.hir_id);
|
||||
let param_def_id = tcx.hir().local_def_id(param.hir_id);
|
||||
for predicate in &generics.where_clause.predicates {
|
||||
// Look for `type: ...` where clauses.
|
||||
let data = match *predicate {
|
||||
@ -1370,7 +1370,7 @@ fn object_lifetime_defaults_for_item(
|
||||
.enumerate()
|
||||
.find(|&(_, (_, lt_name, _))| lt_name == name)
|
||||
.map_or(Set1::Many, |(i, (id, _, origin))| {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
Set1::One(Region::EarlyBound(i as u32, def_id, origin))
|
||||
})
|
||||
}
|
||||
@ -1835,7 +1835,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||
node: hir::ImplItemKind::Method(..),
|
||||
..
|
||||
}) => {
|
||||
let scope = self.tcx.hir().local_def_id_from_hir_id(fn_id);
|
||||
let scope = self.tcx.hir().local_def_id(fn_id);
|
||||
def = Region::Free(scope, def.id().unwrap());
|
||||
}
|
||||
_ => {}
|
||||
|
@ -361,7 +361,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) {
|
||||
let impl_def_id = self.tcx.hir().local_def_id_from_hir_id(
|
||||
let impl_def_id = self.tcx.hir().local_def_id(
|
||||
self.tcx.hir().get_parent_item(ii.hir_id));
|
||||
if self.tcx.impl_trait_ref(impl_def_id).is_none() {
|
||||
self.check_missing_stability(ii.hir_id, ii.span, "item");
|
||||
@ -598,7 +598,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
// Deprecated attributes apply in-crate and cross-crate.
|
||||
if let Some(id) = id {
|
||||
if let Some(depr_entry) = self.lookup_deprecation_entry(def_id) {
|
||||
let parent_def_id = self.hir().local_def_id_from_hir_id(
|
||||
let parent_def_id = self.hir().local_def_id(
|
||||
self.hir().get_parent_item(id));
|
||||
let skip = self.lookup_deprecation_entry(parent_def_id)
|
||||
.map_or(false, |parent_depr| parent_depr.same_origin(&depr_entry));
|
||||
@ -766,7 +766,7 @@ impl Visitor<'tcx> for Checker<'tcx> {
|
||||
// compiler-generated `extern crate` items have a dummy span.
|
||||
if item.span.is_dummy() { return }
|
||||
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
let cnum = match self.tcx.extern_mod_stmt_cnum(def_id) {
|
||||
Some(cnum) => cnum,
|
||||
None => return,
|
||||
@ -796,7 +796,7 @@ impl Visitor<'tcx> for Checker<'tcx> {
|
||||
// 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_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
let adt_def = self.tcx.adt_def(def_id);
|
||||
let ty = self.tcx.type_of(def_id);
|
||||
|
||||
|
@ -79,7 +79,7 @@ impl<'tcx> MonoItem<'tcx> {
|
||||
tcx.symbol_name(Instance::mono(tcx, def_id))
|
||||
}
|
||||
MonoItem::GlobalAsm(hir_id) => {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let def_id = tcx.hir().local_def_id(hir_id);
|
||||
SymbolName {
|
||||
name: InternedString::intern(&format!("global_asm_{:?}", def_id))
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ impl<'tcx> DefIdForest {
|
||||
/// crate.
|
||||
#[inline]
|
||||
pub fn full(tcx: TyCtxt<'tcx>) -> DefIdForest {
|
||||
let crate_id = tcx.hir().local_def_id_from_hir_id(CRATE_HIR_ID);
|
||||
let crate_id = tcx.hir().local_def_id(CRATE_HIR_ID);
|
||||
DefIdForest::from_id(crate_id)
|
||||
}
|
||||
|
||||
|
@ -2816,7 +2816,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
parent_vis: &hir::Visibility,
|
||||
trait_item_ref: &hir::TraitItemRef)
|
||||
-> AssocItem {
|
||||
let def_id = self.hir().local_def_id_from_hir_id(trait_item_ref.id.hir_id);
|
||||
let def_id = self.hir().local_def_id(trait_item_ref.id.hir_id);
|
||||
let (kind, has_self) = match trait_item_ref.kind {
|
||||
hir::AssocItemKind::Const => (ty::AssocKind::Const, false),
|
||||
hir::AssocItemKind::Method { has_self } => {
|
||||
@ -2842,7 +2842,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
parent_def_id: DefId,
|
||||
impl_item_ref: &hir::ImplItemRef)
|
||||
-> AssocItem {
|
||||
let def_id = self.hir().local_def_id_from_hir_id(impl_item_ref.id.hir_id);
|
||||
let def_id = self.hir().local_def_id(impl_item_ref.id.hir_id);
|
||||
let (kind, has_self) = match impl_item_ref.kind {
|
||||
hir::AssocItemKind::Const => (ty::AssocKind::Const, false),
|
||||
hir::AssocItemKind::Method { has_self } => {
|
||||
@ -3114,7 +3114,7 @@ impl Iterator for AssocItemsIterator<'_> {
|
||||
fn associated_item(tcx: TyCtxt<'_>, def_id: DefId) -> AssocItem {
|
||||
let id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
let parent_id = tcx.hir().get_parent_item(id);
|
||||
let parent_def_id = tcx.hir().local_def_id_from_hir_id(parent_id);
|
||||
let parent_def_id = tcx.hir().local_def_id(parent_id);
|
||||
let parent_item = tcx.hir().expect_item(parent_id);
|
||||
match parent_item.node {
|
||||
hir::ItemKind::Impl(.., ref impl_item_refs) => {
|
||||
@ -3178,14 +3178,14 @@ fn associated_item_def_ids(tcx: TyCtxt<'_>, def_id: DefId) -> &[DefId] {
|
||||
tcx.arena.alloc_from_iter(
|
||||
trait_item_refs.iter()
|
||||
.map(|trait_item_ref| trait_item_ref.id)
|
||||
.map(|id| tcx.hir().local_def_id_from_hir_id(id.hir_id))
|
||||
.map(|id| tcx.hir().local_def_id(id.hir_id))
|
||||
)
|
||||
}
|
||||
hir::ItemKind::Impl(.., ref impl_item_refs) => {
|
||||
tcx.arena.alloc_from_iter(
|
||||
impl_item_refs.iter()
|
||||
.map(|impl_item_ref| impl_item_ref.id)
|
||||
.map(|id| tcx.hir().local_def_id_from_hir_id(id.hir_id))
|
||||
.map(|id| tcx.hir().local_def_id(id.hir_id))
|
||||
)
|
||||
}
|
||||
hir::ItemKind::TraitAlias(..) => &[],
|
||||
|
@ -186,7 +186,7 @@ pub(super) fn trait_impls_of_provider(
|
||||
}
|
||||
|
||||
for &hir_id in tcx.hir().trait_impls(trait_id) {
|
||||
add_impl(tcx.hir().local_def_id_from_hir_id(hir_id));
|
||||
add_impl(tcx.hir().local_def_id(hir_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>(
|
||||
cfg: &cfg::CFG,
|
||||
) -> (BorrowckCtxt<'a, 'tcx>, AnalysisData<'tcx>) {
|
||||
let owner_id = tcx.hir().body_owner(body_id);
|
||||
let owner_def_id = tcx.hir().local_def_id_from_hir_id(owner_id);
|
||||
let owner_def_id = tcx.hir().local_def_id(owner_id);
|
||||
let tables = tcx.typeck_tables_of(owner_def_id);
|
||||
let region_scope_tree = tcx.region_scope_tree(owner_def_id);
|
||||
let body = tcx.hir().body(body_id);
|
||||
|
@ -84,7 +84,7 @@ fn reachable_non_generics_provider(
|
||||
// let it through if it's included statically.
|
||||
match tcx.hir().get(hir_id) {
|
||||
Node::ForeignItem(..) => {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let def_id = tcx.hir().local_def_id(hir_id);
|
||||
if tcx.is_statically_included_foreign_item(def_id) {
|
||||
Some(def_id)
|
||||
} else {
|
||||
@ -104,7 +104,7 @@ fn reachable_non_generics_provider(
|
||||
node: hir::ImplItemKind::Method(..),
|
||||
..
|
||||
}) => {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let def_id = tcx.hir().local_def_id(hir_id);
|
||||
let generics = tcx.generics_of(def_id);
|
||||
if !generics.requires_monomorphization(tcx) &&
|
||||
// Functions marked with #[inline] are only ever codegened
|
||||
|
@ -33,7 +33,7 @@ impl SymbolNamesTest<'tcx> {
|
||||
fn process_attrs(&mut self,
|
||||
hir_id: hir::HirId) {
|
||||
let tcx = self.tcx;
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let def_id = tcx.hir().local_def_id(hir_id);
|
||||
for attr in tcx.get_attrs(def_id).iter() {
|
||||
if attr.check_name(SYMBOL_NAME) {
|
||||
// for now, can only use on monomorphic names
|
||||
|
@ -471,7 +471,7 @@ impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> {
|
||||
}
|
||||
|
||||
fn node_path(&self, id: hir::HirId) -> Option<String> {
|
||||
Some(self.tcx.def_path_str(self.tcx.hir().local_def_id_from_hir_id(id)))
|
||||
Some(self.tcx.def_path_str(self.tcx.hir().local_def_id(id)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ impl IfThisChanged<'tcx> {
|
||||
}
|
||||
|
||||
fn process_attrs(&mut self, hir_id: hir::HirId, attrs: &[ast::Attribute]) {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(hir_id);
|
||||
let def_path_hash = self.tcx.def_path_hash(def_id);
|
||||
for attr in attrs {
|
||||
if attr.check_name(ATTR_IF_THIS_CHANGED) {
|
||||
|
@ -500,7 +500,7 @@ impl DirtyCleanVisitor<'tcx> {
|
||||
}
|
||||
|
||||
fn check_item(&mut self, item_id: hir::HirId, item_span: Span) {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(item_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item_id);
|
||||
for attr in self.tcx.get_attrs(def_id).iter() {
|
||||
let assertion = match self.assertion_maybe(item_id, attr) {
|
||||
Some(a) => a,
|
||||
|
@ -16,7 +16,7 @@ fn proc_macro_decls_static(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<DefId> {
|
||||
let mut finder = Finder { decls: None };
|
||||
tcx.hir().krate().visit_all_item_likes(&mut finder);
|
||||
|
||||
finder.decls.map(|id| tcx.hir().local_def_id_from_hir_id(id))
|
||||
finder.decls.map(|id| tcx.hir().local_def_id(id))
|
||||
}
|
||||
|
||||
struct Finder {
|
||||
|
@ -114,7 +114,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers {
|
||||
hir::ItemKind::Enum(..) |
|
||||
hir::ItemKind::Struct(..) |
|
||||
hir::ItemKind::Union(..) => {
|
||||
let def_id = cx.tcx.hir().local_def_id_from_hir_id(it.hir_id);
|
||||
let def_id = cx.tcx.hir().local_def_id(it.hir_id);
|
||||
self.check_heap_type(cx, it.span, cx.tcx.type_of(def_id))
|
||||
}
|
||||
_ => ()
|
||||
@ -125,7 +125,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers {
|
||||
hir::ItemKind::Struct(ref struct_def, _) |
|
||||
hir::ItemKind::Union(ref struct_def, _) => {
|
||||
for struct_field in struct_def.fields() {
|
||||
let def_id = cx.tcx.hir().local_def_id_from_hir_id(struct_field.hir_id);
|
||||
let def_id = cx.tcx.hir().local_def_id(struct_field.hir_id);
|
||||
self.check_heap_type(cx, struct_field.span,
|
||||
cx.tcx.type_of(def_id));
|
||||
}
|
||||
@ -500,21 +500,21 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations {
|
||||
if !ast_generics.params.is_empty() {
|
||||
return;
|
||||
}
|
||||
let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id_from_hir_id(item.hir_id));
|
||||
let def = cx.tcx.adt_def(cx.tcx.hir().local_def_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_from_hir_id(item.hir_id));
|
||||
let def = cx.tcx.adt_def(cx.tcx.hir().local_def_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_from_hir_id(item.hir_id));
|
||||
let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id(item.hir_id));
|
||||
(def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[])))
|
||||
}
|
||||
_ => return,
|
||||
@ -792,7 +792,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PluginAsLibrary {
|
||||
_ => return,
|
||||
};
|
||||
|
||||
let def_id = cx.tcx.hir().local_def_id_from_hir_id(it.hir_id);
|
||||
let def_id = cx.tcx.hir().local_def_id(it.hir_id);
|
||||
let prfn = match cx.tcx.extern_mod_stmt_cnum(def_id) {
|
||||
Some(cnum) => cx.tcx.plugin_registrar_fn(cnum),
|
||||
None => {
|
||||
@ -973,7 +973,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnionsWithDropFields {
|
||||
if let hir::ItemKind::Union(ref vdata, _) = item.node {
|
||||
for field in vdata.fields() {
|
||||
let field_ty = ctx.tcx.type_of(
|
||||
ctx.tcx.hir().local_def_id_from_hir_id(field.hir_id));
|
||||
ctx.tcx.hir().local_def_id(field.hir_id));
|
||||
if field_ty.needs_drop(ctx.tcx, ctx.param_env) {
|
||||
ctx.span_lint(UNIONS_WITH_DROP_FIELDS,
|
||||
field.span,
|
||||
@ -1216,7 +1216,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TrivialConstraints {
|
||||
use rustc::ty::Predicate::*;
|
||||
|
||||
if cx.tcx.features().trivial_bounds {
|
||||
let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = cx.tcx.hir().local_def_id(item.hir_id);
|
||||
let predicates = cx.tcx.predicates_of(def_id);
|
||||
for &(predicate, span) in &predicates.predicates {
|
||||
let predicate_kind_name = match predicate {
|
||||
@ -1541,7 +1541,7 @@ impl ExplicitOutlivesRequirements {
|
||||
ty_generics: &'tcx ty::Generics,
|
||||
) -> Vec<ty::Region<'tcx>> {
|
||||
let index = ty_generics.param_def_id_to_index[
|
||||
&tcx.hir().local_def_id_from_hir_id(param.hir_id)];
|
||||
&tcx.hir().local_def_id(param.hir_id)];
|
||||
|
||||
match param.kind {
|
||||
hir::GenericParamKind::Lifetime { .. } => {
|
||||
@ -1659,7 +1659,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
|
||||
use rustc::middle::resolve_lifetime::Region;
|
||||
|
||||
let infer_static = cx.tcx.features().infer_static_outlives_requirements;
|
||||
let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = cx.tcx.hir().local_def_id(item.hir_id);
|
||||
if let hir::ItemKind::Struct(_, ref hir_generics)
|
||||
| hir::ItemKind::Enum(_, ref hir_generics)
|
||||
| hir::ItemKind::Union(_, ref hir_generics) = item.node
|
||||
|
@ -20,7 +20,7 @@ pub enum MethodLateContext {
|
||||
}
|
||||
|
||||
pub fn method_context(cx: &LateContext<'_, '_>, id: hir::HirId) -> MethodLateContext {
|
||||
let def_id = cx.tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = cx.tcx.hir().local_def_id(id);
|
||||
let item = cx.tcx.associated_item(def_id);
|
||||
match item.container {
|
||||
ty::TraitContainer(..) => MethodLateContext::TraitAutoImpl,
|
||||
|
@ -888,7 +888,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn check_foreign_fn(&mut self, id: hir::HirId, decl: &hir::FnDecl) {
|
||||
let def_id = self.cx.tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = self.cx.tcx.hir().local_def_id(id);
|
||||
let sig = self.cx.tcx.fn_sig(def_id);
|
||||
let sig = self.cx.tcx.erase_late_bound_regions(&sig);
|
||||
let inputs = if sig.c_variadic {
|
||||
@ -912,7 +912,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn check_foreign_static(&mut self, id: hir::HirId, span: Span) {
|
||||
let def_id = self.cx.tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = self.cx.tcx.hir().local_def_id(id);
|
||||
let ty = self.cx.tcx.type_of(def_id);
|
||||
self.check_type_for_ffi_and_report_errors(span, ty);
|
||||
}
|
||||
@ -941,7 +941,7 @@ declare_lint_pass!(VariantSizeDifferences => [VARIANT_SIZE_DIFFERENCES]);
|
||||
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_from_hir_id(it.hir_id);
|
||||
let item_def_id = cx.tcx.hir().local_def_id(it.hir_id);
|
||||
let t = cx.tcx.type_of(item_def_id);
|
||||
let ty = cx.tcx.erase_regions(&t);
|
||||
let layout = match cx.layout_of(ty) {
|
||||
|
@ -667,7 +667,7 @@ impl EncodeContext<'tcx> {
|
||||
(id, md, attrs, vis): (hir::HirId, &hir::Mod, &[ast::Attribute], &hir::Visibility),
|
||||
) -> Entry<'tcx> {
|
||||
let tcx = self.tcx;
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
debug!("EncodeContext::encode_info_for_mod({:?})", def_id);
|
||||
|
||||
let data = ModData {
|
||||
@ -683,7 +683,7 @@ impl EncodeContext<'tcx> {
|
||||
span: self.lazy(&tcx.def_span(def_id)),
|
||||
attributes: self.encode_attributes(attrs),
|
||||
children: self.lazy_seq(md.item_ids.iter().map(|item_id| {
|
||||
tcx.hir().local_def_id_from_hir_id(item_id.id).index
|
||||
tcx.hir().local_def_id(item_id.id).index
|
||||
})),
|
||||
stability: self.encode_stability(def_id),
|
||||
deprecation: self.encode_deprecation(def_id),
|
||||
@ -1105,7 +1105,7 @@ impl EncodeContext<'tcx> {
|
||||
// for methods, write all the stuff get_trait_method
|
||||
// needs to know
|
||||
let ctor = struct_def.ctor_hir_id()
|
||||
.map(|ctor_hir_id| tcx.hir().local_def_id_from_hir_id(ctor_hir_id).index);
|
||||
.map(|ctor_hir_id| tcx.hir().local_def_id(ctor_hir_id).index);
|
||||
|
||||
let repr_options = get_repr_options(tcx, def_id);
|
||||
|
||||
@ -1194,7 +1194,7 @@ impl EncodeContext<'tcx> {
|
||||
hir::ItemKind::ForeignMod(ref fm) => {
|
||||
self.lazy_seq(fm.items
|
||||
.iter()
|
||||
.map(|foreign_item| tcx.hir().local_def_id_from_hir_id(
|
||||
.map(|foreign_item| tcx.hir().local_def_id(
|
||||
foreign_item.hir_id).index))
|
||||
}
|
||||
hir::ItemKind::Enum(..) => {
|
||||
@ -1313,7 +1313,7 @@ impl EncodeContext<'tcx> {
|
||||
/// Serialize the text of exported macros
|
||||
fn encode_info_for_macro_def(&mut self, macro_def: &hir::MacroDef) -> Entry<'tcx> {
|
||||
use syntax::print::pprust;
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(macro_def.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(macro_def.hir_id);
|
||||
Entry {
|
||||
kind: EntryKind::MacroDef(self.lazy(&MacroDef {
|
||||
body: pprust::tts_to_string(¯o_def.body.trees().collect::<Vec<_>>()),
|
||||
@ -1656,7 +1656,7 @@ impl Visitor<'tcx> for EncodeContext<'tcx> {
|
||||
}
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
intravisit::walk_item(self, item);
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
match item.node {
|
||||
hir::ItemKind::ExternCrate(_) |
|
||||
hir::ItemKind::Use(..) => {} // ignore these
|
||||
@ -1666,7 +1666,7 @@ impl Visitor<'tcx> for EncodeContext<'tcx> {
|
||||
}
|
||||
fn visit_foreign_item(&mut self, ni: &'tcx hir::ForeignItem) {
|
||||
intravisit::walk_foreign_item(self, ni);
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(ni.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(ni.hir_id);
|
||||
self.record(def_id,
|
||||
EncodeContext::encode_info_for_foreign_item,
|
||||
(def_id, ni));
|
||||
@ -1678,7 +1678,7 @@ impl Visitor<'tcx> for EncodeContext<'tcx> {
|
||||
intravisit::walk_variant(self, v, g, id);
|
||||
|
||||
if let Some(ref discr) = v.node.disr_expr {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(discr.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(discr.hir_id);
|
||||
self.record(def_id, EncodeContext::encode_info_for_anon_const, def_id);
|
||||
}
|
||||
}
|
||||
@ -1691,7 +1691,7 @@ impl Visitor<'tcx> for EncodeContext<'tcx> {
|
||||
self.encode_info_for_ty(ty);
|
||||
}
|
||||
fn visit_macro_def(&mut self, macro_def: &'tcx hir::MacroDef) {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(macro_def.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(macro_def.hir_id);
|
||||
self.record(def_id, EncodeContext::encode_info_for_macro_def, macro_def);
|
||||
}
|
||||
}
|
||||
@ -1710,7 +1710,7 @@ impl EncodeContext<'tcx> {
|
||||
|
||||
fn encode_info_for_generics(&mut self, generics: &hir::Generics) {
|
||||
for param in &generics.params {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(param.hir_id);
|
||||
match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => continue,
|
||||
GenericParamKind::Type { ref default, .. } => {
|
||||
@ -1730,7 +1730,7 @@ impl EncodeContext<'tcx> {
|
||||
fn encode_info_for_ty(&mut self, ty: &hir::Ty) {
|
||||
match ty.node {
|
||||
hir::TyKind::Array(_, ref length) => {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(length.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(length.hir_id);
|
||||
self.record(def_id, EncodeContext::encode_info_for_anon_const, def_id);
|
||||
}
|
||||
_ => {}
|
||||
@ -1740,7 +1740,7 @@ impl EncodeContext<'tcx> {
|
||||
fn encode_info_for_expr(&mut self, expr: &hir::Expr) {
|
||||
match expr.node {
|
||||
hir::ExprKind::Closure(..) => {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(expr.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(expr.hir_id);
|
||||
self.record(def_id, EncodeContext::encode_info_for_closure, def_id);
|
||||
}
|
||||
_ => {}
|
||||
@ -1752,7 +1752,7 @@ impl EncodeContext<'tcx> {
|
||||
/// 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_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
match item.node {
|
||||
hir::ItemKind::Static(..) |
|
||||
hir::ItemKind::Const(..) |
|
||||
@ -1788,7 +1788,7 @@ impl EncodeContext<'tcx> {
|
||||
|
||||
// If the struct has a constructor, encode it.
|
||||
if let Some(ctor_hir_id) = struct_def.ctor_hir_id() {
|
||||
let ctor_def_id = self.tcx.hir().local_def_id_from_hir_id(ctor_hir_id);
|
||||
let ctor_def_id = self.tcx.hir().local_def_id(ctor_hir_id);
|
||||
self.record(ctor_def_id,
|
||||
EncodeContext::encode_struct_ctor,
|
||||
(def_id, ctor_def_id));
|
||||
@ -1823,7 +1823,7 @@ struct ImplVisitor<'tcx> {
|
||||
impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'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_from_hir_id(item.hir_id);
|
||||
let impl_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
if let Some(trait_ref) = self.tcx.impl_trait_ref(impl_id) {
|
||||
self.impls
|
||||
.entry(trait_ref.def_id)
|
||||
|
@ -25,11 +25,11 @@ impl ItemLikeVisitor<'tcx> for Collector<'tcx> {
|
||||
};
|
||||
|
||||
let foreign_items = fm.items.iter()
|
||||
.map(|it| self.tcx.hir().local_def_id_from_hir_id(it.hir_id))
|
||||
.map(|it| self.tcx.hir().local_def_id(it.hir_id))
|
||||
.collect();
|
||||
self.modules.push(ForeignModule {
|
||||
foreign_items,
|
||||
def_id: self.tcx.hir().local_def_id_from_hir_id(it.hir_id),
|
||||
def_id: self.tcx.hir().local_def_id(it.hir_id),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ impl ItemLikeVisitor<'tcx> for Collector<'tcx> {
|
||||
name: None,
|
||||
kind: cstore::NativeUnknown,
|
||||
cfg: None,
|
||||
foreign_module: Some(self.tcx.hir().local_def_id_from_hir_id(it.hir_id)),
|
||||
foreign_module: Some(self.tcx.hir().local_def_id(it.hir_id)),
|
||||
wasm_import_module: None,
|
||||
};
|
||||
let mut kind_specified = false;
|
||||
|
@ -768,7 +768,7 @@ fn for_each_late_bound_region_defined_on<'tcx>(
|
||||
local_id: *late_bound,
|
||||
};
|
||||
let name = tcx.hir().name(hir_id).as_interned_str();
|
||||
let region_def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let region_def_id = tcx.hir().local_def_id(hir_id);
|
||||
let liberated_region = tcx.mk_region(ty::ReFree(ty::FreeRegion {
|
||||
scope: fn_def_id,
|
||||
bound_region: ty::BoundRegion::BrNamed(region_def_id, name),
|
||||
|
@ -69,7 +69,7 @@ pub fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> Body<'_> {
|
||||
// fetch the fully liberated fn signature (that is, all bound
|
||||
// types/lifetimes replaced)
|
||||
let fn_sig = cx.tables().liberated_fn_sigs()[id].clone();
|
||||
let fn_def_id = tcx.hir().local_def_id_from_hir_id(id);
|
||||
let fn_def_id = tcx.hir().local_def_id(id);
|
||||
|
||||
let ty = tcx.type_of(fn_def_id);
|
||||
let mut abi = fn_sig.abi;
|
||||
@ -534,7 +534,7 @@ where
|
||||
let span = tcx_hir.span(fn_id);
|
||||
|
||||
let hir_tables = hir.tables();
|
||||
let fn_def_id = tcx_hir.local_def_id_from_hir_id(fn_id);
|
||||
let fn_def_id = tcx_hir.local_def_id(fn_id);
|
||||
|
||||
// Gather the upvars of a closure, if any.
|
||||
let mut upvar_mutbls = vec![];
|
||||
|
@ -542,7 +542,7 @@ fn make_mirror_unadjusted<'a, 'tcx>(
|
||||
|
||||
// Now comes the rote stuff:
|
||||
hir::ExprKind::Repeat(ref v, ref count) => {
|
||||
let def_id = cx.tcx.hir().local_def_id_from_hir_id(count.hir_id);
|
||||
let def_id = cx.tcx.hir().local_def_id(count.hir_id);
|
||||
let substs = InternalSubsts::identity_for_item(cx.tcx.global_tcx(), def_id);
|
||||
let instance = ty::Instance::resolve(
|
||||
cx.tcx.global_tcx(),
|
||||
@ -910,9 +910,9 @@ fn convert_path_expr<'a, 'tcx>(
|
||||
Res::Def(DefKind::ConstParam, def_id) => {
|
||||
let hir_id = cx.tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
let item_id = cx.tcx.hir().get_parent_node(hir_id);
|
||||
let item_def_id = cx.tcx.hir().local_def_id_from_hir_id(item_id);
|
||||
let item_def_id = cx.tcx.hir().local_def_id(item_id);
|
||||
let generics = cx.tcx.generics_of(item_def_id);
|
||||
let local_def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let local_def_id = cx.tcx.hir().local_def_id(hir_id);
|
||||
let index = generics.param_def_id_to_index[&local_def_id];
|
||||
let name = cx.tcx.hir().name(hir_id).as_interned_str();
|
||||
let val = ConstValue::Param(ty::ParamConst::new(index, name));
|
||||
@ -1191,7 +1191,7 @@ fn capture_upvar<'tcx>(
|
||||
) -> ExprRef<'tcx> {
|
||||
let upvar_id = ty::UpvarId {
|
||||
var_path: ty::UpvarPath { hir_id: var_hir_id },
|
||||
closure_expr_id: cx.tcx.hir().local_def_id_from_hir_id(closure_expr.hir_id).to_local(),
|
||||
closure_expr_id: cx.tcx.hir().local_def_id(closure_expr.hir_id).to_local(),
|
||||
};
|
||||
let upvar_capture = cx.tables().upvar_capture(upvar_id);
|
||||
let temp_lifetime = cx.region_scope_tree.temporary_scope(closure_expr.hir_id.local_id);
|
||||
|
@ -54,7 +54,7 @@ pub struct Cx<'a, 'tcx> {
|
||||
impl<'a, 'tcx> Cx<'a, 'tcx> {
|
||||
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>, src_id: hir::HirId) -> Cx<'a, 'tcx> {
|
||||
let tcx = infcx.tcx;
|
||||
let src_def_id = tcx.hir().local_def_id_from_hir_id(src_id);
|
||||
let src_def_id = tcx.hir().local_def_id(src_id);
|
||||
let tables = tcx.typeck_tables_of(src_def_id);
|
||||
let body_owner_kind = tcx.hir().body_owner_kind(src_id);
|
||||
|
||||
|
@ -989,7 +989,7 @@ impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
|
||||
hir::ItemKind::Union(_, ref generics) => {
|
||||
if generics.params.is_empty() {
|
||||
if self.mode == MonoItemCollectionMode::Eager {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
debug!("RootCollector: ADT drop-glue for {}",
|
||||
def_id_to_string(self.tcx, def_id));
|
||||
|
||||
@ -1001,11 +1001,11 @@ impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
|
||||
hir::ItemKind::GlobalAsm(..) => {
|
||||
debug!("RootCollector: ItemKind::GlobalAsm({})",
|
||||
def_id_to_string(self.tcx,
|
||||
self.tcx.hir().local_def_id_from_hir_id(item.hir_id)));
|
||||
self.tcx.hir().local_def_id(item.hir_id)));
|
||||
self.output.push(MonoItem::GlobalAsm(item.hir_id));
|
||||
}
|
||||
hir::ItemKind::Static(..) => {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
debug!("RootCollector: ItemKind::Static({})",
|
||||
def_id_to_string(self.tcx, def_id));
|
||||
self.output.push(MonoItem::Static(def_id));
|
||||
@ -1015,7 +1015,7 @@ impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
|
||||
// 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_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
|
||||
let instance = Instance::mono(self.tcx, def_id);
|
||||
let cid = GlobalId {
|
||||
@ -1029,7 +1029,7 @@ impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
|
||||
}
|
||||
}
|
||||
hir::ItemKind::Fn(..) => {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
self.push_if_root(def_id);
|
||||
}
|
||||
}
|
||||
@ -1043,7 +1043,7 @@ impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
|
||||
fn visit_impl_item(&mut self, ii: &'v hir::ImplItem) {
|
||||
match ii.node {
|
||||
hir::ImplItemKind::Method(hir::MethodSig { .. }, _) => {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(ii.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(ii.hir_id);
|
||||
self.push_if_root(def_id);
|
||||
}
|
||||
_ => { /* Nothing to do here */ }
|
||||
@ -1136,7 +1136,7 @@ fn create_mono_items_for_default_impls<'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
let impl_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let impl_def_id = tcx.hir().local_def_id(item.hir_id);
|
||||
|
||||
debug!("create_mono_items_for_default_impls(item={})",
|
||||
def_id_to_string(tcx, impl_def_id));
|
||||
|
@ -55,7 +55,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug {
|
||||
tcx.symbol_name(Instance::mono(tcx, def_id))
|
||||
}
|
||||
MonoItem::GlobalAsm(hir_id) => {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let def_id = tcx.hir().local_def_id(hir_id);
|
||||
ty::SymbolName {
|
||||
name: InternedString::intern(&format!("global_asm_{:?}", def_id))
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ fn mono_item_visibility(
|
||||
};
|
||||
}
|
||||
MonoItem::GlobalAsm(hir_id) => {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(*hir_id);
|
||||
let def_id = tcx.hir().local_def_id(*hir_id);
|
||||
return if tcx.is_reachable_non_generic(def_id) {
|
||||
*can_be_internalized = false;
|
||||
default_visibility(tcx, def_id, false)
|
||||
@ -698,7 +698,7 @@ fn characteristic_def_id_of_mono_item<'tcx>(
|
||||
Some(def_id)
|
||||
}
|
||||
MonoItem::Static(def_id) => Some(def_id),
|
||||
MonoItem::GlobalAsm(hir_id) => Some(tcx.hir().local_def_id_from_hir_id(hir_id)),
|
||||
MonoItem::GlobalAsm(hir_id) => Some(tcx.hir().local_def_id(hir_id)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> &DefIdSet {
|
||||
_: hir::HirId,
|
||||
_: Span) {
|
||||
if let hir::VariantData::Tuple(_, hir_id) = *v {
|
||||
self.set.insert(self.tcx.hir().local_def_id_from_hir_id(hir_id));
|
||||
self.set.insert(self.tcx.hir().local_def_id(hir_id));
|
||||
}
|
||||
intravisit::walk_struct_def(self, v)
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ struct VarianceTest<'tcx> {
|
||||
|
||||
impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> {
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let item_def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
|
||||
if let ItemKind::Ty(..) = item.node {
|
||||
for attr in self.tcx.get_attrs(item_def_id).iter() {
|
||||
|
@ -165,7 +165,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
|
||||
impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
|
||||
fn check_nested_body(&mut self, body_id: hir::BodyId) -> Promotability {
|
||||
let item_id = self.tcx.hir().body_owner(body_id);
|
||||
let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item_id);
|
||||
let item_def_id = self.tcx.hir().local_def_id(item_id);
|
||||
|
||||
let outer_in_fn = self.in_fn;
|
||||
let outer_tables = self.tables;
|
||||
@ -451,7 +451,7 @@ fn check_expr_kind<'a, 'tcx>(
|
||||
let nested_body_promotable = v.check_nested_body(body_id);
|
||||
// Paths in constant contexts cannot refer to local variables,
|
||||
// as there are none, and thus closures can't have upvars there.
|
||||
let closure_def_id = v.tcx.hir().local_def_id_from_hir_id(e.hir_id);
|
||||
let closure_def_id = v.tcx.hir().local_def_id(e.hir_id);
|
||||
if !v.tcx.upvars(closure_def_id).map_or(true, |v| v.is_empty()) {
|
||||
NotPromotable
|
||||
} else {
|
||||
|
@ -44,7 +44,7 @@ fn plugin_registrar_fn(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<DefId> {
|
||||
0 => None,
|
||||
1 => {
|
||||
let (hir_id, _) = finder.registrars.pop().unwrap();
|
||||
Some(tcx.hir().local_def_id_from_hir_id(hir_id))
|
||||
Some(tcx.hir().local_def_id(hir_id))
|
||||
},
|
||||
_ => {
|
||||
let diagnostic = tcx.sess.diagnostic();
|
||||
|
@ -250,13 +250,13 @@ fn def_id_visibility<'tcx>(
|
||||
let parent_hir_id = tcx.hir().get_parent_node(hir_id);
|
||||
match tcx.hir().get(parent_hir_id) {
|
||||
Node::Variant(..) => {
|
||||
let parent_did = tcx.hir().local_def_id_from_hir_id(parent_hir_id);
|
||||
let parent_did = tcx.hir().local_def_id(parent_hir_id);
|
||||
let (mut ctor_vis, mut span, mut descr) = def_id_visibility(
|
||||
tcx, parent_did,
|
||||
);
|
||||
|
||||
let adt_def = tcx.adt_def(tcx.hir().get_parent_did(hir_id));
|
||||
let ctor_did = tcx.hir().local_def_id_from_hir_id(
|
||||
let ctor_did = tcx.hir().local_def_id(
|
||||
vdata.ctor_hir_id().unwrap());
|
||||
let variant = adt_def.variant_with_ctor_id(ctor_did);
|
||||
|
||||
@ -333,7 +333,7 @@ fn item_tables<'a, 'tcx>(
|
||||
hir_id: hir::HirId,
|
||||
empty_tables: &'a ty::TypeckTables<'tcx>,
|
||||
) -> &'a ty::TypeckTables<'tcx> {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let def_id = tcx.hir().local_def_id(hir_id);
|
||||
if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables }
|
||||
}
|
||||
|
||||
@ -394,7 +394,7 @@ trait VisibilityLike: Sized {
|
||||
access_levels: &AccessLevels,
|
||||
) -> Self {
|
||||
let mut find = FindMin { tcx, access_levels, min: Self::MAX };
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let def_id = tcx.hir().local_def_id(hir_id);
|
||||
find.visit(tcx.type_of(def_id));
|
||||
if let Some(trait_ref) = tcx.impl_trait_ref(def_id) {
|
||||
find.visit_trait(trait_ref);
|
||||
@ -475,7 +475,7 @@ impl EmbargoVisitor<'tcx> {
|
||||
) -> ReachEverythingInTheInterfaceVisitor<'_, 'tcx> {
|
||||
ReachEverythingInTheInterfaceVisitor {
|
||||
access_level: cmp::min(access_level, Some(AccessLevel::Reachable)),
|
||||
item_def_id: self.tcx.hir().local_def_id_from_hir_id(item_id),
|
||||
item_def_id: self.tcx.hir().local_def_id(item_id),
|
||||
ev: self,
|
||||
}
|
||||
}
|
||||
@ -506,7 +506,7 @@ impl EmbargoVisitor<'tcx> {
|
||||
if let hir::ItemKind::Mod(m) = &item.node {
|
||||
for item_id in m.item_ids.as_ref() {
|
||||
let item = self.tcx.hir().expect_item(item_id.id);
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(item_id.id);
|
||||
let def_id = self.tcx.hir().local_def_id(item_id.id);
|
||||
if !self.tcx.hygienic_eq(segment.ident, item.ident, def_id) { continue; }
|
||||
if let hir::ItemKind::Use(..) = item.node {
|
||||
self.update(item.hir_id, Some(AccessLevel::Exported));
|
||||
@ -726,7 +726,7 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||
// This code is here instead of in visit_item so that the
|
||||
// crate module gets processed as well.
|
||||
if self.prev_level.is_some() {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = self.tcx.hir().local_def_id(id);
|
||||
if let Some(exports) = self.tcx.module_exports(def_id) {
|
||||
for export in exports.iter() {
|
||||
if export.vis == ty::Visibility::Public {
|
||||
@ -751,7 +751,7 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||
|
||||
let module_did = ty::DefIdTree::parent(
|
||||
self.tcx,
|
||||
self.tcx.hir().local_def_id_from_hir_id(md.hir_id)
|
||||
self.tcx.hir().local_def_id(md.hir_id)
|
||||
).unwrap();
|
||||
let mut module_id = self.tcx.hir().as_local_hir_id(module_did).unwrap();
|
||||
let level = if md.vis.node.is_pub() { self.get(module_id) } else { None };
|
||||
@ -772,7 +772,7 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||
for id in &module.item_ids {
|
||||
self.update(id.id, level);
|
||||
}
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(module_id);
|
||||
let def_id = self.tcx.hir().local_def_id(module_id);
|
||||
if let Some(exports) = self.tcx.module_exports(def_id) {
|
||||
for export in exports.iter() {
|
||||
if let Some(hir_id) = self.tcx.hir().as_local_hir_id(export.res.def_id()) {
|
||||
@ -1163,7 +1163,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
|
||||
// Check types in item interfaces.
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
let orig_current_item = mem::replace(&mut self.current_item,
|
||||
self.tcx.hir().local_def_id_from_hir_id(item.hir_id));
|
||||
self.tcx.hir().local_def_id(item.hir_id));
|
||||
let orig_in_body = mem::replace(&mut self.in_body, false);
|
||||
let orig_tables =
|
||||
mem::replace(&mut self.tables, item_tables(self.tcx, item.hir_id, self.empty_tables));
|
||||
@ -1689,7 +1689,7 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> {
|
||||
SearchInterfaceForPrivateItemsVisitor {
|
||||
tcx: self.tcx,
|
||||
item_id,
|
||||
item_def_id: self.tcx.hir().local_def_id_from_hir_id(item_id),
|
||||
item_def_id: self.tcx.hir().local_def_id(item_id),
|
||||
span: self.tcx.hir().span(item_id),
|
||||
required_visibility,
|
||||
has_pub_restricted: self.has_pub_restricted,
|
||||
|
@ -628,7 +628,7 @@ struct ClauseDumper<'tcx> {
|
||||
|
||||
impl ClauseDumper<'tcx> {
|
||||
fn process_attrs(&mut self, hir_id: hir::HirId, attrs: &[ast::Attribute]) {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(hir_id);
|
||||
for attr in attrs {
|
||||
let mut clauses = None;
|
||||
|
||||
|
@ -1999,7 +1999,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
let item_id = tcx.hir().get_parent_node(hir_id);
|
||||
let item_def_id = tcx.hir().local_def_id_from_hir_id(item_id);
|
||||
let item_def_id = tcx.hir().local_def_id(item_id);
|
||||
let generics = tcx.generics_of(item_def_id);
|
||||
let index = generics.param_def_id_to_index[&def_id];
|
||||
tcx.mk_ty_param(index, tcx.hir().name(hir_id).as_interned_str())
|
||||
@ -2091,7 +2091,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
self.res_to_ty(opt_self_ty, path, false)
|
||||
}
|
||||
hir::TyKind::Def(item_id, ref lifetimes) => {
|
||||
let did = tcx.hir().local_def_id_from_hir_id(item_id.id);
|
||||
let did = tcx.hir().local_def_id(item_id.id);
|
||||
self.impl_trait_ty_to_ty(did, lifetimes)
|
||||
}
|
||||
hir::TyKind::Path(hir::QPath::TypeRelative(ref qself, ref segment)) => {
|
||||
@ -2173,7 +2173,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
debug!("ast_const_to_const(id={:?}, ast_const={:?})", ast_const.hir_id, ast_const);
|
||||
|
||||
let tcx = self.tcx();
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(ast_const.hir_id);
|
||||
let def_id = tcx.hir().local_def_id(ast_const.hir_id);
|
||||
|
||||
let mut const_ = ty::Const {
|
||||
val: ConstValue::Unevaluated(
|
||||
@ -2189,9 +2189,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
// parent item and construct a `ParamConst`.
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
let item_id = tcx.hir().get_parent_node(hir_id);
|
||||
let item_def_id = tcx.hir().local_def_id_from_hir_id(item_id);
|
||||
let item_def_id = tcx.hir().local_def_id(item_id);
|
||||
let generics = tcx.generics_of(item_def_id);
|
||||
let index = generics.param_def_id_to_index[&tcx.hir().local_def_id_from_hir_id(hir_id)];
|
||||
let index = generics.param_def_id_to_index[&tcx.hir().local_def_id(hir_id)];
|
||||
let name = tcx.hir().name(hir_id).as_interned_str();
|
||||
const_.val = ConstValue::Param(ty::ParamConst::new(index, name));
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
opt_kind, expected_sig
|
||||
);
|
||||
|
||||
let expr_def_id = self.tcx.hir().local_def_id_from_hir_id(expr.hir_id);
|
||||
let expr_def_id = self.tcx.hir().local_def_id(expr.hir_id);
|
||||
|
||||
let ClosureSignatures {
|
||||
bound_sig,
|
||||
|
@ -901,7 +901,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
expr: &'tcx hir::Expr,
|
||||
) -> Ty<'tcx> {
|
||||
let tcx = self.tcx;
|
||||
let count_def_id = tcx.hir().local_def_id_from_hir_id(count.hir_id);
|
||||
let count_def_id = tcx.hir().local_def_id(count.hir_id);
|
||||
let count = if self.const_param_def_id(count).is_some() {
|
||||
Ok(self.to_const(count, tcx.type_of(count_def_id)))
|
||||
} else {
|
||||
|
@ -22,7 +22,7 @@ fn equate_intrinsic_type<'tcx>(
|
||||
inputs: Vec<Ty<'tcx>>,
|
||||
output: Ty<'tcx>,
|
||||
) {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id);
|
||||
let def_id = tcx.hir().local_def_id(it.hir_id);
|
||||
|
||||
match it.node {
|
||||
hir::ForeignItemKind::Fn(..) => {}
|
||||
|
@ -196,7 +196,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
)?;
|
||||
|
||||
for import_id in &pick.import_ids {
|
||||
let import_def_id = self.tcx.hir().local_def_id_from_hir_id(*import_id);
|
||||
let import_def_id = self.tcx.hir().local_def_id(*import_id);
|
||||
debug!("used_trait_import: {:?}", import_def_id);
|
||||
Lrc::get_mut(&mut self.tables.borrow_mut().used_trait_imports)
|
||||
.unwrap().insert(import_def_id);
|
||||
@ -434,7 +434,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
self_ty, expr_id, ProbeScope::TraitsInScope)?;
|
||||
debug!("resolve_ufcs: pick={:?}", pick);
|
||||
for import_id in pick.import_ids {
|
||||
let import_def_id = tcx.hir().local_def_id_from_hir_id(import_id);
|
||||
let import_def_id = tcx.hir().local_def_id(import_id);
|
||||
debug!("resolve_ufcs: used_trait_import: {:?}", import_def_id);
|
||||
Lrc::get_mut(&mut self.tables.borrow_mut().used_trait_imports)
|
||||
.unwrap().insert(import_def_id);
|
||||
|
@ -797,7 +797,7 @@ fn compute_all_traits(tcx: TyCtxt<'_>) -> Vec<DefId> {
|
||||
match i.node {
|
||||
hir::ItemKind::Trait(..) |
|
||||
hir::ItemKind::TraitAlias(..) => {
|
||||
let def_id = self.map.local_def_id_from_hir_id(i.hir_id);
|
||||
let def_id = self.map.local_def_id(i.hir_id);
|
||||
self.traits.push(def_id);
|
||||
}
|
||||
_ => ()
|
||||
|
@ -1085,7 +1085,7 @@ fn check_fn<'a, 'tcx>(
|
||||
fcx.yield_ty = Some(yield_ty);
|
||||
}
|
||||
|
||||
let outer_def_id = fcx.tcx.closure_base_def_id(fcx.tcx.hir().local_def_id_from_hir_id(fn_id));
|
||||
let outer_def_id = fcx.tcx.closure_base_def_id(fcx.tcx.hir().local_def_id(fn_id));
|
||||
let outer_hir_id = fcx.tcx.hir().as_local_hir_id(outer_def_id).unwrap();
|
||||
GatherLocalsVisitor { fcx: &fcx, parent_id: outer_hir_id, }.visit_body(body);
|
||||
|
||||
@ -1183,7 +1183,7 @@ fn check_fn<'a, 'tcx>(
|
||||
|
||||
// Check that a function marked as `#[panic_handler]` has signature `fn(&PanicInfo) -> !`
|
||||
if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() {
|
||||
if panic_impl_did == fcx.tcx.hir().local_def_id_from_hir_id(fn_id) {
|
||||
if panic_impl_did == fcx.tcx.hir().local_def_id(fn_id) {
|
||||
if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() {
|
||||
// at this point we don't care if there are duplicate handlers or if the handler has
|
||||
// the wrong signature as this value we'll be used when writing metadata and that
|
||||
@ -1241,7 +1241,7 @@ fn check_fn<'a, 'tcx>(
|
||||
|
||||
// Check that a function marked as `#[alloc_error_handler]` has signature `fn(Layout) -> !`
|
||||
if let Some(alloc_error_handler_did) = fcx.tcx.lang_items().oom() {
|
||||
if alloc_error_handler_did == fcx.tcx.hir().local_def_id_from_hir_id(fn_id) {
|
||||
if alloc_error_handler_did == fcx.tcx.hir().local_def_id(fn_id) {
|
||||
if let Some(alloc_layout_did) = fcx.tcx.lang_items().alloc_layout() {
|
||||
if declared_ret_ty.sty != ty::Never {
|
||||
fcx.tcx.sess.span_err(
|
||||
@ -1292,7 +1292,7 @@ fn check_fn<'a, 'tcx>(
|
||||
}
|
||||
|
||||
fn check_struct(tcx: TyCtxt<'_>, id: hir::HirId, span: Span) {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
let def = tcx.adt_def(def_id);
|
||||
def.destructor(tcx); // force the destructor to be evaluated
|
||||
check_representable(tcx, span, def_id);
|
||||
@ -1306,7 +1306,7 @@ fn check_struct(tcx: TyCtxt<'_>, id: hir::HirId, span: Span) {
|
||||
}
|
||||
|
||||
fn check_union(tcx: TyCtxt<'_>, id: hir::HirId, span: Span) {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
let def = tcx.adt_def(def_id);
|
||||
def.destructor(tcx); // force the destructor to be evaluated
|
||||
check_representable(tcx, span, def_id);
|
||||
@ -1334,18 +1334,18 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item) {
|
||||
debug!(
|
||||
"check_item_type(it.hir_id={}, it.name={})",
|
||||
it.hir_id,
|
||||
tcx.def_path_str(tcx.hir().local_def_id_from_hir_id(it.hir_id))
|
||||
tcx.def_path_str(tcx.hir().local_def_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_from_hir_id(it.hir_id);
|
||||
let def_id = tcx.hir().local_def_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_from_hir_id(it.hir_id));
|
||||
tcx.typeck_tables_of(tcx.hir().local_def_id(it.hir_id));
|
||||
}
|
||||
hir::ItemKind::Enum(ref enum_definition, _) => {
|
||||
check_enum(tcx, it.span, &enum_definition.variants, it.hir_id);
|
||||
@ -1353,7 +1353,7 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item) {
|
||||
hir::ItemKind::Fn(..) => {} // entirely within check_item_body
|
||||
hir::ItemKind::Impl(.., ref impl_item_refs) => {
|
||||
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);
|
||||
let impl_def_id = tcx.hir().local_def_id(it.hir_id);
|
||||
if let Some(impl_trait_ref) = tcx.impl_trait_ref(impl_def_id) {
|
||||
check_impl_items_against_trait(
|
||||
tcx,
|
||||
@ -1367,7 +1367,7 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item) {
|
||||
}
|
||||
}
|
||||
hir::ItemKind::Trait(..) => {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id);
|
||||
let def_id = tcx.hir().local_def_id(it.hir_id);
|
||||
check_on_unimplemented(tcx, def_id, it);
|
||||
}
|
||||
hir::ItemKind::Struct(..) => {
|
||||
@ -1377,13 +1377,13 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item) {
|
||||
check_union(tcx, it.hir_id, it.span);
|
||||
}
|
||||
hir::ItemKind::Existential(..) => {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id);
|
||||
let def_id = tcx.hir().local_def_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_from_hir_id(it.hir_id);
|
||||
let def_id = tcx.hir().local_def_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);
|
||||
@ -1401,7 +1401,7 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item) {
|
||||
}
|
||||
} else {
|
||||
for item in &m.items {
|
||||
let generics = tcx.generics_of(tcx.hir().local_def_id_from_hir_id(item.hir_id));
|
||||
let generics = tcx.generics_of(tcx.hir().local_def_id(item.hir_id));
|
||||
if generics.params.len() - generics.own_counts().lifetimes != 0 {
|
||||
let mut err = struct_span_err!(
|
||||
tcx.sess,
|
||||
@ -1468,7 +1468,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_>, id: DefId, span: Span)
|
||||
}
|
||||
|
||||
fn check_on_unimplemented(tcx: TyCtxt<'_>, trait_def_id: DefId, item: &hir::Item) {
|
||||
let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let item_def_id = tcx.hir().local_def_id(item.hir_id);
|
||||
// an error would be reported if this fails.
|
||||
let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id);
|
||||
}
|
||||
@ -1551,7 +1551,7 @@ fn check_impl_items_against_trait<'tcx>(
|
||||
// and compatible with trait signature
|
||||
for impl_item in impl_items() {
|
||||
let ty_impl_item = tcx.associated_item(
|
||||
tcx.hir().local_def_id_from_hir_id(impl_item.hir_id));
|
||||
tcx.hir().local_def_id(impl_item.hir_id));
|
||||
let ty_trait_item = tcx.associated_items(impl_trait_ref.def_id)
|
||||
.find(|ac| Namespace::from(&impl_item.node) == Namespace::from(ac.kind) &&
|
||||
tcx.hygienic_eq(ty_impl_item.ident, ac.ident, impl_trait_ref.def_id))
|
||||
@ -1909,7 +1909,7 @@ fn check_transparent(tcx: TyCtxt<'_>, sp: Span, def_id: DefId) {
|
||||
|
||||
#[allow(trivial_numeric_casts)]
|
||||
pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, vs: &'tcx [hir::Variant], id: hir::HirId) {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
let def = tcx.adt_def(def_id);
|
||||
def.destructor(tcx); // force the destructor to be evaluated
|
||||
|
||||
@ -1937,7 +1937,7 @@ pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, vs: &'tcx [hir::Variant], i
|
||||
|
||||
for v in vs {
|
||||
if let Some(ref e) = v.node.disr_expr {
|
||||
tcx.typeck_tables_of(tcx.hir().local_def_id_from_hir_id(e.hir_id));
|
||||
tcx.typeck_tables_of(tcx.hir().local_def_id(e.hir_id));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2006,7 +2006,7 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
|
||||
let tcx = self.tcx;
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
let item_id = tcx.hir().ty_param_owner(hir_id);
|
||||
let item_def_id = tcx.hir().local_def_id_from_hir_id(item_id);
|
||||
let item_def_id = tcx.hir().local_def_id(item_id);
|
||||
let generics = tcx.generics_of(item_def_id);
|
||||
let index = generics.param_def_id_to_index[&def_id];
|
||||
tcx.arena.alloc(ty::GenericPredicates {
|
||||
@ -2453,7 +2453,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
value: &T,
|
||||
value_span: Span,
|
||||
) -> T {
|
||||
let parent_def_id = self.tcx.hir().local_def_id_from_hir_id(parent_id);
|
||||
let parent_def_id = self.tcx.hir().local_def_id(parent_id);
|
||||
debug!("instantiate_opaque_types_from_value(parent_def_id={:?}, value={:?})",
|
||||
parent_def_id,
|
||||
value);
|
||||
|
@ -138,7 +138,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
/// types from which we should derive implied bounds, if any.
|
||||
pub fn regionck_item(&self, item_id: hir::HirId, span: Span, wf_tys: &[Ty<'tcx>]) {
|
||||
debug!("regionck_item(item.id={:?}, wf_tys={:?})", item_id, wf_tys);
|
||||
let subject = self.tcx.hir().local_def_id_from_hir_id(item_id);
|
||||
let subject = self.tcx.hir().local_def_id(item_id);
|
||||
let mut rcx = RegionCtxt::new(
|
||||
self,
|
||||
RepeatingScope(item_id),
|
||||
|
@ -248,7 +248,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// This may change if abstract return types of some sort are
|
||||
// implemented.
|
||||
let tcx = self.tcx;
|
||||
let closure_def_id = tcx.hir().local_def_id_from_hir_id(closure_id);
|
||||
let closure_def_id = tcx.hir().local_def_id(closure_id);
|
||||
|
||||
tcx.upvars(closure_def_id).iter().flat_map(|upvars| {
|
||||
upvars
|
||||
|
@ -95,7 +95,7 @@ pub fn check_item_well_formed(tcx: TyCtxt<'_>, def_id: DefId) {
|
||||
// won't be allowed unless there's an *explicit* implementation of `Send`
|
||||
// for `T`
|
||||
hir::ItemKind::Impl(_, polarity, defaultness, _, ref trait_ref, ref self_ty, _) => {
|
||||
let is_auto = tcx.impl_trait_ref(tcx.hir().local_def_id_from_hir_id(item.hir_id))
|
||||
let is_auto = tcx.impl_trait_ref(tcx.hir().local_def_id(item.hir_id))
|
||||
.map_or(false, |trait_ref| tcx.trait_is_auto(trait_ref.def_id));
|
||||
if let (hir::Defaultness::Default { .. }, true) = (defaultness, is_auto) {
|
||||
tcx.sess.span_err(item.span, "impls of auto traits cannot be default");
|
||||
@ -188,7 +188,7 @@ fn check_associated_item(
|
||||
|
||||
let code = ObligationCauseCode::MiscObligation;
|
||||
for_id(tcx, item_id, span).with_fcx(|fcx, tcx| {
|
||||
let item = fcx.tcx.associated_item(fcx.tcx.hir().local_def_id_from_hir_id(item_id));
|
||||
let item = fcx.tcx.associated_item(fcx.tcx.hir().local_def_id(item_id));
|
||||
|
||||
let (mut implied_bounds, self_ty) = match item.container {
|
||||
ty::TraitContainer(_) => (vec![], fcx.tcx.mk_self_type()),
|
||||
@ -232,7 +232,7 @@ fn for_item<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item) -> CheckWfFcxBuilder<'tcx
|
||||
}
|
||||
|
||||
fn for_id(tcx: TyCtxt<'_>, id: hir::HirId, span: Span) -> CheckWfFcxBuilder<'_> {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
CheckWfFcxBuilder {
|
||||
inherited: Inherited::build(tcx, def_id),
|
||||
id,
|
||||
@ -252,7 +252,7 @@ fn check_type_defn<'tcx, F>(
|
||||
{
|
||||
for_item(tcx, item).with_fcx(|fcx, fcx_tcx| {
|
||||
let variants = lookup_fields(fcx);
|
||||
let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = fcx.tcx.hir().local_def_id(item.hir_id);
|
||||
let packed = fcx.tcx.adt_def(def_id).repr.packed();
|
||||
|
||||
for variant in &variants {
|
||||
@ -320,7 +320,7 @@ fn check_type_defn<'tcx, F>(
|
||||
fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item) {
|
||||
debug!("check_trait: {:?}", item.hir_id);
|
||||
|
||||
let trait_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let trait_def_id = tcx.hir().local_def_id(item.hir_id);
|
||||
|
||||
let trait_def = tcx.trait_def(trait_def_id);
|
||||
if trait_def.is_marker {
|
||||
@ -342,7 +342,7 @@ fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item) {
|
||||
|
||||
fn check_item_fn(tcx: TyCtxt<'_>, item: &hir::Item) {
|
||||
for_item(tcx, item).with_fcx(|fcx, tcx| {
|
||||
let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = fcx.tcx.hir().local_def_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![];
|
||||
@ -361,7 +361,7 @@ fn check_item_type(
|
||||
debug!("check_item_type: {:?}", item_id);
|
||||
|
||||
for_id(tcx, item_id, ty_span).with_fcx(|fcx, gcx| {
|
||||
let ty = gcx.type_of(gcx.hir().local_def_id_from_hir_id(item_id));
|
||||
let ty = gcx.type_of(gcx.hir().local_def_id(item_id));
|
||||
let item_ty = fcx.normalize_associated_types_in(ty_span, &ty);
|
||||
|
||||
let mut forbid_unsized = true;
|
||||
@ -394,7 +394,7 @@ fn check_impl<'tcx>(
|
||||
debug!("check_impl: {:?}", item);
|
||||
|
||||
for_item(tcx, item).with_fcx(|fcx, tcx| {
|
||||
let item_def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let item_def_id = fcx.tcx.hir().local_def_id(item.hir_id);
|
||||
|
||||
match *ast_trait_ref {
|
||||
Some(ref ast_trait_ref) => {
|
||||
@ -943,7 +943,7 @@ fn check_variances_for_type_defn<'tcx>(
|
||||
item: &hir::Item,
|
||||
hir_generics: &hir::Generics,
|
||||
) {
|
||||
let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let item_def_id = tcx.hir().local_def_id(item.hir_id);
|
||||
let ty = tcx.type_of(item_def_id);
|
||||
if tcx.has_error_field(ty) {
|
||||
return;
|
||||
@ -1026,7 +1026,7 @@ fn reject_shadowing_parameters(tcx: TyCtxt<'_>, def_id: DefId) {
|
||||
fn check_false_global_bounds(fcx: &FnCtxt<'_, '_>, span: Span, id: hir::HirId) {
|
||||
let empty_env = ty::ParamEnv::empty();
|
||||
|
||||
let def_id = fcx.tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = fcx.tcx.hir().local_def_id(id);
|
||||
let predicates = fcx.tcx.predicates_of(def_id).predicates
|
||||
.iter()
|
||||
.map(|(p, _)| *p)
|
||||
@ -1069,19 +1069,19 @@ impl CheckTypeWellFormedVisitor<'tcx> {
|
||||
impl ParItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'tcx> {
|
||||
fn visit_item(&self, i: &'tcx hir::Item) {
|
||||
debug!("visit_item: {:?}", i);
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(i.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(i.hir_id);
|
||||
self.tcx.ensure().check_item_well_formed(def_id);
|
||||
}
|
||||
|
||||
fn visit_trait_item(&self, trait_item: &'tcx hir::TraitItem) {
|
||||
debug!("visit_trait_item: {:?}", trait_item);
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(trait_item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(trait_item.hir_id);
|
||||
self.tcx.ensure().check_trait_item_well_formed(def_id);
|
||||
}
|
||||
|
||||
fn visit_impl_item(&self, impl_item: &'tcx hir::ImplItem) {
|
||||
debug!("visit_impl_item: {:?}", impl_item);
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(impl_item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(impl_item.hir_id);
|
||||
self.tcx.ensure().check_impl_item_well_formed(def_id);
|
||||
}
|
||||
}
|
||||
@ -1101,7 +1101,7 @@ struct AdtField<'tcx> {
|
||||
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn non_enum_variant(&self, struct_def: &hir::VariantData) -> AdtVariant<'tcx> {
|
||||
let fields = struct_def.fields().iter().map(|field| {
|
||||
let field_ty = self.tcx.type_of(self.tcx.hir().local_def_id_from_hir_id(field.hir_id));
|
||||
let field_ty = self.tcx.type_of(self.tcx.hir().local_def_id(field.hir_id));
|
||||
let field_ty = self.normalize_associated_types_in(field.span,
|
||||
&field_ty);
|
||||
let field_ty = self.resolve_vars_if_possible(&field_ty);
|
||||
|
@ -34,7 +34,7 @@ use syntax_pos::Span;
|
||||
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
pub fn resolve_type_vars_in_body(&self, body: &'tcx hir::Body) -> &'tcx ty::TypeckTables<'tcx> {
|
||||
let item_id = self.tcx.hir().body_owner(body.id());
|
||||
let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item_id);
|
||||
let item_def_id = self.tcx.hir().local_def_id(item_id);
|
||||
|
||||
// This attribute causes us to dump some writeback information
|
||||
// in the form of errors, which is uSymbolfor unit tests.
|
||||
|
@ -52,7 +52,7 @@ struct CheckVisitor<'tcx> {
|
||||
|
||||
impl CheckVisitor<'tcx> {
|
||||
fn check_import(&self, id: hir::HirId, span: Span) {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = self.tcx.hir().local_def_id(id);
|
||||
if !self.tcx.maybe_unused_trait_import(def_id) {
|
||||
return;
|
||||
}
|
||||
@ -219,7 +219,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_from_hir_id(item.hir_id);
|
||||
let extern_crate_def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
self.crates_to_lint.push(
|
||||
ExternCrateToLint {
|
||||
def_id: extern_crate_def_id,
|
||||
|
@ -38,7 +38,7 @@ impl<'tcx> Checker<'tcx> {
|
||||
{
|
||||
if Some(self.trait_def_id) == trait_def_id {
|
||||
for &impl_id in self.tcx.hir().trait_impls(self.trait_def_id) {
|
||||
let impl_def_id = self.tcx.hir().local_def_id_from_hir_id(impl_id);
|
||||
let impl_def_id = self.tcx.hir().local_def_id(impl_id);
|
||||
f(self.tcx, impl_def_id);
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ impl ItemLikeVisitor<'v> for InherentCollect<'tcx> {
|
||||
_ => return
|
||||
};
|
||||
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
let self_ty = self.tcx.type_of(def_id);
|
||||
let lang_items = self.tcx.lang_items();
|
||||
match self_ty.sty {
|
||||
@ -257,7 +257,7 @@ impl InherentCollect<'tcx> {
|
||||
// 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_from_hir_id(item.hir_id);
|
||||
let impl_def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
let vec = self.impls_map.inherent_impls.entry(def_id).or_default();
|
||||
vec.push(impl_def_id);
|
||||
} else {
|
||||
|
@ -89,7 +89,7 @@ impl ItemLikeVisitor<'v> for InherentOverlapChecker<'tcx> {
|
||||
hir::ItemKind::Struct(..) |
|
||||
hir::ItemKind::Trait(..) |
|
||||
hir::ItemKind::Union(..) => {
|
||||
let type_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let type_def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
self.check_for_overlapping_inherent_impls(type_def_id);
|
||||
}
|
||||
_ => {}
|
||||
|
@ -19,7 +19,7 @@ mod orphan;
|
||||
mod unsafety;
|
||||
|
||||
fn check_impl(tcx: TyCtxt<'_>, hir_id: HirId) {
|
||||
let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
let impl_def_id = tcx.hir().local_def_id(hir_id);
|
||||
|
||||
// If there are no traits, then this implementation must have a
|
||||
// base type.
|
||||
@ -151,8 +151,8 @@ pub fn check_coherence(tcx: TyCtxt<'_>) {
|
||||
/// Overlap: no two impls for the same trait are implemented for the
|
||||
/// same type. Likewise, no two inherent impls for a given type
|
||||
/// constructor provide a method with the same name.
|
||||
fn check_impl_overlap(tcx: TyCtxt<'_>, hir_id: HirId) {
|
||||
let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
fn check_impl_overlap<'tcx>(tcx: TyCtxt<'tcx>, hir_id: HirId) {
|
||||
let impl_def_id = tcx.hir().local_def_id(hir_id);
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
|
||||
let trait_def_id = trait_ref.def_id;
|
||||
|
||||
|
@ -22,7 +22,7 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'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_from_hir_id(item.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
// "Trait" impl
|
||||
if let hir::ItemKind::Impl(.., Some(_), _, _) = item.node {
|
||||
debug!("coherence2::orphan check: trait impl {}",
|
||||
|
@ -21,7 +21,7 @@ impl UnsafetyChecker<'tcx> {
|
||||
unsafety: hir::Unsafety,
|
||||
polarity: hir::ImplPolarity)
|
||||
{
|
||||
let local_did = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let local_did = self.tcx.hir().local_def_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| {
|
||||
|
@ -124,12 +124,12 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
|
||||
hir::GenericParamKind::Type {
|
||||
default: Some(_), ..
|
||||
} => {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(param.hir_id);
|
||||
self.tcx.type_of(def_id);
|
||||
}
|
||||
hir::GenericParamKind::Type { .. } => {}
|
||||
hir::GenericParamKind::Const { .. } => {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(param.hir_id);
|
||||
self.tcx.type_of(def_id);
|
||||
}
|
||||
}
|
||||
@ -139,7 +139,7 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
|
||||
if let hir::ExprKind::Closure(..) = expr.node {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(expr.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(expr.hir_id);
|
||||
self.tcx.generics_of(def_id);
|
||||
self.tcx.type_of(def_id);
|
||||
}
|
||||
@ -265,7 +265,7 @@ fn type_param_predicates(
|
||||
|
||||
let param_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
let param_owner = tcx.hir().ty_param_owner(param_id);
|
||||
let param_owner_def_id = tcx.hir().local_def_id_from_hir_id(param_owner);
|
||||
let param_owner_def_id = tcx.hir().local_def_id(param_owner);
|
||||
let generics = tcx.generics_of(param_owner_def_id);
|
||||
let index = generics.param_def_id_to_index[&def_id];
|
||||
let ty = tcx.mk_ty_param(index, tcx.hir().ty_param_name(param_id).as_interned_str());
|
||||
@ -385,7 +385,7 @@ fn is_param(tcx: TyCtxt<'_>, ast_ty: &hir::Ty, param_id: hir::HirId) -> bool {
|
||||
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node {
|
||||
match path.res {
|
||||
Res::SelfTy(Some(def_id), None) | Res::Def(DefKind::TyParam, def_id) => {
|
||||
def_id == tcx.hir().local_def_id_from_hir_id(param_id)
|
||||
def_id == tcx.hir().local_def_id(param_id)
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
@ -397,7 +397,7 @@ fn is_param(tcx: TyCtxt<'_>, ast_ty: &hir::Ty, param_id: hir::HirId) -> bool {
|
||||
fn convert_item(tcx: TyCtxt<'_>, item_id: hir::HirId) {
|
||||
let it = tcx.hir().expect_item(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);
|
||||
let def_id = tcx.hir().local_def_id(item_id);
|
||||
match it.node {
|
||||
// These don't define types.
|
||||
hir::ItemKind::ExternCrate(_)
|
||||
@ -406,7 +406,7 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::HirId) {
|
||||
| hir::ItemKind::GlobalAsm(_) => {}
|
||||
hir::ItemKind::ForeignMod(ref foreign_mod) => {
|
||||
for item in &foreign_mod.items {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = tcx.hir().local_def_id(item.hir_id);
|
||||
tcx.generics_of(def_id);
|
||||
tcx.type_of(def_id);
|
||||
tcx.predicates_of(def_id);
|
||||
@ -444,7 +444,7 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::HirId) {
|
||||
tcx.predicates_of(def_id);
|
||||
|
||||
for f in struct_def.fields() {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(f.hir_id);
|
||||
let def_id = tcx.hir().local_def_id(f.hir_id);
|
||||
tcx.generics_of(def_id);
|
||||
tcx.type_of(def_id);
|
||||
tcx.predicates_of(def_id);
|
||||
@ -478,7 +478,7 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::HirId) {
|
||||
|
||||
fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::HirId) {
|
||||
let trait_item = tcx.hir().expect_trait_item(trait_item_id);
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(trait_item.hir_id);
|
||||
let def_id = tcx.hir().local_def_id(trait_item.hir_id);
|
||||
tcx.generics_of(def_id);
|
||||
|
||||
match trait_item.node {
|
||||
@ -498,7 +498,7 @@ fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::HirId) {
|
||||
}
|
||||
|
||||
fn convert_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::HirId) {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(impl_item_id);
|
||||
let def_id = tcx.hir().local_def_id(impl_item_id);
|
||||
tcx.generics_of(def_id);
|
||||
tcx.type_of(def_id);
|
||||
tcx.predicates_of(def_id);
|
||||
@ -508,7 +508,7 @@ fn convert_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::HirId) {
|
||||
}
|
||||
|
||||
fn convert_variant_ctor(tcx: TyCtxt<'_>, ctor_id: hir::HirId) {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(ctor_id);
|
||||
let def_id = tcx.hir().local_def_id(ctor_id);
|
||||
tcx.generics_of(def_id);
|
||||
tcx.type_of(def_id);
|
||||
tcx.predicates_of(def_id);
|
||||
@ -525,7 +525,7 @@ fn convert_enum_variant_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, variants:
|
||||
let wrapped_discr = prev_discr.map_or(initial, |d| d.wrap_incr(tcx));
|
||||
prev_discr = Some(
|
||||
if let Some(ref e) = variant.node.disr_expr {
|
||||
let expr_did = tcx.hir().local_def_id_from_hir_id(e.hir_id);
|
||||
let expr_did = tcx.hir().local_def_id(e.hir_id);
|
||||
def.eval_explicit_discr(tcx, expr_did)
|
||||
} else if let Some(discr) = repr_type.disr_incr(tcx, prev_discr) {
|
||||
Some(discr)
|
||||
@ -548,7 +548,7 @@ fn convert_enum_variant_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, variants:
|
||||
);
|
||||
|
||||
for f in variant.node.data.fields() {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(f.hir_id);
|
||||
let def_id = tcx.hir().local_def_id(f.hir_id);
|
||||
tcx.generics_of(def_id);
|
||||
tcx.type_of(def_id);
|
||||
tcx.predicates_of(def_id);
|
||||
@ -578,7 +578,7 @@ fn convert_variant(
|
||||
.fields()
|
||||
.iter()
|
||||
.map(|f| {
|
||||
let fid = tcx.hir().local_def_id_from_hir_id(f.hir_id);
|
||||
let fid = tcx.hir().local_def_id(f.hir_id);
|
||||
let dup_span = seen_fields.get(&f.ident.modern()).cloned();
|
||||
if let Some(prev_span) = dup_span {
|
||||
struct_span_err!(
|
||||
@ -635,13 +635,13 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::AdtDef {
|
||||
let variants = def.variants
|
||||
.iter()
|
||||
.map(|v| {
|
||||
let variant_did = Some(tcx.hir().local_def_id_from_hir_id(v.node.id));
|
||||
let variant_did = Some(tcx.hir().local_def_id(v.node.id));
|
||||
let ctor_did = v.node.data.ctor_hir_id()
|
||||
.map(|hir_id| tcx.hir().local_def_id_from_hir_id(hir_id));
|
||||
.map(|hir_id| tcx.hir().local_def_id(hir_id));
|
||||
|
||||
let discr = if let Some(ref e) = v.node.disr_expr {
|
||||
distance_from_explicit = 0;
|
||||
ty::VariantDiscr::Explicit(tcx.hir().local_def_id_from_hir_id(e.hir_id))
|
||||
ty::VariantDiscr::Explicit(tcx.hir().local_def_id(e.hir_id))
|
||||
} else {
|
||||
ty::VariantDiscr::Relative(distance_from_explicit)
|
||||
};
|
||||
@ -657,7 +657,7 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::AdtDef {
|
||||
ItemKind::Struct(ref def, _) => {
|
||||
let variant_did = None;
|
||||
let ctor_did = def.ctor_hir_id()
|
||||
.map(|hir_id| tcx.hir().local_def_id_from_hir_id(hir_id));
|
||||
.map(|hir_id| tcx.hir().local_def_id(hir_id));
|
||||
|
||||
let variants = std::iter::once(convert_variant(
|
||||
tcx, variant_did, ctor_did, item.ident, ty::VariantDiscr::Relative(0), def,
|
||||
@ -669,7 +669,7 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::AdtDef {
|
||||
ItemKind::Union(ref def, _) => {
|
||||
let variant_did = None;
|
||||
let ctor_did = def.ctor_hir_id()
|
||||
.map(|hir_id| tcx.hir().local_def_id_from_hir_id(hir_id));
|
||||
.map(|hir_id| tcx.hir().local_def_id(hir_id));
|
||||
|
||||
let variants = std::iter::once(convert_variant(
|
||||
tcx, variant_did, ctor_did, item.ident, ty::VariantDiscr::Relative(0), def,
|
||||
@ -889,7 +889,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
|
||||
Node::ImplItem(_) | Node::TraitItem(_) | Node::Variant(_) |
|
||||
Node::Ctor(..) | Node::Field(_) => {
|
||||
let parent_id = tcx.hir().get_parent_item(hir_id);
|
||||
Some(tcx.hir().local_def_id_from_hir_id(parent_id))
|
||||
Some(tcx.hir().local_def_id(parent_id))
|
||||
}
|
||||
Node::Expr(&hir::Expr {
|
||||
node: hir::ExprKind::Closure(..),
|
||||
@ -937,7 +937,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
|
||||
opt_self = Some(ty::GenericParamDef {
|
||||
index: 0,
|
||||
name: kw::SelfUpper.as_interned_str(),
|
||||
def_id: tcx.hir().local_def_id_from_hir_id(param_id),
|
||||
def_id: tcx.hir().local_def_id(param_id),
|
||||
pure_wrt_drop: false,
|
||||
kind: ty::GenericParamDefKind::Type {
|
||||
has_default: false,
|
||||
@ -983,7 +983,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
|
||||
.map(|(i, param)| ty::GenericParamDef {
|
||||
name: param.name.ident().as_interned_str(),
|
||||
index: own_start + i as u32,
|
||||
def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id),
|
||||
def_id: tcx.hir().local_def_id(param.hir_id),
|
||||
pure_wrt_drop: param.pure_wrt_drop,
|
||||
kind: ty::GenericParamDefKind::Lifetime,
|
||||
}),
|
||||
@ -1050,7 +1050,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
|
||||
let param_def = ty::GenericParamDef {
|
||||
index: type_start + i as u32,
|
||||
name: param.name.ident().as_interned_str(),
|
||||
def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id),
|
||||
def_id: tcx.hir().local_def_id(param.hir_id),
|
||||
pure_wrt_drop: param.pure_wrt_drop,
|
||||
kind,
|
||||
};
|
||||
@ -1623,7 +1623,7 @@ fn find_existential_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
intravisit::NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
fn visit_item(&mut self, it: &'tcx Item) {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(it.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_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);
|
||||
@ -1631,7 +1631,7 @@ fn find_existential_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
}
|
||||
}
|
||||
fn visit_impl_item(&mut self, it: &'tcx ImplItem) {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(it.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_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);
|
||||
@ -1639,7 +1639,7 @@ fn find_existential_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
}
|
||||
}
|
||||
fn visit_trait_item(&mut self, it: &'tcx TraitItem) {
|
||||
let def_id = self.tcx.hir().local_def_id_from_hir_id(it.hir_id);
|
||||
let def_id = self.tcx.hir().local_def_id(it.hir_id);
|
||||
self.check(def_id);
|
||||
intravisit::walk_trait_item(self, it);
|
||||
}
|
||||
@ -1720,7 +1720,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
|
||||
let ty = tcx.type_of(tcx.hir().get_parent_did(hir_id));
|
||||
let inputs = data.fields()
|
||||
.iter()
|
||||
.map(|f| tcx.type_of(tcx.hir().local_def_id_from_hir_id(f.hir_id)));
|
||||
.map(|f| tcx.type_of(tcx.hir().local_def_id(f.hir_id)));
|
||||
ty::Binder::bind(tcx.mk_fn_sig(
|
||||
inputs,
|
||||
ty,
|
||||
@ -2036,7 +2036,7 @@ fn explicit_predicates_of(
|
||||
let mut index = parent_count + has_own_self as u32;
|
||||
for param in early_bound_lifetimes_from_generics(tcx, ast_generics) {
|
||||
let region = tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion {
|
||||
def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id),
|
||||
def_id: tcx.hir().local_def_id(param.hir_id),
|
||||
index,
|
||||
name: param.name.ident().as_interned_str(),
|
||||
}));
|
||||
@ -2154,7 +2154,7 @@ fn explicit_predicates_of(
|
||||
};
|
||||
|
||||
let assoc_ty =
|
||||
tcx.mk_projection(tcx.hir().local_def_id_from_hir_id(trait_item.hir_id),
|
||||
tcx.mk_projection(tcx.hir().local_def_id(trait_item.hir_id),
|
||||
self_trait_ref.substs);
|
||||
|
||||
let bounds = AstConv::compute_bounds(
|
||||
|
@ -79,7 +79,7 @@ struct ImplWfCheck<'tcx> {
|
||||
impl ItemLikeVisitor<'tcx> for ImplWfCheck<'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_from_hir_id(item.hir_id);
|
||||
let impl_def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
enforce_impl_params_are_constrained(self.tcx,
|
||||
impl_def_id,
|
||||
impl_item_refs);
|
||||
@ -109,7 +109,7 @@ fn enforce_impl_params_are_constrained(
|
||||
|
||||
// Disallow unconstrained lifetimes, but only if they appear in assoc types.
|
||||
let lifetimes_in_associated_types: FxHashSet<_> = impl_item_refs.iter()
|
||||
.map(|item_ref| tcx.hir().local_def_id_from_hir_id(item_ref.id.hir_id))
|
||||
.map(|item_ref| tcx.hir().local_def_id(item_ref.id.hir_id))
|
||||
.filter(|&def_id| {
|
||||
let item = tcx.associated_item(def_id);
|
||||
item.kind == ty::AssocKind::Type && item.defaultness.has_value()
|
||||
|
@ -370,7 +370,7 @@ pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> {
|
||||
// def-ID that will be used to determine the traits/predicates in
|
||||
// scope. This is derived from the enclosing item-like thing.
|
||||
let env_node_id = tcx.hir().get_parent_item(hir_ty.hir_id);
|
||||
let env_def_id = tcx.hir().local_def_id_from_hir_id(env_node_id);
|
||||
let env_def_id = tcx.hir().local_def_id(env_node_id);
|
||||
let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id);
|
||||
|
||||
astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty)
|
||||
@ -384,7 +384,7 @@ pub fn hir_trait_to_predicates<'tcx>(
|
||||
// def-ID that will be used to determine the traits/predicates in
|
||||
// scope. This is derived from the enclosing item-like thing.
|
||||
let env_hir_id = tcx.hir().get_parent_item(hir_trait.hir_ref_id);
|
||||
let env_def_id = tcx.hir().local_def_id_from_hir_id(env_hir_id);
|
||||
let env_def_id = tcx.hir().local_def_id(env_hir_id);
|
||||
let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id);
|
||||
let mut bounds = Bounds::default();
|
||||
let (principal, _) = AstConv::instantiate_poly_trait_ref_inner(
|
||||
|
@ -52,7 +52,7 @@ pub struct InferVisitor<'cx, 'tcx> {
|
||||
|
||||
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_from_hir_id(item.hir_id);
|
||||
let item_did = self.tcx.hir().local_def_id(item.hir_id);
|
||||
|
||||
debug!("InferVisitor::visit_item(item={:?})", item_did);
|
||||
|
||||
|
@ -15,7 +15,7 @@ struct OutlivesTest<'tcx> {
|
||||
|
||||
impl ItemLikeVisitor<'tcx> for OutlivesTest<'tcx> {
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let item_def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
|
||||
// For unit testing: check for a special "rustc_outlives"
|
||||
// attribute and report an error with various results if found.
|
||||
|
@ -120,7 +120,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ConstraintContext<'a, 'tcx> {
|
||||
impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
|
||||
fn visit_node_helper(&mut self, id: hir::HirId) {
|
||||
let tcx = self.terms_cx.tcx;
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
self.build_constraints_for_item(def_id);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ impl<'a, 'tcx> SolveContext<'a, 'tcx> {
|
||||
|
||||
let solutions = &self.solutions;
|
||||
self.terms_cx.inferred_starts.iter().map(|(&id, &InferredIndex(start))| {
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
let generics = tcx.generics_of(def_id);
|
||||
let count = generics.count();
|
||||
|
||||
|
@ -103,7 +103,7 @@ fn lang_items(tcx: TyCtxt<'_>) -> Vec<(hir::HirId, Vec<ty::Variance>)> {
|
||||
impl<'a, 'tcx> TermsContext<'a, 'tcx> {
|
||||
fn add_inferreds_for_item(&mut self, id: hir::HirId) {
|
||||
let tcx = self.tcx;
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(id);
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
let count = tcx.generics_of(def_id).count();
|
||||
|
||||
if count == 0 {
|
||||
|
@ -13,7 +13,7 @@ struct VarianceTest<'tcx> {
|
||||
|
||||
impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> {
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let item_def_id = self.tcx.hir().local_def_id(item.hir_id);
|
||||
|
||||
// For unit testing: check for a special "rustc_variance"
|
||||
// attribute and report an error with various results if found.
|
||||
|
@ -281,14 +281,14 @@ impl Clean<ExternalCrate> for CrateNum {
|
||||
hir::ItemKind::Mod(_) => {
|
||||
as_primitive(Res::Def(
|
||||
DefKind::Mod,
|
||||
cx.tcx.hir().local_def_id_from_hir_id(id.id),
|
||||
cx.tcx.hir().local_def_id(id.id),
|
||||
))
|
||||
}
|
||||
hir::ItemKind::Use(ref path, hir::UseKind::Single)
|
||||
if item.vis.node.is_pub() => {
|
||||
as_primitive(path.res).map(|(_, prim, attrs)| {
|
||||
// Pretend the primitive is local.
|
||||
(cx.tcx.hir().local_def_id_from_hir_id(id.id), prim, attrs)
|
||||
(cx.tcx.hir().local_def_id(id.id), prim, attrs)
|
||||
})
|
||||
}
|
||||
_ => None
|
||||
@ -325,13 +325,13 @@ impl Clean<ExternalCrate> for CrateNum {
|
||||
hir::ItemKind::Mod(_) => {
|
||||
as_keyword(Res::Def(
|
||||
DefKind::Mod,
|
||||
cx.tcx.hir().local_def_id_from_hir_id(id.id),
|
||||
cx.tcx.hir().local_def_id(id.id),
|
||||
))
|
||||
}
|
||||
hir::ItemKind::Use(ref path, hir::UseKind::Single)
|
||||
if item.vis.node.is_pub() => {
|
||||
as_keyword(path.res).map(|(_, prim, attrs)| {
|
||||
(cx.tcx.hir().local_def_id_from_hir_id(id.id), prim, attrs)
|
||||
(cx.tcx.hir().local_def_id(id.id), prim, attrs)
|
||||
})
|
||||
}
|
||||
_ => None
|
||||
@ -1588,7 +1588,7 @@ impl Clean<GenericParamDef> for hir::GenericParam {
|
||||
}
|
||||
hir::GenericParamKind::Type { ref default, synthetic } => {
|
||||
(self.name.ident().name.clean(cx), GenericParamDefKind::Type {
|
||||
did: cx.tcx.hir().local_def_id_from_hir_id(self.hir_id),
|
||||
did: cx.tcx.hir().local_def_id(self.hir_id),
|
||||
bounds: self.bounds.clean(cx),
|
||||
default: default.clean(cx),
|
||||
synthetic: synthetic,
|
||||
@ -1596,7 +1596,7 @@ impl Clean<GenericParamDef> for hir::GenericParam {
|
||||
}
|
||||
hir::GenericParamKind::Const { ref ty } => {
|
||||
(self.name.ident().name.clean(cx), GenericParamDefKind::Const {
|
||||
did: cx.tcx.hir().local_def_id_from_hir_id(self.hir_id),
|
||||
did: cx.tcx.hir().local_def_id(self.hir_id),
|
||||
ty: ty.clean(cx),
|
||||
})
|
||||
}
|
||||
@ -1926,7 +1926,7 @@ impl Clean<Item> for doctree::Function<'_> {
|
||||
(self.generics.clean(cx), (self.decl, self.body).clean(cx))
|
||||
});
|
||||
|
||||
let did = cx.tcx.hir().local_def_id_from_hir_id(self.id);
|
||||
let did = cx.tcx.hir().local_def_id(self.id);
|
||||
let constness = if cx.tcx.is_min_const_fn(did) {
|
||||
hir::Constness::Const
|
||||
} else {
|
||||
@ -2136,7 +2136,7 @@ impl Clean<Item> for doctree::Trait<'_> {
|
||||
name: Some(self.name.clean(cx)),
|
||||
attrs: attrs,
|
||||
source: self.whence.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
@ -2166,7 +2166,7 @@ impl Clean<Item> for doctree::TraitAlias<'_> {
|
||||
name: Some(self.name.clean(cx)),
|
||||
attrs,
|
||||
source: self.whence.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
@ -2229,7 +2229,7 @@ impl Clean<Item> for hir::TraitItem {
|
||||
AssocTypeItem(bounds.clean(cx), default.clean(cx))
|
||||
}
|
||||
};
|
||||
let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id);
|
||||
let local_did = cx.tcx.hir().local_def_id(self.hir_id);
|
||||
Item {
|
||||
name: Some(self.ident.name.clean(cx)),
|
||||
attrs: self.attrs.clean(cx),
|
||||
@ -2262,7 +2262,7 @@ impl Clean<Item> for hir::ImplItem {
|
||||
generics: Generics::default(),
|
||||
}, true),
|
||||
};
|
||||
let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id);
|
||||
let local_did = cx.tcx.hir().local_def_id(self.hir_id);
|
||||
Item {
|
||||
name: Some(self.ident.name.clean(cx)),
|
||||
source: self.span.clean(cx),
|
||||
@ -2757,7 +2757,7 @@ impl Clean<Type> for hir::Ty {
|
||||
}
|
||||
TyKind::Slice(ref ty) => Slice(box ty.clean(cx)),
|
||||
TyKind::Array(ref ty, ref length) => {
|
||||
let def_id = cx.tcx.hir().local_def_id_from_hir_id(length.hir_id);
|
||||
let def_id = cx.tcx.hir().local_def_id(length.hir_id);
|
||||
let param_env = cx.tcx.param_env(def_id);
|
||||
let substs = InternalSubsts::identity_for_item(cx.tcx, def_id);
|
||||
let cid = GlobalId {
|
||||
@ -2829,7 +2829,7 @@ impl Clean<Type> for hir::Ty {
|
||||
if let Some(lt) = lifetime.cloned() {
|
||||
if !lt.is_elided() {
|
||||
let lt_def_id =
|
||||
cx.tcx.hir().local_def_id_from_hir_id(param.hir_id);
|
||||
cx.tcx.hir().local_def_id(param.hir_id);
|
||||
lt_substs.insert(lt_def_id, lt.clean(cx));
|
||||
}
|
||||
}
|
||||
@ -2837,7 +2837,7 @@ impl Clean<Type> for hir::Ty {
|
||||
}
|
||||
hir::GenericParamKind::Type { ref default, .. } => {
|
||||
let ty_param_def_id =
|
||||
cx.tcx.hir().local_def_id_from_hir_id(param.hir_id);
|
||||
cx.tcx.hir().local_def_id(param.hir_id);
|
||||
let mut j = 0;
|
||||
let type_ = generic_args.args.iter().find_map(|arg| {
|
||||
match arg {
|
||||
@ -2861,7 +2861,7 @@ impl Clean<Type> for hir::Ty {
|
||||
}
|
||||
hir::GenericParamKind::Const { .. } => {
|
||||
let const_param_def_id =
|
||||
cx.tcx.hir().local_def_id_from_hir_id(param.hir_id);
|
||||
cx.tcx.hir().local_def_id(param.hir_id);
|
||||
let mut j = 0;
|
||||
let const_ = generic_args.args.iter().find_map(|arg| {
|
||||
match arg {
|
||||
@ -3159,7 +3159,7 @@ impl<'tcx> Clean<Constant> for ty::Const<'tcx> {
|
||||
|
||||
impl Clean<Item> for hir::StructField {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> Item {
|
||||
let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id);
|
||||
let local_did = cx.tcx.hir().local_def_id(self.hir_id);
|
||||
|
||||
Item {
|
||||
name: Some(self.ident.name).clean(cx),
|
||||
@ -3240,7 +3240,7 @@ impl Clean<Item> for doctree::Struct<'_> {
|
||||
name: Some(self.name.clean(cx)),
|
||||
attrs: self.attrs.clean(cx),
|
||||
source: self.whence.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
@ -3260,7 +3260,7 @@ impl Clean<Item> for doctree::Union<'_> {
|
||||
name: Some(self.name.clean(cx)),
|
||||
attrs: self.attrs.clean(cx),
|
||||
source: self.whence.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
@ -3307,7 +3307,7 @@ impl Clean<Item> for doctree::Enum<'_> {
|
||||
name: Some(self.name.clean(cx)),
|
||||
attrs: self.attrs.clean(cx),
|
||||
source: self.whence.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
@ -3334,7 +3334,7 @@ impl Clean<Item> for doctree::Variant<'_> {
|
||||
visibility: None,
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
inner: VariantItem(Variant {
|
||||
kind: self.def.clean(cx),
|
||||
}),
|
||||
@ -3635,7 +3635,7 @@ impl Clean<Item> for doctree::Typedef<'_> {
|
||||
name: Some(self.name.clean(cx)),
|
||||
attrs: self.attrs.clean(cx),
|
||||
source: self.whence.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
@ -3659,7 +3659,7 @@ impl Clean<Item> for doctree::Existential<'_> {
|
||||
name: Some(self.name.clean(cx)),
|
||||
attrs: self.attrs.clean(cx),
|
||||
source: self.whence.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
@ -3710,7 +3710,7 @@ impl Clean<Item> for doctree::Static<'_> {
|
||||
name: Some(self.name.clean(cx)),
|
||||
attrs: self.attrs.clean(cx),
|
||||
source: self.whence.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
@ -3735,7 +3735,7 @@ impl Clean<Item> for doctree::Constant<'_> {
|
||||
name: Some(self.name.clean(cx)),
|
||||
attrs: self.attrs.clean(cx),
|
||||
source: self.whence.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
@ -3822,7 +3822,7 @@ impl Clean<Vec<Item>> for doctree::Impl<'_> {
|
||||
name: None,
|
||||
attrs: self.attrs.clean(cx),
|
||||
source: self.whence.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
@ -4053,7 +4053,7 @@ impl Clean<Item> for doctree::ForeignItem<'_> {
|
||||
name: Some(self.name.clean(cx)),
|
||||
attrs: self.attrs.clean(cx),
|
||||
source: self.whence.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
visibility: self.vis.clean(cx),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
@ -4269,7 +4269,7 @@ impl Clean<Item> for doctree::ProcMacro<'_> {
|
||||
visibility: Some(Public),
|
||||
stability: self.stab.clean(cx),
|
||||
deprecation: self.depr.clean(cx),
|
||||
def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id),
|
||||
def_id: cx.tcx.hir().local_def_id(self.id),
|
||||
inner: ProcMacroItem(ProcMacro {
|
||||
kind: self.kind,
|
||||
helpers: self.helpers.clean(cx),
|
||||
|
@ -363,7 +363,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
||||
// to the map from defid -> hirid
|
||||
let access_levels = AccessLevels {
|
||||
map: access_levels.map.iter()
|
||||
.map(|(&k, &v)| (tcx.hir().local_def_id_from_hir_id(k), v))
|
||||
.map(|(&k, &v)| (tcx.hir().local_def_id(k), v))
|
||||
.collect()
|
||||
};
|
||||
|
||||
|
@ -118,7 +118,7 @@ pub fn collect_trait_impls(krate: Crate, cx: &DocContext<'_>) -> Crate {
|
||||
// doesn't work with it anyway, so pull them from the HIR map instead
|
||||
for &trait_did in cx.all_traits.iter() {
|
||||
for &impl_node in cx.tcx.hir().trait_impls(trait_did) {
|
||||
let impl_did = cx.tcx.hir().local_def_id_from_hir_id(impl_node);
|
||||
let impl_did = cx.tcx.hir().local_def_id(impl_node);
|
||||
inline::build_impl(cx, impl_did, &mut new_items);
|
||||
}
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||
let ident = renamed.unwrap_or(item.ident);
|
||||
|
||||
if item.vis.node.is_pub() {
|
||||
let def_id = self.cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||
let def_id = self.cx.tcx.hir().local_def_id(item.hir_id);
|
||||
self.store_path(def_id);
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||
_ 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_from_hir_id(item.hir_id);
|
||||
let def_id = self.cx.tcx.hir().local_def_id(item.hir_id);
|
||||
om.extern_crates.push(ExternCrate {
|
||||
cnum: self.cx.tcx.extern_mod_stmt_cnum(def_id)
|
||||
.unwrap_or(LOCAL_CRATE),
|
||||
@ -618,7 +618,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||
|
||||
Macro {
|
||||
|
||||
def_id: self.cx.tcx.hir().local_def_id_from_hir_id(def.hir_id),
|
||||
def_id: self.cx.tcx.hir().local_def_id(def.hir_id),
|
||||
attrs: &def.attrs,
|
||||
name: renamed.unwrap_or(def.name),
|
||||
whence: def.span,
|
||||
|
Loading…
x
Reference in New Issue
Block a user