1
Fork 0

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

@ -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
@ -654,7 +654,7 @@ impl Clean<Item> for doctree::Module<'_> {
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
deprecation: self.depr.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id),
def_id: cx.tcx.hir().local_def_id_from_node_id(self.id),
inner: ModuleItem(Module {
is_crate: self.is_crate,
items,
@ -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 {
@ -2982,10 +2982,11 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
ty::FnPtr(_) => {
let ty = cx.tcx.lift(self).expect("FnPtr lift failed");
let sig = ty.fn_sig(cx.tcx);
let local_def_id = cx.tcx.hir().local_def_id_from_node_id(ast::CRATE_NODE_ID);
BareFunction(box BareFunctionDecl {
unsafety: sig.unsafety(),
generic_params: Vec::new(),
decl: (cx.tcx.hir().local_def_id(ast::CRATE_NODE_ID), sig).clean(cx),
decl: (local_def_id, sig).clean(cx),
abi: sig.abi(),
})
}
@ -3158,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),
@ -3239,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),
@ -3259,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),
@ -3306,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),
@ -3333,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),
}),
@ -3634,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),
@ -3658,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),
@ -3709,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),
@ -3734,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),
@ -3821,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),
@ -3991,7 +3992,7 @@ impl Clean<Vec<Item>> for doctree::Import<'_> {
name: None,
attrs: self.attrs.clean(cx),
source: self.whence.clean(cx),
def_id: cx.tcx.hir().local_def_id(ast::CRATE_NODE_ID),
def_id: cx.tcx.hir().local_def_id_from_node_id(ast::CRATE_NODE_ID),
visibility: self.vis.clean(cx),
stability: None,
deprecation: None,
@ -4052,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),
@ -4268,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),