1#![allow(unused_parens)]
8
9use std::ffi::OsStr;
10use std::mem;
11use std::path::PathBuf;
12use std::sync::Arc;
13
14use rustc_arena::TypedArena;
15use rustc_ast::expand::StrippedCfgItem;
16use rustc_ast::expand::allocator::AllocatorKind;
17use rustc_data_structures::fingerprint::Fingerprint;
18use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
19use rustc_data_structures::sorted_map::SortedMap;
20use rustc_data_structures::steal::Steal;
21use rustc_data_structures::svh::Svh;
22use rustc_data_structures::unord::{UnordMap, UnordSet};
23use rustc_errors::ErrorGuaranteed;
24use rustc_hir::def::{DefKind, DocLinkResMap};
25use rustc_hir::def_id::{
26 CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap, LocalDefIdSet, LocalModDefId,
27};
28use rustc_hir::lang_items::{LangItem, LanguageItems};
29use rustc_hir::{Crate, ItemLocalId, ItemLocalMap, PreciseCapturingArgKind, TraitCandidate};
30use rustc_index::IndexVec;
31use rustc_lint_defs::LintId;
32use rustc_macros::rustc_queries;
33use rustc_query_system::ich::StableHashingContext;
34use rustc_query_system::query::{
35 QueryCache, QueryMode, QueryStackDeferred, QueryState, try_get_cached,
36};
37use rustc_session::Limits;
38use rustc_session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion};
39use rustc_session::cstore::{
40 CrateDepKind, CrateSource, ExternCrate, ForeignModule, LinkagePreference, NativeLib,
41};
42use rustc_session::lint::LintExpectationId;
43use rustc_span::def_id::LOCAL_CRATE;
44use rustc_span::source_map::Spanned;
45use rustc_span::{DUMMY_SP, Span, Symbol};
46use rustc_target::spec::PanicStrategy;
47use {rustc_abi as abi, rustc_ast as ast, rustc_attr_data_structures as attr, rustc_hir as hir};
48
49use crate::infer::canonical::{self, Canonical};
50use crate::lint::LintExpectation;
51use crate::metadata::ModChild;
52use crate::middle::codegen_fn_attrs::CodegenFnAttrs;
53use crate::middle::debugger_visualizer::DebuggerVisualizerFile;
54use crate::middle::exported_symbols::{ExportedSymbol, SymbolExportInfo};
55use crate::middle::lib_features::LibFeatures;
56use crate::middle::privacy::EffectiveVisibilities;
57use crate::middle::resolve_bound_vars::{ObjectLifetimeDefault, ResolveBoundVars, ResolvedArg};
58use crate::middle::stability::{self, DeprecationEntry};
59use crate::mir::interpret::{
60 EvalStaticInitializerRawResult, EvalToAllocationRawResult, EvalToConstValueResult,
61 EvalToValTreeResult, GlobalId, LitToConstInput,
62};
63use crate::mir::mono::{CodegenUnit, CollectionMode, MonoItem, MonoItemPartitions};
64use crate::query::erase::{Erase, erase, restore};
65use crate::query::plumbing::{
66 CyclePlaceholder, DynamicQuery, query_ensure, query_ensure_error_guaranteed, query_get_at,
67};
68use crate::traits::query::{
69 CanonicalAliasGoal, CanonicalDropckOutlivesGoal, CanonicalImpliedOutlivesBoundsGoal,
70 CanonicalPredicateGoal, CanonicalTyGoal, CanonicalTypeOpAscribeUserTypeGoal,
71 CanonicalTypeOpNormalizeGoal, CanonicalTypeOpProvePredicateGoal, DropckConstraint,
72 DropckOutlivesResult, MethodAutoderefStepsResult, NoSolution, NormalizationResult,
73 OutlivesBound,
74};
75use crate::traits::{
76 CodegenObligationError, DynCompatibilityViolation, EvaluationResult, ImplSource,
77 ObligationCause, OverflowError, WellFormedLoc, specialization_graph,
78};
79use crate::ty::fast_reject::SimplifiedType;
80use crate::ty::layout::ValidityRequirement;
81use crate::ty::print::{PrintTraitRefExt, describe_as_module};
82use crate::ty::util::AlwaysRequiresDrop;
83use crate::ty::{
84 self, CrateInherentImpls, GenericArg, GenericArgsRef, PseudoCanonicalInput, Ty, TyCtxt,
85 TyCtxtFeed,
86};
87use crate::{dep_graph, mir, thir};
88
89mod arena_cached;
90pub mod erase;
91mod keys;
92pub use keys::{AsLocalKey, Key, LocalCrate};
93pub mod on_disk_cache;
94#[macro_use]
95pub mod plumbing;
96pub use plumbing::{IntoQueryParam, TyCtxtAt, TyCtxtEnsureDone, TyCtxtEnsureOk};
97
98rustc_queries! {
110 query trigger_delayed_bug(key: DefId) {
112 desc { "triggering a delayed bug for testing incremental" }
113 }
114
115 query registered_tools(_: ()) -> &'tcx ty::RegisteredTools {
117 arena_cache
118 desc { "compute registered tools for crate" }
119 }
120
121 query early_lint_checks(_: ()) {
122 desc { "perform lints prior to AST lowering" }
123 }
124
125 query env_var_os(key: &'tcx OsStr) -> Option<&'tcx OsStr> {
135 eval_always
137 desc { "get the value of an environment variable" }
138 }
139
140 query resolutions(_: ()) -> &'tcx ty::ResolverGlobalCtxt {
141 no_hash
142 desc { "getting the resolver outputs" }
143 }
144
145 query resolver_for_lowering_raw(_: ()) -> (&'tcx Steal<(ty::ResolverAstLowering, Arc<ast::Crate>)>, &'tcx ty::ResolverGlobalCtxt) {
146 eval_always
147 no_hash
148 desc { "getting the resolver for lowering" }
149 }
150
151 query source_span(key: LocalDefId) -> Span {
157 eval_always
159 desc { "getting the source span" }
160 }
161
162 query hir_crate(key: ()) -> &'tcx Crate<'tcx> {
170 arena_cache
171 eval_always
172 desc { "getting the crate HIR" }
173 }
174
175 query hir_crate_items(_: ()) -> &'tcx rustc_middle::hir::ModuleItems {
177 arena_cache
178 eval_always
179 desc { "getting HIR crate items" }
180 }
181
182 query hir_module_items(key: LocalModDefId) -> &'tcx rustc_middle::hir::ModuleItems {
187 arena_cache
188 desc { |tcx| "getting HIR module items in `{}`", tcx.def_path_str(key) }
189 cache_on_disk_if { true }
190 }
191
192 query local_def_id_to_hir_id(key: LocalDefId) -> hir::HirId {
194 desc { |tcx| "getting HIR ID of `{}`", tcx.def_path_str(key) }
195 feedable
196 }
197
198 query hir_owner_parent(key: hir::OwnerId) -> hir::HirId {
203 desc { |tcx| "getting HIR parent of `{}`", tcx.def_path_str(key) }
204 }
205
206 query opt_hir_owner_nodes(key: LocalDefId) -> Option<&'tcx hir::OwnerNodes<'tcx>> {
211 desc { |tcx| "getting HIR owner items in `{}`", tcx.def_path_str(key) }
212 feedable
213 }
214
215 query hir_attr_map(key: hir::OwnerId) -> &'tcx hir::AttributeMap<'tcx> {
220 desc { |tcx| "getting HIR owner attributes in `{}`", tcx.def_path_str(key) }
221 feedable
222 }
223
224 query const_param_default(param: DefId) -> ty::EarlyBinder<'tcx, ty::Const<'tcx>> {
228 desc { |tcx| "computing the default for const parameter `{}`", tcx.def_path_str(param) }
229 cache_on_disk_if { param.is_local() }
230 separate_provide_extern
231 }
232
233 query type_of(key: DefId) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
252 desc { |tcx|
253 "{action} `{path}`",
254 action = match tcx.def_kind(key) {
255 DefKind::TyAlias => "expanding type alias",
256 DefKind::TraitAlias => "expanding trait alias",
257 _ => "computing type of",
258 },
259 path = tcx.def_path_str(key),
260 }
261 cache_on_disk_if { key.is_local() }
262 separate_provide_extern
263 feedable
264 }
265
266 query type_of_opaque(key: DefId) -> Result<ty::EarlyBinder<'tcx, Ty<'tcx>>, CyclePlaceholder> {
277 desc { |tcx|
278 "computing type of opaque `{path}`",
279 path = tcx.def_path_str(key),
280 }
281 cycle_stash
282 }
283 query type_of_opaque_hir_typeck(key: LocalDefId) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
284 desc { |tcx|
285 "computing type of opaque `{path}` via HIR typeck",
286 path = tcx.def_path_str(key),
287 }
288 }
289
290 query type_alias_is_lazy(key: DefId) -> bool {
304 desc { |tcx|
305 "computing whether the type alias `{path}` is lazy",
306 path = tcx.def_path_str(key),
307 }
308 separate_provide_extern
309 }
310
311 query collect_return_position_impl_trait_in_trait_tys(key: DefId)
312 -> Result<&'tcx DefIdMap<ty::EarlyBinder<'tcx, Ty<'tcx>>>, ErrorGuaranteed>
313 {
314 desc { "comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process" }
315 cache_on_disk_if { key.is_local() }
316 separate_provide_extern
317 }
318
319 query opaque_ty_origin(key: DefId) -> hir::OpaqueTyOrigin<DefId>
320 {
321 desc { "determine where the opaque originates from" }
322 separate_provide_extern
323 }
324
325 query unsizing_params_for_adt(key: DefId) -> &'tcx rustc_index::bit_set::DenseBitSet<u32>
326 {
327 arena_cache
328 desc { |tcx|
329 "determining what parameters of `{}` can participate in unsizing",
330 tcx.def_path_str(key),
331 }
332 }
333
334 query analysis(key: ()) {
336 eval_always
337 desc { "running analysis passes on this crate" }
338 }
339
340 query check_expectations(key: Option<Symbol>) {
355 eval_always
356 desc { "checking lint expectations (RFC 2383)" }
357 }
358
359 query generics_of(key: DefId) -> &'tcx ty::Generics {
361 desc { |tcx| "computing generics of `{}`", tcx.def_path_str(key) }
362 arena_cache
363 cache_on_disk_if { key.is_local() }
364 separate_provide_extern
365 feedable
366 }
367
368 query predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
376 desc { |tcx| "computing predicates of `{}`", tcx.def_path_str(key) }
377 cache_on_disk_if { key.is_local() }
378 feedable
379 }
380
381 query opaque_types_defined_by(
382 key: LocalDefId
383 ) -> &'tcx ty::List<LocalDefId> {
384 desc {
385 |tcx| "computing the opaque types defined by `{}`",
386 tcx.def_path_str(key.to_def_id())
387 }
388 }
389
390 query nested_bodies_within(
391 key: LocalDefId
392 ) -> &'tcx ty::List<LocalDefId> {
393 desc {
394 |tcx| "computing the coroutines defined within `{}`",
395 tcx.def_path_str(key.to_def_id())
396 }
397 }
398
399 query explicit_item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
418 desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
419 cache_on_disk_if { key.is_local() }
420 separate_provide_extern
421 feedable
422 }
423
424 query explicit_item_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
431 desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
432 cache_on_disk_if { key.is_local() }
433 separate_provide_extern
434 feedable
435 }
436
437 query item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
461 desc { |tcx| "elaborating item bounds for `{}`", tcx.def_path_str(key) }
462 }
463
464 query item_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
465 desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
466 }
467
468 query item_non_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
469 desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
470 }
471
472 query impl_super_outlives(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
473 desc { |tcx| "elaborating supertrait outlives for trait of `{}`", tcx.def_path_str(key) }
474 }
475
476 query native_libraries(_: CrateNum) -> &'tcx Vec<NativeLib> {
481 arena_cache
482 desc { "looking up the native libraries of a linked crate" }
483 separate_provide_extern
484 }
485
486 query shallow_lint_levels_on(key: hir::OwnerId) -> &'tcx rustc_middle::lint::ShallowLintLevelMap {
487 arena_cache
488 desc { |tcx| "looking up lint levels for `{}`", tcx.def_path_str(key) }
489 }
490
491 query lint_expectations(_: ()) -> &'tcx Vec<(LintExpectationId, LintExpectation)> {
492 arena_cache
493 desc { "computing `#[expect]`ed lints in this crate" }
494 }
495
496 query lints_that_dont_need_to_run(_: ()) -> &'tcx UnordSet<LintId> {
497 arena_cache
498 desc { "Computing all lints that are explicitly enabled or with a default level greater than Allow" }
499 }
500
501 query expn_that_defined(key: DefId) -> rustc_span::ExpnId {
502 desc { |tcx| "getting the expansion that defined `{}`", tcx.def_path_str(key) }
503 separate_provide_extern
504 }
505
506 query is_panic_runtime(_: CrateNum) -> bool {
507 fatal_cycle
508 desc { "checking if the crate is_panic_runtime" }
509 separate_provide_extern
510 }
511
512 query representability(_: LocalDefId) -> rustc_middle::ty::Representability {
514 desc { "checking if `{}` is representable", tcx.def_path_str(key) }
515 cycle_delay_bug
517 anon
521 }
522
523 query representability_adt_ty(_: Ty<'tcx>) -> rustc_middle::ty::Representability {
525 desc { "checking if `{}` is representable", key }
526 cycle_delay_bug
527 anon
528 }
529
530 query params_in_repr(key: DefId) -> &'tcx rustc_index::bit_set::DenseBitSet<u32> {
532 desc { "finding type parameters in the representation" }
533 arena_cache
534 no_hash
535 separate_provide_extern
536 }
537
538 query thir_body(key: LocalDefId) -> Result<(&'tcx Steal<thir::Thir<'tcx>>, thir::ExprId), ErrorGuaranteed> {
540 no_hash
542 desc { |tcx| "building THIR for `{}`", tcx.def_path_str(key) }
543 }
544
545 query mir_keys(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexSet<LocalDefId> {
549 arena_cache
550 desc { "getting a list of all mir_keys" }
551 }
552
553 query mir_const_qualif(key: DefId) -> mir::ConstQualifs {
557 desc { |tcx| "const checking `{}`", tcx.def_path_str(key) }
558 cache_on_disk_if { key.is_local() }
559 separate_provide_extern
560 }
561
562 query mir_built(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
568 desc { |tcx| "building MIR for `{}`", tcx.def_path_str(key) }
569 feedable
570 }
571
572 query thir_abstract_const(
574 key: DefId
575 ) -> Result<Option<ty::EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed> {
576 desc {
577 |tcx| "building an abstract representation for `{}`", tcx.def_path_str(key),
578 }
579 separate_provide_extern
580 }
581
582 query mir_drops_elaborated_and_const_checked(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
583 no_hash
584 desc { |tcx| "elaborating drops for `{}`", tcx.def_path_str(key) }
585 }
586
587 query mir_for_ctfe(
588 key: DefId
589 ) -> &'tcx mir::Body<'tcx> {
590 desc { |tcx| "caching mir of `{}` for CTFE", tcx.def_path_str(key) }
591 cache_on_disk_if { key.is_local() }
592 separate_provide_extern
593 }
594
595 query mir_promoted(key: LocalDefId) -> (
596 &'tcx Steal<mir::Body<'tcx>>,
597 &'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>>
598 ) {
599 no_hash
600 desc { |tcx| "promoting constants in MIR for `{}`", tcx.def_path_str(key) }
601 }
602
603 query closure_typeinfo(key: LocalDefId) -> ty::ClosureTypeInfo<'tcx> {
604 desc {
605 |tcx| "finding symbols for captures of closure `{}`",
606 tcx.def_path_str(key)
607 }
608 }
609
610 query closure_saved_names_of_captured_variables(def_id: DefId) -> &'tcx IndexVec<abi::FieldIdx, Symbol> {
618 arena_cache
619 desc { |tcx| "computing debuginfo for closure `{}`", tcx.def_path_str(def_id) }
620 separate_provide_extern
621 }
622
623 query mir_coroutine_witnesses(key: DefId) -> Option<&'tcx mir::CoroutineLayout<'tcx>> {
624 arena_cache
625 desc { |tcx| "coroutine witness types for `{}`", tcx.def_path_str(key) }
626 cache_on_disk_if { key.is_local() }
627 separate_provide_extern
628 }
629
630 query check_coroutine_obligations(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
631 desc { |tcx| "verify auto trait bounds for coroutine interior type `{}`", tcx.def_path_str(key) }
632 return_result_from_ensure_ok
633 }
634
635 query optimized_mir(key: DefId) -> &'tcx mir::Body<'tcx> {
638 desc { |tcx| "optimizing MIR for `{}`", tcx.def_path_str(key) }
639 cache_on_disk_if { key.is_local() }
640 separate_provide_extern
641 }
642
643 query coverage_attr_on(key: LocalDefId) -> bool {
649 desc { |tcx| "checking for `#[coverage(..)]` on `{}`", tcx.def_path_str(key) }
650 feedable
651 }
652
653 query coverage_ids_info(key: ty::InstanceKind<'tcx>) -> Option<&'tcx mir::coverage::CoverageIdsInfo> {
666 desc { |tcx| "retrieving coverage IDs info from MIR for `{}`", tcx.def_path_str(key.def_id()) }
667 arena_cache
668 }
669
670 query promoted_mir(key: DefId) -> &'tcx IndexVec<mir::Promoted, mir::Body<'tcx>> {
676 desc { |tcx| "optimizing promoted MIR for `{}`", tcx.def_path_str(key) }
677 cache_on_disk_if { key.is_local() }
678 separate_provide_extern
679 }
680
681 query erase_regions_ty(ty: Ty<'tcx>) -> Ty<'tcx> {
685 anon
692 desc { "erasing regions from `{}`", ty }
693 }
694
695 query wasm_import_module_map(_: CrateNum) -> &'tcx DefIdMap<String> {
696 arena_cache
697 desc { "getting wasm import module map" }
698 }
699
700 query trait_explicit_predicates_and_bounds(key: LocalDefId) -> ty::GenericPredicates<'tcx> {
722 desc { |tcx| "computing explicit predicates of trait `{}`", tcx.def_path_str(key) }
723 }
724
725 query explicit_predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
731 desc { |tcx| "computing explicit predicates of `{}`", tcx.def_path_str(key) }
732 cache_on_disk_if { key.is_local() }
733 separate_provide_extern
734 feedable
735 }
736
737 query inferred_outlives_of(key: DefId) -> &'tcx [(ty::Clause<'tcx>, Span)] {
744 desc { |tcx| "computing inferred outlives-predicates of `{}`", tcx.def_path_str(key) }
745 cache_on_disk_if { key.is_local() }
746 separate_provide_extern
747 feedable
748 }
749
750 query explicit_super_predicates_of(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
758 desc { |tcx| "computing the super predicates of `{}`", tcx.def_path_str(key) }
759 cache_on_disk_if { key.is_local() }
760 separate_provide_extern
761 }
762
763 query explicit_implied_predicates_of(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
770 desc { |tcx| "computing the implied predicates of `{}`", tcx.def_path_str(key) }
771 cache_on_disk_if { key.is_local() }
772 separate_provide_extern
773 }
774
775 query explicit_supertraits_containing_assoc_item(
779 key: (DefId, rustc_span::Ident)
780 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
781 desc { |tcx| "computing the super traits of `{}` with associated type name `{}`",
782 tcx.def_path_str(key.0),
783 key.1
784 }
785 }
786
787 query const_conditions(
797 key: DefId
798 ) -> ty::ConstConditions<'tcx> {
799 desc { |tcx| "computing the conditions for `{}` to be considered const",
800 tcx.def_path_str(key)
801 }
802 separate_provide_extern
803 }
804
805 query explicit_implied_const_bounds(
811 key: DefId
812 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::PolyTraitRef<'tcx>, Span)]> {
813 desc { |tcx| "computing the implied `~const` bounds for `{}`",
814 tcx.def_path_str(key)
815 }
816 separate_provide_extern
817 }
818
819 query type_param_predicates(
822 key: (LocalDefId, LocalDefId, rustc_span::Ident)
823 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
824 desc { |tcx| "computing the bounds for type parameter `{}`", tcx.hir_ty_param_name(key.1) }
825 }
826
827 query trait_def(key: DefId) -> &'tcx ty::TraitDef {
828 desc { |tcx| "computing trait definition for `{}`", tcx.def_path_str(key) }
829 arena_cache
830 cache_on_disk_if { key.is_local() }
831 separate_provide_extern
832 }
833 query adt_def(key: DefId) -> ty::AdtDef<'tcx> {
834 desc { |tcx| "computing ADT definition for `{}`", tcx.def_path_str(key) }
835 cache_on_disk_if { key.is_local() }
836 separate_provide_extern
837 }
838 query adt_destructor(key: DefId) -> Option<ty::Destructor> {
839 desc { |tcx| "computing `Drop` impl for `{}`", tcx.def_path_str(key) }
840 cache_on_disk_if { key.is_local() }
841 separate_provide_extern
842 }
843 query adt_async_destructor(key: DefId) -> Option<ty::AsyncDestructor> {
844 desc { |tcx| "computing `AsyncDrop` impl for `{}`", tcx.def_path_str(key) }
845 cache_on_disk_if { key.is_local() }
846 separate_provide_extern
847 }
848
849 query adt_sized_constraint(key: DefId) -> Option<ty::EarlyBinder<'tcx, Ty<'tcx>>> {
850 desc { |tcx| "computing the `Sized` constraint for `{}`", tcx.def_path_str(key) }
851 }
852
853 query adt_dtorck_constraint(
854 key: DefId
855 ) -> &'tcx DropckConstraint<'tcx> {
856 desc { |tcx| "computing drop-check constraints for `{}`", tcx.def_path_str(key) }
857 }
858
859 query constness(key: DefId) -> hir::Constness {
881 desc { |tcx| "checking if item is const: `{}`", tcx.def_path_str(key) }
882 separate_provide_extern
883 feedable
884 }
885
886 query asyncness(key: DefId) -> ty::Asyncness {
887 desc { |tcx| "checking if the function is async: `{}`", tcx.def_path_str(key) }
888 separate_provide_extern
889 }
890
891 query is_promotable_const_fn(key: DefId) -> bool {
899 desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) }
900 }
901
902 query coroutine_by_move_body_def_id(def_id: DefId) -> DefId {
909 desc { |tcx| "looking up the coroutine by-move body for `{}`", tcx.def_path_str(def_id) }
910 separate_provide_extern
911 }
912
913 query coroutine_kind(def_id: DefId) -> Option<hir::CoroutineKind> {
915 desc { |tcx| "looking up coroutine kind of `{}`", tcx.def_path_str(def_id) }
916 separate_provide_extern
917 feedable
918 }
919
920 query coroutine_for_closure(def_id: DefId) -> DefId {
921 desc { |_tcx| "Given a coroutine-closure def id, return the def id of the coroutine returned by it" }
922 separate_provide_extern
923 }
924
925 query coroutine_hidden_types(
926 def_id: DefId
927 ) -> ty::EarlyBinder<'tcx, ty::Binder<'tcx, ty::CoroutineWitnessTypes<TyCtxt<'tcx>>>> {
928 desc { "looking up the hidden types stored across await points in a coroutine" }
929 }
930
931 query crate_variances(_: ()) -> &'tcx ty::CrateVariancesMap<'tcx> {
939 arena_cache
940 desc { "computing the variances for items in this crate" }
941 }
942
943 query variances_of(def_id: DefId) -> &'tcx [ty::Variance] {
951 desc { |tcx| "computing the variances of `{}`", tcx.def_path_str(def_id) }
952 cache_on_disk_if { def_id.is_local() }
953 separate_provide_extern
954 cycle_delay_bug
955 }
956
957 query inferred_outlives_crate(_: ()) -> &'tcx ty::CratePredicatesMap<'tcx> {
965 arena_cache
966 desc { "computing the inferred outlives-predicates for items in this crate" }
967 }
968
969 query associated_item_def_ids(key: DefId) -> &'tcx [DefId] {
972 desc { |tcx| "collecting associated items or fields of `{}`", tcx.def_path_str(key) }
973 cache_on_disk_if { key.is_local() }
974 separate_provide_extern
975 }
976
977 query associated_item(key: DefId) -> ty::AssocItem {
979 desc { |tcx| "computing associated item data for `{}`", tcx.def_path_str(key) }
980 cache_on_disk_if { key.is_local() }
981 separate_provide_extern
982 feedable
983 }
984
985 query associated_items(key: DefId) -> &'tcx ty::AssocItems {
987 arena_cache
988 desc { |tcx| "collecting associated items of `{}`", tcx.def_path_str(key) }
989 }
990
991 query impl_item_implementor_ids(impl_id: DefId) -> &'tcx DefIdMap<DefId> {
1013 arena_cache
1014 desc { |tcx| "comparing impl items against trait for `{}`", tcx.def_path_str(impl_id) }
1015 }
1016
1017 query associated_types_for_impl_traits_in_associated_fn(fn_def_id: DefId) -> &'tcx [DefId] {
1024 desc { |tcx| "creating associated items for opaque types returned by `{}`", tcx.def_path_str(fn_def_id) }
1025 cache_on_disk_if { fn_def_id.is_local() }
1026 separate_provide_extern
1027 }
1028
1029 query associated_type_for_impl_trait_in_trait(opaque_ty_def_id: LocalDefId) -> LocalDefId {
1032 desc { |tcx| "creating the associated item corresponding to the opaque type `{}`", tcx.def_path_str(opaque_ty_def_id.to_def_id()) }
1033 cache_on_disk_if { true }
1034 }
1035
1036 query impl_trait_header(impl_id: DefId) -> Option<ty::ImplTraitHeader<'tcx>> {
1039 desc { |tcx| "computing trait implemented by `{}`", tcx.def_path_str(impl_id) }
1040 cache_on_disk_if { impl_id.is_local() }
1041 separate_provide_extern
1042 }
1043
1044 query impl_self_is_guaranteed_unsized(impl_def_id: DefId) -> bool {
1048 desc { |tcx| "computing whether `{}` has a guaranteed unsized self type", tcx.def_path_str(impl_def_id) }
1049 }
1050
1051 query inherent_impls(key: DefId) -> &'tcx [DefId] {
1055 desc { |tcx| "collecting inherent impls for `{}`", tcx.def_path_str(key) }
1056 cache_on_disk_if { key.is_local() }
1057 separate_provide_extern
1058 }
1059
1060 query incoherent_impls(key: SimplifiedType) -> &'tcx [DefId] {
1061 desc { |tcx| "collecting all inherent impls for `{:?}`", key }
1062 }
1063
1064 query check_unsafety(key: LocalDefId) {
1066 desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key) }
1067 }
1068
1069 query check_tail_calls(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
1071 desc { |tcx| "tail-call-checking `{}`", tcx.def_path_str(key) }
1072 return_result_from_ensure_ok
1073 }
1074
1075 query assumed_wf_types(key: LocalDefId) -> &'tcx [(Ty<'tcx>, Span)] {
1080 desc { |tcx| "computing the implied bounds of `{}`", tcx.def_path_str(key) }
1081 }
1082
1083 query assumed_wf_types_for_rpitit(key: DefId) -> &'tcx [(Ty<'tcx>, Span)] {
1086 desc { |tcx| "computing the implied bounds of `{}`", tcx.def_path_str(key) }
1087 separate_provide_extern
1088 }
1089
1090 query fn_sig(key: DefId) -> ty::EarlyBinder<'tcx, ty::PolyFnSig<'tcx>> {
1092 desc { |tcx| "computing function signature of `{}`", tcx.def_path_str(key) }
1093 cache_on_disk_if { key.is_local() }
1094 separate_provide_extern
1095 cycle_delay_bug
1096 }
1097
1098 query lint_mod(key: LocalModDefId) {
1100 desc { |tcx| "linting {}", describe_as_module(key, tcx) }
1101 }
1102
1103 query check_unused_traits(_: ()) {
1104 desc { "checking unused trait imports in crate" }
1105 }
1106
1107 query check_mod_attrs(key: LocalModDefId) {
1109 desc { |tcx| "checking attributes in {}", describe_as_module(key, tcx) }
1110 }
1111
1112 query check_mod_unstable_api_usage(key: LocalModDefId) {
1114 desc { |tcx| "checking for unstable API usage in {}", describe_as_module(key, tcx) }
1115 }
1116
1117 query check_mod_loops(key: LocalModDefId) {
1119 desc { |tcx| "checking loops in {}", describe_as_module(key, tcx) }
1120 }
1121
1122 query check_mod_naked_functions(key: LocalModDefId) {
1123 desc { |tcx| "checking naked functions in {}", describe_as_module(key, tcx) }
1124 }
1125
1126 query check_mod_privacy(key: LocalModDefId) {
1127 desc { |tcx| "checking privacy in {}", describe_as_module(key.to_local_def_id(), tcx) }
1128 }
1129
1130 query check_liveness(key: LocalDefId) {
1131 desc { |tcx| "checking liveness of variables in `{}`", tcx.def_path_str(key) }
1132 }
1133
1134 query live_symbols_and_ignored_derived_traits(_: ()) -> &'tcx (
1139 LocalDefIdSet,
1140 LocalDefIdMap<Vec<(DefId, DefId)>>
1141 ) {
1142 arena_cache
1143 desc { "finding live symbols in crate" }
1144 }
1145
1146 query check_mod_deathness(key: LocalModDefId) {
1147 desc { |tcx| "checking deathness of variables in {}", describe_as_module(key, tcx) }
1148 }
1149
1150 query check_mod_type_wf(key: LocalModDefId) -> Result<(), ErrorGuaranteed> {
1151 desc { |tcx| "checking that types are well-formed in {}", describe_as_module(key, tcx) }
1152 return_result_from_ensure_ok
1153 }
1154
1155 query coerce_unsized_info(key: DefId) -> Result<ty::adjustment::CoerceUnsizedInfo, ErrorGuaranteed> {
1157 desc { |tcx| "computing CoerceUnsized info for `{}`", tcx.def_path_str(key) }
1158 cache_on_disk_if { key.is_local() }
1159 separate_provide_extern
1160 return_result_from_ensure_ok
1161 }
1162
1163 query typeck(key: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> {
1164 desc { |tcx| "type-checking `{}`", tcx.def_path_str(key) }
1165 cache_on_disk_if(tcx) { !tcx.is_typeck_child(key.to_def_id()) }
1166 }
1167
1168 query used_trait_imports(key: LocalDefId) -> &'tcx UnordSet<LocalDefId> {
1169 desc { |tcx| "finding used_trait_imports `{}`", tcx.def_path_str(key) }
1170 cache_on_disk_if { true }
1171 }
1172
1173 query coherent_trait(def_id: DefId) -> Result<(), ErrorGuaranteed> {
1174 desc { |tcx| "coherence checking all impls of trait `{}`", tcx.def_path_str(def_id) }
1175 return_result_from_ensure_ok
1176 }
1177
1178 query mir_borrowck(key: LocalDefId) -> Result<&'tcx mir::ConcreteOpaqueTypes<'tcx>, ErrorGuaranteed> {
1181 desc { |tcx| "borrow-checking `{}`", tcx.def_path_str(key) }
1182 }
1183
1184 query crate_inherent_impls(k: ()) -> (&'tcx CrateInherentImpls, Result<(), ErrorGuaranteed>) {
1192 desc { "finding all inherent impls defined in crate" }
1193 }
1194
1195 query crate_inherent_impls_validity_check(_: ()) -> Result<(), ErrorGuaranteed> {
1203 desc { "check for inherent impls that should not be defined in crate" }
1204 return_result_from_ensure_ok
1205 }
1206
1207 query crate_inherent_impls_overlap_check(_: ()) -> Result<(), ErrorGuaranteed> {
1215 desc { "check for overlap between inherent impls defined in this crate" }
1216 return_result_from_ensure_ok
1217 }
1218
1219 query orphan_check_impl(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1222 desc { |tcx|
1223 "checking whether impl `{}` follows the orphan rules",
1224 tcx.def_path_str(key),
1225 }
1226 return_result_from_ensure_ok
1227 }
1228
1229 query mir_callgraph_reachable(key: (ty::Instance<'tcx>, LocalDefId)) -> bool {
1232 fatal_cycle
1233 desc { |tcx|
1234 "computing if `{}` (transitively) calls `{}`",
1235 key.0,
1236 tcx.def_path_str(key.1),
1237 }
1238 }
1239
1240 query mir_inliner_callees(key: ty::InstanceKind<'tcx>) -> &'tcx [(DefId, GenericArgsRef<'tcx>)] {
1242 fatal_cycle
1243 desc { |tcx|
1244 "computing all local function calls in `{}`",
1245 tcx.def_path_str(key.def_id()),
1246 }
1247 }
1248
1249 query tag_for_variant(
1257 key: (Ty<'tcx>, abi::VariantIdx)
1258 ) -> Option<ty::ScalarInt> {
1259 desc { "computing variant tag for enum" }
1260 }
1261
1262 query eval_to_allocation_raw(key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>)
1271 -> EvalToAllocationRawResult<'tcx> {
1272 desc { |tcx|
1273 "const-evaluating + checking `{}`",
1274 key.value.display(tcx)
1275 }
1276 cache_on_disk_if { true }
1277 }
1278
1279 query eval_static_initializer(key: DefId) -> EvalStaticInitializerRawResult<'tcx> {
1281 desc { |tcx|
1282 "evaluating initializer of static `{}`",
1283 tcx.def_path_str(key)
1284 }
1285 cache_on_disk_if { key.is_local() }
1286 separate_provide_extern
1287 feedable
1288 }
1289
1290 query eval_to_const_value_raw(key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>)
1303 -> EvalToConstValueResult<'tcx> {
1304 desc { |tcx|
1305 "simplifying constant for the type system `{}`",
1306 key.value.display(tcx)
1307 }
1308 depth_limit
1309 cache_on_disk_if { true }
1310 }
1311
1312 query eval_to_valtree(
1315 key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>
1316 ) -> EvalToValTreeResult<'tcx> {
1317 desc { "evaluating type-level constant" }
1318 }
1319
1320 query valtree_to_const_val(key: ty::Value<'tcx>) -> mir::ConstValue<'tcx> {
1322 desc { "converting type-level constant value to MIR constant value"}
1323 }
1324
1325 query destructure_const(key: ty::Const<'tcx>) -> ty::DestructuredConst<'tcx> {
1328 desc { "destructuring type level constant"}
1329 }
1330
1331 query lit_to_const(
1333 key: LitToConstInput<'tcx>
1334 ) -> ty::Const<'tcx> {
1335 desc { "converting literal to const" }
1336 }
1337
1338 query check_match(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
1339 desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) }
1340 return_result_from_ensure_ok
1341 }
1342
1343 query effective_visibilities(_: ()) -> &'tcx EffectiveVisibilities {
1345 eval_always
1346 desc { "checking effective visibilities" }
1347 }
1348 query check_private_in_public(_: ()) {
1349 eval_always
1350 desc { "checking for private elements in public interfaces" }
1351 }
1352
1353 query reachable_set(_: ()) -> &'tcx LocalDefIdSet {
1354 arena_cache
1355 desc { "reachability" }
1356 cache_on_disk_if { true }
1357 }
1358
1359 query region_scope_tree(def_id: DefId) -> &'tcx crate::middle::region::ScopeTree {
1362 desc { |tcx| "computing drop scopes for `{}`", tcx.def_path_str(def_id) }
1363 }
1364
1365 query mir_shims(key: ty::InstanceKind<'tcx>) -> &'tcx mir::Body<'tcx> {
1367 arena_cache
1368 desc {
1369 |tcx| "generating MIR shim for `{}`, instance={:?}",
1370 tcx.def_path_str(key.def_id()),
1371 key
1372 }
1373 }
1374
1375 query symbol_name(key: ty::Instance<'tcx>) -> ty::SymbolName<'tcx> {
1379 desc { "computing the symbol for `{}`", key }
1380 cache_on_disk_if { true }
1381 }
1382
1383 query def_kind(def_id: DefId) -> DefKind {
1384 desc { |tcx| "looking up definition kind of `{}`", tcx.def_path_str(def_id) }
1385 cache_on_disk_if { def_id.is_local() }
1386 separate_provide_extern
1387 feedable
1388 }
1389
1390 query def_span(def_id: DefId) -> Span {
1392 desc { |tcx| "looking up span for `{}`", tcx.def_path_str(def_id) }
1393 cache_on_disk_if { def_id.is_local() }
1394 separate_provide_extern
1395 feedable
1396 }
1397
1398 query def_ident_span(def_id: DefId) -> Option<Span> {
1400 desc { |tcx| "looking up span for `{}`'s identifier", tcx.def_path_str(def_id) }
1401 cache_on_disk_if { def_id.is_local() }
1402 separate_provide_extern
1403 feedable
1404 }
1405
1406 query lookup_stability(def_id: DefId) -> Option<attr::Stability> {
1407 desc { |tcx| "looking up stability of `{}`", tcx.def_path_str(def_id) }
1408 cache_on_disk_if { def_id.is_local() }
1409 separate_provide_extern
1410 }
1411
1412 query lookup_const_stability(def_id: DefId) -> Option<attr::ConstStability> {
1413 desc { |tcx| "looking up const stability of `{}`", tcx.def_path_str(def_id) }
1414 cache_on_disk_if { def_id.is_local() }
1415 separate_provide_extern
1416 }
1417
1418 query lookup_default_body_stability(def_id: DefId) -> Option<attr::DefaultBodyStability> {
1419 desc { |tcx| "looking up default body stability of `{}`", tcx.def_path_str(def_id) }
1420 separate_provide_extern
1421 }
1422
1423 query should_inherit_track_caller(def_id: DefId) -> bool {
1424 desc { |tcx| "computing should_inherit_track_caller of `{}`", tcx.def_path_str(def_id) }
1425 }
1426
1427 query lookup_deprecation_entry(def_id: DefId) -> Option<DeprecationEntry> {
1428 desc { |tcx| "checking whether `{}` is deprecated", tcx.def_path_str(def_id) }
1429 cache_on_disk_if { def_id.is_local() }
1430 separate_provide_extern
1431 }
1432
1433 query is_doc_hidden(def_id: DefId) -> bool {
1435 desc { |tcx| "checking whether `{}` is `doc(hidden)`", tcx.def_path_str(def_id) }
1436 separate_provide_extern
1437 }
1438
1439 query is_doc_notable_trait(def_id: DefId) -> bool {
1441 desc { |tcx| "checking whether `{}` is `doc(notable_trait)`", tcx.def_path_str(def_id) }
1442 }
1443
1444 query attrs_for_def(def_id: DefId) -> &'tcx [hir::Attribute] {
1448 desc { |tcx| "collecting attributes of `{}`", tcx.def_path_str(def_id) }
1449 separate_provide_extern
1450 }
1451
1452 query codegen_fn_attrs(def_id: DefId) -> &'tcx CodegenFnAttrs {
1453 desc { |tcx| "computing codegen attributes of `{}`", tcx.def_path_str(def_id) }
1454 arena_cache
1455 cache_on_disk_if { def_id.is_local() }
1456 separate_provide_extern
1457 feedable
1458 }
1459
1460 query asm_target_features(def_id: DefId) -> &'tcx FxIndexSet<Symbol> {
1461 desc { |tcx| "computing target features for inline asm of `{}`", tcx.def_path_str(def_id) }
1462 }
1463
1464 query fn_arg_idents(def_id: DefId) -> &'tcx [Option<rustc_span::Ident>] {
1465 desc { |tcx| "looking up function parameter identifiers for `{}`", tcx.def_path_str(def_id) }
1466 separate_provide_extern
1467 }
1468
1469 query rendered_const(def_id: DefId) -> &'tcx String {
1472 arena_cache
1473 desc { |tcx| "rendering constant initializer of `{}`", tcx.def_path_str(def_id) }
1474 separate_provide_extern
1475 }
1476
1477 query rendered_precise_capturing_args(def_id: DefId) -> Option<&'tcx [PreciseCapturingArgKind<Symbol, Symbol>]> {
1479 desc { |tcx| "rendering precise capturing args for `{}`", tcx.def_path_str(def_id) }
1480 separate_provide_extern
1481 }
1482
1483 query impl_parent(def_id: DefId) -> Option<DefId> {
1484 desc { |tcx| "computing specialization parent impl of `{}`", tcx.def_path_str(def_id) }
1485 separate_provide_extern
1486 }
1487
1488 query is_ctfe_mir_available(key: DefId) -> bool {
1489 desc { |tcx| "checking if item has CTFE MIR available: `{}`", tcx.def_path_str(key) }
1490 cache_on_disk_if { key.is_local() }
1491 separate_provide_extern
1492 }
1493 query is_mir_available(key: DefId) -> bool {
1494 desc { |tcx| "checking if item has MIR available: `{}`", tcx.def_path_str(key) }
1495 cache_on_disk_if { key.is_local() }
1496 separate_provide_extern
1497 }
1498
1499 query own_existential_vtable_entries(
1500 key: DefId
1501 ) -> &'tcx [DefId] {
1502 desc { |tcx| "finding all existential vtable entries for trait `{}`", tcx.def_path_str(key) }
1503 }
1504
1505 query vtable_entries(key: ty::TraitRef<'tcx>)
1506 -> &'tcx [ty::VtblEntry<'tcx>] {
1507 desc { |tcx| "finding all vtable entries for trait `{}`", tcx.def_path_str(key.def_id) }
1508 }
1509
1510 query first_method_vtable_slot(key: ty::TraitRef<'tcx>) -> usize {
1511 desc { |tcx| "finding the slot within the vtable of `{}` for the implementation of `{}`", key.self_ty(), key.print_only_trait_name() }
1512 }
1513
1514 query supertrait_vtable_slot(key: (Ty<'tcx>, Ty<'tcx>)) -> Option<usize> {
1515 desc { |tcx| "finding the slot within vtable for trait object `{}` vtable ptr during trait upcasting coercion from `{}` vtable",
1516 key.1, key.0 }
1517 }
1518
1519 query vtable_allocation(key: (Ty<'tcx>, Option<ty::ExistentialTraitRef<'tcx>>)) -> mir::interpret::AllocId {
1520 desc { |tcx| "vtable const allocation for <{} as {}>",
1521 key.0,
1522 key.1.map(|trait_ref| format!("{trait_ref}")).unwrap_or("_".to_owned())
1523 }
1524 }
1525
1526 query codegen_select_candidate(
1527 key: PseudoCanonicalInput<'tcx, ty::TraitRef<'tcx>>
1528 ) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
1529 cache_on_disk_if { true }
1530 desc { |tcx| "computing candidate for `{}`", key.value }
1531 }
1532
1533 query all_local_trait_impls(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexMap<DefId, Vec<LocalDefId>> {
1535 desc { "finding local trait impls" }
1536 }
1537
1538 query local_trait_impls(trait_id: DefId) -> &'tcx [LocalDefId] {
1540 desc { "finding local trait impls of `{}`", tcx.def_path_str(trait_id) }
1541 }
1542
1543 query trait_impls_of(trait_id: DefId) -> &'tcx ty::trait_def::TraitImpls {
1545 arena_cache
1546 desc { |tcx| "finding trait impls of `{}`", tcx.def_path_str(trait_id) }
1547 }
1548
1549 query specialization_graph_of(trait_id: DefId) -> Result<&'tcx specialization_graph::Graph, ErrorGuaranteed> {
1550 desc { |tcx| "building specialization graph of trait `{}`", tcx.def_path_str(trait_id) }
1551 cache_on_disk_if { true }
1552 return_result_from_ensure_ok
1553 }
1554 query dyn_compatibility_violations(trait_id: DefId) -> &'tcx [DynCompatibilityViolation] {
1555 desc { |tcx| "determining dyn-compatibility of trait `{}`", tcx.def_path_str(trait_id) }
1556 }
1557 query is_dyn_compatible(trait_id: DefId) -> bool {
1558 desc { |tcx| "checking if trait `{}` is dyn-compatible", tcx.def_path_str(trait_id) }
1559 }
1560
1561 query param_env(def_id: DefId) -> ty::ParamEnv<'tcx> {
1570 desc { |tcx| "computing normalized predicates of `{}`", tcx.def_path_str(def_id) }
1571 feedable
1572 }
1573
1574 query param_env_normalized_for_post_analysis(def_id: DefId) -> ty::ParamEnv<'tcx> {
1578 desc { |tcx| "computing revealed normalized predicates of `{}`", tcx.def_path_str(def_id) }
1579 }
1580
1581 query is_copy_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1584 desc { "computing whether `{}` is `Copy`", env.value }
1585 }
1586 query is_use_cloned_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1589 desc { "computing whether `{}` is `UseCloned`", env.value }
1590 }
1591 query is_sized_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1593 desc { "computing whether `{}` is `Sized`", env.value }
1594 }
1595 query is_freeze_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1597 desc { "computing whether `{}` is freeze", env.value }
1598 }
1599 query is_unpin_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1601 desc { "computing whether `{}` is `Unpin`", env.value }
1602 }
1603 query is_async_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1605 desc { "computing whether `{}` is `AsyncDrop`", env.value }
1606 }
1607 query needs_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1609 desc { "computing whether `{}` needs drop", env.value }
1610 }
1611 query needs_async_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1613 desc { "computing whether `{}` needs async drop", env.value }
1614 }
1615 query has_significant_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1617 desc { "computing whether `{}` has a significant drop", env.value }
1618 }
1619
1620 query has_structural_eq_impl(ty: Ty<'tcx>) -> bool {
1625 desc {
1626 "computing whether `{}` implements `StructuralPartialEq`",
1627 ty
1628 }
1629 }
1630
1631 query adt_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1635 desc { |tcx| "computing when `{}` needs drop", tcx.def_path_str(def_id) }
1636 cache_on_disk_if { true }
1637 }
1638
1639 query adt_async_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1643 desc { |tcx| "computing when `{}` needs async drop", tcx.def_path_str(def_id) }
1644 cache_on_disk_if { true }
1645 }
1646
1647 query adt_significant_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1654 desc { |tcx| "computing when `{}` has a significant destructor", tcx.def_path_str(def_id) }
1655 }
1656
1657 query list_significant_drop_tys(ty: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> &'tcx ty::List<Ty<'tcx>> {
1675 desc { |tcx| "computing when `{}` has a significant destructor", ty.value }
1676 }
1677
1678 query layout_of(
1681 key: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>
1682 ) -> Result<ty::layout::TyAndLayout<'tcx>, &'tcx ty::layout::LayoutError<'tcx>> {
1683 depth_limit
1684 desc { "computing layout of `{}`", key.value }
1685 cycle_delay_bug
1687 }
1688
1689 query fn_abi_of_fn_ptr(
1694 key: ty::PseudoCanonicalInput<'tcx, (ty::PolyFnSig<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
1695 ) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
1696 desc { "computing call ABI of `{}` function pointers", key.value.0 }
1697 }
1698
1699 query fn_abi_of_instance(
1705 key: ty::PseudoCanonicalInput<'tcx, (ty::Instance<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
1706 ) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
1707 desc { "computing call ABI of `{}`", key.value.0 }
1708 }
1709
1710 query dylib_dependency_formats(_: CrateNum)
1711 -> &'tcx [(CrateNum, LinkagePreference)] {
1712 desc { "getting dylib dependency formats of crate" }
1713 separate_provide_extern
1714 }
1715
1716 query dependency_formats(_: ()) -> &'tcx Arc<crate::middle::dependency_format::Dependencies> {
1717 arena_cache
1718 desc { "getting the linkage format of all dependencies" }
1719 }
1720
1721 query is_compiler_builtins(_: CrateNum) -> bool {
1722 fatal_cycle
1723 desc { "checking if the crate is_compiler_builtins" }
1724 separate_provide_extern
1725 }
1726 query has_global_allocator(_: CrateNum) -> bool {
1727 eval_always
1729 fatal_cycle
1730 desc { "checking if the crate has_global_allocator" }
1731 separate_provide_extern
1732 }
1733 query has_alloc_error_handler(_: CrateNum) -> bool {
1734 eval_always
1736 fatal_cycle
1737 desc { "checking if the crate has_alloc_error_handler" }
1738 separate_provide_extern
1739 }
1740 query has_panic_handler(_: CrateNum) -> bool {
1741 fatal_cycle
1742 desc { "checking if the crate has_panic_handler" }
1743 separate_provide_extern
1744 }
1745 query is_profiler_runtime(_: CrateNum) -> bool {
1746 fatal_cycle
1747 desc { "checking if a crate is `#![profiler_runtime]`" }
1748 separate_provide_extern
1749 }
1750 query has_ffi_unwind_calls(key: LocalDefId) -> bool {
1751 desc { |tcx| "checking if `{}` contains FFI-unwind calls", tcx.def_path_str(key) }
1752 cache_on_disk_if { true }
1753 }
1754 query required_panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
1755 fatal_cycle
1756 desc { "getting a crate's required panic strategy" }
1757 separate_provide_extern
1758 }
1759 query panic_in_drop_strategy(_: CrateNum) -> PanicStrategy {
1760 fatal_cycle
1761 desc { "getting a crate's configured panic-in-drop strategy" }
1762 separate_provide_extern
1763 }
1764 query is_no_builtins(_: CrateNum) -> bool {
1765 fatal_cycle
1766 desc { "getting whether a crate has `#![no_builtins]`" }
1767 separate_provide_extern
1768 }
1769 query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
1770 fatal_cycle
1771 desc { "getting a crate's symbol mangling version" }
1772 separate_provide_extern
1773 }
1774
1775 query extern_crate(def_id: CrateNum) -> Option<&'tcx ExternCrate> {
1776 eval_always
1777 desc { "getting crate's ExternCrateData" }
1778 separate_provide_extern
1779 }
1780
1781 query specialization_enabled_in(cnum: CrateNum) -> bool {
1782 desc { "checking whether the crate enabled `specialization`/`min_specialization`" }
1783 separate_provide_extern
1784 }
1785
1786 query specializes(_: (DefId, DefId)) -> bool {
1787 desc { "computing whether impls specialize one another" }
1788 }
1789 query in_scope_traits_map(_: hir::OwnerId)
1790 -> Option<&'tcx ItemLocalMap<Box<[TraitCandidate]>>> {
1791 desc { "getting traits in scope at a block" }
1792 }
1793
1794 query defaultness(def_id: DefId) -> hir::Defaultness {
1796 desc { |tcx| "looking up whether `{}` has `default`", tcx.def_path_str(def_id) }
1797 separate_provide_extern
1798 feedable
1799 }
1800
1801 query check_well_formed(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1802 desc { |tcx| "checking that `{}` is well-formed", tcx.def_path_str(key) }
1803 return_result_from_ensure_ok
1804 }
1805
1806 query enforce_impl_non_lifetime_params_are_constrained(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1807 desc { |tcx| "checking that `{}`'s generics are constrained by the impl header", tcx.def_path_str(key) }
1808 return_result_from_ensure_ok
1809 }
1810
1811 query reachable_non_generics(_: CrateNum)
1824 -> &'tcx DefIdMap<SymbolExportInfo> {
1825 arena_cache
1826 desc { "looking up the exported symbols of a crate" }
1827 separate_provide_extern
1828 }
1829 query is_reachable_non_generic(def_id: DefId) -> bool {
1830 desc { |tcx| "checking whether `{}` is an exported symbol", tcx.def_path_str(def_id) }
1831 cache_on_disk_if { def_id.is_local() }
1832 separate_provide_extern
1833 }
1834 query is_unreachable_local_definition(def_id: LocalDefId) -> bool {
1835 desc { |tcx|
1836 "checking whether `{}` is reachable from outside the crate",
1837 tcx.def_path_str(def_id),
1838 }
1839 }
1840
1841 query upstream_monomorphizations(_: ()) -> &'tcx DefIdMap<UnordMap<GenericArgsRef<'tcx>, CrateNum>> {
1849 arena_cache
1850 desc { "collecting available upstream monomorphizations" }
1851 }
1852
1853 query upstream_monomorphizations_for(def_id: DefId)
1861 -> Option<&'tcx UnordMap<GenericArgsRef<'tcx>, CrateNum>>
1862 {
1863 desc { |tcx|
1864 "collecting available upstream monomorphizations for `{}`",
1865 tcx.def_path_str(def_id),
1866 }
1867 separate_provide_extern
1868 }
1869
1870 query upstream_drop_glue_for(args: GenericArgsRef<'tcx>) -> Option<CrateNum> {
1886 desc { "available upstream drop-glue for `{:?}`", args }
1887 }
1888
1889 query upstream_async_drop_glue_for(args: GenericArgsRef<'tcx>) -> Option<CrateNum> {
1906 desc { "available upstream async-drop-glue for `{:?}`", args }
1907 }
1908
1909 query foreign_modules(_: CrateNum) -> &'tcx FxIndexMap<DefId, ForeignModule> {
1911 arena_cache
1912 desc { "looking up the foreign modules of a linked crate" }
1913 separate_provide_extern
1914 }
1915
1916 query clashing_extern_declarations(_: ()) {
1918 desc { "checking `extern fn` declarations are compatible" }
1919 }
1920
1921 query entry_fn(_: ()) -> Option<(DefId, EntryFnType)> {
1924 desc { "looking up the entry function of a crate" }
1925 }
1926
1927 query proc_macro_decls_static(_: ()) -> Option<LocalDefId> {
1929 desc { "looking up the proc macro declarations for a crate" }
1930 }
1931
1932 query crate_hash(_: CrateNum) -> Svh {
1940 eval_always
1941 desc { "looking up the hash a crate" }
1942 separate_provide_extern
1943 }
1944
1945 query crate_host_hash(_: CrateNum) -> Option<Svh> {
1947 eval_always
1948 desc { "looking up the hash of a host version of a crate" }
1949 separate_provide_extern
1950 }
1951
1952 query extra_filename(_: CrateNum) -> &'tcx String {
1955 arena_cache
1956 eval_always
1957 desc { "looking up the extra filename for a crate" }
1958 separate_provide_extern
1959 }
1960
1961 query crate_extern_paths(_: CrateNum) -> &'tcx Vec<PathBuf> {
1963 arena_cache
1964 eval_always
1965 desc { "looking up the paths for extern crates" }
1966 separate_provide_extern
1967 }
1968
1969 query implementations_of_trait(_: (CrateNum, DefId)) -> &'tcx [(DefId, Option<SimplifiedType>)] {
1972 desc { "looking up implementations of a trait in a crate" }
1973 separate_provide_extern
1974 }
1975
1976 query crate_incoherent_impls(key: (CrateNum, SimplifiedType)) -> &'tcx [DefId] {
1981 desc { |tcx| "collecting all impls for a type in a crate" }
1982 separate_provide_extern
1983 }
1984
1985 query native_library(def_id: DefId) -> Option<&'tcx NativeLib> {
1987 desc { |tcx| "getting the native library for `{}`", tcx.def_path_str(def_id) }
1988 }
1989
1990 query inherit_sig_for_delegation_item(def_id: LocalDefId) -> &'tcx [Ty<'tcx>] {
1991 desc { "inheriting delegation signature" }
1992 }
1993
1994 query resolve_bound_vars(owner_id: hir::OwnerId) -> &'tcx ResolveBoundVars {
1998 arena_cache
1999 desc { |tcx| "resolving lifetimes for `{}`", tcx.def_path_str(owner_id) }
2000 }
2001 query named_variable_map(owner_id: hir::OwnerId) -> &'tcx SortedMap<ItemLocalId, ResolvedArg> {
2002 desc { |tcx| "looking up a named region inside `{}`", tcx.def_path_str(owner_id) }
2003 }
2004 query is_late_bound_map(owner_id: hir::OwnerId) -> Option<&'tcx FxIndexSet<ItemLocalId>> {
2005 desc { |tcx| "testing if a region is late bound inside `{}`", tcx.def_path_str(owner_id) }
2006 }
2007 query object_lifetime_default(def_id: DefId) -> ObjectLifetimeDefault {
2022 desc { "looking up lifetime defaults for type parameter `{}`", tcx.def_path_str(def_id) }
2023 separate_provide_extern
2024 }
2025 query late_bound_vars_map(owner_id: hir::OwnerId)
2026 -> &'tcx SortedMap<ItemLocalId, Vec<ty::BoundVariableKind>> {
2027 desc { |tcx| "looking up late bound vars inside `{}`", tcx.def_path_str(owner_id) }
2028 }
2029 query opaque_captured_lifetimes(def_id: LocalDefId) -> &'tcx [(ResolvedArg, LocalDefId)] {
2044 desc { |tcx| "listing captured lifetimes for opaque `{}`", tcx.def_path_str(def_id) }
2045 }
2046
2047 query visibility(def_id: DefId) -> ty::Visibility<DefId> {
2060 desc { |tcx| "computing visibility of `{}`", tcx.def_path_str(def_id) }
2061 separate_provide_extern
2062 feedable
2063 }
2064
2065 query inhabited_predicate_adt(key: DefId) -> ty::inhabitedness::InhabitedPredicate<'tcx> {
2066 desc { "computing the uninhabited predicate of `{:?}`", key }
2067 }
2068
2069 query inhabited_predicate_type(key: Ty<'tcx>) -> ty::inhabitedness::InhabitedPredicate<'tcx> {
2071 desc { "computing the uninhabited predicate of `{}`", key }
2072 }
2073
2074 query dep_kind(_: CrateNum) -> CrateDepKind {
2075 eval_always
2076 desc { "fetching what a dependency looks like" }
2077 separate_provide_extern
2078 }
2079
2080 query crate_name(_: CrateNum) -> Symbol {
2082 feedable
2083 desc { "fetching what a crate is named" }
2084 separate_provide_extern
2085 }
2086 query module_children(def_id: DefId) -> &'tcx [ModChild] {
2087 desc { |tcx| "collecting child items of module `{}`", tcx.def_path_str(def_id) }
2088 separate_provide_extern
2089 }
2090 query extern_mod_stmt_cnum(def_id: LocalDefId) -> Option<CrateNum> {
2091 desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id) }
2092 }
2093
2094 query num_extern_def_ids(_: CrateNum) -> usize {
2100 desc { "fetching the number of definitions in a crate" }
2101 separate_provide_extern
2102 }
2103
2104 query lib_features(_: CrateNum) -> &'tcx LibFeatures {
2105 desc { "calculating the lib features defined in a crate" }
2106 separate_provide_extern
2107 arena_cache
2108 }
2109 query stability_implications(_: CrateNum) -> &'tcx UnordMap<Symbol, Symbol> {
2110 arena_cache
2111 desc { "calculating the implications between `#[unstable]` features defined in a crate" }
2112 separate_provide_extern
2113 }
2114 query intrinsic_raw(def_id: DefId) -> Option<rustc_middle::ty::IntrinsicDef> {
2116 desc { |tcx| "fetch intrinsic name if `{}` is an intrinsic", tcx.def_path_str(def_id) }
2117 separate_provide_extern
2118 }
2119 query get_lang_items(_: ()) -> &'tcx LanguageItems {
2121 arena_cache
2122 eval_always
2123 desc { "calculating the lang items map" }
2124 }
2125
2126 query all_diagnostic_items(_: ()) -> &'tcx rustc_hir::diagnostic_items::DiagnosticItems {
2128 arena_cache
2129 eval_always
2130 desc { "calculating the diagnostic items map" }
2131 }
2132
2133 query defined_lang_items(_: CrateNum) -> &'tcx [(DefId, LangItem)] {
2135 desc { "calculating the lang items defined in a crate" }
2136 separate_provide_extern
2137 }
2138
2139 query diagnostic_items(_: CrateNum) -> &'tcx rustc_hir::diagnostic_items::DiagnosticItems {
2141 arena_cache
2142 desc { "calculating the diagnostic items map in a crate" }
2143 separate_provide_extern
2144 }
2145
2146 query missing_lang_items(_: CrateNum) -> &'tcx [LangItem] {
2147 desc { "calculating the missing lang items in a crate" }
2148 separate_provide_extern
2149 }
2150
2151 query visible_parent_map(_: ()) -> &'tcx DefIdMap<DefId> {
2156 arena_cache
2157 desc { "calculating the visible parent map" }
2158 }
2159 query trimmed_def_paths(_: ()) -> &'tcx DefIdMap<Symbol> {
2162 arena_cache
2163 desc { "calculating trimmed def paths" }
2164 }
2165 query missing_extern_crate_item(_: CrateNum) -> bool {
2166 eval_always
2167 desc { "seeing if we're missing an `extern crate` item for this crate" }
2168 separate_provide_extern
2169 }
2170 query used_crate_source(_: CrateNum) -> &'tcx Arc<CrateSource> {
2171 arena_cache
2172 eval_always
2173 desc { "looking at the source for a crate" }
2174 separate_provide_extern
2175 }
2176
2177 query debugger_visualizers(_: CrateNum) -> &'tcx Vec<DebuggerVisualizerFile> {
2182 arena_cache
2183 desc { "looking up the debugger visualizers for this crate" }
2184 separate_provide_extern
2185 eval_always
2186 }
2187
2188 query postorder_cnums(_: ()) -> &'tcx [CrateNum] {
2189 eval_always
2190 desc { "generating a postorder list of CrateNums" }
2191 }
2192 query is_private_dep(c: CrateNum) -> bool {
2195 eval_always
2196 desc { "checking whether crate `{}` is a private dependency", c }
2197 separate_provide_extern
2198 }
2199 query allocator_kind(_: ()) -> Option<AllocatorKind> {
2200 eval_always
2201 desc { "getting the allocator kind for the current crate" }
2202 }
2203 query alloc_error_handler_kind(_: ()) -> Option<AllocatorKind> {
2204 eval_always
2205 desc { "alloc error handler kind for the current crate" }
2206 }
2207
2208 query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
2209 desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }
2210 }
2211 query maybe_unused_trait_imports(_: ()) -> &'tcx FxIndexSet<LocalDefId> {
2212 desc { "fetching potentially unused trait imports" }
2213 }
2214 query names_imported_by_glob_use(def_id: LocalDefId) -> &'tcx FxIndexSet<Symbol> {
2215 desc { |tcx| "finding names imported by glob use for `{}`", tcx.def_path_str(def_id) }
2216 }
2217
2218 query stability_index(_: ()) -> &'tcx stability::Index {
2219 arena_cache
2220 eval_always
2221 desc { "calculating the stability index for the local crate" }
2222 }
2223 query crates(_: ()) -> &'tcx [CrateNum] {
2226 eval_always
2227 desc { "fetching all foreign CrateNum instances" }
2228 }
2229 query used_crates(_: ()) -> &'tcx [CrateNum] {
2233 eval_always
2234 desc { "fetching `CrateNum`s for all crates loaded non-speculatively" }
2235 }
2236
2237 query traits(_: CrateNum) -> &'tcx [DefId] {
2239 desc { "fetching all traits in a crate" }
2240 separate_provide_extern
2241 }
2242
2243 query trait_impls_in_crate(_: CrateNum) -> &'tcx [DefId] {
2244 desc { "fetching all trait impls in a crate" }
2245 separate_provide_extern
2246 }
2247
2248 query stable_order_of_exportable_impls(_: CrateNum) -> &'tcx FxIndexMap<DefId, usize> {
2249 desc { "fetching the stable impl's order" }
2250 separate_provide_extern
2251 }
2252
2253 query exportable_items(_: CrateNum) -> &'tcx [DefId] {
2254 desc { "fetching all exportable items in a crate" }
2255 separate_provide_extern
2256 }
2257
2258 query exported_symbols(cnum: CrateNum) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportInfo)] {
2264 desc { "collecting exported symbols for crate `{}`", cnum}
2265 cache_on_disk_if { *cnum == LOCAL_CRATE }
2266 separate_provide_extern
2267 }
2268
2269 query collect_and_partition_mono_items(_: ()) -> MonoItemPartitions<'tcx> {
2270 eval_always
2271 desc { "collect_and_partition_mono_items" }
2272 }
2273
2274 query is_codegened_item(def_id: DefId) -> bool {
2275 desc { |tcx| "determining whether `{}` needs codegen", tcx.def_path_str(def_id) }
2276 }
2277
2278 query codegen_unit(sym: Symbol) -> &'tcx CodegenUnit<'tcx> {
2279 desc { "getting codegen unit `{sym}`" }
2280 }
2281
2282 query backend_optimization_level(_: ()) -> OptLevel {
2283 desc { "optimization level used by backend" }
2284 }
2285
2286 query output_filenames(_: ()) -> &'tcx Arc<OutputFilenames> {
2291 feedable
2292 desc { "getting output filenames" }
2293 arena_cache
2294 }
2295
2296 query normalize_canonicalized_projection_ty(
2302 goal: CanonicalAliasGoal<'tcx>
2303 ) -> Result<
2304 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2305 NoSolution,
2306 > {
2307 desc { "normalizing `{}`", goal.canonical.value.value }
2308 }
2309
2310 query normalize_canonicalized_free_alias(
2316 goal: CanonicalAliasGoal<'tcx>
2317 ) -> Result<
2318 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2319 NoSolution,
2320 > {
2321 desc { "normalizing `{}`", goal.canonical.value.value }
2322 }
2323
2324 query normalize_canonicalized_inherent_projection_ty(
2330 goal: CanonicalAliasGoal<'tcx>
2331 ) -> Result<
2332 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2333 NoSolution,
2334 > {
2335 desc { "normalizing `{}`", goal.canonical.value.value }
2336 }
2337
2338 query try_normalize_generic_arg_after_erasing_regions(
2340 goal: PseudoCanonicalInput<'tcx, GenericArg<'tcx>>
2341 ) -> Result<GenericArg<'tcx>, NoSolution> {
2342 desc { "normalizing `{}`", goal.value }
2343 }
2344
2345 query implied_outlives_bounds(
2346 key: (CanonicalImpliedOutlivesBoundsGoal<'tcx>, bool)
2347 ) -> Result<
2348 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>,
2349 NoSolution,
2350 > {
2351 desc { "computing implied outlives bounds for `{}` (hack disabled = {:?})", key.0.canonical.value.value.ty, key.1 }
2352 }
2353
2354 query dropck_outlives(
2357 goal: CanonicalDropckOutlivesGoal<'tcx>
2358 ) -> Result<
2359 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>,
2360 NoSolution,
2361 > {
2362 desc { "computing dropck types for `{}`", goal.canonical.value.value.dropped_ty }
2363 }
2364
2365 query evaluate_obligation(
2368 goal: CanonicalPredicateGoal<'tcx>
2369 ) -> Result<EvaluationResult, OverflowError> {
2370 desc { "evaluating trait selection obligation `{}`", goal.canonical.value.value }
2371 }
2372
2373 query type_op_ascribe_user_type(
2375 goal: CanonicalTypeOpAscribeUserTypeGoal<'tcx>
2376 ) -> Result<
2377 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
2378 NoSolution,
2379 > {
2380 desc { "evaluating `type_op_ascribe_user_type` `{:?}`", goal.canonical.value.value }
2381 }
2382
2383 query type_op_prove_predicate(
2385 goal: CanonicalTypeOpProvePredicateGoal<'tcx>
2386 ) -> Result<
2387 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
2388 NoSolution,
2389 > {
2390 desc { "evaluating `type_op_prove_predicate` `{:?}`", goal.canonical.value.value }
2391 }
2392
2393 query type_op_normalize_ty(
2395 goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>
2396 ) -> Result<
2397 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Ty<'tcx>>>,
2398 NoSolution,
2399 > {
2400 desc { "normalizing `{}`", goal.canonical.value.value.value }
2401 }
2402
2403 query type_op_normalize_clause(
2405 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::Clause<'tcx>>
2406 ) -> Result<
2407 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::Clause<'tcx>>>,
2408 NoSolution,
2409 > {
2410 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2411 }
2412
2413 query type_op_normalize_poly_fn_sig(
2415 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::PolyFnSig<'tcx>>
2416 ) -> Result<
2417 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::PolyFnSig<'tcx>>>,
2418 NoSolution,
2419 > {
2420 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2421 }
2422
2423 query type_op_normalize_fn_sig(
2425 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>
2426 ) -> Result<
2427 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::FnSig<'tcx>>>,
2428 NoSolution,
2429 > {
2430 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2431 }
2432
2433 query instantiate_and_check_impossible_predicates(key: (DefId, GenericArgsRef<'tcx>)) -> bool {
2434 desc { |tcx|
2435 "checking impossible instantiated predicates: `{}`",
2436 tcx.def_path_str(key.0)
2437 }
2438 }
2439
2440 query is_impossible_associated_item(key: (DefId, DefId)) -> bool {
2441 desc { |tcx|
2442 "checking if `{}` is impossible to reference within `{}`",
2443 tcx.def_path_str(key.1),
2444 tcx.def_path_str(key.0),
2445 }
2446 }
2447
2448 query method_autoderef_steps(
2449 goal: CanonicalTyGoal<'tcx>
2450 ) -> MethodAutoderefStepsResult<'tcx> {
2451 desc { "computing autoderef types for `{}`", goal.canonical.value.value }
2452 }
2453
2454 query rust_target_features(_: CrateNum) -> &'tcx UnordMap<String, rustc_target::target_features::Stability> {
2456 arena_cache
2457 eval_always
2458 desc { "looking up Rust target features" }
2459 }
2460
2461 query implied_target_features(feature: Symbol) -> &'tcx Vec<Symbol> {
2462 arena_cache
2463 eval_always
2464 desc { "looking up implied target features" }
2465 }
2466
2467 query features_query(_: ()) -> &'tcx rustc_feature::Features {
2468 feedable
2469 desc { "looking up enabled feature gates" }
2470 }
2471
2472 query crate_for_resolver((): ()) -> &'tcx Steal<(rustc_ast::Crate, rustc_ast::AttrVec)> {
2473 feedable
2474 no_hash
2475 desc { "the ast before macro expansion and name resolution" }
2476 }
2477
2478 query resolve_instance_raw(
2488 key: ty::PseudoCanonicalInput<'tcx, (DefId, GenericArgsRef<'tcx>)>
2489 ) -> Result<Option<ty::Instance<'tcx>>, ErrorGuaranteed> {
2490 desc { "resolving instance `{}`", ty::Instance::new_raw(key.value.0, key.value.1) }
2491 }
2492
2493 query reveal_opaque_types_in_bounds(key: ty::Clauses<'tcx>) -> ty::Clauses<'tcx> {
2494 desc { "revealing opaque types in `{:?}`", key }
2495 }
2496
2497 query limits(key: ()) -> Limits {
2498 desc { "looking up limits" }
2499 }
2500
2501 query diagnostic_hir_wf_check(
2510 key: (ty::Predicate<'tcx>, WellFormedLoc)
2511 ) -> Option<&'tcx ObligationCause<'tcx>> {
2512 arena_cache
2513 eval_always
2514 no_hash
2515 desc { "performing HIR wf-checking for predicate `{:?}` at item `{:?}`", key.0, key.1 }
2516 }
2517
2518 query global_backend_features(_: ()) -> &'tcx Vec<String> {
2521 arena_cache
2522 eval_always
2523 desc { "computing the backend features for CLI flags" }
2524 }
2525
2526 query check_validity_requirement(key: (ValidityRequirement, ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>)) -> Result<bool, &'tcx ty::layout::LayoutError<'tcx>> {
2527 desc { "checking validity requirement for `{}`: {}", key.1.value, key.0 }
2528 }
2529
2530 query compare_impl_item(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
2535 desc { |tcx| "checking assoc item `{}` is compatible with trait definition", tcx.def_path_str(key) }
2536 return_result_from_ensure_ok
2537 }
2538
2539 query deduced_param_attrs(def_id: DefId) -> &'tcx [ty::DeducedParamAttrs] {
2540 desc { |tcx| "deducing parameter attributes for {}", tcx.def_path_str(def_id) }
2541 separate_provide_extern
2542 }
2543
2544 query doc_link_resolutions(def_id: DefId) -> &'tcx DocLinkResMap {
2545 eval_always
2546 desc { "resolutions for documentation links for a module" }
2547 separate_provide_extern
2548 }
2549
2550 query doc_link_traits_in_scope(def_id: DefId) -> &'tcx [DefId] {
2551 eval_always
2552 desc { "traits in scope for documentation links for a module" }
2553 separate_provide_extern
2554 }
2555
2556 query stripped_cfg_items(cnum: CrateNum) -> &'tcx [StrippedCfgItem] {
2560 desc { "getting cfg-ed out item names" }
2561 separate_provide_extern
2562 }
2563
2564 query generics_require_sized_self(def_id: DefId) -> bool {
2565 desc { "check whether the item has a `where Self: Sized` bound" }
2566 }
2567
2568 query cross_crate_inlinable(def_id: DefId) -> bool {
2569 desc { "whether the item should be made inlinable across crates" }
2570 separate_provide_extern
2571 }
2572
2573 query check_mono_item(key: ty::Instance<'tcx>) {
2577 desc { "monomorphization-time checking" }
2578 }
2579
2580 query skip_move_check_fns(_: ()) -> &'tcx FxIndexSet<DefId> {
2582 arena_cache
2583 desc { "functions to skip for move-size check" }
2584 }
2585
2586 query items_of_instance(key: (ty::Instance<'tcx>, CollectionMode)) -> (&'tcx [Spanned<MonoItem<'tcx>>], &'tcx [Spanned<MonoItem<'tcx>>]) {
2587 desc { "collecting items used by `{}`", key.0 }
2588 cache_on_disk_if { true }
2589 }
2590
2591 query size_estimate(key: ty::Instance<'tcx>) -> usize {
2592 desc { "estimating codegen size of `{}`", key }
2593 cache_on_disk_if { true }
2594 }
2595
2596 query anon_const_kind(def_id: DefId) -> ty::AnonConstKind {
2597 desc { |tcx| "looking up anon const kind of `{}`", tcx.def_path_str(def_id) }
2598 separate_provide_extern
2599 }
2600}
2601
2602rustc_with_all_queries! { define_callbacks! }
2603rustc_feedable_queries! { define_feedable! }