about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2020-03-27 07:43:11 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2020-03-27 07:43:11 +0100
commitdb5be1fe208d0cbdde750a0eb9f01bbd8afda1ee (patch)
treec83f6ed0c1ce68bce57565dbfefefae7b38265d0 /src
parent4faf701d2028dd6031a3c772ae4b3e844d51c3c3 (diff)
downloadrust-db5be1fe208d0cbdde750a0eb9f01bbd8afda1ee.tar.gz
rust-db5be1fe208d0cbdde750a0eb9f01bbd8afda1ee.zip
Move QueryContext to the parent module.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_query_system/query/caches.rs2
-rw-r--r--src/librustc_query_system/query/config.rs40
-rw-r--r--src/librustc_query_system/query/job.rs2
-rw-r--r--src/librustc_query_system/query/mod.rs41
-rw-r--r--src/librustc_query_system/query/plumbing.rs3
5 files changed, 46 insertions, 42 deletions
diff --git a/src/librustc_query_system/query/caches.rs b/src/librustc_query_system/query/caches.rs
index 51bea58fd80..0c0335ba04f 100644
--- a/src/librustc_query_system/query/caches.rs
+++ b/src/librustc_query_system/query/caches.rs
@@ -1,6 +1,6 @@
 use crate::dep_graph::DepNodeIndex;
-use crate::query::config::QueryContext;
 use crate::query::plumbing::{QueryLookup, QueryState};
+use crate::query::QueryContext;
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::sharded::Sharded;
diff --git a/src/librustc_query_system/query/config.rs b/src/librustc_query_system/query/config.rs
index 46a48a31161..20dad0bd47e 100644
--- a/src/librustc_query_system/query/config.rs
+++ b/src/librustc_query_system/query/config.rs
@@ -1,20 +1,14 @@
 //! Query configuration and description traits.
 
+use crate::dep_graph::DepNode;
 use crate::dep_graph::SerializedDepNodeIndex;
-use crate::dep_graph::{DepContext, DepGraph, DepNode};
 use crate::query::caches::QueryCache;
-use crate::query::job::{QueryJobId, QueryJobInfo};
 use crate::query::plumbing::CycleError;
-use crate::query::QueryState;
+use crate::query::{QueryContext, QueryState};
 use rustc_data_structures::profiling::ProfileCategory;
 use rustc_span::def_id::DefId;
 
 use rustc_data_structures::fingerprint::Fingerprint;
-use rustc_data_structures::fx::FxHashMap;
-use rustc_data_structures::stable_hasher::HashStable;
-use rustc_data_structures::sync::Lock;
-use rustc_data_structures::thin_vec::ThinVec;
-use rustc_errors::Diagnostic;
 use std::borrow::Cow;
 use std::fmt::Debug;
 use std::hash::Hash;
@@ -29,36 +23,6 @@ pub trait QueryConfig<CTX> {
     type Value: Clone;
 }
 
