rustc: rename ty::maps to ty::query.
This commit is contained in:
parent
7f20af002e
commit
5a5c7ded0d
|
@ -6,7 +6,7 @@ This directory contains the source code of the rust project, including:
|
||||||
For more information on how various parts of the compiler work, see the [rustc guide].
|
For more information on how various parts of the compiler work, see the [rustc guide].
|
||||||
|
|
||||||
Their is also useful content in the following READMEs, which are gradually being moved over to the guide:
|
Their is also useful content in the following READMEs, which are gradually being moved over to the guide:
|
||||||
- https://github.com/rust-lang/rust/tree/master/src/librustc/ty/maps
|
- https://github.com/rust-lang/rust/tree/master/src/librustc/ty/query
|
||||||
- https://github.com/rust-lang/rust/tree/master/src/librustc/dep_graph
|
- https://github.com/rust-lang/rust/tree/master/src/librustc/dep_graph
|
||||||
- https://github.com/rust-lang/rust/blob/master/src/librustc/infer/region_constraints
|
- https://github.com/rust-lang/rust/blob/master/src/librustc/infer/region_constraints
|
||||||
- https://github.com/rust-lang/rust/tree/master/src/librustc/infer/higher_ranked
|
- https://github.com/rust-lang/rust/tree/master/src/librustc/infer/higher_ranked
|
||||||
|
|
|
@ -656,7 +656,7 @@ impl DepGraph {
|
||||||
// We failed to mark it green, so we try to force the query.
|
// We failed to mark it green, so we try to force the query.
|
||||||
debug!("try_mark_green({:?}) --- trying to force \
|
debug!("try_mark_green({:?}) --- trying to force \
|
||||||
dependency {:?}", dep_node, dep_dep_node);
|
dependency {:?}", dep_node, dep_dep_node);
|
||||||
if ::ty::maps::force_from_dep_node(tcx, dep_dep_node) {
|
if ::ty::query::force_from_dep_node(tcx, dep_dep_node) {
|
||||||
let dep_dep_node_color = data.colors.borrow().get(dep_dep_node_index);
|
let dep_dep_node_color = data.colors.borrow().get(dep_dep_node_index);
|
||||||
|
|
||||||
match dep_dep_node_color {
|
match dep_dep_node_color {
|
||||||
|
@ -742,14 +742,14 @@ impl DepGraph {
|
||||||
// and emit other diagnostics before these diagnostics are emitted.
|
// and emit other diagnostics before these diagnostics are emitted.
|
||||||
// Such diagnostics should be emitted after these.
|
// Such diagnostics should be emitted after these.
|
||||||
// See https://github.com/rust-lang/rust/issues/48685
|
// See https://github.com/rust-lang/rust/issues/48685
|
||||||
let diagnostics = tcx.on_disk_query_result_cache
|
let diagnostics = tcx.queries.on_disk_cache
|
||||||
.load_diagnostics(tcx, prev_dep_node_index);
|
.load_diagnostics(tcx, prev_dep_node_index);
|
||||||
|
|
||||||
if diagnostics.len() > 0 {
|
if diagnostics.len() > 0 {
|
||||||
let handle = tcx.sess.diagnostic();
|
let handle = tcx.sess.diagnostic();
|
||||||
|
|
||||||
// Promote the previous diagnostics to the current session.
|
// Promote the previous diagnostics to the current session.
|
||||||
tcx.on_disk_query_result_cache
|
tcx.queries.on_disk_cache
|
||||||
.store_diagnostics(dep_node_index, diagnostics.clone());
|
.store_diagnostics(dep_node_index, diagnostics.clone());
|
||||||
|
|
||||||
for diagnostic in diagnostics {
|
for diagnostic in diagnostics {
|
||||||
|
|
|
@ -45,7 +45,7 @@ use syntax::tokenstream::TokenStream;
|
||||||
use syntax::util::ThinVec;
|
use syntax::util::ThinVec;
|
||||||
use syntax::util::parser::ExprPrecedence;
|
use syntax::util::parser::ExprPrecedence;
|
||||||
use ty::AdtKind;
|
use ty::AdtKind;
|
||||||
use ty::maps::Providers;
|
use ty::query::Providers;
|
||||||
|
|
||||||
use rustc_data_structures::indexed_vec;
|
use rustc_data_structures::indexed_vec;
|
||||||
use rustc_data_structures::sync::{ParallelIterator, par_iter, Send, Sync, scope};
|
use rustc_data_structures::sync::{ParallelIterator, par_iter, Send, Sync, scope};
|
||||||
|
|
|
@ -47,7 +47,7 @@ use syntax::symbol::Symbol;
|
||||||
use syntax::visit as ast_visit;
|
use syntax::visit as ast_visit;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
use ty::TyCtxt;
|
use ty::TyCtxt;
|
||||||
use ty::maps::Providers;
|
use ty::query::Providers;
|
||||||
use util::nodemap::NodeMap;
|
use util::nodemap::NodeMap;
|
||||||
|
|
||||||
pub use lint::context::{LateContext, EarlyContext, LintContext, LintStore,
|
pub use lint::context::{LateContext, EarlyContext, LintContext, LintStore,
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
use hir::def_id::DefId;
|
use hir::def_id::DefId;
|
||||||
use ty;
|
use ty;
|
||||||
use ty::subst::Substs;
|
use ty::subst::Substs;
|
||||||
use ty::maps::TyCtxtAt;
|
use ty::query::TyCtxtAt;
|
||||||
use mir::interpret::ConstValue;
|
use mir::interpret::ConstValue;
|
||||||
use errors::DiagnosticBuilder;
|
use errors::DiagnosticBuilder;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ use hir::def::Def;
|
||||||
use hir::def_id::{DefId, CrateNum};
|
use hir::def_id::{DefId, CrateNum};
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
use ty::{self, TyCtxt};
|
use ty::{self, TyCtxt};
|
||||||
use ty::maps::Providers;
|
use ty::query::Providers;
|
||||||
use middle::privacy;
|
use middle::privacy;
|
||||||
use session::config;
|
use session::config;
|
||||||
use util::nodemap::{NodeSet, FxHashSet};
|
use util::nodemap::{NodeSet, FxHashSet};
|
||||||
|
|
|
@ -27,7 +27,7 @@ use syntax::codemap;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax_pos::{Span, DUMMY_SP};
|
use syntax_pos::{Span, DUMMY_SP};
|
||||||
use ty::TyCtxt;
|
use ty::TyCtxt;
|
||||||
use ty::maps::Providers;
|
use ty::query::Providers;
|
||||||
|
|
||||||
use hir;
|
use hir;
|
||||||
use hir::def_id::DefId;
|
use hir::def_id::DefId;
|
||||||
|
|
|
@ -349,8 +349,8 @@ type ScopeRef<'a> = &'a Scope<'a>;
|
||||||
|
|
||||||
const ROOT_SCOPE: ScopeRef<'static> = &Scope::Root;
|
const ROOT_SCOPE: ScopeRef<'static> = &Scope::Root;
|
||||||
|
|
||||||
pub fn provide(providers: &mut ty::maps::Providers) {
|
pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
*providers = ty::maps::Providers {
|
*providers = ty::query::Providers {
|
||||||
resolve_lifetimes,
|
resolve_lifetimes,
|
||||||
|
|
||||||
named_region_map: |tcx, id| {
|
named_region_map: |tcx, id| {
|
||||||
|
|
|
@ -991,8 +991,8 @@ impl<'tcx> TraitObligation<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut ty::maps::Providers) {
|
pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
*providers = ty::maps::Providers {
|
*providers = ty::query::Providers {
|
||||||
is_object_safe: object_safety::is_object_safe_provider,
|
is_object_safe: object_safety::is_object_safe_provider,
|
||||||
specialization_graph_of: specialize::specialization_graph_provider,
|
specialization_graph_of: specialize::specialization_graph_provider,
|
||||||
specializes: specialize::specializes,
|
specializes: specialize::specializes,
|
||||||
|
|
|
@ -46,7 +46,7 @@ use ty::{TyVar, TyVid, IntVar, IntVid, FloatVar, FloatVid};
|
||||||
use ty::TypeVariants::*;
|
use ty::TypeVariants::*;
|
||||||
use ty::GenericParamDefKind;
|
use ty::GenericParamDefKind;
|
||||||
use ty::layout::{LayoutDetails, TargetDataLayout};
|
use ty::layout::{LayoutDetails, TargetDataLayout};
|
||||||
use ty::maps;
|
use ty::query;
|
||||||
use ty::steal::Steal;
|
use ty::steal::Steal;
|
||||||
use ty::BindingMode;
|
use ty::BindingMode;
|
||||||
use ty::CanonicalTy;
|
use ty::CanonicalTy;
|
||||||
|
@ -863,11 +863,6 @@ pub struct GlobalCtxt<'tcx> {
|
||||||
|
|
||||||
pub dep_graph: DepGraph,
|
pub dep_graph: DepGraph,
|
||||||
|
|
||||||
/// This provides access to the incr. comp. on-disk cache for query results.
|
|
||||||
/// Do not access this directly. It is only meant to be used by
|
|
||||||
/// `DepGraph::try_mark_green()` and the query infrastructure in `ty::maps`.
|
|
||||||
pub(crate) on_disk_query_result_cache: maps::OnDiskCache<'tcx>,
|
|
||||||
|
|
||||||
/// Common types, pre-interned for your convenience.
|
/// Common types, pre-interned for your convenience.
|
||||||
pub types: CommonTypes<'tcx>,
|
pub types: CommonTypes<'tcx>,
|
||||||
|
|
||||||
|
@ -886,7 +881,7 @@ pub struct GlobalCtxt<'tcx> {
|
||||||
/// as well as all upstream crates. Only populated in incremental mode.
|
/// as well as all upstream crates. Only populated in incremental mode.
|
||||||
pub def_path_hash_to_def_id: Option<FxHashMap<DefPathHash, DefId>>,
|
pub def_path_hash_to_def_id: Option<FxHashMap<DefPathHash, DefId>>,
|
||||||
|
|
||||||
pub maps: maps::Maps<'tcx>,
|
pub(crate) queries: query::Queries<'tcx>,
|
||||||
|
|
||||||
// Records the free variables refrenced by every closure
|
// Records the free variables refrenced by every closure
|
||||||
// expression. Do not track deps for this, just recompute it from
|
// expression. Do not track deps for this, just recompute it from
|
||||||
|
@ -1074,12 +1069,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
/// reference to the context, to allow formatting values that need it.
|
/// reference to the context, to allow formatting values that need it.
|
||||||
pub fn create_and_enter<F, R>(s: &'tcx Session,
|
pub fn create_and_enter<F, R>(s: &'tcx Session,
|
||||||
cstore: &'tcx CrateStoreDyn,
|
cstore: &'tcx CrateStoreDyn,
|
||||||
local_providers: ty::maps::Providers<'tcx>,
|
local_providers: ty::query::Providers<'tcx>,
|
||||||
extern_providers: ty::maps::Providers<'tcx>,
|
extern_providers: ty::query::Providers<'tcx>,
|
||||||
arenas: &'tcx AllArenas<'tcx>,
|
arenas: &'tcx AllArenas<'tcx>,
|
||||||
resolutions: ty::Resolutions,
|
resolutions: ty::Resolutions,
|
||||||
hir: hir_map::Map<'tcx>,
|
hir: hir_map::Map<'tcx>,
|
||||||
on_disk_query_result_cache: maps::OnDiskCache<'tcx>,
|
on_disk_query_result_cache: query::OnDiskCache<'tcx>,
|
||||||
crate_name: &str,
|
crate_name: &str,
|
||||||
tx: mpsc::Sender<Box<dyn Any + Send>>,
|
tx: mpsc::Sender<Box<dyn Any + Send>>,
|
||||||
output_filenames: &OutputFilenames,
|
output_filenames: &OutputFilenames,
|
||||||
|
@ -1144,7 +1139,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
global_arenas: &arenas.global,
|
global_arenas: &arenas.global,
|
||||||
global_interners: interners,
|
global_interners: interners,
|
||||||
dep_graph: dep_graph.clone(),
|
dep_graph: dep_graph.clone(),
|
||||||
on_disk_query_result_cache,
|
|
||||||
types: common_types,
|
types: common_types,
|
||||||
trait_map,
|
trait_map,
|
||||||
export_map: resolutions.export_map.into_iter().map(|(k, v)| {
|
export_map: resolutions.export_map.into_iter().map(|(k, v)| {
|
||||||
|
@ -1165,7 +1159,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
.collect(),
|
.collect(),
|
||||||
hir,
|
hir,
|
||||||
def_path_hash_to_def_id,
|
def_path_hash_to_def_id,
|
||||||
maps: maps::Maps::new(providers),
|
queries: query::Queries::new(providers, on_disk_query_result_cache),
|
||||||
rcache: Lock::new(FxHashMap()),
|
rcache: Lock::new(FxHashMap()),
|
||||||
selection_cache: traits::SelectionCache::new(),
|
selection_cache: traits::SelectionCache::new(),
|
||||||
evaluation_cache: traits::EvaluationCache::new(),
|
evaluation_cache: traits::EvaluationCache::new(),
|
||||||
|
@ -1343,7 +1337,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
-> Result<(), E::Error>
|
-> Result<(), E::Error>
|
||||||
where E: ty::codec::TyEncoder
|
where E: ty::codec::TyEncoder
|
||||||
{
|
{
|
||||||
self.on_disk_query_result_cache.serialize(self.global_tcx(), encoder)
|
self.queries.on_disk_cache.serialize(self.global_tcx(), encoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If true, we should use a naive AST walk to determine if match
|
/// If true, we should use a naive AST walk to determine if match
|
||||||
|
@ -1702,7 +1696,7 @@ pub mod tls {
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use syntax_pos;
|
use syntax_pos;
|
||||||
use ty::maps;
|
use ty::query;
|
||||||
use errors::{Diagnostic, TRACK_DIAGNOSTICS};
|
use errors::{Diagnostic, TRACK_DIAGNOSTICS};
|
||||||
use rustc_data_structures::OnDrop;
|
use rustc_data_structures::OnDrop;
|
||||||
use rustc_data_structures::sync::{self, Lrc, Lock};
|
use rustc_data_structures::sync::{self, Lrc, Lock};
|
||||||
|
@ -1726,8 +1720,8 @@ pub mod tls {
|
||||||
pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||||
|
|
||||||
/// The current query job, if any. This is updated by start_job in
|
/// The current query job, if any. This is updated by start_job in
|
||||||
/// ty::maps::plumbing when executing a query
|
/// ty::query::plumbing when executing a query
|
||||||
pub query: Option<Lrc<maps::QueryJob<'gcx>>>,
|
pub query: Option<Lrc<query::QueryJob<'gcx>>>,
|
||||||
|
|
||||||
/// Used to prevent layout from recursing too deeply.
|
/// Used to prevent layout from recursing too deeply.
|
||||||
pub layout_depth: usize,
|
pub layout_depth: usize,
|
||||||
|
@ -2792,7 +2786,7 @@ impl<T, R, E> InternIteratorElement<T, R> for Result<T, E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut ty::maps::Providers) {
|
pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
// FIXME(#44234) - almost all of these queries have no sub-queries and
|
// FIXME(#44234) - almost all of these queries have no sub-queries and
|
||||||
// therefore no actual inputs, they're just reading tables calculated in
|
// therefore no actual inputs, they're just reading tables calculated in
|
||||||
// resolve! Does this work? Unsure! That's what the issue is about
|
// resolve! Does this work? Unsure! That's what the issue is about
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
use ty::{self, Ty, TyCtxt};
|
use ty::{self, Ty, TyCtxt};
|
||||||
use ty::fold::{TypeFolder, TypeFoldable};
|
use ty::fold::{TypeFolder, TypeFoldable};
|
||||||
|
|
||||||
pub(super) fn provide(providers: &mut ty::maps::Providers) {
|
pub(super) fn provide(providers: &mut ty::query::Providers) {
|
||||||
*providers = ty::maps::Providers {
|
*providers = ty::query::Providers {
|
||||||
erase_regions_ty,
|
erase_regions_ty,
|
||||||
..*providers
|
..*providers
|
||||||
};
|
};
|
||||||
|
|
|
@ -194,8 +194,8 @@ fn layout_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut ty::maps::Providers) {
|
pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
*providers = ty::maps::Providers {
|
*providers = ty::query::Providers {
|
||||||
layout_raw,
|
layout_raw,
|
||||||
..*providers
|
..*providers
|
||||||
};
|
};
|
||||||
|
@ -1481,7 +1481,7 @@ impl<'a, 'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> LayoutOf for LayoutCx<'tcx, ty::maps::TyCtxtAt<'a, 'tcx, 'tcx>> {
|
impl<'a, 'tcx> LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'a, 'tcx, 'tcx>> {
|
||||||
type Ty = Ty<'tcx>;
|
type Ty = Ty<'tcx>;
|
||||||
type TyLayout = Result<TyLayout<'tcx>, LayoutError<'tcx>>;
|
type TyLayout = Result<TyLayout<'tcx>, LayoutError<'tcx>>;
|
||||||
|
|
||||||
|
@ -1527,7 +1527,7 @@ impl TyCtxt<'a, 'tcx, '_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ty::maps::TyCtxtAt<'a, 'tcx, '_> {
|
impl ty::query::TyCtxtAt<'a, 'tcx, '_> {
|
||||||
/// Computes the layout of a type. Note that this implicitly
|
/// Computes the layout of a type. Note that this implicitly
|
||||||
/// executes in "reveal all" mode.
|
/// executes in "reveal all" mode.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -85,7 +85,7 @@ pub use self::instance::{Instance, InstanceDef};
|
||||||
|
|
||||||
pub use self::trait_def::TraitDef;
|
pub use self::trait_def::TraitDef;
|
||||||
|
|
||||||
pub use self::maps::queries;
|
pub use self::query::queries;
|
||||||
|
|
||||||
pub mod adjustment;
|
pub mod adjustment;
|
||||||
pub mod binding;
|
pub mod binding;
|
||||||
|
@ -100,8 +100,8 @@ pub mod inhabitedness;
|
||||||
pub mod item_path;
|
pub mod item_path;
|
||||||
pub mod layout;
|
pub mod layout;
|
||||||
pub mod _match;
|
pub mod _match;
|
||||||
pub mod maps;
|
|
||||||
pub mod outlives;
|
pub mod outlives;
|
||||||
|
pub mod query;
|
||||||
pub mod relate;
|
pub mod relate;
|
||||||
pub mod steal;
|
pub mod steal;
|
||||||
pub mod subst;
|
pub mod subst;
|
||||||
|
@ -2175,7 +2175,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
|
||||||
/// Due to normalization being eager, this applies even if
|
/// Due to normalization being eager, this applies even if
|
||||||
/// the associated type is behind a pointer, e.g. issue #31299.
|
/// the associated type is behind a pointer, e.g. issue #31299.
|
||||||
pub fn sized_constraint(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] {
|
pub fn sized_constraint(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] {
|
||||||
match tcx.try_get_query::<queries::adt_sized_constraint>(DUMMY_SP, self.did) {
|
match tcx.try_adt_sized_constraint(DUMMY_SP, self.did) {
|
||||||
Ok(tys) => tys,
|
Ok(tys) => tys,
|
||||||
Err(mut bug) => {
|
Err(mut bug) => {
|
||||||
debug!("adt_sized_constraint: {:?} is recursive", self);
|
debug!("adt_sized_constraint: {:?} is recursive", self);
|
||||||
|
@ -2917,12 +2917,12 @@ fn instance_def_size_estimate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut ty::maps::Providers) {
|
pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
context::provide(providers);
|
context::provide(providers);
|
||||||
erase_regions::provide(providers);
|
erase_regions::provide(providers);
|
||||||
layout::provide(providers);
|
layout::provide(providers);
|
||||||
util::provide(providers);
|
util::provide(providers);
|
||||||
*providers = ty::maps::Providers {
|
*providers = ty::query::Providers {
|
||||||
associated_item,
|
associated_item,
|
||||||
associated_item_def_ids,
|
associated_item_def_ids,
|
||||||
adt_sized_constraint,
|
adt_sized_constraint,
|
||||||
|
|
|
@ -55,7 +55,7 @@ get to use the nice method-call-style syntax. Instead, you invoke
|
||||||
using the `try_get` method, which looks roughly like this:
|
using the `try_get` method, which looks roughly like this:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use ty::maps::queries;
|
use ty::query::queries;
|
||||||
...
|
...
|
||||||
match queries::type_of::try_get(tcx, DUMMY_SP, self.did) {
|
match queries::type_of::try_get(tcx, DUMMY_SP, self.did) {
|
||||||
Ok(result) => {
|
Ok(result) => {
|
||||||
|
@ -207,7 +207,7 @@ by the time you read this README, but at present it looks something
|
||||||
like:
|
like:
|
||||||
|
|
||||||
```
|
```
|
||||||
define_maps! { <'tcx>
|
define_queries! { <'tcx>
|
||||||
/// Records the type of every item.
|
/// Records the type of every item.
|
||||||
[] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>,
|
[] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>,
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ Let's go over them one by one:
|
||||||
processed.
|
processed.
|
||||||
- **Name of query:** the name of the query method
|
- **Name of query:** the name of the query method
|
||||||
(`tcx.type_of(..)`). Also used as the name of a struct
|
(`tcx.type_of(..)`). Also used as the name of a struct
|
||||||
(`ty::maps::queries::type_of`) that will be generated to represent
|
(`ty::query::queries::type_of`) that will be generated to represent
|
||||||
this query.
|
this query.
|
||||||
- **Dep-node constructor:** indicates the constructor function that
|
- **Dep-node constructor:** indicates the constructor function that
|
||||||
connects this query to incremental compilation. Typically, this is a
|
connects this query to incremental compilation. Typically, this is a
|
||||||
|
@ -247,7 +247,7 @@ Let's go over them one by one:
|
||||||
bottom of the file. This is typically used when the query key is
|
bottom of the file. This is typically used when the query key is
|
||||||
not a def-id, or just not the type that the dep-node expects.
|
not a def-id, or just not the type that the dep-node expects.
|
||||||
- **Query key type:** the type of the argument to this query.
|
- **Query key type:** the type of the argument to this query.
|
||||||
This type must implement the `ty::maps::keys::Key` trait, which
|
This type must implement the `ty::query::keys::Key` trait, which
|
||||||
defines (for example) how to map it to a crate, and so forth.
|
defines (for example) how to map it to a crate, and so forth.
|
||||||
- **Result type of query:** the type produced by this query. This type
|
- **Result type of query:** the type produced by this query. This type
|
||||||
should (a) not use `RefCell` or other interior mutability and (b) be
|
should (a) not use `RefCell` or other interior mutability and (b) be
|
||||||
|
@ -260,14 +260,14 @@ Let's go over them one by one:
|
||||||
|
|
||||||
So, to add a query:
|
So, to add a query:
|
||||||
|
|
||||||
- Add an entry to `define_maps!` using the format above.
|
- Add an entry to `define_queries!` using the format above.
|
||||||
- Possibly add a corresponding entry to the dep-node macro.
|
- Possibly add a corresponding entry to the dep-node macro.
|
||||||
- Link the provider by modifying the appropriate `provide` method;
|
- Link the provider by modifying the appropriate `provide` method;
|
||||||
or add a new one if needed and ensure that `rustc_driver` is invoking it.
|
or add a new one if needed and ensure that `rustc_driver` is invoking it.
|
||||||
|
|
||||||
#### Query structs and descriptions
|
#### Query structs and descriptions
|
||||||
|
|
||||||
For each kind, the `define_maps` macro will generate a "query struct"
|
For each kind, the `define_queries` macro will generate a "query struct"
|
||||||
named after the query. This struct is a kind of a place-holder
|
named after the query. This struct is a kind of a place-holder
|
||||||
describing the query. Each such struct implements the
|
describing the query. Each such struct implements the
|
||||||
`self::config::QueryConfig` trait, which has associated types for the
|
`self::config::QueryConfig` trait, which has associated types for the
|
|
@ -15,9 +15,9 @@ use mir::interpret::{GlobalId, ConstValue};
|
||||||
use traits::query::{CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal};
|
use traits::query::{CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal};
|
||||||
use ty::{self, ParamEnvAnd, Ty, TyCtxt};
|
use ty::{self, ParamEnvAnd, Ty, TyCtxt};
|
||||||
use ty::subst::Substs;
|
use ty::subst::Substs;
|
||||||
use ty::maps::queries;
|
use ty::query::queries;
|
||||||
use ty::maps::Query;
|
use ty::query::Query;
|
||||||
use ty::maps::QueryMap;
|
use ty::query::QueryCache;
|
||||||
|
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
@ -26,18 +26,20 @@ use rustc_data_structures::sync::Lock;
|
||||||
use rustc_data_structures::stable_hasher::HashStable;
|
use rustc_data_structures::stable_hasher::HashStable;
|
||||||
use ich::StableHashingContext;
|
use ich::StableHashingContext;
|
||||||
|
|
||||||
/// Query configuration and description traits.
|
// Query configuration and description traits.
|
||||||
|
|
||||||
pub trait QueryConfig<'tcx> {
|
pub trait QueryConfig<'tcx> {
|
||||||
const NAME: &'static str;
|
const NAME: &'static str;
|
||||||
|
|
||||||
type Key: Eq + Hash + Clone + Debug;
|
type Key: Eq + Hash + Clone + Debug;
|
||||||
type Value: Clone + for<'a> HashStable<StableHashingContext<'a>>;
|
type Value: Clone + for<'a> HashStable<StableHashingContext<'a>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) trait QueryAccessors<'tcx>: QueryConfig<'tcx> {
|
||||||
fn query(key: Self::Key) -> Query<'tcx>;
|
fn query(key: Self::Key) -> Query<'tcx>;
|
||||||
|
|
||||||
// Don't use this method to access query results, instead use the methods on TyCtxt
|
// Don't use this method to access query results, instead use the methods on TyCtxt
|
||||||
fn query_map<'a>(tcx: TyCtxt<'a, 'tcx, '_>) -> &'a Lock<QueryMap<'tcx, Self>>;
|
fn query_cache<'a>(tcx: TyCtxt<'a, 'tcx, '_>) -> &'a Lock<QueryCache<'tcx, Self>>;
|
||||||
|
|
||||||
fn to_dep_node(tcx: TyCtxt<'_, 'tcx, '_>, key: &Self::Key) -> DepNode;
|
fn to_dep_node(tcx: TyCtxt<'_, 'tcx, '_>, key: &Self::Key) -> DepNode;
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@ pub trait QueryConfig<'tcx> {
|
||||||
fn handle_cycle_error(tcx: TyCtxt<'_, 'tcx, '_>) -> Self::Value;
|
fn handle_cycle_error(tcx: TyCtxt<'_, 'tcx, '_>) -> Self::Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait QueryDescription<'tcx>: QueryConfig<'tcx> {
|
pub(super) trait QueryDescription<'tcx>: QueryAccessors<'tcx> {
|
||||||
fn describe(tcx: TyCtxt, key: Self::Key) -> String;
|
fn describe(tcx: TyCtxt, key: Self::Key) -> String;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -62,7 +64,7 @@ pub trait QueryDescription<'tcx>: QueryConfig<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, M: QueryConfig<'tcx, Key=DefId>> QueryDescription<'tcx> for M {
|
impl<'tcx, M: QueryAccessors<'tcx, Key=DefId>> QueryDescription<'tcx> for M {
|
||||||
default fn describe(tcx: TyCtxt, def_id: DefId) -> String {
|
default fn describe(tcx: TyCtxt, def_id: DefId) -> String {
|
||||||
if !tcx.sess.verbose() {
|
if !tcx.sess.verbose() {
|
||||||
format!("processing `{}`", tcx.item_path_str(def_id))
|
format!("processing `{}`", tcx.item_path_str(def_id))
|
||||||
|
@ -233,7 +235,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::const_eval<'tcx> {
|
||||||
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
id: SerializedDepNodeIndex)
|
id: SerializedDepNodeIndex)
|
||||||
-> Option<Self::Value> {
|
-> Option<Self::Value> {
|
||||||
tcx.on_disk_query_result_cache.try_load_query_result(tcx, id).map(Ok)
|
tcx.queries.on_disk_cache.try_load_query_result(tcx, id).map(Ok)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +259,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::symbol_name<'tcx> {
|
||||||
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
id: SerializedDepNodeIndex)
|
id: SerializedDepNodeIndex)
|
||||||
-> Option<Self::Value> {
|
-> Option<Self::Value> {
|
||||||
tcx.on_disk_query_result_cache.try_load_query_result(tcx, id)
|
tcx.queries.on_disk_cache.try_load_query_result(tcx, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +333,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::const_is_rvalue_promotable_to_sta
|
||||||
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
id: SerializedDepNodeIndex)
|
id: SerializedDepNodeIndex)
|
||||||
-> Option<Self::Value> {
|
-> Option<Self::Value> {
|
||||||
tcx.on_disk_query_result_cache.try_load_query_result(tcx, id)
|
tcx.queries.on_disk_cache.try_load_query_result(tcx, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +365,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::codegen_fulfill_obligation<'tcx>
|
||||||
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
id: SerializedDepNodeIndex)
|
id: SerializedDepNodeIndex)
|
||||||
-> Option<Self::Value> {
|
-> Option<Self::Value> {
|
||||||
tcx.on_disk_query_result_cache.try_load_query_result(tcx, id)
|
tcx.queries.on_disk_cache.try_load_query_result(tcx, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -683,7 +685,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::typeck_tables_of<'tcx> {
|
||||||
id: SerializedDepNodeIndex)
|
id: SerializedDepNodeIndex)
|
||||||
-> Option<Self::Value> {
|
-> Option<Self::Value> {
|
||||||
let typeck_tables: Option<ty::TypeckTables<'tcx>> = tcx
|
let typeck_tables: Option<ty::TypeckTables<'tcx>> = tcx
|
||||||
.on_disk_query_result_cache
|
.queries.on_disk_cache
|
||||||
.try_load_query_result(tcx, id);
|
.try_load_query_result(tcx, id);
|
||||||
|
|
||||||
typeck_tables.map(|tables| tcx.alloc_tables(tables))
|
typeck_tables.map(|tables| tcx.alloc_tables(tables))
|
||||||
|
@ -699,7 +701,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::optimized_mir<'tcx> {
|
||||||
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
id: SerializedDepNodeIndex)
|
id: SerializedDepNodeIndex)
|
||||||
-> Option<Self::Value> {
|
-> Option<Self::Value> {
|
||||||
let mir: Option<::mir::Mir<'tcx>> = tcx.on_disk_query_result_cache
|
let mir: Option<::mir::Mir<'tcx>> = tcx.queries.on_disk_cache
|
||||||
.try_load_query_result(tcx, id);
|
.try_load_query_result(tcx, id);
|
||||||
mir.map(|x| tcx.alloc_mir(x))
|
mir.map(|x| tcx.alloc_mir(x))
|
||||||
}
|
}
|
||||||
|
@ -738,7 +740,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::generics_of<'tcx> {
|
||||||
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
id: SerializedDepNodeIndex)
|
id: SerializedDepNodeIndex)
|
||||||
-> Option<Self::Value> {
|
-> Option<Self::Value> {
|
||||||
let generics: Option<ty::Generics> = tcx.on_disk_query_result_cache
|
let generics: Option<ty::Generics> = tcx.queries.on_disk_cache
|
||||||
.try_load_query_result(tcx, id);
|
.try_load_query_result(tcx, id);
|
||||||
generics.map(|x| tcx.alloc_generics(x))
|
generics.map(|x| tcx.alloc_generics(x))
|
||||||
}
|
}
|
||||||
|
@ -780,7 +782,7 @@ macro_rules! impl_disk_cacheable_query(
|
||||||
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
id: SerializedDepNodeIndex)
|
id: SerializedDepNodeIndex)
|
||||||
-> Option<Self::Value> {
|
-> Option<Self::Value> {
|
||||||
tcx.on_disk_query_result_cache.try_load_query_result(tcx, id)
|
tcx.queries.on_disk_cache.try_load_query_result(tcx, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,8 +15,8 @@ use rustc_data_structures::sync::{Lock, LockGuard, Lrc, Weak};
|
||||||
use rustc_data_structures::OnDrop;
|
use rustc_data_structures::OnDrop;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
use ty::tls;
|
use ty::tls;
|
||||||
use ty::maps::Query;
|
use ty::query::Query;
|
||||||
use ty::maps::plumbing::CycleError;
|
use ty::query::plumbing::CycleError;
|
||||||
use ty::context::TyCtxt;
|
use ty::context::TyCtxt;
|
||||||
use errors::Diagnostic;
|
use errors::Diagnostic;
|
||||||
use std::process;
|
use std::process;
|
||||||
|
@ -497,7 +497,7 @@ fn deadlock(tcx: TyCtxt<'_, '_, '_>, registry: &rayon_core::Registry) {
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut wakelist = Vec::new();
|
let mut wakelist = Vec::new();
|
||||||
let mut jobs: Vec<_> = tcx.maps.collect_active_jobs();
|
let mut jobs: Vec<_> = tcx.queries.collect_active_jobs();
|
||||||
|
|
||||||
let mut found_cycle = false;
|
let mut found_cycle = false;
|
||||||
|
|
|
@ -24,10 +24,10 @@ use syntax_pos::symbol::InternedString;
|
||||||
|
|
||||||
/// The `Key` trait controls what types can legally be used as the key
|
/// The `Key` trait controls what types can legally be used as the key
|
||||||
/// for a query.
|
/// for a query.
|
||||||
pub trait Key: Clone + Hash + Eq + Debug {
|
pub(super) trait Key: Clone + Hash + Eq + Debug {
|
||||||
/// Given an instance of this key, what crate is it referring to?
|
/// Given an instance of this key, what crate is it referring to?
|
||||||
/// This is used to find the provider.
|
/// This is used to find the provider.
|
||||||
fn map_crate(&self) -> CrateNum;
|
fn query_crate(&self) -> CrateNum;
|
||||||
|
|
||||||
/// In the event that a cycle occurs, if no explicit span has been
|
/// In the event that a cycle occurs, if no explicit span has been
|
||||||
/// given for a query with key `self`, what span should we use?
|
/// given for a query with key `self`, what span should we use?
|
||||||
|
@ -35,7 +35,7 @@ pub trait Key: Clone + Hash + Eq + Debug {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for ty::InstanceDef<'tcx> {
|
impl<'tcx> Key for ty::InstanceDef<'tcx> {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
LOCAL_CRATE
|
LOCAL_CRATE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ impl<'tcx> Key for ty::InstanceDef<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for ty::Instance<'tcx> {
|
impl<'tcx> Key for ty::Instance<'tcx> {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
LOCAL_CRATE
|
LOCAL_CRATE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ impl<'tcx> Key for ty::Instance<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for mir::interpret::GlobalId<'tcx> {
|
impl<'tcx> Key for mir::interpret::GlobalId<'tcx> {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
self.instance.map_crate()
|
self.instance.query_crate()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_span(&self, tcx: TyCtxt) -> Span {
|
fn default_span(&self, tcx: TyCtxt) -> Span {
|
||||||
|
@ -65,7 +65,7 @@ impl<'tcx> Key for mir::interpret::GlobalId<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Key for CrateNum {
|
impl Key for CrateNum {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
fn default_span(&self, _: TyCtxt) -> Span {
|
fn default_span(&self, _: TyCtxt) -> Span {
|
||||||
|
@ -74,7 +74,7 @@ impl Key for CrateNum {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Key for DefIndex {
|
impl Key for DefIndex {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
LOCAL_CRATE
|
LOCAL_CRATE
|
||||||
}
|
}
|
||||||
fn default_span(&self, _tcx: TyCtxt) -> Span {
|
fn default_span(&self, _tcx: TyCtxt) -> Span {
|
||||||
|
@ -83,7 +83,7 @@ impl Key for DefIndex {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Key for DefId {
|
impl Key for DefId {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
self.krate
|
self.krate
|
||||||
}
|
}
|
||||||
fn default_span(&self, tcx: TyCtxt) -> Span {
|
fn default_span(&self, tcx: TyCtxt) -> Span {
|
||||||
|
@ -92,7 +92,7 @@ impl Key for DefId {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Key for (DefId, DefId) {
|
impl Key for (DefId, DefId) {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
self.0.krate
|
self.0.krate
|
||||||
}
|
}
|
||||||
fn default_span(&self, tcx: TyCtxt) -> Span {
|
fn default_span(&self, tcx: TyCtxt) -> Span {
|
||||||
|
@ -101,7 +101,7 @@ impl Key for (DefId, DefId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Key for (CrateNum, DefId) {
|
impl Key for (CrateNum, DefId) {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
fn default_span(&self, tcx: TyCtxt) -> Span {
|
fn default_span(&self, tcx: TyCtxt) -> Span {
|
||||||
|
@ -110,7 +110,7 @@ impl Key for (CrateNum, DefId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Key for (DefId, SimplifiedType) {
|
impl Key for (DefId, SimplifiedType) {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
self.0.krate
|
self.0.krate
|
||||||
}
|
}
|
||||||
fn default_span(&self, tcx: TyCtxt) -> Span {
|
fn default_span(&self, tcx: TyCtxt) -> Span {
|
||||||
|
@ -119,7 +119,7 @@ impl Key for (DefId, SimplifiedType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for (DefId, &'tcx Substs<'tcx>) {
|
impl<'tcx> Key for (DefId, &'tcx Substs<'tcx>) {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
self.0.krate
|
self.0.krate
|
||||||
}
|
}
|
||||||
fn default_span(&self, tcx: TyCtxt) -> Span {
|
fn default_span(&self, tcx: TyCtxt) -> Span {
|
||||||
|
@ -128,7 +128,7 @@ impl<'tcx> Key for (DefId, &'tcx Substs<'tcx>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>) {
|
impl<'tcx> Key for (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>) {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
self.1.def_id().krate
|
self.1.def_id().krate
|
||||||
}
|
}
|
||||||
fn default_span(&self, tcx: TyCtxt) -> Span {
|
fn default_span(&self, tcx: TyCtxt) -> Span {
|
||||||
|
@ -137,7 +137,7 @@ impl<'tcx> Key for (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for ty::PolyTraitRef<'tcx>{
|
impl<'tcx> Key for ty::PolyTraitRef<'tcx>{
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
self.def_id().krate
|
self.def_id().krate
|
||||||
}
|
}
|
||||||
fn default_span(&self, tcx: TyCtxt) -> Span {
|
fn default_span(&self, tcx: TyCtxt) -> Span {
|
||||||
|
@ -146,7 +146,7 @@ impl<'tcx> Key for ty::PolyTraitRef<'tcx>{
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for (mir::interpret::ConstValue<'tcx>, Ty<'tcx>) {
|
impl<'tcx> Key for (mir::interpret::ConstValue<'tcx>, Ty<'tcx>) {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
LOCAL_CRATE
|
LOCAL_CRATE
|
||||||
}
|
}
|
||||||
fn default_span(&self, _: TyCtxt) -> Span {
|
fn default_span(&self, _: TyCtxt) -> Span {
|
||||||
|
@ -155,7 +155,7 @@ impl<'tcx> Key for (mir::interpret::ConstValue<'tcx>, Ty<'tcx>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for Ty<'tcx> {
|
impl<'tcx> Key for Ty<'tcx> {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
LOCAL_CRATE
|
LOCAL_CRATE
|
||||||
}
|
}
|
||||||
fn default_span(&self, _: TyCtxt) -> Span {
|
fn default_span(&self, _: TyCtxt) -> Span {
|
||||||
|
@ -164,7 +164,7 @@ impl<'tcx> Key for Ty<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for ty::ParamEnv<'tcx> {
|
impl<'tcx> Key for ty::ParamEnv<'tcx> {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
LOCAL_CRATE
|
LOCAL_CRATE
|
||||||
}
|
}
|
||||||
fn default_span(&self, _: TyCtxt) -> Span {
|
fn default_span(&self, _: TyCtxt) -> Span {
|
||||||
|
@ -173,8 +173,8 @@ impl<'tcx> Key for ty::ParamEnv<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, T: Key> Key for ty::ParamEnvAnd<'tcx, T> {
|
impl<'tcx, T: Key> Key for ty::ParamEnvAnd<'tcx, T> {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
self.value.map_crate()
|
self.value.query_crate()
|
||||||
}
|
}
|
||||||
fn default_span(&self, tcx: TyCtxt) -> Span {
|
fn default_span(&self, tcx: TyCtxt) -> Span {
|
||||||
self.value.default_span(tcx)
|
self.value.default_span(tcx)
|
||||||
|
@ -182,7 +182,7 @@ impl<'tcx, T: Key> Key for ty::ParamEnvAnd<'tcx, T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Key for InternedString {
|
impl Key for InternedString {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
LOCAL_CRATE
|
LOCAL_CRATE
|
||||||
}
|
}
|
||||||
fn default_span(&self, _tcx: TyCtxt) -> Span {
|
fn default_span(&self, _tcx: TyCtxt) -> Span {
|
||||||
|
@ -191,7 +191,7 @@ impl Key for InternedString {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for CanonicalProjectionGoal<'tcx> {
|
impl<'tcx> Key for CanonicalProjectionGoal<'tcx> {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
LOCAL_CRATE
|
LOCAL_CRATE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ impl<'tcx> Key for CanonicalProjectionGoal<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for CanonicalTyGoal<'tcx> {
|
impl<'tcx> Key for CanonicalTyGoal<'tcx> {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
LOCAL_CRATE
|
LOCAL_CRATE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ impl<'tcx> Key for CanonicalTyGoal<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Key for CanonicalPredicateGoal<'tcx> {
|
impl<'tcx> Key for CanonicalPredicateGoal<'tcx> {
|
||||||
fn map_crate(&self) -> CrateNum {
|
fn query_crate(&self) -> CrateNum {
|
||||||
LOCAL_CRATE
|
LOCAL_CRATE
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use dep_graph::{DepConstructor, DepNode};
|
use dep_graph::{DepConstructor, DepNode};
|
||||||
|
use errors::DiagnosticBuilder;
|
||||||
use hir::def_id::{CrateNum, DefId, DefIndex};
|
use hir::def_id::{CrateNum, DefId, DefIndex};
|
||||||
use hir::def::{Def, Export};
|
use hir::def::{Def, Export};
|
||||||
use hir::{self, TraitCandidate, ItemLocalId, CodegenFnAttrs};
|
use hir::{self, TraitCandidate, ItemLocalId, CodegenFnAttrs};
|
||||||
|
@ -71,30 +72,30 @@ pub use self::job::{QueryJob, QueryInfo};
|
||||||
pub use self::job::handle_deadlock;
|
pub use self::job::handle_deadlock;
|
||||||
|
|
||||||
mod keys;
|
mod keys;
|
||||||
pub use self::keys::Key;
|
use self::keys::Key;
|
||||||
|
|
||||||
mod values;
|
mod values;
|
||||||
use self::values::Value;
|
use self::values::Value;
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
pub use self::config::QueryConfig;
|
pub use self::config::QueryConfig;
|
||||||
use self::config::QueryDescription;
|
use self::config::{QueryAccessors, QueryDescription};
|
||||||
|
|
||||||
mod on_disk_cache;
|
mod on_disk_cache;
|
||||||
pub use self::on_disk_cache::OnDiskCache;
|
pub use self::on_disk_cache::OnDiskCache;
|
||||||
|
|
||||||
// Each of these maps also corresponds to a method on a
|
// Each of these quries corresponds to a function pointer field in the
|
||||||
// `Provider` trait for requesting a value of that type,
|
// `Providers` struct for requesting a value of that type, and a method
|
||||||
// and a method on `Maps` itself for doing that in a
|
// on `tcx: TyCtxt` (and `tcx.at(span)`) for doing that request in a way
|
||||||
// a way that memoizes and does dep-graph tracking,
|
// which memoizes and does dep-graph tracking, wrapping around the actual
|
||||||
// wrapping around the actual chain of providers that
|
// `Providers` that the driver creates (using several `rustc_*` crates).
|
||||||
// the driver creates (using several `rustc_*` crates).
|
|
||||||
//
|
//
|
||||||
// The result of query must implement Clone. They must also implement ty::maps::values::Value
|
// The result type of each query must implement `Clone`, and additionally
|
||||||
// which produces an appropriate error value if the query resulted in a query cycle.
|
// `ty::query::values::Value`, which produces an appropriate placeholder
|
||||||
// Queries marked with `fatal_cycle` do not need that implementation
|
// (error) value if the query resulted in a query cycle.
|
||||||
|
// Queries marked with `fatal_cycle` do not need the latter implementation,
|
||||||
// as they will raise an fatal error on query cycles instead.
|
// as they will raise an fatal error on query cycles instead.
|
||||||
define_maps! { <'tcx>
|
define_queries! { <'tcx>
|
||||||
/// Records the type of every item.
|
/// Records the type of every item.
|
||||||
[] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>,
|
[] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>,
|
||||||
|
|
||||||
|
@ -468,6 +469,32 @@ define_maps! { <'tcx>
|
||||||
-> Lrc<FxHashMap<DefId, String>>,
|
-> Lrc<FxHashMap<DefId, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// `try_get_query` can't be public because it uses the private query
|
||||||
|
// implementation traits, so we provide access to it selectively.
|
||||||
|
impl<'a, 'tcx, 'lcx> TyCtxt<'a, 'tcx, 'lcx> {
|
||||||
|
pub fn try_adt_sized_constraint(
|
||||||
|
self,
|
||||||
|
span: Span,
|
||||||
|
key: DefId,
|
||||||
|
) -> Result<&'tcx [Ty<'tcx>], DiagnosticBuilder<'a>> {
|
||||||
|
self.try_get_query::<queries::adt_sized_constraint>(span, key)
|
||||||
|
}
|
||||||
|
pub fn try_needs_drop_raw(
|
||||||
|
self,
|
||||||
|
span: Span,
|
||||||
|
key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>,
|
||||||
|
) -> Result<bool, DiagnosticBuilder<'a>> {
|
||||||
|
self.try_get_query::<queries::needs_drop_raw>(span, key)
|
||||||
|
}
|
||||||
|
pub fn try_optimized_mir(
|
||||||
|
self,
|
||||||
|
span: Span,
|
||||||
|
key: DefId,
|
||||||
|
) -> Result<&'tcx mir::Mir<'tcx>, DiagnosticBuilder<'a>> {
|
||||||
|
self.try_get_query::<queries::optimized_mir>(span, key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// These functions are little shims used to find the dep-node for a
|
// These functions are little shims used to find the dep-node for a
|
||||||
// given query when there is not a *direct* mapping:
|
// given query when there is not a *direct* mapping:
|
|
@ -209,7 +209,7 @@ impl<'sess> OnDiskCache<'sess> {
|
||||||
let mut query_result_index = EncodedQueryResultIndex::new();
|
let mut query_result_index = EncodedQueryResultIndex::new();
|
||||||
|
|
||||||
time(tcx.sess, "encode query results", || {
|
time(tcx.sess, "encode query results", || {
|
||||||
use ty::maps::queries::*;
|
use ty::query::queries::*;
|
||||||
let enc = &mut encoder;
|
let enc = &mut encoder;
|
||||||
let qri = &mut query_result_index;
|
let qri = &mut query_result_index;
|
||||||
|
|
||||||
|
@ -232,11 +232,11 @@ impl<'sess> OnDiskCache<'sess> {
|
||||||
encode_query_results::<specialization_graph_of, _>(tcx, enc, qri)?;
|
encode_query_results::<specialization_graph_of, _>(tcx, enc, qri)?;
|
||||||
|
|
||||||
// const eval is special, it only encodes successfully evaluated constants
|
// const eval is special, it only encodes successfully evaluated constants
|
||||||
use ty::maps::QueryConfig;
|
use ty::query::QueryAccessors;
|
||||||
let map = const_eval::query_map(tcx).borrow();
|
let cache = const_eval::query_cache(tcx).borrow();
|
||||||
assert!(map.active.is_empty());
|
assert!(cache.active.is_empty());
|
||||||
for (key, entry) in map.results.iter() {
|
for (key, entry) in cache.results.iter() {
|
||||||
use ty::maps::config::QueryDescription;
|
use ty::query::config::QueryDescription;
|
||||||
if const_eval::cache_on_disk(key.clone()) {
|
if const_eval::cache_on_disk(key.clone()) {
|
||||||
if let Ok(ref value) = entry.value {
|
if let Ok(ref value) = entry.value {
|
||||||
let dep_node = SerializedDepNodeIndex::new(entry.index.index());
|
let dep_node = SerializedDepNodeIndex::new(entry.index.index());
|
||||||
|
@ -1099,7 +1099,7 @@ fn encode_query_results<'enc, 'a, 'tcx, Q, E>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
|
|
||||||
time(tcx.sess, desc, || {
|
time(tcx.sess, desc, || {
|
||||||
|
|
||||||
let map = Q::query_map(tcx).borrow();
|
let map = Q::query_cache(tcx).borrow();
|
||||||
assert!(map.active.is_empty());
|
assert!(map.active.is_empty());
|
||||||
for (key, entry) in map.results.iter() {
|
for (key, entry) in map.results.iter() {
|
||||||
if Q::cache_on_disk(key.clone()) {
|
if Q::cache_on_disk(key.clone()) {
|
|
@ -19,10 +19,9 @@ use errors::Diagnostic;
|
||||||
use errors::FatalError;
|
use errors::FatalError;
|
||||||
use ty::tls;
|
use ty::tls;
|
||||||
use ty::{TyCtxt};
|
use ty::{TyCtxt};
|
||||||
use ty::maps::Query;
|
use ty::query::Query;
|
||||||
use ty::maps::config::QueryConfig;
|
use ty::query::config::{QueryConfig, QueryDescription};
|
||||||
use ty::maps::config::QueryDescription;
|
use ty::query::job::{QueryJob, QueryResult, QueryInfo};
|
||||||
use ty::maps::job::{QueryJob, QueryResult, QueryInfo};
|
|
||||||
use ty::item_path;
|
use ty::item_path;
|
||||||
|
|
||||||
use util::common::{profq_msg, ProfileQueriesMsg, QueryMsg};
|
use util::common::{profq_msg, ProfileQueriesMsg, QueryMsg};
|
||||||
|
@ -35,7 +34,7 @@ use std::collections::hash_map::Entry;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
use syntax::codemap::DUMMY_SP;
|
use syntax::codemap::DUMMY_SP;
|
||||||
|
|
||||||
pub struct QueryMap<'tcx, D: QueryConfig<'tcx> + ?Sized> {
|
pub struct QueryCache<'tcx, D: QueryConfig<'tcx> + ?Sized> {
|
||||||
pub(super) results: FxHashMap<D::Key, QueryValue<D::Value>>,
|
pub(super) results: FxHashMap<D::Key, QueryValue<D::Value>>,
|
||||||
pub(super) active: FxHashMap<D::Key, QueryResult<'tcx>>,
|
pub(super) active: FxHashMap<D::Key, QueryResult<'tcx>>,
|
||||||
}
|
}
|
||||||
|
@ -56,9 +55,9 @@ impl<T> QueryValue<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, M: QueryConfig<'tcx>> QueryMap<'tcx, M> {
|
impl<'tcx, M: QueryConfig<'tcx>> QueryCache<'tcx, M> {
|
||||||
pub(super) fn new() -> QueryMap<'tcx, M> {
|
pub(super) fn new() -> QueryCache<'tcx, M> {
|
||||||
QueryMap {
|
QueryCache {
|
||||||
results: FxHashMap(),
|
results: FxHashMap(),
|
||||||
active: FxHashMap(),
|
active: FxHashMap(),
|
||||||
}
|
}
|
||||||
|
@ -95,7 +94,7 @@ macro_rules! profq_query_msg {
|
||||||
/// A type representing the responsibility to execute the job in the `job` field.
|
/// A type representing the responsibility to execute the job in the `job` field.
|
||||||
/// This will poison the relevant query if dropped.
|
/// This will poison the relevant query if dropped.
|
||||||
pub(super) struct JobOwner<'a, 'tcx: 'a, Q: QueryDescription<'tcx> + 'a> {
|
pub(super) struct JobOwner<'a, 'tcx: 'a, Q: QueryDescription<'tcx> + 'a> {
|
||||||
map: &'a Lock<QueryMap<'tcx, Q>>,
|
cache: &'a Lock<QueryCache<'tcx, Q>>,
|
||||||
key: Q::Key,
|
key: Q::Key,
|
||||||
job: Lrc<QueryJob<'tcx>>,
|
job: Lrc<QueryJob<'tcx>>,
|
||||||
}
|
}
|
||||||
|
@ -114,9 +113,9 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
|
||||||
span: Span,
|
span: Span,
|
||||||
key: &Q::Key,
|
key: &Q::Key,
|
||||||
) -> TryGetJob<'a, 'tcx, Q> {
|
) -> TryGetJob<'a, 'tcx, Q> {
|
||||||
let map = Q::query_map(tcx);
|
let cache = Q::query_cache(tcx);
|
||||||
loop {
|
loop {
|
||||||
let mut lock = map.borrow_mut();
|
let mut lock = cache.borrow_mut();
|
||||||
if let Some(value) = lock.results.get(key) {
|
if let Some(value) = lock.results.get(key) {
|
||||||
profq_msg!(tcx, ProfileQueriesMsg::CacheHit);
|
profq_msg!(tcx, ProfileQueriesMsg::CacheHit);
|
||||||
let result = Ok((value.value.clone(), value.index));
|
let result = Ok((value.value.clone(), value.index));
|
||||||
|
@ -138,7 +137,7 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
|
||||||
};
|
};
|
||||||
let job = Lrc::new(QueryJob::new(info, icx.query.clone()));
|
let job = Lrc::new(QueryJob::new(info, icx.query.clone()));
|
||||||
let owner = JobOwner {
|
let owner = JobOwner {
|
||||||
map,
|
cache,
|
||||||
job: job.clone(),
|
job: job.clone(),
|
||||||
key: (*key).clone(),
|
key: (*key).clone(),
|
||||||
};
|
};
|
||||||
|
@ -155,20 +154,20 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Completes the query by updating the query map with the `result`,
|
/// Completes the query by updating the query cache with the `result`,
|
||||||
/// signals the waiter and forgets the JobOwner, so it won't poison the query
|
/// signals the waiter and forgets the JobOwner, so it won't poison the query
|
||||||
pub(super) fn complete(self, result: &Q::Value, dep_node_index: DepNodeIndex) {
|
pub(super) fn complete(self, result: &Q::Value, dep_node_index: DepNodeIndex) {
|
||||||
// We can move out of `self` here because we `mem::forget` it below
|
// We can move out of `self` here because we `mem::forget` it below
|
||||||
let key = unsafe { ptr::read(&self.key) };
|
let key = unsafe { ptr::read(&self.key) };
|
||||||
let job = unsafe { ptr::read(&self.job) };
|
let job = unsafe { ptr::read(&self.job) };
|
||||||
let map = self.map;
|
let cache = self.cache;
|
||||||
|
|
||||||
// Forget ourself so our destructor won't poison the query
|
// Forget ourself so our destructor won't poison the query
|
||||||
mem::forget(self);
|
mem::forget(self);
|
||||||
|
|
||||||
let value = QueryValue::new(result.clone(), dep_node_index);
|
let value = QueryValue::new(result.clone(), dep_node_index);
|
||||||
{
|
{
|
||||||
let mut lock = map.borrow_mut();
|
let mut lock = cache.borrow_mut();
|
||||||
lock.active.remove(&key);
|
lock.active.remove(&key);
|
||||||
lock.results.insert(key, value);
|
lock.results.insert(key, value);
|
||||||
}
|
}
|
||||||
|
@ -215,7 +214,7 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
|
||||||
impl<'a, 'tcx, Q: QueryDescription<'tcx>> Drop for JobOwner<'a, 'tcx, Q> {
|
impl<'a, 'tcx, Q: QueryDescription<'tcx>> Drop for JobOwner<'a, 'tcx, Q> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
// Poison the query so jobs waiting on it panic
|
// Poison the query so jobs waiting on it panic
|
||||||
self.map.borrow_mut().active.insert(self.key.clone(), QueryResult::Poisoned);
|
self.cache.borrow_mut().active.insert(self.key.clone(), QueryResult::Poisoned);
|
||||||
// Also signal the completion of the job, so waiters
|
// Also signal the completion of the job, so waiters
|
||||||
// will continue execution
|
// will continue execution
|
||||||
self.job.signal_complete();
|
self.job.signal_complete();
|
||||||
|
@ -231,7 +230,7 @@ pub struct CycleError<'tcx> {
|
||||||
|
|
||||||
/// The result of `try_get_lock`
|
/// The result of `try_get_lock`
|
||||||
pub(super) enum TryGetJob<'a, 'tcx: 'a, D: QueryDescription<'tcx> + 'a> {
|
pub(super) enum TryGetJob<'a, 'tcx: 'a, D: QueryDescription<'tcx> + 'a> {
|
||||||
/// The query is not yet started. Contains a guard to the map eventually used to start it.
|
/// The query is not yet started. Contains a guard to the cache eventually used to start it.
|
||||||
NotYetStarted(JobOwner<'a, 'tcx, D>),
|
NotYetStarted(JobOwner<'a, 'tcx, D>),
|
||||||
|
|
||||||
/// The query was already completed.
|
/// The query was already completed.
|
||||||
|
@ -392,7 +391,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
|
|
||||||
self.dep_graph.read_index(dep_node_index);
|
self.dep_graph.read_index(dep_node_index);
|
||||||
|
|
||||||
self.on_disk_query_result_cache
|
self.queries.on_disk_cache
|
||||||
.store_diagnostics_for_anon_node(dep_node_index, diagnostics);
|
.store_diagnostics_for_anon_node(dep_node_index, diagnostics);
|
||||||
|
|
||||||
job.complete(&result, dep_node_index);
|
job.complete(&result, dep_node_index);
|
||||||
|
@ -546,7 +545,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if dep_node.kind != ::dep_graph::DepKind::Null {
|
if dep_node.kind != ::dep_graph::DepKind::Null {
|
||||||
self.on_disk_query_result_cache
|
self.queries.on_disk_cache
|
||||||
.store_diagnostics(dep_node_index, diagnostics);
|
.store_diagnostics(dep_node_index, diagnostics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +561,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
/// side-effects -- e.g., in order to report errors for erroneous programs.
|
/// side-effects -- e.g., in order to report errors for erroneous programs.
|
||||||
///
|
///
|
||||||
/// Note: The optimization is only available during incr. comp.
|
/// Note: The optimization is only available during incr. comp.
|
||||||
pub fn ensure_query<Q: QueryDescription<'gcx>>(self, key: Q::Key) -> () {
|
pub(super) fn ensure_query<Q: QueryDescription<'gcx>>(self, key: Q::Key) -> () {
|
||||||
let dep_node = Q::to_dep_node(self, &key);
|
let dep_node = Q::to_dep_node(self, &key);
|
||||||
|
|
||||||
// Ensuring an "input" or anonymous query makes no sense
|
// Ensuring an "input" or anonymous query makes no sense
|
||||||
|
@ -595,10 +594,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
self.force_query_with_job::<Q>(key, job, dep_node)
|
self.force_query_with_job::<Q>(key, job, dep_node)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn try_get_query<Q: QueryDescription<'gcx>>(
|
pub(super) fn try_get_query<Q: QueryDescription<'gcx>>(
|
||||||
self,
|
self,
|
||||||
span: Span,
|
span: Span,
|
||||||
key: Q::Key
|
key: Q::Key,
|
||||||
) -> Result<Q::Value, DiagnosticBuilder<'a>> {
|
) -> Result<Q::Value, DiagnosticBuilder<'a>> {
|
||||||
match self.try_get_with::<Q>(span, key) {
|
match self.try_get_with::<Q>(span, key) {
|
||||||
Ok(e) => Ok(e),
|
Ok(e) => Ok(e),
|
||||||
|
@ -606,7 +605,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_query<Q: QueryDescription<'gcx>>(self, span: Span, key: Q::Key) -> Q::Value {
|
pub(super) fn get_query<Q: QueryDescription<'gcx>>(
|
||||||
|
self,
|
||||||
|
span: Span,
|
||||||
|
key: Q::Key,
|
||||||
|
) -> Q::Value {
|
||||||
self.try_get_query::<Q>(span, key).unwrap_or_else(|mut e| {
|
self.try_get_query::<Q>(span, key).unwrap_or_else(|mut e| {
|
||||||
e.emit();
|
e.emit();
|
||||||
Q::handle_cycle_error(self)
|
Q::handle_cycle_error(self)
|
||||||
|
@ -627,13 +630,14 @@ macro_rules! handle_cycle_error {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! define_maps {
|
macro_rules! define_queries {
|
||||||
(<$tcx:tt>
|
(<$tcx:tt>
|
||||||
$($(#[$attr:meta])*
|
$($(#[$attr:meta])*
|
||||||
[$($modifiers:tt)*] fn $name:ident: $node:ident($K:ty) -> $V:ty,)*) => {
|
[$($modifiers:tt)*] fn $name:ident: $node:ident($K:ty) -> $V:ty,)*) => {
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use ty::maps::job::QueryResult;
|
#[cfg(parallel_queries)]
|
||||||
|
use ty::query::job::QueryResult;
|
||||||
use rustc_data_structures::sync::Lock;
|
use rustc_data_structures::sync::Lock;
|
||||||
use {
|
use {
|
||||||
rustc_data_structures::stable_hasher::HashStable,
|
rustc_data_structures::stable_hasher::HashStable,
|
||||||
|
@ -642,20 +646,24 @@ macro_rules! define_maps {
|
||||||
ich::StableHashingContext
|
ich::StableHashingContext
|
||||||
};
|
};
|
||||||
|
|
||||||
define_map_struct! {
|
define_queries_struct! {
|
||||||
tcx: $tcx,
|
tcx: $tcx,
|
||||||
input: ($(([$($modifiers)*] [$($attr)*] [$name]))*)
|
input: ($(([$($modifiers)*] [$($attr)*] [$name]))*)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<$tcx> Maps<$tcx> {
|
impl<$tcx> Queries<$tcx> {
|
||||||
pub fn new(providers: IndexVec<CrateNum, Providers<$tcx>>)
|
pub fn new(
|
||||||
-> Self {
|
providers: IndexVec<CrateNum, Providers<$tcx>>,
|
||||||
Maps {
|
on_disk_cache: OnDiskCache<'tcx>,
|
||||||
|
) -> Self {
|
||||||
|
Queries {
|
||||||
providers,
|
providers,
|
||||||
$($name: Lock::new(QueryMap::new())),*
|
on_disk_cache,
|
||||||
|
$($name: Lock::new(QueryCache::new())),*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(parallel_queries)]
|
||||||
pub fn collect_active_jobs(&self) -> Vec<Lrc<QueryJob<$tcx>>> {
|
pub fn collect_active_jobs(&self) -> Vec<Lrc<QueryJob<$tcx>>> {
|
||||||
let mut jobs = Vec::new();
|
let mut jobs = Vec::new();
|
||||||
|
|
||||||
|
@ -750,13 +758,15 @@ macro_rules! define_maps {
|
||||||
type Value = $V;
|
type Value = $V;
|
||||||
|
|
||||||
const NAME: &'static str = stringify!($name);
|
const NAME: &'static str = stringify!($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<$tcx> QueryAccessors<$tcx> for queries::$name<$tcx> {
|
||||||
fn query(key: Self::Key) -> Query<'tcx> {
|
fn query(key: Self::Key) -> Query<'tcx> {
|
||||||
Query::$name(key)
|
Query::$name(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn query_map<'a>(tcx: TyCtxt<'a, $tcx, '_>) -> &'a Lock<QueryMap<$tcx, Self>> {
|
fn query_cache<'a>(tcx: TyCtxt<'a, $tcx, '_>) -> &'a Lock<QueryCache<$tcx, Self>> {
|
||||||
&tcx.maps.$name
|
&tcx.queries.$name
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
|
@ -769,7 +779,7 @@ macro_rules! define_maps {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn compute(tcx: TyCtxt<'_, 'tcx, '_>, key: Self::Key) -> Self::Value {
|
fn compute(tcx: TyCtxt<'_, 'tcx, '_>, key: Self::Key) -> Self::Value {
|
||||||
__query_compute::$name(move || {
|
__query_compute::$name(move || {
|
||||||
let provider = tcx.maps.providers[key.map_crate()].$name;
|
let provider = tcx.queries.providers[key.query_crate()].$name;
|
||||||
provider(tcx.global_tcx(), key)
|
provider(tcx.global_tcx(), key)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -840,12 +850,18 @@ macro_rules! define_maps {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! define_map_struct {
|
macro_rules! define_queries_struct {
|
||||||
(tcx: $tcx:tt,
|
(tcx: $tcx:tt,
|
||||||
input: ($(([$($modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => {
|
input: ($(([$($modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => {
|
||||||
pub struct Maps<$tcx> {
|
pub(crate) struct Queries<$tcx> {
|
||||||
|
/// This provides access to the incr. comp. on-disk cache for query results.
|
||||||
|
/// Do not access this directly. It is only meant to be used by
|
||||||
|
/// `DepGraph::try_mark_green()` and the query infrastructure.
|
||||||
|
pub(crate) on_disk_cache: OnDiskCache<'tcx>,
|
||||||
|
|
||||||
providers: IndexVec<CrateNum, Providers<$tcx>>,
|
providers: IndexVec<CrateNum, Providers<$tcx>>,
|
||||||
$($(#[$attr])* $name: Lock<QueryMap<$tcx, queries::$name<$tcx>>>,)*
|
|
||||||
|
$($(#[$attr])* $name: Lock<QueryCache<$tcx, queries::$name<$tcx>>>,)*
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -860,7 +876,7 @@ macro_rules! define_provider_struct {
|
||||||
impl<$tcx> Default for Providers<$tcx> {
|
impl<$tcx> Default for Providers<$tcx> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
$(fn $name<'a, $tcx>(_: TyCtxt<'a, $tcx, $tcx>, key: $K) -> $R {
|
$(fn $name<'a, $tcx>(_: TyCtxt<'a, $tcx, $tcx>, key: $K) -> $R {
|
||||||
bug!("tcx.maps.{}({:?}) unsupported by its crate",
|
bug!("tcx.{}({:?}) unsupported by its crate",
|
||||||
stringify!($name), key);
|
stringify!($name), key);
|
||||||
})*
|
})*
|
||||||
Providers { $($name),* }
|
Providers { $($name),* }
|
||||||
|
@ -960,11 +976,11 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
|
||||||
profq_msg!(tcx,
|
profq_msg!(tcx,
|
||||||
ProfileQueriesMsg::QueryBegin(
|
ProfileQueriesMsg::QueryBegin(
|
||||||
DUMMY_SP.data(),
|
DUMMY_SP.data(),
|
||||||
profq_query_msg!(::ty::maps::queries::$query::NAME, tcx, $key),
|
profq_query_msg!(::ty::query::queries::$query::NAME, tcx, $key),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
match tcx.force_query::<::ty::maps::queries::$query>($key, DUMMY_SP, *dep_node) {
|
match tcx.force_query::<::ty::query::queries::$query>($key, DUMMY_SP, *dep_node) {
|
||||||
Ok(_) => {},
|
Ok(_) => {},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tcx.report_cycle(e).emit();
|
tcx.report_cycle(e).emit();
|
||||||
|
@ -1201,15 +1217,15 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
|
||||||
|
|
||||||
|
|
||||||
// FIXME(#45015): Another piece of boilerplate code that could be generated in
|
// FIXME(#45015): Another piece of boilerplate code that could be generated in
|
||||||
// a combined define_dep_nodes!()/define_maps!() macro.
|
// a combined define_dep_nodes!()/define_queries!() macro.
|
||||||
macro_rules! impl_load_from_cache {
|
macro_rules! impl_load_from_cache {
|
||||||
($($dep_kind:ident => $query_name:ident,)*) => {
|
($($dep_kind:ident => $query_name:ident,)*) => {
|
||||||
impl DepNode {
|
impl DepNode {
|
||||||
// Check whether the query invocation corresponding to the given
|
// Check whether the query invocation corresponding to the given
|
||||||
// DepNode is eligible for on-disk-caching.
|
// DepNode is eligible for on-disk-caching.
|
||||||
pub fn cache_on_disk(&self, tcx: TyCtxt) -> bool {
|
pub fn cache_on_disk(&self, tcx: TyCtxt) -> bool {
|
||||||
use ty::maps::queries;
|
use ty::query::queries;
|
||||||
use ty::maps::QueryDescription;
|
use ty::query::QueryDescription;
|
||||||
|
|
||||||
match self.kind {
|
match self.kind {
|
||||||
$(DepKind::$dep_kind => {
|
$(DepKind::$dep_kind => {
|
|
@ -18,7 +18,7 @@ use ich::NodeIdHashingMode;
|
||||||
use traits::{self, ObligationCause};
|
use traits::{self, ObligationCause};
|
||||||
use ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable};
|
use ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable};
|
||||||
use ty::subst::{Substs, UnpackedKind};
|
use ty::subst::{Substs, UnpackedKind};
|
||||||
use ty::maps::TyCtxtAt;
|
use ty::query::TyCtxtAt;
|
||||||
use ty::TypeVariants::*;
|
use ty::TypeVariants::*;
|
||||||
use ty::layout::{Integer, IntegerExt};
|
use ty::layout::{Integer, IntegerExt};
|
||||||
use util::common::ErrorReported;
|
use util::common::ErrorReported;
|
||||||
|
@ -415,7 +415,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
return None;
|
return None;
|
||||||
};
|
};
|
||||||
|
|
||||||
ty::maps::queries::coherent_trait::ensure(self, drop_trait);
|
ty::query::queries::coherent_trait::ensure(self, drop_trait);
|
||||||
|
|
||||||
let mut dtor_did = None;
|
let mut dtor_did = None;
|
||||||
let ty = self.type_of(adt_did);
|
let ty = self.type_of(adt_did);
|
||||||
|
@ -883,7 +883,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
let (param_env, ty) = query.into_parts();
|
let (param_env, ty) = query.into_parts();
|
||||||
|
|
||||||
let needs_drop = |ty: Ty<'tcx>| -> bool {
|
let needs_drop = |ty: Ty<'tcx>| -> bool {
|
||||||
match tcx.try_get_query::<ty::queries::needs_drop_raw>(DUMMY_SP, param_env.and(ty)) {
|
match tcx.try_needs_drop_raw(DUMMY_SP, param_env.and(ty)) {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(mut bug) => {
|
Err(mut bug) => {
|
||||||
// Cycles should be reported as an error by `check_representable`.
|
// Cycles should be reported as an error by `check_representable`.
|
||||||
|
@ -1014,8 +1014,8 @@ impl<'tcx> ExplicitSelf<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut ty::maps::Providers) {
|
pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
*providers = ty::maps::Providers {
|
*providers = ty::query::Providers {
|
||||||
is_copy_raw,
|
is_copy_raw,
|
||||||
is_sized_raw,
|
is_sized_raw,
|
||||||
is_freeze_raw,
|
is_freeze_raw,
|
||||||
|
|
|
@ -37,7 +37,7 @@ use rustc::middle::mem_categorization::ImmutabilityBlame;
|
||||||
use rustc::middle::region;
|
use rustc::middle::region;
|
||||||
use rustc::middle::free_region::RegionRelations;
|
use rustc::middle::free_region::RegionRelations;
|
||||||
use rustc::ty::{self, Ty, TyCtxt};
|
use rustc::ty::{self, Ty, TyCtxt};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc_mir::util::borrowck_errors::{BorrowckErrors, Origin};
|
use rustc_mir::util::borrowck_errors::{BorrowckErrors, Origin};
|
||||||
use rustc::util::nodemap::FxHashSet;
|
use rustc::util::nodemap::FxHashSet;
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
|
||||||
// Note that `mir_validated` is a "stealable" result; the
|
// Note that `mir_validated` is a "stealable" result; the
|
||||||
// thief, `optimized_mir()`, forces borrowck, so we know that
|
// thief, `optimized_mir()`, forces borrowck, so we know that
|
||||||
// is not yet stolen.
|
// is not yet stolen.
|
||||||
ty::maps::queries::mir_validated::ensure(tcx, owner_def_id);
|
ty::query::queries::mir_validated::ensure(tcx, owner_def_id);
|
||||||
|
|
||||||
// option dance because you can't capture an uninitialized variable
|
// option dance because you can't capture an uninitialized variable
|
||||||
// by mut-ref.
|
// by mut-ref.
|
||||||
|
|
|
@ -17,7 +17,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::session::config::Sanitizer;
|
use rustc::session::config::Sanitizer;
|
||||||
use rustc::ty::TyCtxt;
|
use rustc::ty::TyCtxt;
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_target::spec::PanicStrategy;
|
use rustc_target::spec::PanicStrategy;
|
||||||
|
|
|
@ -19,7 +19,7 @@ use rustc::ich::Fingerprint;
|
||||||
use rustc::middle::exported_symbols::{SymbolExportLevel, ExportedSymbol, metadata_symbol_name};
|
use rustc::middle::exported_symbols::{SymbolExportLevel, ExportedSymbol, metadata_symbol_name};
|
||||||
use rustc::session::config;
|
use rustc::session::config;
|
||||||
use rustc::ty::{TyCtxt, SymbolName};
|
use rustc::ty::{TyCtxt, SymbolName};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::ty::subst::Substs;
|
use rustc::ty::subst::Substs;
|
||||||
use rustc::util::nodemap::{FxHashMap, DefIdMap};
|
use rustc::util::nodemap::{FxHashMap, DefIdMap};
|
||||||
use rustc_allocator::ALLOCATOR_METHODS;
|
use rustc_allocator::ALLOCATOR_METHODS;
|
||||||
|
|
|
@ -41,7 +41,7 @@ use rustc::mir::mono::{Linkage, Visibility, Stats};
|
||||||
use rustc::middle::cstore::{EncodedMetadata};
|
use rustc::middle::cstore::{EncodedMetadata};
|
||||||
use rustc::ty::{self, Ty, TyCtxt};
|
use rustc::ty::{self, Ty, TyCtxt};
|
||||||
use rustc::ty::layout::{self, Align, TyLayout, LayoutOf};
|
use rustc::ty::layout::{self, Align, TyLayout, LayoutOf};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::dep_graph::{DepNode, DepConstructor};
|
use rustc::dep_graph::{DepNode, DepConstructor};
|
||||||
use rustc::middle::cstore::{self, LinkMeta, LinkagePreference};
|
use rustc::middle::cstore::{self, LinkMeta, LinkagePreference};
|
||||||
use rustc::middle::exported_symbols;
|
use rustc::middle::exported_symbols;
|
||||||
|
|
|
@ -183,14 +183,14 @@ impl CodegenBackend for LlvmCodegenBackend {
|
||||||
box metadata::LlvmMetadataLoader
|
box metadata::LlvmMetadataLoader
|
||||||
}
|
}
|
||||||
|
|
||||||
fn provide(&self, providers: &mut ty::maps::Providers) {
|
fn provide(&self, providers: &mut ty::query::Providers) {
|
||||||
back::symbol_names::provide(providers);
|
back::symbol_names::provide(providers);
|
||||||
back::symbol_export::provide(providers);
|
back::symbol_export::provide(providers);
|
||||||
base::provide(providers);
|
base::provide(providers);
|
||||||
attributes::provide(providers);
|
attributes::provide(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn provide_extern(&self, providers: &mut ty::maps::Providers) {
|
fn provide_extern(&self, providers: &mut ty::query::Providers) {
|
||||||
back::symbol_export::provide_extern(providers);
|
back::symbol_export::provide_extern(providers);
|
||||||
base::provide_extern(providers);
|
base::provide_extern(providers);
|
||||||
attributes::provide_extern(providers);
|
attributes::provide_extern(providers);
|
||||||
|
|
|
@ -39,7 +39,7 @@ use rustc::hir::def_id::LOCAL_CRATE;
|
||||||
use rustc::session::{Session, CompileIncomplete};
|
use rustc::session::{Session, CompileIncomplete};
|
||||||
use rustc::session::config::{CrateType, OutputFilenames, PrintRequest};
|
use rustc::session::config::{CrateType, OutputFilenames, PrintRequest};
|
||||||
use rustc::ty::TyCtxt;
|
use rustc::ty::TyCtxt;
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::middle::cstore::EncodedMetadata;
|
use rustc::middle::cstore::EncodedMetadata;
|
||||||
use rustc::middle::cstore::MetadataLoader;
|
use rustc::middle::cstore::MetadataLoader;
|
||||||
use rustc::dep_graph::DepGraph;
|
use rustc::dep_graph::DepGraph;
|
||||||
|
|
|
@ -103,7 +103,7 @@ use rustc::hir::map::definitions::DefPathData;
|
||||||
use rustc::ich::NodeIdHashingMode;
|
use rustc::ich::NodeIdHashingMode;
|
||||||
use rustc::middle::weak_lang_items;
|
use rustc::middle::weak_lang_items;
|
||||||
use rustc::ty::item_path::{self, ItemPathBuffer, RootMode};
|
use rustc::ty::item_path::{self, ItemPathBuffer, RootMode};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::ty::subst::Substs;
|
use rustc::ty::subst::Substs;
|
||||||
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
|
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
|
||||||
use rustc::util::common::record_time;
|
use rustc::util::common::record_time;
|
||||||
|
|
|
@ -87,7 +87,7 @@ pub fn spawn_thread_pool<F: FnOnce(config::Options) -> R + sync::Send, R: sync::
|
||||||
|
|
||||||
let config = ThreadPoolBuilder::new()
|
let config = ThreadPoolBuilder::new()
|
||||||
.num_threads(Session::query_threads_from_opts(&opts))
|
.num_threads(Session::query_threads_from_opts(&opts))
|
||||||
.deadlock_handler(|| unsafe { ty::maps::handle_deadlock() })
|
.deadlock_handler(|| unsafe { ty::query::handle_deadlock() })
|
||||||
.stack_size(16 * 1024 * 1024);
|
.stack_size(16 * 1024 * 1024);
|
||||||
|
|
||||||
let with_pool = move |pool: &ThreadPool| {
|
let with_pool = move |pool: &ThreadPool| {
|
||||||
|
@ -399,10 +399,10 @@ pub struct CompileController<'a> {
|
||||||
|
|
||||||
/// Allows overriding default rustc query providers,
|
/// Allows overriding default rustc query providers,
|
||||||
/// after `default_provide` has installed them.
|
/// after `default_provide` has installed them.
|
||||||
pub provide: Box<Fn(&mut ty::maps::Providers) + 'a>,
|
pub provide: Box<Fn(&mut ty::query::Providers) + 'a>,
|
||||||
/// Same as `provide`, but only for non-local crates,
|
/// Same as `provide`, but only for non-local crates,
|
||||||
/// applied after `default_provide_extern`.
|
/// applied after `default_provide_extern`.
|
||||||
pub provide_extern: Box<Fn(&mut ty::maps::Providers) + 'a>,
|
pub provide_extern: Box<Fn(&mut ty::query::Providers) + 'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CompileController<'a> {
|
impl<'a> CompileController<'a> {
|
||||||
|
@ -1140,7 +1140,7 @@ where
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_provide(providers: &mut ty::maps::Providers) {
|
pub fn default_provide(providers: &mut ty::query::Providers) {
|
||||||
hir::provide(providers);
|
hir::provide(providers);
|
||||||
borrowck::provide(providers);
|
borrowck::provide(providers);
|
||||||
mir::provide(providers);
|
mir::provide(providers);
|
||||||
|
@ -1158,7 +1158,7 @@ pub fn default_provide(providers: &mut ty::maps::Providers) {
|
||||||
lint::provide(providers);
|
lint::provide(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_provide_extern(providers: &mut ty::maps::Providers) {
|
pub fn default_provide_extern(providers: &mut ty::query::Providers) {
|
||||||
cstore::provide_extern(providers);
|
cstore::provide_extern(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1203,7 +1203,7 @@ where
|
||||||
|
|
||||||
time(sess, "loop checking", || loops::check_crate(sess, &hir_map));
|
time(sess, "loop checking", || loops::check_crate(sess, &hir_map));
|
||||||
|
|
||||||
let mut local_providers = ty::maps::Providers::default();
|
let mut local_providers = ty::query::Providers::default();
|
||||||
default_provide(&mut local_providers);
|
default_provide(&mut local_providers);
|
||||||
codegen_backend.provide(&mut local_providers);
|
codegen_backend.provide(&mut local_providers);
|
||||||
(control.provide)(&mut local_providers);
|
(control.provide)(&mut local_providers);
|
||||||
|
|
|
@ -20,7 +20,7 @@ use rustc::middle::region;
|
||||||
use rustc::ty::subst::Subst;
|
use rustc::ty::subst::Subst;
|
||||||
use rustc::traits::ObligationCause;
|
use rustc::traits::ObligationCause;
|
||||||
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
|
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
|
||||||
use rustc::ty::maps::OnDiskCache;
|
use rustc::ty::query::OnDiskCache;
|
||||||
use rustc::infer::{self, InferOk, InferResult};
|
use rustc::infer::{self, InferOk, InferResult};
|
||||||
use rustc::infer::outlives::env::OutlivesEnvironment;
|
use rustc::infer::outlives::env::OutlivesEnvironment;
|
||||||
use rustc::infer::type_variable::TypeVariableOrigin;
|
use rustc::infer::type_variable::TypeVariableOrigin;
|
||||||
|
@ -157,8 +157,8 @@ fn test_env_with_pool<F>(
|
||||||
};
|
};
|
||||||
TyCtxt::create_and_enter(&sess,
|
TyCtxt::create_and_enter(&sess,
|
||||||
&cstore,
|
&cstore,
|
||||||
ty::maps::Providers::default(),
|
ty::query::Providers::default(),
|
||||||
ty::maps::Providers::default(),
|
ty::query::Providers::default(),
|
||||||
&arenas,
|
&arenas,
|
||||||
resolutions,
|
resolutions,
|
||||||
hir_map,
|
hir_map,
|
||||||
|
|
|
@ -385,7 +385,7 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> {
|
||||||
// michaelwoerister and vitiral came up with a possible solution,
|
// michaelwoerister and vitiral came up with a possible solution,
|
||||||
// to just do this before every query
|
// to just do this before every query
|
||||||
// ```
|
// ```
|
||||||
// ::rustc::ty::maps::plumbing::force_from_dep_node(tcx, dep_node)
|
// ::rustc::ty::query::plumbing::force_from_dep_node(tcx, dep_node)
|
||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
// However, this did not seem to work effectively and more bugs were hit.
|
// However, this did not seem to work effectively and more bugs were hit.
|
||||||
|
|
|
@ -14,7 +14,7 @@ use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc::dep_graph::{PreviousDepGraph, SerializedDepGraph, WorkProduct, WorkProductId};
|
use rustc::dep_graph::{PreviousDepGraph, SerializedDepGraph, WorkProduct, WorkProductId};
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::ty::TyCtxt;
|
use rustc::ty::TyCtxt;
|
||||||
use rustc::ty::maps::OnDiskCache;
|
use rustc::ty::query::OnDiskCache;
|
||||||
use rustc::util::common::time_ext;
|
use rustc::util::common::time_ext;
|
||||||
use rustc_serialize::Decodable as RustcDecodable;
|
use rustc_serialize::Decodable as RustcDecodable;
|
||||||
use rustc_serialize::opaque::Decoder;
|
use rustc_serialize::opaque::Decoder;
|
||||||
|
|
|
@ -15,7 +15,7 @@ use native_libs;
|
||||||
use foreign_modules;
|
use foreign_modules;
|
||||||
use schema;
|
use schema;
|
||||||
|
|
||||||
use rustc::ty::maps::QueryConfig;
|
use rustc::ty::query::QueryConfig;
|
||||||
use rustc::middle::cstore::{CrateStore, DepKind,
|
use rustc::middle::cstore::{CrateStore, DepKind,
|
||||||
MetadataLoader, LinkMeta,
|
MetadataLoader, LinkMeta,
|
||||||
LoadedMacro, EncodedMetadata, NativeLibraryKind};
|
LoadedMacro, EncodedMetadata, NativeLibraryKind};
|
||||||
|
@ -24,7 +24,7 @@ use rustc::middle::stability::DeprecationEntry;
|
||||||
use rustc::hir::def;
|
use rustc::hir::def;
|
||||||
use rustc::session::{CrateDisambiguator, Session};
|
use rustc::session::{CrateDisambiguator, Session};
|
||||||
use rustc::ty::{self, TyCtxt};
|
use rustc::ty::{self, TyCtxt};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE, CRATE_DEF_INDEX};
|
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE, CRATE_DEF_INDEX};
|
||||||
use rustc::hir::map::{DefKey, DefPath, DefPathHash};
|
use rustc::hir::map::{DefKey, DefPath, DefPathHash};
|
||||||
use rustc::hir::map::blocks::FnLikeNode;
|
use rustc::hir::map::blocks::FnLikeNode;
|
||||||
|
|
|
@ -16,7 +16,7 @@ use rustc::hir::def_id::DefId;
|
||||||
use rustc::hir::map::definitions::DefPathData;
|
use rustc::hir::map::definitions::DefPathData;
|
||||||
use rustc::infer::InferCtxt;
|
use rustc::infer::InferCtxt;
|
||||||
use rustc::ty::{self, ParamEnv, TyCtxt};
|
use rustc::ty::{self, ParamEnv, TyCtxt};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::lint::builtin::UNUSED_MUT;
|
use rustc::lint::builtin::UNUSED_MUT;
|
||||||
use rustc::mir::{AggregateKind, BasicBlock, BorrowCheckResult, BorrowKind};
|
use rustc::mir::{AggregateKind, BasicBlock, BorrowCheckResult, BorrowKind};
|
||||||
use rustc::mir::{ClearCrossCrate, Local, Location, Place, Mir, Mutability, Operand};
|
use rustc::mir::{ClearCrossCrate, Local, Location, Place, Mir, Mutability, Operand};
|
||||||
|
|
|
@ -8,7 +8,7 @@ use rustc::mir;
|
||||||
use rustc::ty::layout::{self, Size, Align, HasDataLayout, IntegerExt, LayoutOf, TyLayout};
|
use rustc::ty::layout::{self, Size, Align, HasDataLayout, IntegerExt, LayoutOf, TyLayout};
|
||||||
use rustc::ty::subst::{Subst, Substs};
|
use rustc::ty::subst::{Subst, Substs};
|
||||||
use rustc::ty::{self, Ty, TyCtxt, TypeAndMut};
|
use rustc::ty::{self, Ty, TyCtxt, TypeAndMut};
|
||||||
use rustc::ty::maps::TyCtxtAt;
|
use rustc::ty::query::TyCtxtAt;
|
||||||
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
|
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
|
||||||
use rustc::middle::const_val::FrameInfo;
|
use rustc::middle::const_val::FrameInfo;
|
||||||
use syntax::codemap::{self, Span};
|
use syntax::codemap::{self, Span};
|
||||||
|
|
|
@ -4,7 +4,7 @@ use std::ptr;
|
||||||
use rustc::hir::def_id::DefId;
|
use rustc::hir::def_id::DefId;
|
||||||
use rustc::ty::Instance;
|
use rustc::ty::Instance;
|
||||||
use rustc::ty::ParamEnv;
|
use rustc::ty::ParamEnv;
|
||||||
use rustc::ty::maps::TyCtxtAt;
|
use rustc::ty::query::TyCtxtAt;
|
||||||
use rustc::ty::layout::{self, Align, TargetDataLayout, Size};
|
use rustc::ty::layout::{self, Align, TargetDataLayout, Size};
|
||||||
use syntax::ast::Mutability;
|
use syntax::ast::Mutability;
|
||||||
use rustc::middle::const_val::ConstVal;
|
use rustc::middle::const_val::ConstVal;
|
||||||
|
|
|
@ -67,7 +67,7 @@ pub mod interpret;
|
||||||
pub mod monomorphize;
|
pub mod monomorphize;
|
||||||
|
|
||||||
pub use hair::pattern::check_crate as matchck_crate;
|
pub use hair::pattern::check_crate as matchck_crate;
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
|
|
||||||
pub fn provide(providers: &mut Providers) {
|
pub fn provide(providers: &mut Providers) {
|
||||||
borrow_check::provide(providers);
|
borrow_check::provide(providers);
|
||||||
|
|
|
@ -14,7 +14,7 @@ use rustc::infer;
|
||||||
use rustc::mir::*;
|
use rustc::mir::*;
|
||||||
use rustc::ty::{self, Ty, TyCtxt, GenericParamDefKind};
|
use rustc::ty::{self, Ty, TyCtxt, GenericParamDefKind};
|
||||||
use rustc::ty::subst::{Subst, Substs};
|
use rustc::ty::subst::{Subst, Substs};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
|
|
||||||
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
|
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_data_structures::indexed_vec::IndexVec;
|
use rustc_data_structures::indexed_vec::IndexVec;
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
|
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::ty::{self, TyCtxt};
|
use rustc::ty::{self, TyCtxt};
|
||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
use rustc::hir::def_id::DefId;
|
use rustc::hir::def_id::DefId;
|
||||||
|
|
|
@ -126,9 +126,8 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let callee_mir = match self.tcx.try_get_query::<ty::queries::optimized_mir>(
|
let callee_mir = match self.tcx.try_optimized_mir(callsite.location.span,
|
||||||
callsite.location.span,
|
callsite.callee) {
|
||||||
callsite.callee) {
|
|
||||||
Ok(callee_mir) if self.should_inline(callsite, callee_mir) => {
|
Ok(callee_mir) if self.should_inline(callsite, callee_mir) => {
|
||||||
self.tcx.subst_and_normalize_erasing_regions(
|
self.tcx.subst_and_normalize_erasing_regions(
|
||||||
&callsite.substs,
|
&callsite.substs,
|
||||||
|
|
|
@ -13,7 +13,7 @@ use build;
|
||||||
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||||
use rustc::mir::{Mir, Promoted};
|
use rustc::mir::{Mir, Promoted};
|
||||||
use rustc::ty::TyCtxt;
|
use rustc::ty::TyCtxt;
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::ty::steal::Steal;
|
use rustc::ty::steal::Steal;
|
||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
|
use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
|
||||||
|
|
|
@ -24,7 +24,7 @@ use rustc::middle::const_val::ConstVal;
|
||||||
use rustc::traits::{self, TraitEngine};
|
use rustc::traits::{self, TraitEngine};
|
||||||
use rustc::ty::{self, TyCtxt, Ty, TypeFoldable};
|
use rustc::ty::{self, TyCtxt, Ty, TypeFoldable};
|
||||||
use rustc::ty::cast::CastTy;
|
use rustc::ty::cast::CastTy;
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::mir::*;
|
use rustc::mir::*;
|
||||||
use rustc::mir::traversal::ReversePostorder;
|
use rustc::mir::traversal::ReversePostorder;
|
||||||
use rustc::mir::visit::{PlaceContext, Visitor};
|
use rustc::mir::visit::{PlaceContext, Visitor};
|
||||||
|
|
|
@ -32,7 +32,7 @@ extern crate syntax;
|
||||||
extern crate syntax_pos;
|
extern crate syntax_pos;
|
||||||
extern crate rustc_errors as errors;
|
extern crate rustc_errors as errors;
|
||||||
|
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
|
|
||||||
mod diagnostics;
|
mod diagnostics;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ use rustc::middle::expr_use_visitor as euv;
|
||||||
use rustc::middle::mem_categorization as mc;
|
use rustc::middle::mem_categorization as mc;
|
||||||
use rustc::middle::mem_categorization::Categorization;
|
use rustc::middle::mem_categorization::Categorization;
|
||||||
use rustc::ty::{self, Ty, TyCtxt};
|
use rustc::ty::{self, Ty, TyCtxt};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::ty::subst::Substs;
|
use rustc::ty::subst::Substs;
|
||||||
use rustc::util::nodemap::{ItemLocalSet, NodeSet};
|
use rustc::util::nodemap::{ItemLocalSet, NodeSet};
|
||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
|
|
|
@ -31,7 +31,7 @@ use rustc::lint;
|
||||||
use rustc::middle::privacy::{AccessLevel, AccessLevels};
|
use rustc::middle::privacy::{AccessLevel, AccessLevels};
|
||||||
use rustc::ty::{self, TyCtxt, Ty, TypeFoldable, GenericParamDefKind};
|
use rustc::ty::{self, TyCtxt, Ty, TypeFoldable, GenericParamDefKind};
|
||||||
use rustc::ty::fold::TypeVisitor;
|
use rustc::ty::fold::TypeVisitor;
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::ty::subst::UnpackedKind;
|
use rustc::ty::subst::UnpackedKind;
|
||||||
use rustc::util::nodemap::NodeSet;
|
use rustc::util::nodemap::NodeSet;
|
||||||
use syntax::ast::{self, CRATE_NODE_ID, Ident};
|
use syntax::ast::{self, CRATE_NODE_ID, Ident};
|
||||||
|
|
|
@ -36,7 +36,7 @@ mod normalize_erasing_regions;
|
||||||
mod util;
|
mod util;
|
||||||
pub mod lowering;
|
pub mod lowering;
|
||||||
|
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
|
|
||||||
pub fn provide(p: &mut Providers) {
|
pub fn provide(p: &mut Providers) {
|
||||||
*p = Providers {
|
*p = Providers {
|
||||||
|
|
|
@ -40,7 +40,7 @@ mod suggest;
|
||||||
|
|
||||||
use self::probe::{IsSuggestion, ProbeScope};
|
use self::probe::{IsSuggestion, ProbeScope};
|
||||||
|
|
||||||
pub fn provide(providers: &mut ty::maps::Providers) {
|
pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
suggest::provide(providers);
|
suggest::provide(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -741,7 +741,7 @@ fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec<DefId>
|
||||||
traits
|
traits
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut ty::maps::Providers) {
|
pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
providers.all_traits = |tcx, cnum| {
|
providers.all_traits = |tcx, cnum| {
|
||||||
assert_eq!(cnum, LOCAL_CRATE);
|
assert_eq!(cnum, LOCAL_CRATE);
|
||||||
Lrc::new(compute_all_traits(tcx))
|
Lrc::new(compute_all_traits(tcx))
|
||||||
|
|
|
@ -99,7 +99,7 @@ use rustc::traits::{self, ObligationCause, ObligationCauseCode, TraitEngine};
|
||||||
use rustc::ty::{self, Ty, TyCtxt, GenericParamDefKind, Visibility, ToPredicate, RegionKind};
|
use rustc::ty::{self, Ty, TyCtxt, GenericParamDefKind, Visibility, ToPredicate, RegionKind};
|
||||||
use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
|
use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
|
||||||
use rustc::ty::fold::TypeFoldable;
|
use rustc::ty::fold::TypeFoldable;
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::ty::util::{Representability, IntTypeExt, Discr};
|
use rustc::ty::util::{Representability, IntTypeExt, Discr};
|
||||||
use errors::{DiagnosticBuilder, DiagnosticId};
|
use errors::{DiagnosticBuilder, DiagnosticId};
|
||||||
|
|
||||||
|
@ -703,7 +703,7 @@ fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum
|
||||||
debug_assert!(crate_num == LOCAL_CRATE);
|
debug_assert!(crate_num == LOCAL_CRATE);
|
||||||
Ok(tcx.sess.track_errors(|| {
|
Ok(tcx.sess.track_errors(|| {
|
||||||
for body_owner_def_id in tcx.body_owners() {
|
for body_owner_def_id in tcx.body_owners() {
|
||||||
ty::maps::queries::typeck_tables_of::ensure(tcx, body_owner_def_id);
|
ty::query::queries::typeck_tables_of::ensure(tcx, body_owner_def_id);
|
||||||
}
|
}
|
||||||
})?)
|
})?)
|
||||||
}
|
}
|
||||||
|
|
|
@ -749,21 +749,21 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckTypeWellFormedVisitor<'a, 'tcx> {
|
||||||
fn visit_item(&mut self, i: &hir::Item) {
|
fn visit_item(&mut self, i: &hir::Item) {
|
||||||
debug!("visit_item: {:?}", i);
|
debug!("visit_item: {:?}", i);
|
||||||
let def_id = self.tcx.hir.local_def_id(i.id);
|
let def_id = self.tcx.hir.local_def_id(i.id);
|
||||||
ty::maps::queries::check_item_well_formed::ensure(self.tcx, def_id);
|
ty::query::queries::check_item_well_formed::ensure(self.tcx, def_id);
|
||||||
intravisit::walk_item(self, i);
|
intravisit::walk_item(self, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_trait_item(&mut self, trait_item: &'v hir::TraitItem) {
|
fn visit_trait_item(&mut self, trait_item: &'v hir::TraitItem) {
|
||||||
debug!("visit_trait_item: {:?}", trait_item);
|
debug!("visit_trait_item: {:?}", trait_item);
|
||||||
let def_id = self.tcx.hir.local_def_id(trait_item.id);
|
let def_id = self.tcx.hir.local_def_id(trait_item.id);
|
||||||
ty::maps::queries::check_trait_item_well_formed::ensure(self.tcx, def_id);
|
ty::query::queries::check_trait_item_well_formed::ensure(self.tcx, def_id);
|
||||||
intravisit::walk_trait_item(self, trait_item)
|
intravisit::walk_trait_item(self, trait_item)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_impl_item(&mut self, impl_item: &'v hir::ImplItem) {
|
fn visit_impl_item(&mut self, impl_item: &'v hir::ImplItem) {
|
||||||
debug!("visit_impl_item: {:?}", impl_item);
|
debug!("visit_impl_item: {:?}", impl_item);
|
||||||
let def_id = self.tcx.hir.local_def_id(impl_item.id);
|
let def_id = self.tcx.hir.local_def_id(impl_item.id);
|
||||||
ty::maps::queries::check_impl_item_well_formed::ensure(self.tcx, def_id);
|
ty::query::queries::check_impl_item_well_formed::ensure(self.tcx, def_id);
|
||||||
intravisit::walk_impl_item(self, impl_item)
|
intravisit::walk_impl_item(self, impl_item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
use hir::def_id::{DefId, LOCAL_CRATE};
|
use hir::def_id::{DefId, LOCAL_CRATE};
|
||||||
use rustc::traits;
|
use rustc::traits;
|
||||||
use rustc::ty::{self, TyCtxt, TypeFoldable};
|
use rustc::ty::{self, TyCtxt, TypeFoldable};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
|
|
||||||
|
@ -127,15 +127,15 @@ fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) {
|
||||||
|
|
||||||
pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
||||||
for &trait_def_id in tcx.hir.krate().trait_impls.keys() {
|
for &trait_def_id in tcx.hir.krate().trait_impls.keys() {
|
||||||
ty::maps::queries::coherent_trait::ensure(tcx, trait_def_id);
|
ty::query::queries::coherent_trait::ensure(tcx, trait_def_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafety::check(tcx);
|
unsafety::check(tcx);
|
||||||
orphan::check(tcx);
|
orphan::check(tcx);
|
||||||
|
|
||||||
// these queries are executed for side-effects (error reporting):
|
// these queries are executed for side-effects (error reporting):
|
||||||
ty::maps::queries::crate_inherent_impls::ensure(tcx, LOCAL_CRATE);
|
ty::query::queries::crate_inherent_impls::ensure(tcx, LOCAL_CRATE);
|
||||||
ty::maps::queries::crate_inherent_impls_overlap_check::ensure(tcx, LOCAL_CRATE);
|
ty::query::queries::crate_inherent_impls_overlap_check::ensure(tcx, LOCAL_CRATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Overlap: No two impls for the same trait are implemented for the
|
/// Overlap: No two impls for the same trait are implemented for the
|
||||||
|
|
|
@ -33,7 +33,7 @@ use rustc::mir::mono::Linkage;
|
||||||
use rustc::ty::subst::Substs;
|
use rustc::ty::subst::Substs;
|
||||||
use rustc::ty::{ToPredicate, ReprOptions};
|
use rustc::ty::{ToPredicate, ReprOptions};
|
||||||
use rustc::ty::{self, AdtKind, ToPolyTraitRef, Ty, TyCtxt};
|
use rustc::ty::{self, AdtKind, ToPolyTraitRef, Ty, TyCtxt};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::ty::util::IntTypeExt;
|
use rustc::ty::util::IntTypeExt;
|
||||||
use rustc::ty::util::Discr;
|
use rustc::ty::util::Discr;
|
||||||
use rustc::util::captures::Captures;
|
use rustc::util::captures::Captures;
|
||||||
|
|
|
@ -104,7 +104,7 @@ use hir::map as hir_map;
|
||||||
use rustc::infer::InferOk;
|
use rustc::infer::InferOk;
|
||||||
use rustc::ty::subst::Substs;
|
use rustc::ty::subst::Substs;
|
||||||
use rustc::ty::{self, Ty, TyCtxt};
|
use rustc::ty::{self, Ty, TyCtxt};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine};
|
use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine};
|
||||||
use session::{CompileIncomplete, config};
|
use session::{CompileIncomplete, config};
|
||||||
use util::common::time;
|
use util::common::time;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
use hir::map as hir_map;
|
use hir::map as hir_map;
|
||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::ty::subst::UnpackedKind;
|
use rustc::ty::subst::UnpackedKind;
|
||||||
use rustc::ty::{self, CratePredicatesMap, TyCtxt};
|
use rustc::ty::{self, CratePredicatesMap, TyCtxt};
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
|
|
|
@ -17,7 +17,7 @@ use arena;
|
||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||||
use rustc::ty::{self, CrateVariancesMap, TyCtxt};
|
use rustc::ty::{self, CrateVariancesMap, TyCtxt};
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
|
|
||||||
/// Defines the `TermsContext` basically houses an arena where we can
|
/// Defines the `TermsContext` basically houses an arena where we can
|
||||||
|
|
|
@ -20,7 +20,7 @@ use syntax::symbol::Symbol;
|
||||||
use rustc::session::{Session, CompileIncomplete};
|
use rustc::session::{Session, CompileIncomplete};
|
||||||
use rustc::session::config::OutputFilenames;
|
use rustc::session::config::OutputFilenames;
|
||||||
use rustc::ty::TyCtxt;
|
use rustc::ty::TyCtxt;
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::middle::cstore::MetadataLoader;
|
use rustc::middle::cstore::MetadataLoader;
|
||||||
use rustc::dep_graph::DepGraph;
|
use rustc::dep_graph::DepGraph;
|
||||||
use rustc_codegen_utils::codegen_backend::{CodegenBackend, MetadataOnlyCodegenBackend};
|
use rustc_codegen_utils::codegen_backend::{CodegenBackend, MetadataOnlyCodegenBackend};
|
||||||
|
|
Loading…
Reference in New Issue