1
Fork 0

Remove NodeId from doctree::Module

This commit is contained in:
Mark Rousskov 2019-07-24 16:28:51 -04:00
parent 4beb751575
commit c36e0c0424
3 changed files with 7 additions and 10 deletions

View file

@ -654,9 +654,9 @@ impl Clean<Item> 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,

View file

@ -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<Enum<'hir>>,
pub fns: Vec<Function<'hir>>,
pub mods: Vec<Module<'hir>>,
pub id: NodeId,
pub hid: hir::HirId,
pub id: hir::HirId,
pub typedefs: Vec<Typedef<'hir>>,
pub opaque_tys: Vec<OpaqueTy<'hir>>,
pub statics: Vec<Static<'hir>>,
@ -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,

View file

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