rustdoc: Don't try to inline the crate root

Fixes other test cases found in #16274
This commit is contained in:
Alex Crichton 2014-09-23 15:19:30 -07:00
parent d2b30f7d38
commit 3d8ca595a1
5 changed files with 57 additions and 3 deletions

View file

@ -46,12 +46,15 @@ pub struct RustdocVisitor<'a, 'tcx: 'a> {
impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
pub fn new(cx: &'a core::DocContext<'tcx>,
analysis: Option<&'a core::CrateAnalysis>) -> RustdocVisitor<'a, 'tcx> {
// If the root is reexported, terminate all recursion.
let mut stack = HashSet::new();
stack.insert(ast::CRATE_NODE_ID);
RustdocVisitor {
module: Module::new(None),
attrs: Vec::new(),
cx: cx,
analysis: analysis,
view_item_stack: HashSet::new(),
view_item_stack: stack,
}
}
@ -232,7 +235,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
if !please_inline && analysis.public_items.contains(&def.node) {
return false
}
if !self.view_item_stack.insert(id) { return false }
if !self.view_item_stack.insert(def.node) { return false }
let ret = match tcx.map.get(def.node) {
ast_map::NodeItem(it) => {