Skip to content

Commit 42f0db5

Browse files
committed
Move HashStable bound to the trait definition.
1 parent 63087b6 commit 42f0db5

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/librustc/ty/query/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use rustc_hir::def_id::DefId;
1010

1111
use rustc_data_structures::fingerprint::Fingerprint;
1212
use rustc_data_structures::fx::FxHashMap;
13+
use rustc_data_structures::stable_hasher::HashStable;
1314
use rustc_query_system::dep_graph::{DepContext, DepNode};
1415
use rustc_session::Session;
1516
use std::borrow::Cow;
@@ -25,7 +26,7 @@ pub trait QueryConfig<CTX> {
2526
}
2627

2728
pub trait QueryContext: DepContext {
28-
type Query: Clone;
29+
type Query: Clone + HashStable<Self::StableHashingContext>;
2930

3031
/// Access the session.
3132
fn session(&self) -> &Session;

src/librustc/ty/query/job.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@ fn connected_to_root<CTX: QueryContext>(
405405
fn pick_query<'a, CTX, T, F>(query_map: &QueryMap<CTX>, tcx: CTX, queries: &'a [T], f: F) -> &'a T
406406
where
407407
CTX: QueryContext,
408-
CTX::Query: HashStable<CTX::StableHashingContext>,
409408
F: Fn(&T) -> (Span, QueryJobId<CTX::DepKind>),
410409
{
411410
// Deterministically pick an entry point
@@ -437,10 +436,7 @@ fn remove_cycle<CTX: QueryContext>(
437436
jobs: &mut Vec<QueryJobId<CTX::DepKind>>,
438437
wakelist: &mut Vec<Lrc<QueryWaiter<CTX>>>,
439438
tcx: CTX,
440-
) -> bool
441-
where
442-
CTX::Query: HashStable<CTX::StableHashingContext>,
443-
{
439+
) -> bool {
444440
let mut visited = FxHashSet::default();
445441
let mut stack = Vec::new();
446442
// Look for a cycle starting with the last query in `jobs`
@@ -564,10 +560,7 @@ pub unsafe fn handle_deadlock() {
564560
/// There may be multiple cycles involved in a deadlock, so this searches
565561
/// all active queries for cycles before finally resuming all the waiters at once.
566562
#[cfg(parallel_compiler)]
567-
fn deadlock<CTX: QueryContext>(tcx: CTX, registry: &rayon_core::Registry)
568-
where
569-
CTX::Query: HashStable<CTX::StableHashingContext>,
570-
{
563+
fn deadlock<CTX: QueryContext>(tcx: CTX, registry: &rayon_core::Registry) {
571564
let on_panic = OnDrop(|| {
572565
eprintln!("deadlock handler panicked, aborting process");
573566
process::abort();

0 commit comments

Comments
 (0)