1#![allow(unused_parens)]
8
9use std::ffi::OsStr;
10use std::mem;
11use std::path::PathBuf;
12use std::sync::Arc;
13
14use rustc_arena::TypedArena;
15use rustc_ast::expand::StrippedCfgItem;
16use rustc_ast::expand::allocator::AllocatorKind;
17use rustc_data_structures::fingerprint::Fingerprint;
18use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
19use rustc_data_structures::sorted_map::SortedMap;
20use rustc_data_structures::steal::Steal;
21use rustc_data_structures::svh::Svh;
22use rustc_data_structures::unord::{UnordMap, UnordSet};
23use rustc_errors::ErrorGuaranteed;
24use rustc_hir::def::{DefKind, DocLinkResMap};
25use rustc_hir::def_id::{
26 CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap, LocalDefIdSet, LocalModDefId,
27};
28use rustc_hir::lang_items::{LangItem, LanguageItems};
29use rustc_hir::{Crate, ItemLocalId, ItemLocalMap, PreciseCapturingArgKind, TraitCandidate};
30use rustc_index::IndexVec;
31use rustc_lint_defs::LintId;
32use rustc_macros::rustc_queries;
33use rustc_query_system::ich::StableHashingContext;
34use rustc_query_system::query::{
35 QueryCache, QueryMode, QueryStackDeferred, QueryState, try_get_cached,
36};
37use rustc_session::Limits;
38use rustc_session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion};
39use rustc_session::cstore::{
40 CrateDepKind, CrateSource, ExternCrate, ForeignModule, LinkagePreference, NativeLib,
41};
42use rustc_session::lint::LintExpectationId;
43use rustc_span::def_id::LOCAL_CRATE;
44use rustc_span::source_map::Spanned;
45use rustc_span::{DUMMY_SP, Span, Symbol};
46use rustc_target::spec::PanicStrategy;
47use {rustc_abi as abi, rustc_ast as ast, rustc_attr_data_structures as attr, rustc_hir as hir};
48
49use crate::infer::canonical::{self, Canonical};
50use crate::lint::LintExpectation;
51use crate::metadata::ModChild;
52use crate::middle::codegen_fn_attrs::CodegenFnAttrs;
53use crate::middle::debugger_visualizer::DebuggerVisualizerFile;
54use crate::middle::exported_symbols::{ExportedSymbol, SymbolExportInfo};
55use crate::middle::lib_features::LibFeatures;
56use crate::middle::privacy::EffectiveVisibilities;
57use crate::middle::resolve_bound_vars::{ObjectLifetimeDefault, ResolveBoundVars, ResolvedArg};
58use crate::middle::stability::{self, DeprecationEntry};
59use crate::mir::interpret::{
60 EvalStaticInitializerRawResult, EvalToAllocationRawResult, EvalToConstValueResult,
61 EvalToValTreeResult, GlobalId, LitToConstInput,
62};
63use crate::mir::mono::{CodegenUnit, CollectionMode, MonoItem, MonoItemPartitions};
64use crate::query::erase::{Erase, erase, restore};
65use crate::query::plumbing::{
66 CyclePlaceholder, DynamicQuery, query_ensure, query_ensure_error_guaranteed, query_get_at,
67};
68use crate::traits::query::{
69 CanonicalAliasGoal, CanonicalDropckOutlivesGoal, CanonicalImpliedOutlivesBoundsGoal,
70 CanonicalPredicateGoal, CanonicalTyGoal, CanonicalTypeOpAscribeUserTypeGoal,
71 CanonicalTypeOpNormalizeGoal, CanonicalTypeOpProvePredicateGoal, DropckConstraint,
72 DropckOutlivesResult, MethodAutoderefStepsResult, NoSolution, NormalizationResult,
73 OutlivesBound,
74};
75use crate::traits::{
76 CodegenObligationError, DynCompatibilityViolation, EvaluationResult, ImplSource,
77 ObligationCause, OverflowError, WellFormedLoc, specialization_graph,
78};
79use crate::ty::fast_reject::SimplifiedType;
80use crate::ty::layout::ValidityRequirement;
81use crate::ty::print::{PrintTraitRefExt, describe_as_module};
82use crate::ty::util::AlwaysRequiresDrop;
83use crate::ty::{
84 self, CrateInherentImpls, GenericArg, GenericArgsRef, PseudoCanonicalInput, Ty, TyCtxt,
85 TyCtxtFeed,
86};
87use crate::{dep_graph, mir, thir};
88
89mod arena_cached;
90pub mod erase;
91mod keys;
92pub use keys::{AsLocalKey, Key, LocalCrate};
93pub mod on_disk_cache;
94#[macro_use]
95pub mod plumbing;
96pub use plumbing::{IntoQueryParam, TyCtxtAt, TyCtxtEnsureDone, TyCtxtEnsureOk};
97
98rustc_queries! {
110 query trigger_delayed_bug(key: DefId) {
112 desc { "triggering a delayed bug for testing incremental" }
113 }
114
115 query registered_tools(_: ()) -> &'tcx ty::RegisteredTools {
117 arena_cache
118 desc { "compute registered tools for crate" }
119 }
120
121 query early_lint_checks(_: ()) {
122 desc { "perform lints prior to AST lowering" }
123 }
124
125 query env_var_os(key: &'tcx OsStr) -> Option<&'tcx OsStr> {
135 eval_always
137 desc { "get the value of an environment variable" }
138 }
139
140 query resolutions(_: ()) -> &'tcx ty::ResolverGlobalCtxt {
141 no_hash
142 desc { "getting the resolver outputs" }
143 }
144
145 query resolver_for_lowering_raw(_: ()) -> (&'tcx Steal<(ty::ResolverAstLowering, Arc<ast::Crate>)>, &'tcx ty::ResolverGlobalCtxt) {
146 eval_always
147 no_hash
148 desc { "getting the resolver for lowering" }
149 }
150
151 query source_span(key: LocalDefId) -> Span {
157 eval_always
159 desc { "getting the source span" }
160 }
161
162 query hir_crate(key: ()) -> &'tcx Crate<'tcx> {
170 arena_cache
171 eval_always
172 desc { "getting the crate HIR" }
173 }
174
175 query hir_crate_items(_: ()) -> &'tcx rustc_middle::hir::ModuleItems {
177 arena_cache
178 eval_always
179 desc { "getting HIR crate items" }
180 }
181
182 query hir_module_items(key: LocalModDefId) -> &'tcx rustc_middle::hir::ModuleItems {
187 arena_cache
188 desc { |tcx| "getting HIR module items in `{}`", tcx.def_path_str(key) }
189 cache_on_disk_if { true }
190 }
191
192 query local_def_id_to_hir_id(key: LocalDefId) -> hir::HirId {
194 desc { |tcx| "getting HIR ID of `{}`", tcx.def_path_str(key) }
195 feedable
196 }
197
198 query hir_owner_parent(key: hir::OwnerId) -> hir::HirId {
203 desc { |tcx| "getting HIR parent of `{}`", tcx.def_path_str(key) }
204 }
205
206 query opt_hir_owner_nodes(key: LocalDefId) -> Option<&'tcx hir::OwnerNodes<'tcx>> {
211 desc { |tcx| "getting HIR owner items in `{}`", tcx.def_path_str(key) }
212 feedable
213 }
214
215 query hir_attr_map(key: hir::OwnerId) -> &'tcx hir::AttributeMap<'tcx> {
220 desc { |tcx| "getting HIR owner attributes in `{}`", tcx.def_path_str(key) }
221 feedable
222 }
223
224 query const_param_default(param: DefId) -> ty::EarlyBinder<'tcx, ty::Const<'tcx>> {
228 desc { |tcx| "computing the default for const parameter `{}`", tcx.def_path_str(param) }
229 cache_on_disk_if { param.is_local() }
230 separate_provide_extern
231 }
232
233 query type_of(key: DefId) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
252 desc { |tcx|
253 "{action} `{path}`",
254 action = match tcx.def_kind(key) {
255 DefKind::TyAlias => "expanding type alias",
256 DefKind::TraitAlias => "expanding trait alias",
257 _ => "computing type of",
258 },
259 path = tcx.def_path_str(key),
260 }
261 cache_on_disk_if { key.is_local() }
262 separate_provide_extern
263 feedable
264 }
265
266 query type_of_opaque(key: DefId) -> Result<ty::EarlyBinder<'tcx, Ty<'tcx>>, CyclePlaceholder> {
275 desc { |tcx|
276 "computing type of opaque `{path}`",
277 path = tcx.def_path_str(key),
278 }
279 cycle_stash
280 }
281
282 query type_alias_is_lazy(key: DefId) -> bool {
296 desc { |tcx|
297 "computing whether the type alias `{path}` is lazy",
298 path = tcx.def_path_str(key),
299 }
300 separate_provide_extern
301 }
302
303 query collect_return_position_impl_trait_in_trait_tys(key: DefId)
304 -> Result<&'tcx DefIdMap<ty::EarlyBinder<'tcx, Ty<'tcx>>>, ErrorGuaranteed>
305 {
306 desc { "comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process" }
307 cache_on_disk_if { key.is_local() }
308 separate_provide_extern
309 }
310
311 query opaque_ty_origin(key: DefId) -> hir::OpaqueTyOrigin<DefId>
312 {
313 desc { "determine where the opaque originates from" }
314 separate_provide_extern
315 }
316
317 query unsizing_params_for_adt(key: DefId) -> &'tcx rustc_index::bit_set::DenseBitSet<u32>
318 {
319 arena_cache
320 desc { |tcx|
321 "determining what parameters of `{}` can participate in unsizing",
322 tcx.def_path_str(key),
323 }
324 }
325
326 query analysis(key: ()) {
328 eval_always
329 desc { "running analysis passes on this crate" }
330 }
331
332 query check_expectations(key: Option<Symbol>) {
347 eval_always
348 desc { "checking lint expectations (RFC 2383)" }
349 }
350
351 query generics_of(key: DefId) -> &'tcx ty::Generics {
353 desc { |tcx| "computing generics of `{}`", tcx.def_path_str(key) }
354 arena_cache
355 cache_on_disk_if { key.is_local() }
356 separate_provide_extern
357 feedable
358 }
359
360 query predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
368 desc { |tcx| "computing predicates of `{}`", tcx.def_path_str(key) }
369 cache_on_disk_if { key.is_local() }
370 feedable
371 }
372
373 query opaque_types_defined_by(
374 key: LocalDefId
375 ) -> &'tcx ty::List<LocalDefId> {
376 desc {
377 |tcx| "computing the opaque types defined by `{}`",
378 tcx.def_path_str(key.to_def_id())
379 }
380 }
381
382 query explicit_item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
401 desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
402 cache_on_disk_if { key.is_local() }
403 separate_provide_extern
404 feedable
405 }
406
407 query explicit_item_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
414 desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
415 cache_on_disk_if { key.is_local() }
416 separate_provide_extern
417 feedable
418 }
419
420 query item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
444 desc { |tcx| "elaborating item bounds for `{}`", tcx.def_path_str(key) }
445 }
446
447 query item_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
448 desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
449 }
450
451 query item_non_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
452 desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
453 }
454
455 query impl_super_outlives(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
456 desc { |tcx| "elaborating supertrait outlives for trait of `{}`", tcx.def_path_str(key) }
457 }
458
459 query native_libraries(_: CrateNum) -> &'tcx Vec<NativeLib> {
464 arena_cache
465 desc { "looking up the native libraries of a linked crate" }
466 separate_provide_extern
467 }
468
469 query shallow_lint_levels_on(key: hir::OwnerId) -> &'tcx rustc_middle::lint::ShallowLintLevelMap {
470 arena_cache
471 desc { |tcx| "looking up lint levels for `{}`", tcx.def_path_str(key) }
472 }
473
474 query lint_expectations(_: ()) -> &'tcx Vec<(LintExpectationId, LintExpectation)> {
475 arena_cache
476 desc { "computing `#[expect]`ed lints in this crate" }
477 }
478
479 query lints_that_dont_need_to_run(_: ()) -> &'tcx FxIndexSet<LintId> {
480 arena_cache
481 desc { "Computing all lints that are explicitly enabled or with a default level greater than Allow" }
482 }
483
484 query expn_that_defined(key: DefId) -> rustc_span::ExpnId {
485 desc { |tcx| "getting the expansion that defined `{}`", tcx.def_path_str(key) }
486 separate_provide_extern
487 }
488
489 query is_panic_runtime(_: CrateNum) -> bool {
490 fatal_cycle
491 desc { "checking if the crate is_panic_runtime" }
492 separate_provide_extern
493 }
494
495 query representability(_: LocalDefId) -> rustc_middle::ty::Representability {
497 desc { "checking if `{}` is representable", tcx.def_path_str(key) }
498 cycle_delay_bug
500 anon
504 }
505
506 query representability_adt_ty(_: Ty<'tcx>) -> rustc_middle::ty::Representability {
508 desc { "checking if `{}` is representable", key }
509 cycle_delay_bug
510 anon
511 }
512
513 query params_in_repr(key: DefId) -> &'tcx rustc_index::bit_set::DenseBitSet<u32> {
515 desc { "finding type parameters in the representation" }
516 arena_cache
517 no_hash
518 separate_provide_extern
519 }
520
521 query thir_body(key: LocalDefId) -> Result<(&'tcx Steal<thir::Thir<'tcx>>, thir::ExprId), ErrorGuaranteed> {
523 no_hash
525 desc { |tcx| "building THIR for `{}`", tcx.def_path_str(key) }
526 }
527
528 query mir_keys(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexSet<LocalDefId> {
532 arena_cache
533 desc { "getting a list of all mir_keys" }
534 }
535
536 query mir_const_qualif(key: DefId) -> mir::ConstQualifs {
540 desc { |tcx| "const checking `{}`", tcx.def_path_str(key) }
541 cache_on_disk_if { key.is_local() }
542 separate_provide_extern
543 }
544
545 query mir_built(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
551 desc { |tcx| "building MIR for `{}`", tcx.def_path_str(key) }
552 feedable
553 }
554
555 query thir_abstract_const(
557 key: DefId
558 ) -> Result<Option<ty::EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed> {
559 desc {
560 |tcx| "building an abstract representation for `{}`", tcx.def_path_str(key),
561 }
562 separate_provide_extern
563 }
564
565 query mir_drops_elaborated_and_const_checked(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
566 no_hash
567 desc { |tcx| "elaborating drops for `{}`", tcx.def_path_str(key) }
568 }
569
570 query mir_for_ctfe(
571 key: DefId
572 ) -> &'tcx mir::Body<'tcx> {
573 desc { |tcx| "caching mir of `{}` for CTFE", tcx.def_path_str(key) }
574 cache_on_disk_if { key.is_local() }
575 separate_provide_extern
576 }
577
578 query mir_promoted(key: LocalDefId) -> (
579 &'tcx Steal<mir::Body<'tcx>>,
580 &'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>>
581 ) {
582 no_hash
583 desc { |tcx| "promoting constants in MIR for `{}`", tcx.def_path_str(key) }
584 }
585
586 query closure_typeinfo(key: LocalDefId) -> ty::ClosureTypeInfo<'tcx> {
587 desc {
588 |tcx| "finding symbols for captures of closure `{}`",
589 tcx.def_path_str(key)
590 }
591 }
592
593 query closure_saved_names_of_captured_variables(def_id: DefId) -> &'tcx IndexVec<abi::FieldIdx, Symbol> {
601 arena_cache
602 desc { |tcx| "computing debuginfo for closure `{}`", tcx.def_path_str(def_id) }
603 separate_provide_extern
604 }
605
606 query mir_coroutine_witnesses(key: DefId) -> Option<&'tcx mir::CoroutineLayout<'tcx>> {
607 arena_cache
608 desc { |tcx| "coroutine witness types for `{}`", tcx.def_path_str(key) }
609 cache_on_disk_if { key.is_local() }
610 separate_provide_extern
611 }
612
613 query check_coroutine_obligations(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
614 desc { |tcx| "verify auto trait bounds for coroutine interior type `{}`", tcx.def_path_str(key) }
615 }
616
617 query optimized_mir(key: DefId) -> &'tcx mir::Body<'tcx> {
620 desc { |tcx| "optimizing MIR for `{}`", tcx.def_path_str(key) }
621 cache_on_disk_if { key.is_local() }
622 separate_provide_extern
623 }
624
625 query coverage_attr_on(key: LocalDefId) -> bool {
631 desc { |tcx| "checking for `#[coverage(..)]` on `{}`", tcx.def_path_str(key) }
632 feedable
633 }
634
635 query coverage_ids_info(key: ty::InstanceKind<'tcx>) -> Option<&'tcx mir::coverage::CoverageIdsInfo> {
648 desc { |tcx| "retrieving coverage IDs info from MIR for `{}`", tcx.def_path_str(key.def_id()) }
649 arena_cache
650 }
651
652 query promoted_mir(key: DefId) -> &'tcx IndexVec<mir::Promoted, mir::Body<'tcx>> {
658 desc { |tcx| "optimizing promoted MIR for `{}`", tcx.def_path_str(key) }
659 cache_on_disk_if { key.is_local() }
660 separate_provide_extern
661 }
662
663 query erase_regions_ty(ty: Ty<'tcx>) -> Ty<'tcx> {
667 anon
674 desc { "erasing regions from `{}`", ty }
675 }
676
677 query wasm_import_module_map(_: CrateNum) -> &'tcx DefIdMap<String> {
678 arena_cache
679 desc { "getting wasm import module map" }
680 }
681
682 query trait_explicit_predicates_and_bounds(key: LocalDefId) -> ty::GenericPredicates<'tcx> {
704 desc { |tcx| "computing explicit predicates of trait `{}`", tcx.def_path_str(key) }
705 }
706
707 query explicit_predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
713 desc { |tcx| "computing explicit predicates of `{}`", tcx.def_path_str(key) }
714 cache_on_disk_if { key.is_local() }
715 separate_provide_extern
716 feedable
717 }
718
719 query inferred_outlives_of(key: DefId) -> &'tcx [(ty::Clause<'tcx>, Span)] {
726 desc { |tcx| "computing inferred outlives-predicates of `{}`", tcx.def_path_str(key) }
727 cache_on_disk_if { key.is_local() }
728 separate_provide_extern
729 feedable
730 }
731
732 query explicit_super_predicates_of(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
740 desc { |tcx| "computing the super predicates of `{}`", tcx.def_path_str(key) }
741 cache_on_disk_if { key.is_local() }
742 separate_provide_extern
743 }
744
745 query explicit_implied_predicates_of(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
752 desc { |tcx| "computing the implied predicates of `{}`", tcx.def_path_str(key) }
753 cache_on_disk_if { key.is_local() }
754 separate_provide_extern
755 }
756
757 query explicit_supertraits_containing_assoc_item(
761 key: (DefId, rustc_span::Ident)
762 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
763 desc { |tcx| "computing the super traits of `{}` with associated type name `{}`",
764 tcx.def_path_str(key.0),
765 key.1
766 }
767 }
768
769 query const_conditions(
779 key: DefId
780 ) -> ty::ConstConditions<'tcx> {
781 desc { |tcx| "computing the conditions for `{}` to be considered const",
782 tcx.def_path_str(key)
783 }
784 separate_provide_extern
785 }
786
787 query explicit_implied_const_bounds(
793 key: DefId
794 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::PolyTraitRef<'tcx>, Span)]> {
795 desc { |tcx| "computing the implied `~const` bounds for `{}`",
796 tcx.def_path_str(key)
797 }
798 separate_provide_extern
799 }
800
801 query type_param_predicates(
804 key: (LocalDefId, LocalDefId, rustc_span::Ident)
805 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
806 desc { |tcx| "computing the bounds for type parameter `{}`", tcx.hir_ty_param_name(key.1) }
807 }
808
809 query trait_def(key: DefId) -> &'tcx ty::TraitDef {
810 desc { |tcx| "computing trait definition for `{}`", tcx.def_path_str(key) }
811 arena_cache
812 cache_on_disk_if { key.is_local() }
813 separate_provide_extern
814 }
815 query adt_def(key: DefId) -> ty::AdtDef<'tcx> {
816 desc { |tcx| "computing ADT definition for `{}`", tcx.def_path_str(key) }
817 cache_on_disk_if { key.is_local() }
818 separate_provide_extern
819 }
820 query adt_destructor(key: DefId) -> Option<ty::Destructor> {
821 desc { |tcx| "computing `Drop` impl for `{}`", tcx.def_path_str(key) }
822 cache_on_disk_if { key.is_local() }
823 separate_provide_extern
824 }
825 query adt_async_destructor(key: DefId) -> Option<ty::AsyncDestructor> {
826 desc { |tcx| "computing `AsyncDrop` impl for `{}`", tcx.def_path_str(key) }
827 cache_on_disk_if { key.is_local() }
828 separate_provide_extern
829 }
830
831 query adt_sized_constraint(key: DefId) -> Option<ty::EarlyBinder<'tcx, Ty<'tcx>>> {
832 desc { |tcx| "computing the `Sized` constraint for `{}`", tcx.def_path_str(key) }
833 }
834
835 query adt_dtorck_constraint(
836 key: DefId
837 ) -> &'tcx DropckConstraint<'tcx> {
838 desc { |tcx| "computing drop-check constraints for `{}`", tcx.def_path_str(key) }
839 }
840
841 query constness(key: DefId) -> hir::Constness {
863 desc { |tcx| "checking if item is const: `{}`", tcx.def_path_str(key) }
864 separate_provide_extern
865 feedable
866 }
867
868 query asyncness(key: DefId) -> ty::Asyncness {
869 desc { |tcx| "checking if the function is async: `{}`", tcx.def_path_str(key) }
870 separate_provide_extern
871 }
872
873 query is_promotable_const_fn(key: DefId) -> bool {
881 desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) }
882 }
883
884 query coroutine_by_move_body_def_id(def_id: DefId) -> DefId {
891 desc { |tcx| "looking up the coroutine by-move body for `{}`", tcx.def_path_str(def_id) }
892 separate_provide_extern
893 }
894
895 query coroutine_kind(def_id: DefId) -> Option<hir::CoroutineKind> {
897 desc { |tcx| "looking up coroutine kind of `{}`", tcx.def_path_str(def_id) }
898 separate_provide_extern
899 feedable
900 }
901
902 query coroutine_for_closure(def_id: DefId) -> DefId {
903 desc { |_tcx| "Given a coroutine-closure def id, return the def id of the coroutine returned by it" }
904 separate_provide_extern
905 }
906
907 query crate_variances(_: ()) -> &'tcx ty::CrateVariancesMap<'tcx> {
915 arena_cache
916 desc { "computing the variances for items in this crate" }
917 }
918
919 query variances_of(def_id: DefId) -> &'tcx [ty::Variance] {
927 desc { |tcx| "computing the variances of `{}`", tcx.def_path_str(def_id) }
928 cache_on_disk_if { def_id.is_local() }
929 separate_provide_extern
930 cycle_delay_bug
931 }
932
933 query inferred_outlives_crate(_: ()) -> &'tcx ty::CratePredicatesMap<'tcx> {
941 arena_cache
942 desc { "computing the inferred outlives-predicates for items in this crate" }
943 }
944
945 query associated_item_def_ids(key: DefId) -> &'tcx [DefId] {
948 desc { |tcx| "collecting associated items or fields of `{}`", tcx.def_path_str(key) }
949 cache_on_disk_if { key.is_local() }
950 separate_provide_extern
951 }
952
953 query associated_item(key: DefId) -> ty::AssocItem {
955 desc { |tcx| "computing associated item data for `{}`", tcx.def_path_str(key) }
956 cache_on_disk_if { key.is_local() }
957 separate_provide_extern
958 feedable
959 }
960
961 query associated_items(key: DefId) -> &'tcx ty::AssocItems {
963 arena_cache
964 desc { |tcx| "collecting associated items of `{}`", tcx.def_path_str(key) }
965 }
966
967 query impl_item_implementor_ids(impl_id: DefId) -> &'tcx DefIdMap<DefId> {
989 arena_cache
990 desc { |tcx| "comparing impl items against trait for `{}`", tcx.def_path_str(impl_id) }
991 }
992
993 query associated_types_for_impl_traits_in_associated_fn(fn_def_id: DefId) -> &'tcx [DefId] {
1000 desc { |tcx| "creating associated items for opaque types returned by `{}`", tcx.def_path_str(fn_def_id) }
1001 cache_on_disk_if { fn_def_id.is_local() }
1002 separate_provide_extern
1003 }
1004
1005 query associated_type_for_impl_trait_in_trait(opaque_ty_def_id: LocalDefId) -> LocalDefId {
1008 desc { |tcx| "creating the associated item corresponding to the opaque type `{}`", tcx.def_path_str(opaque_ty_def_id.to_def_id()) }
1009 cache_on_disk_if { true }
1010 }
1011
1012 query impl_trait_header(impl_id: DefId) -> Option<ty::ImplTraitHeader<'tcx>> {
1015 desc { |tcx| "computing trait implemented by `{}`", tcx.def_path_str(impl_id) }
1016 cache_on_disk_if { impl_id.is_local() }
1017 separate_provide_extern
1018 }
1019
1020 query inherent_impls(key: DefId) -> &'tcx [DefId] {
1024 desc { |tcx| "collecting inherent impls for `{}`", tcx.def_path_str(key) }
1025 cache_on_disk_if { key.is_local() }
1026 separate_provide_extern
1027 }
1028
1029 query incoherent_impls(key: SimplifiedType) -> &'tcx [DefId] {
1030 desc { |tcx| "collecting all inherent impls for `{:?}`", key }
1031 }
1032
1033 query check_unsafety(key: LocalDefId) {
1035 desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key) }
1036 cache_on_disk_if { true }
1037 }
1038
1039 query check_tail_calls(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
1041 desc { |tcx| "tail-call-checking `{}`", tcx.def_path_str(key) }
1042 cache_on_disk_if { true }
1043 }
1044
1045 query assumed_wf_types(key: LocalDefId) -> &'tcx [(Ty<'tcx>, Span)] {
1050 desc { |tcx| "computing the implied bounds of `{}`", tcx.def_path_str(key) }
1051 }
1052
1053 query assumed_wf_types_for_rpitit(key: DefId) -> &'tcx [(Ty<'tcx>, Span)] {
1056 desc { |tcx| "computing the implied bounds of `{}`", tcx.def_path_str(key) }
1057 separate_provide_extern
1058 }
1059
1060 query fn_sig(key: DefId) -> ty::EarlyBinder<'tcx, ty::PolyFnSig<'tcx>> {
1062 desc { |tcx| "computing function signature of `{}`", tcx.def_path_str(key) }
1063 cache_on_disk_if { key.is_local() }
1064 separate_provide_extern
1065 cycle_delay_bug
1066 }
1067
1068 query lint_mod(key: LocalModDefId) {
1070 desc { |tcx| "linting {}", describe_as_module(key, tcx) }
1071 }
1072
1073 query check_unused_traits(_: ()) {
1074 desc { "checking unused trait imports in crate" }
1075 }
1076
1077 query check_mod_attrs(key: LocalModDefId) {
1079 desc { |tcx| "checking attributes in {}", describe_as_module(key, tcx) }
1080 }
1081
1082 query check_mod_unstable_api_usage(key: LocalModDefId) {
1084 desc { |tcx| "checking for unstable API usage in {}", describe_as_module(key, tcx) }
1085 }
1086
1087 query check_mod_loops(key: LocalModDefId) {
1089 desc { |tcx| "checking loops in {}", describe_as_module(key, tcx) }
1090 }
1091
1092 query check_mod_naked_functions(key: LocalModDefId) {
1093 desc { |tcx| "checking naked functions in {}", describe_as_module(key, tcx) }
1094 }
1095
1096 query check_mod_privacy(key: LocalModDefId) {
1097 desc { |tcx| "checking privacy in {}", describe_as_module(key.to_local_def_id(), tcx) }
1098 }
1099
1100 query check_liveness(key: LocalDefId) {
1101 desc { |tcx| "checking liveness of variables in `{}`", tcx.def_path_str(key) }
1102 }
1103
1104 query live_symbols_and_ignored_derived_traits(_: ()) -> &'tcx (
1109 LocalDefIdSet,
1110 LocalDefIdMap<Vec<(DefId, DefId)>>
1111 ) {
1112 arena_cache
1113 desc { "finding live symbols in crate" }
1114 }
1115
1116 query check_mod_deathness(key: LocalModDefId) {
1117 desc { |tcx| "checking deathness of variables in {}", describe_as_module(key, tcx) }
1118 }
1119
1120 query check_mod_type_wf(key: LocalModDefId) -> Result<(), ErrorGuaranteed> {
1121 desc { |tcx| "checking that types are well-formed in {}", describe_as_module(key, tcx) }
1122 return_result_from_ensure_ok
1123 }
1124
1125 query coerce_unsized_info(key: DefId) -> Result<ty::adjustment::CoerceUnsizedInfo, ErrorGuaranteed> {
1127 desc { |tcx| "computing CoerceUnsized info for `{}`", tcx.def_path_str(key) }
1128 cache_on_disk_if { key.is_local() }
1129 separate_provide_extern
1130 return_result_from_ensure_ok
1131 }
1132
1133 query typeck(key: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> {
1134 desc { |tcx| "type-checking `{}`", tcx.def_path_str(key) }
1135 cache_on_disk_if(tcx) { !tcx.is_typeck_child(key.to_def_id()) }
1136 }
1137
1138 query used_trait_imports(key: LocalDefId) -> &'tcx UnordSet<LocalDefId> {
1139 desc { |tcx| "finding used_trait_imports `{}`", tcx.def_path_str(key) }
1140 cache_on_disk_if { true }
1141 }
1142
1143 query coherent_trait(def_id: DefId) -> Result<(), ErrorGuaranteed> {
1144 desc { |tcx| "coherence checking all impls of trait `{}`", tcx.def_path_str(def_id) }
1145 return_result_from_ensure_ok
1146 }
1147
1148 query mir_borrowck(key: LocalDefId) -> &'tcx mir::BorrowCheckResult<'tcx> {
1151 desc { |tcx| "borrow-checking `{}`", tcx.def_path_str(key) }
1152 cache_on_disk_if(tcx) { tcx.is_typeck_child(key.to_def_id()) }
1153 }
1154
1155 query crate_inherent_impls(k: ()) -> (&'tcx CrateInherentImpls, Result<(), ErrorGuaranteed>) {
1163 desc { "finding all inherent impls defined in crate" }
1164 }
1165
1166 query crate_inherent_impls_validity_check(_: ()) -> Result<(), ErrorGuaranteed> {
1174 desc { "check for inherent impls that should not be defined in crate" }
1175 return_result_from_ensure_ok
1176 }
1177
1178 query crate_inherent_impls_overlap_check(_: ()) -> Result<(), ErrorGuaranteed> {
1186 desc { "check for overlap between inherent impls defined in this crate" }
1187 return_result_from_ensure_ok
1188 }
1189
1190 query orphan_check_impl(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1193 desc { |tcx|
1194 "checking whether impl `{}` follows the orphan rules",
1195 tcx.def_path_str(key),
1196 }
1197 return_result_from_ensure_ok
1198 }
1199
1200 query mir_callgraph_reachable(key: (ty::Instance<'tcx>, LocalDefId)) -> bool {
1203 fatal_cycle
1204 desc { |tcx|
1205 "computing if `{}` (transitively) calls `{}`",
1206 key.0,
1207 tcx.def_path_str(key.1),
1208 }
1209 }
1210
1211 query mir_inliner_callees(key: ty::InstanceKind<'tcx>) -> &'tcx [(DefId, GenericArgsRef<'tcx>)] {
1213 fatal_cycle
1214 desc { |tcx|
1215 "computing all local function calls in `{}`",
1216 tcx.def_path_str(key.def_id()),
1217 }
1218 }
1219
1220 query tag_for_variant(
1228 key: (Ty<'tcx>, abi::VariantIdx)
1229 ) -> Option<ty::ScalarInt> {
1230 desc { "computing variant tag for enum" }
1231 }
1232
1233 query eval_to_allocation_raw(key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>)
1242 -> EvalToAllocationRawResult<'tcx> {
1243 desc { |tcx|
1244 "const-evaluating + checking `{}`",
1245 key.value.display(tcx)
1246 }
1247 cache_on_disk_if { true }
1248 }
1249
1250 query eval_static_initializer(key: DefId) -> EvalStaticInitializerRawResult<'tcx> {
1252 desc { |tcx|
1253 "evaluating initializer of static `{}`",
1254 tcx.def_path_str(key)
1255 }
1256 cache_on_disk_if { key.is_local() }
1257 separate_provide_extern
1258 feedable
1259 }
1260
1261 query eval_to_const_value_raw(key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>)
1274 -> EvalToConstValueResult<'tcx> {
1275 desc { |tcx|
1276 "simplifying constant for the type system `{}`",
1277 key.value.display(tcx)
1278 }
1279 depth_limit
1280 cache_on_disk_if { true }
1281 }
1282
1283 query eval_to_valtree(
1286 key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>
1287 ) -> EvalToValTreeResult<'tcx> {
1288 desc { "evaluating type-level constant" }
1289 }
1290
1291 query valtree_to_const_val(key: ty::Value<'tcx>) -> mir::ConstValue<'tcx> {
1293 desc { "converting type-level constant value to MIR constant value"}
1294 }
1295
1296 query destructure_const(key: ty::Const<'tcx>) -> ty::DestructuredConst<'tcx> {
1299 desc { "destructuring type level constant"}
1300 }
1301
1302 query lit_to_const(
1304 key: LitToConstInput<'tcx>
1305 ) -> ty::Const<'tcx> {
1306 desc { "converting literal to const" }
1307 }
1308
1309 query check_match(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
1310 desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) }
1311 cache_on_disk_if { true }
1312 }
1313
1314 query effective_visibilities(_: ()) -> &'tcx EffectiveVisibilities {
1316 eval_always
1317 desc { "checking effective visibilities" }
1318 }
1319 query check_private_in_public(_: ()) {
1320 eval_always
1321 desc { "checking for private elements in public interfaces" }
1322 }
1323
1324 query reachable_set(_: ()) -> &'tcx LocalDefIdSet {
1325 arena_cache
1326 desc { "reachability" }
1327 cache_on_disk_if { true }
1328 }
1329
1330 query region_scope_tree(def_id: DefId) -> &'tcx crate::middle::region::ScopeTree {
1333 desc { |tcx| "computing drop scopes for `{}`", tcx.def_path_str(def_id) }
1334 }
1335
1336 query mir_shims(key: ty::InstanceKind<'tcx>) -> &'tcx mir::Body<'tcx> {
1338 arena_cache
1339 desc { |tcx| "generating MIR shim for `{}`", tcx.def_path_str(key.def_id()) }
1340 }
1341
1342 query symbol_name(key: ty::Instance<'tcx>) -> ty::SymbolName<'tcx> {
1346 desc { "computing the symbol for `{}`", key }
1347 cache_on_disk_if { true }
1348 }
1349
1350 query def_kind(def_id: DefId) -> DefKind {
1351 desc { |tcx| "looking up definition kind of `{}`", tcx.def_path_str(def_id) }
1352 cache_on_disk_if { def_id.is_local() }
1353 separate_provide_extern
1354 feedable
1355 }
1356
1357 query def_span(def_id: DefId) -> Span {
1359 desc { |tcx| "looking up span for `{}`", tcx.def_path_str(def_id) }
1360 cache_on_disk_if { def_id.is_local() }
1361 separate_provide_extern
1362 feedable
1363 }
1364
1365 query def_ident_span(def_id: DefId) -> Option<Span> {
1367 desc { |tcx| "looking up span for `{}`'s identifier", tcx.def_path_str(def_id) }
1368 cache_on_disk_if { def_id.is_local() }
1369 separate_provide_extern
1370 feedable
1371 }
1372
1373 query lookup_stability(def_id: DefId) -> Option<attr::Stability> {
1374 desc { |tcx| "looking up stability of `{}`", tcx.def_path_str(def_id) }
1375 cache_on_disk_if { def_id.is_local() }
1376 separate_provide_extern
1377 }
1378
1379 query lookup_const_stability(def_id: DefId) -> Option<attr::ConstStability> {
1380 desc { |tcx| "looking up const stability of `{}`", tcx.def_path_str(def_id) }
1381 cache_on_disk_if { def_id.is_local() }
1382 separate_provide_extern
1383 }
1384
1385 query lookup_default_body_stability(def_id: DefId) -> Option<attr::DefaultBodyStability> {
1386 desc { |tcx| "looking up default body stability of `{}`", tcx.def_path_str(def_id) }
1387 separate_provide_extern
1388 }
1389
1390 query should_inherit_track_caller(def_id: DefId) -> bool {
1391 desc { |tcx| "computing should_inherit_track_caller of `{}`", tcx.def_path_str(def_id) }
1392 }
1393
1394 query lookup_deprecation_entry(def_id: DefId) -> Option<DeprecationEntry> {
1395 desc { |tcx| "checking whether `{}` is deprecated", tcx.def_path_str(def_id) }
1396 cache_on_disk_if { def_id.is_local() }
1397 separate_provide_extern
1398 }
1399
1400 query is_doc_hidden(def_id: DefId) -> bool {
1402 desc { |tcx| "checking whether `{}` is `doc(hidden)`", tcx.def_path_str(def_id) }
1403 separate_provide_extern
1404 }
1405
1406 query is_doc_notable_trait(def_id: DefId) -> bool {
1408 desc { |tcx| "checking whether `{}` is `doc(notable_trait)`", tcx.def_path_str(def_id) }
1409 }
1410
1411 query attrs_for_def(def_id: DefId) -> &'tcx [hir::Attribute] {
1415 desc { |tcx| "collecting attributes of `{}`", tcx.def_path_str(def_id) }
1416 separate_provide_extern
1417 }
1418
1419 query codegen_fn_attrs(def_id: DefId) -> &'tcx CodegenFnAttrs {
1420 desc { |tcx| "computing codegen attributes of `{}`", tcx.def_path_str(def_id) }
1421 arena_cache
1422 cache_on_disk_if { def_id.is_local() }
1423 separate_provide_extern
1424 feedable
1425 }
1426
1427 query asm_target_features(def_id: DefId) -> &'tcx FxIndexSet<Symbol> {
1428 desc { |tcx| "computing target features for inline asm of `{}`", tcx.def_path_str(def_id) }
1429 }
1430
1431 query fn_arg_names(def_id: DefId) -> &'tcx [Option<rustc_span::Ident>] {
1432 desc { |tcx| "looking up function parameter names for `{}`", tcx.def_path_str(def_id) }
1433 separate_provide_extern
1434 }
1435
1436 query rendered_const(def_id: DefId) -> &'tcx String {
1439 arena_cache
1440 desc { |tcx| "rendering constant initializer of `{}`", tcx.def_path_str(def_id) }
1441 separate_provide_extern
1442 }
1443
1444 query rendered_precise_capturing_args(def_id: DefId) -> Option<&'tcx [PreciseCapturingArgKind<Symbol, Symbol>]> {
1446 desc { |tcx| "rendering precise capturing args for `{}`", tcx.def_path_str(def_id) }
1447 separate_provide_extern
1448 }
1449
1450 query impl_parent(def_id: DefId) -> Option<DefId> {
1451 desc { |tcx| "computing specialization parent impl of `{}`", tcx.def_path_str(def_id) }
1452 separate_provide_extern
1453 }
1454
1455 query is_ctfe_mir_available(key: DefId) -> bool {
1456 desc { |tcx| "checking if item has CTFE MIR available: `{}`", tcx.def_path_str(key) }
1457 cache_on_disk_if { key.is_local() }
1458 separate_provide_extern
1459 }
1460 query is_mir_available(key: DefId) -> bool {
1461 desc { |tcx| "checking if item has MIR available: `{}`", tcx.def_path_str(key) }
1462 cache_on_disk_if { key.is_local() }
1463 separate_provide_extern
1464 }
1465
1466 query own_existential_vtable_entries(
1467 key: DefId
1468 ) -> &'tcx [DefId] {
1469 desc { |tcx| "finding all existential vtable entries for trait `{}`", tcx.def_path_str(key) }
1470 }
1471
1472 query vtable_entries(key: ty::TraitRef<'tcx>)
1473 -> &'tcx [ty::VtblEntry<'tcx>] {
1474 desc { |tcx| "finding all vtable entries for trait `{}`", tcx.def_path_str(key.def_id) }
1475 }
1476
1477 query first_method_vtable_slot(key: ty::TraitRef<'tcx>) -> usize {
1478 desc { |tcx| "finding the slot within the vtable of `{}` for the implementation of `{}`", key.self_ty(), key.print_only_trait_name() }
1479 }
1480
1481 query supertrait_vtable_slot(key: (Ty<'tcx>, Ty<'tcx>)) -> Option<usize> {
1482 desc { |tcx| "finding the slot within vtable for trait object `{}` vtable ptr during trait upcasting coercion from `{}` vtable",
1483 key.1, key.0 }
1484 }
1485
1486 query vtable_allocation(key: (Ty<'tcx>, Option<ty::ExistentialTraitRef<'tcx>>)) -> mir::interpret::AllocId {
1487 desc { |tcx| "vtable const allocation for <{} as {}>",
1488 key.0,
1489 key.1.map(|trait_ref| format!("{trait_ref}")).unwrap_or("_".to_owned())
1490 }
1491 }
1492
1493 query codegen_select_candidate(
1494 key: PseudoCanonicalInput<'tcx, ty::TraitRef<'tcx>>
1495 ) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
1496 cache_on_disk_if { true }
1497 desc { |tcx| "computing candidate for `{}`", key.value }
1498 }
1499
1500 query all_local_trait_impls(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexMap<DefId, Vec<LocalDefId>> {
1502 desc { "finding local trait impls" }
1503 }
1504
1505 query trait_impls_of(trait_id: DefId) -> &'tcx ty::trait_def::TraitImpls {
1507 arena_cache
1508 desc { |tcx| "finding trait impls of `{}`", tcx.def_path_str(trait_id) }
1509 }
1510
1511 query specialization_graph_of(trait_id: DefId) -> Result<&'tcx specialization_graph::Graph, ErrorGuaranteed> {
1512 desc { |tcx| "building specialization graph of trait `{}`", tcx.def_path_str(trait_id) }
1513 cache_on_disk_if { true }
1514 return_result_from_ensure_ok
1515 }
1516 query dyn_compatibility_violations(trait_id: DefId) -> &'tcx [DynCompatibilityViolation] {
1517 desc { |tcx| "determining dyn-compatibility of trait `{}`", tcx.def_path_str(trait_id) }
1518 }
1519 query is_dyn_compatible(trait_id: DefId) -> bool {
1520 desc { |tcx| "checking if trait `{}` is dyn-compatible", tcx.def_path_str(trait_id) }
1521 }
1522
1523 query param_env(def_id: DefId) -> ty::ParamEnv<'tcx> {
1532 desc { |tcx| "computing normalized predicates of `{}`", tcx.def_path_str(def_id) }
1533 feedable
1534 }
1535
1536 query param_env_normalized_for_post_analysis(def_id: DefId) -> ty::ParamEnv<'tcx> {
1540 desc { |tcx| "computing revealed normalized predicates of `{}`", tcx.def_path_str(def_id) }
1541 }
1542
1543 query is_copy_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1546 desc { "computing whether `{}` is `Copy`", env.value }
1547 }
1548 query is_use_cloned_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1551 desc { "computing whether `{}` is `UseCloned`", env.value }
1552 }
1553 query is_sized_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1555 desc { "computing whether `{}` is `Sized`", env.value }
1556 }
1557 query is_freeze_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1559 desc { "computing whether `{}` is freeze", env.value }
1560 }
1561 query is_unpin_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1563 desc { "computing whether `{}` is `Unpin`", env.value }
1564 }
1565 query needs_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1567 desc { "computing whether `{}` needs drop", env.value }
1568 }
1569 query needs_async_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1571 desc { "computing whether `{}` needs async drop", env.value }
1572 }
1573 query has_significant_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1575 desc { "computing whether `{}` has a significant drop", env.value }
1576 }
1577
1578 query has_structural_eq_impl(ty: Ty<'tcx>) -> bool {
1583 desc {
1584 "computing whether `{}` implements `StructuralPartialEq`",
1585 ty
1586 }
1587 }
1588
1589 query adt_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1593 desc { |tcx| "computing when `{}` needs drop", tcx.def_path_str(def_id) }
1594 cache_on_disk_if { true }
1595 }
1596
1597 query adt_significant_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1604 desc { |tcx| "computing when `{}` has a significant destructor", tcx.def_path_str(def_id) }
1605 cache_on_disk_if { false }
1606 }
1607
1608 query list_significant_drop_tys(ty: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> &'tcx ty::List<Ty<'tcx>> {
1626 desc { |tcx| "computing when `{}` has a significant destructor", ty.value }
1627 cache_on_disk_if { false }
1628 }
1629
1630 query layout_of(
1633 key: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>
1634 ) -> Result<ty::layout::TyAndLayout<'tcx>, &'tcx ty::layout::LayoutError<'tcx>> {
1635 depth_limit
1636 desc { "computing layout of `{}`", key.value }
1637 cycle_delay_bug
1639 }
1640
1641 query fn_abi_of_fn_ptr(
1646 key: ty::PseudoCanonicalInput<'tcx, (ty::PolyFnSig<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
1647 ) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
1648 desc { "computing call ABI of `{}` function pointers", key.value.0 }
1649 }
1650
1651 query fn_abi_of_instance(
1657 key: ty::PseudoCanonicalInput<'tcx, (ty::Instance<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
1658 ) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
1659 desc { "computing call ABI of `{}`", key.value.0 }
1660 }
1661
1662 query dylib_dependency_formats(_: CrateNum)
1663 -> &'tcx [(CrateNum, LinkagePreference)] {
1664 desc { "getting dylib dependency formats of crate" }
1665 separate_provide_extern
1666 }
1667
1668 query dependency_formats(_: ()) -> &'tcx Arc<crate::middle::dependency_format::Dependencies> {
1669 arena_cache
1670 desc { "getting the linkage format of all dependencies" }
1671 }
1672
1673 query is_compiler_builtins(_: CrateNum) -> bool {
1674 fatal_cycle
1675 desc { "checking if the crate is_compiler_builtins" }
1676 separate_provide_extern
1677 }
1678 query has_global_allocator(_: CrateNum) -> bool {
1679 eval_always
1681 fatal_cycle
1682 desc { "checking if the crate has_global_allocator" }
1683 separate_provide_extern
1684 }
1685 query has_alloc_error_handler(_: CrateNum) -> bool {
1686 eval_always
1688 fatal_cycle
1689 desc { "checking if the crate has_alloc_error_handler" }
1690 separate_provide_extern
1691 }
1692 query has_panic_handler(_: CrateNum) -> bool {
1693 fatal_cycle
1694 desc { "checking if the crate has_panic_handler" }
1695 separate_provide_extern
1696 }
1697 query is_profiler_runtime(_: CrateNum) -> bool {
1698 fatal_cycle
1699 desc { "checking if a crate is `#![profiler_runtime]`" }
1700 separate_provide_extern
1701 }
1702 query has_ffi_unwind_calls(key: LocalDefId) -> bool {
1703 desc { |tcx| "checking if `{}` contains FFI-unwind calls", tcx.def_path_str(key) }
1704 cache_on_disk_if { true }
1705 }
1706 query required_panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
1707 fatal_cycle
1708 desc { "getting a crate's required panic strategy" }
1709 separate_provide_extern
1710 }
1711 query panic_in_drop_strategy(_: CrateNum) -> PanicStrategy {
1712 fatal_cycle
1713 desc { "getting a crate's configured panic-in-drop strategy" }
1714 separate_provide_extern
1715 }
1716 query is_no_builtins(_: CrateNum) -> bool {
1717 fatal_cycle
1718 desc { "getting whether a crate has `#![no_builtins]`" }
1719 separate_provide_extern
1720 }
1721 query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
1722 fatal_cycle
1723 desc { "getting a crate's symbol mangling version" }
1724 separate_provide_extern
1725 }
1726
1727 query extern_crate(def_id: CrateNum) -> Option<&'tcx ExternCrate> {
1728 eval_always
1729 desc { "getting crate's ExternCrateData" }
1730 separate_provide_extern
1731 }
1732
1733 query specialization_enabled_in(cnum: CrateNum) -> bool {
1734 desc { "checking whether the crate enabled `specialization`/`min_specialization`" }
1735 separate_provide_extern
1736 }
1737
1738 query specializes(_: (DefId, DefId)) -> bool {
1739 desc { "computing whether impls specialize one another" }
1740 }
1741 query in_scope_traits_map(_: hir::OwnerId)
1742 -> Option<&'tcx ItemLocalMap<Box<[TraitCandidate]>>> {
1743 desc { "getting traits in scope at a block" }
1744 }
1745
1746 query defaultness(def_id: DefId) -> hir::Defaultness {
1748 desc { |tcx| "looking up whether `{}` has `default`", tcx.def_path_str(def_id) }
1749 separate_provide_extern
1750 feedable
1751 }
1752
1753 query check_well_formed(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1754 desc { |tcx| "checking that `{}` is well-formed", tcx.def_path_str(key) }
1755 return_result_from_ensure_ok
1756 }
1757
1758 query enforce_impl_non_lifetime_params_are_constrained(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1759 desc { |tcx| "checking that `{}`'s generics are constrained by the impl header", tcx.def_path_str(key) }
1760 return_result_from_ensure_ok
1761 }
1762
1763 query reachable_non_generics(_: CrateNum)
1776 -> &'tcx DefIdMap<SymbolExportInfo> {
1777 arena_cache
1778 desc { "looking up the exported symbols of a crate" }
1779 separate_provide_extern
1780 }
1781 query is_reachable_non_generic(def_id: DefId) -> bool {
1782 desc { |tcx| "checking whether `{}` is an exported symbol", tcx.def_path_str(def_id) }
1783 cache_on_disk_if { def_id.is_local() }
1784 separate_provide_extern
1785 }
1786 query is_unreachable_local_definition(def_id: LocalDefId) -> bool {
1787 desc { |tcx|
1788 "checking whether `{}` is reachable from outside the crate",
1789 tcx.def_path_str(def_id),
1790 }
1791 }
1792
1793 query upstream_monomorphizations(_: ()) -> &'tcx DefIdMap<UnordMap<GenericArgsRef<'tcx>, CrateNum>> {
1801 arena_cache
1802 desc { "collecting available upstream monomorphizations" }
1803 }
1804
1805 query upstream_monomorphizations_for(def_id: DefId)
1813 -> Option<&'tcx UnordMap<GenericArgsRef<'tcx>, CrateNum>>
1814 {
1815 desc { |tcx|
1816 "collecting available upstream monomorphizations for `{}`",
1817 tcx.def_path_str(def_id),
1818 }
1819 separate_provide_extern
1820 }
1821
1822 query upstream_drop_glue_for(args: GenericArgsRef<'tcx>) -> Option<CrateNum> {
1838 desc { "available upstream drop-glue for `{:?}`", args }
1839 }
1840
1841 query upstream_async_drop_glue_for(args: GenericArgsRef<'tcx>) -> Option<CrateNum> {
1858 desc { "available upstream async-drop-glue for `{:?}`", args }
1859 }
1860
1861 query foreign_modules(_: CrateNum) -> &'tcx FxIndexMap<DefId, ForeignModule> {
1863 arena_cache
1864 desc { "looking up the foreign modules of a linked crate" }
1865 separate_provide_extern
1866 }
1867
1868 query clashing_extern_declarations(_: ()) {
1870 desc { "checking `extern fn` declarations are compatible" }
1871 }
1872
1873 query entry_fn(_: ()) -> Option<(DefId, EntryFnType)> {
1876 desc { "looking up the entry function of a crate" }
1877 }
1878
1879 query proc_macro_decls_static(_: ()) -> Option<LocalDefId> {
1881 desc { "looking up the proc macro declarations for a crate" }
1882 }
1883
1884 query crate_hash(_: CrateNum) -> Svh {
1887 eval_always
1888 desc { "looking up the hash a crate" }
1889 separate_provide_extern
1890 }
1891
1892 query crate_host_hash(_: CrateNum) -> Option<Svh> {
1894 eval_always
1895 desc { "looking up the hash of a host version of a crate" }
1896 separate_provide_extern
1897 }
1898
1899 query extra_filename(_: CrateNum) -> &'tcx String {
1902 arena_cache
1903 eval_always
1904 desc { "looking up the extra filename for a crate" }
1905 separate_provide_extern
1906 }
1907
1908 query crate_extern_paths(_: CrateNum) -> &'tcx Vec<PathBuf> {
1910 arena_cache
1911 eval_always
1912 desc { "looking up the paths for extern crates" }
1913 separate_provide_extern
1914 }
1915
1916 query implementations_of_trait(_: (CrateNum, DefId)) -> &'tcx [(DefId, Option<SimplifiedType>)] {
1919 desc { "looking up implementations of a trait in a crate" }
1920 separate_provide_extern
1921 }
1922
1923 query crate_incoherent_impls(key: (CrateNum, SimplifiedType)) -> &'tcx [DefId] {
1928 desc { |tcx| "collecting all impls for a type in a crate" }
1929 separate_provide_extern
1930 }
1931
1932 query native_library(def_id: DefId) -> Option<&'tcx NativeLib> {
1934 desc { |tcx| "getting the native library for `{}`", tcx.def_path_str(def_id) }
1935 }
1936
1937 query inherit_sig_for_delegation_item(def_id: LocalDefId) -> &'tcx [Ty<'tcx>] {
1938 desc { "inheriting delegation signature" }
1939 }
1940
1941 query resolve_bound_vars(owner_id: hir::OwnerId) -> &'tcx ResolveBoundVars {
1945 arena_cache
1946 desc { |tcx| "resolving lifetimes for `{}`", tcx.def_path_str(owner_id) }
1947 }
1948 query named_variable_map(owner_id: hir::OwnerId) -> &'tcx SortedMap<ItemLocalId, ResolvedArg> {
1949 desc { |tcx| "looking up a named region inside `{}`", tcx.def_path_str(owner_id) }
1950 }
1951 query is_late_bound_map(owner_id: hir::OwnerId) -> Option<&'tcx FxIndexSet<ItemLocalId>> {
1952 desc { |tcx| "testing if a region is late bound inside `{}`", tcx.def_path_str(owner_id) }
1953 }
1954 query object_lifetime_default(def_id: DefId) -> ObjectLifetimeDefault {
1969 desc { "looking up lifetime defaults for type parameter `{}`", tcx.def_path_str(def_id) }
1970 separate_provide_extern
1971 }
1972 query late_bound_vars_map(owner_id: hir::OwnerId)
1973 -> &'tcx SortedMap<ItemLocalId, Vec<ty::BoundVariableKind>> {
1974 desc { |tcx| "looking up late bound vars inside `{}`", tcx.def_path_str(owner_id) }
1975 }
1976 query opaque_captured_lifetimes(def_id: LocalDefId) -> &'tcx [(ResolvedArg, LocalDefId)] {
1991 desc { |tcx| "listing captured lifetimes for opaque `{}`", tcx.def_path_str(def_id) }
1992 }
1993
1994 query visibility(def_id: DefId) -> ty::Visibility<DefId> {
2007 desc { |tcx| "computing visibility of `{}`", tcx.def_path_str(def_id) }
2008 separate_provide_extern
2009 feedable
2010 }
2011
2012 query inhabited_predicate_adt(key: DefId) -> ty::inhabitedness::InhabitedPredicate<'tcx> {
2013 desc { "computing the uninhabited predicate of `{:?}`", key }
2014 }
2015
2016 query inhabited_predicate_type(key: Ty<'tcx>) -> ty::inhabitedness::InhabitedPredicate<'tcx> {
2018 desc { "computing the uninhabited predicate of `{}`", key }
2019 }
2020
2021 query dep_kind(_: CrateNum) -> CrateDepKind {
2022 eval_always
2023 desc { "fetching what a dependency looks like" }
2024 separate_provide_extern
2025 }
2026
2027 query crate_name(_: CrateNum) -> Symbol {
2029 feedable
2030 desc { "fetching what a crate is named" }
2031 separate_provide_extern
2032 }
2033 query module_children(def_id: DefId) -> &'tcx [ModChild] {
2034 desc { |tcx| "collecting child items of module `{}`", tcx.def_path_str(def_id) }
2035 separate_provide_extern
2036 }
2037 query extern_mod_stmt_cnum(def_id: LocalDefId) -> Option<CrateNum> {
2038 desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id) }
2039 }
2040
2041 query num_extern_def_ids(_: CrateNum) -> usize {
2047 desc { "fetching the number of definitions in a crate" }
2048 separate_provide_extern
2049 }
2050
2051 query lib_features(_: CrateNum) -> &'tcx LibFeatures {
2052 desc { "calculating the lib features defined in a crate" }
2053 separate_provide_extern
2054 arena_cache
2055 }
2056 query stability_implications(_: CrateNum) -> &'tcx UnordMap<Symbol, Symbol> {
2057 arena_cache
2058 desc { "calculating the implications between `#[unstable]` features defined in a crate" }
2059 separate_provide_extern
2060 }
2061 query intrinsic_raw(def_id: DefId) -> Option<rustc_middle::ty::IntrinsicDef> {
2063 desc { |tcx| "fetch intrinsic name if `{}` is an intrinsic", tcx.def_path_str(def_id) }
2064 separate_provide_extern
2065 }
2066 query get_lang_items(_: ()) -> &'tcx LanguageItems {
2068 arena_cache
2069 eval_always
2070 desc { "calculating the lang items map" }
2071 }
2072
2073 query all_diagnostic_items(_: ()) -> &'tcx rustc_hir::diagnostic_items::DiagnosticItems {
2075 arena_cache
2076 eval_always
2077 desc { "calculating the diagnostic items map" }
2078 }
2079
2080 query defined_lang_items(_: CrateNum) -> &'tcx [(DefId, LangItem)] {
2082 desc { "calculating the lang items defined in a crate" }
2083 separate_provide_extern
2084 }
2085
2086 query diagnostic_items(_: CrateNum) -> &'tcx rustc_hir::diagnostic_items::DiagnosticItems {
2088 arena_cache
2089 desc { "calculating the diagnostic items map in a crate" }
2090 separate_provide_extern
2091 }
2092
2093 query missing_lang_items(_: CrateNum) -> &'tcx [LangItem] {
2094 desc { "calculating the missing lang items in a crate" }
2095 separate_provide_extern
2096 }
2097
2098 query visible_parent_map(_: ()) -> &'tcx DefIdMap<DefId> {
2103 arena_cache
2104 desc { "calculating the visible parent map" }
2105 }
2106 query trimmed_def_paths(_: ()) -> &'tcx DefIdMap<Symbol> {
2109 arena_cache
2110 desc { "calculating trimmed def paths" }
2111 }
2112 query missing_extern_crate_item(_: CrateNum) -> bool {
2113 eval_always
2114 desc { "seeing if we're missing an `extern crate` item for this crate" }
2115 separate_provide_extern
2116 }
2117 query used_crate_source(_: CrateNum) -> &'tcx Arc<CrateSource> {
2118 arena_cache
2119 eval_always
2120 desc { "looking at the source for a crate" }
2121 separate_provide_extern
2122 }
2123
2124 query debugger_visualizers(_: CrateNum) -> &'tcx Vec<DebuggerVisualizerFile> {
2129 arena_cache
2130 desc { "looking up the debugger visualizers for this crate" }
2131 separate_provide_extern
2132 eval_always
2133 }
2134
2135 query postorder_cnums(_: ()) -> &'tcx [CrateNum] {
2136 eval_always
2137 desc { "generating a postorder list of CrateNums" }
2138 }
2139 query is_private_dep(c: CrateNum) -> bool {
2142 eval_always
2143 desc { "checking whether crate `{}` is a private dependency", c }
2144 separate_provide_extern
2145 }
2146 query allocator_kind(_: ()) -> Option<AllocatorKind> {
2147 eval_always
2148 desc { "getting the allocator kind for the current crate" }
2149 }
2150 query alloc_error_handler_kind(_: ()) -> Option<AllocatorKind> {
2151 eval_always
2152 desc { "alloc error handler kind for the current crate" }
2153 }
2154
2155 query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
2156 desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }
2157 }
2158 query maybe_unused_trait_imports(_: ()) -> &'tcx FxIndexSet<LocalDefId> {
2159 desc { "fetching potentially unused trait imports" }
2160 }
2161 query names_imported_by_glob_use(def_id: LocalDefId) -> &'tcx UnordSet<Symbol> {
2162 desc { |tcx| "finding names imported by glob use for `{}`", tcx.def_path_str(def_id) }
2163 }
2164
2165 query stability_index(_: ()) -> &'tcx stability::Index {
2166 arena_cache
2167 eval_always
2168 desc { "calculating the stability index for the local crate" }
2169 }
2170 query crates(_: ()) -> &'tcx [CrateNum] {
2173 eval_always
2174 desc { "fetching all foreign CrateNum instances" }
2175 }
2176 query used_crates(_: ()) -> &'tcx [CrateNum] {
2180 eval_always
2181 desc { "fetching `CrateNum`s for all crates loaded non-speculatively" }
2182 }
2183
2184 query traits(_: CrateNum) -> &'tcx [DefId] {
2186 desc { "fetching all traits in a crate" }
2187 separate_provide_extern
2188 }
2189
2190 query trait_impls_in_crate(_: CrateNum) -> &'tcx [DefId] {
2191 desc { "fetching all trait impls in a crate" }
2192 separate_provide_extern
2193 }
2194
2195 query exported_symbols(cnum: CrateNum) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportInfo)] {
2201 desc { "collecting exported symbols for crate `{}`", cnum}
2202 cache_on_disk_if { *cnum == LOCAL_CRATE }
2203 separate_provide_extern
2204 }
2205
2206 query collect_and_partition_mono_items(_: ()) -> MonoItemPartitions<'tcx> {
2207 eval_always
2208 desc { "collect_and_partition_mono_items" }
2209 }
2210
2211 query is_codegened_item(def_id: DefId) -> bool {
2212 desc { |tcx| "determining whether `{}` needs codegen", tcx.def_path_str(def_id) }
2213 }
2214
2215 query codegen_unit(sym: Symbol) -> &'tcx CodegenUnit<'tcx> {
2216 desc { "getting codegen unit `{sym}`" }
2217 }
2218
2219 query backend_optimization_level(_: ()) -> OptLevel {
2220 desc { "optimization level used by backend" }
2221 }
2222
2223 query output_filenames(_: ()) -> &'tcx Arc<OutputFilenames> {
2228 feedable
2229 desc { "getting output filenames" }
2230 arena_cache
2231 }
2232
2233 query normalize_canonicalized_projection_ty(
2239 goal: CanonicalAliasGoal<'tcx>
2240 ) -> Result<
2241 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2242 NoSolution,
2243 > {
2244 desc { "normalizing `{}`", goal.canonical.value.value }
2245 }
2246
2247 query normalize_canonicalized_weak_ty(
2253 goal: CanonicalAliasGoal<'tcx>
2254 ) -> Result<
2255 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2256 NoSolution,
2257 > {
2258 desc { "normalizing `{}`", goal.canonical.value.value }
2259 }
2260
2261 query normalize_canonicalized_inherent_projection_ty(
2267 goal: CanonicalAliasGoal<'tcx>
2268 ) -> Result<
2269 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2270 NoSolution,
2271 > {
2272 desc { "normalizing `{}`", goal.canonical.value.value }
2273 }
2274
2275 query try_normalize_generic_arg_after_erasing_regions(
2277 goal: PseudoCanonicalInput<'tcx, GenericArg<'tcx>>
2278 ) -> Result<GenericArg<'tcx>, NoSolution> {
2279 desc { "normalizing `{}`", goal.value }
2280 }
2281
2282 query implied_outlives_bounds(
2283 key: (CanonicalImpliedOutlivesBoundsGoal<'tcx>, bool)
2284 ) -> Result<
2285 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>,
2286 NoSolution,
2287 > {
2288 desc { "computing implied outlives bounds for `{}` (hack disabled = {:?})", key.0.canonical.value.value.ty, key.1 }
2289 }
2290
2291 query dropck_outlives(
2294 goal: CanonicalDropckOutlivesGoal<'tcx>
2295 ) -> Result<
2296 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>,
2297 NoSolution,
2298 > {
2299 desc { "computing dropck types for `{}`", goal.canonical.value.value.dropped_ty }
2300 }
2301
2302 query evaluate_obligation(
2305 goal: CanonicalPredicateGoal<'tcx>
2306 ) -> Result<EvaluationResult, OverflowError> {
2307 desc { "evaluating trait selection obligation `{}`", goal.canonical.value.value }
2308 }
2309
2310 query type_op_ascribe_user_type(
2312 goal: CanonicalTypeOpAscribeUserTypeGoal<'tcx>
2313 ) -> Result<
2314 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
2315 NoSolution,
2316 > {
2317 desc { "evaluating `type_op_ascribe_user_type` `{:?}`", goal.canonical.value.value }
2318 }
2319
2320 query type_op_prove_predicate(
2322 goal: CanonicalTypeOpProvePredicateGoal<'tcx>
2323 ) -> Result<
2324 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
2325 NoSolution,
2326 > {
2327 desc { "evaluating `type_op_prove_predicate` `{:?}`", goal.canonical.value.value }
2328 }
2329
2330 query type_op_normalize_ty(
2332 goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>
2333 ) -> Result<
2334 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Ty<'tcx>>>,
2335 NoSolution,
2336 > {
2337 desc { "normalizing `{}`", goal.canonical.value.value.value }
2338 }
2339
2340 query type_op_normalize_clause(
2342 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::Clause<'tcx>>
2343 ) -> Result<
2344 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::Clause<'tcx>>>,
2345 NoSolution,
2346 > {
2347 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2348 }
2349
2350 query type_op_normalize_poly_fn_sig(
2352 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::PolyFnSig<'tcx>>
2353 ) -> Result<
2354 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::PolyFnSig<'tcx>>>,
2355 NoSolution,
2356 > {
2357 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2358 }
2359
2360 query type_op_normalize_fn_sig(
2362 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>
2363 ) -> Result<
2364 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::FnSig<'tcx>>>,
2365 NoSolution,
2366 > {
2367 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2368 }
2369
2370 query instantiate_and_check_impossible_predicates(key: (DefId, GenericArgsRef<'tcx>)) -> bool {
2371 desc { |tcx|
2372 "checking impossible instantiated predicates: `{}`",
2373 tcx.def_path_str(key.0)
2374 }
2375 }
2376
2377 query is_impossible_associated_item(key: (DefId, DefId)) -> bool {
2378 desc { |tcx|
2379 "checking if `{}` is impossible to reference within `{}`",
2380 tcx.def_path_str(key.1),
2381 tcx.def_path_str(key.0),
2382 }
2383 }
2384
2385 query method_autoderef_steps(
2386 goal: CanonicalTyGoal<'tcx>
2387 ) -> MethodAutoderefStepsResult<'tcx> {
2388 desc { "computing autoderef types for `{}`", goal.canonical.value.value }
2389 }
2390
2391 query rust_target_features(_: CrateNum) -> &'tcx UnordMap<String, rustc_target::target_features::Stability> {
2393 arena_cache
2394 eval_always
2395 desc { "looking up Rust target features" }
2396 }
2397
2398 query implied_target_features(feature: Symbol) -> &'tcx Vec<Symbol> {
2399 arena_cache
2400 eval_always
2401 desc { "looking up implied target features" }
2402 }
2403
2404 query features_query(_: ()) -> &'tcx rustc_feature::Features {
2405 feedable
2406 desc { "looking up enabled feature gates" }
2407 }
2408
2409 query crate_for_resolver((): ()) -> &'tcx Steal<(rustc_ast::Crate, rustc_ast::AttrVec)> {
2410 feedable
2411 no_hash
2412 desc { "the ast before macro expansion and name resolution" }
2413 }
2414
2415 query resolve_instance_raw(
2425 key: ty::PseudoCanonicalInput<'tcx, (DefId, GenericArgsRef<'tcx>)>
2426 ) -> Result<Option<ty::Instance<'tcx>>, ErrorGuaranteed> {
2427 desc { "resolving instance `{}`", ty::Instance::new(key.value.0, key.value.1) }
2428 }
2429
2430 query reveal_opaque_types_in_bounds(key: ty::Clauses<'tcx>) -> ty::Clauses<'tcx> {
2431 desc { "revealing opaque types in `{:?}`", key }
2432 }
2433
2434 query limits(key: ()) -> Limits {
2435 desc { "looking up limits" }
2436 }
2437
2438 query diagnostic_hir_wf_check(
2447 key: (ty::Predicate<'tcx>, WellFormedLoc)
2448 ) -> Option<&'tcx ObligationCause<'tcx>> {
2449 arena_cache
2450 eval_always
2451 no_hash
2452 desc { "performing HIR wf-checking for predicate `{:?}` at item `{:?}`", key.0, key.1 }
2453 }
2454
2455 query global_backend_features(_: ()) -> &'tcx Vec<String> {
2458 arena_cache
2459 eval_always
2460 desc { "computing the backend features for CLI flags" }
2461 }
2462
2463 query check_validity_requirement(key: (ValidityRequirement, ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>)) -> Result<bool, &'tcx ty::layout::LayoutError<'tcx>> {
2464 desc { "checking validity requirement for `{}`: {}", key.1.value, key.0 }
2465 }
2466
2467 query compare_impl_item(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
2472 desc { |tcx| "checking assoc item `{}` is compatible with trait definition", tcx.def_path_str(key) }
2473 return_result_from_ensure_ok
2474 }
2475
2476 query deduced_param_attrs(def_id: DefId) -> &'tcx [ty::DeducedParamAttrs] {
2477 desc { |tcx| "deducing parameter attributes for {}", tcx.def_path_str(def_id) }
2478 separate_provide_extern
2479 }
2480
2481 query doc_link_resolutions(def_id: DefId) -> &'tcx DocLinkResMap {
2482 eval_always
2483 desc { "resolutions for documentation links for a module" }
2484 separate_provide_extern
2485 }
2486
2487 query doc_link_traits_in_scope(def_id: DefId) -> &'tcx [DefId] {
2488 eval_always
2489 desc { "traits in scope for documentation links for a module" }
2490 separate_provide_extern
2491 }
2492
2493 query stripped_cfg_items(cnum: CrateNum) -> &'tcx [StrippedCfgItem] {
2497 desc { "getting cfg-ed out item names" }
2498 separate_provide_extern
2499 }
2500
2501 query generics_require_sized_self(def_id: DefId) -> bool {
2502 desc { "check whether the item has a `where Self: Sized` bound" }
2503 }
2504
2505 query cross_crate_inlinable(def_id: DefId) -> bool {
2506 desc { "whether the item should be made inlinable across crates" }
2507 separate_provide_extern
2508 }
2509
2510 query check_mono_item(key: ty::Instance<'tcx>) {
2514 desc { "monomorphization-time checking" }
2515 cache_on_disk_if { true }
2516 }
2517
2518 query skip_move_check_fns(_: ()) -> &'tcx FxIndexSet<DefId> {
2520 arena_cache
2521 desc { "functions to skip for move-size check" }
2522 }
2523
2524 query items_of_instance(key: (ty::Instance<'tcx>, CollectionMode)) -> (&'tcx [Spanned<MonoItem<'tcx>>], &'tcx [Spanned<MonoItem<'tcx>>]) {
2525 desc { "collecting items used by `{}`", key.0 }
2526 cache_on_disk_if { true }
2527 }
2528
2529 query size_estimate(key: ty::Instance<'tcx>) -> usize {
2530 desc { "estimating codegen size of `{}`", key }
2531 cache_on_disk_if { true }
2532 }
2533}
2534
2535rustc_query_append! { define_callbacks! }
2536rustc_feedable_queries! { define_feedable! }