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.
This commit is contained in:
Oliver Middleton 2016-12-09 14:56:55 +00:00
parent d9aae6362d
commit c6c3a2763b
1 changed files with 7 additions and 0 deletions

View File

@ -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))) => {