]> git.lizzy.rs Git - rust.git/commitdiff
Update rustdoc to new ExternEntry format
authorAaron Hill <aa1ronham@gmail.com>
Sun, 7 Apr 2019 23:15:32 +0000 (19:15 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Sun, 14 Apr 2019 19:45:18 +0000 (15:45 -0400)
src/librustdoc/config.rs

index fae07be101780911ca7f914d4af55a9ff3ae1224..8a669cad514b54f51e3cf608be463c664861487a 100644 (file)
@@ -578,7 +578,7 @@ fn parse_extern_html_roots(
 /// error message.
 // FIXME(eddyb) This shouldn't be duplicated with `rustc::session`.
 fn parse_externs(matches: &getopts::Matches) -> Result<Externs, String> {
-    let mut externs: BTreeMap<_, BTreeSet<_>> = BTreeMap::new();
+    let mut externs: BTreeMap<_, ExternEntry> = BTreeMap::new();
     for arg in &matches.opt_strs("extern") {
         let mut parts = arg.splitn(2, '=');
         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> {
         }
         let name = name.to_string();
         // For Rustdoc purposes, we can treat all externs as public
-        externs.entry(name).or_default().insert(ExternEntry { location, public: true });
+        externs.entry(name)
+            .and_modify(|e| { e.locations.insert(location.clone()); } )
+            .or_insert_with(|| {
+                let mut locations = BTreeSet::new();
+                locations.insert(location);
+                ExternEntry { locations, is_private_dep: false }
+            });
     }
     Ok(Externs::new(externs))
 }