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.
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.
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, CodegenFnAttrs};
16 use infer::canonical::{self, Canonical};
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;
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};
31 use mir::interpret::{GlobalId, Allocation, ConstValue};
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;
41 use ty::{self, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt};
43 use ty::subst::Substs;
44 use util::nodemap::{DefIdSet, DefIdMap, ItemLocalSet};
45 use util::common::{ErrorReported};
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;
54 use rustc_data_structures::sync::Lrc;
56 use syntax_pos::{Span, DUMMY_SP};
57 use syntax_pos::symbol::InternedString;
60 use syntax::feature_gate;
61 use syntax::symbol::Symbol;
65 use self::plumbing::*;
66 pub use self::plumbing::{force_from_dep_node, CycleError};
69 pub use self::job::{QueryJob, QueryInfo};
70 #[cfg(parallel_queries)]
71 pub use self::job::handle_deadlock;
74 pub use self::keys::Key;
77 use self::values::Value;
80 pub use self::config::QueryConfig;
81 use self::config::QueryDescription;
84 pub use self::on_disk_cache::OnDiskCache;
86 // Each of these maps also corresponds to a method on a
87 // `Provider` trait for requesting a value of that type,
88 // and a method on `Maps` itself for doing that in a
89 // a way that memoizes and does dep-graph tracking,
90 // wrapping around the actual chain of providers that
91 // the driver creates (using several `rustc_*` crates).
93 // The result of query must implement Clone. They must also implement ty::maps::values::Value
94 // which produces an appropriate error value if the query resulted in a query cycle.
95 // Queries marked with `fatal_cycle` do not need that implementation
96 // as they will raise an fatal error on query cycles instead.
98 /// Records the type of every item.
99 [] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>,
101 /// Maps from the def-id of an item (trait/struct/enum/fn) to its
102 /// associated generics and predicates.
103 [] fn generics_of: GenericsOfItem(DefId) -> &'tcx ty::Generics,
104 [] fn predicates_of: PredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
105 [] fn explicit_predicates_of: PredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
107 /// Maps from the def-id of a trait to the list of
108 /// super-predicates. This is a subset of the full list of
109 /// predicates. We store these in a separate map because we must
110 /// evaluate them even during type conversion, often before the
111 /// full predicates are available (note that supertraits have
112 /// additional acyclicity requirements).
113 [] fn super_predicates_of: SuperPredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
115 /// To avoid cycles within the predicates of a single item we compute
116 /// per-type-parameter predicates for resolving `T::AssocTy`.
117 [] fn type_param_predicates: type_param_predicates((DefId, DefId))
118 -> ty::GenericPredicates<'tcx>,
120 [] fn trait_def: TraitDefOfItem(DefId) -> &'tcx ty::TraitDef,
121 [] fn adt_def: AdtDefOfItem(DefId) -> &'tcx ty::AdtDef,
122 [] fn adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
123 [] fn adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
124 [] fn adt_dtorck_constraint: DtorckConstraint(
126 ) -> Result<DtorckConstraint<'tcx>, NoSolution>,
128 /// True if this is a const fn
129 [] fn is_const_fn: IsConstFn(DefId) -> bool,
131 /// True if this is a foreign item (i.e., linked via `extern { ... }`).
132 [] fn is_foreign_item: IsForeignItem(DefId) -> bool,
134 /// Get a map with the variance of every item; use `item_variance`
136 [] fn crate_variances: crate_variances(CrateNum) -> Lrc<ty::CrateVariancesMap>,
138 /// Maps from def-id of a type or region parameter to its
139 /// (inferred) variance.
140 [] fn variances_of: ItemVariances(DefId) -> Lrc<Vec<ty::Variance>>,
142 /// Maps from def-id of a type to its (inferred) outlives.
143 [] fn inferred_outlives_of: InferredOutlivesOf(DefId) -> Lrc<Vec<ty::Predicate<'tcx>>>,
145 /// Maps from def-id of a type to its (inferred) outlives.
146 [] fn inferred_outlives_crate: InferredOutlivesCrate(CrateNum)
147 -> Lrc<ty::CratePredicatesMap<'tcx>>,
149 /// Maps from an impl/trait def-id to a list of the def-ids of its items
150 [] fn associated_item_def_ids: AssociatedItemDefIds(DefId) -> Lrc<Vec<DefId>>,
152 /// Maps from a trait item to the trait item "descriptor"
153 [] fn associated_item: AssociatedItems(DefId) -> ty::AssociatedItem,
155 [] fn impl_trait_ref: ImplTraitRef(DefId) -> Option<ty::TraitRef<'tcx>>,
156 [] fn impl_polarity: ImplPolarity(DefId) -> hir::ImplPolarity,
158 /// Maps a DefId of a type to a list of its inherent impls.
159 /// Contains implementations of methods that are inherent to a type.
160 /// Methods in these implementations don't need to be exported.
161 [] fn inherent_impls: InherentImpls(DefId) -> Lrc<Vec<DefId>>,
163 /// Set of all the def-ids in this crate that have MIR associated with
164 /// them. This includes all the body owners, but also things like struct
166 [] fn mir_keys: mir_keys(CrateNum) -> Lrc<DefIdSet>,
168 /// Maps DefId's that have an associated Mir to the result
169 /// of the MIR qualify_consts pass. The actual meaning of
170 /// the value isn't known except to the pass itself.
171 [] fn mir_const_qualif: MirConstQualif(DefId) -> (u8, Lrc<IdxSetBuf<mir::Local>>),
173 /// Fetch the MIR for a given def-id right after it's built - this includes
174 /// unreachable code.
175 [] fn mir_built: MirBuilt(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
177 /// Fetch the MIR for a given def-id up till the point where it is
178 /// ready for const evaluation.
180 /// See the README for the `mir` module for details.
181 [] fn mir_const: MirConst(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
183 [] fn mir_validated: MirValidated(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
185 /// MIR after our optimization passes have run. This is MIR that is ready
186 /// for codegen. This is also the only query that can fetch non-local MIR, at present.
187 [] fn optimized_mir: MirOptimized(DefId) -> &'tcx mir::Mir<'tcx>,
189 /// The result of unsafety-checking this def-id.
190 [] fn unsafety_check_result: UnsafetyCheckResult(DefId) -> mir::UnsafetyCheckResult,
192 /// HACK: when evaluated, this reports a "unsafe derive on repr(packed)" error
193 [] fn unsafe_derive_on_repr_packed: UnsafeDeriveOnReprPacked(DefId) -> (),
195 /// The signature of functions and closures.
196 [] fn fn_sig: FnSignature(DefId) -> ty::PolyFnSig<'tcx>,
198 /// Caches CoerceUnsized kinds for impls on custom types.
199 [] fn coerce_unsized_info: CoerceUnsizedInfo(DefId)
200 -> ty::adjustment::CoerceUnsizedInfo,
202 [] fn typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult,
204 [] fn typeck_tables_of: TypeckTables(DefId) -> &'tcx ty::TypeckTables<'tcx>,
206 [] fn used_trait_imports: UsedTraitImports(DefId) -> Lrc<DefIdSet>,
208 [] fn has_typeck_tables: HasTypeckTables(DefId) -> bool,
210 [] fn coherent_trait: CoherenceCheckTrait(DefId) -> (),
212 [] fn borrowck: BorrowCheck(DefId) -> Lrc<BorrowCheckResult>,
214 /// Borrow checks the function body. If this is a closure, returns
215 /// additional requirements that the closure's creator must verify.
216 [] fn mir_borrowck: MirBorrowCheck(DefId) -> mir::BorrowCheckResult<'tcx>,
218 /// Gets a complete map from all types to their inherent impls.
219 /// Not meant to be used directly outside of coherence.
220 /// (Defined only for LOCAL_CRATE)
221 [] fn crate_inherent_impls: crate_inherent_impls_dep_node(CrateNum) -> CrateInherentImpls,
223 /// Checks all types in the krate for overlap in their inherent impls. Reports errors.
224 /// Not meant to be used directly outside of coherence.
225 /// (Defined only for LOCAL_CRATE)
226 [] fn crate_inherent_impls_overlap_check: inherent_impls_overlap_check_dep_node(CrateNum) -> (),
228 /// Results of evaluating const items or constants embedded in
229 /// other items (such as enum variant explicit discriminants).
230 [] fn const_eval: const_eval_dep_node(ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
233 /// Converts a constant value to an constant allocation
234 [] fn const_value_to_allocation: const_value_to_allocation(
235 (ConstValue<'tcx>, Ty<'tcx>)
236 ) -> &'tcx Allocation,
238 [] fn check_match: CheckMatch(DefId)
239 -> Result<(), ErrorReported>,
241 /// Performs the privacy check and computes "access levels".
242 [] fn privacy_access_levels: PrivacyAccessLevels(CrateNum) -> Lrc<AccessLevels>,
244 [] fn reachable_set: reachability_dep_node(CrateNum) -> ReachableSet,
246 /// Per-body `region::ScopeTree`. The `DefId` should be the owner-def-id for the body;
247 /// in the case of closures, this will be redirected to the enclosing function.
248 [] fn region_scope_tree: RegionScopeTree(DefId) -> Lrc<region::ScopeTree>,
250 [] fn mir_shims: mir_shim_dep_node(ty::InstanceDef<'tcx>) -> &'tcx mir::Mir<'tcx>,
252 [] fn def_symbol_name: SymbolName(DefId) -> ty::SymbolName,
253 [] fn symbol_name: symbol_name_dep_node(ty::Instance<'tcx>) -> ty::SymbolName,
255 [] fn describe_def: DescribeDef(DefId) -> Option<Def>,
256 [] fn def_span: DefSpan(DefId) -> Span,
257 [] fn lookup_stability: LookupStability(DefId) -> Option<&'tcx attr::Stability>,
258 [] fn lookup_deprecation_entry: LookupDeprecationEntry(DefId) -> Option<DeprecationEntry>,
259 [] fn item_attrs: ItemAttrs(DefId) -> Lrc<[ast::Attribute]>,
260 [] fn codegen_fn_attrs: codegen_fn_attrs(DefId) -> CodegenFnAttrs,
261 [] fn fn_arg_names: FnArgNames(DefId) -> Vec<ast::Name>,
262 /// Gets the rendered value of the specified constant or associated constant.
264 [] fn rendered_const: RenderedConst(DefId) -> String,
265 [] fn impl_parent: ImplParent(DefId) -> Option<DefId>,
266 [] fn trait_of_item: TraitOfItem(DefId) -> Option<DefId>,
267 [] fn const_is_rvalue_promotable_to_static: ConstIsRvaluePromotableToStatic(DefId) -> bool,
268 [] fn rvalue_promotable_map: RvaluePromotableMap(DefId) -> Lrc<ItemLocalSet>,
269 [] fn is_mir_available: IsMirAvailable(DefId) -> bool,
270 [] fn vtable_methods: vtable_methods_node(ty::PolyTraitRef<'tcx>)
271 -> Lrc<Vec<Option<(DefId, &'tcx Substs<'tcx>)>>>,
273 [] fn codegen_fulfill_obligation: fulfill_obligation_dep_node(
274 (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> Vtable<'tcx, ()>,
275 [] fn trait_impls_of: TraitImpls(DefId) -> Lrc<ty::trait_def::TraitImpls>,
276 [] fn specialization_graph_of: SpecializationGraph(DefId) -> Lrc<specialization_graph::Graph>,
277 [] fn is_object_safe: ObjectSafety(DefId) -> bool,
279 // Get the ParameterEnvironment for a given item; this environment
280 // will be in "user-facing" mode, meaning that it is suitabe for
281 // type-checking etc, and it does not normalize specializable
282 // associated types. This is almost always what you want,
283 // unless you are doing MIR optimizations, in which case you
284 // might want to use `reveal_all()` method to change modes.
285 [] fn param_env: ParamEnv(DefId) -> ty::ParamEnv<'tcx>,
287 // Trait selection queries. These are best used by invoking `ty.moves_by_default()`,
288 // `ty.is_copy()`, etc, since that will prune the environment where possible.
289 [] fn is_copy_raw: is_copy_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
290 [] fn is_sized_raw: is_sized_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
291 [] fn is_freeze_raw: is_freeze_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
292 [] fn needs_drop_raw: needs_drop_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
293 [] fn layout_raw: layout_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
294 -> Result<&'tcx ty::layout::LayoutDetails,
295 ty::layout::LayoutError<'tcx>>,
297 [] fn dylib_dependency_formats: DylibDepFormats(CrateNum)
298 -> Lrc<Vec<(CrateNum, LinkagePreference)>>,
300 [fatal_cycle] fn is_panic_runtime: IsPanicRuntime(CrateNum) -> bool,
301 [fatal_cycle] fn is_compiler_builtins: IsCompilerBuiltins(CrateNum) -> bool,
302 [fatal_cycle] fn has_global_allocator: HasGlobalAllocator(CrateNum) -> bool,
303 [fatal_cycle] fn is_sanitizer_runtime: IsSanitizerRuntime(CrateNum) -> bool,
304 [fatal_cycle] fn is_profiler_runtime: IsProfilerRuntime(CrateNum) -> bool,
305 [fatal_cycle] fn panic_strategy: GetPanicStrategy(CrateNum) -> PanicStrategy,
306 [fatal_cycle] fn is_no_builtins: IsNoBuiltins(CrateNum) -> bool,
308 [] fn extern_crate: ExternCrate(DefId) -> Lrc<Option<ExternCrate>>,
310 [] fn specializes: specializes_node((DefId, DefId)) -> bool,
311 [] fn in_scope_traits_map: InScopeTraits(DefIndex)
312 -> Option<Lrc<FxHashMap<ItemLocalId, Lrc<StableVec<TraitCandidate>>>>>,
313 [] fn module_exports: ModuleExports(DefId) -> Option<Lrc<Vec<Export>>>,
314 [] fn lint_levels: lint_levels_node(CrateNum) -> Lrc<lint::LintLevelMap>,
316 [] fn impl_defaultness: ImplDefaultness(DefId) -> hir::Defaultness,
318 [] fn check_item_well_formed: CheckItemWellFormed(DefId) -> (),
319 [] fn check_trait_item_well_formed: CheckTraitItemWellFormed(DefId) -> (),
320 [] fn check_impl_item_well_formed: CheckImplItemWellFormed(DefId) -> (),
322 // The DefIds of all non-generic functions and statics in the given crate
323 // that can be reached from outside the crate.
325 // We expect this items to be available for being linked to.
327 // This query can also be called for LOCAL_CRATE. In this case it will
328 // compute which items will be reachable to other crates, taking into account
329 // the kind of crate that is currently compiled. Crates with only a
330 // C interface have fewer reachable things.
332 // Does not include external symbols that don't have a corresponding DefId,
333 // like the compiler-generated `main` function and so on.
334 [] fn reachable_non_generics: ReachableNonGenerics(CrateNum)
335 -> Lrc<DefIdMap<SymbolExportLevel>>,
336 [] fn is_reachable_non_generic: IsReachableNonGeneric(DefId) -> bool,
337 [] fn is_unreachable_local_definition: IsUnreachableLocalDefinition(DefId) -> bool,
339 [] fn upstream_monomorphizations: UpstreamMonomorphizations(CrateNum)
340 -> Lrc<DefIdMap<Lrc<FxHashMap<&'tcx Substs<'tcx>, CrateNum>>>>,
341 [] fn upstream_monomorphizations_for: UpstreamMonomorphizationsFor(DefId)
342 -> Option<Lrc<FxHashMap<&'tcx Substs<'tcx>, CrateNum>>>,
344 [] fn native_libraries: NativeLibraries(CrateNum) -> Lrc<Vec<NativeLibrary>>,
346 [] fn foreign_modules: ForeignModules(CrateNum) -> Lrc<Vec<ForeignModule>>,
348 [] fn plugin_registrar_fn: PluginRegistrarFn(CrateNum) -> Option<DefId>,
349 [] fn derive_registrar_fn: DeriveRegistrarFn(CrateNum) -> Option<DefId>,
350 [] fn crate_disambiguator: CrateDisambiguator(CrateNum) -> CrateDisambiguator,
351 [] fn crate_hash: CrateHash(CrateNum) -> Svh,
352 [] fn original_crate_name: OriginalCrateName(CrateNum) -> Symbol,
353 [] fn extra_filename: ExtraFileName(CrateNum) -> String,
355 [] fn implementations_of_trait: implementations_of_trait_node((CrateNum, DefId))
357 [] fn all_trait_implementations: AllTraitImplementations(CrateNum)
360 [] fn dllimport_foreign_items: DllimportForeignItems(CrateNum)
361 -> Lrc<FxHashSet<DefId>>,
362 [] fn is_dllimport_foreign_item: IsDllimportForeignItem(DefId) -> bool,
363 [] fn is_statically_included_foreign_item: IsStaticallyIncludedForeignItem(DefId) -> bool,
364 [] fn native_library_kind: NativeLibraryKind(DefId)
365 -> Option<NativeLibraryKind>,
366 [] fn link_args: link_args_node(CrateNum) -> Lrc<Vec<String>>,
368 // Lifetime resolution. See `middle::resolve_lifetimes`.
369 [] fn resolve_lifetimes: ResolveLifetimes(CrateNum) -> Lrc<ResolveLifetimes>,
370 [] fn named_region_map: NamedRegion(DefIndex) ->
371 Option<Lrc<FxHashMap<ItemLocalId, Region>>>,
372 [] fn is_late_bound_map: IsLateBound(DefIndex) ->
373 Option<Lrc<FxHashSet<ItemLocalId>>>,
374 [] fn object_lifetime_defaults_map: ObjectLifetimeDefaults(DefIndex)
375 -> Option<Lrc<FxHashMap<ItemLocalId, Lrc<Vec<ObjectLifetimeDefault>>>>>,
377 [] fn visibility: Visibility(DefId) -> ty::Visibility,
378 [] fn dep_kind: DepKind(CrateNum) -> DepKind,
379 [] fn crate_name: CrateName(CrateNum) -> Symbol,
380 [] fn item_children: ItemChildren(DefId) -> Lrc<Vec<Export>>,
381 [] fn extern_mod_stmt_cnum: ExternModStmtCnum(DefId) -> Option<CrateNum>,
383 [] fn get_lang_items: get_lang_items_node(CrateNum) -> Lrc<LanguageItems>,
384 [] fn defined_lang_items: DefinedLangItems(CrateNum) -> Lrc<Vec<(DefId, usize)>>,
385 [] fn missing_lang_items: MissingLangItems(CrateNum) -> Lrc<Vec<LangItem>>,
386 [] fn visible_parent_map: visible_parent_map_node(CrateNum)
387 -> Lrc<DefIdMap<DefId>>,
388 [] fn missing_extern_crate_item: MissingExternCrateItem(CrateNum) -> bool,
389 [] fn used_crate_source: UsedCrateSource(CrateNum) -> Lrc<CrateSource>,
390 [] fn postorder_cnums: postorder_cnums_node(CrateNum) -> Lrc<Vec<CrateNum>>,
392 [] fn freevars: Freevars(DefId) -> Option<Lrc<Vec<hir::Freevar>>>,
393 [] fn maybe_unused_trait_import: MaybeUnusedTraitImport(DefId) -> bool,
394 [] fn maybe_unused_extern_crates: maybe_unused_extern_crates_node(CrateNum)
395 -> Lrc<Vec<(DefId, Span)>>,
397 [] fn stability_index: stability_index_node(CrateNum) -> Lrc<stability::Index<'tcx>>,
398 [] fn all_crate_nums: all_crate_nums_node(CrateNum) -> Lrc<Vec<CrateNum>>,
400 /// A vector of every trait accessible in the whole crate
401 /// (i.e. including those from subcrates). This is used only for
403 [] fn all_traits: all_traits_node(CrateNum) -> Lrc<Vec<DefId>>,
405 [] fn exported_symbols: ExportedSymbols(CrateNum)
406 -> Arc<Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)>>,
407 [] fn collect_and_partition_mono_items:
408 collect_and_partition_mono_items_node(CrateNum)
409 -> (Arc<DefIdSet>, Arc<Vec<Arc<CodegenUnit<'tcx>>>>),
410 [] fn is_codegened_item: IsCodegenedItem(DefId) -> bool,
411 [] fn codegen_unit: CodegenUnit(InternedString) -> Arc<CodegenUnit<'tcx>>,
412 [] fn compile_codegen_unit: CompileCodegenUnit(InternedString) -> Stats,
413 [] fn output_filenames: output_filenames_node(CrateNum)
414 -> Arc<OutputFilenames>,
416 // Erases regions from `ty` to yield a new type.
417 // Normally you would just use `tcx.erase_regions(&value)`,
418 // however, which uses this query as a kind of cache.
419 [] fn erase_regions_ty: erase_regions_ty(Ty<'tcx>) -> Ty<'tcx>,
421 /// Do not call this query directly: invoke `normalize` instead.
422 [] fn normalize_projection_ty: NormalizeProjectionTy(
423 CanonicalProjectionGoal<'tcx>
425 Lrc<Canonical<'tcx, canonical::QueryResult<'tcx, NormalizationResult<'tcx>>>>,
429 /// Do not call this query directly: invoke `normalize_erasing_regions` instead.
430 [] fn normalize_ty_after_erasing_regions: NormalizeTyAfterErasingRegions(
431 ParamEnvAnd<'tcx, Ty<'tcx>>
434 /// Do not call this query directly: invoke `infcx.at().dropck_outlives()` instead.
435 [] fn dropck_outlives: DropckOutlives(
436 CanonicalTyGoal<'tcx>
438 Lrc<Canonical<'tcx, canonical::QueryResult<'tcx, DropckOutlivesResult<'tcx>>>>,
442 /// Do not call this query directly: invoke `infcx.predicate_may_hold()` or
443 /// `infcx.predicate_must_hold()` instead.
444 [] fn evaluate_obligation: EvaluateObligation(
445 CanonicalPredicateGoal<'tcx>
446 ) -> Result<traits::EvaluationResult, traits::OverflowError>,
448 [] fn substitute_normalize_and_test_predicates:
449 substitute_normalize_and_test_predicates_node((DefId, &'tcx Substs<'tcx>)) -> bool,
451 [] fn target_features_whitelist:
452 target_features_whitelist_node(CrateNum) -> Lrc<FxHashMap<String, Option<String>>>,
454 // Get an estimate of the size of an InstanceDef based on its MIR for CGU partitioning.
455 [] fn instance_def_size_estimate: instance_def_size_estimate_dep_node(ty::InstanceDef<'tcx>)
458 [] fn features_query: features_node(CrateNum) -> Lrc<feature_gate::Features>,
460 [] fn program_clauses_for: ProgramClausesFor(DefId) -> Clauses<'tcx>,
462 [] fn program_clauses_for_env: ProgramClausesForEnv(
466 [] fn wasm_custom_sections: WasmCustomSections(CrateNum) -> Lrc<Vec<DefId>>,
467 [] fn wasm_import_module_map: WasmImportModuleMap(CrateNum)
468 -> Lrc<FxHashMap<DefId, String>>,
471 //////////////////////////////////////////////////////////////////////
472 // These functions are little shims used to find the dep-node for a
473 // given query when there is not a *direct* mapping:
476 fn features_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
477 DepConstructor::Features
480 fn codegen_fn_attrs<'tcx>(id: DefId) -> DepConstructor<'tcx> {
481 DepConstructor::CodegenFnAttrs { 0: id }
484 fn erase_regions_ty<'tcx>(ty: Ty<'tcx>) -> DepConstructor<'tcx> {
485 DepConstructor::EraseRegionsTy { ty }
488 fn const_value_to_allocation<'tcx>(
489 (val, ty): (ConstValue<'tcx>, Ty<'tcx>)
490 ) -> DepConstructor<'tcx> {
491 DepConstructor::ConstValueToAllocation { val, ty }
494 fn type_param_predicates<'tcx>((item_id, param_id): (DefId, DefId)) -> DepConstructor<'tcx> {
495 DepConstructor::TypeParamPredicates {
501 fn fulfill_obligation_dep_node<'tcx>((param_env, trait_ref):
502 (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> DepConstructor<'tcx> {
503 DepConstructor::FulfillObligation {
509 fn crate_inherent_impls_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
510 DepConstructor::Coherence
513 fn inherent_impls_overlap_check_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
514 DepConstructor::CoherenceInherentImplOverlapCheck
517 fn reachability_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
518 DepConstructor::Reachability
521 fn mir_shim_dep_node<'tcx>(instance_def: ty::InstanceDef<'tcx>) -> DepConstructor<'tcx> {
522 DepConstructor::MirShim {
527 fn symbol_name_dep_node<'tcx>(instance: ty::Instance<'tcx>) -> DepConstructor<'tcx> {
528 DepConstructor::InstanceSymbolName { instance }
531 fn typeck_item_bodies_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
532 DepConstructor::TypeckBodiesKrate
535 fn const_eval_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
536 -> DepConstructor<'tcx> {
537 DepConstructor::ConstEval { param_env }
540 fn mir_keys<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
541 DepConstructor::MirKeys
544 fn crate_variances<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
545 DepConstructor::CrateVariances
548 fn is_copy_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
549 DepConstructor::IsCopy { param_env }
552 fn is_sized_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
553 DepConstructor::IsSized { param_env }
556 fn is_freeze_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
557 DepConstructor::IsFreeze { param_env }
560 fn needs_drop_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
561 DepConstructor::NeedsDrop { param_env }
564 fn layout_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
565 DepConstructor::Layout { param_env }
568 fn lint_levels_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
569 DepConstructor::LintLevels
572 fn specializes_node<'tcx>((a, b): (DefId, DefId)) -> DepConstructor<'tcx> {
573 DepConstructor::Specializes { impl1: a, impl2: b }
576 fn implementations_of_trait_node<'tcx>((krate, trait_id): (CrateNum, DefId))
577 -> DepConstructor<'tcx>
579 DepConstructor::ImplementationsOfTrait { krate, trait_id }
582 fn link_args_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
583 DepConstructor::LinkArgs
586 fn get_lang_items_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
587 DepConstructor::GetLangItems
590 fn visible_parent_map_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
591 DepConstructor::VisibleParentMap
594 fn postorder_cnums_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
595 DepConstructor::PostorderCnums
598 fn maybe_unused_extern_crates_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
599 DepConstructor::MaybeUnusedExternCrates
602 fn stability_index_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
603 DepConstructor::StabilityIndex
606 fn all_crate_nums_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
607 DepConstructor::AllCrateNums
610 fn all_traits_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
611 DepConstructor::AllTraits
614 fn collect_and_partition_mono_items_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
615 DepConstructor::CollectAndPartitionMonoItems
618 fn output_filenames_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
619 DepConstructor::OutputFilenames
622 fn vtable_methods_node<'tcx>(trait_ref: ty::PolyTraitRef<'tcx>) -> DepConstructor<'tcx> {
623 DepConstructor::VtableMethods{ trait_ref }
626 fn substitute_normalize_and_test_predicates_node<'tcx>(key: (DefId, &'tcx Substs<'tcx>))
627 -> DepConstructor<'tcx> {
628 DepConstructor::SubstituteNormalizeAndTestPredicates { key }
631 fn target_features_whitelist_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
632 DepConstructor::TargetFeaturesWhitelist
635 fn instance_def_size_estimate_dep_node<'tcx>(instance_def: ty::InstanceDef<'tcx>)
636 -> DepConstructor<'tcx> {
637 DepConstructor::InstanceDefSizeEstimate {