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