Rollup merge of #62168 - ljedrz:the_culmination_of_hiridification, r=Zoxc

The (almost) culmination of HirIdification

It's finally over.

This PR removes old `FIXME`s and renames some functions so that the `HirId` variant has the shorter name.
All that remains (and rightfully so) is stuff in `resolve`, `save_analysis` and (as far as I can tell) in a few places where we can't replace `NodeId` with `HirId`.
This commit is contained in:
Mazdak Farrokhzad 2019-07-05 20:26:56 +02:00 committed by GitHub
commit 2e86c006f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
83 changed files with 309 additions and 321 deletions

View file

@ -1252,15 +1252,15 @@ impl<'tcx> TyCtxt<'tcx> {
maybe_unused_trait_imports:
resolutions.maybe_unused_trait_imports
.into_iter()
.map(|id| hir.local_def_id(id))
.map(|id| hir.local_def_id_from_node_id(id))
.collect(),
maybe_unused_extern_crates:
resolutions.maybe_unused_extern_crates
.into_iter()
.map(|(id, sp)| (hir.local_def_id(id), sp))
.map(|(id, sp)| (hir.local_def_id_from_node_id(id), sp))
.collect(),
glob_map: resolutions.glob_map.into_iter().map(|(id, names)| {
(hir.local_def_id(id), names)
(hir.local_def_id_from_node_id(id), names)
}).collect(),
extern_prelude: resolutions.extern_prelude,
hir_map: hir,

View file

@ -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)
}

View file

@ -2815,7 +2815,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 } => {
@ -2841,7 +2841,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 } => {
@ -3113,7 +3113,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) => {
@ -3177,14 +3177,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(..) => &[],

View file

@ -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));
}
}