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::fx::{FxIndexMap, FxIndexSet};
74use rustc_data_structures::sorted_map::SortedMap;
75use rustc_data_structures::steal::Steal;
76use rustc_data_structures::svh::Svh;
77use rustc_data_structures::unord::{UnordMap, UnordSet};
78use rustc_errors::ErrorGuaranteed;
79use rustc_hir::attrs::StrippedCfgItem;
80use rustc_hir::def::{DefKind, DocLinkResMap};
81use rustc_hir::def_id::{
82 CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap, LocalDefIdSet, LocalModDefId,
83};
84use rustc_hir::lang_items::{LangItem, LanguageItems};
85use rustc_hir::{Crate, ItemLocalId, ItemLocalMap, PreciseCapturingArgKind, TraitCandidate};
86use rustc_index::IndexVec;
87use rustc_lint_defs::LintId;
88use rustc_macros::rustc_queries;
89use rustc_query_system::ich::StableHashingContext;
90use rustc_query_system::query::{QueryMode, QueryStackDeferred, QueryState};
91use rustc_session::Limits;
92use rustc_session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion};
93use rustc_session::cstore::{
94 CrateDepKind, CrateSource, ExternCrate, ForeignModule, LinkagePreference, NativeLib,
95};
96use rustc_session::lint::LintExpectationId;
97use rustc_span::def_id::LOCAL_CRATE;
98use rustc_span::source_map::Spanned;
99use rustc_span::{DUMMY_SP, Span, Symbol};
100use rustc_target::spec::PanicStrategy;
101use {rustc_abi as abi, rustc_ast as ast, rustc_hir as hir};
102
103pub use self::keys::{AsLocalKey, Key, LocalCrate};
104pub use self::plumbing::{IntoQueryParam, TyCtxtAt, TyCtxtEnsureDone, TyCtxtEnsureOk};
105use crate::infer::canonical::{self, Canonical};
106use crate::lint::LintExpectation;
107use crate::metadata::ModChild;
108use crate::middle::codegen_fn_attrs::{CodegenFnAttrs, SanitizerFnAttrs};
109use crate::middle::debugger_visualizer::DebuggerVisualizerFile;
110use crate::middle::deduced_param_attrs::DeducedParamAttrs;
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::{
121 CodegenUnit, CollectionMode, MonoItem, MonoItemPartitions, NormalizationErrorInMono,
122};
123use crate::query::erase::{Erase, erase, restore};
124use crate::query::plumbing::{CyclePlaceholder, DynamicQuery};
125use crate::traits::query::{
126 CanonicalAliasGoal, CanonicalDropckOutlivesGoal, CanonicalImpliedOutlivesBoundsGoal,
127 CanonicalMethodAutoderefStepsGoal, CanonicalPredicateGoal, 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;
148pub(crate) mod inner;
149mod keys;
150pub mod on_disk_cache;
151#[macro_use]
152pub mod plumbing;
153
154rustc_queries! {
166 query trigger_delayed_bug(key: DefId) {
168 desc { "triggering a delayed bug for testing incremental" }
169 }
170
171 query registered_tools(_: ()) -> &'tcx ty::RegisteredTools {
173 arena_cache
174 desc { "compute registered tools for crate" }
175 }
176
177 query early_lint_checks(_: ()) {
178 desc { "perform lints prior to AST lowering" }
179 }
180
181 query env_var_os(key: &'tcx OsStr) -> Option<&'tcx OsStr> {
191 eval_always
193 desc { "get the value of an environment variable" }
194 }
195
196 query resolutions(_: ()) -> &'tcx ty::ResolverGlobalCtxt {
197 desc { "getting the resolver outputs" }
198 }
199
200 query resolver_for_lowering_raw(_: ()) -> (&'tcx Steal<(ty::ResolverAstLowering, Arc<ast::Crate>)>, &'tcx ty::ResolverGlobalCtxt) {
201 eval_always
202 no_hash
203 desc { "getting the resolver for lowering" }
204 }
205
206 query source_span(key: LocalDefId) -> Span {
212 eval_always
214 desc { "getting the source span" }
215 }
216
217 query hir_crate(key: ()) -> &'tcx Crate<'tcx> {
225 arena_cache
226 eval_always
227 desc { "getting the crate HIR" }
228 }
229
230 query hir_crate_items(_: ()) -> &'tcx rustc_middle::hir::ModuleItems {
232 arena_cache
233 eval_always
234 desc { "getting HIR crate items" }
235 }
236
237 query hir_module_items(key: LocalModDefId) -> &'tcx rustc_middle::hir::ModuleItems {
242 arena_cache
243 desc { |tcx| "getting HIR module items in `{}`", tcx.def_path_str(key) }
244 cache_on_disk_if { true }
245 }
246
247 query local_def_id_to_hir_id(key: LocalDefId) -> hir::HirId {
249 desc { |tcx| "getting HIR ID of `{}`", tcx.def_path_str(key) }
250 feedable
251 }
252
253 query hir_owner_parent(key: hir::OwnerId) -> hir::HirId {
258 desc { |tcx| "getting HIR parent of `{}`", tcx.def_path_str(key) }
259 }
260
261 query opt_hir_owner_nodes(key: LocalDefId) -> Option<&'tcx hir::OwnerNodes<'tcx>> {
266 desc { |tcx| "getting HIR owner items in `{}`", tcx.def_path_str(key) }
267 feedable
268 }
269
270 query hir_attr_map(key: hir::OwnerId) -> &'tcx hir::AttributeMap<'tcx> {
275 desc { |tcx| "getting HIR owner attributes in `{}`", tcx.def_path_str(key) }
276 feedable
277 }
278
279 query opt_ast_lowering_delayed_lints(key: hir::OwnerId) -> Option<&'tcx hir::lints::DelayedLints> {
284 desc { |tcx| "getting AST lowering delayed lints in `{}`", tcx.def_path_str(key) }
285 }
286
287 query const_param_default(param: DefId) -> ty::EarlyBinder<'tcx, ty::Const<'tcx>> {
291 desc { |tcx| "computing the default for const parameter `{}`", tcx.def_path_str(param) }
292 cache_on_disk_if { param.is_local() }
293 separate_provide_extern
294 }
295
296 query const_of_item(def_id: DefId) -> ty::EarlyBinder<'tcx, ty::Const<'tcx>> {
304 desc { |tcx| "computing the type-level value for `{}`", tcx.def_path_str(def_id) }
305 cache_on_disk_if { def_id.is_local() }
306 separate_provide_extern
307 }
308
309 query type_of(key: DefId) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
328 desc { |tcx|
329 "{action} `{path}`",
330 action = match tcx.def_kind(key) {
331 DefKind::TyAlias => "expanding type alias",
332 DefKind::TraitAlias => "expanding trait alias",
333 _ => "computing type of",
334 },
335 path = tcx.def_path_str(key),
336 }
337 cache_on_disk_if { key.is_local() }
338 separate_provide_extern
339 feedable
340 }
341
342 query type_of_opaque(key: DefId) -> Result<ty::EarlyBinder<'tcx, Ty<'tcx>>, CyclePlaceholder> {
353 desc { |tcx|
354 "computing type of opaque `{path}`",
355 path = tcx.def_path_str(key),
356 }
357 cycle_stash
358 }
359 query type_of_opaque_hir_typeck(key: LocalDefId) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
360 desc { |tcx|
361 "computing type of opaque `{path}` via HIR typeck",
362 path = tcx.def_path_str(key),
363 }
364 }
365
366 query type_alias_is_lazy(key: DefId) -> bool {
380 desc { |tcx|
381 "computing whether the type alias `{path}` is lazy",
382 path = tcx.def_path_str(key),
383 }
384 separate_provide_extern
385 }
386
387 query collect_return_position_impl_trait_in_trait_tys(key: DefId)
388 -> Result<&'tcx DefIdMap<ty::EarlyBinder<'tcx, Ty<'tcx>>>, ErrorGuaranteed>
389 {
390 desc { "comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process" }
391 cache_on_disk_if { key.is_local() }
392 separate_provide_extern
393 }
394
395 query opaque_ty_origin(key: DefId) -> hir::OpaqueTyOrigin<DefId>
396 {
397 desc { "determine where the opaque originates from" }
398 separate_provide_extern
399 }
400
401 query unsizing_params_for_adt(key: DefId) -> &'tcx rustc_index::bit_set::DenseBitSet<u32>
402 {
403 arena_cache
404 desc { |tcx|
405 "determining what parameters of `{}` can participate in unsizing",
406 tcx.def_path_str(key),
407 }
408 }
409
410 query analysis(key: ()) {
412 eval_always
413 desc { |tcx|
414 "running analysis passes on crate `{}`",
415 tcx.crate_name(LOCAL_CRATE),
416 }
417 }
418
419 query check_expectations(key: Option<Symbol>) {
434 eval_always
435 desc { "checking lint expectations (RFC 2383)" }
436 }
437
438 query generics_of(key: DefId) -> &'tcx ty::Generics {
440 desc { |tcx| "computing generics of `{}`", tcx.def_path_str(key) }
441 arena_cache
442 cache_on_disk_if { key.is_local() }
443 separate_provide_extern
444 feedable
445 }
446
447 query predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
455 desc { |tcx| "computing predicates of `{}`", tcx.def_path_str(key) }
456 cache_on_disk_if { key.is_local() }
457 }
458
459 query opaque_types_defined_by(
460 key: LocalDefId
461 ) -> &'tcx ty::List<LocalDefId> {
462 desc {
463 |tcx| "computing the opaque types defined by `{}`",
464 tcx.def_path_str(key.to_def_id())
465 }
466 }
467
468 query nested_bodies_within(
471 key: LocalDefId
472 ) -> &'tcx ty::List<LocalDefId> {
473 desc {
474 |tcx| "computing the coroutines defined within `{}`",
475 tcx.def_path_str(key.to_def_id())
476 }
477 }
478
479 query explicit_item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
498 desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
499 cache_on_disk_if { key.is_local() }
500 separate_provide_extern
501 feedable
502 }
503
504 query explicit_item_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
511 desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
512 cache_on_disk_if { key.is_local() }
513 separate_provide_extern
514 feedable
515 }
516
517 query item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
541 desc { |tcx| "elaborating item bounds for `{}`", tcx.def_path_str(key) }
542 }
543
544 query item_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
545 desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
546 }
547
548 query item_non_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
549 desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
550 }
551
552 query impl_super_outlives(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
553 desc { |tcx| "elaborating supertrait outlives for trait of `{}`", tcx.def_path_str(key) }
554 }
555
556 query native_libraries(_: CrateNum) -> &'tcx Vec<NativeLib> {
561 arena_cache
562 desc { "looking up the native libraries of a linked crate" }
563 separate_provide_extern
564 }
565
566 query shallow_lint_levels_on(key: hir::OwnerId) -> &'tcx rustc_middle::lint::ShallowLintLevelMap {
567 arena_cache
568 desc { |tcx| "looking up lint levels for `{}`", tcx.def_path_str(key) }
569 }
570
571 query lint_expectations(_: ()) -> &'tcx Vec<(LintExpectationId, LintExpectation)> {
572 arena_cache
573 desc { "computing `#[expect]`ed lints in this crate" }
574 }
575
576 query lints_that_dont_need_to_run(_: ()) -> &'tcx UnordSet<LintId> {
577 arena_cache
578 desc { "Computing all lints that are explicitly enabled or with a default level greater than Allow" }
579 }
580
581 query expn_that_defined(key: DefId) -> rustc_span::ExpnId {
582 desc { |tcx| "getting the expansion that defined `{}`", tcx.def_path_str(key) }
583 separate_provide_extern
584 }
585
586 query is_panic_runtime(_: CrateNum) -> bool {
587 fatal_cycle
588 desc { "checking if the crate is_panic_runtime" }
589 separate_provide_extern
590 }
591
592 query representability(_: LocalDefId) -> rustc_middle::ty::Representability {
594 desc { "checking if `{}` is representable", tcx.def_path_str(key) }
595 cycle_delay_bug
597 anon
601 }
602
603 query representability_adt_ty(_: Ty<'tcx>) -> rustc_middle::ty::Representability {
605 desc { "checking if `{}` is representable", key }
606 cycle_delay_bug
607 anon
608 }
609
610 query params_in_repr(key: DefId) -> &'tcx rustc_index::bit_set::DenseBitSet<u32> {
612 desc { "finding type parameters in the representation" }
613 arena_cache
614 no_hash
615 separate_provide_extern
616 }
617
618 query thir_body(key: LocalDefId) -> Result<(&'tcx Steal<thir::Thir<'tcx>>, thir::ExprId), ErrorGuaranteed> {
621 no_hash
623 desc { |tcx| "building THIR for `{}`", tcx.def_path_str(key) }
624 }
625
626 query mir_keys(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexSet<LocalDefId> {
630 arena_cache
631 desc { "getting a list of all mir_keys" }
632 }
633
634 query mir_const_qualif(key: DefId) -> mir::ConstQualifs {
638 desc { |tcx| "const checking `{}`", tcx.def_path_str(key) }
639 cache_on_disk_if { key.is_local() }
640 separate_provide_extern
641 }
642
643 query mir_built(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
649 desc { |tcx| "building MIR for `{}`", tcx.def_path_str(key) }
650 feedable
651 }
652
653 query thir_abstract_const(
655 key: DefId
656 ) -> Result<Option<ty::EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed> {
657 desc {
658 |tcx| "building an abstract representation for `{}`", tcx.def_path_str(key),
659 }
660 separate_provide_extern
661 }
662
663 query mir_drops_elaborated_and_const_checked(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
664 no_hash
665 desc { |tcx| "elaborating drops for `{}`", tcx.def_path_str(key) }
666 }
667
668 query mir_for_ctfe(
669 key: DefId
670 ) -> &'tcx mir::Body<'tcx> {
671 desc { |tcx| "caching mir of `{}` for CTFE", tcx.def_path_str(key) }
672 cache_on_disk_if { key.is_local() }
673 separate_provide_extern
674 }
675
676 query mir_promoted(key: LocalDefId) -> (
677 &'tcx Steal<mir::Body<'tcx>>,
678 &'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>>
679 ) {
680 no_hash
681 desc { |tcx| "promoting constants in MIR for `{}`", tcx.def_path_str(key) }
682 }
683
684 query closure_typeinfo(key: LocalDefId) -> ty::ClosureTypeInfo<'tcx> {
685 desc {
686 |tcx| "finding symbols for captures of closure `{}`",
687 tcx.def_path_str(key)
688 }
689 }
690
691 query closure_saved_names_of_captured_variables(def_id: DefId) -> &'tcx IndexVec<abi::FieldIdx, Symbol> {
699 arena_cache
700 desc { |tcx| "computing debuginfo for closure `{}`", tcx.def_path_str(def_id) }
701 separate_provide_extern
702 }
703
704 query mir_coroutine_witnesses(key: DefId) -> Option<&'tcx mir::CoroutineLayout<'tcx>> {
705 arena_cache
706 desc { |tcx| "coroutine witness types for `{}`", tcx.def_path_str(key) }
707 cache_on_disk_if { key.is_local() }
708 separate_provide_extern
709 }
710
711 query check_coroutine_obligations(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
712 desc { |tcx| "verify auto trait bounds for coroutine interior type `{}`", tcx.def_path_str(key) }
713 return_result_from_ensure_ok
714 }
715
716 query check_potentially_region_dependent_goals(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
726 desc {
727 |tcx| "reproving potentially region dependent HIR typeck goals for `{}",
728 tcx.def_path_str(key)
729 }
730 }
731
732 query optimized_mir(key: DefId) -> &'tcx mir::Body<'tcx> {
735 desc { |tcx| "optimizing MIR for `{}`", tcx.def_path_str(key) }
736 cache_on_disk_if { key.is_local() }
737 separate_provide_extern
738 }
739
740 query coverage_attr_on(key: LocalDefId) -> bool {
746 desc { |tcx| "checking for `#[coverage(..)]` on `{}`", tcx.def_path_str(key) }
747 feedable
748 }
749
750 query coverage_ids_info(key: ty::InstanceKind<'tcx>) -> Option<&'tcx mir::coverage::CoverageIdsInfo> {
763 desc { |tcx| "retrieving coverage IDs info from MIR for `{}`", tcx.def_path_str(key.def_id()) }
764 arena_cache
765 }
766
767 query promoted_mir(key: DefId) -> &'tcx IndexVec<mir::Promoted, mir::Body<'tcx>> {
773 desc { |tcx| "optimizing promoted MIR for `{}`", tcx.def_path_str(key) }
774 cache_on_disk_if { key.is_local() }
775 separate_provide_extern
776 }
777
778 query erase_and_anonymize_regions_ty(ty: Ty<'tcx>) -> Ty<'tcx> {
782 anon
789 desc { "erasing regions from `{}`", ty }
790 }
791
792 query wasm_import_module_map(_: CrateNum) -> &'tcx DefIdMap<String> {
793 arena_cache
794 desc { "getting wasm import module map" }
795 }
796
797 query trait_explicit_predicates_and_bounds(key: LocalDefId) -> ty::GenericPredicates<'tcx> {
819 desc { |tcx| "computing explicit predicates of trait `{}`", tcx.def_path_str(key) }
820 }
821
822 query explicit_predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
828 desc { |tcx| "computing explicit predicates of `{}`", tcx.def_path_str(key) }
829 cache_on_disk_if { key.is_local() }
830 separate_provide_extern
831 feedable
832 }
833
834 query inferred_outlives_of(key: DefId) -> &'tcx [(ty::Clause<'tcx>, Span)] {
841 desc { |tcx| "computing inferred outlives-predicates of `{}`", tcx.def_path_str(key) }
842 cache_on_disk_if { key.is_local() }
843 separate_provide_extern
844 feedable
845 }
846
847 query explicit_super_predicates_of(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
855 desc { |tcx| "computing the super predicates of `{}`", tcx.def_path_str(key) }
856 cache_on_disk_if { key.is_local() }
857 separate_provide_extern
858 }
859
860 query explicit_implied_predicates_of(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
867 desc { |tcx| "computing the implied predicates of `{}`", tcx.def_path_str(key) }
868 cache_on_disk_if { key.is_local() }
869 separate_provide_extern
870 }
871
872 query explicit_supertraits_containing_assoc_item(
876 key: (DefId, rustc_span::Ident)
877 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
878 desc { |tcx| "computing the super traits of `{}` with associated type name `{}`",
879 tcx.def_path_str(key.0),
880 key.1
881 }
882 }
883
884 query const_conditions(
894 key: DefId
895 ) -> ty::ConstConditions<'tcx> {
896 desc { |tcx| "computing the conditions for `{}` to be considered const",
897 tcx.def_path_str(key)
898 }
899 separate_provide_extern
900 }
901
902 query explicit_implied_const_bounds(
908 key: DefId
909 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::PolyTraitRef<'tcx>, Span)]> {
910 desc { |tcx| "computing the implied `[const]` bounds for `{}`",
911 tcx.def_path_str(key)
912 }
913 separate_provide_extern
914 }
915
916 query type_param_predicates(
919 key: (LocalDefId, LocalDefId, rustc_span::Ident)
920 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
921 desc { |tcx| "computing the bounds for type parameter `{}`", tcx.hir_ty_param_name(key.1) }
922 }
923
924 query trait_def(key: DefId) -> &'tcx ty::TraitDef {
925 desc { |tcx| "computing trait definition for `{}`", tcx.def_path_str(key) }
926 arena_cache
927 cache_on_disk_if { key.is_local() }
928 separate_provide_extern
929 }
930 query adt_def(key: DefId) -> ty::AdtDef<'tcx> {
931 desc { |tcx| "computing ADT definition for `{}`", tcx.def_path_str(key) }
932 cache_on_disk_if { key.is_local() }
933 separate_provide_extern
934 }
935 query adt_destructor(key: DefId) -> Option<ty::Destructor> {
936 desc { |tcx| "computing `Drop` impl for `{}`", tcx.def_path_str(key) }
937 cache_on_disk_if { key.is_local() }
938 separate_provide_extern
939 }
940 query adt_async_destructor(key: DefId) -> Option<ty::AsyncDestructor> {
941 desc { |tcx| "computing `AsyncDrop` impl for `{}`", tcx.def_path_str(key) }
942 cache_on_disk_if { key.is_local() }
943 separate_provide_extern
944 }
945 query adt_sizedness_constraint(
946 key: (DefId, SizedTraitKind)
947 ) -> Option<ty::EarlyBinder<'tcx, Ty<'tcx>>> {
948 desc { |tcx| "computing the sizedness constraint for `{}`", tcx.def_path_str(key.0) }
949 }
950
951 query adt_dtorck_constraint(
952 key: DefId
953 ) -> &'tcx DropckConstraint<'tcx> {
954 desc { |tcx| "computing drop-check constraints for `{}`", tcx.def_path_str(key) }
955 }
956
957 query constness(key: DefId) -> hir::Constness {
979 desc { |tcx| "checking if item is const: `{}`", tcx.def_path_str(key) }
980 separate_provide_extern
981 feedable
982 }
983
984 query asyncness(key: DefId) -> ty::Asyncness {
985 desc { |tcx| "checking if the function is async: `{}`", tcx.def_path_str(key) }
986 separate_provide_extern
987 }
988
989 query is_promotable_const_fn(key: DefId) -> bool {
997 desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) }
998 }
999
1000 query coroutine_by_move_body_def_id(def_id: DefId) -> DefId {
1007 desc { |tcx| "looking up the coroutine by-move body for `{}`", tcx.def_path_str(def_id) }
1008 separate_provide_extern
1009 }
1010
1011 query coroutine_kind(def_id: DefId) -> Option<hir::CoroutineKind> {
1013 desc { |tcx| "looking up coroutine kind of `{}`", tcx.def_path_str(def_id) }
1014 separate_provide_extern
1015 feedable
1016 }
1017
1018 query coroutine_for_closure(def_id: DefId) -> DefId {
1019 desc { |_tcx| "Given a coroutine-closure def id, return the def id of the coroutine returned by it" }
1020 separate_provide_extern
1021 }
1022
1023 query coroutine_hidden_types(
1024 def_id: DefId,
1025 ) -> ty::EarlyBinder<'tcx, ty::Binder<'tcx, ty::CoroutineWitnessTypes<TyCtxt<'tcx>>>> {
1026 desc { "looking up the hidden types stored across await points in a coroutine" }
1027 }
1028
1029 query crate_variances(_: ()) -> &'tcx ty::CrateVariancesMap<'tcx> {
1037 arena_cache
1038 desc { "computing the variances for items in this crate" }
1039 }
1040
1041 query variances_of(def_id: DefId) -> &'tcx [ty::Variance] {
1049 desc { |tcx| "computing the variances of `{}`", tcx.def_path_str(def_id) }
1050 cache_on_disk_if { def_id.is_local() }
1051 separate_provide_extern
1052 cycle_delay_bug
1053 }
1054
1055 query inferred_outlives_crate(_: ()) -> &'tcx ty::CratePredicatesMap<'tcx> {
1063 arena_cache
1064 desc { "computing the inferred outlives-predicates for items in this crate" }
1065 }
1066
1067 query associated_item_def_ids(key: DefId) -> &'tcx [DefId] {
1070 desc { |tcx| "collecting associated items or fields of `{}`", tcx.def_path_str(key) }
1071 cache_on_disk_if { key.is_local() }
1072 separate_provide_extern
1073 }
1074
1075 query associated_item(key: DefId) -> ty::AssocItem {
1077 desc { |tcx| "computing associated item data for `{}`", tcx.def_path_str(key) }
1078 cache_on_disk_if { key.is_local() }
1079 separate_provide_extern
1080 feedable
1081 }
1082
1083 query associated_items(key: DefId) -> &'tcx ty::AssocItems {
1085 arena_cache
1086 desc { |tcx| "collecting associated items of `{}`", tcx.def_path_str(key) }
1087 }
1088
1089 query impl_item_implementor_ids(impl_id: DefId) -> &'tcx DefIdMap<DefId> {
1111 arena_cache
1112 desc { |tcx| "comparing impl items against trait for `{}`", tcx.def_path_str(impl_id) }
1113 }
1114
1115 query associated_types_for_impl_traits_in_trait_or_impl(item_def_id: DefId) -> &'tcx DefIdMap<Vec<DefId>> {
1118 arena_cache
1119 desc { |tcx| "synthesizing RPITIT items for the opaque types for methods in `{}`", tcx.def_path_str(item_def_id) }
1120 separate_provide_extern
1121 }
1122
1123 query impl_trait_header(impl_id: DefId) -> ty::ImplTraitHeader<'tcx> {
1125 desc { |tcx| "computing trait implemented by `{}`", tcx.def_path_str(impl_id) }
1126 cache_on_disk_if { impl_id.is_local() }
1127 separate_provide_extern
1128 }
1129
1130 query impl_self_is_guaranteed_unsized(impl_def_id: DefId) -> bool {
1134 desc { |tcx| "computing whether `{}` has a guaranteed unsized self type", tcx.def_path_str(impl_def_id) }
1135 }
1136
1137 query inherent_impls(key: DefId) -> &'tcx [DefId] {
1141 desc { |tcx| "collecting inherent impls for `{}`", tcx.def_path_str(key) }
1142 cache_on_disk_if { key.is_local() }
1143 separate_provide_extern
1144 }
1145
1146 query incoherent_impls(key: SimplifiedType) -> &'tcx [DefId] {
1147 desc { |tcx| "collecting all inherent impls for `{:?}`", key }
1148 }
1149
1150 query check_transmutes(key: LocalDefId) {
1152 desc { |tcx| "check transmute calls inside `{}`", tcx.def_path_str(key) }
1153 }
1154
1155 query check_unsafety(key: LocalDefId) {
1157 desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key) }
1158 }
1159
1160 query check_tail_calls(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
1162 desc { |tcx| "tail-call-checking `{}`", tcx.def_path_str(key) }
1163 return_result_from_ensure_ok
1164 }
1165
1166 query assumed_wf_types(key: LocalDefId) -> &'tcx [(Ty<'tcx>, Span)] {
1171 desc { |tcx| "computing the implied bounds of `{}`", tcx.def_path_str(key) }
1172 }
1173
1174 query assumed_wf_types_for_rpitit(key: DefId) -> &'tcx [(Ty<'tcx>, Span)] {
1177 desc { |tcx| "computing the implied bounds of `{}`", tcx.def_path_str(key) }
1178 separate_provide_extern
1179 }
1180
1181 query fn_sig(key: DefId) -> ty::EarlyBinder<'tcx, ty::PolyFnSig<'tcx>> {
1183 desc { |tcx| "computing function signature of `{}`", tcx.def_path_str(key) }
1184 cache_on_disk_if { key.is_local() }
1185 separate_provide_extern
1186 cycle_delay_bug
1187 }
1188
1189 query lint_mod(key: LocalModDefId) {
1191 desc { |tcx| "linting {}", describe_as_module(key, tcx) }
1192 }
1193
1194 query check_unused_traits(_: ()) {
1195 desc { "checking unused trait imports in crate" }
1196 }
1197
1198 query check_mod_attrs(key: LocalModDefId) {
1200 desc { |tcx| "checking attributes in {}", describe_as_module(key, tcx) }
1201 }
1202
1203 query check_mod_unstable_api_usage(key: LocalModDefId) {
1205 desc { |tcx| "checking for unstable API usage in {}", describe_as_module(key, tcx) }
1206 }
1207
1208 query check_mod_privacy(key: LocalModDefId) {
1209 desc { |tcx| "checking privacy in {}", describe_as_module(key.to_local_def_id(), tcx) }
1210 }
1211
1212 query check_liveness(key: LocalDefId) -> &'tcx rustc_index::bit_set::DenseBitSet<abi::FieldIdx> {
1213 arena_cache
1214 desc { |tcx| "checking liveness of variables in `{}`", tcx.def_path_str(key.to_def_id()) }
1215 cache_on_disk_if(tcx) { tcx.is_typeck_child(key.to_def_id()) }
1216 }
1217
1218 query live_symbols_and_ignored_derived_traits(_: ()) -> &'tcx Result<(
1222 LocalDefIdSet,
1223 LocalDefIdMap<FxIndexSet<DefId>>,
1224 ), ErrorGuaranteed> {
1225 arena_cache
1226 desc { "finding live symbols in crate" }
1227 }
1228
1229 query check_mod_deathness(key: LocalModDefId) {
1230 desc { |tcx| "checking deathness of variables in {}", describe_as_module(key, tcx) }
1231 }
1232
1233 query check_type_wf(key: ()) -> Result<(), ErrorGuaranteed> {
1234 desc { "checking that types are well-formed" }
1235 return_result_from_ensure_ok
1236 }
1237
1238 query coerce_unsized_info(key: DefId) -> Result<ty::adjustment::CoerceUnsizedInfo, ErrorGuaranteed> {
1240 desc { |tcx| "computing CoerceUnsized info for `{}`", tcx.def_path_str(key) }
1241 cache_on_disk_if { key.is_local() }
1242 separate_provide_extern
1243 return_result_from_ensure_ok
1244 }
1245
1246 query typeck(key: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> {
1247 desc { |tcx| "type-checking `{}`", tcx.def_path_str(key) }
1248 cache_on_disk_if(tcx) { !tcx.is_typeck_child(key.to_def_id()) }
1249 }
1250
1251 query used_trait_imports(key: LocalDefId) -> &'tcx UnordSet<LocalDefId> {
1252 desc { |tcx| "finding used_trait_imports `{}`", tcx.def_path_str(key) }
1253 cache_on_disk_if { true }
1254 }
1255
1256 query coherent_trait(def_id: DefId) -> Result<(), ErrorGuaranteed> {
1257 desc { |tcx| "coherence checking all impls of trait `{}`", tcx.def_path_str(def_id) }
1258 return_result_from_ensure_ok
1259 }
1260
1261 query mir_borrowck(key: LocalDefId) -> Result<
1264 &'tcx FxIndexMap<LocalDefId, ty::DefinitionSiteHiddenType<'tcx>>,
1265 ErrorGuaranteed
1266 > {
1267 desc { |tcx| "borrow-checking `{}`", tcx.def_path_str(key) }
1268 }
1269
1270 query crate_inherent_impls(k: ()) -> (&'tcx CrateInherentImpls, Result<(), ErrorGuaranteed>) {
1278 desc { "finding all inherent impls defined in crate" }
1279 }
1280
1281 query crate_inherent_impls_validity_check(_: ()) -> Result<(), ErrorGuaranteed> {
1289 desc { "check for inherent impls that should not be defined in crate" }
1290 return_result_from_ensure_ok
1291 }
1292
1293 query crate_inherent_impls_overlap_check(_: ()) -> Result<(), ErrorGuaranteed> {
1301 desc { "check for overlap between inherent impls defined in this crate" }
1302 return_result_from_ensure_ok
1303 }
1304
1305 query orphan_check_impl(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1308 desc { |tcx|
1309 "checking whether impl `{}` follows the orphan rules",
1310 tcx.def_path_str(key),
1311 }
1312 return_result_from_ensure_ok
1313 }
1314
1315 query mir_callgraph_cyclic(key: LocalDefId) -> &'tcx UnordSet<LocalDefId> {
1317 fatal_cycle
1318 arena_cache
1319 desc { |tcx|
1320 "computing (transitive) callees of `{}` that may recurse",
1321 tcx.def_path_str(key),
1322 }
1323 cache_on_disk_if { true }
1324 }
1325
1326 query mir_inliner_callees(key: ty::InstanceKind<'tcx>) -> &'tcx [(DefId, GenericArgsRef<'tcx>)] {
1328 fatal_cycle
1329 desc { |tcx|
1330 "computing all local function calls in `{}`",
1331 tcx.def_path_str(key.def_id()),
1332 }
1333 }
1334
1335 query tag_for_variant(
1343 key: PseudoCanonicalInput<'tcx, (Ty<'tcx>, abi::VariantIdx)>,
1344 ) -> Option<ty::ScalarInt> {
1345 desc { "computing variant tag for enum" }
1346 }
1347
1348 query eval_to_allocation_raw(key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>)
1357 -> EvalToAllocationRawResult<'tcx> {
1358 desc { |tcx|
1359 "const-evaluating + checking `{}`",
1360 key.value.display(tcx)
1361 }
1362 cache_on_disk_if { true }
1363 }
1364
1365 query eval_static_initializer(key: DefId) -> EvalStaticInitializerRawResult<'tcx> {
1367 desc { |tcx|
1368 "evaluating initializer of static `{}`",
1369 tcx.def_path_str(key)
1370 }
1371 cache_on_disk_if { key.is_local() }
1372 separate_provide_extern
1373 feedable
1374 }
1375
1376 query eval_to_const_value_raw(key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>)
1389 -> EvalToConstValueResult<'tcx> {
1390 desc { |tcx|
1391 "simplifying constant for the type system `{}`",
1392 key.value.display(tcx)
1393 }
1394 depth_limit
1395 cache_on_disk_if { true }
1396 }
1397
1398 query eval_to_valtree(
1401 key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>
1402 ) -> EvalToValTreeResult<'tcx> {
1403 desc { "evaluating type-level constant" }
1404 }
1405
1406 query valtree_to_const_val(key: ty::Value<'tcx>) -> mir::ConstValue {
1408 desc { "converting type-level constant value to MIR constant value"}
1409 }
1410
1411 query destructure_const(key: ty::Const<'tcx>) -> ty::DestructuredConst<'tcx> {
1414 desc { "destructuring type level constant"}
1415 }
1416
1417 query lit_to_const(
1419 key: LitToConstInput<'tcx>
1420 ) -> ty::Const<'tcx> {
1421 desc { "converting literal to const" }
1422 }
1423
1424 query check_match(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
1425 desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) }
1426 return_result_from_ensure_ok
1427 }
1428
1429 query effective_visibilities(_: ()) -> &'tcx EffectiveVisibilities {
1431 eval_always
1432 desc { "checking effective visibilities" }
1433 }
1434 query check_private_in_public(module_def_id: LocalModDefId) {
1435 desc { |tcx|
1436 "checking for private elements in public interfaces for {}",
1437 describe_as_module(module_def_id, tcx)
1438 }
1439 }
1440
1441 query reachable_set(_: ()) -> &'tcx LocalDefIdSet {
1442 arena_cache
1443 desc { "reachability" }
1444 cache_on_disk_if { true }
1445 }
1446
1447 query region_scope_tree(def_id: DefId) -> &'tcx crate::middle::region::ScopeTree {
1450 desc { |tcx| "computing drop scopes for `{}`", tcx.def_path_str(def_id) }
1451 }
1452
1453 query mir_shims(key: ty::InstanceKind<'tcx>) -> &'tcx mir::Body<'tcx> {
1455 arena_cache
1456 desc {
1457 |tcx| "generating MIR shim for `{}`, instance={:?}",
1458 tcx.def_path_str(key.def_id()),
1459 key
1460 }
1461 }
1462
1463 query symbol_name(key: ty::Instance<'tcx>) -> ty::SymbolName<'tcx> {
1467 desc { "computing the symbol for `{}`", key }
1468 cache_on_disk_if { true }
1469 }
1470
1471 query def_kind(def_id: DefId) -> DefKind {
1472 desc { |tcx| "looking up definition kind of `{}`", tcx.def_path_str(def_id) }
1473 cache_on_disk_if { def_id.is_local() }
1474 separate_provide_extern
1475 feedable
1476 }
1477
1478 query def_span(def_id: DefId) -> Span {
1480 desc { |tcx| "looking up span for `{}`", tcx.def_path_str(def_id) }
1481 cache_on_disk_if { def_id.is_local() }
1482 separate_provide_extern
1483 feedable
1484 }
1485
1486 query def_ident_span(def_id: DefId) -> Option<Span> {
1488 desc { |tcx| "looking up span for `{}`'s identifier", tcx.def_path_str(def_id) }
1489 cache_on_disk_if { def_id.is_local() }
1490 separate_provide_extern
1491 feedable
1492 }
1493
1494 query ty_span(def_id: LocalDefId) -> Span {
1497 desc { |tcx| "looking up span for `{}`'s type", tcx.def_path_str(def_id) }
1498 cache_on_disk_if { true }
1499 }
1500
1501 query lookup_stability(def_id: DefId) -> Option<hir::Stability> {
1502 desc { |tcx| "looking up stability of `{}`", tcx.def_path_str(def_id) }
1503 cache_on_disk_if { def_id.is_local() }
1504 separate_provide_extern
1505 }
1506
1507 query lookup_const_stability(def_id: DefId) -> Option<hir::ConstStability> {
1508 desc { |tcx| "looking up const stability of `{}`", tcx.def_path_str(def_id) }
1509 cache_on_disk_if { def_id.is_local() }
1510 separate_provide_extern
1511 }
1512
1513 query lookup_default_body_stability(def_id: DefId) -> Option<hir::DefaultBodyStability> {
1514 desc { |tcx| "looking up default body stability of `{}`", tcx.def_path_str(def_id) }
1515 separate_provide_extern
1516 }
1517
1518 query should_inherit_track_caller(def_id: DefId) -> bool {
1519 desc { |tcx| "computing should_inherit_track_caller of `{}`", tcx.def_path_str(def_id) }
1520 }
1521
1522 query inherited_align(def_id: DefId) -> Option<Align> {
1523 desc { |tcx| "computing inherited_align of `{}`", tcx.def_path_str(def_id) }
1524 }
1525
1526 query lookup_deprecation_entry(def_id: DefId) -> Option<DeprecationEntry> {
1527 desc { |tcx| "checking whether `{}` is deprecated", tcx.def_path_str(def_id) }
1528 cache_on_disk_if { def_id.is_local() }
1529 separate_provide_extern
1530 }
1531
1532 query is_doc_hidden(def_id: DefId) -> bool {
1534 desc { |tcx| "checking whether `{}` is `doc(hidden)`", tcx.def_path_str(def_id) }
1535 separate_provide_extern
1536 }
1537
1538 query is_doc_notable_trait(def_id: DefId) -> bool {
1540 desc { |tcx| "checking whether `{}` is `doc(notable_trait)`", tcx.def_path_str(def_id) }
1541 }
1542
1543 query attrs_for_def(def_id: DefId) -> &'tcx [hir::Attribute] {
1547 desc { |tcx| "collecting attributes of `{}`", tcx.def_path_str(def_id) }
1548 separate_provide_extern
1549 }
1550
1551 query codegen_fn_attrs(def_id: DefId) -> &'tcx CodegenFnAttrs {
1561 desc { |tcx| "computing codegen attributes of `{}`", tcx.def_path_str(def_id) }
1562 arena_cache
1563 cache_on_disk_if { def_id.is_local() }
1564 separate_provide_extern
1565 feedable
1566 }
1567
1568 query asm_target_features(def_id: DefId) -> &'tcx FxIndexSet<Symbol> {
1569 desc { |tcx| "computing target features for inline asm of `{}`", tcx.def_path_str(def_id) }
1570 }
1571
1572 query fn_arg_idents(def_id: DefId) -> &'tcx [Option<rustc_span::Ident>] {
1573 desc { |tcx| "looking up function parameter identifiers for `{}`", tcx.def_path_str(def_id) }
1574 separate_provide_extern
1575 }
1576
1577 query rendered_const(def_id: DefId) -> &'tcx String {
1580 arena_cache
1581 desc { |tcx| "rendering constant initializer of `{}`", tcx.def_path_str(def_id) }
1582 separate_provide_extern
1583 }
1584
1585 query rendered_precise_capturing_args(def_id: DefId) -> Option<&'tcx [PreciseCapturingArgKind<Symbol, Symbol>]> {
1587 desc { |tcx| "rendering precise capturing args for `{}`", tcx.def_path_str(def_id) }
1588 separate_provide_extern
1589 }
1590
1591 query impl_parent(def_id: DefId) -> Option<DefId> {
1592 desc { |tcx| "computing specialization parent impl of `{}`", tcx.def_path_str(def_id) }
1593 separate_provide_extern
1594 }
1595
1596 query is_ctfe_mir_available(key: DefId) -> bool {
1597 desc { |tcx| "checking if item has CTFE MIR available: `{}`", tcx.def_path_str(key) }
1598 cache_on_disk_if { key.is_local() }
1599 separate_provide_extern
1600 }
1601 query is_mir_available(key: DefId) -> bool {
1602 desc { |tcx| "checking if item has MIR available: `{}`", tcx.def_path_str(key) }
1603 cache_on_disk_if { key.is_local() }
1604 separate_provide_extern
1605 }
1606
1607 query own_existential_vtable_entries(
1608 key: DefId
1609 ) -> &'tcx [DefId] {
1610 desc { |tcx| "finding all existential vtable entries for trait `{}`", tcx.def_path_str(key) }
1611 }
1612
1613 query vtable_entries(key: ty::TraitRef<'tcx>)
1614 -> &'tcx [ty::VtblEntry<'tcx>] {
1615 desc { |tcx| "finding all vtable entries for trait `{}`", tcx.def_path_str(key.def_id) }
1616 }
1617
1618 query first_method_vtable_slot(key: ty::TraitRef<'tcx>) -> usize {
1619 desc { |tcx| "finding the slot within the vtable of `{}` for the implementation of `{}`", key.self_ty(), key.print_only_trait_name() }
1620 }
1621
1622 query supertrait_vtable_slot(key: (Ty<'tcx>, Ty<'tcx>)) -> Option<usize> {
1623 desc { |tcx| "finding the slot within vtable for trait object `{}` vtable ptr during trait upcasting coercion from `{}` vtable",
1624 key.1, key.0 }
1625 }
1626
1627 query vtable_allocation(key: (Ty<'tcx>, Option<ty::ExistentialTraitRef<'tcx>>)) -> mir::interpret::AllocId {
1628 desc { |tcx| "vtable const allocation for <{} as {}>",
1629 key.0,
1630 key.1.map(|trait_ref| format!("{trait_ref}")).unwrap_or_else(|| "_".to_owned())
1631 }
1632 }
1633
1634 query codegen_select_candidate(
1635 key: PseudoCanonicalInput<'tcx, ty::TraitRef<'tcx>>
1636 ) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
1637 cache_on_disk_if { true }
1638 desc { |tcx| "computing candidate for `{}`", key.value }
1639 }
1640
1641 query all_local_trait_impls(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexMap<DefId, Vec<LocalDefId>> {
1643 desc { "finding local trait impls" }
1644 }
1645
1646 query local_trait_impls(trait_id: DefId) -> &'tcx [LocalDefId] {
1648 desc { "finding local trait impls of `{}`", tcx.def_path_str(trait_id) }
1649 }
1650
1651 query trait_impls_of(trait_id: DefId) -> &'tcx ty::trait_def::TraitImpls {
1653 arena_cache
1654 desc { |tcx| "finding trait impls of `{}`", tcx.def_path_str(trait_id) }
1655 }
1656
1657 query specialization_graph_of(trait_id: DefId) -> Result<&'tcx specialization_graph::Graph, ErrorGuaranteed> {
1658 desc { |tcx| "building specialization graph of trait `{}`", tcx.def_path_str(trait_id) }
1659 cache_on_disk_if { true }
1660 return_result_from_ensure_ok
1661 }
1662 query dyn_compatibility_violations(trait_id: DefId) -> &'tcx [DynCompatibilityViolation] {
1663 desc { |tcx| "determining dyn-compatibility of trait `{}`", tcx.def_path_str(trait_id) }
1664 }
1665 query is_dyn_compatible(trait_id: DefId) -> bool {
1666 desc { |tcx| "checking if trait `{}` is dyn-compatible", tcx.def_path_str(trait_id) }
1667 }
1668
1669 query param_env(def_id: DefId) -> ty::ParamEnv<'tcx> {
1678 desc { |tcx| "computing normalized predicates of `{}`", tcx.def_path_str(def_id) }
1679 feedable
1680 }
1681
1682 query typing_env_normalized_for_post_analysis(def_id: DefId) -> ty::TypingEnv<'tcx> {
1686 desc { |tcx| "computing revealed normalized predicates of `{}`", tcx.def_path_str(def_id) }
1687 }
1688
1689 query is_copy_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1692 desc { "computing whether `{}` is `Copy`", env.value }
1693 }
1694 query is_use_cloned_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1697 desc { "computing whether `{}` is `UseCloned`", env.value }
1698 }
1699 query is_sized_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1701 desc { "computing whether `{}` is `Sized`", env.value }
1702 }
1703 query is_freeze_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1705 desc { "computing whether `{}` is freeze", env.value }
1706 }
1707 query is_unpin_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1709 desc { "computing whether `{}` is `Unpin`", env.value }
1710 }
1711 query is_async_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1713 desc { "computing whether `{}` is `AsyncDrop`", env.value }
1714 }
1715 query needs_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1717 desc { "computing whether `{}` needs drop", env.value }
1718 }
1719 query needs_async_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1721 desc { "computing whether `{}` needs async drop", env.value }
1722 }
1723 query has_significant_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1725 desc { "computing whether `{}` has a significant drop", env.value }
1726 }
1727
1728 query has_structural_eq_impl(ty: Ty<'tcx>) -> bool {
1733 desc {
1734 "computing whether `{}` implements `StructuralPartialEq`",
1735 ty
1736 }
1737 }
1738
1739 query adt_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1743 desc { |tcx| "computing when `{}` needs drop", tcx.def_path_str(def_id) }
1744 cache_on_disk_if { true }
1745 }
1746
1747 query adt_async_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1751 desc { |tcx| "computing when `{}` needs async drop", tcx.def_path_str(def_id) }
1752 cache_on_disk_if { true }
1753 }
1754
1755 query adt_significant_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1762 desc { |tcx| "computing when `{}` has a significant destructor", tcx.def_path_str(def_id) }
1763 }
1764
1765 query list_significant_drop_tys(ty: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> &'tcx ty::List<Ty<'tcx>> {
1783 desc { |tcx| "computing when `{}` has a significant destructor", ty.value }
1784 }
1785
1786 query layout_of(
1789 key: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>
1790 ) -> Result<ty::layout::TyAndLayout<'tcx>, &'tcx ty::layout::LayoutError<'tcx>> {
1791 depth_limit
1792 desc { "computing layout of `{}`", key.value }
1793 cycle_delay_bug
1795 }
1796
1797 query fn_abi_of_fn_ptr(
1802 key: ty::PseudoCanonicalInput<'tcx, (ty::PolyFnSig<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
1803 ) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
1804 desc { "computing call ABI of `{}` function pointers", key.value.0 }
1805 }
1806
1807 query fn_abi_of_instance(
1813 key: ty::PseudoCanonicalInput<'tcx, (ty::Instance<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
1814 ) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
1815 desc { "computing call ABI of `{}`", key.value.0 }
1816 }
1817
1818 query dylib_dependency_formats(_: CrateNum)
1819 -> &'tcx [(CrateNum, LinkagePreference)] {
1820 desc { "getting dylib dependency formats of crate" }
1821 separate_provide_extern
1822 }
1823
1824 query dependency_formats(_: ()) -> &'tcx Arc<crate::middle::dependency_format::Dependencies> {
1825 arena_cache
1826 desc { "getting the linkage format of all dependencies" }
1827 }
1828
1829 query is_compiler_builtins(_: CrateNum) -> bool {
1830 fatal_cycle
1831 desc { "checking if the crate is_compiler_builtins" }
1832 separate_provide_extern
1833 }
1834 query has_global_allocator(_: CrateNum) -> bool {
1835 eval_always
1837 fatal_cycle
1838 desc { "checking if the crate has_global_allocator" }
1839 separate_provide_extern
1840 }
1841 query has_alloc_error_handler(_: CrateNum) -> bool {
1842 eval_always
1844 fatal_cycle
1845 desc { "checking if the crate has_alloc_error_handler" }
1846 separate_provide_extern
1847 }
1848 query has_panic_handler(_: CrateNum) -> bool {
1849 fatal_cycle
1850 desc { "checking if the crate has_panic_handler" }
1851 separate_provide_extern
1852 }
1853 query is_profiler_runtime(_: CrateNum) -> bool {
1854 fatal_cycle
1855 desc { "checking if a crate is `#![profiler_runtime]`" }
1856 separate_provide_extern
1857 }
1858 query has_ffi_unwind_calls(key: LocalDefId) -> bool {
1859 desc { |tcx| "checking if `{}` contains FFI-unwind calls", tcx.def_path_str(key) }
1860 cache_on_disk_if { true }
1861 }
1862 query required_panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
1863 fatal_cycle
1864 desc { "getting a crate's required panic strategy" }
1865 separate_provide_extern
1866 }
1867 query panic_in_drop_strategy(_: CrateNum) -> PanicStrategy {
1868 fatal_cycle
1869 desc { "getting a crate's configured panic-in-drop strategy" }
1870 separate_provide_extern
1871 }
1872 query is_no_builtins(_: CrateNum) -> bool {
1873 fatal_cycle
1874 desc { "getting whether a crate has `#![no_builtins]`" }
1875 separate_provide_extern
1876 }
1877 query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
1878 fatal_cycle
1879 desc { "getting a crate's symbol mangling version" }
1880 separate_provide_extern
1881 }
1882
1883 query extern_crate(def_id: CrateNum) -> Option<&'tcx ExternCrate> {
1884 eval_always
1885 desc { "getting crate's ExternCrateData" }
1886 separate_provide_extern
1887 }
1888
1889 query specialization_enabled_in(cnum: CrateNum) -> bool {
1890 desc { "checking whether the crate enabled `specialization`/`min_specialization`" }
1891 separate_provide_extern
1892 }
1893
1894 query specializes(_: (DefId, DefId)) -> bool {
1895 desc { "computing whether impls specialize one another" }
1896 }
1897 query in_scope_traits_map(_: hir::OwnerId)
1898 -> Option<&'tcx ItemLocalMap<Box<[TraitCandidate]>>> {
1899 desc { "getting traits in scope at a block" }
1900 }
1901
1902 query defaultness(def_id: DefId) -> hir::Defaultness {
1905 desc { |tcx| "looking up whether `{}` has `default`", tcx.def_path_str(def_id) }
1906 separate_provide_extern
1907 feedable
1908 }
1909
1910 query default_field(def_id: DefId) -> Option<DefId> {
1912 desc { |tcx| "looking up the `const` corresponding to the default for `{}`", tcx.def_path_str(def_id) }
1913 separate_provide_extern
1914 }
1915
1916 query check_well_formed(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1917 desc { |tcx| "checking that `{}` is well-formed", tcx.def_path_str(key) }
1918 return_result_from_ensure_ok
1919 }
1920
1921 query enforce_impl_non_lifetime_params_are_constrained(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1922 desc { |tcx| "checking that `{}`'s generics are constrained by the impl header", tcx.def_path_str(key) }
1923 return_result_from_ensure_ok
1924 }
1925
1926 query reachable_non_generics(_: CrateNum)
1939 -> &'tcx DefIdMap<SymbolExportInfo> {
1940 arena_cache
1941 desc { "looking up the exported symbols of a crate" }
1942 separate_provide_extern
1943 }
1944 query is_reachable_non_generic(def_id: DefId) -> bool {
1945 desc { |tcx| "checking whether `{}` is an exported symbol", tcx.def_path_str(def_id) }
1946 cache_on_disk_if { def_id.is_local() }
1947 separate_provide_extern
1948 }
1949 query is_unreachable_local_definition(def_id: LocalDefId) -> bool {
1950 desc { |tcx|
1951 "checking whether `{}` is reachable from outside the crate",
1952 tcx.def_path_str(def_id),
1953 }
1954 }
1955
1956 query upstream_monomorphizations(_: ()) -> &'tcx DefIdMap<UnordMap<GenericArgsRef<'tcx>, CrateNum>> {
1964 arena_cache
1965 desc { "collecting available upstream monomorphizations" }
1966 }
1967
1968 query upstream_monomorphizations_for(def_id: DefId)
1976 -> Option<&'tcx UnordMap<GenericArgsRef<'tcx>, CrateNum>>
1977 {
1978 desc { |tcx|
1979 "collecting available upstream monomorphizations for `{}`",
1980 tcx.def_path_str(def_id),
1981 }
1982 separate_provide_extern
1983 }
1984
1985 query upstream_drop_glue_for(args: GenericArgsRef<'tcx>) -> Option<CrateNum> {
2001 desc { "available upstream drop-glue for `{:?}`", args }
2002 }
2003
2004 query upstream_async_drop_glue_for(args: GenericArgsRef<'tcx>) -> Option<CrateNum> {
2021 desc { "available upstream async-drop-glue for `{:?}`", args }
2022 }
2023
2024 query foreign_modules(_: CrateNum) -> &'tcx FxIndexMap<DefId, ForeignModule> {
2026 arena_cache
2027 desc { "looking up the foreign modules of a linked crate" }
2028 separate_provide_extern
2029 }
2030
2031 query clashing_extern_declarations(_: ()) {
2033 desc { "checking `extern fn` declarations are compatible" }
2034 }
2035
2036 query entry_fn(_: ()) -> Option<(DefId, EntryFnType)> {
2039 desc { "looking up the entry function of a crate" }
2040 }
2041
2042 query proc_macro_decls_static(_: ()) -> Option<LocalDefId> {
2044 desc { "looking up the proc macro declarations for a crate" }
2045 }
2046
2047 query crate_hash(_: CrateNum) -> Svh {
2055 eval_always
2056 desc { "looking up the hash a crate" }
2057 separate_provide_extern
2058 }
2059
2060 query crate_host_hash(_: CrateNum) -> Option<Svh> {
2062 eval_always
2063 desc { "looking up the hash of a host version of a crate" }
2064 separate_provide_extern
2065 }
2066
2067 query extra_filename(_: CrateNum) -> &'tcx String {
2070 arena_cache
2071 eval_always
2072 desc { "looking up the extra filename for a crate" }
2073 separate_provide_extern
2074 }
2075
2076 query crate_extern_paths(_: CrateNum) -> &'tcx Vec<PathBuf> {
2078 arena_cache
2079 eval_always
2080 desc { "looking up the paths for extern crates" }
2081 separate_provide_extern
2082 }
2083
2084 query implementations_of_trait(_: (CrateNum, DefId)) -> &'tcx [(DefId, Option<SimplifiedType>)] {
2087 desc { "looking up implementations of a trait in a crate" }
2088 separate_provide_extern
2089 }
2090
2091 query crate_incoherent_impls(key: (CrateNum, SimplifiedType)) -> &'tcx [DefId] {
2096 desc { |tcx| "collecting all impls for a type in a crate" }
2097 separate_provide_extern
2098 }
2099
2100 query native_library(def_id: DefId) -> Option<&'tcx NativeLib> {
2102 desc { |tcx| "getting the native library for `{}`", tcx.def_path_str(def_id) }
2103 }
2104
2105 query inherit_sig_for_delegation_item(def_id: LocalDefId) -> &'tcx [Ty<'tcx>] {
2106 desc { "inheriting delegation signature" }
2107 }
2108
2109 query resolve_bound_vars(owner_id: hir::OwnerId) -> &'tcx ResolveBoundVars {
2113 arena_cache
2114 desc { |tcx| "resolving lifetimes for `{}`", tcx.def_path_str(owner_id) }
2115 }
2116 query named_variable_map(owner_id: hir::OwnerId) -> &'tcx SortedMap<ItemLocalId, ResolvedArg> {
2117 desc { |tcx| "looking up a named region inside `{}`", tcx.def_path_str(owner_id) }
2118 }
2119 query is_late_bound_map(owner_id: hir::OwnerId) -> Option<&'tcx FxIndexSet<ItemLocalId>> {
2120 desc { |tcx| "testing if a region is late bound inside `{}`", tcx.def_path_str(owner_id) }
2121 }
2122 query object_lifetime_default(def_id: DefId) -> ObjectLifetimeDefault {
2137 desc { "looking up lifetime defaults for type parameter `{}`", tcx.def_path_str(def_id) }
2138 separate_provide_extern
2139 }
2140 query late_bound_vars_map(owner_id: hir::OwnerId)
2141 -> &'tcx SortedMap<ItemLocalId, Vec<ty::BoundVariableKind>> {
2142 desc { |tcx| "looking up late bound vars inside `{}`", tcx.def_path_str(owner_id) }
2143 }
2144 query opaque_captured_lifetimes(def_id: LocalDefId) -> &'tcx [(ResolvedArg, LocalDefId)] {
2159 desc { |tcx| "listing captured lifetimes for opaque `{}`", tcx.def_path_str(def_id) }
2160 }
2161
2162 query visibility(def_id: DefId) -> ty::Visibility<DefId> {
2175 desc { |tcx| "computing visibility of `{}`", tcx.def_path_str(def_id) }
2176 separate_provide_extern
2177 feedable
2178 }
2179
2180 query inhabited_predicate_adt(key: DefId) -> ty::inhabitedness::InhabitedPredicate<'tcx> {
2181 desc { "computing the uninhabited predicate of `{:?}`", key }
2182 }
2183
2184 query inhabited_predicate_type(key: Ty<'tcx>) -> ty::inhabitedness::InhabitedPredicate<'tcx> {
2186 desc { "computing the uninhabited predicate of `{}`", key }
2187 }
2188
2189 query dep_kind(_: CrateNum) -> CrateDepKind {
2190 eval_always
2191 desc { "fetching what a dependency looks like" }
2192 separate_provide_extern
2193 }
2194
2195 query crate_name(_: CrateNum) -> Symbol {
2197 feedable
2198 desc { "fetching what a crate is named" }
2199 separate_provide_extern
2200 }
2201 query module_children(def_id: DefId) -> &'tcx [ModChild] {
2202 desc { |tcx| "collecting child items of module `{}`", tcx.def_path_str(def_id) }
2203 separate_provide_extern
2204 }
2205
2206 query num_extern_def_ids(_: CrateNum) -> usize {
2212 desc { "fetching the number of definitions in a crate" }
2213 separate_provide_extern
2214 }
2215
2216 query lib_features(_: CrateNum) -> &'tcx LibFeatures {
2217 desc { "calculating the lib features defined in a crate" }
2218 separate_provide_extern
2219 arena_cache
2220 }
2221 query stability_implications(_: CrateNum) -> &'tcx UnordMap<Symbol, Symbol> {
2234 arena_cache
2235 desc { "calculating the implications between `#[unstable]` features defined in a crate" }
2236 separate_provide_extern
2237 }
2238 query intrinsic_raw(def_id: DefId) -> Option<rustc_middle::ty::IntrinsicDef> {
2240 desc { |tcx| "fetch intrinsic name if `{}` is an intrinsic", tcx.def_path_str(def_id) }
2241 separate_provide_extern
2242 }
2243 query get_lang_items(_: ()) -> &'tcx LanguageItems {
2245 arena_cache
2246 eval_always
2247 desc { "calculating the lang items map" }
2248 }
2249
2250 query all_diagnostic_items(_: ()) -> &'tcx rustc_hir::diagnostic_items::DiagnosticItems {
2252 arena_cache
2253 eval_always
2254 desc { "calculating the diagnostic items map" }
2255 }
2256
2257 query defined_lang_items(_: CrateNum) -> &'tcx [(DefId, LangItem)] {
2259 desc { "calculating the lang items defined in a crate" }
2260 separate_provide_extern
2261 }
2262
2263 query diagnostic_items(_: CrateNum) -> &'tcx rustc_hir::diagnostic_items::DiagnosticItems {
2265 arena_cache
2266 desc { "calculating the diagnostic items map in a crate" }
2267 separate_provide_extern
2268 }
2269
2270 query missing_lang_items(_: CrateNum) -> &'tcx [LangItem] {
2271 desc { "calculating the missing lang items in a crate" }
2272 separate_provide_extern
2273 }
2274
2275 query visible_parent_map(_: ()) -> &'tcx DefIdMap<DefId> {
2280 arena_cache
2281 desc { "calculating the visible parent map" }
2282 }
2283 query trimmed_def_paths(_: ()) -> &'tcx DefIdMap<Symbol> {
2286 arena_cache
2287 desc { "calculating trimmed def paths" }
2288 }
2289 query missing_extern_crate_item(_: CrateNum) -> bool {
2290 eval_always
2291 desc { "seeing if we're missing an `extern crate` item for this crate" }
2292 separate_provide_extern
2293 }
2294 query used_crate_source(_: CrateNum) -> &'tcx Arc<CrateSource> {
2295 arena_cache
2296 eval_always
2297 desc { "looking at the source for a crate" }
2298 separate_provide_extern
2299 }
2300
2301 query debugger_visualizers(_: CrateNum) -> &'tcx Vec<DebuggerVisualizerFile> {
2306 arena_cache
2307 desc { "looking up the debugger visualizers for this crate" }
2308 separate_provide_extern
2309 eval_always
2310 }
2311
2312 query postorder_cnums(_: ()) -> &'tcx [CrateNum] {
2313 eval_always
2314 desc { "generating a postorder list of CrateNums" }
2315 }
2316 query is_private_dep(c: CrateNum) -> bool {
2319 eval_always
2320 desc { "checking whether crate `{}` is a private dependency", c }
2321 separate_provide_extern
2322 }
2323 query allocator_kind(_: ()) -> Option<AllocatorKind> {
2324 eval_always
2325 desc { "getting the allocator kind for the current crate" }
2326 }
2327 query alloc_error_handler_kind(_: ()) -> Option<AllocatorKind> {
2328 eval_always
2329 desc { "alloc error handler kind for the current crate" }
2330 }
2331
2332 query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
2333 desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }
2334 }
2335
2336 query crates(_: ()) -> &'tcx [CrateNum] {
2339 eval_always
2340 desc { "fetching all foreign CrateNum instances" }
2341 }
2342 query used_crates(_: ()) -> &'tcx [CrateNum] {
2346 eval_always
2347 desc { "fetching `CrateNum`s for all crates loaded non-speculatively" }
2348 }
2349
2350 query traits(_: CrateNum) -> &'tcx [DefId] {
2352 desc { "fetching all traits in a crate" }
2353 separate_provide_extern
2354 }
2355
2356 query trait_impls_in_crate(_: CrateNum) -> &'tcx [DefId] {
2357 desc { "fetching all trait impls in a crate" }
2358 separate_provide_extern
2359 }
2360
2361 query stable_order_of_exportable_impls(_: CrateNum) -> &'tcx FxIndexMap<DefId, usize> {
2362 desc { "fetching the stable impl's order" }
2363 separate_provide_extern
2364 }
2365
2366 query exportable_items(_: CrateNum) -> &'tcx [DefId] {
2367 desc { "fetching all exportable items in a crate" }
2368 separate_provide_extern
2369 }
2370
2371 query exported_non_generic_symbols(cnum: CrateNum) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportInfo)] {
2383 desc { "collecting exported non-generic symbols for crate `{}`", cnum}
2384 cache_on_disk_if { *cnum == LOCAL_CRATE }
2385 separate_provide_extern
2386 }
2387
2388 query exported_generic_symbols(cnum: CrateNum) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportInfo)] {
2396 desc { "collecting exported generic symbols for crate `{}`", cnum}
2397 cache_on_disk_if { *cnum == LOCAL_CRATE }
2398 separate_provide_extern
2399 }
2400
2401 query collect_and_partition_mono_items(_: ()) -> MonoItemPartitions<'tcx> {
2402 eval_always
2403 desc { "collect_and_partition_mono_items" }
2404 }
2405
2406 query is_codegened_item(def_id: DefId) -> bool {
2407 desc { |tcx| "determining whether `{}` needs codegen", tcx.def_path_str(def_id) }
2408 }
2409
2410 query codegen_unit(sym: Symbol) -> &'tcx CodegenUnit<'tcx> {
2411 desc { "getting codegen unit `{sym}`" }
2412 }
2413
2414 query backend_optimization_level(_: ()) -> OptLevel {
2415 desc { "optimization level used by backend" }
2416 }
2417
2418 query output_filenames(_: ()) -> &'tcx Arc<OutputFilenames> {
2423 feedable
2424 desc { "getting output filenames" }
2425 arena_cache
2426 }
2427
2428 query normalize_canonicalized_projection(
2434 goal: CanonicalAliasGoal<'tcx>
2435 ) -> Result<
2436 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2437 NoSolution,
2438 > {
2439 desc { "normalizing `{}`", goal.canonical.value.value }
2440 }
2441
2442 query normalize_canonicalized_free_alias(
2448 goal: CanonicalAliasGoal<'tcx>
2449 ) -> Result<
2450 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2451 NoSolution,
2452 > {
2453 desc { "normalizing `{}`", goal.canonical.value.value }
2454 }
2455
2456 query normalize_canonicalized_inherent_projection(
2462 goal: CanonicalAliasGoal<'tcx>
2463 ) -> Result<
2464 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2465 NoSolution,
2466 > {
2467 desc { "normalizing `{}`", goal.canonical.value.value }
2468 }
2469
2470 query try_normalize_generic_arg_after_erasing_regions(
2472 goal: PseudoCanonicalInput<'tcx, GenericArg<'tcx>>
2473 ) -> Result<GenericArg<'tcx>, NoSolution> {
2474 desc { "normalizing `{}`", goal.value }
2475 }
2476
2477 query implied_outlives_bounds(
2478 key: (CanonicalImpliedOutlivesBoundsGoal<'tcx>, bool)
2479 ) -> Result<
2480 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>,
2481 NoSolution,
2482 > {
2483 desc { "computing implied outlives bounds for `{}` (hack disabled = {:?})", key.0.canonical.value.value.ty, key.1 }
2484 }
2485
2486 query dropck_outlives(
2489 goal: CanonicalDropckOutlivesGoal<'tcx>
2490 ) -> Result<
2491 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>,
2492 NoSolution,
2493 > {
2494 desc { "computing dropck types for `{}`", goal.canonical.value.value.dropped_ty }
2495 }
2496
2497 query evaluate_obligation(
2500 goal: CanonicalPredicateGoal<'tcx>
2501 ) -> Result<EvaluationResult, OverflowError> {
2502 desc { "evaluating trait selection obligation `{}`", goal.canonical.value.value }
2503 }
2504
2505 query type_op_ascribe_user_type(
2507 goal: CanonicalTypeOpAscribeUserTypeGoal<'tcx>
2508 ) -> Result<
2509 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
2510 NoSolution,
2511 > {
2512 desc { "evaluating `type_op_ascribe_user_type` `{:?}`", goal.canonical.value.value }
2513 }
2514
2515 query type_op_prove_predicate(
2517 goal: CanonicalTypeOpProvePredicateGoal<'tcx>
2518 ) -> Result<
2519 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
2520 NoSolution,
2521 > {
2522 desc { "evaluating `type_op_prove_predicate` `{:?}`", goal.canonical.value.value }
2523 }
2524
2525 query type_op_normalize_ty(
2527 goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>
2528 ) -> Result<
2529 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Ty<'tcx>>>,
2530 NoSolution,
2531 > {
2532 desc { "normalizing `{}`", goal.canonical.value.value.value }
2533 }
2534
2535 query type_op_normalize_clause(
2537 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::Clause<'tcx>>
2538 ) -> Result<
2539 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::Clause<'tcx>>>,
2540 NoSolution,
2541 > {
2542 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2543 }
2544
2545 query type_op_normalize_poly_fn_sig(
2547 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::PolyFnSig<'tcx>>
2548 ) -> Result<
2549 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::PolyFnSig<'tcx>>>,
2550 NoSolution,
2551 > {
2552 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2553 }
2554
2555 query type_op_normalize_fn_sig(
2557 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>
2558 ) -> Result<
2559 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::FnSig<'tcx>>>,
2560 NoSolution,
2561 > {
2562 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2563 }
2564
2565 query instantiate_and_check_impossible_predicates(key: (DefId, GenericArgsRef<'tcx>)) -> bool {
2566 desc { |tcx|
2567 "checking impossible instantiated predicates: `{}`",
2568 tcx.def_path_str(key.0)
2569 }
2570 }
2571
2572 query is_impossible_associated_item(key: (DefId, DefId)) -> bool {
2573 desc { |tcx|
2574 "checking if `{}` is impossible to reference within `{}`",
2575 tcx.def_path_str(key.1),
2576 tcx.def_path_str(key.0),
2577 }
2578 }
2579
2580 query method_autoderef_steps(
2581 goal: CanonicalMethodAutoderefStepsGoal<'tcx>
2582 ) -> MethodAutoderefStepsResult<'tcx> {
2583 desc { "computing autoderef types for `{}`", goal.canonical.value.value.self_ty }
2584 }
2585
2586 query evaluate_root_goal_for_proof_tree_raw(
2588 goal: solve::CanonicalInput<'tcx>,
2589 ) -> (solve::QueryResult<'tcx>, &'tcx solve::inspect::Probe<TyCtxt<'tcx>>) {
2590 no_hash
2591 desc { "computing proof tree for `{}`", goal.canonical.value.goal.predicate }
2592 }
2593
2594 query rust_target_features(_: CrateNum) -> &'tcx UnordMap<String, rustc_target::target_features::Stability> {
2596 arena_cache
2597 eval_always
2598 desc { "looking up Rust target features" }
2599 }
2600
2601 query implied_target_features(feature: Symbol) -> &'tcx Vec<Symbol> {
2602 arena_cache
2603 eval_always
2604 desc { "looking up implied target features" }
2605 }
2606
2607 query features_query(_: ()) -> &'tcx rustc_feature::Features {
2608 feedable
2609 desc { "looking up enabled feature gates" }
2610 }
2611
2612 query crate_for_resolver((): ()) -> &'tcx Steal<(rustc_ast::Crate, rustc_ast::AttrVec)> {
2613 feedable
2614 no_hash
2615 desc { "the ast before macro expansion and name resolution" }
2616 }
2617
2618 query resolve_instance_raw(
2628 key: ty::PseudoCanonicalInput<'tcx, (DefId, GenericArgsRef<'tcx>)>
2629 ) -> Result<Option<ty::Instance<'tcx>>, ErrorGuaranteed> {
2630 desc { "resolving instance `{}`", ty::Instance::new_raw(key.value.0, key.value.1) }
2631 }
2632
2633 query reveal_opaque_types_in_bounds(key: ty::Clauses<'tcx>) -> ty::Clauses<'tcx> {
2634 desc { "revealing opaque types in `{:?}`", key }
2635 }
2636
2637 query limits(key: ()) -> Limits {
2638 desc { "looking up limits" }
2639 }
2640
2641 query diagnostic_hir_wf_check(
2650 key: (ty::Predicate<'tcx>, WellFormedLoc)
2651 ) -> Option<&'tcx ObligationCause<'tcx>> {
2652 arena_cache
2653 eval_always
2654 no_hash
2655 desc { "performing HIR wf-checking for predicate `{:?}` at item `{:?}`", key.0, key.1 }
2656 }
2657
2658 query global_backend_features(_: ()) -> &'tcx Vec<String> {
2661 arena_cache
2662 eval_always
2663 desc { "computing the backend features for CLI flags" }
2664 }
2665
2666 query check_validity_requirement(key: (ValidityRequirement, ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>)) -> Result<bool, &'tcx ty::layout::LayoutError<'tcx>> {
2667 desc { "checking validity requirement for `{}`: {}", key.1.value, key.0 }
2668 }
2669
2670 query compare_impl_item(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
2675 desc { |tcx| "checking assoc item `{}` is compatible with trait definition", tcx.def_path_str(key) }
2676 return_result_from_ensure_ok
2677 }
2678
2679 query deduced_param_attrs(def_id: DefId) -> &'tcx [DeducedParamAttrs] {
2680 desc { |tcx| "deducing parameter attributes for {}", tcx.def_path_str(def_id) }
2681 separate_provide_extern
2682 }
2683
2684 query doc_link_resolutions(def_id: DefId) -> &'tcx DocLinkResMap {
2685 eval_always
2686 desc { "resolutions for documentation links for a module" }
2687 separate_provide_extern
2688 }
2689
2690 query doc_link_traits_in_scope(def_id: DefId) -> &'tcx [DefId] {
2691 eval_always
2692 desc { "traits in scope for documentation links for a module" }
2693 separate_provide_extern
2694 }
2695
2696 query stripped_cfg_items(cnum: CrateNum) -> &'tcx [StrippedCfgItem] {
2700 desc { "getting cfg-ed out item names" }
2701 separate_provide_extern
2702 }
2703
2704 query generics_require_sized_self(def_id: DefId) -> bool {
2705 desc { "check whether the item has a `where Self: Sized` bound" }
2706 }
2707
2708 query cross_crate_inlinable(def_id: DefId) -> bool {
2709 desc { "whether the item should be made inlinable across crates" }
2710 separate_provide_extern
2711 }
2712
2713 query check_mono_item(key: ty::Instance<'tcx>) {
2717 desc { "monomorphization-time checking" }
2718 }
2719
2720 query skip_move_check_fns(_: ()) -> &'tcx FxIndexSet<DefId> {
2722 arena_cache
2723 desc { "functions to skip for move-size check" }
2724 }
2725
2726 query items_of_instance(key: (ty::Instance<'tcx>, CollectionMode)) -> Result<(&'tcx [Spanned<MonoItem<'tcx>>], &'tcx [Spanned<MonoItem<'tcx>>]), NormalizationErrorInMono> {
2727 desc { "collecting items used by `{}`", key.0 }
2728 cache_on_disk_if { true }
2729 }
2730
2731 query size_estimate(key: ty::Instance<'tcx>) -> usize {
2732 desc { "estimating codegen size of `{}`", key }
2733 cache_on_disk_if { true }
2734 }
2735
2736 query anon_const_kind(def_id: DefId) -> ty::AnonConstKind {
2737 desc { |tcx| "looking up anon const kind of `{}`", tcx.def_path_str(def_id) }
2738 separate_provide_extern
2739 }
2740
2741 query trivial_const(def_id: DefId) -> Option<(mir::ConstValue, Ty<'tcx>)> {
2742 desc { |tcx| "checking if `{}` is a trivial const", tcx.def_path_str(def_id) }
2743 cache_on_disk_if { def_id.is_local() }
2744 separate_provide_extern
2745 }
2746
2747 query sanitizer_settings_for(key: LocalDefId) -> SanitizerFnAttrs {
2753 desc { |tcx| "checking what set of sanitizers are enabled on `{}`", tcx.def_path_str(key) }
2754 feedable
2755 }
2756}
2757
2758rustc_with_all_queries! { define_callbacks! }
2759rustc_feedable_queries! { define_feedable! }
2760
2761fn describe_as_module(def_id: impl Into<LocalDefId>, tcx: TyCtxt<'_>) -> String {
2762 let def_id = def_id.into();
2763 if def_id.is_top_level_module() {
2764 "top-level module".to_string()
2765 } else {
2766 format!("module `{}`", tcx.def_path_str(def_id))
2767 }
2768}