]> git.lizzy.rs Git - rust.git/commitdiff
Move QueryContext to the parent module.
authorCamille GILLOT <gillot.camille@gmail.com>
Fri, 27 Mar 2020 06:43:11 +0000 (07:43 +0100)
committerCamille GILLOT <gillot.camille@gmail.com>
Fri, 27 Mar 2020 06:43:11 +0000 (07:43 +0100)
src/librustc_query_system/query/caches.rs
src/librustc_query_system/query/config.rs
src/librustc_query_system/query/job.rs
src/librustc_query_system/query/mod.rs
src/librustc_query_system/query/plumbing.rs

index 51bea58fd80d82d018301549de1a48b92de24b4b..0c0335ba04f9a17934a8b96fc3d476a1294d7b05 100644 (file)
@@ -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;
index 46a48a31161c74cefc07bbfd3cfe98be13e9f9c7..20dad0bd47ebcfb1de39e458e0d35a5b7f31268d 100644 (file)
@@ -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;
index a7488b6fdff10bc3227897d9f429676e6636e111..de6dc81d8687a18be8d9e7ad7ccc7cc3257258e3 100644 (file)
@@ -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;
index 9d0a6665eac60c8c6aa84f6c2e1b7066e1ef8ea6..b1677c5c93da9e9a4a8fa978e7b255135339e103 100644 (file)
 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;
+}
index bec45b29d308e10f48f220e1232f3e0b768bdb12..b371a914c6fce02304d26bd16c237862b4a91e7c 100644 (file)
@@ -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;