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