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 explicit_item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
409 desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
410 cache_on_disk_if { key.is_local() }
411 separate_provide_extern
412 feedable
413 }
414
415 query explicit_item_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
422 desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
423 cache_on_disk_if { key.is_local() }
424 separate_provide_extern
425 feedable
426 }
427
428 query item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
452 desc { |tcx| "elaborating item bounds for `{}`", tcx.def_path_str(key) }
453 }
454
455 query item_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
456 desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
457 }
458
459 query item_non_self_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
460 desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
461 }
462
463 query impl_super_outlives(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
464 desc { |tcx| "elaborating supertrait outlives for trait of `{}`", tcx.def_path_str(key) }
465 }
466
467 query native_libraries(_: CrateNum) -> &'tcx Vec<NativeLib> {
472 arena_cache
473 desc { "looking up the native libraries of a linked crate" }
474 separate_provide_extern
475 }
476
477 query shallow_lint_levels_on(key: hir::OwnerId) -> &'tcx rustc_middle::lint::ShallowLintLevelMap {
478 arena_cache
479 desc { |tcx| "looking up lint levels for `{}`", tcx.def_path_str(key) }
480 }
481
482 query lint_expectations(_: ()) -> &'tcx Vec<(LintExpectationId, LintExpectation)> {
483 arena_cache
484 desc { "computing `#[expect]`ed lints in this crate" }
485 }
486
487 query lints_that_dont_need_to_run(_: ()) -> &'tcx UnordSet<LintId> {
488 arena_cache
489 desc { "Computing all lints that are explicitly enabled or with a default level greater than Allow" }
490 }
491
492 query expn_that_defined(key: DefId) -> rustc_span::ExpnId {
493 desc { |tcx| "getting the expansion that defined `{}`", tcx.def_path_str(key) }
494 separate_provide_extern
495 }
496
497 query is_panic_runtime(_: CrateNum) -> bool {
498 fatal_cycle
499 desc { "checking if the crate is_panic_runtime" }
500 separate_provide_extern
501 }
502
503 query representability(_: LocalDefId) -> rustc_middle::ty::Representability {
505 desc { "checking if `{}` is representable", tcx.def_path_str(key) }
506 cycle_delay_bug
508 anon
512 }
513
514 query representability_adt_ty(_: Ty<'tcx>) -> rustc_middle::ty::Representability {
516 desc { "checking if `{}` is representable", key }
517 cycle_delay_bug
518 anon
519 }
520
521 query params_in_repr(key: DefId) -> &'tcx rustc_index::bit_set::DenseBitSet<u32> {
523 desc { "finding type parameters in the representation" }
524 arena_cache
525 no_hash
526 separate_provide_extern
527 }
528
529 query thir_body(key: LocalDefId) -> Result<(&'tcx Steal<thir::Thir<'tcx>>, thir::ExprId), ErrorGuaranteed> {
531 no_hash
533 desc { |tcx| "building THIR for `{}`", tcx.def_path_str(key) }
534 }
535
536 query mir_keys(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexSet<LocalDefId> {
540 arena_cache
541 desc { "getting a list of all mir_keys" }
542 }
543
544 query mir_const_qualif(key: DefId) -> mir::ConstQualifs {
548 desc { |tcx| "const checking `{}`", tcx.def_path_str(key) }
549 cache_on_disk_if { key.is_local() }
550 separate_provide_extern
551 }
552
553 query mir_built(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
559 desc { |tcx| "building MIR for `{}`", tcx.def_path_str(key) }
560 feedable
561 }
562
563 query thir_abstract_const(
565 key: DefId
566 ) -> Result<Option<ty::EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed> {
567 desc {
568 |tcx| "building an abstract representation for `{}`", tcx.def_path_str(key),
569 }
570 separate_provide_extern
571 }
572
573 query mir_drops_elaborated_and_const_checked(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
574 no_hash
575 desc { |tcx| "elaborating drops for `{}`", tcx.def_path_str(key) }
576 }
577
578 query mir_for_ctfe(
579 key: DefId
580 ) -> &'tcx mir::Body<'tcx> {
581 desc { |tcx| "caching mir of `{}` for CTFE", tcx.def_path_str(key) }
582 cache_on_disk_if { key.is_local() }
583 separate_provide_extern
584 }
585
586 query mir_promoted(key: LocalDefId) -> (
587 &'tcx Steal<mir::Body<'tcx>>,
588 &'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>>
589 ) {
590 no_hash
591 desc { |tcx| "promoting constants in MIR for `{}`", tcx.def_path_str(key) }
592 }
593
594 query closure_typeinfo(key: LocalDefId) -> ty::ClosureTypeInfo<'tcx> {
595 desc {
596 |tcx| "finding symbols for captures of closure `{}`",
597 tcx.def_path_str(key)
598 }
599 }
600
601 query closure_saved_names_of_captured_variables(def_id: DefId) -> &'tcx IndexVec<abi::FieldIdx, Symbol> {
609 arena_cache
610 desc { |tcx| "computing debuginfo for closure `{}`", tcx.def_path_str(def_id) }
611 separate_provide_extern
612 }
613
614 query mir_coroutine_witnesses(key: DefId) -> Option<&'tcx mir::CoroutineLayout<'tcx>> {
615 arena_cache
616 desc { |tcx| "coroutine witness types for `{}`", tcx.def_path_str(key) }
617 cache_on_disk_if { key.is_local() }
618 separate_provide_extern
619 }
620
621 query check_coroutine_obligations(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
622 desc { |tcx| "verify auto trait bounds for coroutine interior type `{}`", tcx.def_path_str(key) }
623 return_result_from_ensure_ok
624 }
625
626 query optimized_mir(key: DefId) -> &'tcx mir::Body<'tcx> {
629 desc { |tcx| "optimizing MIR for `{}`", tcx.def_path_str(key) }
630 cache_on_disk_if { key.is_local() }
631 separate_provide_extern
632 }
633
634 query coverage_attr_on(key: LocalDefId) -> bool {
640 desc { |tcx| "checking for `#[coverage(..)]` on `{}`", tcx.def_path_str(key) }
641 feedable
642 }
643
644 query coverage_ids_info(key: ty::InstanceKind<'tcx>) -> Option<&'tcx mir::coverage::CoverageIdsInfo> {
657 desc { |tcx| "retrieving coverage IDs info from MIR for `{}`", tcx.def_path_str(key.def_id()) }
658 arena_cache
659 }
660
661 query promoted_mir(key: DefId) -> &'tcx IndexVec<mir::Promoted, mir::Body<'tcx>> {
667 desc { |tcx| "optimizing promoted MIR for `{}`", tcx.def_path_str(key) }
668 cache_on_disk_if { key.is_local() }
669 separate_provide_extern
670 }
671
672 query erase_regions_ty(ty: Ty<'tcx>) -> Ty<'tcx> {
676 anon
683 desc { "erasing regions from `{}`", ty }
684 }
685
686 query wasm_import_module_map(_: CrateNum) -> &'tcx DefIdMap<String> {
687 arena_cache
688 desc { "getting wasm import module map" }
689 }
690
691 query trait_explicit_predicates_and_bounds(key: LocalDefId) -> ty::GenericPredicates<'tcx> {
713 desc { |tcx| "computing explicit predicates of trait `{}`", tcx.def_path_str(key) }
714 }
715
716 query explicit_predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
722 desc { |tcx| "computing explicit predicates of `{}`", tcx.def_path_str(key) }
723 cache_on_disk_if { key.is_local() }
724 separate_provide_extern
725 feedable
726 }
727
728 query inferred_outlives_of(key: DefId) -> &'tcx [(ty::Clause<'tcx>, Span)] {
735 desc { |tcx| "computing inferred outlives-predicates of `{}`", tcx.def_path_str(key) }
736 cache_on_disk_if { key.is_local() }
737 separate_provide_extern
738 feedable
739 }
740
741 query explicit_super_predicates_of(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
749 desc { |tcx| "computing the super predicates of `{}`", tcx.def_path_str(key) }
750 cache_on_disk_if { key.is_local() }
751 separate_provide_extern
752 }
753
754 query explicit_implied_predicates_of(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
761 desc { |tcx| "computing the implied predicates of `{}`", tcx.def_path_str(key) }
762 cache_on_disk_if { key.is_local() }
763 separate_provide_extern
764 }
765
766 query explicit_supertraits_containing_assoc_item(
770 key: (DefId, rustc_span::Ident)
771 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
772 desc { |tcx| "computing the super traits of `{}` with associated type name `{}`",
773 tcx.def_path_str(key.0),
774 key.1
775 }
776 }
777
778 query const_conditions(
788 key: DefId
789 ) -> ty::ConstConditions<'tcx> {
790 desc { |tcx| "computing the conditions for `{}` to be considered const",
791 tcx.def_path_str(key)
792 }
793 separate_provide_extern
794 }
795
796 query explicit_implied_const_bounds(
802 key: DefId
803 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::PolyTraitRef<'tcx>, Span)]> {
804 desc { |tcx| "computing the implied `~const` bounds for `{}`",
805 tcx.def_path_str(key)
806 }
807 separate_provide_extern
808 }
809
810 query type_param_predicates(
813 key: (LocalDefId, LocalDefId, rustc_span::Ident)
814 ) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
815 desc { |tcx| "computing the bounds for type parameter `{}`", tcx.hir_ty_param_name(key.1) }
816 }
817
818 query trait_def(key: DefId) -> &'tcx ty::TraitDef {
819 desc { |tcx| "computing trait definition for `{}`", tcx.def_path_str(key) }
820 arena_cache
821 cache_on_disk_if { key.is_local() }
822 separate_provide_extern
823 }
824 query adt_def(key: DefId) -> ty::AdtDef<'tcx> {
825 desc { |tcx| "computing ADT definition for `{}`", tcx.def_path_str(key) }
826 cache_on_disk_if { key.is_local() }
827 separate_provide_extern
828 }
829 query adt_destructor(key: DefId) -> Option<ty::Destructor> {
830 desc { |tcx| "computing `Drop` impl for `{}`", tcx.def_path_str(key) }
831 cache_on_disk_if { key.is_local() }
832 separate_provide_extern
833 }
834 query adt_async_destructor(key: DefId) -> Option<ty::AsyncDestructor> {
835 desc { |tcx| "computing `AsyncDrop` impl for `{}`", tcx.def_path_str(key) }
836 cache_on_disk_if { key.is_local() }
837 separate_provide_extern
838 }
839
840 query adt_sized_constraint(key: DefId) -> Option<ty::EarlyBinder<'tcx, Ty<'tcx>>> {
841 desc { |tcx| "computing the `Sized` constraint for `{}`", tcx.def_path_str(key) }
842 }
843
844 query adt_dtorck_constraint(
845 key: DefId
846 ) -> &'tcx DropckConstraint<'tcx> {
847 desc { |tcx| "computing drop-check constraints for `{}`", tcx.def_path_str(key) }
848 }
849
850 query constness(key: DefId) -> hir::Constness {
872 desc { |tcx| "checking if item is const: `{}`", tcx.def_path_str(key) }
873 separate_provide_extern
874 feedable
875 }
876
877 query asyncness(key: DefId) -> ty::Asyncness {
878 desc { |tcx| "checking if the function is async: `{}`", tcx.def_path_str(key) }
879 separate_provide_extern
880 }
881
882 query is_promotable_const_fn(key: DefId) -> bool {
890 desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) }
891 }
892
893 query coroutine_by_move_body_def_id(def_id: DefId) -> DefId {
900 desc { |tcx| "looking up the coroutine by-move body for `{}`", tcx.def_path_str(def_id) }
901 separate_provide_extern
902 }
903
904 query coroutine_kind(def_id: DefId) -> Option<hir::CoroutineKind> {
906 desc { |tcx| "looking up coroutine kind of `{}`", tcx.def_path_str(def_id) }
907 separate_provide_extern
908 feedable
909 }
910
911 query coroutine_for_closure(def_id: DefId) -> DefId {
912 desc { |_tcx| "Given a coroutine-closure def id, return the def id of the coroutine returned by it" }
913 separate_provide_extern
914 }
915
916 query crate_variances(_: ()) -> &'tcx ty::CrateVariancesMap<'tcx> {
924 arena_cache
925 desc { "computing the variances for items in this crate" }
926 }
927
928 query variances_of(def_id: DefId) -> &'tcx [ty::Variance] {
936 desc { |tcx| "computing the variances of `{}`", tcx.def_path_str(def_id) }
937 cache_on_disk_if { def_id.is_local() }
938 separate_provide_extern
939 cycle_delay_bug
940 }
941
942 query inferred_outlives_crate(_: ()) -> &'tcx ty::CratePredicatesMap<'tcx> {
950 arena_cache
951 desc { "computing the inferred outlives-predicates for items in this crate" }
952 }
953
954 query associated_item_def_ids(key: DefId) -> &'tcx [DefId] {
957 desc { |tcx| "collecting associated items or fields of `{}`", tcx.def_path_str(key) }
958 cache_on_disk_if { key.is_local() }
959 separate_provide_extern
960 }
961
962 query associated_item(key: DefId) -> ty::AssocItem {
964 desc { |tcx| "computing associated item data for `{}`", tcx.def_path_str(key) }
965 cache_on_disk_if { key.is_local() }
966 separate_provide_extern
967 feedable
968 }
969
970 query associated_items(key: DefId) -> &'tcx ty::AssocItems {
972 arena_cache
973 desc { |tcx| "collecting associated items of `{}`", tcx.def_path_str(key) }
974 }
975
976 query impl_item_implementor_ids(impl_id: DefId) -> &'tcx DefIdMap<DefId> {
998 arena_cache
999 desc { |tcx| "comparing impl items against trait for `{}`", tcx.def_path_str(impl_id) }
1000 }
1001
1002 query associated_types_for_impl_traits_in_associated_fn(fn_def_id: DefId) -> &'tcx [DefId] {
1009 desc { |tcx| "creating associated items for opaque types returned by `{}`", tcx.def_path_str(fn_def_id) }
1010 cache_on_disk_if { fn_def_id.is_local() }
1011 separate_provide_extern
1012 }
1013
1014 query associated_type_for_impl_trait_in_trait(opaque_ty_def_id: LocalDefId) -> LocalDefId {
1017 desc { |tcx| "creating the associated item corresponding to the opaque type `{}`", tcx.def_path_str(opaque_ty_def_id.to_def_id()) }
1018 cache_on_disk_if { true }
1019 }
1020
1021 query impl_trait_header(impl_id: DefId) -> Option<ty::ImplTraitHeader<'tcx>> {
1024 desc { |tcx| "computing trait implemented by `{}`", tcx.def_path_str(impl_id) }
1025 cache_on_disk_if { impl_id.is_local() }
1026 separate_provide_extern
1027 }
1028
1029 query impl_self_is_guaranteed_unsized(impl_def_id: DefId) -> bool {
1033 desc { |tcx| "computing whether `{}` has a guaranteed unsized self type", tcx.def_path_str(impl_def_id) }
1034 }
1035
1036 query inherent_impls(key: DefId) -> &'tcx [DefId] {
1040 desc { |tcx| "collecting inherent impls for `{}`", tcx.def_path_str(key) }
1041 cache_on_disk_if { key.is_local() }
1042 separate_provide_extern
1043 }
1044
1045 query incoherent_impls(key: SimplifiedType) -> &'tcx [DefId] {
1046 desc { |tcx| "collecting all inherent impls for `{:?}`", key }
1047 }
1048
1049 query check_unsafety(key: LocalDefId) {
1051 desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key) }
1052 }
1053
1054 query check_tail_calls(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
1056 desc { |tcx| "tail-call-checking `{}`", tcx.def_path_str(key) }
1057 return_result_from_ensure_ok
1058 }
1059
1060 query assumed_wf_types(key: LocalDefId) -> &'tcx [(Ty<'tcx>, Span)] {
1065 desc { |tcx| "computing the implied bounds of `{}`", tcx.def_path_str(key) }
1066 }
1067
1068 query assumed_wf_types_for_rpitit(key: DefId) -> &'tcx [(Ty<'tcx>, Span)] {
1071 desc { |tcx| "computing the implied bounds of `{}`", tcx.def_path_str(key) }
1072 separate_provide_extern
1073 }
1074
1075 query fn_sig(key: DefId) -> ty::EarlyBinder<'tcx, ty::PolyFnSig<'tcx>> {
1077 desc { |tcx| "computing function signature of `{}`", tcx.def_path_str(key) }
1078 cache_on_disk_if { key.is_local() }
1079 separate_provide_extern
1080 cycle_delay_bug
1081 }
1082
1083 query lint_mod(key: LocalModDefId) {
1085 desc { |tcx| "linting {}", describe_as_module(key, tcx) }
1086 }
1087
1088 query check_unused_traits(_: ()) {
1089 desc { "checking unused trait imports in crate" }
1090 }
1091
1092 query check_mod_attrs(key: LocalModDefId) {
1094 desc { |tcx| "checking attributes in {}", describe_as_module(key, tcx) }
1095 }
1096
1097 query check_mod_unstable_api_usage(key: LocalModDefId) {
1099 desc { |tcx| "checking for unstable API usage in {}", describe_as_module(key, tcx) }
1100 }
1101
1102 query check_mod_loops(key: LocalModDefId) {
1104 desc { |tcx| "checking loops in {}", describe_as_module(key, tcx) }
1105 }
1106
1107 query check_mod_naked_functions(key: LocalModDefId) {
1108 desc { |tcx| "checking naked functions in {}", describe_as_module(key, tcx) }
1109 }
1110
1111 query check_mod_privacy(key: LocalModDefId) {
1112 desc { |tcx| "checking privacy in {}", describe_as_module(key.to_local_def_id(), tcx) }
1113 }
1114
1115 query check_liveness(key: LocalDefId) {
1116 desc { |tcx| "checking liveness of variables in `{}`", tcx.def_path_str(key) }
1117 }
1118
1119 query live_symbols_and_ignored_derived_traits(_: ()) -> &'tcx (
1124 LocalDefIdSet,
1125 LocalDefIdMap<Vec<(DefId, DefId)>>
1126 ) {
1127 arena_cache
1128 desc { "finding live symbols in crate" }
1129 }
1130
1131 query check_mod_deathness(key: LocalModDefId) {
1132 desc { |tcx| "checking deathness of variables in {}", describe_as_module(key, tcx) }
1133 }
1134
1135 query check_mod_type_wf(key: LocalModDefId) -> Result<(), ErrorGuaranteed> {
1136 desc { |tcx| "checking that types are well-formed in {}", describe_as_module(key, tcx) }
1137 return_result_from_ensure_ok
1138 }
1139
1140 query coerce_unsized_info(key: DefId) -> Result<ty::adjustment::CoerceUnsizedInfo, ErrorGuaranteed> {
1142 desc { |tcx| "computing CoerceUnsized info for `{}`", tcx.def_path_str(key) }
1143 cache_on_disk_if { key.is_local() }
1144 separate_provide_extern
1145 return_result_from_ensure_ok
1146 }
1147
1148 query typeck(key: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> {
1149 desc { |tcx| "type-checking `{}`", tcx.def_path_str(key) }
1150 cache_on_disk_if(tcx) { !tcx.is_typeck_child(key.to_def_id()) }
1151 }
1152
1153 query used_trait_imports(key: LocalDefId) -> &'tcx UnordSet<LocalDefId> {
1154 desc { |tcx| "finding used_trait_imports `{}`", tcx.def_path_str(key) }
1155 cache_on_disk_if { true }
1156 }
1157
1158 query coherent_trait(def_id: DefId) -> Result<(), ErrorGuaranteed> {
1159 desc { |tcx| "coherence checking all impls of trait `{}`", tcx.def_path_str(def_id) }
1160 return_result_from_ensure_ok
1161 }
1162
1163 query mir_borrowck(key: LocalDefId) -> Result<&'tcx mir::ConcreteOpaqueTypes<'tcx>, ErrorGuaranteed> {
1166 desc { |tcx| "borrow-checking `{}`", tcx.def_path_str(key) }
1167 }
1168
1169 query crate_inherent_impls(k: ()) -> (&'tcx CrateInherentImpls, Result<(), ErrorGuaranteed>) {
1177 desc { "finding all inherent impls defined in crate" }
1178 }
1179
1180 query crate_inherent_impls_validity_check(_: ()) -> Result<(), ErrorGuaranteed> {
1188 desc { "check for inherent impls that should not be defined in crate" }
1189 return_result_from_ensure_ok
1190 }
1191
1192 query crate_inherent_impls_overlap_check(_: ()) -> Result<(), ErrorGuaranteed> {
1200 desc { "check for overlap between inherent impls defined in this crate" }
1201 return_result_from_ensure_ok
1202 }
1203
1204 query orphan_check_impl(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1207 desc { |tcx|
1208 "checking whether impl `{}` follows the orphan rules",
1209 tcx.def_path_str(key),
1210 }
1211 return_result_from_ensure_ok
1212 }
1213
1214 query mir_callgraph_reachable(key: (ty::Instance<'tcx>, LocalDefId)) -> bool {
1217 fatal_cycle
1218 desc { |tcx|
1219 "computing if `{}` (transitively) calls `{}`",
1220 key.0,
1221 tcx.def_path_str(key.1),
1222 }
1223 }
1224
1225 query mir_inliner_callees(key: ty::InstanceKind<'tcx>) -> &'tcx [(DefId, GenericArgsRef<'tcx>)] {
1227 fatal_cycle
1228 desc { |tcx|
1229 "computing all local function calls in `{}`",
1230 tcx.def_path_str(key.def_id()),
1231 }
1232 }
1233
1234 query tag_for_variant(
1242 key: (Ty<'tcx>, abi::VariantIdx)
1243 ) -> Option<ty::ScalarInt> {
1244 desc { "computing variant tag for enum" }
1245 }
1246
1247 query eval_to_allocation_raw(key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>)
1256 -> EvalToAllocationRawResult<'tcx> {
1257 desc { |tcx|
1258 "const-evaluating + checking `{}`",
1259 key.value.display(tcx)
1260 }
1261 cache_on_disk_if { true }
1262 }
1263
1264 query eval_static_initializer(key: DefId) -> EvalStaticInitializerRawResult<'tcx> {
1266 desc { |tcx|
1267 "evaluating initializer of static `{}`",
1268 tcx.def_path_str(key)
1269 }
1270 cache_on_disk_if { key.is_local() }
1271 separate_provide_extern
1272 feedable
1273 }
1274
1275 query eval_to_const_value_raw(key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>)
1288 -> EvalToConstValueResult<'tcx> {
1289 desc { |tcx|
1290 "simplifying constant for the type system `{}`",
1291 key.value.display(tcx)
1292 }
1293 depth_limit
1294 cache_on_disk_if { true }
1295 }
1296
1297 query eval_to_valtree(
1300 key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>
1301 ) -> EvalToValTreeResult<'tcx> {
1302 desc { "evaluating type-level constant" }
1303 }
1304
1305 query valtree_to_const_val(key: ty::Value<'tcx>) -> mir::ConstValue<'tcx> {
1307 desc { "converting type-level constant value to MIR constant value"}
1308 }
1309
1310 query destructure_const(key: ty::Const<'tcx>) -> ty::DestructuredConst<'tcx> {
1313 desc { "destructuring type level constant"}
1314 }
1315
1316 query lit_to_const(
1318 key: LitToConstInput<'tcx>
1319 ) -> ty::Const<'tcx> {
1320 desc { "converting literal to const" }
1321 }
1322
1323 query check_match(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
1324 desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) }
1325 return_result_from_ensure_ok
1326 }
1327
1328 query effective_visibilities(_: ()) -> &'tcx EffectiveVisibilities {
1330 eval_always
1331 desc { "checking effective visibilities" }
1332 }
1333 query check_private_in_public(_: ()) {
1334 eval_always
1335 desc { "checking for private elements in public interfaces" }
1336 }
1337
1338 query reachable_set(_: ()) -> &'tcx LocalDefIdSet {
1339 arena_cache
1340 desc { "reachability" }
1341 cache_on_disk_if { true }
1342 }
1343
1344 query region_scope_tree(def_id: DefId) -> &'tcx crate::middle::region::ScopeTree {
1347 desc { |tcx| "computing drop scopes for `{}`", tcx.def_path_str(def_id) }
1348 }
1349
1350 query mir_shims(key: ty::InstanceKind<'tcx>) -> &'tcx mir::Body<'tcx> {
1352 arena_cache
1353 desc { |tcx| "generating MIR shim for `{}`", tcx.def_path_str(key.def_id()) }
1354 }
1355
1356 query symbol_name(key: ty::Instance<'tcx>) -> ty::SymbolName<'tcx> {
1360 desc { "computing the symbol for `{}`", key }
1361 cache_on_disk_if { true }
1362 }
1363
1364 query def_kind(def_id: DefId) -> DefKind {
1365 desc { |tcx| "looking up definition kind of `{}`", tcx.def_path_str(def_id) }
1366 cache_on_disk_if { def_id.is_local() }
1367 separate_provide_extern
1368 feedable
1369 }
1370
1371 query def_span(def_id: DefId) -> Span {
1373 desc { |tcx| "looking up span for `{}`", tcx.def_path_str(def_id) }
1374 cache_on_disk_if { def_id.is_local() }
1375 separate_provide_extern
1376 feedable
1377 }
1378
1379 query def_ident_span(def_id: DefId) -> Option<Span> {
1381 desc { |tcx| "looking up span for `{}`'s identifier", tcx.def_path_str(def_id) }
1382 cache_on_disk_if { def_id.is_local() }
1383 separate_provide_extern
1384 feedable
1385 }
1386
1387 query lookup_stability(def_id: DefId) -> Option<attr::Stability> {
1388 desc { |tcx| "looking up stability of `{}`", tcx.def_path_str(def_id) }
1389 cache_on_disk_if { def_id.is_local() }
1390 separate_provide_extern
1391 }
1392
1393 query lookup_const_stability(def_id: DefId) -> Option<attr::ConstStability> {
1394 desc { |tcx| "looking up const stability of `{}`", tcx.def_path_str(def_id) }
1395 cache_on_disk_if { def_id.is_local() }
1396 separate_provide_extern
1397 }
1398
1399 query lookup_default_body_stability(def_id: DefId) -> Option<attr::DefaultBodyStability> {
1400 desc { |tcx| "looking up default body stability of `{}`", tcx.def_path_str(def_id) }
1401 separate_provide_extern
1402 }
1403
1404 query should_inherit_track_caller(def_id: DefId) -> bool {
1405 desc { |tcx| "computing should_inherit_track_caller of `{}`", tcx.def_path_str(def_id) }
1406 }
1407
1408 query lookup_deprecation_entry(def_id: DefId) -> Option<DeprecationEntry> {
1409 desc { |tcx| "checking whether `{}` is deprecated", tcx.def_path_str(def_id) }
1410 cache_on_disk_if { def_id.is_local() }
1411 separate_provide_extern
1412 }
1413
1414 query is_doc_hidden(def_id: DefId) -> bool {
1416 desc { |tcx| "checking whether `{}` is `doc(hidden)`", tcx.def_path_str(def_id) }
1417 separate_provide_extern
1418 }
1419
1420 query is_doc_notable_trait(def_id: DefId) -> bool {
1422 desc { |tcx| "checking whether `{}` is `doc(notable_trait)`", tcx.def_path_str(def_id) }
1423 }
1424
1425 query attrs_for_def(def_id: DefId) -> &'tcx [hir::Attribute] {
1429 desc { |tcx| "collecting attributes of `{}`", tcx.def_path_str(def_id) }
1430 separate_provide_extern
1431 }
1432
1433 query codegen_fn_attrs(def_id: DefId) -> &'tcx CodegenFnAttrs {
1434 desc { |tcx| "computing codegen attributes of `{}`", tcx.def_path_str(def_id) }
1435 arena_cache
1436 cache_on_disk_if { def_id.is_local() }
1437 separate_provide_extern
1438 feedable
1439 }
1440
1441 query asm_target_features(def_id: DefId) -> &'tcx FxIndexSet<Symbol> {
1442 desc { |tcx| "computing target features for inline asm of `{}`", tcx.def_path_str(def_id) }
1443 }
1444
1445 query fn_arg_idents(def_id: DefId) -> &'tcx [Option<rustc_span::Ident>] {
1446 desc { |tcx| "looking up function parameter identifiers for `{}`", tcx.def_path_str(def_id) }
1447 separate_provide_extern
1448 }
1449
1450 query rendered_const(def_id: DefId) -> &'tcx String {
1453 arena_cache
1454 desc { |tcx| "rendering constant initializer of `{}`", tcx.def_path_str(def_id) }
1455 separate_provide_extern
1456 }
1457
1458 query rendered_precise_capturing_args(def_id: DefId) -> Option<&'tcx [PreciseCapturingArgKind<Symbol, Symbol>]> {
1460 desc { |tcx| "rendering precise capturing args for `{}`", tcx.def_path_str(def_id) }
1461 separate_provide_extern
1462 }
1463
1464 query impl_parent(def_id: DefId) -> Option<DefId> {
1465 desc { |tcx| "computing specialization parent impl of `{}`", tcx.def_path_str(def_id) }
1466 separate_provide_extern
1467 }
1468
1469 query is_ctfe_mir_available(key: DefId) -> bool {
1470 desc { |tcx| "checking if item has CTFE MIR available: `{}`", tcx.def_path_str(key) }
1471 cache_on_disk_if { key.is_local() }
1472 separate_provide_extern
1473 }
1474 query is_mir_available(key: DefId) -> bool {
1475 desc { |tcx| "checking if item has MIR available: `{}`", tcx.def_path_str(key) }
1476 cache_on_disk_if { key.is_local() }
1477 separate_provide_extern
1478 }
1479
1480 query own_existential_vtable_entries(
1481 key: DefId
1482 ) -> &'tcx [DefId] {
1483 desc { |tcx| "finding all existential vtable entries for trait `{}`", tcx.def_path_str(key) }
1484 }
1485
1486 query vtable_entries(key: ty::TraitRef<'tcx>)
1487 -> &'tcx [ty::VtblEntry<'tcx>] {
1488 desc { |tcx| "finding all vtable entries for trait `{}`", tcx.def_path_str(key.def_id) }
1489 }
1490
1491 query first_method_vtable_slot(key: ty::TraitRef<'tcx>) -> usize {
1492 desc { |tcx| "finding the slot within the vtable of `{}` for the implementation of `{}`", key.self_ty(), key.print_only_trait_name() }
1493 }
1494
1495 query supertrait_vtable_slot(key: (Ty<'tcx>, Ty<'tcx>)) -> Option<usize> {
1496 desc { |tcx| "finding the slot within vtable for trait object `{}` vtable ptr during trait upcasting coercion from `{}` vtable",
1497 key.1, key.0 }
1498 }
1499
1500 query vtable_allocation(key: (Ty<'tcx>, Option<ty::ExistentialTraitRef<'tcx>>)) -> mir::interpret::AllocId {
1501 desc { |tcx| "vtable const allocation for <{} as {}>",
1502 key.0,
1503 key.1.map(|trait_ref| format!("{trait_ref}")).unwrap_or("_".to_owned())
1504 }
1505 }
1506
1507 query codegen_select_candidate(
1508 key: PseudoCanonicalInput<'tcx, ty::TraitRef<'tcx>>
1509 ) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
1510 cache_on_disk_if { true }
1511 desc { |tcx| "computing candidate for `{}`", key.value }
1512 }
1513
1514 query all_local_trait_impls(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexMap<DefId, Vec<LocalDefId>> {
1516 desc { "finding local trait impls" }
1517 }
1518
1519 query local_trait_impls(trait_id: DefId) -> &'tcx [LocalDefId] {
1521 desc { "finding local trait impls of `{}`", tcx.def_path_str(trait_id) }
1522 }
1523
1524 query trait_impls_of(trait_id: DefId) -> &'tcx ty::trait_def::TraitImpls {
1526 arena_cache
1527 desc { |tcx| "finding trait impls of `{}`", tcx.def_path_str(trait_id) }
1528 }
1529
1530 query specialization_graph_of(trait_id: DefId) -> Result<&'tcx specialization_graph::Graph, ErrorGuaranteed> {
1531 desc { |tcx| "building specialization graph of trait `{}`", tcx.def_path_str(trait_id) }
1532 cache_on_disk_if { true }
1533 return_result_from_ensure_ok
1534 }
1535 query dyn_compatibility_violations(trait_id: DefId) -> &'tcx [DynCompatibilityViolation] {
1536 desc { |tcx| "determining dyn-compatibility of trait `{}`", tcx.def_path_str(trait_id) }
1537 }
1538 query is_dyn_compatible(trait_id: DefId) -> bool {
1539 desc { |tcx| "checking if trait `{}` is dyn-compatible", tcx.def_path_str(trait_id) }
1540 }
1541
1542 query param_env(def_id: DefId) -> ty::ParamEnv<'tcx> {
1551 desc { |tcx| "computing normalized predicates of `{}`", tcx.def_path_str(def_id) }
1552 feedable
1553 }
1554
1555 query param_env_normalized_for_post_analysis(def_id: DefId) -> ty::ParamEnv<'tcx> {
1559 desc { |tcx| "computing revealed normalized predicates of `{}`", tcx.def_path_str(def_id) }
1560 }
1561
1562 query is_copy_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1565 desc { "computing whether `{}` is `Copy`", env.value }
1566 }
1567 query is_use_cloned_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1570 desc { "computing whether `{}` is `UseCloned`", env.value }
1571 }
1572 query is_sized_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1574 desc { "computing whether `{}` is `Sized`", env.value }
1575 }
1576 query is_freeze_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1578 desc { "computing whether `{}` is freeze", env.value }
1579 }
1580 query is_unpin_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1582 desc { "computing whether `{}` is `Unpin`", env.value }
1583 }
1584 query needs_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1586 desc { "computing whether `{}` needs drop", env.value }
1587 }
1588 query needs_async_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1590 desc { "computing whether `{}` needs async drop", env.value }
1591 }
1592 query has_significant_drop_raw(env: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> bool {
1594 desc { "computing whether `{}` has a significant drop", env.value }
1595 }
1596
1597 query has_structural_eq_impl(ty: Ty<'tcx>) -> bool {
1602 desc {
1603 "computing whether `{}` implements `StructuralPartialEq`",
1604 ty
1605 }
1606 }
1607
1608 query adt_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1612 desc { |tcx| "computing when `{}` needs drop", tcx.def_path_str(def_id) }
1613 cache_on_disk_if { true }
1614 }
1615
1616 query adt_significant_drop_tys(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
1623 desc { |tcx| "computing when `{}` has a significant destructor", tcx.def_path_str(def_id) }
1624 }
1625
1626 query list_significant_drop_tys(ty: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>) -> &'tcx ty::List<Ty<'tcx>> {
1644 desc { |tcx| "computing when `{}` has a significant destructor", ty.value }
1645 }
1646
1647 query layout_of(
1650 key: ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>
1651 ) -> Result<ty::layout::TyAndLayout<'tcx>, &'tcx ty::layout::LayoutError<'tcx>> {
1652 depth_limit
1653 desc { "computing layout of `{}`", key.value }
1654 cycle_delay_bug
1656 }
1657
1658 query fn_abi_of_fn_ptr(
1663 key: ty::PseudoCanonicalInput<'tcx, (ty::PolyFnSig<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
1664 ) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
1665 desc { "computing call ABI of `{}` function pointers", key.value.0 }
1666 }
1667
1668 query fn_abi_of_instance(
1674 key: ty::PseudoCanonicalInput<'tcx, (ty::Instance<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
1675 ) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
1676 desc { "computing call ABI of `{}`", key.value.0 }
1677 }
1678
1679 query dylib_dependency_formats(_: CrateNum)
1680 -> &'tcx [(CrateNum, LinkagePreference)] {
1681 desc { "getting dylib dependency formats of crate" }
1682 separate_provide_extern
1683 }
1684
1685 query dependency_formats(_: ()) -> &'tcx Arc<crate::middle::dependency_format::Dependencies> {
1686 arena_cache
1687 desc { "getting the linkage format of all dependencies" }
1688 }
1689
1690 query is_compiler_builtins(_: CrateNum) -> bool {
1691 fatal_cycle
1692 desc { "checking if the crate is_compiler_builtins" }
1693 separate_provide_extern
1694 }
1695 query has_global_allocator(_: CrateNum) -> bool {
1696 eval_always
1698 fatal_cycle
1699 desc { "checking if the crate has_global_allocator" }
1700 separate_provide_extern
1701 }
1702 query has_alloc_error_handler(_: CrateNum) -> bool {
1703 eval_always
1705 fatal_cycle
1706 desc { "checking if the crate has_alloc_error_handler" }
1707 separate_provide_extern
1708 }
1709 query has_panic_handler(_: CrateNum) -> bool {
1710 fatal_cycle
1711 desc { "checking if the crate has_panic_handler" }
1712 separate_provide_extern
1713 }
1714 query is_profiler_runtime(_: CrateNum) -> bool {
1715 fatal_cycle
1716 desc { "checking if a crate is `#![profiler_runtime]`" }
1717 separate_provide_extern
1718 }
1719 query has_ffi_unwind_calls(key: LocalDefId) -> bool {
1720 desc { |tcx| "checking if `{}` contains FFI-unwind calls", tcx.def_path_str(key) }
1721 cache_on_disk_if { true }
1722 }
1723 query required_panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
1724 fatal_cycle
1725 desc { "getting a crate's required panic strategy" }
1726 separate_provide_extern
1727 }
1728 query panic_in_drop_strategy(_: CrateNum) -> PanicStrategy {
1729 fatal_cycle
1730 desc { "getting a crate's configured panic-in-drop strategy" }
1731 separate_provide_extern
1732 }
1733 query is_no_builtins(_: CrateNum) -> bool {
1734 fatal_cycle
1735 desc { "getting whether a crate has `#![no_builtins]`" }
1736 separate_provide_extern
1737 }
1738 query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
1739 fatal_cycle
1740 desc { "getting a crate's symbol mangling version" }
1741 separate_provide_extern
1742 }
1743
1744 query extern_crate(def_id: CrateNum) -> Option<&'tcx ExternCrate> {
1745 eval_always
1746 desc { "getting crate's ExternCrateData" }
1747 separate_provide_extern
1748 }
1749
1750 query specialization_enabled_in(cnum: CrateNum) -> bool {
1751 desc { "checking whether the crate enabled `specialization`/`min_specialization`" }
1752 separate_provide_extern
1753 }
1754
1755 query specializes(_: (DefId, DefId)) -> bool {
1756 desc { "computing whether impls specialize one another" }
1757 }
1758 query in_scope_traits_map(_: hir::OwnerId)
1759 -> Option<&'tcx ItemLocalMap<Box<[TraitCandidate]>>> {
1760 desc { "getting traits in scope at a block" }
1761 }
1762
1763 query defaultness(def_id: DefId) -> hir::Defaultness {
1765 desc { |tcx| "looking up whether `{}` has `default`", tcx.def_path_str(def_id) }
1766 separate_provide_extern
1767 feedable
1768 }
1769
1770 query check_well_formed(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1771 desc { |tcx| "checking that `{}` is well-formed", tcx.def_path_str(key) }
1772 return_result_from_ensure_ok
1773 }
1774
1775 query enforce_impl_non_lifetime_params_are_constrained(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
1776 desc { |tcx| "checking that `{}`'s generics are constrained by the impl header", tcx.def_path_str(key) }
1777 return_result_from_ensure_ok
1778 }
1779
1780 query reachable_non_generics(_: CrateNum)
1793 -> &'tcx DefIdMap<SymbolExportInfo> {
1794 arena_cache
1795 desc { "looking up the exported symbols of a crate" }
1796 separate_provide_extern
1797 }
1798 query is_reachable_non_generic(def_id: DefId) -> bool {
1799 desc { |tcx| "checking whether `{}` is an exported symbol", tcx.def_path_str(def_id) }
1800 cache_on_disk_if { def_id.is_local() }
1801 separate_provide_extern
1802 }
1803 query is_unreachable_local_definition(def_id: LocalDefId) -> bool {
1804 desc { |tcx|
1805 "checking whether `{}` is reachable from outside the crate",
1806 tcx.def_path_str(def_id),
1807 }
1808 }
1809
1810 query upstream_monomorphizations(_: ()) -> &'tcx DefIdMap<UnordMap<GenericArgsRef<'tcx>, CrateNum>> {
1818 arena_cache
1819 desc { "collecting available upstream monomorphizations" }
1820 }
1821
1822 query upstream_monomorphizations_for(def_id: DefId)
1830 -> Option<&'tcx UnordMap<GenericArgsRef<'tcx>, CrateNum>>
1831 {
1832 desc { |tcx|
1833 "collecting available upstream monomorphizations for `{}`",
1834 tcx.def_path_str(def_id),
1835 }
1836 separate_provide_extern
1837 }
1838
1839 query upstream_drop_glue_for(args: GenericArgsRef<'tcx>) -> Option<CrateNum> {
1855 desc { "available upstream drop-glue for `{:?}`", args }
1856 }
1857
1858 query upstream_async_drop_glue_for(args: GenericArgsRef<'tcx>) -> Option<CrateNum> {
1875 desc { "available upstream async-drop-glue for `{:?}`", args }
1876 }
1877
1878 query foreign_modules(_: CrateNum) -> &'tcx FxIndexMap<DefId, ForeignModule> {
1880 arena_cache
1881 desc { "looking up the foreign modules of a linked crate" }
1882 separate_provide_extern
1883 }
1884
1885 query clashing_extern_declarations(_: ()) {
1887 desc { "checking `extern fn` declarations are compatible" }
1888 }
1889
1890 query entry_fn(_: ()) -> Option<(DefId, EntryFnType)> {
1893 desc { "looking up the entry function of a crate" }
1894 }
1895
1896 query proc_macro_decls_static(_: ()) -> Option<LocalDefId> {
1898 desc { "looking up the proc macro declarations for a crate" }
1899 }
1900
1901 query crate_hash(_: CrateNum) -> Svh {
1909 eval_always
1910 desc { "looking up the hash a crate" }
1911 separate_provide_extern
1912 }
1913
1914 query crate_host_hash(_: CrateNum) -> Option<Svh> {
1916 eval_always
1917 desc { "looking up the hash of a host version of a crate" }
1918 separate_provide_extern
1919 }
1920
1921 query extra_filename(_: CrateNum) -> &'tcx String {
1924 arena_cache
1925 eval_always
1926 desc { "looking up the extra filename for a crate" }
1927 separate_provide_extern
1928 }
1929
1930 query crate_extern_paths(_: CrateNum) -> &'tcx Vec<PathBuf> {
1932 arena_cache
1933 eval_always
1934 desc { "looking up the paths for extern crates" }
1935 separate_provide_extern
1936 }
1937
1938 query implementations_of_trait(_: (CrateNum, DefId)) -> &'tcx [(DefId, Option<SimplifiedType>)] {
1941 desc { "looking up implementations of a trait in a crate" }
1942 separate_provide_extern
1943 }
1944
1945 query crate_incoherent_impls(key: (CrateNum, SimplifiedType)) -> &'tcx [DefId] {
1950 desc { |tcx| "collecting all impls for a type in a crate" }
1951 separate_provide_extern
1952 }
1953
1954 query native_library(def_id: DefId) -> Option<&'tcx NativeLib> {
1956 desc { |tcx| "getting the native library for `{}`", tcx.def_path_str(def_id) }
1957 }
1958
1959 query inherit_sig_for_delegation_item(def_id: LocalDefId) -> &'tcx [Ty<'tcx>] {
1960 desc { "inheriting delegation signature" }
1961 }
1962
1963 query resolve_bound_vars(owner_id: hir::OwnerId) -> &'tcx ResolveBoundVars {
1967 arena_cache
1968 desc { |tcx| "resolving lifetimes for `{}`", tcx.def_path_str(owner_id) }
1969 }
1970 query named_variable_map(owner_id: hir::OwnerId) -> &'tcx SortedMap<ItemLocalId, ResolvedArg> {
1971 desc { |tcx| "looking up a named region inside `{}`", tcx.def_path_str(owner_id) }
1972 }
1973 query is_late_bound_map(owner_id: hir::OwnerId) -> Option<&'tcx FxIndexSet<ItemLocalId>> {
1974 desc { |tcx| "testing if a region is late bound inside `{}`", tcx.def_path_str(owner_id) }
1975 }
1976 query object_lifetime_default(def_id: DefId) -> ObjectLifetimeDefault {
1991 desc { "looking up lifetime defaults for type parameter `{}`", tcx.def_path_str(def_id) }
1992 separate_provide_extern
1993 }
1994 query late_bound_vars_map(owner_id: hir::OwnerId)
1995 -> &'tcx SortedMap<ItemLocalId, Vec<ty::BoundVariableKind>> {
1996 desc { |tcx| "looking up late bound vars inside `{}`", tcx.def_path_str(owner_id) }
1997 }
1998 query opaque_captured_lifetimes(def_id: LocalDefId) -> &'tcx [(ResolvedArg, LocalDefId)] {
2013 desc { |tcx| "listing captured lifetimes for opaque `{}`", tcx.def_path_str(def_id) }
2014 }
2015
2016 query visibility(def_id: DefId) -> ty::Visibility<DefId> {
2029 desc { |tcx| "computing visibility of `{}`", tcx.def_path_str(def_id) }
2030 separate_provide_extern
2031 feedable
2032 }
2033
2034 query inhabited_predicate_adt(key: DefId) -> ty::inhabitedness::InhabitedPredicate<'tcx> {
2035 desc { "computing the uninhabited predicate of `{:?}`", key }
2036 }
2037
2038 query inhabited_predicate_type(key: Ty<'tcx>) -> ty::inhabitedness::InhabitedPredicate<'tcx> {
2040 desc { "computing the uninhabited predicate of `{}`", key }
2041 }
2042
2043 query dep_kind(_: CrateNum) -> CrateDepKind {
2044 eval_always
2045 desc { "fetching what a dependency looks like" }
2046 separate_provide_extern
2047 }
2048
2049 query crate_name(_: CrateNum) -> Symbol {
2051 feedable
2052 desc { "fetching what a crate is named" }
2053 separate_provide_extern
2054 }
2055 query module_children(def_id: DefId) -> &'tcx [ModChild] {
2056 desc { |tcx| "collecting child items of module `{}`", tcx.def_path_str(def_id) }
2057 separate_provide_extern
2058 }
2059 query extern_mod_stmt_cnum(def_id: LocalDefId) -> Option<CrateNum> {
2060 desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id) }
2061 }
2062
2063 query num_extern_def_ids(_: CrateNum) -> usize {
2069 desc { "fetching the number of definitions in a crate" }
2070 separate_provide_extern
2071 }
2072
2073 query lib_features(_: CrateNum) -> &'tcx LibFeatures {
2074 desc { "calculating the lib features defined in a crate" }
2075 separate_provide_extern
2076 arena_cache
2077 }
2078 query stability_implications(_: CrateNum) -> &'tcx UnordMap<Symbol, Symbol> {
2079 arena_cache
2080 desc { "calculating the implications between `#[unstable]` features defined in a crate" }
2081 separate_provide_extern
2082 }
2083 query intrinsic_raw(def_id: DefId) -> Option<rustc_middle::ty::IntrinsicDef> {
2085 desc { |tcx| "fetch intrinsic name if `{}` is an intrinsic", tcx.def_path_str(def_id) }
2086 separate_provide_extern
2087 }
2088 query get_lang_items(_: ()) -> &'tcx LanguageItems {
2090 arena_cache
2091 eval_always
2092 desc { "calculating the lang items map" }
2093 }
2094
2095 query all_diagnostic_items(_: ()) -> &'tcx rustc_hir::diagnostic_items::DiagnosticItems {
2097 arena_cache
2098 eval_always
2099 desc { "calculating the diagnostic items map" }
2100 }
2101
2102 query defined_lang_items(_: CrateNum) -> &'tcx [(DefId, LangItem)] {
2104 desc { "calculating the lang items defined in a crate" }
2105 separate_provide_extern
2106 }
2107
2108 query diagnostic_items(_: CrateNum) -> &'tcx rustc_hir::diagnostic_items::DiagnosticItems {
2110 arena_cache
2111 desc { "calculating the diagnostic items map in a crate" }
2112 separate_provide_extern
2113 }
2114
2115 query missing_lang_items(_: CrateNum) -> &'tcx [LangItem] {
2116 desc { "calculating the missing lang items in a crate" }
2117 separate_provide_extern
2118 }
2119
2120 query visible_parent_map(_: ()) -> &'tcx DefIdMap<DefId> {
2125 arena_cache
2126 desc { "calculating the visible parent map" }
2127 }
2128 query trimmed_def_paths(_: ()) -> &'tcx DefIdMap<Symbol> {
2131 arena_cache
2132 desc { "calculating trimmed def paths" }
2133 }
2134 query missing_extern_crate_item(_: CrateNum) -> bool {
2135 eval_always
2136 desc { "seeing if we're missing an `extern crate` item for this crate" }
2137 separate_provide_extern
2138 }
2139 query used_crate_source(_: CrateNum) -> &'tcx Arc<CrateSource> {
2140 arena_cache
2141 eval_always
2142 desc { "looking at the source for a crate" }
2143 separate_provide_extern
2144 }
2145
2146 query debugger_visualizers(_: CrateNum) -> &'tcx Vec<DebuggerVisualizerFile> {
2151 arena_cache
2152 desc { "looking up the debugger visualizers for this crate" }
2153 separate_provide_extern
2154 eval_always
2155 }
2156
2157 query postorder_cnums(_: ()) -> &'tcx [CrateNum] {
2158 eval_always
2159 desc { "generating a postorder list of CrateNums" }
2160 }
2161 query is_private_dep(c: CrateNum) -> bool {
2164 eval_always
2165 desc { "checking whether crate `{}` is a private dependency", c }
2166 separate_provide_extern
2167 }
2168 query allocator_kind(_: ()) -> Option<AllocatorKind> {
2169 eval_always
2170 desc { "getting the allocator kind for the current crate" }
2171 }
2172 query alloc_error_handler_kind(_: ()) -> Option<AllocatorKind> {
2173 eval_always
2174 desc { "alloc error handler kind for the current crate" }
2175 }
2176
2177 query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
2178 desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }
2179 }
2180 query maybe_unused_trait_imports(_: ()) -> &'tcx FxIndexSet<LocalDefId> {
2181 desc { "fetching potentially unused trait imports" }
2182 }
2183 query names_imported_by_glob_use(def_id: LocalDefId) -> &'tcx UnordSet<Symbol> {
2184 desc { |tcx| "finding names imported by glob use for `{}`", tcx.def_path_str(def_id) }
2185 }
2186
2187 query stability_index(_: ()) -> &'tcx stability::Index {
2188 arena_cache
2189 eval_always
2190 desc { "calculating the stability index for the local crate" }
2191 }
2192 query crates(_: ()) -> &'tcx [CrateNum] {
2195 eval_always
2196 desc { "fetching all foreign CrateNum instances" }
2197 }
2198 query used_crates(_: ()) -> &'tcx [CrateNum] {
2202 eval_always
2203 desc { "fetching `CrateNum`s for all crates loaded non-speculatively" }
2204 }
2205
2206 query traits(_: CrateNum) -> &'tcx [DefId] {
2208 desc { "fetching all traits in a crate" }
2209 separate_provide_extern
2210 }
2211
2212 query trait_impls_in_crate(_: CrateNum) -> &'tcx [DefId] {
2213 desc { "fetching all trait impls in a crate" }
2214 separate_provide_extern
2215 }
2216
2217 query exported_symbols(cnum: CrateNum) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportInfo)] {
2223 desc { "collecting exported symbols for crate `{}`", cnum}
2224 cache_on_disk_if { *cnum == LOCAL_CRATE }
2225 separate_provide_extern
2226 }
2227
2228 query collect_and_partition_mono_items(_: ()) -> MonoItemPartitions<'tcx> {
2229 eval_always
2230 desc { "collect_and_partition_mono_items" }
2231 }
2232
2233 query is_codegened_item(def_id: DefId) -> bool {
2234 desc { |tcx| "determining whether `{}` needs codegen", tcx.def_path_str(def_id) }
2235 }
2236
2237 query codegen_unit(sym: Symbol) -> &'tcx CodegenUnit<'tcx> {
2238 desc { "getting codegen unit `{sym}`" }
2239 }
2240
2241 query backend_optimization_level(_: ()) -> OptLevel {
2242 desc { "optimization level used by backend" }
2243 }
2244
2245 query output_filenames(_: ()) -> &'tcx Arc<OutputFilenames> {
2250 feedable
2251 desc { "getting output filenames" }
2252 arena_cache
2253 }
2254
2255 query normalize_canonicalized_projection_ty(
2261 goal: CanonicalAliasGoal<'tcx>
2262 ) -> Result<
2263 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2264 NoSolution,
2265 > {
2266 desc { "normalizing `{}`", goal.canonical.value.value }
2267 }
2268
2269 query normalize_canonicalized_weak_ty(
2275 goal: CanonicalAliasGoal<'tcx>
2276 ) -> Result<
2277 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2278 NoSolution,
2279 > {
2280 desc { "normalizing `{}`", goal.canonical.value.value }
2281 }
2282
2283 query normalize_canonicalized_inherent_projection_ty(
2289 goal: CanonicalAliasGoal<'tcx>
2290 ) -> Result<
2291 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>,
2292 NoSolution,
2293 > {
2294 desc { "normalizing `{}`", goal.canonical.value.value }
2295 }
2296
2297 query try_normalize_generic_arg_after_erasing_regions(
2299 goal: PseudoCanonicalInput<'tcx, GenericArg<'tcx>>
2300 ) -> Result<GenericArg<'tcx>, NoSolution> {
2301 desc { "normalizing `{}`", goal.value }
2302 }
2303
2304 query implied_outlives_bounds(
2305 key: (CanonicalImpliedOutlivesBoundsGoal<'tcx>, bool)
2306 ) -> Result<
2307 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>,
2308 NoSolution,
2309 > {
2310 desc { "computing implied outlives bounds for `{}` (hack disabled = {:?})", key.0.canonical.value.value.ty, key.1 }
2311 }
2312
2313 query dropck_outlives(
2316 goal: CanonicalDropckOutlivesGoal<'tcx>
2317 ) -> Result<
2318 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>,
2319 NoSolution,
2320 > {
2321 desc { "computing dropck types for `{}`", goal.canonical.value.value.dropped_ty }
2322 }
2323
2324 query evaluate_obligation(
2327 goal: CanonicalPredicateGoal<'tcx>
2328 ) -> Result<EvaluationResult, OverflowError> {
2329 desc { "evaluating trait selection obligation `{}`", goal.canonical.value.value }
2330 }
2331
2332 query type_op_ascribe_user_type(
2334 goal: CanonicalTypeOpAscribeUserTypeGoal<'tcx>
2335 ) -> Result<
2336 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
2337 NoSolution,
2338 > {
2339 desc { "evaluating `type_op_ascribe_user_type` `{:?}`", goal.canonical.value.value }
2340 }
2341
2342 query type_op_prove_predicate(
2344 goal: CanonicalTypeOpProvePredicateGoal<'tcx>
2345 ) -> Result<
2346 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
2347 NoSolution,
2348 > {
2349 desc { "evaluating `type_op_prove_predicate` `{:?}`", goal.canonical.value.value }
2350 }
2351
2352 query type_op_normalize_ty(
2354 goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>
2355 ) -> Result<
2356 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Ty<'tcx>>>,
2357 NoSolution,
2358 > {
2359 desc { "normalizing `{}`", goal.canonical.value.value.value }
2360 }
2361
2362 query type_op_normalize_clause(
2364 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::Clause<'tcx>>
2365 ) -> Result<
2366 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::Clause<'tcx>>>,
2367 NoSolution,
2368 > {
2369 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2370 }
2371
2372 query type_op_normalize_poly_fn_sig(
2374 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::PolyFnSig<'tcx>>
2375 ) -> Result<
2376 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::PolyFnSig<'tcx>>>,
2377 NoSolution,
2378 > {
2379 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2380 }
2381
2382 query type_op_normalize_fn_sig(
2384 goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>
2385 ) -> Result<
2386 &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ty::FnSig<'tcx>>>,
2387 NoSolution,
2388 > {
2389 desc { "normalizing `{:?}`", goal.canonical.value.value.value }
2390 }
2391
2392 query instantiate_and_check_impossible_predicates(key: (DefId, GenericArgsRef<'tcx>)) -> bool {
2393 desc { |tcx|
2394 "checking impossible instantiated predicates: `{}`",
2395 tcx.def_path_str(key.0)
2396 }
2397 }
2398
2399 query is_impossible_associated_item(key: (DefId, DefId)) -> bool {
2400 desc { |tcx|
2401 "checking if `{}` is impossible to reference within `{}`",
2402 tcx.def_path_str(key.1),
2403 tcx.def_path_str(key.0),
2404 }
2405 }
2406
2407 query method_autoderef_steps(
2408 goal: CanonicalTyGoal<'tcx>
2409 ) -> MethodAutoderefStepsResult<'tcx> {
2410 desc { "computing autoderef types for `{}`", goal.canonical.value.value }
2411 }
2412
2413 query rust_target_features(_: CrateNum) -> &'tcx UnordMap<String, rustc_target::target_features::Stability> {
2415 arena_cache
2416 eval_always
2417 desc { "looking up Rust target features" }
2418 }
2419
2420 query implied_target_features(feature: Symbol) -> &'tcx Vec<Symbol> {
2421 arena_cache
2422 eval_always
2423 desc { "looking up implied target features" }
2424 }
2425
2426 query features_query(_: ()) -> &'tcx rustc_feature::Features {
2427 feedable
2428 desc { "looking up enabled feature gates" }
2429 }
2430
2431 query crate_for_resolver((): ()) -> &'tcx Steal<(rustc_ast::Crate, rustc_ast::AttrVec)> {
2432 feedable
2433 no_hash
2434 desc { "the ast before macro expansion and name resolution" }
2435 }
2436
2437 query resolve_instance_raw(
2447 key: ty::PseudoCanonicalInput<'tcx, (DefId, GenericArgsRef<'tcx>)>
2448 ) -> Result<Option<ty::Instance<'tcx>>, ErrorGuaranteed> {
2449 desc { "resolving instance `{}`", ty::Instance::new(key.value.0, key.value.1) }
2450 }
2451
2452 query reveal_opaque_types_in_bounds(key: ty::Clauses<'tcx>) -> ty::Clauses<'tcx> {
2453 desc { "revealing opaque types in `{:?}`", key }
2454 }
2455
2456 query limits(key: ()) -> Limits {
2457 desc { "looking up limits" }
2458 }
2459
2460 query diagnostic_hir_wf_check(
2469 key: (ty::Predicate<'tcx>, WellFormedLoc)
2470 ) -> Option<&'tcx ObligationCause<'tcx>> {
2471 arena_cache
2472 eval_always
2473 no_hash
2474 desc { "performing HIR wf-checking for predicate `{:?}` at item `{:?}`", key.0, key.1 }
2475 }
2476
2477 query global_backend_features(_: ()) -> &'tcx Vec<String> {
2480 arena_cache
2481 eval_always
2482 desc { "computing the backend features for CLI flags" }
2483 }
2484
2485 query check_validity_requirement(key: (ValidityRequirement, ty::PseudoCanonicalInput<'tcx, Ty<'tcx>>)) -> Result<bool, &'tcx ty::layout::LayoutError<'tcx>> {
2486 desc { "checking validity requirement for `{}`: {}", key.1.value, key.0 }
2487 }
2488
2489 query compare_impl_item(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
2494 desc { |tcx| "checking assoc item `{}` is compatible with trait definition", tcx.def_path_str(key) }
2495 return_result_from_ensure_ok
2496 }
2497
2498 query deduced_param_attrs(def_id: DefId) -> &'tcx [ty::DeducedParamAttrs] {
2499 desc { |tcx| "deducing parameter attributes for {}", tcx.def_path_str(def_id) }
2500 separate_provide_extern
2501 }
2502
2503 query doc_link_resolutions(def_id: DefId) -> &'tcx DocLinkResMap {
2504 eval_always
2505 desc { "resolutions for documentation links for a module" }
2506 separate_provide_extern
2507 }
2508
2509 query doc_link_traits_in_scope(def_id: DefId) -> &'tcx [DefId] {
2510 eval_always
2511 desc { "traits in scope for documentation links for a module" }
2512 separate_provide_extern
2513 }
2514
2515 query stripped_cfg_items(cnum: CrateNum) -> &'tcx [StrippedCfgItem] {
2519 desc { "getting cfg-ed out item names" }
2520 separate_provide_extern
2521 }
2522
2523 query generics_require_sized_self(def_id: DefId) -> bool {
2524 desc { "check whether the item has a `where Self: Sized` bound" }
2525 }
2526
2527 query cross_crate_inlinable(def_id: DefId) -> bool {
2528 desc { "whether the item should be made inlinable across crates" }
2529 separate_provide_extern
2530 }
2531
2532 query check_mono_item(key: ty::Instance<'tcx>) {
2536 desc { "monomorphization-time checking" }
2537 }
2538
2539 query skip_move_check_fns(_: ()) -> &'tcx FxIndexSet<DefId> {
2541 arena_cache
2542 desc { "functions to skip for move-size check" }
2543 }
2544
2545 query items_of_instance(key: (ty::Instance<'tcx>, CollectionMode)) -> (&'tcx [Spanned<MonoItem<'tcx>>], &'tcx [Spanned<MonoItem<'tcx>>]) {
2546 desc { "collecting items used by `{}`", key.0 }
2547 cache_on_disk_if { true }
2548 }
2549
2550 query size_estimate(key: ty::Instance<'tcx>) -> usize {
2551 desc { "estimating codegen size of `{}`", key }
2552 cache_on_disk_if { true }
2553 }
2554}
2555
2556rustc_query_append! { define_callbacks! }
2557rustc_feedable_queries! { define_feedable! }