1 // Each of these queries corresponds to a function pointer field in the
2 // `Providers` struct for requesting a value of that type, and a method
3 // on `tcx: TyCtxt` (and `tcx.at(span)`) for doing that request in a way
4 // which memoizes and does dep-graph tracking, wrapping around the actual
5 // `Providers` that the driver creates (using several `rustc_*` crates).
7 // The result type of each query must implement `Clone`, and additionally
8 // `ty::query::values::Value`, which produces an appropriate placeholder
9 // (error) value if the query resulted in a query cycle.
10 // Queries marked with `fatal_cycle` do not need the latter implementation,
11 // as they will raise an fatal error on query cycles instead.
13 query trigger_delay_span_bug(key: DefId) -> () {
14 desc { "trigger a delay span bug" }
17 query resolutions(_: ()) -> &'tcx ty::ResolverOutputs {
20 desc { "get the resolver outputs" }
23 /// Represents crate as a whole (as distinct from the top-level crate module).
24 /// If you call `hir_crate` (e.g., indirectly by calling `tcx.hir().krate()`),
25 /// we will have to assume that any change means that you need to be recompiled.
26 /// This is because the `hir_crate` query gives you access to all other items.
27 /// To avoid this fate, do not call `tcx.hir().krate()`; instead,
28 /// prefer wrappers like `tcx.visit_all_items_in_krate()`.
29 query hir_crate(key: ()) -> &'tcx Crate<'tcx> {
32 desc { "get the crate HIR" }
35 /// The indexed HIR. This can be conveniently accessed by `tcx.hir()`.
36 /// Avoid calling this query directly.
37 query index_hir(_: ()) -> &'tcx crate::hir::IndexedHir<'tcx> {
43 /// The items in a module.
45 /// This can be conveniently accessed by `tcx.hir().visit_item_likes_in_module`.
46 /// Avoid calling this query directly.
47 query hir_module_items(key: LocalDefId) -> &'tcx hir::ModuleItems {
49 desc { |tcx| "HIR module items in `{}`", tcx.def_path_str(key.to_def_id()) }
52 /// Gives access to the HIR node for the HIR owner `key`.
54 /// This can be conveniently accessed by methods on `tcx.hir()`.
55 /// Avoid calling this query directly.
56 query hir_owner(key: LocalDefId) -> Option<crate::hir::Owner<'tcx>> {
58 desc { |tcx| "HIR owner of `{}`", tcx.def_path_str(key.to_def_id()) }
61 /// Gives access to the HIR node's parent for the HIR owner `key`.
63 /// This can be conveniently accessed by methods on `tcx.hir()`.
64 /// Avoid calling this query directly.
65 query hir_owner_parent(key: LocalDefId) -> hir::HirId {
67 desc { |tcx| "HIR parent of `{}`", tcx.def_path_str(key.to_def_id()) }
70 /// Gives access to the HIR nodes and bodies inside the HIR owner `key`.
72 /// This can be conveniently accessed by methods on `tcx.hir()`.
73 /// Avoid calling this query directly.
74 query hir_owner_nodes(key: LocalDefId) -> Option<&'tcx crate::hir::OwnerNodes<'tcx>> {
76 desc { |tcx| "HIR owner items in `{}`", tcx.def_path_str(key.to_def_id()) }
79 /// Gives access to the HIR attributes inside the HIR owner `key`.
81 /// This can be conveniently accessed by methods on `tcx.hir()`.
82 /// Avoid calling this query directly.
83 query hir_attrs(key: LocalDefId) -> rustc_middle::hir::AttributeMap<'tcx> {
85 desc { |tcx| "HIR owner attributes in `{}`", tcx.def_path_str(key.to_def_id()) }
88 /// Computes the `DefId` of the corresponding const parameter in case the `key` is a
89 /// const argument and returns `None` otherwise.
91 /// ```ignore (incomplete)
92 /// let a = foo::<7>();
93 /// // ^ Calling `opt_const_param_of` for this argument,
95 /// fn foo<const N: usize>()
96 /// // ^ returns this `DefId`.
99 /// // ^ While calling `opt_const_param_of` for other bodies returns `None`.
102 // It looks like caching this query on disk actually slightly
103 // worsened performance in #74376.
105 // Once const generics are more prevalently used, we might want to
106 // consider only caching calls returning `Some`.
107 query opt_const_param_of(key: LocalDefId) -> Option<DefId> {
108 desc { |tcx| "computing the optional const parameter of `{}`", tcx.def_path_str(key.to_def_id()) }
111 /// Given the def_id of a const-generic parameter, computes the associated default const
112 /// parameter. e.g. `fn example<const N: usize=3>` called on `N` would return `3`.
113 query const_param_default(param: DefId) -> &'tcx ty::Const<'tcx> {
114 desc { |tcx| "compute const default for a given parameter `{}`", tcx.def_path_str(param) }
117 /// Records the type of every item.
118 query type_of(key: DefId) -> Ty<'tcx> {
119 desc { |tcx| "computing type of `{}`", tcx.def_path_str(key) }
120 cache_on_disk_if { key.is_local() }
123 query analysis(key: ()) -> Result<(), ErrorReported> {
125 desc { "running analysis passes on this crate" }
128 /// Maps from the `DefId` of an item (trait/struct/enum/fn) to its
129 /// associated generics.
130 query generics_of(key: DefId) -> ty::Generics {
131 desc { |tcx| "computing generics of `{}`", tcx.def_path_str(key) }
132 storage(ArenaCacheSelector<'tcx>)
133 cache_on_disk_if { key.is_local() }
136 /// Maps from the `DefId` of an item (trait/struct/enum/fn) to the
137 /// predicates (where-clauses) that must be proven true in order
138 /// to reference it. This is almost always the "predicates query"
141 /// `predicates_of` builds on `predicates_defined_on` -- in fact,
142 /// it is almost always the same as that query, except for the
143 /// case of traits. For traits, `predicates_of` contains
144 /// an additional `Self: Trait<...>` predicate that users don't
145 /// actually write. This reflects the fact that to invoke the
146 /// trait (e.g., via `Default::default`) you must supply types
147 /// that actually implement the trait. (However, this extra
148 /// predicate gets in the way of some checks, which are intended
149 /// to operate over only the actual where-clauses written by the
151 query predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
152 desc { |tcx| "computing predicates of `{}`", tcx.def_path_str(key) }
153 cache_on_disk_if { key.is_local() }
156 /// Returns the list of bounds that can be used for
157 /// `SelectionCandidate::ProjectionCandidate(_)` and
158 /// `ProjectionTyCandidate::TraitDef`.
159 /// Specifically this is the bounds written on the trait's type
160 /// definition, or those after the `impl` keyword
162 /// ```ignore (incomplete)
163 /// type X: Bound + 'lt
165 /// impl Debug + Display
166 /// // ^^^^^^^^^^^^^^^
169 /// `key` is the `DefId` of the associated type or opaque type.
171 /// Bounds from the parent (e.g. with nested impl trait) are not included.
172 query explicit_item_bounds(key: DefId) -> &'tcx [(ty::Predicate<'tcx>, Span)] {
173 desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
176 /// Elaborated version of the predicates from `explicit_item_bounds`.
182 /// type MyAType: Eq + ?Sized;
186 /// `explicit_item_bounds` returns `[<Self as MyTrait>::MyAType: Eq]`,
187 /// and `item_bounds` returns
190 /// <Self as Trait>::MyAType: Eq,
191 /// <Self as Trait>::MyAType: PartialEq<<Self as Trait>::MyAType>
195 /// Bounds from the parent (e.g. with nested impl trait) are not included.
196 query item_bounds(key: DefId) -> &'tcx ty::List<ty::Predicate<'tcx>> {
197 desc { |tcx| "elaborating item bounds for `{}`", tcx.def_path_str(key) }
200 query native_libraries(_: CrateNum) -> Lrc<Vec<NativeLib>> {
201 desc { "looking up the native libraries of a linked crate" }
204 query lint_levels(_: ()) -> LintLevelMap {
205 storage(ArenaCacheSelector<'tcx>)
207 desc { "computing the lint levels for items in this crate" }
210 query parent_module_from_def_id(key: LocalDefId) -> LocalDefId {
212 desc { |tcx| "parent module of `{}`", tcx.def_path_str(key.to_def_id()) }
215 query expn_that_defined(key: DefId) -> rustc_span::ExpnId {
216 // This query reads from untracked data in definitions.
218 desc { |tcx| "expansion that defined `{}`", tcx.def_path_str(key) }
221 query is_panic_runtime(_: CrateNum) -> bool {
223 desc { "checking if the crate is_panic_runtime" }
226 /// Fetch the THIR for a given body. If typeck for that body failed, returns an empty `Thir`.
227 query thir_body(key: ty::WithOptConstParam<LocalDefId>) -> (&'tcx Steal<thir::Thir<'tcx>>, thir::ExprId) {
228 // Perf tests revealed that hashing THIR is inefficient (see #85729).
230 desc { |tcx| "building THIR for `{}`", tcx.def_path_str(key.did.to_def_id()) }
233 /// Create a THIR tree for debugging.
234 query thir_tree(key: ty::WithOptConstParam<LocalDefId>) -> String {
236 desc { |tcx| "constructing THIR tree for `{}`", tcx.def_path_str(key.did.to_def_id()) }
239 /// Set of all the `DefId`s in this crate that have MIR associated with
240 /// them. This includes all the body owners, but also things like struct
242 query mir_keys(_: ()) -> FxHashSet<LocalDefId> {
243 storage(ArenaCacheSelector<'tcx>)
244 desc { "getting a list of all mir_keys" }
247 /// Maps DefId's that have an associated `mir::Body` to the result
248 /// of the MIR const-checking pass. This is the set of qualifs in
249 /// the final value of a `const`.
250 query mir_const_qualif(key: DefId) -> mir::ConstQualifs {
251 desc { |tcx| "const checking `{}`", tcx.def_path_str(key) }
252 cache_on_disk_if { key.is_local() }
254 query mir_const_qualif_const_arg(
255 key: (LocalDefId, DefId)
256 ) -> mir::ConstQualifs {
258 |tcx| "const checking the const argument `{}`",
259 tcx.def_path_str(key.0.to_def_id())
263 /// Fetch the MIR for a given `DefId` right after it's built - this includes
264 /// unreachable code.
265 query mir_built(key: ty::WithOptConstParam<LocalDefId>) -> &'tcx Steal<mir::Body<'tcx>> {
266 desc { |tcx| "building MIR for `{}`", tcx.def_path_str(key.did.to_def_id()) }
269 /// Fetch the MIR for a given `DefId` up till the point where it is
270 /// ready for const qualification.
272 /// See the README for the `mir` module for details.
273 query mir_const(key: ty::WithOptConstParam<LocalDefId>) -> &'tcx Steal<mir::Body<'tcx>> {
275 |tcx| "processing MIR for {}`{}`",
276 if key.const_param_did.is_some() { "the const argument " } else { "" },
277 tcx.def_path_str(key.did.to_def_id()),
282 /// Try to build an abstract representation of the given constant.
283 query mir_abstract_const(
285 ) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
287 |tcx| "building an abstract representation for {}", tcx.def_path_str(key),
290 /// Try to build an abstract representation of the given constant.
291 query mir_abstract_const_of_const_arg(
292 key: (LocalDefId, DefId)
293 ) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
296 "building an abstract representation for the const argument {}",
297 tcx.def_path_str(key.0.to_def_id()),
301 query try_unify_abstract_consts(key: (
302 (ty::WithOptConstParam<DefId>, SubstsRef<'tcx>),
303 (ty::WithOptConstParam<DefId>, SubstsRef<'tcx>)
306 |tcx| "trying to unify the generic constants {} and {}",
307 tcx.def_path_str(key.0.0.did), tcx.def_path_str(key.1.0.did)
311 query mir_drops_elaborated_and_const_checked(
312 key: ty::WithOptConstParam<LocalDefId>
313 ) -> &'tcx Steal<mir::Body<'tcx>> {
315 desc { |tcx| "elaborating drops for `{}`", tcx.def_path_str(key.did.to_def_id()) }
320 ) -> &'tcx mir::Body<'tcx> {
321 desc { |tcx| "caching mir of `{}` for CTFE", tcx.def_path_str(key) }
322 cache_on_disk_if { key.is_local() }
325 query mir_for_ctfe_of_const_arg(key: (LocalDefId, DefId)) -> &'tcx mir::Body<'tcx> {
327 |tcx| "MIR for CTFE of the const argument `{}`",
328 tcx.def_path_str(key.0.to_def_id())
332 query mir_promoted(key: ty::WithOptConstParam<LocalDefId>) ->
334 &'tcx Steal<mir::Body<'tcx>>,
335 &'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>>
339 |tcx| "processing {}`{}`",
340 if key.const_param_did.is_some() { "the const argument " } else { "" },
341 tcx.def_path_str(key.did.to_def_id()),
345 query symbols_for_closure_captures(
346 key: (LocalDefId, DefId)
347 ) -> Vec<rustc_span::Symbol> {
349 |tcx| "symbols for captures of closure `{}` in `{}`",
350 tcx.def_path_str(key.1),
351 tcx.def_path_str(key.0.to_def_id())
355 /// MIR after our optimization passes have run. This is MIR that is ready
356 /// for codegen. This is also the only query that can fetch non-local MIR, at present.
357 query optimized_mir(key: DefId) -> &'tcx mir::Body<'tcx> {
358 desc { |tcx| "optimizing MIR for `{}`", tcx.def_path_str(key) }
359 cache_on_disk_if { key.is_local() }
362 /// Returns coverage summary info for a function, after executing the `InstrumentCoverage`
363 /// MIR pass (assuming the -Zinstrument-coverage option is enabled).
364 query coverageinfo(key: ty::InstanceDef<'tcx>) -> mir::CoverageInfo {
365 desc { |tcx| "retrieving coverage info from MIR for `{}`", tcx.def_path_str(key.def_id()) }
366 storage(ArenaCacheSelector<'tcx>)
369 /// Returns the name of the file that contains the function body, if instrumented for coverage.
370 query covered_file_name(key: DefId) -> Option<Symbol> {
372 |tcx| "retrieving the covered file name, if instrumented, for `{}`",
373 tcx.def_path_str(key)
375 storage(ArenaCacheSelector<'tcx>)
376 cache_on_disk_if { key.is_local() }
379 /// Returns the `CodeRegions` for a function that has instrumented coverage, in case the
380 /// function was optimized out before codegen, and before being added to the Coverage Map.
381 query covered_code_regions(key: DefId) -> Vec<&'tcx mir::coverage::CodeRegion> {
383 |tcx| "retrieving the covered `CodeRegion`s, if instrumented, for `{}`",
384 tcx.def_path_str(key)
386 storage(ArenaCacheSelector<'tcx>)
387 cache_on_disk_if { key.is_local() }
390 /// The `DefId` is the `DefId` of the containing MIR body. Promoteds do not have their own
391 /// `DefId`. This function returns all promoteds in the specified body. The body references
392 /// promoteds by the `DefId` and the `mir::Promoted` index. This is necessary, because
393 /// after inlining a body may refer to promoteds from other bodies. In that case you still
394 /// need to use the `DefId` of the original body.
395 query promoted_mir(key: DefId) -> &'tcx IndexVec<mir::Promoted, mir::Body<'tcx>> {
396 desc { |tcx| "optimizing promoted MIR for `{}`", tcx.def_path_str(key) }
397 cache_on_disk_if { key.is_local() }
399 query promoted_mir_of_const_arg(
400 key: (LocalDefId, DefId)
401 ) -> &'tcx IndexVec<mir::Promoted, mir::Body<'tcx>> {
403 |tcx| "optimizing promoted MIR for the const argument `{}`",
404 tcx.def_path_str(key.0.to_def_id()),
408 /// Erases regions from `ty` to yield a new type.
409 /// Normally you would just use `tcx.erase_regions(value)`,
410 /// however, which uses this query as a kind of cache.
411 query erase_regions_ty(ty: Ty<'tcx>) -> Ty<'tcx> {
412 // This query is not expected to have input -- as a result, it
413 // is not a good candidates for "replay" because it is essentially a
414 // pure function of its input (and hence the expectation is that
415 // no caller would be green **apart** from just these
416 // queries). Making it anonymous avoids hashing the result, which
417 // may save a bit of time.
419 desc { "erasing regions from `{:?}`", ty }
422 query wasm_import_module_map(_: CrateNum) -> FxHashMap<DefId, String> {
423 storage(ArenaCacheSelector<'tcx>)
424 desc { "wasm import module map" }
427 /// Maps from the `DefId` of an item (trait/struct/enum/fn) to the
428 /// predicates (where-clauses) directly defined on it. This is
429 /// equal to the `explicit_predicates_of` predicates plus the
430 /// `inferred_outlives_of` predicates.
431 query predicates_defined_on(key: DefId) -> ty::GenericPredicates<'tcx> {
432 desc { |tcx| "computing predicates of `{}`", tcx.def_path_str(key) }
435 /// Returns everything that looks like a predicate written explicitly
436 /// by the user on a trait item.
438 /// Traits are unusual, because predicates on associated types are
439 /// converted into bounds on that type for backwards compatibility:
441 /// trait X where Self::U: Copy { type U; }
445 /// trait X { type U: Copy; }
447 /// `explicit_predicates_of` and `explicit_item_bounds` will then take
448 /// the appropriate subsets of the predicates here.
449 query trait_explicit_predicates_and_bounds(key: LocalDefId) -> ty::GenericPredicates<'tcx> {
450 desc { |tcx| "computing explicit predicates of trait `{}`", tcx.def_path_str(key.to_def_id()) }
453 /// Returns the predicates written explicitly by the user.
454 query explicit_predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
455 desc { |tcx| "computing explicit predicates of `{}`", tcx.def_path_str(key) }
458 /// Returns the inferred outlives predicates (e.g., for `struct
459 /// Foo<'a, T> { x: &'a T }`, this would return `T: 'a`).
460 query inferred_outlives_of(key: DefId) -> &'tcx [(ty::Predicate<'tcx>, Span)] {
461 desc { |tcx| "computing inferred outlives predicates of `{}`", tcx.def_path_str(key) }
464 /// Maps from the `DefId` of a trait to the list of
465 /// super-predicates. This is a subset of the full list of
466 /// predicates. We store these in a separate map because we must
467 /// evaluate them even during type conversion, often before the
468 /// full predicates are available (note that supertraits have
469 /// additional acyclicity requirements).
470 query super_predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
471 desc { |tcx| "computing the super predicates of `{}`", tcx.def_path_str(key) }
474 /// The `Option<Ident>` is the name of an associated type. If it is `None`, then this query
475 /// returns the full set of predicates. If `Some<Ident>`, then the query returns only the
476 /// subset of super-predicates that reference traits that define the given associated type.
477 /// This is used to avoid cycles in resolving types like `T::Item`.
478 query super_predicates_that_define_assoc_type(key: (DefId, Option<rustc_span::symbol::Ident>)) -> ty::GenericPredicates<'tcx> {
479 desc { |tcx| "computing the super traits of `{}`{}",
480 tcx.def_path_str(key.0),
481 if let Some(assoc_name) = key.1 { format!(" with associated type name `{}`", assoc_name) } else { "".to_string() },
485 /// To avoid cycles within the predicates of a single item we compute
486 /// per-type-parameter predicates for resolving `T::AssocTy`.
487 query type_param_predicates(key: (DefId, LocalDefId, rustc_span::symbol::Ident)) -> ty::GenericPredicates<'tcx> {
488 desc { |tcx| "computing the bounds for type parameter `{}`", {
489 let id = tcx.hir().local_def_id_to_hir_id(key.1);
490 tcx.hir().ty_param_name(id)
494 query trait_def(key: DefId) -> ty::TraitDef {
495 desc { |tcx| "computing trait definition for `{}`", tcx.def_path_str(key) }
496 storage(ArenaCacheSelector<'tcx>)
498 query adt_def(key: DefId) -> &'tcx ty::AdtDef {
499 desc { |tcx| "computing ADT definition for `{}`", tcx.def_path_str(key) }
501 query adt_destructor(key: DefId) -> Option<ty::Destructor> {
502 desc { |tcx| "computing `Drop` impl for `{}`", tcx.def_path_str(key) }
505 // The cycle error here should be reported as an error by `check_representable`.
506 // We consider the type as Sized in the meanwhile to avoid
507 // further errors (done in impl Value for AdtSizedConstraint).
508 // Use `cycle_delay_bug` to delay the cycle error here to be emitted later
509 // in case we accidentally otherwise don't emit an error.
510 query adt_sized_constraint(
512 ) -> AdtSizedConstraint<'tcx> {
513 desc { |tcx| "computing `Sized` constraints for `{}`", tcx.def_path_str(key) }
517 query adt_dtorck_constraint(
519 ) -> Result<DtorckConstraint<'tcx>, NoSolution> {
520 desc { |tcx| "computing drop-check constraints for `{}`", tcx.def_path_str(key) }
523 /// Returns `true` if this is a const fn, use the `is_const_fn` to know whether your crate
524 /// actually sees it as const fn (e.g., the const-fn-ness might be unstable and you might
525 /// not have the feature gate active).
527 /// **Do not call this function manually.** It is only meant to cache the base data for the
528 /// `is_const_fn` function.
529 query is_const_fn_raw(key: DefId) -> bool {
530 desc { |tcx| "checking if item is const fn: `{}`", tcx.def_path_str(key) }
533 /// Returns `true` if this is a const `impl`. **Do not call this function manually.**
535 /// This query caches the base data for the `is_const_impl` helper function, which also
536 /// takes into account stability attributes (e.g., `#[rustc_const_unstable]`).
537 query is_const_impl_raw(key: DefId) -> bool {
538 desc { |tcx| "checking if item is const impl: `{}`", tcx.def_path_str(key) }
541 query asyncness(key: DefId) -> hir::IsAsync {
542 desc { |tcx| "checking if the function is async: `{}`", tcx.def_path_str(key) }
545 /// Returns `true` if calls to the function may be promoted.
547 /// This is either because the function is e.g., a tuple-struct or tuple-variant
548 /// constructor, or because it has the `#[rustc_promotable]` attribute. The attribute should
549 /// be removed in the future in favour of some form of check which figures out whether the
550 /// function does not inspect the bits of any of its arguments (so is essentially just a
551 /// constructor function).
552 query is_promotable_const_fn(key: DefId) -> bool {
553 desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) }
556 /// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
557 query is_foreign_item(key: DefId) -> bool {
558 desc { |tcx| "checking if `{}` is a foreign item", tcx.def_path_str(key) }
561 /// Returns `Some(mutability)` if the node pointed to by `def_id` is a static item.
562 query static_mutability(def_id: DefId) -> Option<hir::Mutability> {
563 desc { |tcx| "looking up static mutability of `{}`", tcx.def_path_str(def_id) }
566 /// Returns `Some(generator_kind)` if the node pointed to by `def_id` is a generator.
567 query generator_kind(def_id: DefId) -> Option<hir::GeneratorKind> {
568 desc { |tcx| "looking up generator kind of `{}`", tcx.def_path_str(def_id) }
571 /// Gets a map with the variance of every item; use `item_variance` instead.
572 query crate_variances(_: ()) -> ty::CrateVariancesMap<'tcx> {
573 storage(ArenaCacheSelector<'tcx>)
574 desc { "computing the variances for items in this crate" }
577 /// Maps from the `DefId` of a type or region parameter to its (inferred) variance.
578 query variances_of(def_id: DefId) -> &'tcx [ty::Variance] {
579 desc { |tcx| "computing the variances of `{}`", tcx.def_path_str(def_id) }
582 /// Maps from thee `DefId` of a type to its (inferred) outlives.
583 query inferred_outlives_crate(_: ()) -> ty::CratePredicatesMap<'tcx> {
584 storage(ArenaCacheSelector<'tcx>)
585 desc { "computing the inferred outlives predicates for items in this crate" }
588 /// Maps from an impl/trait `DefId to a list of the `DefId`s of its items.
589 query associated_item_def_ids(key: DefId) -> &'tcx [DefId] {
590 desc { |tcx| "collecting associated items of `{}`", tcx.def_path_str(key) }
593 /// Maps from a trait item to the trait item "descriptor".
594 query associated_item(key: DefId) -> ty::AssocItem {
595 desc { |tcx| "computing associated item data for `{}`", tcx.def_path_str(key) }
596 storage(ArenaCacheSelector<'tcx>)
599 /// Collects the associated items defined on a trait or impl.
600 query associated_items(key: DefId) -> ty::AssocItems<'tcx> {
601 storage(ArenaCacheSelector<'tcx>)
602 desc { |tcx| "collecting associated items of {}", tcx.def_path_str(key) }
605 /// Given an `impl_id`, return the trait it implements.
606 /// Return `None` if this is an inherent impl.
607 query impl_trait_ref(impl_id: DefId) -> Option<ty::TraitRef<'tcx>> {
608 desc { |tcx| "computing trait implemented by `{}`", tcx.def_path_str(impl_id) }
610 query impl_polarity(impl_id: DefId) -> ty::ImplPolarity {
611 desc { |tcx| "computing implementation polarity of `{}`", tcx.def_path_str(impl_id) }
614 query issue33140_self_ty(key: DefId) -> Option<ty::Ty<'tcx>> {
615 desc { |tcx| "computing Self type wrt issue #33140 `{}`", tcx.def_path_str(key) }
618 /// Maps a `DefId` of a type to a list of its inherent impls.
619 /// Contains implementations of methods that are inherent to a type.
620 /// Methods in these implementations don't need to be exported.
621 query inherent_impls(key: DefId) -> &'tcx [DefId] {
622 desc { |tcx| "collecting inherent impls for `{}`", tcx.def_path_str(key) }
626 /// The result of unsafety-checking this `LocalDefId`.
627 query unsafety_check_result(key: LocalDefId) -> &'tcx mir::UnsafetyCheckResult {
628 desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key.to_def_id()) }
629 cache_on_disk_if { true }
631 query unsafety_check_result_for_const_arg(key: (LocalDefId, DefId)) -> &'tcx mir::UnsafetyCheckResult {
633 |tcx| "unsafety-checking the const argument `{}`",
634 tcx.def_path_str(key.0.to_def_id())
638 /// Unsafety-check this `LocalDefId` with THIR unsafeck. This should be
639 /// used with `-Zthir-unsafeck`.
640 query thir_check_unsafety(key: LocalDefId) {
641 desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key.to_def_id()) }
642 cache_on_disk_if { true }
644 query thir_check_unsafety_for_const_arg(key: (LocalDefId, DefId)) {
646 |tcx| "unsafety-checking the const argument `{}`",
647 tcx.def_path_str(key.0.to_def_id())
651 /// HACK: when evaluated, this reports a "unsafe derive on repr(packed)" error.
653 /// Unsafety checking is executed for each method separately, but we only want
654 /// to emit this error once per derive. As there are some impls with multiple
655 /// methods, we use a query for deduplication.
656 query unsafe_derive_on_repr_packed(key: LocalDefId) -> () {
657 desc { |tcx| "processing `{}`", tcx.def_path_str(key.to_def_id()) }
660 /// The signature of functions.
661 query fn_sig(key: DefId) -> ty::PolyFnSig<'tcx> {
662 desc { |tcx| "computing function signature of `{}`", tcx.def_path_str(key) }
665 query lint_mod(key: LocalDefId) -> () {
666 desc { |tcx| "linting {}", describe_as_module(key, tcx) }
669 /// Checks the attributes in the module.
670 query check_mod_attrs(key: LocalDefId) -> () {
671 desc { |tcx| "checking attributes in {}", describe_as_module(key, tcx) }
674 query check_mod_unstable_api_usage(key: LocalDefId) -> () {
675 desc { |tcx| "checking for unstable API usage in {}", describe_as_module(key, tcx) }
678 /// Checks the const bodies in the module for illegal operations (e.g. `if` or `loop`).
679 query check_mod_const_bodies(key: LocalDefId) -> () {
680 desc { |tcx| "checking consts in {}", describe_as_module(key, tcx) }
683 /// Checks the loops in the module.
684 query check_mod_loops(key: LocalDefId) -> () {
685 desc { |tcx| "checking loops in {}", describe_as_module(key, tcx) }
688 query check_mod_naked_functions(key: LocalDefId) -> () {
689 desc { |tcx| "checking naked functions in {}", describe_as_module(key, tcx) }
692 query check_mod_item_types(key: LocalDefId) -> () {
693 desc { |tcx| "checking item types in {}", describe_as_module(key, tcx) }
696 query check_mod_privacy(key: LocalDefId) -> () {
697 desc { |tcx| "checking privacy in {}", describe_as_module(key, tcx) }
700 query check_mod_intrinsics(key: LocalDefId) -> () {
701 desc { |tcx| "checking intrinsics in {}", describe_as_module(key, tcx) }
704 query check_mod_liveness(key: LocalDefId) -> () {
705 desc { |tcx| "checking liveness of variables in {}", describe_as_module(key, tcx) }
708 query check_mod_impl_wf(key: LocalDefId) -> () {
709 desc { |tcx| "checking that impls are well-formed in {}", describe_as_module(key, tcx) }
712 query collect_mod_item_types(key: LocalDefId) -> () {
713 desc { |tcx| "collecting item types in {}", describe_as_module(key, tcx) }
716 /// Caches `CoerceUnsized` kinds for impls on custom types.
717 query coerce_unsized_info(key: DefId)
718 -> ty::adjustment::CoerceUnsizedInfo {
719 desc { |tcx| "computing CoerceUnsized info for `{}`", tcx.def_path_str(key) }
722 query typeck_item_bodies(_: ()) -> () {
723 desc { "type-checking all item bodies" }
726 query typeck(key: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> {
727 desc { |tcx| "type-checking `{}`", tcx.def_path_str(key.to_def_id()) }
728 cache_on_disk_if { true }
730 query typeck_const_arg(
731 key: (LocalDefId, DefId)
732 ) -> &'tcx ty::TypeckResults<'tcx> {
734 |tcx| "type-checking the const argument `{}`",
735 tcx.def_path_str(key.0.to_def_id()),
738 query diagnostic_only_typeck(key: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> {
739 desc { |tcx| "type-checking `{}`", tcx.def_path_str(key.to_def_id()) }
740 cache_on_disk_if { true }
741 load_cached(tcx, id) {
742 let typeck_results: Option<ty::TypeckResults<'tcx>> = tcx
743 .on_disk_cache().as_ref()
744 .and_then(|c| c.try_load_query_result(*tcx, id));
746 typeck_results.map(|x| &*tcx.arena.alloc(x))
750 query used_trait_imports(key: LocalDefId) -> &'tcx FxHashSet<LocalDefId> {
751 desc { |tcx| "used_trait_imports `{}`", tcx.def_path_str(key.to_def_id()) }
752 cache_on_disk_if { true }
755 query has_typeck_results(def_id: DefId) -> bool {
756 desc { |tcx| "checking whether `{}` has a body", tcx.def_path_str(def_id) }
759 query coherent_trait(def_id: DefId) -> () {
760 desc { |tcx| "coherence checking all impls of trait `{}`", tcx.def_path_str(def_id) }
763 /// Borrow-checks the function body. If this is a closure, returns
764 /// additional requirements that the closure's creator must verify.
765 query mir_borrowck(key: LocalDefId) -> &'tcx mir::BorrowCheckResult<'tcx> {
766 desc { |tcx| "borrow-checking `{}`", tcx.def_path_str(key.to_def_id()) }
767 cache_on_disk_if(tcx, opt_result) {
768 tcx.is_closure(key.to_def_id())
769 || opt_result.map_or(false, |r| !r.concrete_opaque_types.is_empty())
772 query mir_borrowck_const_arg(key: (LocalDefId, DefId)) -> &'tcx mir::BorrowCheckResult<'tcx> {
774 |tcx| "borrow-checking the const argument`{}`",
775 tcx.def_path_str(key.0.to_def_id())
779 /// Gets a complete map from all types to their inherent impls.
780 /// Not meant to be used directly outside of coherence.
781 query crate_inherent_impls(k: ()) -> CrateInherentImpls {
782 storage(ArenaCacheSelector<'tcx>)
784 desc { "all inherent impls defined in crate" }
787 /// Checks all types in the crate for overlap in their inherent impls. Reports errors.
788 /// Not meant to be used directly outside of coherence.
789 query crate_inherent_impls_overlap_check(_: ())
792 desc { "check for overlap between inherent impls defined in this crate" }
795 /// Check whether the function has any recursion that could cause the inliner to trigger
796 /// a cycle. Returns the call stack causing the cycle. The call stack does not contain the
797 /// current function, just all intermediate functions.
798 query mir_callgraph_reachable(key: (ty::Instance<'tcx>, LocalDefId)) -> bool {
801 "computing if `{}` (transitively) calls `{}`",
803 tcx.def_path_str(key.1.to_def_id()),
807 /// Obtain all the calls into other local functions
808 query mir_inliner_callees(key: ty::InstanceDef<'tcx>) -> &'tcx [(DefId, SubstsRef<'tcx>)] {
811 "computing all local function calls in `{}`",
812 tcx.def_path_str(key.def_id()),
816 /// Evaluates a constant and returns the computed allocation.
818 /// **Do not use this** directly, use the `tcx.eval_static_initializer` wrapper.
819 query eval_to_allocation_raw(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
820 -> EvalToAllocationRawResult<'tcx> {
822 "const-evaluating + checking `{}`",
823 key.value.display(tcx)
825 cache_on_disk_if { true }
828 /// Evaluates const items or anonymous constants
829 /// (such as enum variant explicit discriminants or array lengths)
830 /// into a representation suitable for the type system and const generics.
832 /// **Do not use this** directly, use one of the following wrappers: `tcx.const_eval_poly`,
833 /// `tcx.const_eval_resolve`, `tcx.const_eval_instance`, or `tcx.const_eval_global_id`.
834 query eval_to_const_value_raw(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
835 -> EvalToConstValueResult<'tcx> {
837 "simplifying constant for the type system `{}`",
838 key.value.display(tcx)
840 cache_on_disk_if { true }
843 /// Convert an evaluated constant to a type level constant or
844 /// return `None` if that is not possible.
845 query const_to_valtree(
846 key: ty::ParamEnvAnd<'tcx, ConstAlloc<'tcx>>
847 ) -> Option<ty::ValTree<'tcx>> {
848 desc { "destructure constant" }
851 /// Destructure a constant ADT or array into its variant index and its
853 query destructure_const(
854 key: ty::ParamEnvAnd<'tcx, &'tcx ty::Const<'tcx>>
855 ) -> mir::DestructuredConst<'tcx> {
856 desc { "destructure constant" }
859 /// Dereference a constant reference or raw pointer and turn the result into a constant
862 key: ty::ParamEnvAnd<'tcx, &'tcx ty::Const<'tcx>>
863 ) -> &'tcx ty::Const<'tcx> {
864 desc { "deref constant" }
867 query const_caller_location(key: (rustc_span::Symbol, u32, u32)) -> ConstValue<'tcx> {
868 desc { "get a &core::panic::Location referring to a span" }
872 key: LitToConstInput<'tcx>
873 ) -> Result<&'tcx ty::Const<'tcx>, LitToConstError> {
874 desc { "converting literal to const" }
877 query check_match(key: DefId) {
878 desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) }
879 cache_on_disk_if { key.is_local() }
882 /// Performs part of the privacy check and computes "access levels".
883 query privacy_access_levels(_: ()) -> &'tcx AccessLevels {
885 desc { "privacy access levels" }
887 query check_private_in_public(_: ()) -> () {
889 desc { "checking for private elements in public interfaces" }
892 query reachable_set(_: ()) -> FxHashSet<LocalDefId> {
893 storage(ArenaCacheSelector<'tcx>)
894 desc { "reachability" }
897 /// Per-body `region::ScopeTree`. The `DefId` should be the owner `DefId` for the body;
898 /// in the case of closures, this will be redirected to the enclosing function.
899 query region_scope_tree(def_id: DefId) -> &'tcx region::ScopeTree {
900 desc { |tcx| "computing drop scopes for `{}`", tcx.def_path_str(def_id) }
903 query mir_shims(key: ty::InstanceDef<'tcx>) -> mir::Body<'tcx> {
904 storage(ArenaCacheSelector<'tcx>)
905 desc { |tcx| "generating MIR shim for `{}`", tcx.def_path_str(key.def_id()) }
908 /// The `symbol_name` query provides the symbol name for calling a
909 /// given instance from the local crate. In particular, it will also
910 /// look up the correct symbol name of instances from upstream crates.
911 query symbol_name(key: ty::Instance<'tcx>) -> ty::SymbolName<'tcx> {
912 desc { "computing the symbol for `{}`", key }
913 cache_on_disk_if { true }
916 query opt_def_kind(def_id: DefId) -> Option<DefKind> {
917 desc { |tcx| "looking up definition kind of `{}`", tcx.def_path_str(def_id) }
920 query def_span(def_id: DefId) -> Span {
921 desc { |tcx| "looking up span for `{}`", tcx.def_path_str(def_id) }
922 // FIXME(mw): DefSpans are not really inputs since they are derived from
923 // HIR. But at the moment HIR hashing still contains some hacks that allow
924 // to make type debuginfo to be source location independent. Declaring
925 // DefSpan an input makes sure that changes to these are always detected
926 // regardless of HIR hashing.
930 query def_ident_span(def_id: DefId) -> Option<Span> {
931 desc { |tcx| "looking up span for `{}`'s identifier", tcx.def_path_str(def_id) }
934 query lookup_stability(def_id: DefId) -> Option<&'tcx attr::Stability> {
935 desc { |tcx| "looking up stability of `{}`", tcx.def_path_str(def_id) }
938 query lookup_const_stability(def_id: DefId) -> Option<&'tcx attr::ConstStability> {
939 desc { |tcx| "looking up const stability of `{}`", tcx.def_path_str(def_id) }
942 query should_inherit_track_caller(def_id: DefId) -> bool {
943 desc { |tcx| "computing should_inherit_track_caller of `{}`", tcx.def_path_str(def_id) }
946 query lookup_deprecation_entry(def_id: DefId) -> Option<DeprecationEntry> {
947 desc { |tcx| "checking whether `{}` is deprecated", tcx.def_path_str(def_id) }
950 query item_attrs(def_id: DefId) -> &'tcx [ast::Attribute] {
951 desc { |tcx| "collecting attributes of `{}`", tcx.def_path_str(def_id) }
954 query codegen_fn_attrs(def_id: DefId) -> CodegenFnAttrs {
955 desc { |tcx| "computing codegen attributes of `{}`", tcx.def_path_str(def_id) }
956 storage(ArenaCacheSelector<'tcx>)
957 cache_on_disk_if { true }
960 query fn_arg_names(def_id: DefId) -> &'tcx [rustc_span::symbol::Ident] {
961 desc { |tcx| "looking up function parameter names for `{}`", tcx.def_path_str(def_id) }
963 /// Gets the rendered value of the specified constant or associated constant.
965 query rendered_const(def_id: DefId) -> String {
966 desc { |tcx| "rendering constant intializer of `{}`", tcx.def_path_str(def_id) }
968 query impl_parent(def_id: DefId) -> Option<DefId> {
969 desc { |tcx| "computing specialization parent impl of `{}`", tcx.def_path_str(def_id) }
972 /// Given an `associated_item`, find the trait it belongs to.
973 /// Return `None` if the `DefId` is not an associated item.
974 query trait_of_item(associated_item: DefId) -> Option<DefId> {
975 desc { |tcx| "finding trait defining `{}`", tcx.def_path_str(associated_item) }
978 query is_ctfe_mir_available(key: DefId) -> bool {
979 desc { |tcx| "checking if item has ctfe mir available: `{}`", tcx.def_path_str(key) }
981 query is_mir_available(key: DefId) -> bool {
982 desc { |tcx| "checking if item has mir available: `{}`", tcx.def_path_str(key) }
985 query vtable_entries(key: ty::PolyTraitRef<'tcx>)
986 -> &'tcx [ty::VtblEntry<'tcx>] {
987 desc { |tcx| "finding all vtable entries for trait {}", tcx.def_path_str(key.def_id()) }
990 query vtable_trait_upcasting_coercion_new_vptr_slot(key: (ty::PolyTraitRef<'tcx>, ty::PolyTraitRef<'tcx>)) -> Option<usize> {
991 desc { |tcx| "finding the slot within vtable for trait {} vtable ptr during trait upcasting coercion from {} vtable",
992 tcx.def_path_str(key.1.def_id()), tcx.def_path_str(key.0.def_id()) }
995 query codegen_fulfill_obligation(
996 key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)
997 ) -> Result<ImplSource<'tcx, ()>, ErrorReported> {
998 cache_on_disk_if { true }
1000 "checking if `{}` fulfills its obligations",
1001 tcx.def_path_str(key.1.def_id())
1005 /// Return all `impl` blocks in the current crate.
1007 /// To allow caching this between crates, you must pass in [`LOCAL_CRATE`] as the crate number.
1008 /// Passing in any other crate will cause an ICE.
1010 /// [`LOCAL_CRATE`]: rustc_hir::def_id::LOCAL_CRATE
1011 query all_local_trait_impls(_: ()) -> &'tcx BTreeMap<DefId, Vec<LocalDefId>> {
1012 desc { "local trait impls" }
1015 /// Given a trait `trait_id`, return all known `impl` blocks.
1016 query trait_impls_of(trait_id: DefId) -> ty::trait_def::TraitImpls {
1017 storage(ArenaCacheSelector<'tcx>)
1018 desc { |tcx| "trait impls of `{}`", tcx.def_path_str(trait_id) }
1021 query specialization_graph_of(trait_id: DefId) -> specialization_graph::Graph {
1022 storage(ArenaCacheSelector<'tcx>)
1023 desc { |tcx| "building specialization graph of trait `{}`", tcx.def_path_str(trait_id) }
1024 cache_on_disk_if { true }
1026 query object_safety_violations(trait_id: DefId) -> &'tcx [traits::ObjectSafetyViolation] {
1027 desc { |tcx| "determine object safety of trait `{}`", tcx.def_path_str(trait_id) }
1030 /// Gets the ParameterEnvironment for a given item; this environment
1031 /// will be in "user-facing" mode, meaning that it is suitable for
1032 /// type-checking etc, and it does not normalize specializable
1033 /// associated types. This is almost always what you want,
1034 /// unless you are doing MIR optimizations, in which case you
1035 /// might want to use `reveal_all()` method to change modes.
1036 query param_env(def_id: DefId) -> ty::ParamEnv<'tcx> {
1037 desc { |tcx| "computing normalized predicates of `{}`", tcx.def_path_str(def_id) }
1040 /// Like `param_env`, but returns the `ParamEnv` in `Reveal::All` mode.
1041 /// Prefer this over `tcx.param_env(def_id).with_reveal_all_normalized(tcx)`,
1042 /// as this method is more efficient.
1043 query param_env_reveal_all_normalized(def_id: DefId) -> ty::ParamEnv<'tcx> {
1044 desc { |tcx| "computing revealed normalized predicates of `{}`", tcx.def_path_str(def_id) }
1047 /// Trait selection queries. These are best used by invoking `ty.is_copy_modulo_regions()`,
1048 /// `ty.is_copy()`, etc, since that will prune the environment where possible.
1049 query is_copy_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
1050 desc { "computing whether `{}` is `Copy`", env.value }
1052 /// Query backing `TyS::is_sized`.
1053 query is_sized_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
1054 desc { "computing whether `{}` is `Sized`", env.value }
1056 /// Query backing `TyS::is_freeze`.
1057 query is_freeze_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
1058 desc { "computing whether `{}` is freeze", env.value }
1060 /// Query backing `TyS::is_unpin`.
1061 query is_unpin_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
1062 desc { "computing whether `{}` is `Unpin`", env.value }
1064 /// Query backing `TyS::needs_drop`.
1065 query needs_drop_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
1066 desc { "computing whether `{}` needs drop", env.value }
1068 /// Query backing `TyS::has_significant_drop_raw`.
1069 query has_significant_drop_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
1070 desc { "computing whether `{}` has a significant drop", env.value }
1073 /// Query backing `TyS::is_structural_eq_shallow`.
1075 /// This is only correct for ADTs. Call `is_structural_eq_shallow` to handle all types
1077 query has_structural_eq_impls(ty: Ty<'tcx>) -> bool {
1079 "computing whether `{:?}` implements `PartialStructuralEq` and `StructuralEq`",
1084 /// A list of types where the ADT requires drop if and only if any of
1085 /// those types require drop. If the ADT is known to always need drop
1086 /// then `Err(AlwaysRequiresDrop)` is returned.
1087 query adt_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1088 desc { |tcx| "computing when `{}` needs drop", tcx.def_path_str(def_id) }
1089 cache_on_disk_if { true }
1092 /// A list of types where the ADT requires drop if and only if any of those types
1093 /// has significant drop. A type marked with the attribute `rustc_insignificant_dtor`
1094 /// is considered to not be significant. A drop is significant if it is implemented
1095 /// by the user or does anything that will have any observable behavior (other than
1096 /// freeing up memory). If the ADT is known to have a significant destructor then
1097 /// `Err(AlwaysRequiresDrop)` is returned.
1098 query adt_significant_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1099 desc { |tcx| "computing when `{}` has a significant destructor", tcx.def_path_str(def_id) }
1100 cache_on_disk_if { false }
1104 env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>
1105 ) -> Result<&'tcx rustc_target::abi::Layout, ty::layout::LayoutError<'tcx>> {
1106 desc { "computing layout of `{}`", env.value }
1109 query dylib_dependency_formats(_: CrateNum)
1110 -> &'tcx [(CrateNum, LinkagePreference)] {
1111 desc { "dylib dependency formats of crate" }
1114 query dependency_formats(_: ()) -> Lrc<crate::middle::dependency_format::Dependencies> {
1115 desc { "get the linkage format of all dependencies" }
1118 query is_compiler_builtins(_: CrateNum) -> bool {
1120 desc { "checking if the crate is_compiler_builtins" }
1122 query has_global_allocator(_: CrateNum) -> bool {
1123 // This query depends on untracked global state in CStore
1126 desc { "checking if the crate has_global_allocator" }
1128 query has_panic_handler(_: CrateNum) -> bool {
1130 desc { "checking if the crate has_panic_handler" }
1132 query is_profiler_runtime(_: CrateNum) -> bool {
1134 desc { "query a crate is `#![profiler_runtime]`" }
1136 query panic_strategy(_: CrateNum) -> PanicStrategy {
1138 desc { "query a crate's configured panic strategy" }
1140 query is_no_builtins(_: CrateNum) -> bool {
1142 desc { "test whether a crate has `#![no_builtins]`" }
1144 query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
1146 desc { "query a crate's symbol mangling version" }
1149 query extern_crate(def_id: DefId) -> Option<&'tcx ExternCrate> {
1151 desc { "getting crate's ExternCrateData" }
1154 query specializes(_: (DefId, DefId)) -> bool {
1155 desc { "computing whether impls specialize one another" }
1157 query in_scope_traits_map(_: LocalDefId)
1158 -> Option<&'tcx FxHashMap<ItemLocalId, Box<[TraitCandidate]>>> {
1159 desc { "traits in scope at a block" }
1162 query module_exports(def_id: LocalDefId) -> Option<&'tcx [Export<LocalDefId>]> {
1163 desc { |tcx| "looking up items exported by `{}`", tcx.def_path_str(def_id.to_def_id()) }
1166 query impl_defaultness(def_id: DefId) -> hir::Defaultness {
1167 desc { |tcx| "looking up whether `{}` is a default impl", tcx.def_path_str(def_id) }
1170 query impl_constness(def_id: DefId) -> hir::Constness {
1171 desc { |tcx| "looking up whether `{}` is a const impl", tcx.def_path_str(def_id) }
1174 query check_item_well_formed(key: LocalDefId) -> () {
1175 desc { |tcx| "checking that `{}` is well-formed", tcx.def_path_str(key.to_def_id()) }
1177 query check_trait_item_well_formed(key: LocalDefId) -> () {
1178 desc { |tcx| "checking that `{}` is well-formed", tcx.def_path_str(key.to_def_id()) }
1180 query check_impl_item_well_formed(key: LocalDefId) -> () {
1181 desc { |tcx| "checking that `{}` is well-formed", tcx.def_path_str(key.to_def_id()) }
1184 // The `DefId`s of all non-generic functions and statics in the given crate
1185 // that can be reached from outside the crate.
1187 // We expect this items to be available for being linked to.
1189 // This query can also be called for `LOCAL_CRATE`. In this case it will
1190 // compute which items will be reachable to other crates, taking into account
1191 // the kind of crate that is currently compiled. Crates with only a
1192 // C interface have fewer reachable things.
1194 // Does not include external symbols that don't have a corresponding DefId,
1195 // like the compiler-generated `main` function and so on.
1196 query reachable_non_generics(_: CrateNum)
1197 -> DefIdMap<SymbolExportLevel> {
1198 storage(ArenaCacheSelector<'tcx>)
1199 desc { "looking up the exported symbols of a crate" }
1201 query is_reachable_non_generic(def_id: DefId) -> bool {
1202 desc { |tcx| "checking whether `{}` is an exported symbol", tcx.def_path_str(def_id) }
1204 query is_unreachable_local_definition(def_id: LocalDefId) -> bool {
1206 "checking whether `{}` is reachable from outside the crate",
1207 tcx.def_path_str(def_id.to_def_id()),
1211 /// The entire set of monomorphizations the local crate can safely link
1212 /// to because they are exported from upstream crates. Do not depend on
1213 /// this directly, as its value changes anytime a monomorphization gets
1214 /// added or removed in any upstream crate. Instead use the narrower
1215 /// `upstream_monomorphizations_for`, `upstream_drop_glue_for`, or, even
1216 /// better, `Instance::upstream_monomorphization()`.
1217 query upstream_monomorphizations(_: ()) -> DefIdMap<FxHashMap<SubstsRef<'tcx>, CrateNum>> {
1218 storage(ArenaCacheSelector<'tcx>)
1219 desc { "collecting available upstream monomorphizations" }
1222 /// Returns the set of upstream monomorphizations available for the
1223 /// generic function identified by the given `def_id`. The query makes
1224 /// sure to make a stable selection if the same monomorphization is
1225 /// available in multiple upstream crates.
1227 /// You likely want to call `Instance::upstream_monomorphization()`
1228 /// instead of invoking this query directly.
1229 query upstream_monomorphizations_for(def_id: DefId)
1230 -> Option<&'tcx FxHashMap<SubstsRef<'tcx>, CrateNum>> {
1232 "collecting available upstream monomorphizations for `{}`",
1233 tcx.def_path_str(def_id),
1237 /// Returns the upstream crate that exports drop-glue for the given
1238 /// type (`substs` is expected to be a single-item list containing the
1239 /// type one wants drop-glue for).
1241 /// This is a subset of `upstream_monomorphizations_for` in order to
1242 /// increase dep-tracking granularity. Otherwise adding or removing any
1243 /// type with drop-glue in any upstream crate would invalidate all
1244 /// functions calling drop-glue of an upstream type.
1246 /// You likely want to call `Instance::upstream_monomorphization()`
1247 /// instead of invoking this query directly.
1249 /// NOTE: This query could easily be extended to also support other
1250 /// common functions that have are large set of monomorphizations
1251 /// (like `Clone::clone` for example).
1252 query upstream_drop_glue_for(substs: SubstsRef<'tcx>) -> Option<CrateNum> {
1253 desc { "available upstream drop-glue for `{:?}`", substs }
1256 query foreign_modules(_: CrateNum) -> Lrc<FxHashMap<DefId, ForeignModule>> {
1257 desc { "looking up the foreign modules of a linked crate" }
1260 /// Identifies the entry-point (e.g., the `main` function) for a given
1261 /// crate, returning `None` if there is no entry point (such as for library crates).
1262 query entry_fn(_: ()) -> Option<(DefId, EntryFnType)> {
1263 desc { "looking up the entry function of a crate" }
1265 query proc_macro_decls_static(_: ()) -> Option<LocalDefId> {
1266 desc { "looking up the derive registrar for a crate" }
1268 // The macro which defines `rustc_metadata::provide_extern` depends on this query's name.
1269 // Changing the name should cause a compiler error, but in case that changes, be aware.
1270 query crate_hash(_: CrateNum) -> Svh {
1272 desc { "looking up the hash a crate" }
1274 query crate_host_hash(_: CrateNum) -> Option<Svh> {
1276 desc { "looking up the hash of a host version of a crate" }
1278 query extra_filename(_: CrateNum) -> String {
1280 desc { "looking up the extra filename for a crate" }
1282 query crate_extern_paths(_: CrateNum) -> Vec<PathBuf> {
1284 desc { "looking up the paths for extern crates" }
1287 /// Given a crate and a trait, look up all impls of that trait in the crate.
1288 /// Return `(impl_id, self_ty)`.
1289 query implementations_of_trait(_: (CrateNum, DefId))
1290 -> &'tcx [(DefId, Option<ty::fast_reject::SimplifiedType>)] {
1291 desc { "looking up implementations of a trait in a crate" }
1294 /// Given a crate, look up all trait impls in that crate.
1295 /// Return `(impl_id, self_ty)`.
1296 query all_trait_implementations(_: CrateNum)
1297 -> &'tcx [(DefId, Option<ty::fast_reject::SimplifiedType>)] {
1298 desc { "looking up all (?) trait implementations" }
1301 query is_dllimport_foreign_item(def_id: DefId) -> bool {
1302 desc { |tcx| "is_dllimport_foreign_item({})", tcx.def_path_str(def_id) }
1304 query is_statically_included_foreign_item(def_id: DefId) -> bool {
1305 desc { |tcx| "is_statically_included_foreign_item({})", tcx.def_path_str(def_id) }
1307 query native_library_kind(def_id: DefId)
1308 -> Option<NativeLibKind> {
1309 desc { |tcx| "native_library_kind({})", tcx.def_path_str(def_id) }
1312 /// Does lifetime resolution, but does not descend into trait items. This
1313 /// should only be used for resolving lifetimes of on trait definitions,
1314 /// and is used to avoid cycles. Importantly, `resolve_lifetimes` still visits
1315 /// the same lifetimes and is responsible for diagnostics.
1316 /// See `rustc_resolve::late::lifetimes for details.
1317 query resolve_lifetimes_trait_definition(_: LocalDefId) -> ResolveLifetimes {
1318 storage(ArenaCacheSelector<'tcx>)
1319 desc { "resolving lifetimes for a trait definition" }
1321 /// Does lifetime resolution on items. Importantly, we can't resolve
1322 /// lifetimes directly on things like trait methods, because of trait params.
1323 /// See `rustc_resolve::late::lifetimes for details.
1324 query resolve_lifetimes(_: LocalDefId) -> ResolveLifetimes {
1325 storage(ArenaCacheSelector<'tcx>)
1326 desc { "resolving lifetimes" }
1328 query named_region_map(_: LocalDefId) ->
1329 Option<&'tcx FxHashMap<ItemLocalId, Region>> {
1330 desc { "looking up a named region" }
1332 query is_late_bound_map(_: LocalDefId) ->
1333 Option<(LocalDefId, &'tcx FxHashSet<ItemLocalId>)> {
1334 desc { "testing if a region is late bound" }
1336 /// For a given item (like a struct), gets the default lifetimes to be used
1337 /// for each parameter if a trait object were to be passed for that parameter.
1338 /// For example, for `struct Foo<'a, T, U>`, this would be `['static, 'static]`.
1339 /// For `struct Foo<'a, T: 'a, U>`, this would instead be `['a, 'static]`.
1340 query object_lifetime_defaults_map(_: LocalDefId)
1341 -> Option<Vec<ObjectLifetimeDefault>> {
1342 desc { "looking up lifetime defaults for a region on an item" }
1344 query late_bound_vars_map(_: LocalDefId)
1345 -> Option<&'tcx FxHashMap<ItemLocalId, Vec<ty::BoundVariableKind>>> {
1346 desc { "looking up late bound vars" }
1349 query lifetime_scope_map(_: LocalDefId) -> Option<FxHashMap<ItemLocalId, LifetimeScopeForPath>> {
1350 desc { "finds the lifetime scope for an HirId of a PathSegment" }
1353 query visibility(def_id: DefId) -> ty::Visibility {
1354 desc { |tcx| "computing visibility of `{}`", tcx.def_path_str(def_id) }
1357 /// Computes the set of modules from which this type is visibly uninhabited.
1358 /// To check whether a type is uninhabited at all (not just from a given module), you could
1359 /// check whether the forest is empty.
1360 query type_uninhabited_from(
1361 key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>
1362 ) -> ty::inhabitedness::DefIdForest {
1363 desc { "computing the inhabitedness of `{:?}`", key }
1366 query dep_kind(_: CrateNum) -> CrateDepKind {
1368 desc { "fetching what a dependency looks like" }
1370 query crate_name(_: CrateNum) -> Symbol {
1372 desc { "fetching what a crate is named" }
1374 query item_children(def_id: DefId) -> &'tcx [Export<hir::HirId>] {
1375 desc { |tcx| "collecting child items of `{}`", tcx.def_path_str(def_id) }
1377 query extern_mod_stmt_cnum(def_id: LocalDefId) -> Option<CrateNum> {
1378 desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id.to_def_id()) }
1381 query get_lib_features(_: ()) -> LibFeatures {
1382 storage(ArenaCacheSelector<'tcx>)
1384 desc { "calculating the lib features map" }
1386 query defined_lib_features(_: CrateNum)
1387 -> &'tcx [(Symbol, Option<Symbol>)] {
1388 desc { "calculating the lib features defined in a crate" }
1390 /// Returns the lang items defined in another crate by loading it from metadata.
1391 query get_lang_items(_: ()) -> LanguageItems {
1392 storage(ArenaCacheSelector<'tcx>)
1394 desc { "calculating the lang items map" }
1397 /// Returns all diagnostic items defined in all crates.
1398 query all_diagnostic_items(_: ()) -> FxHashMap<Symbol, DefId> {
1399 storage(ArenaCacheSelector<'tcx>)
1401 desc { "calculating the diagnostic items map" }
1404 /// Returns the lang items defined in another crate by loading it from metadata.
1405 query defined_lang_items(_: CrateNum) -> &'tcx [(DefId, usize)] {
1406 desc { "calculating the lang items defined in a crate" }
1409 /// Returns the diagnostic items defined in a crate.
1410 query diagnostic_items(_: CrateNum) -> FxHashMap<Symbol, DefId> {
1411 storage(ArenaCacheSelector<'tcx>)
1412 desc { "calculating the diagnostic items map in a crate" }
1415 query missing_lang_items(_: CrateNum) -> &'tcx [LangItem] {
1416 desc { "calculating the missing lang items in a crate" }
1418 query visible_parent_map(_: ()) -> DefIdMap<DefId> {
1419 storage(ArenaCacheSelector<'tcx>)
1420 desc { "calculating the visible parent map" }
1422 query trimmed_def_paths(_: ()) -> FxHashMap<DefId, Symbol> {
1423 storage(ArenaCacheSelector<'tcx>)
1424 desc { "calculating trimmed def paths" }
1426 query missing_extern_crate_item(_: CrateNum) -> bool {
1428 desc { "seeing if we're missing an `extern crate` item for this crate" }
1430 query used_crate_source(_: CrateNum) -> Lrc<CrateSource> {
1432 desc { "looking at the source for a crate" }
1434 query postorder_cnums(_: ()) -> &'tcx [CrateNum] {
1436 desc { "generating a postorder list of CrateNums" }
1438 /// Returns whether or not the crate with CrateNum 'cnum'
1439 /// is marked as a private dependency
1440 query is_private_dep(c: CrateNum) -> bool {
1442 desc { "check whether crate {} is a private dependency", c }
1444 query allocator_kind(_: ()) -> Option<AllocatorKind> {
1446 desc { "allocator kind for the current crate" }
1449 query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
1450 desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }
1453 query maybe_unused_trait_import(def_id: LocalDefId) -> bool {
1454 desc { |tcx| "maybe_unused_trait_import for `{}`", tcx.def_path_str(def_id.to_def_id()) }
1456 query maybe_unused_extern_crates(_: ()) -> &'tcx [(LocalDefId, Span)] {
1457 desc { "looking up all possibly unused extern crates" }
1459 query names_imported_by_glob_use(def_id: LocalDefId) -> &'tcx FxHashSet<Symbol> {
1460 desc { |tcx| "names_imported_by_glob_use for `{}`", tcx.def_path_str(def_id.to_def_id()) }
1463 query stability_index(_: ()) -> stability::Index<'tcx> {
1464 storage(ArenaCacheSelector<'tcx>)
1466 desc { "calculating the stability index for the local crate" }
1468 query crates(_: ()) -> &'tcx [CrateNum] {
1470 desc { "fetching all foreign CrateNum instances" }
1473 /// A vector of every trait accessible in the whole crate
1474 /// (i.e., including those from subcrates). This is used only for
1475 /// error reporting.
1476 query all_traits(_: ()) -> &'tcx [DefId] {
1477 desc { "fetching all foreign and local traits" }
1480 /// The list of symbols exported from the given crate.
1482 /// - All names contained in `exported_symbols(cnum)` are guaranteed to
1483 /// correspond to a publicly visible symbol in `cnum` machine code.
1484 /// - The `exported_symbols` sets of different crates do not intersect.
1485 query exported_symbols(_: CrateNum)
1486 -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)] {
1487 desc { "exported_symbols" }
1490 query collect_and_partition_mono_items(_: ()) -> (&'tcx DefIdSet, &'tcx [CodegenUnit<'tcx>]) {
1492 desc { "collect_and_partition_mono_items" }
1494 query is_codegened_item(def_id: DefId) -> bool {
1495 desc { |tcx| "determining whether `{}` needs codegen", tcx.def_path_str(def_id) }
1498 /// All items participating in code generation together with items inlined into them.
1499 query codegened_and_inlined_items(_: ()) -> &'tcx DefIdSet {
1501 desc { "codegened_and_inlined_items" }
1504 query codegen_unit(_: Symbol) -> &'tcx CodegenUnit<'tcx> {
1505 desc { "codegen_unit" }
1507 query unused_generic_params(key: DefId) -> FiniteBitSet<u32> {
1508 cache_on_disk_if { key.is_local() }
1510 |tcx| "determining which generic parameters are unused by `{}`",
1511 tcx.def_path_str(key)
1514 query backend_optimization_level(_: ()) -> OptLevel {
1515 desc { "optimization level used by backend" }
1518 query output_filenames(_: ()) -> Arc<OutputFilenames> {
1520 desc { "output_filenames" }
1523 /// Do not call this query directly: invoke `normalize` instead.
1524 query normalize_projection_ty(
1525 goal: CanonicalProjectionGoal<'tcx>
1527 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
1530 desc { "normalizing `{:?}`", goal }
1533 /// Do not call this query directly: invoke `normalize_erasing_regions` instead.
1534 query normalize_generic_arg_after_erasing_regions(
1535 goal: ParamEnvAnd<'tcx, GenericArg<'tcx>>
1536 ) -> GenericArg<'tcx> {
1537 desc { "normalizing `{}`", goal.value }
1540 /// Do not call this query directly: invoke `normalize_erasing_regions` instead.
1541 query normalize_mir_const_after_erasing_regions(
1542 goal: ParamEnvAnd<'tcx, mir::ConstantKind<'tcx>>
1543 ) -> mir::ConstantKind<'tcx> {
1544 desc { "normalizing `{}`", goal.value }
1547 query implied_outlives_bounds(
1548 goal: CanonicalTyGoal<'tcx>
1550 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>,
1553 desc { "computing implied outlives bounds for `{:?}`", goal }
1556 /// Do not call this query directly: invoke `infcx.at().dropck_outlives()` instead.
1557 query dropck_outlives(
1558 goal: CanonicalTyGoal<'tcx>
1560 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>,
1563 desc { "computing dropck types for `{:?}`", goal }
1566 /// Do not call this query directly: invoke `infcx.predicate_may_hold()` or
1567 /// `infcx.predicate_must_hold()` instead.
1568 query evaluate_obligation(
1569 goal: CanonicalPredicateGoal<'tcx>
1570 ) -> Result<traits::EvaluationResult, traits::OverflowError> {
1571 desc { "evaluating trait selection obligation `{}`", goal.value.value }
1574 query evaluate_goal(
1575 goal: traits::CanonicalChalkEnvironmentAndGoal<'tcx>
1577 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
1580 desc { "evaluating trait selection obligation `{}`", goal.value }
1583 /// Do not call this query directly: part of the `Eq` type-op
1584 query type_op_ascribe_user_type(
1585 goal: CanonicalTypeOpAscribeUserTypeGoal<'tcx>
1587 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
1590 desc { "evaluating `type_op_ascribe_user_type` `{:?}`", goal }
1593 /// Do not call this query directly: part of the `Eq` type-op
1595 goal: CanonicalTypeOpEqGoal<'tcx>
1597 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
1600 desc { "evaluating `type_op_eq` `{:?}`", goal }
1603 /// Do not call this query directly: part of the `Subtype` type-op
1604 query type_op_subtype(
1605 goal: CanonicalTypeOpSubtypeGoal<'tcx>
1607 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
1610 desc { "evaluating `type_op_subtype` `{:?}`", goal }
1613 /// Do not call this query directly: part of the `ProvePredicate` type-op
1614 query type_op_prove_predicate(
1615 goal: CanonicalTypeOpProvePredicateGoal<'tcx>
1617 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
1620 desc { "evaluating `type_op_prove_predicate` `{:?}`", goal }
1623 /// Do not call this query directly: part of the `Normalize` type-op
1624 query type_op_normalize_ty(
1625 goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>
1627 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Ty<'tcx>>>,
1630 desc { "normalizing `{:?}`", goal }
1633 /// Do not call this query directly: part of the `Normalize` type-op
1634 query type_op_normalize_predicate(
1635 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::Predicate<'tcx>>
1637 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::Predicate<'tcx>>>,
1640 desc { "normalizing `{:?}`", goal }
1643 /// Do not call this query directly: part of the `Normalize` type-op
1644 query type_op_normalize_poly_fn_sig(
1645 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::PolyFnSig<'tcx>>
1647 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::PolyFnSig<'tcx>>>,
1650 desc { "normalizing `{:?}`", goal }
1653 /// Do not call this query directly: part of the `Normalize` type-op
1654 query type_op_normalize_fn_sig(
1655 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>
1657 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::FnSig<'tcx>>>,
1660 desc { "normalizing `{:?}`", goal }
1663 query subst_and_check_impossible_predicates(key: (DefId, SubstsRef<'tcx>)) -> bool {
1665 "impossible substituted predicates:`{}`",
1666 tcx.def_path_str(key.0)
1670 query method_autoderef_steps(
1671 goal: CanonicalTyGoal<'tcx>
1672 ) -> MethodAutoderefStepsResult<'tcx> {
1673 desc { "computing autoderef types for `{:?}`", goal }
1676 query supported_target_features(_: CrateNum) -> FxHashMap<String, Option<Symbol>> {
1677 storage(ArenaCacheSelector<'tcx>)
1679 desc { "looking up supported target features" }
1682 /// Get an estimate of the size of an InstanceDef based on its MIR for CGU partitioning.
1683 query instance_def_size_estimate(def: ty::InstanceDef<'tcx>)
1685 desc { |tcx| "estimating size for `{}`", tcx.def_path_str(def.def_id()) }
1688 query features_query(_: ()) -> &'tcx rustc_feature::Features {
1690 desc { "looking up enabled feature gates" }
1693 /// Attempt to resolve the given `DefId` to an `Instance`, for the
1694 /// given generics args (`SubstsRef`), returning one of:
1695 /// * `Ok(Some(instance))` on success
1696 /// * `Ok(None)` when the `SubstsRef` are still too generic,
1697 /// and therefore don't allow finding the final `Instance`
1698 /// * `Err(ErrorReported)` when the `Instance` resolution process
1699 /// couldn't complete due to errors elsewhere - this is distinct
1700 /// from `Ok(None)` to avoid misleading diagnostics when an error
1701 /// has already been/will be emitted, for the original cause
1702 query resolve_instance(
1703 key: ty::ParamEnvAnd<'tcx, (DefId, SubstsRef<'tcx>)>
1704 ) -> Result<Option<ty::Instance<'tcx>>, ErrorReported> {
1705 desc { "resolving instance `{}`", ty::Instance::new(key.value.0, key.value.1) }
1708 query resolve_instance_of_const_arg(
1709 key: ty::ParamEnvAnd<'tcx, (LocalDefId, DefId, SubstsRef<'tcx>)>
1710 ) -> Result<Option<ty::Instance<'tcx>>, ErrorReported> {
1712 "resolving instance of the const argument `{}`",
1713 ty::Instance::new(key.value.0.to_def_id(), key.value.2),
1717 query normalize_opaque_types(key: &'tcx ty::List<ty::Predicate<'tcx>>) -> &'tcx ty::List<ty::Predicate<'tcx>> {
1718 desc { "normalizing opaque types in {:?}", key }
1721 /// Checks whether a type is definitely uninhabited. This is
1722 /// conservative: for some types that are uninhabited we return `false`,
1723 /// but we only return `true` for types that are definitely uninhabited.
1724 /// `ty.conservative_is_privately_uninhabited` implies that any value of type `ty`
1725 /// will be `Abi::Uninhabited`. (Note that uninhabited types may have nonzero
1726 /// size, to account for partial initialisation. See #49298 for details.)
1727 query conservative_is_privately_uninhabited(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
1728 desc { "conservatively checking if {:?} is privately uninhabited", key }
1731 query limits(key: ()) -> Limits {
1732 desc { "looking up limits" }
1735 /// Performs an HIR-based well-formed check on the item with the given `HirId`. If
1736 /// we get an `Umimplemented` error that matches the provided `Predicate`, return
1737 /// the cause of the newly created obligation.
1739 /// This is only used by error-reporting code to get a better cause (in particular, a better
1740 /// span) for an *existing* error. Therefore, it is best-effort, and may never handle
1741 /// all of the cases that the normal `ty::Ty`-based wfcheck does. This is fine,
1742 /// because the `ty::Ty`-based wfcheck is always run.
1743 query diagnostic_hir_wf_check(key: (ty::Predicate<'tcx>, traits::WellFormedLoc)) -> Option<traits::ObligationCause<'tcx>> {
1746 desc { "performing HIR wf-checking for predicate {:?} at item {:?}", key.0, key.1 }