|
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; |
6 | 5 |
|
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; |
11 | 7 | use syntax_pos::Span;
|
12 | 8 |
|
13 |
| -use crate::ty::tls; |
14 |
| -use crate::ty::query::Query; |
15 |
| -use crate::ty::query::plumbing::CycleError; |
16 | 9 | #[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; |
22 | 11 |
|
23 | 12 | #[cfg(parallel_compiler)]
|
24 | 13 | use {
|
25 |
| - rustc_rayon_core as rayon_core, |
26 | 14 | 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, |
31 | 20 | syntax_pos::DUMMY_SP,
|
32 |
| - rustc_data_structures::stable_hasher::{StableHasherResult, StableHasher, HashStable}, |
| 21 | + std::{mem, process, thread}, |
| 22 | + std::iter::FromIterator, |
33 | 23 | };
|
34 | 24 |
|
35 | 25 | /// Indicates the state of a query for a given key in a query map.
|
@@ -81,7 +71,7 @@ impl<'tcx> QueryJob<'tcx> {
|
81 | 71 | span: Span,
|
82 | 72 | ) -> Result<(), CycleError<'tcx>> {
|
83 | 73 | tls::with_related_context(tcx, move |icx| {
|
84 |
| - let mut waiter = Lrc::new(QueryWaiter { |
| 74 | + let waiter = Lrc::new(QueryWaiter { |
85 | 75 | query: icx.query.clone(),
|
86 | 76 | span,
|
87 | 77 | cycle: Lock::new(None),
|
@@ -432,7 +422,7 @@ fn remove_cycle<'tcx>(
|
432 | 422 | let usage = usage.as_ref().map(|(span, query)| (*span, query.info.query.clone()));
|
433 | 423 |
|
434 | 424 | // Create the cycle error
|
435 |
| - let mut error = CycleError { |
| 425 | + let error = CycleError { |
436 | 426 | usage,
|
437 | 427 | cycle: stack.iter().map(|&(s, ref q)| QueryInfo {
|
438 | 428 | span: s,
|
@@ -464,21 +454,13 @@ fn remove_cycle<'tcx>(
|
464 | 454 | /// Must only be called when a deadlock is about to happen.
|
465 | 455 | #[cfg(parallel_compiler)]
|
466 | 456 | pub unsafe fn handle_deadlock() {
|
467 |
| - use syntax; |
468 |
| - use syntax_pos; |
469 |
| - |
470 | 457 | let registry = rayon_core::Registry::current();
|
471 | 458 |
|
472 | 459 | let gcx_ptr = tls::GCX_PTR.with(|gcx_ptr| {
|
473 | 460 | gcx_ptr as *const _
|
474 | 461 | });
|
475 | 462 | let gcx_ptr = &*gcx_ptr;
|
476 | 463 |
|
477 |
| - let syntax_globals = syntax::GLOBALS.with(|syntax_globals| { |
478 |
| - syntax_globals as *const _ |
479 |
| - }); |
480 |
| - let syntax_globals = &*syntax_globals; |
481 |
| - |
482 | 464 | let syntax_pos_globals = syntax_pos::GLOBALS.with(|syntax_pos_globals| {
|
483 | 465 | syntax_pos_globals as *const _
|
484 | 466 | });
|
|
0 commit comments