]> git.lizzy.rs Git - rust.git/blob - src/librustc/ty/query/mod.rs
Rollup merge of #59680 - DevQps:document-rustc-z-flag, r=cramertj
[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::{Def, 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};
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 use crate::session::Session;
45
46 use rustc_data_structures::svh::Svh;
47 use rustc_data_structures::bit_set::BitSet;
48 use rustc_data_structures::indexed_vec::IndexVec;
49 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
50 use rustc_data_structures::stable_hasher::StableVec;
51 use rustc_data_structures::sync::Lrc;
52 use rustc_data_structures::fingerprint::Fingerprint;
53 use rustc_target::spec::PanicStrategy;
54
55 use std::borrow::Cow;
56 use std::ops::Deref;
57 use std::sync::Arc;
58 use std::intrinsics::type_name;
59 use syntax_pos::{Span, DUMMY_SP};
60 use syntax_pos::symbol::InternedString;
61 use syntax::attr;
62 use syntax::ast;
63 use syntax::feature_gate;
64 use syntax::symbol::Symbol;
65
66 #[macro_use]
67 mod plumbing;
68 use self::plumbing::*;
69 pub use self::plumbing::{force_from_dep_node, CycleError};
70
71 mod job;
72 pub use self::job::{QueryJob, QueryInfo};
73 #[cfg(parallel_compiler)]
74 pub use self::job::handle_deadlock;
75
76 mod keys;
77 use self::keys::Key;
78
79 mod values;
80 use self::values::Value;
81
82 mod config;
83 pub(crate) use self::config::QueryDescription;
84 pub use self::config::QueryConfig;
85 use self::config::QueryAccessors;
86
87 mod on_disk_cache;
88 pub use self::on_disk_cache::OnDiskCache;
89
90 // Each of these queries corresponds to a function pointer field in the
91 // `Providers` struct for requesting a value of that type, and a method
92 // on `tcx: TyCtxt` (and `tcx.at(span)`) for doing that request in a way
93 // which memoizes and does dep-graph tracking, wrapping around the actual
94 // `Providers` that the driver creates (using several `rustc_*` crates).
95 //
96 // The result type of each query must implement `Clone`, and additionally
97 // `ty::query::values::Value`, which produces an appropriate placeholder
98 // (error) value if the query resulted in a query cycle.
99 // Queries marked with `fatal_cycle` do not need the latter implementation,
100 // as they will raise an fatal error on query cycles instead.
101
102 rustc_query_append! { [define_queries!][ <'tcx>
103     Other {
104         /// Run analysis passes on the crate
105         [] fn analysis: Analysis(CrateNum) -> Result<(), ErrorReported>,
106
107     },
108 ]}