Fix cfg(parallel_compiler) mode

Fix rebase
This commit is contained in:
Vadim Petrochenkov 2019-07-24 11:44:14 +03:00
parent 676d282dd3
commit 1a370109ec
5 changed files with 19 additions and 38 deletions

View File

@ -127,6 +127,8 @@ fn main() {
if env::var_os("RUSTC_DENY_WARNINGS").is_some() &&
env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
// When extending this list, search for `NO-RUSTC-WRAPPER` and add the new lints
// there as well, some code doesn't go through this `rustc` wrapper.
cmd.arg("-Dwarnings");
cmd.arg("-Drust_2018_idioms");
cmd.arg("-Dunused_lifetimes");

View File

@ -217,7 +217,7 @@ where
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A, B, const N: usize> PartialEq<[B; N]> for [A; N]
impl<A, B, const N: usize> PartialEq<[B; N]> for [A; N]
where
A: PartialEq<B>,
[A; N]: LengthAtMost32,
@ -234,7 +234,7 @@ where
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A, B, const N: usize> PartialEq<[B]> for [A; N]
impl<A, B, const N: usize> PartialEq<[B]> for [A; N]
where
A: PartialEq<B>,
[A; N]: LengthAtMost32,

View File

@ -1,35 +1,25 @@
#![allow(unused_imports)] // `cfg(parallel_compiler)`
use crate::ty::context::TyCtxt;
use crate::ty::query::plumbing::CycleError;
use crate::ty::query::Query;
use crate::ty::tls;
use std::mem;
use std::process;
use std::{fmt, ptr};
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::sync::{Lock, LockGuard, Lrc, Weak};
use rustc_data_structures::OnDrop;
use rustc_data_structures::jobserver;
use rustc_data_structures::sync::Lrc;
use syntax_pos::Span;
use crate::ty::tls;
use crate::ty::query::Query;
use crate::ty::query::plumbing::CycleError;
#[cfg(not(parallel_compiler))]
use crate::ty::query::{
plumbing::TryGetJob,
config::QueryDescription,
};
use crate::ty::context::TyCtxt;
use std::ptr;
#[cfg(parallel_compiler)]
use {
rustc_rayon_core as rayon_core,
parking_lot::{Mutex, Condvar},
std::sync::atomic::Ordering,
std::thread,
std::iter,
std::iter::FromIterator,
rustc_data_structures::{jobserver, OnDrop},
rustc_data_structures::fx::FxHashSet,
rustc_data_structures::stable_hasher::{StableHasher, HashStable},
rustc_data_structures::sync::Lock,
rustc_rayon_core as rayon_core,
syntax_pos::DUMMY_SP,
rustc_data_structures::stable_hasher::{StableHasherResult, StableHasher, HashStable},
std::{mem, process, thread},
std::iter::FromIterator,
};
/// Indicates the state of a query for a given key in a query map.
@ -81,7 +71,7 @@ impl<'tcx> QueryJob<'tcx> {
span: Span,
) -> Result<(), CycleError<'tcx>> {
tls::with_related_context(tcx, move |icx| {
let mut waiter = Lrc::new(QueryWaiter {
let waiter = Lrc::new(QueryWaiter {
query: icx.query.clone(),
span,
cycle: Lock::new(None),
@ -432,7 +422,7 @@ fn remove_cycle<'tcx>(
let usage = usage.as_ref().map(|(span, query)| (*span, query.info.query.clone()));
// Create the cycle error
let mut error = CycleError {
let error = CycleError {
usage,
cycle: stack.iter().map(|&(s, ref q)| QueryInfo {
span: s,
@ -464,9 +454,6 @@ fn remove_cycle<'tcx>(
/// Must only be called when a deadlock is about to happen.
#[cfg(parallel_compiler)]
pub unsafe fn handle_deadlock() {
use syntax;
use syntax_pos;
let registry = rayon_core::Registry::current();
let gcx_ptr = tls::GCX_PTR.with(|gcx_ptr| {
@ -474,11 +461,6 @@ pub unsafe fn handle_deadlock() {
});
let gcx_ptr = &*gcx_ptr;
let syntax_globals = syntax::GLOBALS.with(|syntax_globals| {
syntax_globals as *const _
});
let syntax_globals = &*syntax_globals;
let syntax_pos_globals = syntax_pos::GLOBALS.with(|syntax_pos_globals| {
syntax_pos_globals as *const _
});

View File

@ -17,7 +17,6 @@ use rustc::util::common::{time, ErrorReported};
use rustc::session::Session;
use rustc::session::config::{self, CrateType, Input, OutputFilenames, OutputType};
use rustc::session::search_paths::PathKind;
use rustc_allocator as allocator;
use rustc_ast_borrowck as borrowck;
use rustc_codegen_ssa::back::link::emit_metadata;
use rustc_codegen_utils::codegen_backend::CodegenBackend;

View File

@ -203,8 +203,6 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
f: F,
) -> R {
use rayon::{ThreadPool, ThreadPoolBuilder};
use syntax;
use syntax_pos;
let gcx_ptr = &Lock::new(0);