From 1da44451098e9947fa398e7d2858853a8964c200 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sat, 1 May 2021 00:06:17 -0400 Subject: [PATCH] Apply `--cfg parallel_compiler` when documenting This also reverts commit 9823c2cc700fea541bf2670fcee93af662b63022 working around the bug. --- compiler/rustc_middle/src/ty/query/mod.rs | 1 + compiler/rustc_query_impl/src/plumbing.rs | 10 ++++------ src/bootstrap/compile.rs | 1 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_middle/src/ty/query/mod.rs b/compiler/rustc_middle/src/ty/query/mod.rs index c170858ba85..f50c506f169 100644 --- a/compiler/rustc_middle/src/ty/query/mod.rs +++ b/compiler/rustc_middle/src/ty/query/mod.rs @@ -233,6 +233,7 @@ macro_rules! define_callbacks { } pub trait QueryEngine<'tcx>: rustc_data_structures::sync::Sync { + #[cfg(parallel_compiler)] unsafe fn deadlock(&'tcx self, tcx: TyCtxt<'tcx>, registry: &rustc_rayon_core::Registry); fn encode_query_results( diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index ee914fa1ba9..c789aa2fa59 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -550,12 +550,10 @@ macro_rules! define_queries_struct { } impl QueryEngine<'tcx> for Queries<'tcx> { - unsafe fn deadlock(&'tcx self, _tcx: TyCtxt<'tcx>, _registry: &rustc_rayon_core::Registry) { - #[cfg(parallel_compiler)] - { - let tcx = QueryCtxt { tcx: _tcx, queries: self }; - rustc_query_system::query::deadlock(tcx, _registry) - } + #[cfg(parallel_compiler)] + unsafe fn deadlock(&'tcx self, tcx: TyCtxt<'tcx>, registry: &rustc_rayon_core::Registry) { + let tcx = QueryCtxt { tcx, queries: self }; + rustc_query_system::query::deadlock(tcx, registry) } fn encode_query_results( diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 66a88e85fea..2676b3bf8e0 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -648,6 +648,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS } if builder.config.rustc_parallel { cargo.rustflag("--cfg=parallel_compiler"); + cargo.rustdocflag("--cfg=parallel_compiler"); } if builder.config.rust_verify_llvm_ir { cargo.env("RUSTC_VERIFY_LLVM_IR", "1");