about summary refs log tree commit diff
path: root/src/librustdoc/html/sources.rs
diff options
context:
space:
mode:
authorOliver Middleton <olliemail27@gmail.com>2020-04-05 22:37:06 +0100
committerOliver Middleton <olliemail27@gmail.com>2020-04-08 18:35:17 +0100
commit6f96dc221c53a80f20883d285d55099fbeba15f4 (patch)
treeebeba37cbb46405ba29c378dd4ff62fc27440a7d /src/librustdoc/html/sources.rs
parent607b8582362be8e26df7acc12fa242359d7edf95 (diff)
downloadrust-6f96dc221c53a80f20883d285d55099fbeba15f4.tar.gz
rust-6f96dc221c53a80f20883d285d55099fbeba15f4.zip
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.
Diffstat (limited to 'src/librustdoc/html/sources.rs')
-rw-r--r--src/librustdoc/html/sources.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs
index 86f46b2d7e1..c5f44baced2 100644
--- a/src/librustdoc/html/sources.rs
+++ b/src/librustdoc/html/sources.rs
@@ -5,6 +5,7 @@ use crate::html::format::Buffer;
 use crate::html::highlight;
 use crate::html::layout;
 use crate::html::render::{Error, SharedContext, BASIC_KEYWORDS};
+use rustc_hir::def_id::LOCAL_CRATE;
 use rustc_span::source_map::FileName;
 use std::ffi::OsStr;
 use std::fs;
@@ -37,8 +38,8 @@ impl<'a> DocFolder for SourceCollector<'a> {
         if self.scx.include_sources
             // skip all synthetic "files"
             && item.source.filename.is_real()
-            // skip non-local items
-            && item.def_id.is_local()
+            // skip non-local files
+            && item.source.cnum == LOCAL_CRATE
         {
             // If it turns out that we couldn't read this file, then we probably
             // can't read any of the files (generating html output from json or