Skip to content

Commit 52308be

Browse files
committed
Auto merge of #31614 - mitaa:rdoc_locitem_extmac, r=alexcrichton
fixes #26606 r? @alexcrichton
2 parents 4bc5507 + a57cca9 commit 52308be

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

html/render.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,11 +1501,17 @@ impl<'a> Item<'a> {
15011501
true, |component| {
15021502
path.push(component.to_string());
15031503
});
1504-
Some(format!("{root}src/{krate}/{path}.html#{href}",
1505-
root = self.cx.root_path,
1506-
krate = self.cx.layout.krate,
1507-
path = path.join("/"),
1508-
href = href))
1504+
// If the span points into an external macro the
1505+
// source-file will be bogus, i.e `<foo macros>`
1506+
if Path::new(&self.item.source.filename).is_file() {
1507+
Some(format!("{root}src/{krate}/{path}.html#{href}",
1508+
root = self.cx.root_path,
1509+
krate = self.cx.layout.krate,
1510+
path = path.join("/"),
1511+
href = href))
1512+
} else {
1513+
None
1514+
}
15091515

15101516
// If this item is not part of the local crate, then things get a little
15111517
// trickier. We don't actually know the span of the external item, but

0 commit comments

Comments
 (0)