Skip to content

Commit 1a37010

Browse files
committed
Fix cfg(parallel_compiler) mode
Fix rebase
1 parent 676d282 commit 1a37010

File tree

5 files changed

+19
-38
lines changed

5 files changed

+19
-38
lines changed

src/bootstrap/bin/rustc.rs

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ fn main() {
127127

128128
if env::var_os("RUSTC_DENY_WARNINGS").is_some() &&
129129
env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
130+
// When extending this list, search for `NO-RUSTC-WRAPPER` and add the new lints
131+
// there as well, some code doesn't go through this `rustc` wrapper.
130132
cmd.arg("-Dwarnings");
131133
cmd.arg("-Drust_2018_idioms");
132134
cmd.arg("-Dunused_lifetimes");

src/libcore/array.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ where
217217
}
218218

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

236236
#[stable(feature = "rust1", since = "1.0.0")]
237-
impl<'a, 'b, A, B, const N: usize> PartialEq<[B]> for [A; N]
237+
impl<A, B, const N: usize> PartialEq<[B]> for [A; N]
238238
where
239239
A: PartialEq<B>,
240240
[A; N]: LengthAtMost32,

src/librustc/ty/query/job.rs

+15-33
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,25 @@
1-
#![allow(unused_imports)] // `cfg(parallel_compiler)`
2-
3-
use std::mem;
4-
use std::process;
5-
use std::{fmt, ptr};
1+
use crate::ty::context::TyCtxt;
2+
use crate::ty::query::plumbing::CycleError;
3+
use crate::ty::query::Query;
4+
use crate::ty::tls;
65

7-
use rustc_data_structures::fx::FxHashSet;
8-
use rustc_data_structures::sync::{Lock, LockGuard, Lrc, Weak};
9-
use rustc_data_structures::OnDrop;
10-
use rustc_data_structures::jobserver;
6+
use rustc_data_structures::sync::Lrc;
117
use syntax_pos::Span;
128

13-
use crate::ty::tls;
14-
use crate::ty::query::Query;
15-
use crate::ty::query::plumbing::CycleError;
169
#[cfg(not(parallel_compiler))]
17-
use crate::ty::query::{
18-
plumbing::TryGetJob,
19-
config::QueryDescription,
20-
};
21-
use crate::ty::context::TyCtxt;
10+
use std::ptr;
2211

2312
#[cfg(parallel_compiler)]
2413
use {
25-
rustc_rayon_core as rayon_core,
2614
parking_lot::{Mutex, Condvar},
27-
std::sync::atomic::Ordering,
28-
std::thread,
29-
std::iter,
30-
std::iter::FromIterator,
15+
rustc_data_structures::{jobserver, OnDrop},
16+
rustc_data_structures::fx::FxHashSet,
17+
rustc_data_structures::stable_hasher::{StableHasher, HashStable},
18+
rustc_data_structures::sync::Lock,
19+
rustc_rayon_core as rayon_core,
3120
syntax_pos::DUMMY_SP,
32-
rustc_data_structures::stable_hasher::{StableHasherResult, StableHasher, HashStable},
21+
std::{mem, process, thread},
22+
std::iter::FromIterator,
3323
};
3424

3525
/// Indicates the state of a query for a given key in a query map.
@@ -81,7 +71,7 @@ impl<'tcx> QueryJob<'tcx> {
8171
span: Span,
8272
) -> Result<(), CycleError<'tcx>> {
8373
tls::with_related_context(tcx, move |icx| {
84-
let mut waiter = Lrc::new(QueryWaiter {
74+
let waiter = Lrc::new(QueryWaiter {
8575
query: icx.query.clone(),
8676
span,
8777
cycle: Lock::new(None),
@@ -432,7 +422,7 @@ fn remove_cycle<'tcx>(
432422
let usage = usage.as_ref().map(|(span, query)| (*span, query.info.query.clone()));
433423

434424
// Create the cycle error
435-
let mut error = CycleError {
425+
let error = CycleError {
436426
usage,
437427
cycle: stack.iter().map(|&(s, ref q)| QueryInfo {
438428
span: s,
@@ -464,21 +454,13 @@ fn remove_cycle<'tcx>(
464454
/// Must only be called when a deadlock is about to happen.
465455
#[cfg(parallel_compiler)]
466456
pub unsafe fn handle_deadlock() {
467-
use syntax;
468-
use syntax_pos;
469-
470457
let registry = rayon_core::Registry::current();
471458

472459
let gcx_ptr = tls::GCX_PTR.with(|gcx_ptr| {
473460
gcx_ptr as *const _
474461
});
475462
let gcx_ptr = &*gcx_ptr;
476463

477-
let syntax_globals = syntax::GLOBALS.with(|syntax_globals| {
478-
syntax_globals as *const _
479-
});
480-
let syntax_globals = &*syntax_globals;
481-
482464
let syntax_pos_globals = syntax_pos::GLOBALS.with(|syntax_pos_globals| {
483465
syntax_pos_globals as *const _
484466
});

src/librustc_interface/passes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use rustc::util::common::{time, ErrorReported};
1717
use rustc::session::Session;
1818
use rustc::session::config::{self, CrateType, Input, OutputFilenames, OutputType};
1919
use rustc::session::search_paths::PathKind;
20-
use rustc_allocator as allocator;
2120
use rustc_ast_borrowck as borrowck;
2221
use rustc_codegen_ssa::back::link::emit_metadata;
2322
use rustc_codegen_utils::codegen_backend::CodegenBackend;

src/librustc_interface/util.rs

-2
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
203203
f: F,
204204
) -> R {
205205
use rayon::{ThreadPool, ThreadPoolBuilder};
206-
use syntax;
207-
use syntax_pos;
208206

209207
let gcx_ptr = &Lock::new(0);
210208

0 commit comments

Comments
 (0)