Skip to content

Commit e3363f2

Browse files
authored
Rollup merge of rust-lang#38264 - ollie27:rustdoc_src_macro, r=brson
rustdoc: Remove broken src links from reexported items from macros When an item is defined in an external macro it doesn't get a real filename so we need to filter out these when generating src links for reexported items.
2 parents a9dcfd0 + c6c3a27 commit e3363f2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: src/librustdoc/html/render.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,13 @@ impl<'a> Item<'a> {
14681468
return None;
14691469
}
14701470
} else {
1471+
// Macros from other libraries get special filenames which we can
1472+
// safely ignore.
1473+
if self.item.source.filename.starts_with("<") &&
1474+
self.item.source.filename.ends_with("macros>") {
1475+
return None;
1476+
}
1477+
14711478
let (krate, src_root) = match cache.extern_locations.get(&self.item.def_id.krate) {
14721479
Some(&(ref name, ref src, Local)) => (name, src),
14731480
Some(&(ref name, ref src, Remote(ref s))) => {

0 commit comments

Comments
 (0)