]> git.proxmox.com Git - rustc.git/blob - src/librustc/ty/maps/mod.rs
New upstream version 1.27.2+dfsg1
[rustc.git] / src / librustc / ty / maps / mod.rs
1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 use dep_graph::{DepConstructor, DepNode};
12 use hir::def_id::{CrateNum, DefId, DefIndex};
13 use hir::def::{Def, Export};
14 use hir::{self, TraitCandidate, ItemLocalId, TransFnAttrs};
15 use hir::svh::Svh;
16 use infer::canonical::{self, Canonical};
17 use lint;
18 use middle::borrowck::BorrowCheckResult;
19 use middle::cstore::{ExternCrate, LinkagePreference, NativeLibrary, ForeignModule};
20 use middle::cstore::{NativeLibraryKind, DepKind, CrateSource};
21 use middle::privacy::AccessLevels;
22 use middle::reachable::ReachableSet;
23 use middle::region;
24 use middle::resolve_lifetime::{ResolveLifetimes, Region, ObjectLifetimeDefault};
25 use middle::stability::{self, DeprecationEntry};
26 use middle::lang_items::{LanguageItems, LangItem};
27 use middle::exported_symbols::{SymbolExportLevel, ExportedSymbol};
28 use middle::const_val::EvalResult;
29 use mir::mono::{CodegenUnit, Stats};
30 use mir;
31 use mir::interpret::{GlobalId};
32 use session::{CompileResult, CrateDisambiguator};
33 use session::config::OutputFilenames;
34 use traits::{self, Vtable};
35 use traits::query::{CanonicalPredicateGoal, CanonicalProjectionGoal,
36 CanonicalTyGoal, NoSolution};
37 use traits::query::dropck_outlives::{DtorckConstraint, DropckOutlivesResult};
38 use traits::query::normalize::NormalizationResult;
39 use traits::specialization_graph;
40 use traits::Clauses;
41 use ty::{self, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt};
42 use ty::steal::Steal;
43 use ty::subst::Substs;
44 use util::nodemap::{DefIdSet, DefIdMap, ItemLocalSet};
45 use util::common::{ErrorReported};
46
47 use rustc_data_structures::indexed_set::IdxSetBuf;
48 use rustc_target::spec::PanicStrategy;
49 use rustc_data_structures::indexed_vec::IndexVec;
50 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
51 use rustc_data_structures::stable_hasher::StableVec;
52
53 use std::ops::Deref;
54 use rustc_data_structures::sync::Lrc;
55 use std::sync::Arc;
56 use syntax_pos::{Span, DUMMY_SP};
57 use syntax_pos::symbol::InternedString;
58 use syntax::attr;
59 use syntax::ast;
60 use syntax::feature_gate;
61 use syntax::symbol::Symbol;
62
63 #[macro_use]
64 mod plumbing;
65 use self::plumbing::*;
66 pub use self::plumbing::force_from_dep_node;
67
68 mod job;
69 pub use self::job::{QueryJob, QueryInfo};
70
71 mod keys;
72 pub use self::keys::Key;
73
74 mod values;
75 use self::values::Value;
76
77 mod config;
78 pub use self::config::QueryConfig;
79 use self::config::QueryDescription;
80
81 mod on_disk_cache;
82 pub use self::on_disk_cache::OnDiskCache;
83
84 // Each of these maps also corresponds to a method on a
85 // `Provider` trait for requesting a value of that type,
86 // and a method on `Maps` itself for doing that in a
87 // a way that memoizes and does dep-graph tracking,
88 // wrapping around the actual chain of providers that
89 // the driver creates (using several `rustc_*` crates).
90 //
91 // The result of query must implement Clone. They must also implement ty::maps::values::Value
92 // which produces an appropriate error value if the query resulted in a query cycle.
93 // Queries marked with `fatal_cycle` do not need that implementation
94 // as they will raise an fatal error on query cycles instead.
95 define_maps! { <'tcx>
96 /// Records the type of every item.
97 [] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>,
98
99 /// Maps from the def-id of an item (trait/struct/enum/fn) to its
100 /// associated generics and predicates.
101 [] fn generics_of: GenericsOfItem(DefId) -> &'tcx ty::Generics,
102 [] fn predicates_of: PredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
103 [] fn explicit_predicates_of: PredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
104
105 /// Maps from the def-id of a trait to the list of
106 /// super-predicates. This is a subset of the full list of
107 /// predicates. We store these in a separate map because we must
108 /// evaluate them even during type conversion, often before the
109 /// full predicates are available (note that supertraits have
110 /// additional acyclicity requirements).
111 [] fn super_predicates_of: SuperPredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
112
113 /// To avoid cycles within the predicates of a single item we compute
114 /// per-type-parameter predicates for resolving `T::AssocTy`.
115 [] fn type_param_predicates: type_param_predicates((DefId, DefId))
116 -> ty::GenericPredicates<'tcx>,
117
118 [] fn trait_def: TraitDefOfItem(DefId) -> &'tcx ty::TraitDef,
119 [] fn adt_def: AdtDefOfItem(DefId) -> &'tcx ty::AdtDef,
120 [] fn adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
121 [] fn adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
122 [] fn adt_dtorck_constraint: DtorckConstraint(
123 DefId
124 ) -> Result<DtorckConstraint<'tcx>, NoSolution>,
125
126 /// True if this is a const fn
127 [] fn is_const_fn: IsConstFn(DefId) -> bool,
128
129 /// True if this is a foreign item (i.e., linked via `extern { ... }`).
130 [] fn is_foreign_item: IsForeignItem(DefId) -> bool,
131
132 /// Get a map with the variance of every item; use `item_variance`
133 /// instead.
134 [] fn crate_variances: crate_variances(CrateNum) -> Lrc<ty::CrateVariancesMap>,
135
136 /// Maps from def-id of a type or region parameter to its
137 /// (inferred) variance.
138 [] fn variances_of: ItemVariances(DefId) -> Lrc<Vec<ty::Variance>>,
139
140 /// Maps from def-id of a type to its (inferred) outlives.
141 [] fn inferred_outlives_of: InferredOutlivesOf(DefId) -> Lrc<Vec<ty::Predicate<'tcx>>>,
142
143 /// Maps from def-id of a type to its (inferred) outlives.
144 [] fn inferred_outlives_crate: InferredOutlivesCrate(CrateNum)
145 -> Lrc<ty::CratePredicatesMap<'tcx>>,
146
147 /// Maps from an impl/trait def-id to a list of the def-ids of its items
148 [] fn associated_item_def_ids: AssociatedItemDefIds(DefId) -> Lrc<Vec<DefId>>,
149
150 /// Maps from a trait item to the trait item "descriptor"
151 [] fn associated_item: AssociatedItems(DefId) -> ty::AssociatedItem,
152
153 [] fn impl_trait_ref: ImplTraitRef(DefId) -> Option<ty::TraitRef<'tcx>>,
154 [] fn impl_polarity: ImplPolarity(DefId) -> hir::ImplPolarity,
155
156 /// Maps a DefId of a type to a list of its inherent impls.
157 /// Contains implementations of methods that are inherent to a type.
158 /// Methods in these implementations don't need to be exported.
159 [] fn inherent_impls: InherentImpls(DefId) -> Lrc<Vec<DefId>>,
160
161 /// Set of all the def-ids in this crate that have MIR associated with
162 /// them. This includes all the body owners, but also things like struct
163 /// constructors.
164 [] fn mir_keys: mir_keys(CrateNum) -> Lrc<DefIdSet>,
165
166 /// Maps DefId's that have an associated Mir to the result
167 /// of the MIR qualify_consts pass. The actual meaning of
168 /// the value isn't known except to the pass itself.
169 [] fn mir_const_qualif: MirConstQualif(DefId) -> (u8, Lrc<IdxSetBuf<mir::Local>>),
170
171 /// Fetch the MIR for a given def-id right after it's built - this includes
172 /// unreachable code.
173 [] fn mir_built: MirBuilt(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
174
175 /// Fetch the MIR for a given def-id up till the point where it is
176 /// ready for const evaluation.
177 ///
178 /// See the README for the `mir` module for details.
179 [] fn mir_const: MirConst(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
180
181 [] fn mir_validated: MirValidated(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
182
183 /// MIR after our optimization passes have run. This is MIR that is ready
184 /// for trans. This is also the only query that can fetch non-local MIR, at present.
185 [] fn optimized_mir: MirOptimized(DefId) -> &'tcx mir::Mir<'tcx>,
186
187 /// The result of unsafety-checking this def-id.
188 [] fn unsafety_check_result: UnsafetyCheckResult(DefId) -> mir::UnsafetyCheckResult,
189
190 /// HACK: when evaluated, this reports a "unsafe derive on repr(packed)" error
191 [] fn unsafe_derive_on_repr_packed: UnsafeDeriveOnReprPacked(DefId) -> (),
192
193 /// The signature of functions and closures.
194 [] fn fn_sig: FnSignature(DefId) -> ty::PolyFnSig<'tcx>,
195
196 /// Caches CoerceUnsized kinds for impls on custom types.
197 [] fn coerce_unsized_info: CoerceUnsizedInfo(DefId)
198 -> ty::adjustment::CoerceUnsizedInfo,
199
200 [] fn typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult,
201
202 [] fn typeck_tables_of: TypeckTables(DefId) -> &'tcx ty::TypeckTables<'tcx>,
203
204 [] fn used_trait_imports: UsedTraitImports(DefId) -> Lrc<DefIdSet>,
205
206 [] fn has_typeck_tables: HasTypeckTables(DefId) -> bool,
207
208 [] fn coherent_trait: CoherenceCheckTrait(DefId) -> (),
209
210 [] fn borrowck: BorrowCheck(DefId) -> Lrc<BorrowCheckResult>,
211
212 /// Borrow checks the function body. If this is a closure, returns
213 /// additional requirements that the closure's creator must verify.
214 [] fn mir_borrowck: MirBorrowCheck(DefId) -> mir::BorrowCheckResult<'tcx>,
215
216 /// Gets a complete map from all types to their inherent impls.
217 /// Not meant to be used directly outside of coherence.
218 /// (Defined only for LOCAL_CRATE)
219 [] fn crate_inherent_impls: crate_inherent_impls_dep_node(CrateNum) -> CrateInherentImpls,
220
221 /// Checks all types in the krate for overlap in their inherent impls. Reports errors.
222 /// Not meant to be used directly outside of coherence.
223 /// (Defined only for LOCAL_CRATE)
224 [] fn crate_inherent_impls_overlap_check: inherent_impls_overlap_check_dep_node(CrateNum) -> (),
225
226 /// Results of evaluating const items or constants embedded in
227 /// other items (such as enum variant explicit discriminants).
228 [] fn const_eval: const_eval_dep_node(ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
229 -> EvalResult<'tcx>,
230
231 [] fn check_match: CheckMatch(DefId)
232 -> Result<(), ErrorReported>,
233
234 /// Performs the privacy check and computes "access levels".
235 [] fn privacy_access_levels: PrivacyAccessLevels(CrateNum) -> Lrc<AccessLevels>,
236
237 [] fn reachable_set: reachability_dep_node(CrateNum) -> ReachableSet,
238
239 /// Per-body `region::ScopeTree`. The `DefId` should be the owner-def-id for the body;
240 /// in the case of closures, this will be redirected to the enclosing function.
241 [] fn region_scope_tree: RegionScopeTree(DefId) -> Lrc<region::ScopeTree>,
242
243 [] fn mir_shims: mir_shim_dep_node(ty::InstanceDef<'tcx>) -> &'tcx mir::Mir<'tcx>,
244
245 [] fn def_symbol_name: SymbolName(DefId) -> ty::SymbolName,
246 [] fn symbol_name: symbol_name_dep_node(ty::Instance<'tcx>) -> ty::SymbolName,
247
248 [] fn describe_def: DescribeDef(DefId) -> Option<Def>,
249 [] fn def_span: DefSpan(DefId) -> Span,
250 [] fn lookup_stability: LookupStability(DefId) -> Option<&'tcx attr::Stability>,
251 [] fn lookup_deprecation_entry: LookupDeprecationEntry(DefId) -> Option<DeprecationEntry>,
252 [] fn item_attrs: ItemAttrs(DefId) -> Lrc<[ast::Attribute]>,
253 [] fn trans_fn_attrs: trans_fn_attrs(DefId) -> TransFnAttrs,
254 [] fn fn_arg_names: FnArgNames(DefId) -> Vec<ast::Name>,
255 /// Gets the rendered value of the specified constant or associated constant.
256 /// Used by rustdoc.
257 [] fn rendered_const: RenderedConst(DefId) -> String,
258 [] fn impl_parent: ImplParent(DefId) -> Option<DefId>,
259 [] fn trait_of_item: TraitOfItem(DefId) -> Option<DefId>,
260 [] fn const_is_rvalue_promotable_to_static: ConstIsRvaluePromotableToStatic(DefId) -> bool,
261 [] fn rvalue_promotable_map: RvaluePromotableMap(DefId) -> Lrc<ItemLocalSet>,
262 [] fn is_mir_available: IsMirAvailable(DefId) -> bool,
263 [] fn vtable_methods: vtable_methods_node(ty::PolyTraitRef<'tcx>)
264 -> Lrc<Vec<Option<(DefId, &'tcx Substs<'tcx>)>>>,
265
266 [] fn trans_fulfill_obligation: fulfill_obligation_dep_node(
267 (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> Vtable<'tcx, ()>,
268 [] fn trait_impls_of: TraitImpls(DefId) -> Lrc<ty::trait_def::TraitImpls>,
269 [] fn specialization_graph_of: SpecializationGraph(DefId) -> Lrc<specialization_graph::Graph>,
270 [] fn is_object_safe: ObjectSafety(DefId) -> bool,
271
272 // Get the ParameterEnvironment for a given item; this environment
273 // will be in "user-facing" mode, meaning that it is suitabe for
274 // type-checking etc, and it does not normalize specializable
275 // associated types. This is almost always what you want,
276 // unless you are doing MIR optimizations, in which case you
277 // might want to use `reveal_all()` method to change modes.
278 [] fn param_env: ParamEnv(DefId) -> ty::ParamEnv<'tcx>,
279
280 // Trait selection queries. These are best used by invoking `ty.moves_by_default()`,
281 // `ty.is_copy()`, etc, since that will prune the environment where possible.
282 [] fn is_copy_raw: is_copy_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
283 [] fn is_sized_raw: is_sized_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
284 [] fn is_freeze_raw: is_freeze_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
285 [] fn needs_drop_raw: needs_drop_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
286 [] fn layout_raw: layout_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
287 -> Result<&'tcx ty::layout::LayoutDetails,
288 ty::layout::LayoutError<'tcx>>,
289
290 [] fn dylib_dependency_formats: DylibDepFormats(CrateNum)
291 -> Lrc<Vec<(CrateNum, LinkagePreference)>>,
292
293 [fatal_cycle] fn is_panic_runtime: IsPanicRuntime(CrateNum) -> bool,
294 [fatal_cycle] fn is_compiler_builtins: IsCompilerBuiltins(CrateNum) -> bool,
295 [fatal_cycle] fn has_global_allocator: HasGlobalAllocator(CrateNum) -> bool,
296 [fatal_cycle] fn is_sanitizer_runtime: IsSanitizerRuntime(CrateNum) -> bool,
297 [fatal_cycle] fn is_profiler_runtime: IsProfilerRuntime(CrateNum) -> bool,
298 [fatal_cycle] fn panic_strategy: GetPanicStrategy(CrateNum) -> PanicStrategy,
299 [fatal_cycle] fn is_no_builtins: IsNoBuiltins(CrateNum) -> bool,
300
301 [] fn extern_crate: ExternCrate(DefId) -> Lrc<Option<ExternCrate>>,
302
303 [] fn specializes: specializes_node((DefId, DefId)) -> bool,
304 [] fn in_scope_traits_map: InScopeTraits(DefIndex)
305 -> Option<Lrc<FxHashMap<ItemLocalId, Lrc<StableVec<TraitCandidate>>>>>,
306 [] fn module_exports: ModuleExports(DefId) -> Option<Lrc<Vec<Export>>>,
307 [] fn lint_levels: lint_levels_node(CrateNum) -> Lrc<lint::LintLevelMap>,
308
309 [] fn impl_defaultness: ImplDefaultness(DefId) -> hir::Defaultness,
310
311 [] fn check_item_well_formed: CheckItemWellFormed(DefId) -> (),
312 [] fn check_trait_item_well_formed: CheckTraitItemWellFormed(DefId) -> (),
313 [] fn check_impl_item_well_formed: CheckImplItemWellFormed(DefId) -> (),
314
315 // The DefIds of all non-generic functions and statics in the given crate
316 // that can be reached from outside the crate.
317 //
318 // We expect this items to be available for being linked to.
319 //
320 // This query can also be called for LOCAL_CRATE. In this case it will
321 // compute which items will be reachable to other crates, taking into account
322 // the kind of crate that is currently compiled. Crates with only a
323 // C interface have fewer reachable things.
324 //
325 // Does not include external symbols that don't have a corresponding DefId,
326 // like the compiler-generated `main` function and so on.
327 [] fn reachable_non_generics: ReachableNonGenerics(CrateNum)
328 -> Lrc<DefIdMap<SymbolExportLevel>>,
329 [] fn is_reachable_non_generic: IsReachableNonGeneric(DefId) -> bool,
330 [] fn is_unreachable_local_definition: IsUnreachableLocalDefinition(DefId) -> bool,
331
332 [] fn upstream_monomorphizations: UpstreamMonomorphizations(CrateNum)
333 -> Lrc<DefIdMap<Lrc<FxHashMap<&'tcx Substs<'tcx>, CrateNum>>>>,
334 [] fn upstream_monomorphizations_for: UpstreamMonomorphizationsFor(DefId)
335 -> Option<Lrc<FxHashMap<&'tcx Substs<'tcx>, CrateNum>>>,
336
337 [] fn native_libraries: NativeLibraries(CrateNum) -> Lrc<Vec<NativeLibrary>>,
338
339 [] fn foreign_modules: ForeignModules(CrateNum) -> Lrc<Vec<ForeignModule>>,
340
341 [] fn plugin_registrar_fn: PluginRegistrarFn(CrateNum) -> Option<DefId>,
342 [] fn derive_registrar_fn: DeriveRegistrarFn(CrateNum) -> Option<DefId>,
343 [] fn crate_disambiguator: CrateDisambiguator(CrateNum) -> CrateDisambiguator,
344 [] fn crate_hash: CrateHash(CrateNum) -> Svh,
345 [] fn original_crate_name: OriginalCrateName(CrateNum) -> Symbol,
346 [] fn extra_filename: ExtraFileName(CrateNum) -> String,
347
348 [] fn implementations_of_trait: implementations_of_trait_node((CrateNum, DefId))
349 -> Lrc<Vec<DefId>>,
350 [] fn all_trait_implementations: AllTraitImplementations(CrateNum)
351 -> Lrc<Vec<DefId>>,
352
353 [] fn dllimport_foreign_items: DllimportForeignItems(CrateNum)
354 -> Lrc<FxHashSet<DefId>>,
355 [] fn is_dllimport_foreign_item: IsDllimportForeignItem(DefId) -> bool,
356 [] fn is_statically_included_foreign_item: IsStaticallyIncludedForeignItem(DefId) -> bool,
357 [] fn native_library_kind: NativeLibraryKind(DefId)
358 -> Option<NativeLibraryKind>,
359 [] fn link_args: link_args_node(CrateNum) -> Lrc<Vec<String>>,
360
361 // Lifetime resolution. See `middle::resolve_lifetimes`.
362 [] fn resolve_lifetimes: ResolveLifetimes(CrateNum) -> Lrc<ResolveLifetimes>,
363 [] fn named_region_map: NamedRegion(DefIndex) ->
364 Option<Lrc<FxHashMap<ItemLocalId, Region>>>,
365 [] fn is_late_bound_map: IsLateBound(DefIndex) ->
366 Option<Lrc<FxHashSet<ItemLocalId>>>,
367 [] fn object_lifetime_defaults_map: ObjectLifetimeDefaults(DefIndex)
368 -> Option<Lrc<FxHashMap<ItemLocalId, Lrc<Vec<ObjectLifetimeDefault>>>>>,
369
370 [] fn visibility: Visibility(DefId) -> ty::Visibility,
371 [] fn dep_kind: DepKind(CrateNum) -> DepKind,
372 [] fn crate_name: CrateName(CrateNum) -> Symbol,
373 [] fn item_children: ItemChildren(DefId) -> Lrc<Vec<Export>>,
374 [] fn extern_mod_stmt_cnum: ExternModStmtCnum(DefId) -> Option<CrateNum>,
375
376 [] fn get_lang_items: get_lang_items_node(CrateNum) -> Lrc<LanguageItems>,
377 [] fn defined_lang_items: DefinedLangItems(CrateNum) -> Lrc<Vec<(DefId, usize)>>,
378 [] fn missing_lang_items: MissingLangItems(CrateNum) -> Lrc<Vec<LangItem>>,
379 [] fn visible_parent_map: visible_parent_map_node(CrateNum)
380 -> Lrc<DefIdMap<DefId>>,
381 [] fn missing_extern_crate_item: MissingExternCrateItem(CrateNum) -> bool,
382 [] fn used_crate_source: UsedCrateSource(CrateNum) -> Lrc<CrateSource>,
383 [] fn postorder_cnums: postorder_cnums_node(CrateNum) -> Lrc<Vec<CrateNum>>,
384
385 [] fn freevars: Freevars(DefId) -> Option<Lrc<Vec<hir::Freevar>>>,
386 [] fn maybe_unused_trait_import: MaybeUnusedTraitImport(DefId) -> bool,
387 [] fn maybe_unused_extern_crates: maybe_unused_extern_crates_node(CrateNum)
388 -> Lrc<Vec<(DefId, Span)>>,
389
390 [] fn stability_index: stability_index_node(CrateNum) -> Lrc<stability::Index<'tcx>>,
391 [] fn all_crate_nums: all_crate_nums_node(CrateNum) -> Lrc<Vec<CrateNum>>,
392
393 /// A vector of every trait accessible in the whole crate
394 /// (i.e. including those from subcrates). This is used only for
395 /// error reporting.
396 [] fn all_traits: all_traits_node(CrateNum) -> Lrc<Vec<DefId>>,
397
398 [] fn exported_symbols: ExportedSymbols(CrateNum)
399 -> Arc<Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)>>,
400 [] fn collect_and_partition_translation_items:
401 collect_and_partition_translation_items_node(CrateNum)
402 -> (Arc<DefIdSet>, Arc<Vec<Arc<CodegenUnit<'tcx>>>>),
403 [] fn is_translated_item: IsTranslatedItem(DefId) -> bool,
404 [] fn codegen_unit: CodegenUnit(InternedString) -> Arc<CodegenUnit<'tcx>>,
405 [] fn compile_codegen_unit: CompileCodegenUnit(InternedString) -> Stats,
406 [] fn output_filenames: output_filenames_node(CrateNum)
407 -> Arc<OutputFilenames>,
408
409 // Erases regions from `ty` to yield a new type.
410 // Normally you would just use `tcx.erase_regions(&value)`,
411 // however, which uses this query as a kind of cache.
412 [] fn erase_regions_ty: erase_regions_ty(Ty<'tcx>) -> Ty<'tcx>,
413
414 /// Do not call this query directly: invoke `normalize` instead.
415 [] fn normalize_projection_ty: NormalizeProjectionTy(
416 CanonicalProjectionGoal<'tcx>
417 ) -> Result<
418 Lrc<Canonical<'tcx, canonical::QueryResult<'tcx, NormalizationResult<'tcx>>>>,
419 NoSolution,
420 >,
421
422 /// Do not call this query directly: invoke `normalize_erasing_regions` instead.
423 [] fn normalize_ty_after_erasing_regions: NormalizeTyAfterErasingRegions(
424 ParamEnvAnd<'tcx, Ty<'tcx>>
425 ) -> Ty<'tcx>,
426
427 /// Do not call this query directly: invoke `infcx.at().dropck_outlives()` instead.
428 [] fn dropck_outlives: DropckOutlives(
429 CanonicalTyGoal<'tcx>
430 ) -> Result<
431 Lrc<Canonical<'tcx, canonical::QueryResult<'tcx, DropckOutlivesResult<'tcx>>>>,
432 NoSolution,
433 >,
434
435 /// Do not call this query directly: invoke `infcx.predicate_may_hold()` or
436 /// `infcx.predicate_must_hold()` instead.
437 [] fn evaluate_obligation: EvaluateObligation(
438 CanonicalPredicateGoal<'tcx>
439 ) -> Result<traits::EvaluationResult, traits::OverflowError>,
440
441 [] fn substitute_normalize_and_test_predicates:
442 substitute_normalize_and_test_predicates_node((DefId, &'tcx Substs<'tcx>)) -> bool,
443
444 [] fn target_features_whitelist:
445 target_features_whitelist_node(CrateNum) -> Lrc<FxHashMap<String, Option<String>>>,
446
447 // Get an estimate of the size of an InstanceDef based on its MIR for CGU partitioning.
448 [] fn instance_def_size_estimate: instance_def_size_estimate_dep_node(ty::InstanceDef<'tcx>)
449 -> usize,
450
451 [] fn features_query: features_node(CrateNum) -> Lrc<feature_gate::Features>,
452
453 [] fn program_clauses_for: ProgramClausesFor(DefId) -> Clauses<'tcx>,
454
455 [] fn program_clauses_for_env: ProgramClausesForEnv(
456 ty::ParamEnv<'tcx>
457 ) -> Clauses<'tcx>,
458
459 [] fn wasm_custom_sections: WasmCustomSections(CrateNum) -> Lrc<Vec<DefId>>,
460 [] fn wasm_import_module_map: WasmImportModuleMap(CrateNum)
461 -> Lrc<FxHashMap<DefId, String>>,
462 }
463
464 //////////////////////////////////////////////////////////////////////
465 // These functions are little shims used to find the dep-node for a
466 // given query when there is not a *direct* mapping:
467
468
469 fn features_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
470 DepConstructor::Features
471 }
472
473 fn trans_fn_attrs<'tcx>(id: DefId) -> DepConstructor<'tcx> {
474 DepConstructor::TransFnAttrs { 0: id }
475 }
476
477 fn erase_regions_ty<'tcx>(ty: Ty<'tcx>) -> DepConstructor<'tcx> {
478 DepConstructor::EraseRegionsTy { ty }
479 }
480
481 fn type_param_predicates<'tcx>((item_id, param_id): (DefId, DefId)) -> DepConstructor<'tcx> {
482 DepConstructor::TypeParamPredicates {
483 item_id,
484 param_id
485 }
486 }
487
488 fn fulfill_obligation_dep_node<'tcx>((param_env, trait_ref):
489 (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> DepConstructor<'tcx> {
490 DepConstructor::FulfillObligation {
491 param_env,
492 trait_ref
493 }
494 }
495
496 fn crate_inherent_impls_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
497 DepConstructor::Coherence
498 }
499
500 fn inherent_impls_overlap_check_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
501 DepConstructor::CoherenceInherentImplOverlapCheck
502 }
503
504 fn reachability_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
505 DepConstructor::Reachability
506 }
507
508 fn mir_shim_dep_node<'tcx>(instance_def: ty::InstanceDef<'tcx>) -> DepConstructor<'tcx> {
509 DepConstructor::MirShim {
510 instance_def
511 }
512 }
513
514 fn symbol_name_dep_node<'tcx>(instance: ty::Instance<'tcx>) -> DepConstructor<'tcx> {
515 DepConstructor::InstanceSymbolName { instance }
516 }
517
518 fn typeck_item_bodies_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
519 DepConstructor::TypeckBodiesKrate
520 }
521
522 fn const_eval_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
523 -> DepConstructor<'tcx> {
524 DepConstructor::ConstEval { param_env }
525 }
526
527 fn mir_keys<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
528 DepConstructor::MirKeys
529 }
530
531 fn crate_variances<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
532 DepConstructor::CrateVariances
533 }
534
535 fn is_copy_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
536 DepConstructor::IsCopy { param_env }
537 }
538
539 fn is_sized_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
540 DepConstructor::IsSized { param_env }
541 }
542
543 fn is_freeze_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
544 DepConstructor::IsFreeze { param_env }
545 }
546
547 fn needs_drop_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
548 DepConstructor::NeedsDrop { param_env }
549 }
550
551 fn layout_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
552 DepConstructor::Layout { param_env }
553 }
554
555 fn lint_levels_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
556 DepConstructor::LintLevels
557 }
558
559 fn specializes_node<'tcx>((a, b): (DefId, DefId)) -> DepConstructor<'tcx> {
560 DepConstructor::Specializes { impl1: a, impl2: b }
561 }
562
563 fn implementations_of_trait_node<'tcx>((krate, trait_id): (CrateNum, DefId))
564 -> DepConstructor<'tcx>
565 {
566 DepConstructor::ImplementationsOfTrait { krate, trait_id }
567 }
568
569 fn link_args_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
570 DepConstructor::LinkArgs
571 }
572
573 fn get_lang_items_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
574 DepConstructor::GetLangItems
575 }
576
577 fn visible_parent_map_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
578 DepConstructor::VisibleParentMap
579 }
580
581 fn postorder_cnums_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
582 DepConstructor::PostorderCnums
583 }
584
585 fn maybe_unused_extern_crates_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
586 DepConstructor::MaybeUnusedExternCrates
587 }
588
589 fn stability_index_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
590 DepConstructor::StabilityIndex
591 }
592
593 fn all_crate_nums_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
594 DepConstructor::AllCrateNums
595 }
596
597 fn all_traits_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
598 DepConstructor::AllTraits
599 }
600
601 fn collect_and_partition_translation_items_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
602 DepConstructor::CollectAndPartitionTranslationItems
603 }
604
605 fn output_filenames_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
606 DepConstructor::OutputFilenames
607 }
608
609 fn vtable_methods_node<'tcx>(trait_ref: ty::PolyTraitRef<'tcx>) -> DepConstructor<'tcx> {
610 DepConstructor::VtableMethods{ trait_ref }
611 }
612
613 fn substitute_normalize_and_test_predicates_node<'tcx>(key: (DefId, &'tcx Substs<'tcx>))
614 -> DepConstructor<'tcx> {
615 DepConstructor::SubstituteNormalizeAndTestPredicates { key }
616 }
617
618 fn target_features_whitelist_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
619 DepConstructor::TargetFeaturesWhitelist
620 }
621
622 fn instance_def_size_estimate_dep_node<'tcx>(instance_def: ty::InstanceDef<'tcx>)
623 -> DepConstructor<'tcx> {
624 DepConstructor::InstanceDefSizeEstimate {
625 instance_def
626 }
627 }