rustdoc: Don't try to load source files from external crates
Local items defined in external macros shouldn't generate rendered source files and should link to the external crate's docs instead.
This commit is contained in:
parent
607b858236
commit
6f96dc221c
8 changed files with 47 additions and 7 deletions
|
@ -47,7 +47,7 @@ use rustc_data_structures::flock;
|
|||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_feature::UnstableFeatures;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_hir::Mutability;
|
||||
use rustc_middle::middle::privacy::AccessLevels;
|
||||
use rustc_middle::middle::stability;
|
||||
|
@ -1623,14 +1623,14 @@ impl Context {
|
|||
_ => return None,
|
||||
};
|
||||
|
||||
let (krate, path) = if item.def_id.is_local() {
|
||||
let (krate, path) = if item.source.cnum == LOCAL_CRATE {
|
||||
if let Some(path) = self.shared.local_sources.get(file) {
|
||||
(&self.shared.layout.krate, path)
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
} else {
|
||||
let (krate, src_root) = match *self.cache.extern_locations.get(&item.def_id.krate)? {
|
||||
let (krate, src_root) = match *self.cache.extern_locations.get(&item.source.cnum)? {
|
||||
(ref name, ref src, Local) => (name, src),
|
||||
(ref name, ref src, Remote(ref s)) => {
|
||||
root = s.to_string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue