From 4581d16bcbea9273b6755dd24a884a234a0dc2f7 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Tue, 19 Jan 2021 20:40:16 +0100 Subject: [PATCH] Move the query system to rustc_query_impl. --- Cargo.lock | 24 +++++++ compiler/rustc_interface/Cargo.toml | 1 + compiler/rustc_interface/src/passes.rs | 8 +-- compiler/rustc_interface/src/queries.rs | 8 +-- compiler/rustc_macros/src/query.rs | 3 + compiler/rustc_middle/src/ty/context.rs | 2 +- compiler/rustc_middle/src/ty/mod.rs | 2 - compiler/rustc_middle/src/ty/query/mod.rs | 44 +++++-------- .../src/ty/query/on_disk_cache.rs | 4 +- compiler/rustc_query_impl/Cargo.toml | 27 ++++++++ .../query => rustc_query_impl/src}/README.md | 0 .../ty/query => rustc_query_impl/src}/keys.rs | 10 +-- compiler/rustc_query_impl/src/lib.rs | 65 +++++++++++++++++++ .../src}/plumbing.rs | 44 ++++--------- .../src}/profiling_support.rs | 3 +- .../query => rustc_query_impl/src}/stats.rs | 4 +- .../query => rustc_query_impl/src}/values.rs | 4 +- 17 files changed, 170 insertions(+), 83 deletions(-) create mode 100644 compiler/rustc_query_impl/Cargo.toml rename compiler/{rustc_middle/src/ty/query => rustc_query_impl/src}/README.md (100%) rename compiler/{rustc_middle/src/ty/query => rustc_query_impl/src}/keys.rs (97%) create mode 100644 compiler/rustc_query_impl/src/lib.rs rename compiler/{rustc_middle/src/ty/query => rustc_query_impl/src}/plumbing.rs (95%) rename compiler/{rustc_middle/src/ty/query => rustc_query_impl/src}/profiling_support.rs (99%) rename compiler/{rustc_middle/src/ty/query => rustc_query_impl/src}/stats.rs (98%) rename compiler/{rustc_middle/src/ty/query => rustc_query_impl/src}/values.rs (94%) diff --git a/Cargo.lock b/Cargo.lock index b78bf583205..0576a55a447 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3901,6 +3901,7 @@ dependencies = [ "rustc_passes", "rustc_plugin_impl", "rustc_privacy", + "rustc_query_impl", "rustc_resolve", "rustc_serialize", "rustc_session", @@ -4167,6 +4168,29 @@ dependencies = [ "tracing", ] +[[package]] +name = "rustc_query_impl" +version = "0.0.0" +dependencies = [ + "measureme", + "rustc-rayon-core", + "rustc_ast", + "rustc_attr", + "rustc_data_structures", + "rustc_errors", + "rustc_feature", + "rustc_hir", + "rustc_index", + "rustc_macros", + "rustc_middle", + "rustc_query_system", + "rustc_serialize", + "rustc_session", + "rustc_span", + "rustc_target", + "tracing", +] + [[package]] name = "rustc_query_system" version = "0.0.0" diff --git a/compiler/rustc_interface/Cargo.toml b/compiler/rustc_interface/Cargo.toml index a1ac155d57a..cfe98a630c1 100644 --- a/compiler/rustc_interface/Cargo.toml +++ b/compiler/rustc_interface/Cargo.toml @@ -41,6 +41,7 @@ rustc_lint = { path = "../rustc_lint" } rustc_errors = { path = "../rustc_errors" } rustc_plugin_impl = { path = "../rustc_plugin_impl" } rustc_privacy = { path = "../rustc_privacy" } +rustc_query_impl = { path = "../rustc_query_impl" } rustc_resolve = { path = "../rustc_resolve" } rustc_trait_selection = { path = "../rustc_trait_selection" } rustc_ty_utils = { path = "../rustc_ty_utils" } diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 76d988815ff..6358855ac32 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -21,7 +21,6 @@ use rustc_middle::arena::Arena; use rustc_middle::dep_graph::DepGraph; use rustc_middle::middle; use rustc_middle::middle::cstore::{CrateStore, MetadataLoader, MetadataLoaderDyn}; -use rustc_middle::ty::query; use rustc_middle::ty::query::Providers; use rustc_middle::ty::{self, GlobalCtxt, ResolverOutputs, TyCtxt}; use rustc_mir as mir; @@ -29,6 +28,7 @@ use rustc_mir_build as mir_build; use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str}; use rustc_passes::{self, hir_stats, layout_test}; use rustc_plugin_impl as plugin; +use rustc_query_impl::Queries as TcxQueries; use rustc_resolve::{Resolver, ResolverArenas}; use rustc_session::config::{CrateType, Input, OutputFilenames, OutputType, PpMode, PpSourceMode}; use rustc_session::lint; @@ -762,7 +762,7 @@ pub fn create_global_ctxt<'tcx>( mut resolver_outputs: ResolverOutputs, outputs: OutputFilenames, crate_name: &str, - queries: &'tcx OnceCell>, + queries: &'tcx OnceCell>, global_ctxt: &'tcx OnceCell>, arena: &'tcx WorkerLocal>, ) -> QueryContext<'tcx> { @@ -791,7 +791,7 @@ pub fn create_global_ctxt<'tcx>( let max_cnum = crates.iter().map(|c| c.as_usize()).max().unwrap_or(0); let mut providers = IndexVec::from_elem_n(extern_providers, max_cnum + 1); providers[LOCAL_CRATE] = local_providers; - queries.get_or_init(|| query::Queries::new(providers, extern_providers)) + queries.get_or_init(|| TcxQueries::new(providers, extern_providers)) }; let gcx = sess.time("setup_global_ctxt", || { @@ -805,7 +805,7 @@ pub fn create_global_ctxt<'tcx>( defs, dep_graph, query_result_on_disk_cache, - queries, + queries.as_dyn(), &crate_name, &outputs, ) diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index f70701257e2..9c38d2b91ab 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -13,8 +13,8 @@ use rustc_incremental::DepGraphFuture; use rustc_lint::LintStore; use rustc_middle::arena::Arena; use rustc_middle::dep_graph::DepGraph; -use rustc_middle::ty::query; use rustc_middle::ty::{GlobalCtxt, ResolverOutputs, TyCtxt}; +use rustc_query_impl::Queries as TcxQueries; use rustc_serialize::json; use rustc_session::config::{self, OutputFilenames, OutputType}; use rustc_session::{output::find_crate_name, Session}; @@ -72,7 +72,7 @@ impl Default for Query { pub struct Queries<'tcx> { compiler: &'tcx Compiler, gcx: OnceCell>, - queries: OnceCell>, + queries: OnceCell>, arena: WorkerLocal>, hir_arena: WorkerLocal>, @@ -429,11 +429,11 @@ impl Compiler { { let _prof_timer = queries.session().prof.generic_activity("self_profile_alloc_query_strings"); - gcx.enter(query::alloc_self_profile_query_strings); + gcx.enter(rustc_query_impl::alloc_self_profile_query_strings); } if self.session().opts.debugging_opts.query_stats { - gcx.enter(query::print_stats); + gcx.enter(rustc_query_impl::print_stats); } } diff --git a/compiler/rustc_macros/src/query.rs b/compiler/rustc_macros/src/query.rs index 5326f0ae269..3e67525567f 100644 --- a/compiler/rustc_macros/src/query.rs +++ b/compiler/rustc_macros/src/query.rs @@ -495,6 +495,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream { } TokenStream::from(quote! { + #[macro_export] macro_rules! rustc_query_append { ([$($macro:tt)*][$($other:tt)*]) => { $($macro)* { @@ -514,11 +515,13 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream { ); } } + #[macro_export] macro_rules! rustc_cached_queries { ($($macro:tt)*) => { $($macro)*(#cached_queries); } } + #[macro_export] macro_rules! rustc_query_description { () => { #query_description_stream } } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 6c1e09b9bf9..d316d595b1a 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -966,7 +966,7 @@ pub struct GlobalCtxt<'tcx> { /// Do not access this directly. It is only meant to be used by /// `DepGraph::try_mark_green()` and the query infrastructure. /// This is `None` if we are not incremental compilation mode - pub(crate) on_disk_cache: Option>, + pub on_disk_cache: Option>, pub queries: &'tcx dyn query::QueryEngine<'tcx>, pub query_caches: query::QueryCaches<'tcx>, diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index b7f62437fa5..018d269bfd1 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -100,8 +100,6 @@ pub use self::list::List; pub use self::trait_def::TraitDef; -pub use self::query::queries; - pub use self::consts::{Const, ConstInt, ConstKind, InferConst, ScalarInt}; pub mod _match; diff --git a/compiler/rustc_middle/src/ty/query/mod.rs b/compiler/rustc_middle/src/ty/query/mod.rs index 0abd5676557..0bc14f1e27c 100644 --- a/compiler/rustc_middle/src/ty/query/mod.rs +++ b/compiler/rustc_middle/src/ty/query/mod.rs @@ -31,13 +31,12 @@ use crate::traits::{self, ImplSource}; use crate::ty::subst::{GenericArg, SubstsRef}; use crate::ty::util::AlwaysRequiresDrop; use crate::ty::{self, AdtSizedConstraint, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt}; -use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; use rustc_data_structures::stable_hasher::StableVec; use rustc_data_structures::steal::Steal; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::Lrc; -use rustc_errors::{Diagnostic, ErrorReported, Handler, Level}; +use rustc_errors::{ErrorReported, Handler}; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, LocalDefId}; @@ -59,34 +58,12 @@ use std::ops::Deref; use std::path::PathBuf; use std::sync::Arc; -#[macro_use] -mod plumbing; -pub use plumbing::QueryCtxt; -use plumbing::QueryStruct; -pub(crate) use rustc_query_system::query::CycleError; +pub(crate) use rustc_query_system::query::QueryJobId; use rustc_query_system::query::*; -mod stats; -pub use self::stats::print_stats; - -pub use rustc_query_system::query::{QueryInfo, QueryJob, QueryJobId}; - -mod keys; -use self::keys::Key; - -mod values; -use self::values::Value; - -use rustc_query_system::query::QueryAccessors; -pub use rustc_query_system::query::QueryConfig; -pub(crate) use rustc_query_system::query::QueryDescription; - -mod on_disk_cache; +pub mod on_disk_cache; pub use self::on_disk_cache::OnDiskCache; -mod profiling_support; -pub use self::profiling_support::alloc_self_profile_query_strings; - #[derive(Copy, Clone)] pub struct TyCtxtAt<'tcx> { pub tcx: TyCtxt<'tcx>, @@ -131,6 +108,18 @@ macro_rules! query_helper_param_ty { ($K:ty) => { $K }; } +macro_rules! query_storage { + ([][$K:ty, $V:ty]) => { + >::Cache + }; + ([storage($ty:ty) $($rest:tt)*][$K:ty, $V:ty]) => { + <$ty as CacheSelector<$K, $V>>::Cache + }; + ([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => { + query_storage!([$($($modifiers)*)*][$($args)*]) + }; +} + macro_rules! define_callbacks { (<$tcx:tt> $($(#[$attr:meta])* @@ -169,7 +158,7 @@ macro_rules! define_callbacks { #[derive(Default)] pub struct QueryCaches<$tcx> { - $($(#[$attr])* $name: QueryCacheStore>,)* + $($(#[$attr])* pub $name: QueryCacheStore>,)* } impl TyCtxtEnsure<$tcx> { @@ -288,7 +277,6 @@ macro_rules! define_callbacks { // Queries marked with `fatal_cycle` do not need the latter implementation, // as they will raise an fatal error on query cycles instead. -rustc_query_append! { [define_queries!][<'tcx>] } rustc_query_append! { [define_callbacks!][<'tcx>] } mod sealed { diff --git a/compiler/rustc_middle/src/ty/query/on_disk_cache.rs b/compiler/rustc_middle/src/ty/query/on_disk_cache.rs index c71de7f4cd7..d0cd8a48f99 100644 --- a/compiler/rustc_middle/src/ty/query/on_disk_cache.rs +++ b/compiler/rustc_middle/src/ty/query/on_disk_cache.rs @@ -502,7 +502,7 @@ impl<'sess> OnDiskCache<'sess> { /// Returns the cached query result if there is something in the cache for /// the given `SerializedDepNodeIndex`; otherwise returns `None`. - crate fn try_load_query_result<'tcx, T>( + pub fn try_load_query_result<'tcx, T>( &self, tcx: TyCtxt<'tcx>, dep_node_index: SerializedDepNodeIndex, @@ -665,7 +665,7 @@ impl<'sess> OnDiskCache<'sess> { /// A decoder that can read from the incremental compilation cache. It is similar to the one /// we use for crate metadata decoding in that it can rebase spans and eventually /// will also handle things that contain `Ty` instances. -crate struct CacheDecoder<'a, 'tcx> { +pub struct CacheDecoder<'a, 'tcx> { tcx: TyCtxt<'tcx>, opaque: opaque::Decoder<'a>, source_map: &'a SourceMap, diff --git a/compiler/rustc_query_impl/Cargo.toml b/compiler/rustc_query_impl/Cargo.toml new file mode 100644 index 00000000000..c88b766a55a --- /dev/null +++ b/compiler/rustc_query_impl/Cargo.toml @@ -0,0 +1,27 @@ +[package] +authors = ["The Rust Project Developers"] +name = "rustc_query_impl" +version = "0.0.0" +edition = "2018" + +[lib] +doctest = false + +[dependencies] +measureme = "9.0.0" +rustc-rayon-core = "0.3.0" +tracing = "0.1" +rustc_ast = { path = "../rustc_ast" } +rustc_attr = { path = "../rustc_attr" } +rustc_data_structures = { path = "../rustc_data_structures" } +rustc_errors = { path = "../rustc_errors" } +rustc_feature = { path = "../rustc_feature" } +rustc_hir = { path = "../rustc_hir" } +rustc_index = { path = "../rustc_index" } +rustc_macros = { path = "../rustc_macros" } +rustc_middle = { path = "../rustc_middle" } +rustc_query_system = { path = "../rustc_query_system" } +rustc_span = { path = "../rustc_span" } +rustc_serialize = { path = "../rustc_serialize" } +rustc_session = { path = "../rustc_session" } +rustc_target = { path = "../rustc_target" } diff --git a/compiler/rustc_middle/src/ty/query/README.md b/compiler/rustc_query_impl/src/README.md similarity index 100% rename from compiler/rustc_middle/src/ty/query/README.md rename to compiler/rustc_query_impl/src/README.md diff --git a/compiler/rustc_middle/src/ty/query/keys.rs b/compiler/rustc_query_impl/src/keys.rs similarity index 97% rename from compiler/rustc_middle/src/ty/query/keys.rs rename to compiler/rustc_query_impl/src/keys.rs index 2f76237e8fb..1ae5bf12cab 100644 --- a/compiler/rustc_middle/src/ty/query/keys.rs +++ b/compiler/rustc_query_impl/src/keys.rs @@ -1,11 +1,11 @@ //! Defines the set of legal keys that can be used in queries. -use crate::infer::canonical::Canonical; -use crate::mir; -use crate::ty::fast_reject::SimplifiedType; -use crate::ty::subst::{GenericArg, SubstsRef}; -use crate::ty::{self, Ty, TyCtxt}; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE}; +use rustc_middle::infer::canonical::Canonical; +use rustc_middle::mir; +use rustc_middle::ty::fast_reject::SimplifiedType; +use rustc_middle::ty::subst::{GenericArg, SubstsRef}; +use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_span::symbol::{Ident, Symbol}; use rustc_span::{Span, DUMMY_SP}; diff --git a/compiler/rustc_query_impl/src/lib.rs b/compiler/rustc_query_impl/src/lib.rs new file mode 100644 index 00000000000..43dfe6892b1 --- /dev/null +++ b/compiler/rustc_query_impl/src/lib.rs @@ -0,0 +1,65 @@ +//! Support for serializing the dep-graph and reloading it. + +#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] +#![feature(in_band_lifetimes)] +#![feature(exhaustive_patterns)] +#![feature(nll)] +#![feature(min_specialization)] +#![feature(crate_visibility_modifier)] +#![feature(once_cell)] +#![feature(rustc_attrs)] +#![feature(never_type)] +#![recursion_limit = "256"] + +#[macro_use] +extern crate rustc_middle; +#[macro_use] +extern crate tracing; + +use rustc_data_structures::fingerprint::Fingerprint; +use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_errors::{Diagnostic, Handler, Level}; +use rustc_hir::def_id::CrateNum; +use rustc_index::vec::IndexVec; +use rustc_middle::dep_graph; +use rustc_middle::ich::StableHashingContext; +use rustc_middle::ty::query::{query_keys, query_storage, query_stored, query_values}; +use rustc_middle::ty::query::{Providers, QueryEngine}; +use rustc_middle::ty::TyCtxt; +use rustc_serialize::opaque; +use rustc_span::{Span, DUMMY_SP}; +use std::mem; + +#[macro_use] +mod plumbing; +pub use plumbing::QueryCtxt; +use plumbing::QueryStruct; +use rustc_query_system::query::*; + +mod stats; +pub use self::stats::print_stats; + +mod keys; +use keys::Key; + +mod values; +use self::values::Value; + +use rustc_query_system::query::QueryAccessors; +pub use rustc_query_system::query::QueryConfig; +pub(crate) use rustc_query_system::query::QueryDescription; + +use rustc_middle::ty::query::on_disk_cache; + +mod profiling_support; +pub use self::profiling_support::alloc_self_profile_query_strings; + +rustc_query_append! { [define_queries!][<'tcx>] } + +impl<'tcx> Queries<'tcx> { + // Force codegen in the dyn-trait transformation in this crate. + pub fn as_dyn(&'tcx self) -> &'tcx dyn QueryEngine<'tcx> { + self + } +} diff --git a/compiler/rustc_middle/src/ty/query/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs similarity index 95% rename from compiler/rustc_middle/src/ty/query/plumbing.rs rename to compiler/rustc_query_impl/src/plumbing.rs index 79900fc7636..466c1f79f48 100644 --- a/compiler/rustc_middle/src/ty/query/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -2,10 +2,11 @@ //! generate the actual methods on tcx which find and execute the provider, //! manage the caches, and so forth. -use crate::dep_graph::{DepKind, DepNode, DepNodeExt, DepNodeIndex, SerializedDepNodeIndex}; -use crate::ty::query::{on_disk_cache, queries, Query}; -use crate::ty::tls::{self, ImplicitCtxt}; -use crate::ty::{self, TyCtxt}; +use super::{queries, Query}; +use rustc_middle::dep_graph::{DepKind, DepNode, DepNodeExt, DepNodeIndex, SerializedDepNodeIndex}; +use rustc_middle::ty::query::on_disk_cache; +use rustc_middle::ty::tls::{self, ImplicitCtxt}; +use rustc_middle::ty::{self, TyCtxt}; use rustc_query_system::dep_graph::HasDepContext; use rustc_query_system::query::{CycleError, QueryJobId, QueryJobInfo}; use rustc_query_system::query::{QueryContext, QueryDescription}; @@ -33,8 +34,8 @@ impl<'tcx> std::ops::Deref for QueryCtxt<'tcx> { } impl HasDepContext for QueryCtxt<'tcx> { - type DepKind = crate::dep_graph::DepKind; - type StableHashingContext = crate::ich::StableHashingContext<'tcx>; + type DepKind = rustc_middle::dep_graph::DepKind; + type StableHashingContext = rustc_middle::ich::StableHashingContext<'tcx>; type DepContext = TyCtxt<'tcx>; #[inline] @@ -251,7 +252,7 @@ impl<'tcx> QueryCtxt<'tcx> { macro_rules! encode_queries { ($($query:ident,)*) => { $( - on_disk_cache::encode_query_results::<_, ty::query::queries::$query<'_>>( + on_disk_cache::encode_query_results::<_, super::queries::$query<'_>>( self, encoder, query_result_index @@ -363,18 +364,6 @@ macro_rules! is_eval_always { }; } -macro_rules! query_storage { - ([][$K:ty, $V:ty]) => { - >::Cache - }; - ([storage($ty:ty) $($rest:tt)*][$K:ty, $V:ty]) => { - <$ty as CacheSelector<$K, $V>>::Cache - }; - ([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => { - query_storage!([$($($modifiers)*)*][$($args)*]) - }; -} - macro_rules! hash_result { ([][$hcx:expr, $result:expr]) => {{ dep_graph::hash_result($hcx, &$result) @@ -392,13 +381,6 @@ macro_rules! define_queries { $($(#[$attr:meta])* [$($modifiers:tt)*] fn $name:ident($($K:tt)*) -> $V:ty,)*) => { - use std::mem; - use crate::{ - rustc_data_structures::stable_hasher::HashStable, - rustc_data_structures::stable_hasher::StableHasher, - ich::StableHashingContext - }; - define_queries_struct! { tcx: $tcx, input: ($(([$($modifiers)*] [$($attr)*] [$name]))*) @@ -407,7 +389,7 @@ macro_rules! define_queries { #[allow(nonstandard_style)] #[derive(Clone, Debug)] pub enum Query<$tcx> { - $($(#[$attr])* $name($($K)*)),* + $($(#[$attr])* $name(query_keys::$name<$tcx>)),* } impl<$tcx> Query<$tcx> { @@ -465,8 +447,8 @@ macro_rules! define_queries { } $(impl<$tcx> QueryConfig for queries::$name<$tcx> { - type Key = $($K)*; - type Value = $V; + type Key = query_keys::$name<$tcx>; + type Value = query_values::$name<$tcx>; type Stored = query_stored::$name<$tcx>; const NAME: &'static str = stringify!($name); } @@ -520,8 +502,8 @@ macro_rules! define_queries { #[allow(non_upper_case_globals)] pub mod query_callbacks { use super::*; - use crate::dep_graph::DepNode; - use crate::ty::query::{queries, query_keys}; + use rustc_middle::dep_graph::DepNode; + use rustc_middle::ty::query::query_keys; use rustc_query_system::dep_graph::DepNodeParams; use rustc_query_system::query::{force_query, QueryDescription}; diff --git a/compiler/rustc_middle/src/ty/query/profiling_support.rs b/compiler/rustc_query_impl/src/profiling_support.rs similarity index 99% rename from compiler/rustc_middle/src/ty/query/profiling_support.rs rename to compiler/rustc_query_impl/src/profiling_support.rs index aab5fd9e8a1..24485889731 100644 --- a/compiler/rustc_middle/src/ty/query/profiling_support.rs +++ b/compiler/rustc_query_impl/src/profiling_support.rs @@ -1,10 +1,9 @@ -use crate::ty::context::TyCtxt; -use crate::ty::WithOptConstParam; use measureme::{StringComponent, StringId}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::profiling::SelfProfiler; use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_hir::definitions::DefPathData; +use rustc_middle::ty::{TyCtxt, WithOptConstParam}; use rustc_query_system::query::{QueryCache, QueryCacheStore}; use std::fmt::Debug; use std::io::Write; diff --git a/compiler/rustc_middle/src/ty/query/stats.rs b/compiler/rustc_query_impl/src/stats.rs similarity index 98% rename from compiler/rustc_middle/src/ty/query/stats.rs rename to compiler/rustc_query_impl/src/stats.rs index 47cbc7e43d2..4d52483c3b8 100644 --- a/compiler/rustc_middle/src/ty/query/stats.rs +++ b/compiler/rustc_query_impl/src/stats.rs @@ -1,6 +1,6 @@ -use crate::ty::query::query_storage; -use crate::ty::TyCtxt; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; +use rustc_middle::ty::query::query_storage; +use rustc_middle::ty::TyCtxt; use rustc_query_system::query::{QueryCache, QueryCacheStore}; use std::any::type_name; diff --git a/compiler/rustc_middle/src/ty/query/values.rs b/compiler/rustc_query_impl/src/values.rs similarity index 94% rename from compiler/rustc_middle/src/ty/query/values.rs rename to compiler/rustc_query_impl/src/values.rs index fa15395db4e..003867beeb7 100644 --- a/compiler/rustc_middle/src/ty/query/values.rs +++ b/compiler/rustc_query_impl/src/values.rs @@ -1,5 +1,5 @@ -use crate::ty::query::QueryCtxt; -use crate::ty::{self, AdtSizedConstraint, Ty, TyS}; +use super::QueryCtxt; +use rustc_middle::ty::{self, AdtSizedConstraint, Ty, TyS}; pub(super) trait Value<'tcx>: Sized { fn from_cycle_error(tcx: QueryCtxt<'tcx>) -> Self;