]> git.lizzy.rs Git - rust.git/blob - src/librustc/query/mod.rs
Update const_forget.rs
[rust.git] / src / librustc / query / mod.rs
1 use crate::dep_graph::{DepKind, DepNode, RecoverKey, SerializedDepNodeIndex};
2 use crate::mir;
3 use crate::mir::interpret::{GlobalId, LitToConstInput};
4 use crate::traits;
5 use crate::traits::query::{
6     CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal,
7     CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpEqGoal, CanonicalTypeOpNormalizeGoal,
8     CanonicalTypeOpProvePredicateGoal, CanonicalTypeOpSubtypeGoal,
9 };
10 use crate::ty::query::queries;
11 use crate::ty::query::QueryDescription;
12 use crate::ty::subst::SubstsRef;
13 use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt};
14 use rustc_hir::def_id::{CrateNum, DefId, DefIndex};
15
16 use rustc_span::symbol::Symbol;
17 use std::borrow::Cow;
18
19 fn describe_as_module(def_id: DefId, tcx: TyCtxt<'_>) -> String {
20     if def_id.is_top_level_module() {
21         "top-level module".to_string()
22     } else {
23         format!("module `{}`", tcx.def_path_str(def_id))
24     }
25 }
26
27 // Each of these queries corresponds to a function pointer field in the
28 // `Providers` struct for requesting a value of that type, and a method
29 // on `tcx: TyCtxt` (and `tcx.at(span)`) for doing that request in a way
30 // which memoizes and does dep-graph tracking, wrapping around the actual
31 // `Providers` that the driver creates (using several `rustc_*` crates).
32 //
33 // The result type of each query must implement `Clone`, and additionally
34 // `ty::query::values::Value`, which produces an appropriate placeholder
35 // (error) value if the query resulted in a query cycle.
36 // Queries marked with `fatal_cycle` do not need the latter implementation,
37 // as they will raise an fatal error on query cycles instead.
38 rustc_queries! {
39     Other {
40         query trigger_delay_span_bug(key: DefId) -> () {
41             desc { "trigger a delay span bug" }
42         }
43     }
44
45     Other {
46         // Represents crate as a whole (as distinct from the top-level crate module).
47         // If you call `hir_crate` (e.g., indirectly by calling `tcx.hir().krate()`),
48         // we will have to assume that any change means that you need to be recompiled.
49         // This is because the `hir_crate` query gives you access to all other items.
50         // To avoid this fate, do not call `tcx.hir().krate()`; instead,
51         // prefer wrappers like `tcx.visit_all_items_in_krate()`.
52         query hir_crate(key: CrateNum) -> &'tcx Crate<'tcx> {
53             eval_always
54             no_hash
55             desc { "get the crate HIR" }
56         }
57
58         /// Records the type of every item.
59         query type_of(key: DefId) -> Ty<'tcx> {
60             cache_on_disk_if { key.is_local() }
61         }
62
63         /// Maps from the `DefId` of an item (trait/struct/enum/fn) to its
64         /// associated generics.
65         query generics_of(key: DefId) -> &'tcx ty::Generics {
66             cache_on_disk_if { key.is_local() }
67             load_cached(tcx, id) {
68                 let generics: Option<ty::Generics> = tcx.queries.on_disk_cache
69                                                         .try_load_query_result(tcx, id);
70                 generics.map(|x| &*tcx.arena.alloc(x))
71             }
72         }
73
74         /// Maps from the `DefId` of an item (trait/struct/enum/fn) to the
75         /// predicates (where-clauses) that must be proven true in order
76         /// to reference it. This is almost always the "predicates query"
77         /// that you want.
78         ///
79         /// `predicates_of` builds on `predicates_defined_on` -- in fact,
80         /// it is almost always the same as that query, except for the
81         /// case of traits. For traits, `predicates_of` contains
82         /// an additional `Self: Trait<...>` predicate that users don't
83         /// actually write. This reflects the fact that to invoke the
84         /// trait (e.g., via `Default::default`) you must supply types
85         /// that actually implement the trait. (However, this extra
86         /// predicate gets in the way of some checks, which are intended
87         /// to operate over only the actual where-clauses written by the
88         /// user.)
89         query predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
90             cache_on_disk_if { key.is_local() }
91         }
92
93         query native_libraries(_: CrateNum) -> Lrc<Vec<NativeLibrary>> {
94             desc { "looking up the native libraries of a linked crate" }
95         }
96
97         query lint_levels(_: CrateNum) -> &'tcx LintLevelMap {
98             eval_always
99             desc { "computing the lint levels for items in this crate" }
100         }
101
102         query parent_module_from_def_id(_: DefId) -> DefId {
103             eval_always
104         }
105     }
106
107     Codegen {
108         query is_panic_runtime(_: CrateNum) -> bool {
109             fatal_cycle
110             desc { "checking if the crate is_panic_runtime" }
111         }
112     }
113
114     Codegen {
115         /// Set of all the `DefId`s in this crate that have MIR associated with
116         /// them. This includes all the body owners, but also things like struct
117         /// constructors.
118         query mir_keys(_: CrateNum) -> &'tcx DefIdSet {
119             desc { "getting a list of all mir_keys" }
120         }
121
122         /// Maps DefId's that have an associated `mir::Body` to the result
123         /// of the MIR const-checking pass. This is the set of qualifs in
124         /// the final value of a `const`.
125         query mir_const_qualif(key: DefId) -> mir::ConstQualifs {
126             desc { |tcx| "const checking `{}`", tcx.def_path_str(key) }
127             cache_on_disk_if { key.is_local() }
128         }
129
130         /// Fetch the MIR for a given `DefId` right after it's built - this includes
131         /// unreachable code.
132         query mir_built(_: DefId) -> &'tcx Steal<mir::BodyAndCache<'tcx>> {
133             desc { "building MIR for" }
134         }
135
136         /// Fetch the MIR for a given `DefId` up till the point where it is
137         /// ready for const evaluation.
138         ///
139         /// See the README for the `mir` module for details.
140         query mir_const(_: DefId) -> &'tcx Steal<mir::BodyAndCache<'tcx>> {
141             no_hash
142         }
143
144         query mir_validated(_: DefId) ->
145             (
146                 &'tcx Steal<mir::BodyAndCache<'tcx>>,
147                 &'tcx Steal<IndexVec<mir::Promoted, mir::BodyAndCache<'tcx>>>
148             ) {
149             no_hash
150         }
151
152         /// MIR after our optimization passes have run. This is MIR that is ready
153         /// for codegen. This is also the only query that can fetch non-local MIR, at present.
154         query optimized_mir(key: DefId) -> &'tcx mir::BodyAndCache<'tcx> {
155             cache_on_disk_if { key.is_local() }
156             load_cached(tcx, id) {
157                 let mir: Option<crate::mir::BodyAndCache<'tcx>>
158                     = tcx.queries.on_disk_cache.try_load_query_result(tcx, id);
159                 mir.map(|x| {
160                     let cache = tcx.arena.alloc(x);
161                     cache.ensure_predecessors();
162                     &*cache
163                 })
164             }
165         }
166
167         query promoted_mir(key: DefId) -> &'tcx IndexVec<mir::Promoted, mir::BodyAndCache<'tcx>> {
168             cache_on_disk_if { key.is_local() }
169             load_cached(tcx, id) {
170                 let promoted: Option<
171                     rustc_index::vec::IndexVec<
172                         crate::mir::Promoted,
173                         crate::mir::BodyAndCache<'tcx>
174                     >> = tcx.queries.on_disk_cache.try_load_query_result(tcx, id);
175                 promoted.map(|p| {
176                     let cache = tcx.arena.alloc(p);
177                     for body in cache.iter_mut() {
178                         body.ensure_predecessors();
179                     }
180                     &*cache
181                 })
182             }
183         }
184     }
185
186     TypeChecking {
187         // Erases regions from `ty` to yield a new type.
188         // Normally you would just use `tcx.erase_regions(&value)`,
189         // however, which uses this query as a kind of cache.
190         query erase_regions_ty(ty: Ty<'tcx>) -> Ty<'tcx> {
191             // This query is not expected to have input -- as a result, it
192             // is not a good candidates for "replay" because it is essentially a
193             // pure function of its input (and hence the expectation is that
194             // no caller would be green **apart** from just these
195             // queries). Making it anonymous avoids hashing the result, which
196             // may save a bit of time.
197             anon
198             no_force
199             desc { "erasing regions from `{:?}`", ty }
200         }
201
202         query program_clauses_for(_: DefId) -> Clauses<'tcx> {
203             desc { "generating chalk-style clauses" }
204         }
205
206         query program_clauses_for_env(_: traits::Environment<'tcx>) -> Clauses<'tcx> {
207             no_force
208             desc { "generating chalk-style clauses for environment" }
209         }
210
211         // Get the chalk-style environment of the given item.
212         query environment(_: DefId) -> traits::Environment<'tcx> {
213             desc { "return a chalk-style environment" }
214         }
215     }
216
217     Linking {
218         query wasm_import_module_map(_: CrateNum) -> &'tcx FxHashMap<DefId, String> {
219             desc { "wasm import module map" }
220         }
221     }
222
223     Other {
224         /// Maps from the `DefId` of an item (trait/struct/enum/fn) to the
225         /// predicates (where-clauses) directly defined on it. This is
226         /// equal to the `explicit_predicates_of` predicates plus the
227         /// `inferred_outlives_of` predicates.
228         query predicates_defined_on(_: DefId) -> ty::GenericPredicates<'tcx> {}
229
230         /// Returns the predicates written explicitly by the user.
231         query explicit_predicates_of(_: DefId) -> ty::GenericPredicates<'tcx> {}
232
233         /// Returns the inferred outlives predicates (e.g., for `struct
234         /// Foo<'a, T> { x: &'a T }`, this would return `T: 'a`).
235         query inferred_outlives_of(_: DefId) -> &'tcx [(ty::Predicate<'tcx>, Span)] {}
236
237         /// Maps from the `DefId` of a trait to the list of
238         /// super-predicates. This is a subset of the full list of
239         /// predicates. We store these in a separate map because we must
240         /// evaluate them even during type conversion, often before the
241         /// full predicates are available (note that supertraits have
242         /// additional acyclicity requirements).
243         query super_predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
244             desc { |tcx| "computing the supertraits of `{}`", tcx.def_path_str(key) }
245         }
246
247         /// To avoid cycles within the predicates of a single item we compute
248         /// per-type-parameter predicates for resolving `T::AssocTy`.
249         query type_param_predicates(key: (DefId, DefId)) -> ty::GenericPredicates<'tcx> {
250             no_force
251             desc { |tcx| "computing the bounds for type parameter `{}`", {
252                 let id = tcx.hir().as_local_hir_id(key.1).unwrap();
253                 tcx.hir().ty_param_name(id)
254             }}
255         }
256
257         query trait_def(_: DefId) -> &'tcx ty::TraitDef {}
258         query adt_def(_: DefId) -> &'tcx ty::AdtDef {}
259         query adt_destructor(_: DefId) -> Option<ty::Destructor> {}
260
261         // The cycle error here should be reported as an error by `check_representable`.
262         // We consider the type as Sized in the meanwhile to avoid
263         // further errors (done in impl Value for AdtSizedConstraint).
264         // Use `cycle_delay_bug` to delay the cycle error here to be emitted later
265         // in case we accidentally otherwise don't emit an error.
266         query adt_sized_constraint(
267             _: DefId
268         ) -> AdtSizedConstraint<'tcx> {
269             cycle_delay_bug
270         }
271
272         query adt_dtorck_constraint(
273             _: DefId
274         ) -> Result<DtorckConstraint<'tcx>, NoSolution> {}
275
276         /// Returns `true` if this is a const fn, use the `is_const_fn` to know whether your crate
277         /// actually sees it as const fn (e.g., the const-fn-ness might be unstable and you might
278         /// not have the feature gate active).
279         ///
280         /// **Do not call this function manually.** It is only meant to cache the base data for the
281         /// `is_const_fn` function.
282         query is_const_fn_raw(key: DefId) -> bool {
283             desc { |tcx| "checking if item is const fn: `{}`", tcx.def_path_str(key) }
284         }
285
286         /// Returns `true` if this is a const `impl`. **Do not call this function manually.**
287         ///
288         /// This query caches the base data for the `is_const_impl` helper function, which also
289         /// takes into account stability attributes (e.g., `#[rustc_const_unstable]`).
290         query is_const_impl_raw(key: DefId) -> bool {
291             desc { |tcx| "checking if item is const impl: `{}`", tcx.def_path_str(key) }
292         }
293
294         query asyncness(key: DefId) -> hir::IsAsync {
295             desc { |tcx| "checking if the function is async: `{}`", tcx.def_path_str(key) }
296         }
297
298         /// Returns `true` if calls to the function may be promoted.
299         ///
300         /// This is either because the function is e.g., a tuple-struct or tuple-variant
301         /// constructor, or because it has the `#[rustc_promotable]` attribute. The attribute should
302         /// be removed in the future in favour of some form of check which figures out whether the
303         /// function does not inspect the bits of any of its arguments (so is essentially just a
304         /// constructor function).
305         query is_promotable_const_fn(_: DefId) -> bool {}
306
307         query const_fn_is_allowed_fn_ptr(_: DefId) -> bool {}
308
309         /// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
310         query is_foreign_item(_: DefId) -> bool {}
311
312         /// Returns `Some(mutability)` if the node pointed to by `def_id` is a static item.
313         query static_mutability(_: DefId) -> Option<hir::Mutability> {}
314
315         /// Returns `Some(generator_kind)` if the node pointed to by `def_id` is a generator.
316         query generator_kind(_: DefId) -> Option<hir::GeneratorKind> {}
317
318         /// Gets a map with the variance of every item; use `item_variance` instead.
319         query crate_variances(_: CrateNum) -> &'tcx ty::CrateVariancesMap<'tcx> {
320             desc { "computing the variances for items in this crate" }
321         }
322
323         /// Maps from the `DefId` of a type or region parameter to its (inferred) variance.
324         query variances_of(_: DefId) -> &'tcx [ty::Variance] {}
325     }
326
327     TypeChecking {
328         /// Maps from thee `DefId` of a type to its (inferred) outlives.
329         query inferred_outlives_crate(_: CrateNum)
330             -> &'tcx ty::CratePredicatesMap<'tcx> {
331             desc { "computing the inferred outlives predicates for items in this crate" }
332         }
333     }
334
335     Other {
336         /// Maps from an impl/trait `DefId to a list of the `DefId`s of its items.
337         query associated_item_def_ids(_: DefId) -> &'tcx [DefId] {}
338
339         /// Maps from a trait item to the trait item "descriptor".
340         query associated_item(_: DefId) -> ty::AssocItem {}
341
342         /// Collects the associated items defined on a trait or impl.
343         query associated_items(key: DefId) -> &'tcx ty::AssociatedItems {
344             desc { |tcx| "collecting associated items of {}", tcx.def_path_str(key) }
345         }
346
347         query impl_trait_ref(_: DefId) -> Option<ty::TraitRef<'tcx>> {}
348         query impl_polarity(_: DefId) -> ty::ImplPolarity {}
349
350         query issue33140_self_ty(_: DefId) -> Option<ty::Ty<'tcx>> {}
351     }
352
353     TypeChecking {
354         /// Maps a `DefId` of a type to a list of its inherent impls.
355         /// Contains implementations of methods that are inherent to a type.
356         /// Methods in these implementations don't need to be exported.
357         query inherent_impls(_: DefId) -> &'tcx [DefId] {
358             eval_always
359         }
360     }
361
362     TypeChecking {
363         /// The result of unsafety-checking this `DefId`.
364         query unsafety_check_result(key: DefId) -> mir::UnsafetyCheckResult {
365             desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key) }
366             cache_on_disk_if { key.is_local() }
367         }
368
369         /// HACK: when evaluated, this reports a "unsafe derive on repr(packed)" error
370         query unsafe_derive_on_repr_packed(_: DefId) -> () {}
371
372         /// The signature of functions and closures.
373         query fn_sig(_: DefId) -> ty::PolyFnSig<'tcx> {}
374     }
375
376     Other {
377         query lint_mod(key: DefId) -> () {
378             desc { |tcx| "linting {}", describe_as_module(key, tcx) }
379         }
380
381         /// Checks the attributes in the module.
382         query check_mod_attrs(key: DefId) -> () {
383             desc { |tcx| "checking attributes in {}", describe_as_module(key, tcx) }
384         }
385
386         query check_mod_unstable_api_usage(key: DefId) -> () {
387             desc { |tcx| "checking for unstable API usage in {}", describe_as_module(key, tcx) }
388         }
389
390         /// Checks the const bodies in the module for illegal operations (e.g. `if` or `loop`).
391         query check_mod_const_bodies(key: DefId) -> () {
392             desc { |tcx| "checking consts in {}", describe_as_module(key, tcx) }
393         }
394
395         /// Checks the loops in the module.
396         query check_mod_loops(key: DefId) -> () {
397             desc { |tcx| "checking loops in {}", describe_as_module(key, tcx) }
398         }
399
400         query check_mod_item_types(key: DefId) -> () {
401             desc { |tcx| "checking item types in {}", describe_as_module(key, tcx) }
402         }
403
404         query check_mod_privacy(key: DefId) -> () {
405             desc { |tcx| "checking privacy in {}", describe_as_module(key, tcx) }
406         }
407
408         query check_mod_intrinsics(key: DefId) -> () {
409             desc { |tcx| "checking intrinsics in {}", describe_as_module(key, tcx) }
410         }
411
412         query check_mod_liveness(key: DefId) -> () {
413             desc { |tcx| "checking liveness of variables in {}", describe_as_module(key, tcx) }
414         }
415
416         query check_mod_impl_wf(key: DefId) -> () {
417             desc { |tcx| "checking that impls are well-formed in {}", describe_as_module(key, tcx) }
418         }
419
420         query collect_mod_item_types(key: DefId) -> () {
421             desc { |tcx| "collecting item types in {}", describe_as_module(key, tcx) }
422         }
423
424         /// Caches `CoerceUnsized` kinds for impls on custom types.
425         query coerce_unsized_info(_: DefId)
426             -> ty::adjustment::CoerceUnsizedInfo {}
427     }
428
429     TypeChecking {
430         query typeck_item_bodies(_: CrateNum) -> () {
431             desc { "type-checking all item bodies" }
432         }
433
434         query typeck_tables_of(key: DefId) -> &'tcx ty::TypeckTables<'tcx> {
435             desc { |tcx| "type-checking `{}`", tcx.def_path_str(key) }
436             cache_on_disk_if { key.is_local() }
437         }
438         query diagnostic_only_typeck_tables_of(key: DefId) -> &'tcx ty::TypeckTables<'tcx> {
439             cache_on_disk_if { key.is_local() }
440             load_cached(tcx, id) {
441                 let typeck_tables: Option<ty::TypeckTables<'tcx>> = tcx
442                     .queries.on_disk_cache
443                     .try_load_query_result(tcx, id);
444
445                 typeck_tables.map(|tables| &*tcx.arena.alloc(tables))
446             }
447         }
448     }
449
450     Other {
451         query used_trait_imports(key: DefId) -> &'tcx DefIdSet {
452             cache_on_disk_if { key.is_local() }
453         }
454     }
455
456     TypeChecking {
457         query has_typeck_tables(_: DefId) -> bool {}
458
459         query coherent_trait(def_id: DefId) -> () {
460             desc { |tcx| "coherence checking all impls of trait `{}`", tcx.def_path_str(def_id) }
461         }
462     }
463
464     BorrowChecking {
465         /// Borrow-checks the function body. If this is a closure, returns
466         /// additional requirements that the closure's creator must verify.
467         query mir_borrowck(key: DefId) -> &'tcx mir::BorrowCheckResult<'tcx> {
468             desc { |tcx| "borrow-checking `{}`", tcx.def_path_str(key) }
469             cache_on_disk_if(tcx, opt_result) {
470                 key.is_local()
471                     && (tcx.is_closure(key)
472                         || opt_result.map_or(false, |r| !r.concrete_opaque_types.is_empty()))
473             }
474         }
475     }
476
477     TypeChecking {
478         /// Gets a complete map from all types to their inherent impls.
479         /// Not meant to be used directly outside of coherence.
480         /// (Defined only for `LOCAL_CRATE`.)
481         query crate_inherent_impls(k: CrateNum)
482             -> &'tcx CrateInherentImpls {
483             eval_always
484             desc { "all inherent impls defined in crate `{:?}`", k }
485         }
486
487         /// Checks all types in the crate for overlap in their inherent impls. Reports errors.
488         /// Not meant to be used directly outside of coherence.
489         /// (Defined only for `LOCAL_CRATE`.)
490         query crate_inherent_impls_overlap_check(_: CrateNum)
491             -> () {
492             eval_always
493             desc { "check for overlap between inherent impls defined in this crate" }
494         }
495     }
496
497     Other {
498         /// Evaluates a constant without running sanity checks.
499         ///
500         /// **Do not use this** outside const eval. Const eval uses this to break query cycles
501         /// during validation. Please add a comment to every use site explaining why using
502         /// `const_eval_validated` isn't sufficient. The returned constant also isn't in a suitable
503         /// form to be used outside of const eval.
504         query const_eval_raw(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
505             -> ConstEvalRawResult<'tcx> {
506             no_force
507             desc { |tcx|
508                 "const-evaluating `{}`",
509                 tcx.def_path_str(key.value.instance.def.def_id())
510             }
511         }
512
513         /// Results of evaluating const items or constants embedded in
514         /// other items (such as enum variant explicit discriminants).
515         ///
516         /// In contrast to `const_eval_raw` this performs some validation on the constant, and
517         /// returns a proper constant that is usable by the rest of the compiler.
518         ///
519         /// **Do not use this** directly, use one of the following wrappers: `tcx.const_eval_poly`,
520         /// `tcx.const_eval_resolve`, `tcx.const_eval_instance`, or `tcx.const_eval_global_id`.
521         query const_eval_validated(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
522             -> ConstEvalResult<'tcx> {
523             no_force
524             desc { |tcx|
525                 "const-evaluating + checking `{}`",
526                 tcx.def_path_str(key.value.instance.def.def_id())
527             }
528             cache_on_disk_if(_, opt_result) {
529                 // Only store results without errors
530                 opt_result.map_or(true, |r| r.is_ok())
531             }
532         }
533
534         /// Extracts a field of a (variant of a) const.
535         query const_field(
536             key: ty::ParamEnvAnd<'tcx, (&'tcx ty::Const<'tcx>, mir::Field)>
537         ) -> ConstValue<'tcx> {
538             no_force
539             desc { "extract field of const" }
540         }
541
542         /// Destructure a constant ADT or array into its variant indent and its
543         /// field values.
544         query destructure_const(
545             key: ty::ParamEnvAnd<'tcx, &'tcx ty::Const<'tcx>>
546         ) -> mir::DestructuredConst<'tcx> {
547             no_force
548             desc { "destructure constant" }
549         }
550
551         query const_caller_location(key: (rustc_span::Symbol, u32, u32)) -> ConstValue<'tcx> {
552             no_force
553             desc { "get a &core::panic::Location referring to a span" }
554         }
555
556         query lit_to_const(
557             key: LitToConstInput<'tcx>
558         ) -> Result<&'tcx ty::Const<'tcx>, LitToConstError> {
559             no_force
560             desc { "converting literal to const" }
561         }
562     }
563
564     TypeChecking {
565         query check_match(key: DefId) {
566             cache_on_disk_if { key.is_local() }
567         }
568
569         /// Performs part of the privacy check and computes "access levels".
570         query privacy_access_levels(_: CrateNum) -> &'tcx AccessLevels {
571             eval_always
572             desc { "privacy access levels" }
573         }
574         query check_private_in_public(_: CrateNum) -> () {
575             eval_always
576             desc { "checking for private elements in public interfaces" }
577         }
578     }
579
580     Other {
581         query reachable_set(_: CrateNum) -> Lrc<HirIdSet> {
582             desc { "reachability" }
583         }
584
585         /// Per-body `region::ScopeTree`. The `DefId` should be the owner `DefId` for the body;
586         /// in the case of closures, this will be redirected to the enclosing function.
587         query region_scope_tree(_: DefId) -> &'tcx region::ScopeTree {}
588
589         query mir_shims(key: ty::InstanceDef<'tcx>) -> &'tcx mir::BodyAndCache<'tcx> {
590             no_force
591             desc { |tcx| "generating MIR shim for `{}`", tcx.def_path_str(key.def_id()) }
592         }
593
594         /// The `symbol_name` query provides the symbol name for calling a
595         /// given instance from the local crate. In particular, it will also
596         /// look up the correct symbol name of instances from upstream crates.
597         query symbol_name(key: ty::Instance<'tcx>) -> ty::SymbolName {
598             no_force
599             desc { "computing the symbol for `{}`", key }
600             cache_on_disk_if { true }
601         }
602
603         query def_kind(_: DefId) -> Option<DefKind> {}
604         query def_span(_: DefId) -> Span {
605             // FIXME(mw): DefSpans are not really inputs since they are derived from
606             // HIR. But at the moment HIR hashing still contains some hacks that allow
607             // to make type debuginfo to be source location independent. Declaring
608             // DefSpan an input makes sure that changes to these are always detected
609             // regardless of HIR hashing.
610             eval_always
611         }
612         query lookup_stability(_: DefId) -> Option<&'tcx attr::Stability> {}
613         query lookup_const_stability(_: DefId) -> Option<&'tcx attr::ConstStability> {}
614         query lookup_deprecation_entry(_: DefId) -> Option<DeprecationEntry> {}
615         query item_attrs(_: DefId) -> Lrc<[ast::Attribute]> {}
616     }
617
618     Codegen {
619         query codegen_fn_attrs(_: DefId) -> CodegenFnAttrs {
620             cache_on_disk_if { true }
621         }
622     }
623
624     Other {
625         query fn_arg_names(_: DefId) -> Vec<ast::Name> {}
626         /// Gets the rendered value of the specified constant or associated constant.
627         /// Used by rustdoc.
628         query rendered_const(_: DefId) -> String {}
629         query impl_parent(_: DefId) -> Option<DefId> {}
630     }
631
632     TypeChecking {
633         query trait_of_item(_: DefId) -> Option<DefId> {}
634     }
635
636     Codegen {
637         query is_mir_available(key: DefId) -> bool {
638             desc { |tcx| "checking if item has mir available: `{}`", tcx.def_path_str(key) }
639         }
640     }
641
642     Other {
643         query vtable_methods(key: ty::PolyTraitRef<'tcx>)
644                             -> &'tcx [Option<(DefId, SubstsRef<'tcx>)>] {
645             no_force
646             desc { |tcx| "finding all methods for trait {}", tcx.def_path_str(key.def_id()) }
647         }
648     }
649
650     Codegen {
651         query codegen_fulfill_obligation(
652             key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)
653         ) -> Vtable<'tcx, ()> {
654             no_force
655             cache_on_disk_if { true }
656             desc { |tcx|
657                 "checking if `{}` fulfills its obligations",
658                 tcx.def_path_str(key.1.def_id())
659             }
660         }
661     }
662
663     TypeChecking {
664         query trait_impls_of(key: DefId) -> &'tcx ty::trait_def::TraitImpls {
665             desc { |tcx| "trait impls of `{}`", tcx.def_path_str(key) }
666         }
667         query specialization_graph_of(key: DefId) -> &'tcx specialization_graph::Graph {
668             desc { |tcx| "building specialization graph of trait `{}`", tcx.def_path_str(key) }
669             cache_on_disk_if { true }
670         }
671         query object_safety_violations(key: DefId) -> Vec<traits::ObjectSafetyViolation> {
672             desc { |tcx| "determine object safety of trait `{}`", tcx.def_path_str(key) }
673         }
674
675         /// Gets the ParameterEnvironment for a given item; this environment
676         /// will be in "user-facing" mode, meaning that it is suitabe for
677         /// type-checking etc, and it does not normalize specializable
678         /// associated types. This is almost always what you want,
679         /// unless you are doing MIR optimizations, in which case you
680         /// might want to use `reveal_all()` method to change modes.
681         query param_env(_: DefId) -> ty::ParamEnv<'tcx> {}
682
683         /// Trait selection queries. These are best used by invoking `ty.is_copy_modulo_regions()`,
684         /// `ty.is_copy()`, etc, since that will prune the environment where possible.
685         query is_copy_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
686             no_force
687             desc { "computing whether `{}` is `Copy`", env.value }
688         }
689         /// Query backing `TyS::is_sized`.
690         query is_sized_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
691             no_force
692             desc { "computing whether `{}` is `Sized`", env.value }
693         }
694         /// Query backing `TyS::is_freeze`.
695         query is_freeze_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
696             no_force
697             desc { "computing whether `{}` is freeze", env.value }
698         }
699         /// Query backing `TyS::needs_drop`.
700         query needs_drop_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
701             no_force
702             desc { "computing whether `{}` needs drop", env.value }
703         }
704
705         /// A list of types where the ADT requires drop if and only if any of
706         /// those types require drop. If the ADT is known to always need drop
707         /// then `Err(AlwaysRequiresDrop)` is returned.
708         query adt_drop_tys(_: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
709             cache_on_disk_if { true }
710         }
711
712         query layout_raw(
713             env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>
714         ) -> Result<&'tcx ty::layout::LayoutDetails, ty::layout::LayoutError<'tcx>> {
715             no_force
716             desc { "computing layout of `{}`", env.value }
717         }
718     }
719
720     Other {
721         query dylib_dependency_formats(_: CrateNum)
722                                         -> &'tcx [(CrateNum, LinkagePreference)] {
723             desc { "dylib dependency formats of crate" }
724         }
725
726         query dependency_formats(_: CrateNum)
727             -> Lrc<crate::middle::dependency_format::Dependencies>
728         {
729             desc { "get the linkage format of all dependencies" }
730         }
731     }
732
733     Codegen {
734         query is_compiler_builtins(_: CrateNum) -> bool {
735             fatal_cycle
736             desc { "checking if the crate is_compiler_builtins" }
737         }
738         query has_global_allocator(_: CrateNum) -> bool {
739             fatal_cycle
740             desc { "checking if the crate has_global_allocator" }
741         }
742         query has_panic_handler(_: CrateNum) -> bool {
743             fatal_cycle
744             desc { "checking if the crate has_panic_handler" }
745         }
746         query is_profiler_runtime(_: CrateNum) -> bool {
747             fatal_cycle
748             desc { "query a crate is `#![profiler_runtime]`" }
749         }
750         query panic_strategy(_: CrateNum) -> PanicStrategy {
751             fatal_cycle
752             desc { "query a crate's configured panic strategy" }
753         }
754         query is_no_builtins(_: CrateNum) -> bool {
755             fatal_cycle
756             desc { "test whether a crate has `#![no_builtins]`" }
757         }
758         query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
759             fatal_cycle
760             desc { "query a crate's symbol mangling version" }
761         }
762
763         query extern_crate(_: DefId) -> Option<&'tcx ExternCrate> {
764             eval_always
765             desc { "getting crate's ExternCrateData" }
766         }
767     }
768
769     TypeChecking {
770         query specializes(_: (DefId, DefId)) -> bool {
771             no_force
772             desc { "computing whether impls specialize one another" }
773         }
774         query in_scope_traits_map(_: DefIndex)
775             -> Option<&'tcx FxHashMap<ItemLocalId, StableVec<TraitCandidate>>> {
776             eval_always
777             desc { "traits in scope at a block" }
778         }
779     }
780
781     Other {
782         query module_exports(_: DefId) -> Option<&'tcx [Export<hir::HirId>]> {
783             eval_always
784         }
785     }
786
787     TypeChecking {
788         query impl_defaultness(_: DefId) -> hir::Defaultness {}
789
790         query check_item_well_formed(_: DefId) -> () {}
791         query check_trait_item_well_formed(_: DefId) -> () {}
792         query check_impl_item_well_formed(_: DefId) -> () {}
793     }
794
795     Linking {
796         // The `DefId`s of all non-generic functions and statics in the given crate
797         // that can be reached from outside the crate.
798         //
799         // We expect this items to be available for being linked to.
800         //
801         // This query can also be called for `LOCAL_CRATE`. In this case it will
802         // compute which items will be reachable to other crates, taking into account
803         // the kind of crate that is currently compiled. Crates with only a
804         // C interface have fewer reachable things.
805         //
806         // Does not include external symbols that don't have a corresponding DefId,
807         // like the compiler-generated `main` function and so on.
808         query reachable_non_generics(_: CrateNum)
809             -> &'tcx DefIdMap<SymbolExportLevel> {
810             desc { "looking up the exported symbols of a crate" }
811         }
812         query is_reachable_non_generic(_: DefId) -> bool {}
813         query is_unreachable_local_definition(_: DefId) -> bool {}
814     }
815
816     Codegen {
817         /// The entire set of monomorphizations the local crate can safely link
818         /// to because they are exported from upstream crates. Do not depend on
819         /// this directly, as its value changes anytime a monomorphization gets
820         /// added or removed in any upstream crate. Instead use the narrower
821         /// `upstream_monomorphizations_for`, `upstream_drop_glue_for`, or, even
822         /// better, `Instance::upstream_monomorphization()`.
823         query upstream_monomorphizations(
824             k: CrateNum
825         ) -> &'tcx DefIdMap<FxHashMap<SubstsRef<'tcx>, CrateNum>> {
826             desc { "collecting available upstream monomorphizations `{:?}`", k }
827         }
828
829         /// Returns the set of upstream monomorphizations available for the
830         /// generic function identified by the given `def_id`. The query makes
831         /// sure to make a stable selection if the same monomorphization is
832         /// available in multiple upstream crates.
833         ///
834         /// You likely want to call `Instance::upstream_monomorphization()`
835         /// instead of invoking this query directly.
836         query upstream_monomorphizations_for(_: DefId)
837             -> Option<&'tcx FxHashMap<SubstsRef<'tcx>, CrateNum>> {}
838
839         /// Returns the upstream crate that exports drop-glue for the given
840         /// type (`substs` is expected to be a single-item list containing the
841         /// type one wants drop-glue for).
842         ///
843         /// This is a subset of `upstream_monomorphizations_for` in order to
844         /// increase dep-tracking granularity. Otherwise adding or removing any
845         /// type with drop-glue in any upstream crate would invalidate all
846         /// functions calling drop-glue of an upstream type.
847         ///
848         /// You likely want to call `Instance::upstream_monomorphization()`
849         /// instead of invoking this query directly.
850         ///
851         /// NOTE: This query could easily be extended to also support other
852         ///       common functions that have are large set of monomorphizations
853         ///       (like `Clone::clone` for example).
854         query upstream_drop_glue_for(substs: SubstsRef<'tcx>) -> Option<CrateNum> {
855             desc { "available upstream drop-glue for `{:?}`", substs }
856             no_force
857         }
858     }
859
860     Other {
861         query foreign_modules(_: CrateNum) -> &'tcx [ForeignModule] {
862             desc { "looking up the foreign modules of a linked crate" }
863         }
864
865         /// Identifies the entry-point (e.g., the `main` function) for a given
866         /// crate, returning `None` if there is no entry point (such as for library crates).
867         query entry_fn(_: CrateNum) -> Option<(DefId, EntryFnType)> {
868             desc { "looking up the entry function of a crate" }
869         }
870         query plugin_registrar_fn(_: CrateNum) -> Option<DefId> {
871             desc { "looking up the plugin registrar for a crate" }
872         }
873         query proc_macro_decls_static(_: CrateNum) -> Option<DefId> {
874             desc { "looking up the derive registrar for a crate" }
875         }
876         query crate_disambiguator(_: CrateNum) -> CrateDisambiguator {
877             eval_always
878             desc { "looking up the disambiguator a crate" }
879         }
880         query crate_hash(_: CrateNum) -> Svh {
881             eval_always
882             desc { "looking up the hash a crate" }
883         }
884         query crate_host_hash(_: CrateNum) -> Option<Svh> {
885             eval_always
886             desc { "looking up the hash of a host version of a crate" }
887         }
888         query original_crate_name(_: CrateNum) -> Symbol {
889             eval_always
890             desc { "looking up the original name a crate" }
891         }
892         query extra_filename(_: CrateNum) -> String {
893             eval_always
894             desc { "looking up the extra filename for a crate" }
895         }
896     }
897
898     TypeChecking {
899         query implementations_of_trait(_: (CrateNum, DefId))
900             -> &'tcx [DefId] {
901             no_force
902             desc { "looking up implementations of a trait in a crate" }
903         }
904         query all_trait_implementations(_: CrateNum)
905             -> &'tcx [DefId] {
906             desc { "looking up all (?) trait implementations" }
907         }
908     }
909
910     Other {
911         query dllimport_foreign_items(_: CrateNum)
912             -> &'tcx FxHashSet<DefId> {
913             desc { "dllimport_foreign_items" }
914         }
915         query is_dllimport_foreign_item(_: DefId) -> bool {}
916         query is_statically_included_foreign_item(_: DefId) -> bool {}
917         query native_library_kind(_: DefId)
918             -> Option<NativeLibraryKind> {}
919     }
920
921     Linking {
922         query link_args(_: CrateNum) -> Lrc<Vec<String>> {
923             eval_always
924             desc { "looking up link arguments for a crate" }
925         }
926     }
927
928     BorrowChecking {
929         /// Lifetime resolution. See `middle::resolve_lifetimes`.
930         query resolve_lifetimes(_: CrateNum) -> &'tcx ResolveLifetimes {
931             desc { "resolving lifetimes" }
932         }
933         query named_region_map(_: DefIndex) ->
934             Option<&'tcx FxHashMap<ItemLocalId, Region>> {
935             desc { "looking up a named region" }
936         }
937         query is_late_bound_map(_: DefIndex) ->
938             Option<&'tcx FxHashSet<ItemLocalId>> {
939             desc { "testing if a region is late bound" }
940         }
941         query object_lifetime_defaults_map(_: DefIndex)
942             -> Option<&'tcx FxHashMap<ItemLocalId, Vec<ObjectLifetimeDefault>>> {
943             desc { "looking up lifetime defaults for a region" }
944         }
945     }
946
947     TypeChecking {
948         query visibility(_: DefId) -> ty::Visibility {}
949     }
950
951     Other {
952         query dep_kind(_: CrateNum) -> DepKind {
953             eval_always
954             desc { "fetching what a dependency looks like" }
955         }
956         query crate_name(_: CrateNum) -> Symbol {
957             eval_always
958             desc { "fetching what a crate is named" }
959         }
960         query item_children(_: DefId) -> &'tcx [Export<hir::HirId>] {}
961         query extern_mod_stmt_cnum(_: DefId) -> Option<CrateNum> {}
962
963         query get_lib_features(_: CrateNum) -> &'tcx LibFeatures {
964             eval_always
965             desc { "calculating the lib features map" }
966         }
967         query defined_lib_features(_: CrateNum)
968             -> &'tcx [(Symbol, Option<Symbol>)] {
969             desc { "calculating the lib features defined in a crate" }
970         }
971         /// Returns the lang items defined in another crate by loading it from metadata.
972         // FIXME: It is illegal to pass a `CrateNum` other than `LOCAL_CRATE` here, just get rid
973         // of that argument?
974         query get_lang_items(_: CrateNum) -> &'tcx LanguageItems {
975             eval_always
976             desc { "calculating the lang items map" }
977         }
978
979         /// Returns all diagnostic items defined in all crates.
980         query all_diagnostic_items(_: CrateNum) -> &'tcx FxHashMap<Symbol, DefId> {
981             eval_always
982             desc { "calculating the diagnostic items map" }
983         }
984
985         /// Returns the lang items defined in another crate by loading it from metadata.
986         query defined_lang_items(_: CrateNum) -> &'tcx [(DefId, usize)] {
987             desc { "calculating the lang items defined in a crate" }
988         }
989
990         /// Returns the diagnostic items defined in a crate.
991         query diagnostic_items(_: CrateNum) -> &'tcx FxHashMap<Symbol, DefId> {
992             desc { "calculating the diagnostic items map in a crate" }
993         }
994
995         query missing_lang_items(_: CrateNum) -> &'tcx [LangItem] {
996             desc { "calculating the missing lang items in a crate" }
997         }
998         query visible_parent_map(_: CrateNum)
999             -> &'tcx DefIdMap<DefId> {
1000             desc { "calculating the visible parent map" }
1001         }
1002         query missing_extern_crate_item(_: CrateNum) -> bool {
1003             eval_always
1004             desc { "seeing if we're missing an `extern crate` item for this crate" }
1005         }
1006         query used_crate_source(_: CrateNum) -> Lrc<CrateSource> {
1007             eval_always
1008             desc { "looking at the source for a crate" }
1009         }
1010         query postorder_cnums(_: CrateNum) -> &'tcx [CrateNum] {
1011             eval_always
1012             desc { "generating a postorder list of CrateNums" }
1013         }
1014
1015         query upvars(_: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
1016             eval_always
1017         }
1018         query maybe_unused_trait_import(_: DefId) -> bool {
1019             eval_always
1020         }
1021         query maybe_unused_extern_crates(_: CrateNum)
1022             -> &'tcx [(DefId, Span)] {
1023             eval_always
1024             desc { "looking up all possibly unused extern crates" }
1025         }
1026         query names_imported_by_glob_use(_: DefId)
1027             -> Lrc<FxHashSet<ast::Name>> {
1028             eval_always
1029         }
1030
1031         query stability_index(_: CrateNum) -> &'tcx stability::Index<'tcx> {
1032             eval_always
1033             desc { "calculating the stability index for the local crate" }
1034         }
1035         query all_crate_nums(_: CrateNum) -> &'tcx [CrateNum] {
1036             eval_always
1037             desc { "fetching all foreign CrateNum instances" }
1038         }
1039
1040         /// A vector of every trait accessible in the whole crate
1041         /// (i.e., including those from subcrates). This is used only for
1042         /// error reporting.
1043         query all_traits(_: CrateNum) -> &'tcx [DefId] {
1044             desc { "fetching all foreign and local traits" }
1045         }
1046     }
1047
1048     Linking {
1049         /// The list of symbols exported from the given crate.
1050         ///
1051         /// - All names contained in `exported_symbols(cnum)` are guaranteed to
1052         ///   correspond to a publicly visible symbol in `cnum` machine code.
1053         /// - The `exported_symbols` sets of different crates do not intersect.
1054         query exported_symbols(_: CrateNum)
1055             -> Arc<Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)>> {
1056             desc { "exported_symbols" }
1057         }
1058     }
1059
1060     Codegen {
1061         query collect_and_partition_mono_items(_: CrateNum)
1062             -> (Arc<DefIdSet>, Arc<Vec<Arc<CodegenUnit<'tcx>>>>) {
1063             eval_always
1064             desc { "collect_and_partition_mono_items" }
1065         }
1066         query is_codegened_item(_: DefId) -> bool {}
1067         query codegen_unit(_: Symbol) -> Arc<CodegenUnit<'tcx>> {
1068             no_force
1069             desc { "codegen_unit" }
1070         }
1071         query backend_optimization_level(_: CrateNum) -> OptLevel {
1072             desc { "optimization level used by backend" }
1073         }
1074     }
1075
1076     Other {
1077         query output_filenames(_: CrateNum) -> Arc<OutputFilenames> {
1078             eval_always
1079             desc { "output_filenames" }
1080         }
1081     }
1082
1083     TypeChecking {
1084         /// Do not call this query directly: invoke `normalize` instead.
1085         query normalize_projection_ty(
1086             goal: CanonicalProjectionGoal<'tcx>
1087         ) -> Result<
1088             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
1089             NoSolution,
1090         > {
1091             no_force
1092             desc { "normalizing `{:?}`", goal }
1093         }
1094
1095         /// Do not call this query directly: invoke `normalize_erasing_regions` instead.
1096         query normalize_ty_after_erasing_regions(
1097             goal: ParamEnvAnd<'tcx, Ty<'tcx>>
1098         ) -> Ty<'tcx> {
1099             no_force
1100             desc { "normalizing `{:?}`", goal }
1101         }
1102
1103         query implied_outlives_bounds(
1104             goal: CanonicalTyGoal<'tcx>
1105         ) -> Result<
1106             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>,
1107             NoSolution,
1108         > {
1109             no_force
1110             desc { "computing implied outlives bounds for `{:?}`", goal }
1111         }
1112
1113         /// Do not call this query directly: invoke `infcx.at().dropck_outlives()` instead.
1114         query dropck_outlives(
1115             goal: CanonicalTyGoal<'tcx>
1116         ) -> Result<
1117             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>,
1118             NoSolution,
1119         > {
1120             no_force
1121             desc { "computing dropck types for `{:?}`", goal }
1122         }
1123
1124         /// Do not call this query directly: invoke `infcx.predicate_may_hold()` or
1125         /// `infcx.predicate_must_hold()` instead.
1126         query evaluate_obligation(
1127             goal: CanonicalPredicateGoal<'tcx>
1128         ) -> Result<traits::EvaluationResult, traits::OverflowError> {
1129             no_force
1130             desc { "evaluating trait selection obligation `{}`", goal.value.value }
1131         }
1132
1133         query evaluate_goal(
1134             goal: traits::ChalkCanonicalGoal<'tcx>
1135         ) -> Result<
1136             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
1137             NoSolution
1138         > {
1139             no_force
1140             desc { "evaluating trait selection obligation `{}`", goal.value.goal }
1141         }
1142
1143         /// Do not call this query directly: part of the `Eq` type-op
1144         query type_op_ascribe_user_type(
1145             goal: CanonicalTypeOpAscribeUserTypeGoal<'tcx>
1146         ) -> Result<
1147             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
1148             NoSolution,
1149         > {
1150             no_force
1151             desc { "evaluating `type_op_ascribe_user_type` `{:?}`", goal }
1152         }
1153
1154         /// Do not call this query directly: part of the `Eq` type-op
1155         query type_op_eq(
1156             goal: CanonicalTypeOpEqGoal<'tcx>
1157         ) -> Result<
1158             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
1159             NoSolution,
1160         > {
1161             no_force
1162             desc { "evaluating `type_op_eq` `{:?}`", goal }
1163         }
1164
1165         /// Do not call this query directly: part of the `Subtype` type-op
1166         query type_op_subtype(
1167             goal: CanonicalTypeOpSubtypeGoal<'tcx>
1168         ) -> Result<
1169             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
1170             NoSolution,
1171         > {
1172             no_force
1173             desc { "evaluating `type_op_subtype` `{:?}`", goal }
1174         }
1175
1176         /// Do not call this query directly: part of the `ProvePredicate` type-op
1177         query type_op_prove_predicate(
1178             goal: CanonicalTypeOpProvePredicateGoal<'tcx>
1179         ) -> Result<
1180             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
1181             NoSolution,
1182         > {
1183             no_force
1184             desc { "evaluating `type_op_prove_predicate` `{:?}`", goal }
1185         }
1186
1187         /// Do not call this query directly: part of the `Normalize` type-op
1188         query type_op_normalize_ty(
1189             goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>
1190         ) -> Result<
1191             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Ty<'tcx>>>,
1192             NoSolution,
1193         > {
1194             no_force
1195             desc { "normalizing `{:?}`", goal }
1196         }
1197
1198         /// Do not call this query directly: part of the `Normalize` type-op
1199         query type_op_normalize_predicate(
1200             goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::Predicate<'tcx>>
1201         ) -> Result<
1202             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::Predicate<'tcx>>>,
1203             NoSolution,
1204         > {
1205             no_force
1206             desc { "normalizing `{:?}`", goal }
1207         }
1208
1209         /// Do not call this query directly: part of the `Normalize` type-op
1210         query type_op_normalize_poly_fn_sig(
1211             goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::PolyFnSig<'tcx>>
1212         ) -> Result<
1213             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::PolyFnSig<'tcx>>>,
1214             NoSolution,
1215         > {
1216             no_force
1217             desc { "normalizing `{:?}`", goal }
1218         }
1219
1220         /// Do not call this query directly: part of the `Normalize` type-op
1221         query type_op_normalize_fn_sig(
1222             goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>
1223         ) -> Result<
1224             &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::FnSig<'tcx>>>,
1225             NoSolution,
1226         > {
1227             no_force
1228             desc { "normalizing `{:?}`", goal }
1229         }
1230
1231         query substitute_normalize_and_test_predicates(key: (DefId, SubstsRef<'tcx>)) -> bool {
1232             no_force
1233             desc { |tcx|
1234                 "testing substituted normalized predicates:`{}`",
1235                 tcx.def_path_str(key.0)
1236             }
1237         }
1238
1239         query method_autoderef_steps(
1240             goal: CanonicalTyGoal<'tcx>
1241         ) -> MethodAutoderefStepsResult<'tcx> {
1242             no_force
1243             desc { "computing autoderef types for `{:?}`", goal }
1244         }
1245     }
1246
1247     Other {
1248         query target_features_whitelist(_: CrateNum) -> &'tcx FxHashMap<String, Option<Symbol>> {
1249             eval_always
1250             desc { "looking up the whitelist of target features" }
1251         }
1252
1253         // Get an estimate of the size of an InstanceDef based on its MIR for CGU partitioning.
1254         query instance_def_size_estimate(def: ty::InstanceDef<'tcx>)
1255             -> usize {
1256             no_force
1257             desc { |tcx| "estimating size for `{}`", tcx.def_path_str(def.def_id()) }
1258         }
1259
1260         query features_query(_: CrateNum) -> &'tcx rustc_feature::Features {
1261             eval_always
1262             desc { "looking up enabled feature gates" }
1263         }
1264     }
1265 }