Apply --cfg parallel_compiler when documenting

This also reverts commit 9823c2cc70
working around the bug.
This commit is contained in:
Joshua Nelson 2021-05-01 00:06:17 -04:00
parent b52769b804
commit 1da4445109
3 changed files with 6 additions and 6 deletions

View File

@ -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(

View File

@ -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)
}
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(

View File

@ -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");