From c36e0c04243c2aa5e6fb9289345e9215ea0ebde5 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Wed, 24 Jul 2019 16:28:51 -0400 Subject: [PATCH] Remove NodeId from doctree::Module --- src/librustdoc/clean/mod.rs | 6 +++--- src/librustdoc/doctree.rs | 8 +++----- src/librustdoc/visit_ast.rs | 3 +-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index bf09e8785ad..aee9b74c31c 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -654,9 +654,9 @@ impl Clean for doctree::Module<'_> { attrs, source: whence.clean(cx), visibility: self.vis.clean(cx), - stability: cx.stability(self.hid).clean(cx), - deprecation: cx.deprecation(self.hid).clean(cx), - def_id: cx.tcx.hir().local_def_id_from_node_id(self.id), + stability: cx.stability(self.id).clean(cx), + deprecation: cx.deprecation(self.id).clean(cx), + def_id: cx.tcx.hir().local_def_id(self.id), inner: ModuleItem(Module { is_crate: self.is_crate, items, diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index 39714708572..90dcf1be76c 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -3,7 +3,7 @@ pub use self::StructType::*; use syntax::ast; -use syntax::ast::{Name, NodeId}; +use syntax::ast::Name; use syntax::ext::base::MacroKind; use syntax_pos::{self, Span}; @@ -23,8 +23,7 @@ pub struct Module<'hir> { pub enums: Vec>, pub fns: Vec>, pub mods: Vec>, - pub id: NodeId, - pub hid: hir::HirId, + pub id: hir::HirId, pub typedefs: Vec>, pub opaque_tys: Vec>, pub statics: Vec>, @@ -47,8 +46,7 @@ impl Module<'hir> { ) -> Module<'hir> { Module { name : name, - id: ast::CRATE_NODE_ID, - hid: hir::CRATE_HIR_ID, + id: hir::CRATE_HIR_ID, vis, where_outer: syntax_pos::DUMMY_SP, where_inner: syntax_pos::DUMMY_SP, diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 002721afbc4..f01b9eeb30f 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -206,8 +206,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { let mut om = Module::new(name, attrs, vis); om.where_outer = span; om.where_inner = m.inner; - om.hid = id; - om.id = self.cx.tcx.hir().hir_to_node_id(id); + om.id = id; // Keep track of if there were any private modules in the path. let orig_inside_public_path = self.inside_public_path; self.inside_public_path &= vis.node.is_pub();