]> git.lizzy.rs Git - rust.git/commitdiff
Move HashStable bound to the trait definition.
authorCamille GILLOT <gillot.camille@gmail.com>
Thu, 19 Mar 2020 12:15:34 +0000 (13:15 +0100)
committerCamille GILLOT <gillot.camille@gmail.com>
Thu, 26 Mar 2020 08:22:45 +0000 (09:22 +0100)
src/librustc/ty/query/config.rs
src/librustc/ty/query/job.rs

index 9495d9bfc6b314b3ad550f621e2037137ee49458..04662986702a935a0168b6ae50df8c7e5a480150 100644 (file)
@@ -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<CTX> {
 }
 
 pub trait QueryContext: DepContext {
-    type Query: Clone;
+    type Query: Clone + HashStable<Self::StableHashingContext>;
 
     /// Access the session.
     fn session(&self) -> &Session;
index 253c814588fbaccf8e8fb1d3767ac8921b0228f1..7f0156abdea1a6a3ddc8102a33e7b4a343dd3c5b 100644 (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();