about summary refs log tree commit diff
path: root/src/librustdoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-06-22 04:21:59 -0700
committerGitHub <noreply@github.com>2016-06-22 04:21:59 -0700
commite41cdabc3e5fff02abfef513d3289370fae358b8 (patch)
tree8c8de5f65c6796c558fd1a8d0f96031bc280499b /src/librustdoc
parent3ee3267af39aa95fed707c67acb656845eb8f365 (diff)
parentc749a3e4b588ccc46d34e0c7b40a1e9a2f374c5b (diff)
downloadrust-e41cdabc3e5fff02abfef513d3289370fae358b8.tar.gz
rust-e41cdabc3e5fff02abfef513d3289370fae358b8.zip
Auto merge of #34408 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests

- Successful merges: #34190, #34363, #34367, #34383, #34387, #34394, #34404
- Failed merges:
Diffstat (limited to 'src/librustdoc')
-rw-r--r--src/librustdoc/clean/inline.rs10
-rw-r--r--src/librustdoc/html/render.rs15
2 files changed, 17 insertions, 8 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index e49b96cbfd0..8ffbd6be418 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -143,8 +143,14 @@ pub fn load_attrs<'a, 'tcx>(cx: &DocContext, tcx: TyCtxt<'a, 'tcx, 'tcx>,
 pub fn record_extern_fqn(cx: &DocContext, did: DefId, kind: clean::TypeKind) {
     if let Some(tcx) = cx.tcx_opt() {
         let crate_name = tcx.sess.cstore.crate_name(did.krate).to_string();
-        let relative = tcx.def_path(did).data.into_iter().map(|elem| {
-            elem.data.to_string()
+        let relative = tcx.def_path(did).data.into_iter().filter_map(|elem| {
+            // extern blocks have an empty name
+            let s = elem.data.to_string();
+            if !s.is_empty() {
+                Some(s)
+            } else {
+                None
+            }
         });
         let fqn = once(crate_name).chain(relative).collect();
         cx.renderinfo.borrow_mut().external_paths.insert(did, (fqn, kind));
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 493d3d6abc9..0d390a87d20 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -1519,20 +1519,23 @@ impl<'a> Item<'a> {
         // located, then we return `None`.
         } else {
             let cache = cache();
-            let path = match cache.external_paths.get(&self.item.def_id) {
+            let external_path = match cache.external_paths.get(&self.item.def_id) {
                 Some(path) => path,
                 None => return None,
             };
-            let root = match cache.extern_locations.get(&self.item.def_id.krate) {
+            let mut path = match cache.extern_locations.get(&self.item.def_id.krate) {
                 Some(&(_, Remote(ref s))) => s.to_string(),
                 Some(&(_, Local)) => self.cx.root_path.clone(),
                 Some(&(_, Unknown)) => return None,
                 None => return None,
             };
-            Some(format!("{root}{path}/{file}?gotosrc={goto}",
-                         root = root,
-                         path = path[..path.len() - 1].join("/"),
-                         file = item_path(shortty(self.item), self.item.name.as_ref().unwrap()),
+            for item in &external_path[..external_path.len() - 1] {
+                path.push_str(item);
+                path.push_str("/");
+            }
+            Some(format!("{path}{file}?gotosrc={goto}",
+                         path = path,
+                         file = item_path(shortty(self.item), external_path.last().unwrap()),
                          goto = self.item.def_id.index.as_usize()))
         }
     }