1#![allow(unused_parens)]
64
65use std::ffi::OsStr;
66use std::mem;
67use std::path::PathBuf;
68use std::sync::Arc;
69
70use rustc_abi::Align;
71use rustc_arena::TypedArena;
72use rustc_ast::expand::allocator::AllocatorKind;
73use rustc_data_structures::fingerprint::Fingerprint;
74use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
75use rustc_data_structures::sorted_map::SortedMap;
76use rustc_data_structures::steal::Steal;
77use rustc_data_structures::svh::Svh;
78use rustc_data_structures::unord::{UnordMap, UnordSet};
79use rustc_errors::ErrorGuaranteed;
80use rustc_hir::attrs::StrippedCfgItem;
81use rustc_hir::def::{DefKind, DocLinkResMap};
82use rustc_hir::def_id::{
83 CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap, LocalDefIdSet, LocalModDefId,
84};
85use rustc_hir::lang_items::{LangItem, LanguageItems};
86use rustc_hir::{Crate, ItemLocalId, ItemLocalMap, PreciseCapturingArgKind, TraitCandidate};
87use rustc_index::IndexVec;
88use rustc_lint_defs::LintId;
89use rustc_macros::rustc_queries;
90use rustc_query_system::ich::StableHashingContext;
91use rustc_query_system::query::{
92 QueryCache, QueryMode, QueryStackDeferred, QueryState, try_get_cached,
93};
94use rustc_session::Limits;
95use rustc_session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion};
96use rustc_session::cstore::{
97 CrateDepKind, CrateSource, ExternCrate, ForeignModule, LinkagePreference, NativeLib,
98};
99use rustc_session::lint::LintExpectationId;
100use rustc_span::def_id::LOCAL_CRATE;
101use rustc_span::source_map::Spanned;
102use rustc_span::{DUMMY_SP, Span, Symbol};
103use rustc_target::spec::{PanicStrategy, SanitizerSet};
104use {rustc_abi as abi, rustc_ast as ast, rustc_hir as hir};
105
106use crate::infer::canonical::{self, Canonical};
107use crate::lint::LintExpectation;
108use crate::metadata::ModChild;
109use crate::middle::codegen_fn_attrs::CodegenFnAttrs;
110use crate::middle::debugger_visualizer::DebuggerVisualizerFile;
111use crate::middle::exported_symbols::{ExportedSymbol, SymbolExportInfo};
112use crate::middle::lib_features::LibFeatures;
113use crate::middle::privacy::EffectiveVisibilities;
114use crate::middle::resolve_bound_vars::{ObjectLifetimeDefault, ResolveBoundVars, ResolvedArg};
115use crate::middle::stability::DeprecationEntry;
116use crate::mir::interpret::{
117 EvalStaticInitializerRawResult, EvalToAllocationRawResult, EvalToConstValueResult,
118 EvalToValTreeResult, GlobalId, LitToConstInput,
119};
120use crate::mir::mono::{CodegenUnit, CollectionMode, MonoItem, MonoItemPartitions};
121use crate::query::erase::{Erase, erase, restore};
122use crate::query::plumbing::{
123 CyclePlaceholder, DynamicQuery, query_ensure, query_ensure_error_guaranteed, query_get_at,
124};
125use crate::traits::query::{
126 CanonicalAliasGoal, CanonicalDropckOutlivesGoal, CanonicalImpliedOutlivesBoundsGoal,
127 CanonicalPredicateGoal, CanonicalTyGoal, CanonicalTypeOpAscribeUserTypeGoal,
128 CanonicalTypeOpNormalizeGoal, CanonicalTypeOpProvePredicateGoal, DropckConstraint,
129 DropckOutlivesResult, MethodAutoderefStepsResult, NoSolution, NormalizationResult,
130 OutlivesBound,
131};
132use crate::traits::{
133 CodegenObligationError, DynCompatibilityViolation, EvaluationResult, ImplSource,
134 ObligationCause, OverflowError, WellFormedLoc, solve, specialization_graph,
135};
136use crate::ty::fast_reject::SimplifiedType;
137use crate::ty::layout::ValidityRequirement;
138use crate::ty::print::PrintTraitRefExt;
139use crate::ty::util::AlwaysRequiresDrop;
140use crate::ty::{
141 self, CrateInherentImpls, GenericArg, GenericArgsRef, PseudoCanonicalInput, SizedTraitKind, Ty,
142 TyCtxt, TyCtxtFeed,
143};
144use crate::{dep_graph, mir, thir};
145
146mod arena_cached;
147pub mod erase;
148mod keys;
149pub use keys::{AsLocalKey, Key, LocalCrate};
150pub mod on_disk_cache;
151#[macro_use]
152pub mod plumbing;
153pub use plumbing::{IntoQueryParam, TyCtxtAt, TyCtxtEnsureDone, TyCtxtEnsureOk};
154
155rustc_queries! {
167 query trigger_delayed_bug(key: DefId) {
169 desc { "triggering a delayed bug for testing incremental" }
170 }
171
172 query registered_tools(_: ()) -> &'tcx ty::RegisteredTools {
174 arena_cache
175 desc { "compute registered tools for crate" }
176 }
177
178 query early_lint_checks(_: ()) {
179 desc { "perform lints prior to AST lowering" }
180 }
181
182 query env_var_os(key: &'tcx OsStr) -> Option<&'tcx OsStr> {
192 eval_always
194 desc { "get the value of an environment variable" }
195 }
196
197 query resolutions(_: ()) -> &'tcx ty::ResolverGlobalCtxt {
198 desc { "getting the resolver outputs" }
199 }
200
201 query resolver_for_lowering_raw(_: ()) -> (&'tcx Steal<(ty::ResolverAstLowering, Arc<ast::Crate>)>, &'tcx ty::ResolverGlobalCtxt) {
202 eval_always
203 no_hash
204 desc { "getting the resolver for lowering" }
205 }
206
207 query source_span(key: LocalDefId) -> Span {
213 eval_always
215 desc { "getting the source span" }
216 }
217
218 query hir_crate(key: ()) -> &'tcx Crate<'tcx> {
226 arena_cache
227 eval_always
228 desc { "getting the crate HIR" }
229 }
230
231 query hir_crate_items(_: ()) -> &'tcx rustc_middle::hir::ModuleItems {
233 arena_cache
234 eval_always
235 desc { "getting HIR crate items" }
236 }
237
238 query hir_module_items(key: LocalModDefId) -> &'tcx rustc_middle::hir::ModuleItems {
243 arena_cache
244 desc { |tcx| "getting HIR module items in `{}`", tcx.def_path_str(key) }
245 cache_on_disk_if { true }
246 }
247
248 query local_def_id_to_hir_id(key: LocalDefId) -> hir::HirId {
250 desc { |tcx| "getting HIR ID of `{}`", tcx.def_path_str(key) }
251 feedable
252 }
253
254 query hir_owner_parent(key: hir::OwnerId) -> hir::HirId {
259 desc { |tcx| "getting HIR parent of `{}`", tcx.def_path_str(key) }
260 }
261
262 query opt_hir_owner_nodes(key: LocalDefId) -> Option<&'tcx hir::OwnerNodes<'tcx>> {
267 desc { |tcx| "getting HIR owner items in `{}`", tcx.def_path_str(key) }
268 feedable
269 }
270
271 query hir_attr_map(key: hir::OwnerId) -> &'tcx hir::AttributeMap<'tcx> {
276 desc { |tcx| "getting HIR owner attributes in `{}`", tcx.def_path_str(key) }
277 feedable
278 }
279
280 query opt_ast_lowering_delayed_lints(key: hir::OwnerId) -> Option<&'tcx hir::lints::DelayedLints> {
285 desc { |tcx| "getting AST lowering delayed lints in `{}`", tcx.def_path_str(key) }
286 }
287
288 query const_param_default(param: DefId) -> ty::EarlyBinder<'tcx, ty::Const<'tcx>> {
292 desc { |tcx| "computing the default for const parameter `{}`", tcx.def_path_str(param) }
293 cache_on_disk_if { param.is_local() }
294 separate_provide_extern
295 }
296
297 query type_of(key: DefId) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
316 desc { |tcx|
317 "{action} `{path}`",
318 action = match tcx.def_kind(key) {
319 DefKind::TyAlias => "expanding type alias",
320 DefKind::TraitAlias => "expanding trait alias",
321 _ => "computing type of",
322 },
323 path = tcx.def_path_str(key),
324 }
325 cache_on_disk_if { key.is_local() }
326 separate_provide_extern
327 feedable
328 }
329
330 query type_of_opaque(key: DefId) -> Result<ty::EarlyBinder<'tcx, Ty<'tcx>>, CyclePlaceholder> {
341 desc { |tcx|
342 "computing type of opaque `{path}`",
343 path = tcx.def_path_str(key),
344 }
345 cycle_stash
346 }
347 query type_of_opaque_hir_typeck(key: LocalDefId) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
348 desc { |tcx|
349 "computing type of opaque `{path}` via HIR typeck",
350 path = tcx.def_path_str(key),
351 }
352 }
353
354 query type_alias_is_lazy(key: DefId) -> bool {
368 desc { |tcx|
369 "computing whether the type alias `{path}` is lazy",
370 path = tcx.def_path_str(key),
371 }
372 separate_provide_extern
373 }
374
375 query collect_return_position_impl_trait_in_trait_tys(key: DefId)
376 -> Result<&'tcx DefIdMap<ty::EarlyBinder<'tcx, Ty<'tcx>>>, ErrorGuaranteed>
377 {
378 desc { "comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process" }
379 cache_on_disk_if { key.is_local() }
380 separate_provide_extern
381 }
382
383 query opaque_ty_origin(key: DefId) -> hir::OpaqueTyOrigin<DefId>
384 {
385 desc { "determine where the opaque originates from" }
386 separate_provide_extern
387 }
388
389 query unsizing_params_for_adt(key: DefId) -> &'tcx rustc_index::bit_set::DenseBitSet<u32>
390 {
391 arena_cache
392 desc { |tcx|
393 "determining what parameters of `{}` can participate in unsizing",
394 tcx.def_path_str(key),
395 }
396 }
397
398 query analysis(key: ()) {
400 eval_always
401 desc { "running analysis passes on this crate" }
402 }
403
404 query check_expectations(key: Option<Symbol>) {
419 eval_always
420 desc { "checking lint expectations (RFC 2383)" }
421 }
422
423 query generics_of(key: DefId) -> &'tcx ty::Generics {
425 desc { |tcx| "computing generics of `{}`", tcx.def_path_str(key) }
426 arena_cache
427 cache_on_disk_if { key.is_local() }
428 separate_provide_extern
429 feedable
430 }
431
432 query predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
440 desc { |tcx| "computing predicates of `{}`", tcx.def_path_str(key) }
441 cache_on_disk_if { key.is_local() }
442 }
443
444 query opaque_types_defined_by(
445 key: LocalDefId
446 ) -> &'tcx ty::List<LocalDefId> {
447 desc {
448 |tcx| "computing the opaque types defined by `{}`",
449 tcx.def_path_str(key.to_def_id())
450 }
451 }
452
453 query nested_bodies_within(
456 key: LocalDefId
457 ) -> &'tcx ty::List<LocalDefId> {
458 desc {
459 |tcx| "computing the coroutines defined within `{}`",
460 tcx.def_path_str(key.to_def_id())
461 }
462 }
463
464 query explicit_item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
483 desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
484 cache_on_disk_if { key.is_local() }
485 separate_provide_extern
486 feedable
487 }
488
489 query explicit_item_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
496 desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
497 cache_on_disk_if { key.is_local() }
498 separate_provide_extern
499 feedable
500 }
501
502 query item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
526 desc { |tcx| "elaborating item bounds for `{}`", tcx.def_path_str(key) }
527 }
528
529 query item_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
530 desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
531 }
532
533 query item_non_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
534 desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
535 }
536
537 query impl_super_outlives(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
538 desc { |tcx| "elaborating supertrait outlives for trait of `{}`", tcx.def_path_str(key) }
539 }
540
541 query native_libraries(_: CrateNum) -> &'tcx Vec<NativeLib> {
546 arena_cache
547 desc { "looking up the native libraries of a linked crate" }
548 separate_provide_extern
549 }
550
551 query shallow_lint_levels_on(key: hir::OwnerId) -> &'tcx rustc_middle::lint::ShallowLintLevelMap {
552 arena_cache
553 desc { |tcx| "looking up lint levels for `{}`", tcx.def_path_str(key) }
554 }
555
556 query lint_expectations(_: ()) -> &'tcx Vec<(LintExpectationId, LintExpectation)> {
557 arena_cache
558 desc { "computing `#[expect]`ed lints in this crate" }
559 }
560
561 query lints_that_dont_need_to_run(_: ()) -> &'tcx UnordSet<LintId> {
562 arena_cache
563 desc { "Computing all lints that are explicitly enabled or with a default level greater than Allow" }
564 }
565
566 query expn_that_defined(key: DefId) -> rustc_span::ExpnId {
567 desc { |tcx| "getting the expansion that defined `{}`", tcx.def_path_str(key) }
568 separate_provide_extern
569 }
570
571 query is_panic_runtime(_: CrateNum) -> bool {
572 fatal_cycle
573 desc { "checking if the crate is_panic_runtime" }
574 separate_provide_extern
575 }
576
577 query representability(_: LocalDefId) -> rustc_middle::ty::Representability {
579 desc { "checking if `{}` is representable", tcx.def_path_str(key) }
580 cycle_delay_bug
582 anon
586 }
587
588 query representability_adt_ty(_: Ty<'tcx>) -> rustc_middle::ty::Representability {
590 desc { "checking if `{}` is representable", key }
591 cycle_delay_bug
592 anon
593 }
594
595 query params_in_repr(key: DefId) -> &'tcx rustc_index::bit_set::DenseBitSet<u32> {
597 desc { "finding type parameters in the representation" }
598 arena_cache
599 no_hash
600 separate_provide_extern
601 }
602
603 query thir_body(key: LocalDefId) -> Result<(&'tcx Steal<thir::Thir<'tcx>>, thir::ExprId), ErrorGuaranteed> {
606 no_hash
608 desc { |tcx| "building THIR for `{}`", tcx.def_path_str(key) }
609 }
610
611 query mir_keys(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexSet<LocalDefId> {
615 arena_cache
616 desc { "getting a list of all mir_keys" }
617 }
618
619 query mir_const_qualif(key: DefId) -> mir::ConstQualifs {
623 desc { |tcx| "const checking `{}`", tcx.def_path_str(key) }
624 cache_on_disk_if { key.is_local() }
625 separate_provide_extern
626 }
627
628 query mir_built(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
634 desc { |tcx| "building MIR for `{}`", tcx.def_path_str(key) }
635 feedable
636 }
637
638 query thir_abstract_const(
640 key: DefId
641 ) -> Result<Option<ty::EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed> {
642 desc {
643 |tcx| "building an abstract representation for `{}`", tcx.def_path_str(key),
644 }
645 separate_provide_extern
646 }
647
648 query mir_drops_elaborated_and_const_checked(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
649 no_hash
650 desc { |tcx| "elaborating drops for `{}`", tcx.def_path_str(key) }
651 }
652
653 query mir_for_ctfe(
654 key: DefId
655 ) -> &'tcx mir::Body<'tcx> {
656 desc { |tcx| "caching mir of `{}` for CTFE", tcx.def_path_str(key) }
657 cache_on_disk_if { key.is_local() }
658 separate_provide_extern
659 }
660
661 query mir_promoted(key: LocalDefId) -> (
662 &'tcx Steal<mir::Body<'tcx>>,
663 &'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>>
664 ) {
665 no_hash
666 desc { |tcx| "promoting constants in MIR for `{}`", tcx.def_path_str(key) }
667 }
668
669 query closure_typeinfo(key: LocalDefId) -> ty::ClosureTypeInfo<'tcx> {
670 desc {
671 |tcx| "finding symbols for captures of closure `{}`",
672 tcx.def_path_str(key)
673 }
674 }
675
676 query closure_saved_names_of_captured_variables(def_id: DefId) -> &'tcx IndexVec<abi::FieldIdx, Symbol> {
684 arena_cache
685 desc { |tcx| "computing debuginfo for closure `{}`", tcx.def_path_str(def_id) }
686 separate_provide_extern
687 }
688
689 query mir_coroutine_witnesses(key: DefId) -> Option<&'tcx mir::CoroutineLayout<'tcx>> {
690 arena_cache
691 desc { |tcx| "coroutine witness types for `{}`", tcx.def_path_str(key) }
692 cache_on_disk_if { key.is_local() }
693 separate_provide_extern
694 }
695
696 query check_coroutine_obligations(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
697 desc { |tcx| "verify auto trait bounds for coroutine interior type `{}`", tcx.def_path_str(key) }
698 return_result_from_ensure_ok
699 }
700
701 query check_potentially_region_dependent_goals(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
711 desc {
712 |tcx| "reproving potentially region dependent HIR typeck goals for `{}",
713 tcx.def_path_str(key)
714 }
715 }
716
717 query optimized_mir(key: DefId) -> &'tcx mir::Body<'tcx> {
720 desc { |tcx| "optimizing MIR for `{}`", tcx.def_path_str(key) }
721 cache_on_disk_if { key.is_local() }
722 separate_provide_extern
723 }
724
725 query coverage_attr_on(key: LocalDefId) -> bool {
731 desc { |tcx| "checking for `#[coverage(..)]` on `{}`", tcx.def_path_str(key) }
732 feedable
733 }
734
735 query coverage_ids_info(key: ty::InstanceKind<'tcx>) -> Option<&'tcx mir::coverage::CoverageIdsInfo> {
748 desc { |tcx| "retrieving coverage IDs info from MIR for `{}`", tcx.def_path_str(key.def_id()) }
749 arena_cache
750 }
751
752 query promoted_mir(key: DefId) -> &'tcx IndexVec<mir::Promoted, mir::Body<'tcx>> {
758 desc { |tcx| "optimizing promoted MIR for `{}`", tcx.def_path_str(key) }
759 cache_on_disk_if { key.is_local() }
760 separate_provide_extern
761 }
762
763 query erase_and_anonymize_regions_ty(ty: Ty<'tcx>) -> Ty<'tcx> {
767 anon
774 desc { "erasing regions from `{}`", ty }
775 }
776
777 query wasm_import_module_map(_: CrateNum) -> &'tcx DefIdMap<String> {
778 arena_cache
779 desc { "getting wasm import module map" }
780 }
781
782 query trait_explicit_predicates_and_bounds(key: LocalDefId) -> ty::GenericPredicates<'tcx> {
804 desc { |tcx| "computing explicit predicates of trait `{}`", tcx.def_path_str(key) }
805 }
806
807 query explicit_predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
813 desc { |tcx| "computing explicit predicates of `{}`", tcx.def_path_str(key) }
814 cache_on_disk_if { key.is_local() }
815 separate_provide_extern
816 feedable
817 }
818
819 query inferred_outlives_of(key: DefId) -> &'tcx [(ty::Clause<'tcx>, Span)] {
826 desc { |tcx| "computing inferred outlives-predicates of `{}`", tcx.def_path_str(key) }
827 cache_on_disk_if { key.is_local() }
828 separate_provide_extern
829 feedable
830 }
831
832 query explicit_super_predicates_of(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
840 desc { |tcx| "computing the super predicates of `{}`", tcx.def_path_str(key) }
841 cache_on_disk_if { key.is_local() }
842 separate_provide_extern
843 }
844
845 query explicit_implied_predicates_of(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
852 desc { |tcx| "computing the implied predicates of `{}`", tcx.def_path_str(key) }
853 cache_on_disk_if { key.is_local() }
854 separate_provide_extern
855 }
856
857 query explicit_supertraits_containing_assoc_item(
861 key: (DefId, rustc_span::Ident)
862 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
863 desc { |tcx| "computing the super traits of `{}` with associated type name `{}`",
864 tcx.def_path_str(key.0),
865 key.1
866 }
867 }
868
869 query const_conditions(
879 key: DefId
880 ) -> ty::ConstConditions<'tcx> {
881 desc { |tcx| "computing the conditions for `{}` to be considered const",
882 tcx.def_path_str(key)
883 }
884 separate_provide_extern
885 }
886
887 query explicit_implied_const_bounds(
893 key: DefId
894 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::PolyTraitRef<'tcx>, Span)]> {
895 desc { |tcx| "computing the implied `[const]` bounds for `{}`",
896 tcx.def_path_str(key)
897 }
898 separate_provide_extern
899 }
900
901 query type_param_predicates(
904 key: (LocalDefId, LocalDefId, rustc_span::Ident)
905 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
906 desc { |tcx| "computing the bounds for type parameter `{}`", tcx.hir_ty_param_name(key.1) }
907 }
908
909 query trait_def(key: DefId) -> &'tcx ty::TraitDef {
910 desc { |tcx| "computing trait definition for `{}`", tcx.def_path_str(key) }
911 arena_cache
912 cache_on_disk_if { key.is_local() }
913 separate_provide_extern
914 }
915 query adt_def(key: DefId) -> ty::AdtDef<'tcx> {
916 desc { |tcx| "computing ADT definition for `{}`", tcx.def_path_str(key) }
917 cache_on_disk_if { key.is_local() }
918 separate_provide_extern
919 }
920 query adt_destructor(key: DefId) -> Option<ty::Destructor> {
921 desc { |tcx| "computing `Drop` impl for `{}`", tcx.def_path_str(key) }
922 cache_on_disk_if { key.is_local() }
923 separate_provide_extern
924 }
925 query adt_async_destructor(key: DefId) -> Option<ty::AsyncDestructor> {
926 desc { |tcx| "computing `AsyncDrop` impl for `{}`", tcx.def_path_str(key) }
927 cache_on_disk_if { key.is_local() }
928 separate_provide_extern
929 }
930 query adt_sizedness_constraint(
931 key: (DefId, SizedTraitKind)
932 ) -> Option<ty::EarlyBinder<'tcx, Ty<'tcx>>> {
933 desc { |tcx| "computing the sizedness constraint for `{}`", tcx.def_path_str(key.0) }
934 }
935
936 query adt_dtorck_constraint(
937 key: DefId
938 ) -> &'tcx DropckConstraint<'tcx> {
939 desc { |tcx| "computing drop-check constraints for `{}`", tcx.def_path_str(key) }
940 }
941
942 query constness(key: DefId) -> hir::Constness {
964 desc { |tcx| "checking if item is const: `{}`", tcx.def_path_str(key) }
965 separate_provide_extern
966 feedable
967 }
968
969 query asyncness(key: DefId) -> ty::Asyncness {
970 desc { |tcx| "checking if the function is async: `{}`", tcx.def_path_str(key) }
971 separate_provide_extern
972 }
973
974 query is_promotable_const_fn(key: DefId) -> bool {
982 desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) }
983 }
984
985 query coroutine_by_move_body_def_id(def_id: DefId) -> DefId {
992 desc { |tcx| "looking up the coroutine by-move body for `{}`", tcx.def_path_str(def_id) }
993 separate_provide_extern
994 }
995
996 query coroutine_kind(def_id: DefId) -> Option<hir::CoroutineKind> {
998 desc { |tcx| "looking up coroutine kind of `{}`", tcx.def_path_str(def_id) }
999 separate_provide_extern
1000 feedable
1001 }
1002
1003 query coroutine_for_closure(def_id: DefId) -> DefId {
1004 desc { |_tcx| "Given a coroutine-closure def id, return the def id of the coroutine returned by it" }
1005 separate_provide_extern
1006 }
1007
1008 query coroutine_hidden_types(
1009 def_id: DefId,
1010 ) -> ty::EarlyBinder<'tcx, ty::Binder<'tcx, ty::CoroutineWitnessTypes<TyCtxt<'tcx>>>> {
1011 desc { "looking up the hidden types stored across await points in a coroutine" }
1012 }
1013
1014 query crate_variances(_: ()) -> &'tcx ty::CrateVariancesMap<'tcx> {
1022 arena_cache
1023 desc { "computing the variances for items in this crate" }
1024 }
1025
1026 query variances_of(def_id: DefId) -> &'tcx [ty::Variance] {
1034 desc { |tcx| "computing the variances of `{}`", tcx.def_path_str(def_id) }
1035 cache_on_disk_if { def_id.is_local() }
1036 separate_provide_extern
1037 cycle_delay_bug
1038 }
1039
1040 query inferred_outlives_crate(_: ()) -> &'tcx ty::CratePredicatesMap<'tcx> {
1048 arena_cache
1049 desc { "computing the inferred outlives-predicates for items in this crate" }
1050 }
1051
1052 query associated_item_def_ids(key: DefId) -> &'tcx [DefId] {
1055 desc { |tcx| "collecting associated items or fields of `{}`", tcx.def_path_str(key) }
1056 cache_on_disk_if { key.is_local() }
1057 separate_provide_extern
1058 }
1059
1060 query associated_item(key: DefId) -> ty::AssocItem {
1062 desc { |tcx| "computing associated item data for `{}`", tcx.def_path_str(key) }
1063 cache_on_disk_if { key.is_local() }
1064 separate_provide_extern
1065 feedable
1066 }
1067
1068 query associated_items(key: DefId) -> &'tcx ty::AssocItems {
1070 arena_cache
1071 desc { |tcx| "collecting associated items of `{}`", tcx.def_path_str(key) }
1072 }
1073
1074 query impl_item_implementor_ids(impl_id: DefId) -> &'tcx DefIdMap<DefId> {
1096 arena_cache
1097 desc { |tcx| "comparing impl items against trait for `{}`", tcx.def_path_str(impl_id) }
1098 }
1099
1100 query associated_types_for_impl_traits_in_trait_or_impl(item_def_id: DefId) -> &'tcx DefIdMap<Vec<DefId>> {
1103 arena_cache
1104 desc { |tcx| "synthesizing RPITIT items for the opaque types for methods in `{}`", tcx.def_path_str(item_def_id) }
1105 separate_provide_extern
1106 }
1107
1108 query impl_trait_header(impl_id: DefId) -> Option<ty::ImplTraitHeader<'tcx>> {
1111 desc { |tcx| "computing trait implemented by `{}`", tcx.def_path_str(impl_id) }
1112 cache_on_disk_if { impl_id.is_local() }
1113 separate_provide_extern
1114 }
1115
1116 query impl_self_is_guaranteed_unsized(impl_def_id: DefId) -> bool {
1120 desc { |tcx| "computing whether `{}` has a guaranteed unsized self type", tcx.def_path_str(impl_def_id) }
1121 }
1122
1123 query inherent_impls(key: DefId) -> &'tcx [DefId] {
1127 desc { |tcx| "collecting inherent impls for `{}`", tcx.def_path_str(key) }
1128 cache_on_disk_if { key.is_local() }
1129 separate_provide_extern
1130 }
1131
1132 query incoherent_impls(key: SimplifiedType) -> &'tcx [DefId] {
1133 desc { |tcx| "collecting all inherent impls for `{:?}`", key }
1134 }
1135
1136 query check_transmutes(key: LocalDefId) {
1138 desc { |tcx| "check transmute calls inside `{}`", tcx.def_path_str(key) }
1139 }
1140
1141 query check_unsafety(key: LocalDefId) {
1143 desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key) }
1144 }
1145
1146 query check_tail_calls(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
1148 desc { |tcx| "tail-call-checking `{}`", tcx.def_path_str(key) }
1149 return_result_from_ensure_ok
1150 }
1151
1152 query assumed_wf_types(key: LocalDefId) -> &'tcx [(Ty<'tcx>, Span)] {
1157 desc { |tcx| "computing the implied bounds of `{}`", tcx.def_path_str(key) }
1158 }
1159
1160 query assumed_wf_types_for_rpitit(key: DefId) -> &'tcx [(Ty<'tcx>, Span)] {
1163 desc { |tcx| "computing the implied bounds of `{}`", tcx.def_path_str(key) }
1164 separate_provide_extern
1165 }
1166
1167 query fn_sig(key: DefId) -> ty::EarlyBinder<'tcx, ty::PolyFnSig<'tcx>> {
1169 desc { |tcx| "computing function signature of `{}`", tcx.def_path_str(key) }
1170 cache_on_disk_if { key.is_local() }
1171 separate_provide_extern
1172 cycle_delay_bug
1173 }
1174
1175 query lint_mod(key: LocalModDefId) {
1177 desc { |tcx| "linting {}", describe_as_module(key, tcx) }
1178 }
1179
1180 query check_unused_traits(_: ()) {
1181 desc { "checking unused trait imports in crate" }
1182 }
1183
1184 query check_mod_attrs(key: LocalModDefId) {
1186 desc { |tcx| "checking attributes in {}", describe_as_module(key, tcx) }
1187 }
1188
1189 query check_mod_unstable_api_usage(key: LocalModDefId) {
1191 desc { |tcx| "checking for unstable API usage in {}", describe_as_module(key, tcx) }
1192 }
1193
1194 query check_mod_privacy(key: LocalModDefId) {
1195 desc { |tcx| "checking privacy in {}", describe_as_module(key.to_local_def_id(), tcx) }
1196 }
1197
1198 query check_liveness(key: LocalDefId) {
1199 desc { |tcx| "checking liveness of variables in `{}`", tcx.def_path_str(key) }
1200 }
1201
1202 query live_symbols_and_ignored_derived_traits(_: ()) -> &'tcx (
1206 LocalDefIdSet,
1207 LocalDefIdMap<FxIndexSet<DefId>>,
1208 ) {
1209 arena_cache
1210 desc { "finding live symbols in crate" }
1211 }
1212
1213 query check_mod_deathness(key: LocalModDefId) {
1214 desc { |tcx| "checking deathness of variables in {}", describe_as_module(key, tcx) }
1215 }
1216
1217 query check_type_wf(key: ()) -> Result<(), ErrorGuaranteed> {
1218 desc { "checking that types are well-formed" }
1219 return_result_from_ensure_ok
1220 }
1221
1222 query coerce_unsized_info(key: DefId) -> Result<ty::adjustment::CoerceUnsizedInfo, ErrorGuaranteed> {
1224 desc { |tcx| "computing CoerceUnsized info for `{}`", tcx.def_path_str(key) }
1225 cache_on_disk_if { key.is_local() }
1226 separate_provide_extern
1227 return_result_from_ensure_ok
1228 }
1229
1230 query typeck(key: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> {
1231 desc { |tcx| "type-checking `{}`", tcx.def_path_str(key) }
1232 cache_on_disk_if(tcx) { !tcx.is_typeck_child(key.to_def_id()) }
1233 }
1234
1235 query used_trait_imports(key: LocalDefId) -> &'tcx UnordSet<LocalDefId> {
1236 desc { |tcx| "finding used_trait_imports `{}`", tcx.def_path_str(key) }
1237 cache_on_disk_if { true }
1238 }
1239
1240 query coherent_trait(def_id: DefId) -> Result<(), ErrorGuaranteed> {
1241 desc { |tcx| "coherence checking all impls of trait `{}`", tcx.def_path_str(def_id) }
1242 return_result_from_ensure_ok
1243 }
1244
1245 query mir_borrowck(key: LocalDefId) -> Result<&'tcx mir::ConcreteOpaqueTypes<'tcx>, ErrorGuaranteed> {
1248 desc { |tcx| "borrow-checking `{}`", tcx.def_path_str(key) }
1249 }
1250
1251 query crate_inherent_impls(k: ()) -> (&'tcx CrateInherentImpls, Result<(), ErrorGuaranteed>) {
1259 desc { "finding all inherent impls defined in crate" }
1260 }
1261
1262 query crate_inherent_impls_validity_check(_: ()) -> Result<(), ErrorGuaranteed> {
1270 desc { "check for inherent impls that should not be defined in crate" }
1271 return_result_from_ensure_ok
1272 }
1273
1274 query crate_inherent_impls_overlap_check(_: ()) -> Result<(), ErrorGuaranteed> {
1282 desc { "check for overlap between inherent impls defined in this crate" }
1283 return_result_from_ensure_ok
1284 }
1285
1286 query orphan_check_impl(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1289 desc { |tcx|
1290 "checking whether impl `{}` follows the orphan rules",
1291 tcx.def_path_str(key),
1292 }
1293 return_result_from_ensure_ok
1294 }
1295
1296 query mir_callgraph_cyclic(key: LocalDefId) -> &'tcx UnordSet<LocalDefId> {
1298 fatal_cycle
1299 arena_cache
1300 desc { |tcx|
1301 "computing (transitive) callees of `{}` that may recurse",
1302 tcx.def_path_str(key),
1303 }
1304 cache_on_disk_if { true }
1305 }
1306
1307 query mir_inliner_callees(key: ty::InstanceKind<'tcx>) -> &'tcx [(DefId, GenericArgsRef<'tcx>)] {
1309 fatal_cycle
1310 desc { |tcx|
1311 "computing all local function calls in `{}`",
1312 tcx.def_path_str(key.def_id()),
1313 }
1314 }
1315
1316 query tag_for_variant(
1324 key: PseudoCanonicalInput<'tcx, (Ty<'tcx>, abi::VariantIdx)>,
1325 ) -> Option<ty::ScalarInt> {
1326 desc { "computing variant tag for enum" }
1327 }
1328
1329 query eval_to_allocation_raw(key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>)
1338 -> EvalToAllocationRawResult<'tcx> {
1339 desc { |tcx|
1340 "const-evaluating + checking `{}`",
1341 key.value.display(tcx)
1342 }
1343 cache_on_disk_if { true }
1344 }
1345
1346 query eval_static_initializer(key: DefId) -> EvalStaticInitializerRawResult<'tcx> {
1348 desc { |tcx|
1349 "evaluating initializer of static `{}`",
1350 tcx.def_path_str(key)
1351 }
1352 cache_on_disk_if { key.is_local() }
1353 separate_provide_extern
1354 feedable
1355 }
1356
1357 query eval_to_const_value_raw(key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>)
1370 -> EvalToConstValueResult<'tcx> {
1371 desc { |tcx|
1372 "simplifying constant for the type system `{}`",
1373 key.value.display(tcx)
1374 }
1375 depth_limit
1376 cache_on_disk_if { true }
1377 }
1378
1379 query eval_to_valtree(
1382 key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>
1383 ) -> EvalToValTreeResult<'tcx> {
1384 desc { "evaluating type-level constant" }
1385 }
1386
1387 query valtree_to_const_val(key: ty::Value<'tcx>) -> mir::ConstValue {
1389 desc { "converting type-level constant value to MIR constant value"}
1390 }
1391
1392 query destructure_const(key: ty::Const<'tcx>) -> ty::DestructuredConst<'tcx> {
1395 desc { "destructuring type level constant"}
1396 }
1397
1398 query lit_to_const(
1400 key: LitToConstInput<'tcx>
1401 ) -> ty::Const<'tcx> {
1402 desc { "converting literal to const" }
1403 }
1404
1405 query check_match(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
1406 desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) }
1407 return_result_from_ensure_ok
1408 }
1409
1410 query effective_visibilities(_: ()) -> &'tcx EffectiveVisibilities {
1412 eval_always
1413 desc { "checking effective visibilities" }
1414 }
1415 query check_private_in_public(module_def_id: LocalModDefId) {
1416 desc { |tcx|
1417 "checking for private elements in public interfaces for {}",
1418 describe_as_module(module_def_id, tcx)
1419 }
1420 }
1421
1422 query reachable_set(_: ()) -> &'tcx LocalDefIdSet {
1423 arena_cache
1424 desc { "reachability" }
1425 cache_on_disk_if { true }
1426 }
1427
1428 query region_scope_tree(def_id: DefId) -> &'tcx crate::middle::region::ScopeTree {
1431 desc { |tcx| "computing drop scopes for `{}`", tcx.def_path_str(def_id) }
1432 }
1433
1434 query mir_shims(key: ty::InstanceKind<'tcx>) -> &'tcx mir::Body<'tcx> {
1436 arena_cache
1437 desc {
1438 |tcx| "generating MIR shim for `{}`, instance={:?}",
1439 tcx.def_path_str(key.def_id()),
1440 key
1441 }
1442 }
1443
1444 query symbol_name(key: ty::Instance<'tcx>) -> ty::SymbolName<'tcx> {
1448 desc { "computing the symbol for `{}`", key }
1449 cache_on_disk_if { true }
1450 }
1451
1452 query def_kind(def_id: DefId) -> DefKind {
1453 desc { |tcx| "looking up definition kind of `{}`", tcx.def_path_str(def_id) }
1454 cache_on_disk_if { def_id.is_local() }
1455 separate_provide_extern
1456 feedable
1457 }
1458
1459 query def_span(def_id: DefId) -> Span {
1461 desc { |tcx| "looking up span for `{}`", tcx.def_path_str(def_id) }
1462 cache_on_disk_if { def_id.is_local() }
1463 separate_provide_extern
1464 feedable
1465 }
1466
1467 query def_ident_span(def_id: DefId) -> Option<Span> {
1469 desc { |tcx| "looking up span for `{}`'s identifier", tcx.def_path_str(def_id) }
1470 cache_on_disk_if { def_id.is_local() }
1471 separate_provide_extern
1472 feedable
1473 }
1474
1475 query ty_span(def_id: LocalDefId) -> Span {
1478 desc { |tcx| "looking up span for `{}`'s type", tcx.def_path_str(def_id) }
1479 cache_on_disk_if { true }
1480 }
1481
1482 query lookup_stability(def_id: DefId) -> Option<hir::Stability> {
1483 desc { |tcx| "looking up stability of `{}`", tcx.def_path_str(def_id) }
1484 cache_on_disk_if { def_id.is_local() }
1485 separate_provide_extern
1486 }
1487
1488 query lookup_const_stability(def_id: DefId) -> Option<hir::ConstStability> {
1489 desc { |tcx| "looking up const stability of `{}`", tcx.def_path_str(def_id) }
1490 cache_on_disk_if { def_id.is_local() }
1491 separate_provide_extern
1492 }
1493
1494 query lookup_default_body_stability(def_id: DefId) -> Option<hir::DefaultBodyStability> {
1495 desc { |tcx| "looking up default body stability of `{}`", tcx.def_path_str(def_id) }
1496 separate_provide_extern
1497 }
1498
1499 query should_inherit_track_caller(def_id: DefId) -> bool {
1500 desc { |tcx| "computing should_inherit_track_caller of `{}`", tcx.def_path_str(def_id) }
1501 }
1502
1503 query inherited_align(def_id: DefId) -> Option<Align> {
1504 desc { |tcx| "computing inherited_align of `{}`", tcx.def_path_str(def_id) }
1505 }
1506
1507 query lookup_deprecation_entry(def_id: DefId) -> Option<DeprecationEntry> {
1508 desc { |tcx| "checking whether `{}` is deprecated", tcx.def_path_str(def_id) }
1509 cache_on_disk_if { def_id.is_local() }
1510 separate_provide_extern
1511 }
1512
1513 query is_doc_hidden(def_id: DefId) -> bool {
1515 desc { |tcx| "checking whether `{}` is `doc(hidden)`", tcx.def_path_str(def_id) }
1516 separate_provide_extern
1517 }
1518
1519 query is_doc_notable_trait(def_id: DefId) -> bool {
1521 desc { |tcx| "checking whether `{}` is `doc(notable_trait)`", tcx.def_path_str(def_id) }
1522 }
1523
1524 query attrs_for_def(def_id: DefId) -> &'tcx [hir::Attribute] {
1528 desc { |tcx| "collecting attributes of `{}`", tcx.def_path_str(def_id) }
1529 separate_provide_extern
1530 }
1531
1532 query codegen_fn_attrs(def_id: DefId) -> &'tcx CodegenFnAttrs {
1542 desc { |tcx| "computing codegen attributes of `{}`", tcx.def_path_str(def_id) }
1543 arena_cache
1544 cache_on_disk_if { def_id.is_local() }
1545 separate_provide_extern
1546 feedable
1547 }
1548
1549 query asm_target_features(def_id: DefId) -> &'tcx FxIndexSet<Symbol> {
1550 desc { |tcx| "computing target features for inline asm of `{}`", tcx.def_path_str(def_id) }
1551 }
1552
1553 query fn_arg_idents(def_id: DefId) -> &'tcx [Option<rustc_span::Ident>] {
1554 desc { |tcx| "looking up function parameter identifiers for `{}`", tcx.def_path_str(def_id) }
1555 separate_provide_extern
1556 }
1557
1558 query rendered_const(def_id: DefId) -> &'tcx String {
1561 arena_cache
1562 desc { |tcx| "rendering constant initializer of `{}`", tcx.def_path_str(def_id) }
1563 separate_provide_extern
1564 }
1565
1566 query rendered_precise_capturing_args(def_id: DefId) -> Option<&'tcx [PreciseCapturingArgKind<Symbol, Symbol>]> {
1568 desc { |tcx| "rendering precise capturing args for `{}`", tcx.def_path_str(def_id) }
1569 separate_provide_extern
1570 }
1571
1572 query impl_parent(def_id: DefId) -> Option<DefId> {
1573 desc { |tcx| "computing specialization parent impl of `{}`", tcx.def_path_str(def_id) }
1574 separate_provide_extern
1575 }
1576
1577 query is_ctfe_mir_available(key: DefId) -> bool {
1578 desc { |tcx| "checking if item has CTFE MIR available: `{}`", tcx.def_path_str(key) }
1579 cache_on_disk_if { key.is_local() }
1580 separate_provide_extern
1581 }
1582 query is_mir_available(key: DefId) -> bool {
1583 desc { |tcx| "checking if item has MIR available: `{}`", tcx.def_path_str(key) }
1584 cache_on_disk_if { key.is_local() }
1585 separate_provide_extern
1586 }
1587
1588 query own_existential_vtable_entries(
1589 key: DefId
1590 ) -> &'tcx [DefId] {
1591 desc { |tcx| "finding all existential vtable entries for trait `{}`", tcx.def_path_str(key) }
1592 }
1593
1594 query vtable_entries(key: ty::TraitRef<'tcx>)
1595 -> &'tcx [ty::VtblEntry<'tcx>] {
1596 desc { |tcx| "finding all vtable entries for trait `{}`", tcx.def_path_str(key.def_id) }
1597 }
1598
1599 query first_method_vtable_slot(key: ty::TraitRef<'tcx>) -> usize {
1600 desc { |tcx| "finding the slot within the vtable of `{}` for the implementation of `{}`", key.self_ty(), key.print_only_trait_name() }
1601 }
1602
1603 query supertrait_vtable_slot(key: (Ty<'tcx>, Ty<'tcx>)) -> Option<usize> {
1604 desc { |tcx| "finding the slot within vtable for trait object `{}` vtable ptr during trait upcasting coercion from `{}` vtable",
1605 key.1, key.0 }
1606 }
1607
1608 query vtable_allocation(key: (Ty<'tcx>, Option<ty::ExistentialTraitRef<'tcx>>)) -> mir::interpret::AllocId {
1609 desc { |tcx| "vtable const allocation for <{} as {}>",
1610 key.0,
1611 key.1.map(|trait_ref| format!("{trait_ref}")).unwrap_or_else(|| "_".to_owned())
1612 }
1613 }
1614
1615 query codegen_select_candidate(
1616 key: PseudoCanonicalInput<'tcx, ty::TraitRef<'tcx>>
1617 ) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
1618 cache_on_disk_if { true }
1619 desc { |tcx| "computing candidate for `{}`", key.value }
1620 }
1621
1622 query all_local_trait_impls(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexMap<DefId, Vec<LocalDefId>> {
1624 desc { "finding local trait impls" }
1625 }
1626
1627 query local_trait_impls(trait_id: DefId) -> &'tcx [LocalDefId] {
1629 desc { "finding local trait impls of `{}`", tcx.def_path_str(trait_id) }
1630 }
1631
1632 query trait_impls_of(trait_id: DefId) -> &'tcx ty::trait_def::TraitImpls {
1634 arena_cache
1635 desc { |tcx| "finding trait impls of `{}`", tcx.def_path_str(trait_id) }
1636 }
1637
1638 query specialization_graph_of(trait_id: DefId) -> Result<&'tcx specialization_graph::Graph, ErrorGuaranteed> {
1639 desc { |tcx| "building specialization graph of trait `{}`", tcx.def_path_str(trait_id) }
1640 cache_on_disk_if { true }
1641 return_result_from_ensure_ok
1642 }
1643 query dyn_compatibility_violations(trait_id: DefId) -> &'tcx [DynCompatibilityViolation] {
1644 desc { |tcx| "determining dyn-compatibility of trait `{}`", tcx.def_path_str(trait_id) }
1645 }
1646 query is_dyn_compatible(trait_id: DefId) -> bool {
1647 desc { |tcx| "checking if trait `{}` is dyn-compatible", tcx.def_path_str(trait_id) }
1648 }
1649
1650 query param_env(def_id: DefId) -> ty::ParamEnv<'tcx> {
1659 desc { |tcx| "computing normalized predicates of `{}`", tcx.def_path_str(def_id) }
1660 feedable
1661 }
1662
1663 query typing_env_normalized_for_post_analysis(def_id: DefId) -> ty::TypingEnv<'tcx> {
1667 desc { |tcx| "computing revealed normalized predicates of `{}`", tcx.def_path_str(def_id) }
1668 }
1669
1670 query is_copy_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1673 desc { "computing whether `{}` is `Copy`", env.value }
1674 }
1675 query is_use_cloned_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1678 desc { "computing whether `{}` is `UseCloned`", env.value }
1679 }
1680 query is_sized_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1682 desc { "computing whether `{}` is `Sized`", env.value }
1683 }
1684 query is_freeze_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1686 desc { "computing whether `{}` is freeze", env.value }
1687 }
1688 query is_unpin_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1690 desc { "computing whether `{}` is `Unpin`", env.value }
1691 }
1692 query is_async_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1694 desc { "computing whether `{}` is `AsyncDrop`", env.value }
1695 }
1696 query needs_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1698 desc { "computing whether `{}` needs drop", env.value }
1699 }
1700 query needs_async_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1702 desc { "computing whether `{}` needs async drop", env.value }
1703 }
1704 query has_significant_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1706 desc { "computing whether `{}` has a significant drop", env.value }
1707 }
1708
1709 query has_structural_eq_impl(ty: Ty<'tcx>) -> bool {
1714 desc {
1715 "computing whether `{}` implements `StructuralPartialEq`",
1716 ty
1717 }
1718 }
1719
1720 query adt_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1724 desc { |tcx| "computing when `{}` needs drop", tcx.def_path_str(def_id) }
1725 cache_on_disk_if { true }
1726 }
1727
1728 query adt_async_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1732 desc { |tcx| "computing when `{}` needs async drop", tcx.def_path_str(def_id) }
1733 cache_on_disk_if { true }
1734 }
1735
1736 query adt_significant_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1743 desc { |tcx| "computing when `{}` has a significant destructor", tcx.def_path_str(def_id) }
1744 }
1745
1746 query list_significant_drop_tys(ty: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> &'tcx ty::List<Ty<'tcx>> {
1764 desc { |tcx| "computing when `{}` has a significant destructor", ty.value }
1765 }
1766
1767 query layout_of(
1770 key: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>
1771 ) -> Result<ty::layout::TyAndLayout<'tcx>, &'tcx ty::layout::LayoutError<'tcx>> {
1772 depth_limit
1773 desc { "computing layout of `{}`", key.value }
1774 cycle_delay_bug
1776 }
1777
1778 query fn_abi_of_fn_ptr(
1783 key: ty::PseudoCanonicalInput<'tcx, (ty::PolyFnSig<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
1784 ) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
1785 desc { "computing call ABI of `{}` function pointers", key.value.0 }
1786 }
1787
1788 query fn_abi_of_instance(
1794 key: ty::PseudoCanonicalInput<'tcx, (ty::Instance<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
1795 ) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
1796 desc { "computing call ABI of `{}`", key.value.0 }
1797 }
1798
1799 query dylib_dependency_formats(_: CrateNum)
1800 -> &'tcx [(CrateNum, LinkagePreference)] {
1801 desc { "getting dylib dependency formats of crate" }
1802 separate_provide_extern
1803 }
1804
1805 query dependency_formats(_: ()) -> &'tcx Arc<crate::middle::dependency_format::Dependencies> {
1806 arena_cache
1807 desc { "getting the linkage format of all dependencies" }
1808 }
1809
1810 query is_compiler_builtins(_: CrateNum) -> bool {
1811 fatal_cycle
1812 desc { "checking if the crate is_compiler_builtins" }
1813 separate_provide_extern
1814 }
1815 query has_global_allocator(_: CrateNum) -> bool {
1816 eval_always
1818 fatal_cycle
1819 desc { "checking if the crate has_global_allocator" }
1820 separate_provide_extern
1821 }
1822 query has_alloc_error_handler(_: CrateNum) -> bool {
1823 eval_always
1825 fatal_cycle
1826 desc { "checking if the crate has_alloc_error_handler" }
1827 separate_provide_extern
1828 }
1829 query has_panic_handler(_: CrateNum) -> bool {
1830 fatal_cycle
1831 desc { "checking if the crate has_panic_handler" }
1832 separate_provide_extern
1833 }
1834 query is_profiler_runtime(_: CrateNum) -> bool {
1835 fatal_cycle
1836 desc { "checking if a crate is `#![profiler_runtime]`" }
1837 separate_provide_extern
1838 }
1839 query has_ffi_unwind_calls(key: LocalDefId) -> bool {
1840 desc { |tcx| "checking if `{}` contains FFI-unwind calls", tcx.def_path_str(key) }
1841 cache_on_disk_if { true }
1842 }
1843 query required_panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
1844 fatal_cycle
1845 desc { "getting a crate's required panic strategy" }
1846 separate_provide_extern
1847 }
1848 query panic_in_drop_strategy(_: CrateNum) -> PanicStrategy {
1849 fatal_cycle
1850 desc { "getting a crate's configured panic-in-drop strategy" }
1851 separate_provide_extern
1852 }
1853 query is_no_builtins(_: CrateNum) -> bool {
1854 fatal_cycle
1855 desc { "getting whether a crate has `#![no_builtins]`" }
1856 separate_provide_extern
1857 }
1858 query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
1859 fatal_cycle
1860 desc { "getting a crate's symbol mangling version" }
1861 separate_provide_extern
1862 }
1863
1864 query extern_crate(def_id: CrateNum) -> Option<&'tcx ExternCrate> {
1865 eval_always
1866 desc { "getting crate's ExternCrateData" }
1867 separate_provide_extern
1868 }
1869
1870 query specialization_enabled_in(cnum: CrateNum) -> bool {
1871 desc { "checking whether the crate enabled `specialization`/`min_specialization`" }
1872 separate_provide_extern
1873 }
1874
1875 query specializes(_: (DefId, DefId)) -> bool {
1876 desc { "computing whether impls specialize one another" }
1877 }
1878 query in_scope_traits_map(_: hir::OwnerId)
1879 -> Option<&'tcx ItemLocalMap<Box<[TraitCandidate]>>> {
1880 desc { "getting traits in scope at a block" }
1881 }
1882
1883 query defaultness(def_id: DefId) -> hir::Defaultness {
1885 desc { |tcx| "looking up whether `{}` has `default`", tcx.def_path_str(def_id) }
1886 separate_provide_extern
1887 feedable
1888 }
1889
1890 query default_field(def_id: DefId) -> Option<DefId> {
1892 desc { |tcx| "looking up the `const` corresponding to the default for `{}`", tcx.def_path_str(def_id) }
1893 separate_provide_extern
1894 }
1895
1896 query check_well_formed(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1897 desc { |tcx| "checking that `{}` is well-formed", tcx.def_path_str(key) }
1898 return_result_from_ensure_ok
1899 }
1900
1901 query enforce_impl_non_lifetime_params_are_constrained(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1902 desc { |tcx| "checking that `{}`'s generics are constrained by the impl header", tcx.def_path_str(key) }
1903 return_result_from_ensure_ok
1904 }
1905
1906 query reachable_non_generics(_: CrateNum)
1919 -> &'tcx DefIdMap<SymbolExportInfo> {
1920 arena_cache
1921 desc { "looking up the exported symbols of a crate" }
1922 separate_provide_extern
1923 }
1924 query is_reachable_non_generic(def_id: DefId) -> bool {
1925 desc { |tcx| "checking whether `{}` is an exported symbol", tcx.def_path_str(def_id) }
1926 cache_on_disk_if { def_id.is_local() }
1927 separate_provide_extern
1928 }
1929 query is_unreachable_local_definition(def_id: LocalDefId) -> bool {
1930 desc { |tcx|
1931 "checking whether `{}` is reachable from outside the crate",
1932 tcx.def_path_str(def_id),
1933 }
1934 }
1935
1936 query upstream_monomorphizations(_: ()) -> &'tcx DefIdMap<UnordMap<GenericArgsRef<'tcx>, CrateNum>> {
1944 arena_cache
1945 desc { "collecting available upstream monomorphizations" }
1946 }
1947
1948 query upstream_monomorphizations_for(def_id: DefId)
1956 -> Option<&'tcx UnordMap<GenericArgsRef<'tcx>, CrateNum>>
1957 {
1958 desc { |tcx|
1959 "collecting available upstream monomorphizations for `{}`",
1960 tcx.def_path_str(def_id),
1961 }
1962 separate_provide_extern
1963 }
1964
1965 query upstream_drop_glue_for(args: GenericArgsRef<'tcx>) -> Option<CrateNum> {
1981 desc { "available upstream drop-glue for `{:?}`", args }
1982 }
1983
1984 query upstream_async_drop_glue_for(args: GenericArgsRef<'tcx>) -> Option<CrateNum> {
2001 desc { "available upstream async-drop-glue for `{:?}`", args }
2002 }
2003
2004 query foreign_modules(_: CrateNum) -> &'tcx FxIndexMap<DefId, ForeignModule> {
2006 arena_cache
2007 desc { "looking up the foreign modules of a linked crate" }
2008 separate_provide_extern
2009 }
2010
2011 query clashing_extern_declarations(_: ()) {
2013 desc { "checking `extern fn` declarations are compatible" }
2014 }
2015
2016 query entry_fn(_: ()) -> Option<(DefId, EntryFnType)> {
2019 desc { "looking up the entry function of a crate" }
2020 }
2021
2022 query proc_macro_decls_static(_: ()) -> Option<LocalDefId> {
2024 desc { "looking up the proc macro declarations for a crate" }
2025 }
2026
2027 query crate_hash(_: CrateNum) -> Svh {
2035 eval_always
2036 desc { "looking up the hash a crate" }
2037 separate_provide_extern
2038 }
2039
2040 query crate_host_hash(_: CrateNum) -> Option<Svh> {
2042 eval_always
2043 desc { "looking up the hash of a host version of a crate" }
2044 separate_provide_extern
2045 }
2046
2047 query extra_filename(_: CrateNum) -> &'tcx String {
2050 arena_cache
2051 eval_always
2052 desc { "looking up the extra filename for a crate" }
2053 separate_provide_extern
2054 }
2055
2056 query crate_extern_paths(_: CrateNum) -> &'tcx Vec<PathBuf> {
2058 arena_cache
2059 eval_always
2060 desc { "looking up the paths for extern crates" }
2061 separate_provide_extern
2062 }
2063
2064 query implementations_of_trait(_: (CrateNum, DefId)) -> &'tcx [(DefId, Option<SimplifiedType>)] {
2067 desc { "looking up implementations of a trait in a crate" }
2068 separate_provide_extern
2069 }
2070
2071 query crate_incoherent_impls(key: (CrateNum, SimplifiedType)) -> &'tcx [DefId] {
2076 desc { |tcx| "collecting all impls for a type in a crate" }
2077 separate_provide_extern
2078 }
2079
2080 query native_library(def_id: DefId) -> Option<&'tcx NativeLib> {
2082 desc { |tcx| "getting the native library for `{}`", tcx.def_path_str(def_id) }
2083 }
2084
2085 query inherit_sig_for_delegation_item(def_id: LocalDefId) -> &'tcx [Ty<'tcx>] {
2086 desc { "inheriting delegation signature" }
2087 }
2088
2089 query resolve_bound_vars(owner_id: hir::OwnerId) -> &'tcx ResolveBoundVars {
2093 arena_cache
2094 desc { |tcx| "resolving lifetimes for `{}`", tcx.def_path_str(owner_id) }
2095 }
2096 query named_variable_map(owner_id: hir::OwnerId) -> &'tcx SortedMap<ItemLocalId, ResolvedArg> {
2097 desc { |tcx| "looking up a named region inside `{}`", tcx.def_path_str(owner_id) }
2098 }
2099 query is_late_bound_map(owner_id: hir::OwnerId) -> Option<&'tcx FxIndexSet<ItemLocalId>> {
2100 desc { |tcx| "testing if a region is late bound inside `{}`", tcx.def_path_str(owner_id) }
2101 }
2102 query object_lifetime_default(def_id: DefId) -> ObjectLifetimeDefault {
2117 desc { "looking up lifetime defaults for type parameter `{}`", tcx.def_path_str(def_id) }
2118 separate_provide_extern
2119 }
2120 query late_bound_vars_map(owner_id: hir::OwnerId)
2121 -> &'tcx SortedMap<ItemLocalId, Vec<ty::BoundVariableKind>> {
2122 desc { |tcx| "looking up late bound vars inside `{}`", tcx.def_path_str(owner_id) }
2123 }
2124 query opaque_captured_lifetimes(def_id: LocalDefId) -> &'tcx [(ResolvedArg, LocalDefId)] {
2139 desc { |tcx| "listing captured lifetimes for opaque `{}`", tcx.def_path_str(def_id) }
2140 }
2141
2142 query visibility(def_id: DefId) -> ty::Visibility<DefId> {
2155 desc { |tcx| "computing visibility of `{}`", tcx.def_path_str(def_id) }
2156 separate_provide_extern
2157 feedable
2158 }
2159
2160 query inhabited_predicate_adt(key: DefId) -> ty::inhabitedness::InhabitedPredicate<'tcx> {
2161 desc { "computing the uninhabited predicate of `{:?}`", key }
2162 }
2163
2164 query inhabited_predicate_type(key: Ty<'tcx>) -> ty::inhabitedness::InhabitedPredicate<'tcx> {
2166 desc { "computing the uninhabited predicate of `{}`", key }
2167 }
2168
2169 query dep_kind(_: CrateNum) -> CrateDepKind {
2170 eval_always
2171 desc { "fetching what a dependency looks like" }
2172 separate_provide_extern
2173 }
2174
2175 query crate_name(_: CrateNum) -> Symbol {
2177 feedable
2178 desc { "fetching what a crate is named" }
2179 separate_provide_extern
2180 }
2181 query module_children(def_id: DefId) -> &'tcx [ModChild] {
2182 desc { |tcx| "collecting child items of module `{}`", tcx.def_path_str(def_id) }
2183 separate_provide_extern
2184 }
2185
2186 query num_extern_def_ids(_: CrateNum) -> usize {
2192 desc { "fetching the number of definitions in a crate" }
2193 separate_provide_extern
2194 }
2195
2196 query lib_features(_: CrateNum) -> &'tcx LibFeatures {
2197 desc { "calculating the lib features defined in a crate" }
2198 separate_provide_extern
2199 arena_cache
2200 }
2201 query stability_implications(_: CrateNum) -> &'tcx UnordMap<Symbol, Symbol> {
2214 arena_cache
2215 desc { "calculating the implications between `#[unstable]` features defined in a crate" }
2216 separate_provide_extern
2217 }
2218 query intrinsic_raw(def_id: DefId) -> Option<rustc_middle::ty::IntrinsicDef> {
2220 desc { |tcx| "fetch intrinsic name if `{}` is an intrinsic", tcx.def_path_str(def_id) }
2221 separate_provide_extern
2222 }
2223 query get_lang_items(_: ()) -> &'tcx LanguageItems {
2225 arena_cache
2226 eval_always
2227 desc { "calculating the lang items map" }
2228 }
2229
2230 query all_diagnostic_items(_: ()) -> &'tcx rustc_hir::diagnostic_items::DiagnosticItems {
2232 arena_cache
2233 eval_always
2234 desc { "calculating the diagnostic items map" }
2235 }
2236
2237 query defined_lang_items(_: CrateNum) -> &'tcx [(DefId, LangItem)] {
2239 desc { "calculating the lang items defined in a crate" }
2240 separate_provide_extern
2241 }
2242
2243 query diagnostic_items(_: CrateNum) -> &'tcx rustc_hir::diagnostic_items::DiagnosticItems {
2245 arena_cache
2246 desc { "calculating the diagnostic items map in a crate" }
2247 separate_provide_extern
2248 }
2249
2250 query missing_lang_items(_: CrateNum) -> &'tcx [LangItem] {
2251 desc { "calculating the missing lang items in a crate" }
2252 separate_provide_extern
2253 }
2254
2255 query visible_parent_map(_: ()) -> &'tcx DefIdMap<DefId> {
2260 arena_cache
2261 desc { "calculating the visible parent map" }
2262 }
2263 query trimmed_def_paths(_: ()) -> &'tcx DefIdMap<Symbol> {
2266 arena_cache
2267 desc { "calculating trimmed def paths" }
2268 }
2269 query missing_extern_crate_item(_: CrateNum) -> bool {
2270 eval_always
2271 desc { "seeing if we're missing an `extern crate` item for this crate" }
2272 separate_provide_extern
2273 }
2274 query used_crate_source(_: CrateNum) -> &'tcx Arc<CrateSource> {
2275 arena_cache
2276 eval_always
2277 desc { "looking at the source for a crate" }
2278 separate_provide_extern
2279 }
2280
2281 query debugger_visualizers(_: CrateNum) -> &'tcx Vec<DebuggerVisualizerFile> {
2286 arena_cache
2287 desc { "looking up the debugger visualizers for this crate" }
2288 separate_provide_extern
2289 eval_always
2290 }
2291
2292 query postorder_cnums(_: ()) -> &'tcx [CrateNum] {
2293 eval_always
2294 desc { "generating a postorder list of CrateNums" }
2295 }
2296 query is_private_dep(c: CrateNum) -> bool {
2299 eval_always
2300 desc { "checking whether crate `{}` is a private dependency", c }
2301 separate_provide_extern
2302 }
2303 query allocator_kind(_: ()) -> Option<AllocatorKind> {
2304 eval_always
2305 desc { "getting the allocator kind for the current crate" }
2306 }
2307 query alloc_error_handler_kind(_: ()) -> Option<AllocatorKind> {
2308 eval_always
2309 desc { "alloc error handler kind for the current crate" }
2310 }
2311
2312 query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
2313 desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }
2314 }
2315
2316 query crates(_: ()) -> &'tcx [CrateNum] {
2319 eval_always
2320 desc { "fetching all foreign CrateNum instances" }
2321 }
2322 query used_crates(_: ()) -> &'tcx [CrateNum] {
2326 eval_always
2327 desc { "fetching `CrateNum`s for all crates loaded non-speculatively" }
2328 }
2329
2330 query traits(_: CrateNum) -> &'tcx [DefId] {
2332 desc { "fetching all traits in a crate" }
2333 separate_provide_extern
2334 }
2335
2336 query trait_impls_in_crate(_: CrateNum) -> &'tcx [DefId] {
2337 desc { "fetching all trait impls in a crate" }
2338 separate_provide_extern
2339 }
2340
2341 query stable_order_of_exportable_impls(_: CrateNum) -> &'tcx FxIndexMap<DefId, usize> {
2342 desc { "fetching the stable impl's order" }
2343 separate_provide_extern
2344 }
2345
2346 query exportable_items(_: CrateNum) -> &'tcx [DefId] {
2347 desc { "fetching all exportable items in a crate" }
2348 separate_provide_extern
2349 }
2350
2351 query exported_non_generic_symbols(cnum: CrateNum) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportInfo)] {
2363 desc { "collecting exported non-generic symbols for crate `{}`", cnum}
2364 cache_on_disk_if { *cnum == LOCAL_CRATE }
2365 separate_provide_extern
2366 }
2367
2368 query exported_generic_symbols(cnum: CrateNum) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportInfo)] {
2376 desc { "collecting exported generic symbols for crate `{}`", cnum}
2377 cache_on_disk_if { *cnum == LOCAL_CRATE }
2378 separate_provide_extern
2379 }
2380
2381 query collect_and_partition_mono_items(_: ()) -> MonoItemPartitions<'tcx> {
2382 eval_always
2383 desc { "collect_and_partition_mono_items" }
2384 }
2385
2386 query is_codegened_item(def_id: DefId) -> bool {
2387 desc { |tcx| "determining whether `{}` needs codegen", tcx.def_path_str(def_id) }
2388 }
2389
2390 query codegen_unit(sym: Symbol) -> &'tcx CodegenUnit<'tcx> {
2391 desc { "getting codegen unit `{sym}`" }
2392 }
2393
2394 query backend_optimization_level(_: ()) -> OptLevel {
2395 desc { "optimization level used by backend" }
2396 }
2397
2398 query output_filenames(_: ()) -> &'tcx Arc<OutputFilenames> {
2403 feedable
2404 desc { "getting output filenames" }
2405 arena_cache
2406 }
2407
2408 query normalize_canonicalized_projection_ty(
2414 goal: CanonicalAliasGoal<'tcx>
2415 ) -> Result<
2416 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2417 NoSolution,
2418 > {
2419 desc { "normalizing `{}`", goal.canonical.value.value }
2420 }
2421
2422 query normalize_canonicalized_free_alias(
2428 goal: CanonicalAliasGoal<'tcx>
2429 ) -> Result<
2430 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2431 NoSolution,
2432 > {
2433 desc { "normalizing `{}`", goal.canonical.value.value }
2434 }
2435
2436 query normalize_canonicalized_inherent_projection_ty(
2442 goal: CanonicalAliasGoal<'tcx>
2443 ) -> Result<
2444 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2445 NoSolution,
2446 > {
2447 desc { "normalizing `{}`", goal.canonical.value.value }
2448 }
2449
2450 query try_normalize_generic_arg_after_erasing_regions(
2452 goal: PseudoCanonicalInput<'tcx, GenericArg<'tcx>>
2453 ) -> Result<GenericArg<'tcx>, NoSolution> {
2454 desc { "normalizing `{}`", goal.value }
2455 }
2456
2457 query implied_outlives_bounds(
2458 key: (CanonicalImpliedOutlivesBoundsGoal<'tcx>, bool)
2459 ) -> Result<
2460 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>,
2461 NoSolution,
2462 > {
2463 desc { "computing implied outlives bounds for `{}` (hack disabled = {:?})", key.0.canonical.value.value.ty, key.1 }
2464 }
2465
2466 query dropck_outlives(
2469 goal: CanonicalDropckOutlivesGoal<'tcx>
2470 ) -> Result<
2471 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>,
2472 NoSolution,
2473 > {
2474 desc { "computing dropck types for `{}`", goal.canonical.value.value.dropped_ty }
2475 }
2476
2477 query evaluate_obligation(
2480 goal: CanonicalPredicateGoal<'tcx>
2481 ) -> Result<EvaluationResult, OverflowError> {
2482 desc { "evaluating trait selection obligation `{}`", goal.canonical.value.value }
2483 }
2484
2485 query type_op_ascribe_user_type(
2487 goal: CanonicalTypeOpAscribeUserTypeGoal<'tcx>
2488 ) -> Result<
2489 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
2490 NoSolution,
2491 > {
2492 desc { "evaluating `type_op_ascribe_user_type` `{:?}`", goal.canonical.value.value }
2493 }
2494
2495 query type_op_prove_predicate(
2497 goal: CanonicalTypeOpProvePredicateGoal<'tcx>
2498 ) -> Result<
2499 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
2500 NoSolution,
2501 > {
2502 desc { "evaluating `type_op_prove_predicate` `{:?}`", goal.canonical.value.value }
2503 }
2504
2505 query type_op_normalize_ty(
2507 goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>
2508 ) -> Result<
2509 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Ty<'tcx>>>,
2510 NoSolution,
2511 > {
2512 desc { "normalizing `{}`", goal.canonical.value.value.value }
2513 }
2514
2515 query type_op_normalize_clause(
2517 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::Clause<'tcx>>
2518 ) -> Result<
2519 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::Clause<'tcx>>>,
2520 NoSolution,
2521 > {
2522 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2523 }
2524
2525 query type_op_normalize_poly_fn_sig(
2527 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::PolyFnSig<'tcx>>
2528 ) -> Result<
2529 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::PolyFnSig<'tcx>>>,
2530 NoSolution,
2531 > {
2532 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2533 }
2534
2535 query type_op_normalize_fn_sig(
2537 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>
2538 ) -> Result<
2539 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::FnSig<'tcx>>>,
2540 NoSolution,
2541 > {
2542 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2543 }
2544
2545 query instantiate_and_check_impossible_predicates(key: (DefId, GenericArgsRef<'tcx>)) -> bool {
2546 desc { |tcx|
2547 "checking impossible instantiated predicates: `{}`",
2548 tcx.def_path_str(key.0)
2549 }
2550 }
2551
2552 query is_impossible_associated_item(key: (DefId, DefId)) -> bool {
2553 desc { |tcx|
2554 "checking if `{}` is impossible to reference within `{}`",
2555 tcx.def_path_str(key.1),
2556 tcx.def_path_str(key.0),
2557 }
2558 }
2559
2560 query method_autoderef_steps(
2561 goal: CanonicalTyGoal<'tcx>
2562 ) -> MethodAutoderefStepsResult<'tcx> {
2563 desc { "computing autoderef types for `{}`", goal.canonical.value.value }
2564 }
2565
2566 query evaluate_root_goal_for_proof_tree_raw(
2568 goal: solve::CanonicalInput<'tcx>,
2569 ) -> (solve::QueryResult<'tcx>, &'tcx solve::inspect::Probe<TyCtxt<'tcx>>) {
2570 no_hash
2571 desc { "computing proof tree for `{}`", goal.canonical.value.goal.predicate }
2572 }
2573
2574 query rust_target_features(_: CrateNum) -> &'tcx UnordMap<String, rustc_target::target_features::Stability> {
2576 arena_cache
2577 eval_always
2578 desc { "looking up Rust target features" }
2579 }
2580
2581 query implied_target_features(feature: Symbol) -> &'tcx Vec<Symbol> {
2582 arena_cache
2583 eval_always
2584 desc { "looking up implied target features" }
2585 }
2586
2587 query features_query(_: ()) -> &'tcx rustc_feature::Features {
2588 feedable
2589 desc { "looking up enabled feature gates" }
2590 }
2591
2592 query crate_for_resolver((): ()) -> &'tcx Steal<(rustc_ast::Crate, rustc_ast::AttrVec)> {
2593 feedable
2594 no_hash
2595 desc { "the ast before macro expansion and name resolution" }
2596 }
2597
2598 query resolve_instance_raw(
2608 key: ty::PseudoCanonicalInput<'tcx, (DefId, GenericArgsRef<'tcx>)>
2609 ) -> Result<Option<ty::Instance<'tcx>>, ErrorGuaranteed> {
2610 desc { "resolving instance `{}`", ty::Instance::new_raw(key.value.0, key.value.1) }
2611 }
2612
2613 query reveal_opaque_types_in_bounds(key: ty::Clauses<'tcx>) -> ty::Clauses<'tcx> {
2614 desc { "revealing opaque types in `{:?}`", key }
2615 }
2616
2617 query limits(key: ()) -> Limits {
2618 desc { "looking up limits" }
2619 }
2620
2621 query diagnostic_hir_wf_check(
2630 key: (ty::Predicate<'tcx>, WellFormedLoc)
2631 ) -> Option<&'tcx ObligationCause<'tcx>> {
2632 arena_cache
2633 eval_always
2634 no_hash
2635 desc { "performing HIR wf-checking for predicate `{:?}` at item `{:?}`", key.0, key.1 }
2636 }
2637
2638 query global_backend_features(_: ()) -> &'tcx Vec<String> {
2641 arena_cache
2642 eval_always
2643 desc { "computing the backend features for CLI flags" }
2644 }
2645
2646 query check_validity_requirement(key: (ValidityRequirement, ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>)) -> Result<bool, &'tcx ty::layout::LayoutError<'tcx>> {
2647 desc { "checking validity requirement for `{}`: {}", key.1.value, key.0 }
2648 }
2649
2650 query compare_impl_item(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
2655 desc { |tcx| "checking assoc item `{}` is compatible with trait definition", tcx.def_path_str(key) }
2656 return_result_from_ensure_ok
2657 }
2658
2659 query deduced_param_attrs(def_id: DefId) -> &'tcx [ty::DeducedParamAttrs] {
2660 desc { |tcx| "deducing parameter attributes for {}", tcx.def_path_str(def_id) }
2661 separate_provide_extern
2662 }
2663
2664 query doc_link_resolutions(def_id: DefId) -> &'tcx DocLinkResMap {
2665 eval_always
2666 desc { "resolutions for documentation links for a module" }
2667 separate_provide_extern
2668 }
2669
2670 query doc_link_traits_in_scope(def_id: DefId) -> &'tcx [DefId] {
2671 eval_always
2672 desc { "traits in scope for documentation links for a module" }
2673 separate_provide_extern
2674 }
2675
2676 query stripped_cfg_items(cnum: CrateNum) -> &'tcx [StrippedCfgItem] {
2680 desc { "getting cfg-ed out item names" }
2681 separate_provide_extern
2682 }
2683
2684 query generics_require_sized_self(def_id: DefId) -> bool {
2685 desc { "check whether the item has a `where Self: Sized` bound" }
2686 }
2687
2688 query cross_crate_inlinable(def_id: DefId) -> bool {
2689 desc { "whether the item should be made inlinable across crates" }
2690 separate_provide_extern
2691 }
2692
2693 query check_mono_item(key: ty::Instance<'tcx>) {
2697 desc { "monomorphization-time checking" }
2698 }
2699
2700 query skip_move_check_fns(_: ()) -> &'tcx FxIndexSet<DefId> {
2702 arena_cache
2703 desc { "functions to skip for move-size check" }
2704 }
2705
2706 query items_of_instance(key: (ty::Instance<'tcx>, CollectionMode)) -> (&'tcx [Spanned<MonoItem<'tcx>>], &'tcx [Spanned<MonoItem<'tcx>>]) {
2707 desc { "collecting items used by `{}`", key.0 }
2708 cache_on_disk_if { true }
2709 }
2710
2711 query size_estimate(key: ty::Instance<'tcx>) -> usize {
2712 desc { "estimating codegen size of `{}`", key }
2713 cache_on_disk_if { true }
2714 }
2715
2716 query anon_const_kind(def_id: DefId) -> ty::AnonConstKind {
2717 desc { |tcx| "looking up anon const kind of `{}`", tcx.def_path_str(def_id) }
2718 separate_provide_extern
2719 }
2720
2721 query disabled_sanitizers_for(key: LocalDefId) -> SanitizerSet {
2727 desc { |tcx| "checking what set of sanitizers are enabled on `{}`", tcx.def_path_str(key) }
2728 feedable
2729 }
2730}
2731
2732rustc_with_all_queries! { define_callbacks! }
2733rustc_feedable_queries! { define_feedable! }
2734
2735fn describe_as_module(def_id: impl Into<LocalDefId>, tcx: TyCtxt<'_>) -> String {
2736 let def_id = def_id.into();
2737 if def_id.is_top_level_module() {
2738 "top-level module".to_string()
2739 } else {
2740 format!("module `{}`", tcx.def_path_str(def_id))
2741 }
2742}