Skip to content

Commit 278efd1

Browse files
committed
Update rustdoc to new ExternEntry format
1 parent ef33748 commit 278efd1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/librustdoc/config.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ fn parse_extern_html_roots(
578578
/// error message.
579579
// FIXME(eddyb) This shouldn't be duplicated with `rustc::session`.
580580
fn parse_externs(matches: &getopts::Matches) -> Result<Externs, String> {
581-
let mut externs: BTreeMap<_, BTreeSet<_>> = BTreeMap::new();
581+
let mut externs: BTreeMap<_, ExternEntry> = BTreeMap::new();
582582
for arg in &matches.opt_strs("extern") {
583583
let mut parts = arg.splitn(2, '=');
584584
let name = parts.next().ok_or("--extern value must not be empty".to_string())?;
@@ -589,7 +589,13 @@ fn parse_externs(matches: &getopts::Matches) -> Result<Externs, String> {
589589
}
590590
let name = name.to_string();
591591
// For Rustdoc purposes, we can treat all externs as public
592-
externs.entry(name).or_default().insert(ExternEntry { location, public: true });
592+
externs.entry(name)
593+
.and_modify(|e| { e.locations.insert(location.clone()); } )
594+
.or_insert_with(|| {
595+
let mut locations = BTreeSet::new();
596+
locations.insert(location);
597+
ExternEntry { locations, is_private_dep: false }
598+
});
593599
}
594600
Ok(Externs::new(externs))
595601
}

0 commit comments

Comments
 (0)