From 42f0db59873ab47d5c8a00620e94bea63dea35a0 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Thu, 19 Mar 2020 13:15:34 +0100 Subject: [PATCH] Move HashStable bound to the trait definition. --- src/librustc/ty/query/config.rs | 3 ++- src/librustc/ty/query/job.rs | 11 ++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index 9495d9bfc6b..04662986702 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -10,6 +10,7 @@ use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::stable_hasher::HashStable; use rustc_query_system::dep_graph::{DepContext, DepNode}; use rustc_session::Session; use std::borrow::Cow; @@ -25,7 +26,7 @@ pub trait QueryConfig { } pub trait QueryContext: DepContext { - type Query: Clone; + type Query: Clone + HashStable; /// Access the session. fn session(&self) -> &Session; diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index 253c814588f..7f0156abdea 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -405,7 +405,6 @@ fn connected_to_root( fn pick_query<'a, CTX, T, F>(query_map: &QueryMap, tcx: CTX, queries: &'a [T], f: F) -> &'a T where CTX: QueryContext, - CTX::Query: HashStable, F: Fn(&T) -> (Span, QueryJobId), { // Deterministically pick an entry point @@ -437,10 +436,7 @@ fn remove_cycle( jobs: &mut Vec>, wakelist: &mut Vec>>, tcx: CTX, -) -> bool -where - CTX::Query: HashStable, -{ +) -> bool { let mut visited = FxHashSet::default(); let mut stack = Vec::new(); // Look for a cycle starting with the last query in `jobs` @@ -564,10 +560,7 @@ pub unsafe fn handle_deadlock() { /// There may be multiple cycles involved in a deadlock, so this searches /// all active queries for cycles before finally resuming all the waiters at once. #[cfg(parallel_compiler)] -fn deadlock(tcx: CTX, registry: &rayon_core::Registry) -where - CTX::Query: HashStable, -{ +fn deadlock(tcx: CTX, registry: &rayon_core::Registry) { let on_panic = OnDrop(|| { eprintln!("deadlock handler panicked, aborting process"); process::abort(); -- 2.44.0