Skip to content

Commit

Permalink
rustdoc: Remove broken src links from reexported items from macros
Browse files Browse the repository at this point in the history
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
ollie27 committed Dec 9, 2016
1 parent d9aae63 commit c6c3a27
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 c6c3a27

Please sign in to comment.