about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2023-02-19 13:03:41 +0530
committerGitHub <noreply@github.com>2023-02-19 13:03:41 +0530
commit4a0f088f7c0e2899c86c708ff9586c1b3fcbe203 (patch)
tree4630a15debedb29c76a4c8037654376c38b7959b /compiler
parent4165de40f894757026229b5220ad4867bed7a2ff (diff)
parentefbf6547cfeb579c0fbed4306086708d31f7a59d (diff)
downloadrust-4a0f088f7c0e2899c86c708ff9586c1b3fcbe203.tar.gz
rust-4a0f088f7c0e2899c86c708ff9586c1b3fcbe203.zip
Rollup merge of #107951 - petrochenkov:procmacdoc, r=jackh726
resolve: Fix doc links referring to other crates when documenting proc macro crates directly

Fixes https://github.com/rust-lang/rust/issues/107950
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_resolve/src/late.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index 324de7461cd..162f91e05f8 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -4211,7 +4211,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
                 if let Some(res) = res
                     && let Some(def_id) = res.opt_def_id()
                     && !def_id.is_local()
-                    && self.r.session.crate_types().contains(&CrateType::ProcMacro) {
+                    && self.r.session.crate_types().contains(&CrateType::ProcMacro)
+                    && matches!(self.r.session.opts.resolve_doc_links, ResolveDocLinks::ExportedMetadata) {
                     // Encoding foreign def ids in proc macro crate metadata will ICE.
                     return None;
                 }
@@ -4281,6 +4282,10 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
                         .filter_map(|tr| {
                             if !tr.def_id.is_local()
                                 && self.r.session.crate_types().contains(&CrateType::ProcMacro)
+                                && matches!(
+                                    self.r.session.opts.resolve_doc_links,
+                                    ResolveDocLinks::ExportedMetadata
+                                )
                             {
                                 // Encoding foreign def ids in proc macro crate metadata will ICE.
                                 return None;