Rollup merge of #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.
This commit is contained in:
Corey Farwell 2016-12-12 14:10:33 -05:00 committed by GitHub
commit e3363f2772
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))) => {