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