]> git.lizzy.rs Git - rust.git/blob - src/librustc/ty/query/mod.rs
Auto merge of #61765 - Keruspe:rustbuild-cxx, r=alexcrichton
[rust.git] / src / librustc / ty / query / mod.rs
1 use crate::dep_graph::{self, DepNode};
2 use crate::hir::def_id::{CrateNum, DefId, DefIndex};
3 use crate::hir::def::{DefKind, Export};
4 use crate::hir::{self, TraitCandidate, ItemLocalId, CodegenFnAttrs};
5 use crate::infer::canonical::{self, Canonical};
6 use crate::lint;
7 use crate::middle::borrowck::BorrowCheckResult;
8 use crate::middle::cstore::{ExternCrate, LinkagePreference, NativeLibrary, ForeignModule};
9 use crate::middle::cstore::{NativeLibraryKind, DepKind, CrateSource};
10 use crate::middle::privacy::AccessLevels;
11 use crate::middle::reachable::ReachableSet;
12 use crate::middle::region;
13 use crate::middle::resolve_lifetime::{ResolveLifetimes, Region, ObjectLifetimeDefault};
14 use crate::middle::stability::{self, DeprecationEntry};
15 use crate::middle::lib_features::LibFeatures;
16 use crate::middle::lang_items::{LanguageItems, LangItem};
17 use crate::middle::exported_symbols::{SymbolExportLevel, ExportedSymbol};
18 use crate::mir::interpret::{ConstEvalRawResult, ConstEvalResult};
19 use crate::mir::mono::CodegenUnit;
20 use crate::mir;
21 use crate::mir::interpret::GlobalId;
22 use crate::session::CrateDisambiguator;
23 use crate::session::config::{EntryFnType, OutputFilenames, OptLevel, SymbolManglingVersion};
24 use crate::traits::{self, Vtable};
25 use crate::traits::query::{
26     CanonicalPredicateGoal, CanonicalProjectionGoal,
27     CanonicalTyGoal, CanonicalTypeOpAscribeUserTypeGoal,
28     CanonicalTypeOpEqGoal, CanonicalTypeOpSubtypeGoal, CanonicalTypeOpProvePredicateGoal,
29     CanonicalTypeOpNormalizeGoal, NoSolution,
30 };
31 use crate::traits::query::method_autoderef::MethodAutoderefStepsResult;
32 use crate::traits::query::dropck_outlives::{DtorckConstraint, DropckOutlivesResult};
33 use crate::traits::query::normalize::NormalizationResult;
34 use crate::traits::query::outlives_bounds::OutlivesBound;
35 use crate::traits::specialization_graph;
36 use crate::traits::Clauses;
37 use crate::ty::{self, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt, AdtSizedConstraint};
38 use crate::ty::steal::Steal;
39 use crate::ty::util::NeedsDrop;
40 use crate::ty::subst::SubstsRef;
41 use crate::util::nodemap::{DefIdSet, DefIdMap, ItemLocalSet};
42 use crate::util::common::{ErrorReported};
43 use crate::util::profiling::ProfileCategory::*;
44
45 use rustc_data_structures::svh::Svh;
46 use rustc_data_structures::bit_set::BitSet;
47 use rustc_data_structures::indexed_vec::IndexVec;
48 use rustc_data_structures::fx::{FxIndexMap, FxHashMap, FxHashSet};
49 use rustc_data_structures::stable_hasher::StableVec;
50 use rustc_data_structures::sync::Lrc;
51 use rustc_data_structures::fingerprint::Fingerprint;
52 use rustc_target::spec::PanicStrategy;
53
54 use std::borrow::Cow;
55 use std::ops::Deref;
56 use std::sync::Arc;
57 use std::intrinsics::type_name;
58 use syntax_pos::{Span, DUMMY_SP};
59 use syntax_pos::symbol::InternedString;
60 use syntax::attr;
61 use syntax::ast;
62 use syntax::feature_gate;
63 use syntax::symbol::Symbol;
64
65 #[macro_use]
66 mod plumbing;
67 use self::plumbing::*;
68 pub use self::plumbing::{force_from_dep_node, CycleError};
69
70 mod job;
71 pub use self::job::{QueryJob, QueryInfo};
72 #[cfg(parallel_compiler)]
73 pub use self::job::handle_deadlock;
74
75 mod keys;
76 use self::keys::Key;
77
78 mod values;
79 use self::values::Value;
80
81 mod config;
82 pub(crate) use self::config::QueryDescription;
83 pub use self::config::QueryConfig;
84 use self::config::QueryAccessors;
85
86 mod on_disk_cache;
87 pub use self::on_disk_cache::OnDiskCache;
88
89 // Each of these queries corresponds to a function pointer field in the
90 // `Providers` struct for requesting a value of that type, and a method
91 // on `tcx: TyCtxt` (and `tcx.at(span)`) for doing that request in a way
92 // which memoizes and does dep-graph tracking, wrapping around the actual
93 // `Providers` that the driver creates (using several `rustc_*` crates).
94 //
95 // The result type of each query must implement `Clone`, and additionally
96 // `ty::query::values::Value`, which produces an appropriate placeholder
97 // (error) value if the query resulted in a query cycle.
98 // Queries marked with `fatal_cycle` do not need the latter implementation,
99 // as they will raise an fatal error on query cycles instead.
100
101 rustc_query_append! { [define_queries!][ <'tcx>
102     Other {
103         /// Runs analysis passes on the crate.
104         [] fn analysis: Analysis(CrateNum) -> Result<(), ErrorReported>,
105     },
106 ]}