1
Fork 0
rust/src/librustc/ty/query/mod.rs

102 lines
3.9 KiB
Rust
Raw Normal View History

use crate::dep_graph::{self, DepNode};
use crate::hir::exports::Export;
2019-02-05 11:20:45 -06:00
use crate::infer::canonical::{self, Canonical};
use crate::lint;
use crate::middle::codegen_fn_attrs::CodegenFnAttrs;
2019-12-22 17:42:04 -05:00
use crate::middle::cstore::{CrateSource, DepKind, NativeLibraryKind};
use crate::middle::cstore::{ExternCrate, ForeignModule, LinkagePreference, NativeLibrary};
use crate::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
use crate::middle::lang_items::{LangItem, LanguageItems};
use crate::middle::lib_features::LibFeatures;
2019-02-05 11:20:45 -06:00
use crate::middle::privacy::AccessLevels;
use crate::middle::region;
2019-12-22 17:42:04 -05:00
use crate::middle::resolve_lifetime::{ObjectLifetimeDefault, Region, ResolveLifetimes};
2019-02-05 11:20:45 -06:00
use crate::middle::stability::{self, DeprecationEntry};
use crate::mir;
use crate::mir::interpret::GlobalId;
2019-12-22 17:42:04 -05:00
use crate::mir::interpret::{ConstEvalRawResult, ConstEvalResult};
use crate::mir::mono::CodegenUnit;
use crate::session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion};
use crate::session::CrateDisambiguator;
2019-12-22 17:42:04 -05:00
use crate::traits::query::dropck_outlives::{DropckOutlivesResult, DtorckConstraint};
2019-02-05 11:20:45 -06:00
use crate::traits::query::method_autoderef::MethodAutoderefStepsResult;
use crate::traits::query::normalize::NormalizationResult;
use crate::traits::query::outlives_bounds::OutlivesBound;
2019-12-22 17:42:04 -05:00
use crate::traits::query::{
CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal,
CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpEqGoal, CanonicalTypeOpNormalizeGoal,
CanonicalTypeOpProvePredicateGoal, CanonicalTypeOpSubtypeGoal, NoSolution,
};
2019-02-05 11:20:45 -06:00
use crate::traits::specialization_graph;
use crate::traits::Clauses;
2019-12-22 17:42:04 -05:00
use crate::traits::{self, Vtable};
2019-02-05 11:20:45 -06:00
use crate::ty::steal::Steal;
2019-02-09 22:11:53 +08:00
use crate::ty::subst::SubstsRef;
2019-12-22 17:42:04 -05:00
use crate::ty::util::NeedsDrop;
use crate::ty::{self, AdtSizedConstraint, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt};
use crate::util::common::ErrorReported;
2019-12-22 17:42:04 -05:00
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
use rustc_data_structures::profiling::ProfileCategory::*;
use rustc_data_structures::stable_hasher::StableVec;
2019-12-22 17:42:04 -05:00
use rustc_data_structures::svh::Svh;
Merge indexed_set.rs into bitvec.rs, and rename it bit_set.rs. Currently we have two files implementing bitsets (and 2D bit matrices). This commit combines them into one, taking the best features from each. This involves renaming a lot of things. The high level changes are as follows. - bitvec.rs --> bit_set.rs - indexed_set.rs --> (removed) - BitArray + IdxSet --> BitSet (merged, see below) - BitVector --> GrowableBitSet - {,Sparse,Hybrid}IdxSet --> {,Sparse,Hybrid}BitSet - BitMatrix --> BitMatrix - SparseBitMatrix --> SparseBitMatrix The changes within the bitset types themselves are as follows. ``` OLD OLD NEW BitArray<C> IdxSet<T> BitSet<T> -------- ------ ------ grow - grow new - (remove) new_empty new_empty new_empty new_filled new_filled new_filled - to_hybrid to_hybrid clear clear clear set_up_to set_up_to set_up_to clear_above - clear_above count - count contains(T) contains(&T) contains(T) contains_all - superset is_empty - is_empty insert(T) add(&T) insert(T) insert_all - insert_all() remove(T) remove(&T) remove(T) words words words words_mut words_mut words_mut - overwrite overwrite merge union union - subtract subtract - intersect intersect iter iter iter ``` In general, when choosing names I went with: - names that are more obvious (e.g. `BitSet` over `IdxSet`). - names that are more like the Rust libraries (e.g. `T` over `C`, `insert` over `add`); - names that are more set-like (e.g. `union` over `merge`, `superset` over `contains_all`, `domain_size` over `num_bits`). Also, using `T` for index arguments seems more sensible than `&T` -- even though the latter is standard in Rust collection types -- because indices are always copyable. It also results in fewer `&` and `*` sigils in practice.
2018-09-14 15:07:25 +10:00
use rustc_data_structures::sync::Lrc;
use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex};
use rustc_hir::{HirIdSet, ItemLocalId, TraitCandidate};
2019-12-22 17:42:04 -05:00
use rustc_index::vec::IndexVec;
Merge indexed_set.rs into bitvec.rs, and rename it bit_set.rs. Currently we have two files implementing bitsets (and 2D bit matrices). This commit combines them into one, taking the best features from each. This involves renaming a lot of things. The high level changes are as follows. - bitvec.rs --> bit_set.rs - indexed_set.rs --> (removed) - BitArray + IdxSet --> BitSet (merged, see below) - BitVector --> GrowableBitSet - {,Sparse,Hybrid}IdxSet --> {,Sparse,Hybrid}BitSet - BitMatrix --> BitMatrix - SparseBitMatrix --> SparseBitMatrix The changes within the bitset types themselves are as follows. ``` OLD OLD NEW BitArray<C> IdxSet<T> BitSet<T> -------- ------ ------ grow - grow new - (remove) new_empty new_empty new_empty new_filled new_filled new_filled - to_hybrid to_hybrid clear clear clear set_up_to set_up_to set_up_to clear_above - clear_above count - count contains(T) contains(&T) contains(T) contains_all - superset is_empty - is_empty insert(T) add(&T) insert(T) insert_all - insert_all() remove(T) remove(&T) remove(T) words words words words_mut words_mut words_mut - overwrite overwrite merge union union - subtract subtract - intersect intersect iter iter iter ``` In general, when choosing names I went with: - names that are more obvious (e.g. `BitSet` over `IdxSet`). - names that are more like the Rust libraries (e.g. `T` over `C`, `insert` over `add`); - names that are more set-like (e.g. `union` over `merge`, `superset` over `contains_all`, `domain_size` over `num_bits`). Also, using `T` for index arguments seems more sensible than `&T` -- even though the latter is standard in Rust collection types -- because indices are always copyable. It also results in fewer `&` and `*` sigils in practice.
2018-09-14 15:07:25 +10:00
use rustc_target::spec::PanicStrategy;
2020-01-01 19:30:57 +01:00
use rustc_span::symbol::Symbol;
use rustc_span::{Span, DUMMY_SP};
2019-12-22 17:42:04 -05:00
use std::any::type_name;
use std::borrow::Cow;
use std::ops::Deref;
use std::sync::Arc;
2017-05-03 08:40:32 -05:00
use syntax::ast;
2019-12-22 17:42:04 -05:00
use syntax::attr;
2017-09-18 05:40:13 -04:00
#[macro_use]
mod plumbing;
use self::plumbing::*;
pub use self::plumbing::{force_from_dep_node, CycleError};
mod job;
#[cfg(parallel_compiler)]
pub use self::job::handle_deadlock;
2019-12-22 17:42:04 -05:00
pub use self::job::{QueryInfo, QueryJob};
2017-09-18 05:40:13 -04:00
mod keys;
2018-06-13 16:44:43 +03:00
use self::keys::Key;
2017-09-18 05:40:13 -04:00
mod values;
use self::values::Value;
2017-09-18 05:40:13 -04:00
mod config;
2018-12-03 01:14:35 +01:00
use self::config::QueryAccessors;
2019-12-22 17:42:04 -05:00
pub use self::config::QueryConfig;
pub(crate) use self::config::QueryDescription;
mod on_disk_cache;
pub use self::on_disk_cache::OnDiskCache;
2018-12-03 01:14:35 +01:00
// Each of these queries corresponds to a function pointer field in the
2018-06-13 16:44:43 +03:00
// `Providers` struct for requesting a value of that type, and a method
// on `tcx: TyCtxt` (and `tcx.at(span)`) for doing that request in a way
// which memoizes and does dep-graph tracking, wrapping around the actual
// `Providers` that the driver creates (using several `rustc_*` crates).
//
2018-06-13 16:44:43 +03:00
// The result type of each query must implement `Clone`, and additionally
// `ty::query::values::Value`, which produces an appropriate placeholder
// (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.
2018-12-03 01:14:35 +01:00
rustc_query_append! { [define_queries!][ <'tcx>
Other {
/// Runs analysis passes on the crate.
[eval_always] fn analysis: Analysis(CrateNum) -> Result<(), ErrorReported>,
},
2018-12-03 01:14:35 +01:00
]}