Skip to content

Commit

Permalink
Fix cfg(parallel_compiler) mode
Browse files Browse the repository at this point in the history
Fix rebase
  • Loading branch information
petrochenkov committed Jul 28, 2019
1 parent 676d282 commit 1a37010
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 38 deletions.
2 changes: 2 additions & 0 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
48 changes: 15 additions & 33 deletions src/librustc/ty/query/job.rs
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
#![allow(unused_imports)] // `cfg(parallel_compiler)`

use std::mem;
use std::process;
use std::{fmt, ptr};
use crate::ty::context::TyCtxt;
use crate::ty::query::plumbing::CycleError;
use crate::ty::query::Query;
use crate::ty::tls;

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.
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -464,21 +454,13 @@ 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| {
gcx_ptr as *const _
});
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 _
});
Expand Down
1 change: 0 additions & 1 deletion src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_interface/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 1a37010

Please sign in to comment.