1
Fork 0

Auto merge of #31614 - mitaa:rdoc_locitem_extmac, r=alexcrichton

fixes #26606

r? @alexcrichton
This commit is contained in:
bors 2016-02-14 10:10:50 +00:00
commit 083dc5b12d
3 changed files with 46 additions and 5 deletions

View file

@ -1501,11 +1501,17 @@ impl<'a> Item<'a> {
true, |component| {
path.push(component.to_string());
});
Some(format!("{root}src/{krate}/{path}.html#{href}",
root = self.cx.root_path,
krate = self.cx.layout.krate,
path = path.join("/"),
href = href))
// If the span points into an external macro the
// source-file will be bogus, i.e `<foo macros>`
if Path::new(&self.item.source.filename).is_file() {
Some(format!("{root}src/{krate}/{path}.html#{href}",
root = self.cx.root_path,
krate = self.cx.layout.krate,
path = path.join("/"),
href = href))
} else {
None
}
// If this item is not part of the local crate, then things get a little
// trickier. We don't actually know the span of the external item, but