1
Fork 0

rustdoc: avoid cleaning modules with duplicate names

This commit is contained in:
Michael Howell 2022-09-09 12:58:42 -07:00
parent 98f3001eec
commit 1f8d552d6d
2 changed files with 20 additions and 3 deletions

View file

@ -55,9 +55,11 @@ pub(crate) fn clean_doc_module<'tcx>(doc: &DocModule<'tcx>, cx: &mut DocContext<
} }
item item
})); }));
items.extend(doc.mods.iter().map(|x| { items.extend(doc.mods.iter().filter_map(|x| {
inserted.insert((ItemType::Module, x.name)); if !inserted.insert((ItemType::Module, x.name)) {
clean_doc_module(x, cx) return None;
}
Some(clean_doc_module(x, cx))
})); }));
// Split up imports from all other items. // Split up imports from all other items.

View file

@ -0,0 +1,15 @@
#![crate_name = "foo"]
pub mod sub {
pub struct Item;
pub mod prelude {
pub use super::Item;
}
}
// @count foo/index.html '//a[@class="mod"][@title="foo::prelude mod"]' 1
pub mod prelude {}
#[doc(inline)]
pub use sub::*;