-pub trait QueryContext: DepContext {
-    type Query: Clone + HashStable<Self::StableHashingContext>;
-
-    fn incremental_verify_ich(&self) -> bool;
-    fn verbose(&self) -> bool;
-
-    /// Get string representation from DefPath.
-    fn def_path_str(&self, def_id: DefId) -> String;
-
-    /// Access the DepGraph.
-    fn dep_graph(&self) -> &DepGraph<Self::DepKind>;
-
-    /// Get the query information from the TLS context.
-    fn current_query_job(&self) -> Option<QueryJobId<Self::DepKind>>;
-
-    fn try_collect_active_jobs(
-        &self,
-    ) -> Option<FxHashMap<QueryJobId<Self::DepKind>, QueryJobInfo<Self>>>;
-
-    /// Executes a job by changing the `ImplicitCtxt` to point to the
-    /// new query job while it executes. It returns the diagnostics
-    /// captured during execution and the actual result.
-    fn start_query<R>(
-        &self,
-        token: QueryJobId<Self::DepKind>,
-        diagnostics: Option<&Lock<ThinVec<Diagnostic>>>,
-        compute: impl FnOnce(Self) -> R,
-    ) -> R;
-}
-
 pub trait QueryAccessors<CTX: QueryContext>: QueryConfig<CTX> {
     const ANON: bool;
     const EVAL_ALWAYS: bool;
diff --git a/src/librustc_query_system/query/job.rs b/src/librustc_query_system/query/job.rs
index a7488b6fdff..de6dc81d868 100644
--- a/src/librustc_query_system/query/job.rs
+++ b/src/librustc_query_system/query/job.rs
@@ -1,6 +1,6 @@
 use crate::dep_graph::{DepContext, DepKind};
-use crate::query::config::QueryContext;
 use crate::query::plumbing::CycleError;
+use crate::query::QueryContext;
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_span::Span;
diff --git a/src/librustc_query_system/query/mod.rs b/src/librustc_query_system/query/mod.rs
index 9d0a6665eac..b1677c5c93d 100644
--- a/src/librustc_query_system/query/mod.rs
+++ b/src/librustc_query_system/query/mod.rs
@@ -10,4 +10,43 @@ mod caches;
 pub use self::caches::{CacheSelector, DefaultCacheSelector, QueryCache};
 
 mod config;
-pub use self::config::{QueryAccessors, QueryConfig, QueryContext, QueryDescription};
+pub use self::config::{QueryAccessors, QueryConfig, QueryDescription};
+
+use crate::dep_graph::{DepContext, DepGraph};
+
+use rustc_data_structures::fx::FxHashMap;
+use rustc_data_structures::stable_hasher::HashStable;
+use rustc_data_structures::sync::Lock;
+use rustc_data_structures::thin_vec::ThinVec;
+use rustc_errors::Diagnostic;
+use rustc_span::def_id::DefId;
+
+pub trait QueryContext: DepContext {
+    type Query: Clone + HashStable<Self::StableHashingContext>;
+
+    fn incremental_verify_ich(&self) -> bool;
+    fn verbose(&self) -> bool;
+
+    /// Get string representation from DefPath.
+    fn def_path_str(&self, def_id: DefId) -> String;
+
+    /// Access the DepGraph.
+    fn dep_graph(&self) -> &DepGraph<Self::DepKind>;
+
+    /// Get the query information from the TLS context.
+    fn current_query_job(&self) -> Option<QueryJobId<Self::DepKind>>;
+
+    fn try_collect_active_jobs(
+        &self,
+    ) -> Option<FxHashMap<QueryJobId<Self::DepKind>, QueryJobInfo<Self>>>;
+
+    /// Executes a job by changing the `ImplicitCtxt` to point to the
+    /// new query job while it executes. It returns the diagnostics
+    /// captured during execution and the actual result.
+    fn start_query<R>(
+        &self,
+        token: QueryJobId<Self::DepKind>,
+        diagnostics: Option<&Lock<ThinVec<Diagnostic>>>,
+        compute: impl FnOnce(Self) -> R,
+    ) -> R;
+}
diff --git a/src/librustc_query_system/query/plumbing.rs b/src/librustc_query_system/query/plumbing.rs
index bec45b29d30..b371a914c6f 100644
--- a/src/librustc_query_system/query/plumbing.rs
+++ b/src/librustc_query_system/query/plumbing.rs
@@ -5,8 +5,9 @@
 use crate::dep_graph::{DepKind, DepNode};
 use crate::dep_graph::{DepNodeIndex, SerializedDepNodeIndex};
 use crate::query::caches::QueryCache;
-use crate::query::config::{QueryContext, QueryDescription};
+use crate::query::config::QueryDescription;
 use crate::query::job::{QueryInfo, QueryJob, QueryJobId, QueryJobInfo, QueryShardJobId};
+use crate::query::QueryContext;
 
 #[cfg(not(parallel_compiler))]
 use rustc_data_structures::cold_path;