1
Fork 0

Move HashStable bound to the trait definition.

This commit is contained in:
Camille GILLOT 2020-03-19 13:15:34 +01:00
parent 63087b6b15
commit 42f0db5987
2 changed files with 4 additions and 10 deletions

View file

@ -10,6 +10,7 @@ use rustc_hir::def_id::DefId;
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<CTX> {
}
pub trait QueryContext: DepContext {
type Query: Clone;
type Query: Clone + HashStable<Self::StableHashingContext>;
/// Access the session.
fn session(&self) -> &Session;

View file

@ -405,7 +405,6 @@ fn connected_to_root<CTX: QueryContext>(
fn pick_query<'a, CTX, T, F>(query_map: &QueryMap<CTX>, tcx: CTX, queries: &'a [T], f: F) -> &'a T
where
CTX: QueryContext,
CTX::Query: HashStable<CTX::StableHashingContext>,
F: Fn(&T) -> (Span, QueryJobId<CTX::DepKind>),
{
// Deterministically pick an entry point
@ -437,10 +436,7 @@ fn remove_cycle<CTX: QueryContext>(
jobs: &mut Vec<QueryJobId<CTX::DepKind>>,
wakelist: &mut Vec<Lrc<QueryWaiter<CTX>>>,
tcx: CTX,
) -> bool
where
CTX::Query: HashStable<CTX::StableHashingContext>,
{
) -> 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<CTX: QueryContext>(tcx: CTX, registry: &rayon_core::Registry)
where
CTX::Query: HashStable<CTX::StableHashingContext>,
{
fn deadlock<CTX: QueryContext>(tcx: CTX, registry: &rayon_core::Registry) {
let on_panic = OnDrop(|| {
eprintln!("deadlock handler panicked, aborting process");
process::abort();