Skip to content

Commit

Permalink
Rollup merge of #38264 - ollie27:rustdoc_src_macro, r=brson
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
frewsxcv authored Dec 12, 2016
2 parents 68654b9 + c6c3a27 commit 1702795
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,13 @@ impl<'a> Item<'a> {
return None;
}
} else {
// Macros from other libraries get special filenames which we can
// safely ignore.
if self.item.source.filename.starts_with("<") &&
self.item.source.filename.ends_with("macros>") {
return None;
}

let (krate, src_root) = match cache.extern_locations.get(&self.item.def_id.krate) {
Some(&(ref name, ref src, Local)) => (name, src),
Some(&(ref name, ref src, Remote(ref s))) => {
Expand Down

0 comments on commit 1702795

Please sign in to comment.