Skip to content

Commit 1f8d552

Browse files
committed
rustdoc: avoid cleaning modules with duplicate names
1 parent 98f3001 commit 1f8d552

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/librustdoc/clean/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ pub(crate) fn clean_doc_module<'tcx>(doc: &DocModule<'tcx>, cx: &mut DocContext<
5555
}
5656
item
5757
}));
58-
items.extend(doc.mods.iter().map(|x| {
59-
inserted.insert((ItemType::Module, x.name));
60-
clean_doc_module(x, cx)
58+
items.extend(doc.mods.iter().filter_map(|x| {
59+
if !inserted.insert((ItemType::Module, x.name)) {
60+
return None;
61+
}
62+
Some(clean_doc_module(x, cx))
6163
}));
6264

6365
// Split up imports from all other items.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![crate_name = "foo"]
2+
3+
pub mod sub {
4+
pub struct Item;
5+
6+
pub mod prelude {
7+
pub use super::Item;
8+
}
9+
}
10+
11+
// @count foo/index.html '//a[@class="mod"][@title="foo::prelude mod"]' 1
12+
pub mod prelude {}
13+
14+
#[doc(inline)]
15+
pub use sub::*;

0 commit comments

Comments
 (0)