summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_middle/src/query/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_middle/src/query/mod.rs')
-rw-r--r--compiler/rustc_middle/src/query/mod.rs66
1 files changed, 28 insertions, 38 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index 340c5a769..f9ec36836 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -25,7 +25,9 @@ use crate::mir::interpret::{
use crate::mir::interpret::{LitToConstError, LitToConstInput};
use crate::mir::mono::CodegenUnit;
use crate::query::erase::{erase, restore, Erase};
-use crate::query::plumbing::{query_ensure, query_get_at, CyclePlaceholder, DynamicQuery};
+use crate::query::plumbing::{
+ query_ensure, query_ensure_error_guaranteed, query_get_at, CyclePlaceholder, DynamicQuery,
+};
use crate::thir;
use crate::traits::query::{
CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal,
@@ -249,6 +251,7 @@ rustc_queries! {
"computing type of opaque `{path}`",
path = tcx.def_path_str(key),
}
+ cycle_stash
}
query type_alias_is_lazy(key: DefId) -> bool {
@@ -339,7 +342,7 @@ rustc_queries! {
query opaque_types_defined_by(
key: LocalDefId
- ) -> &'tcx [LocalDefId] {
+ ) -> &'tcx ty::List<LocalDefId> {
desc {
|tcx| "computing the opaque types defined by `{}`",
tcx.def_path_str(key.to_def_id())
@@ -541,28 +544,28 @@ rustc_queries! {
}
}
- /// Returns names of captured upvars for closures and generators.
+ /// Returns names of captured upvars for closures and coroutines.
///
/// Here are some examples:
/// - `name__field1__field2` when the upvar is captured by value.
/// - `_ref__name__field` when the upvar is captured by reference.
///
- /// For generators this only contains upvars that are shared by all states.
+ /// For coroutines this only contains upvars that are shared by all states.
query closure_saved_names_of_captured_variables(def_id: DefId) -> &'tcx IndexVec<abi::FieldIdx, Symbol> {
arena_cache
desc { |tcx| "computing debuginfo for closure `{}`", tcx.def_path_str(def_id) }
separate_provide_extern
}
- query mir_generator_witnesses(key: DefId) -> &'tcx Option<mir::GeneratorLayout<'tcx>> {
+ query mir_coroutine_witnesses(key: DefId) -> &'tcx Option<mir::CoroutineLayout<'tcx>> {
arena_cache
- desc { |tcx| "generator witness types for `{}`", tcx.def_path_str(key) }
+ desc { |tcx| "coroutine witness types for `{}`", tcx.def_path_str(key) }
cache_on_disk_if { key.is_local() }
separate_provide_extern
}
- query check_generator_obligations(key: LocalDefId) {
- desc { |tcx| "verify auto trait bounds for generator interior type `{}`", tcx.def_path_str(key) }
+ query check_coroutine_obligations(key: LocalDefId) {
+ desc { |tcx| "verify auto trait bounds for coroutine interior type `{}`", tcx.def_path_str(key) }
}
/// MIR after our optimization passes have run. This is MIR that is ready
@@ -573,22 +576,12 @@ rustc_queries! {
separate_provide_extern
}
- /// Returns coverage summary info for a function, after executing the `InstrumentCoverage`
- /// MIR pass (assuming the -Cinstrument-coverage option is enabled).
- query coverageinfo(key: ty::InstanceDef<'tcx>) -> &'tcx mir::CoverageInfo {
- desc { |tcx| "retrieving coverage info from MIR for `{}`", tcx.def_path_str(key.def_id()) }
- arena_cache
- }
-
- /// Returns the `CodeRegions` for a function that has instrumented coverage, in case the
- /// function was optimized out before codegen, and before being added to the Coverage Map.
- query covered_code_regions(key: DefId) -> &'tcx Vec<&'tcx mir::coverage::CodeRegion> {
- desc {
- |tcx| "retrieving the covered `CodeRegion`s, if instrumented, for `{}`",
- tcx.def_path_str(key)
- }
+ /// Summarizes coverage IDs inserted by the `InstrumentCoverage` MIR pass
+ /// (for compiler option `-Cinstrument-coverage`), after MIR optimizations
+ /// have had a chance to potentially remove some of them.
+ query coverage_ids_info(key: ty::InstanceDef<'tcx>) -> &'tcx mir::CoverageIdsInfo {
+ desc { |tcx| "retrieving coverage IDs info from MIR for `{}`", tcx.def_path_str(key.def_id()) }
arena_cache
- cache_on_disk_if { key.is_local() }
}
/// The `DefId` is the `DefId` of the containing MIR body. Promoteds do not have their own
@@ -753,9 +746,9 @@ rustc_queries! {
desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) }
}
- /// Returns `Some(generator_kind)` if the node pointed to by `def_id` is a generator.
- query generator_kind(def_id: DefId) -> Option<hir::GeneratorKind> {
- desc { |tcx| "looking up generator kind of `{}`", tcx.def_path_str(def_id) }
+ /// Returns `Some(coroutine_kind)` if the node pointed to by `def_id` is a coroutine.
+ query coroutine_kind(def_id: DefId) -> Option<hir::CoroutineKind> {
+ desc { |tcx| "looking up coroutine kind of `{}`", tcx.def_path_str(def_id) }
separate_provide_extern
}
@@ -975,8 +968,9 @@ rustc_queries! {
desc { |tcx| "checking that impls are well-formed in {}", describe_as_module(key, tcx) }
}
- query check_mod_type_wf(key: LocalModDefId) -> () {
+ query check_mod_type_wf(key: LocalModDefId) -> Result<(), ErrorGuaranteed> {
desc { |tcx| "checking that types are well-formed in {}", describe_as_module(key, tcx) }
+ ensure_forwards_result_if_red
}
query collect_mod_item_types(key: LocalModDefId) -> () {
@@ -1107,10 +1101,6 @@ rustc_queries! {
desc { "destructuring type level constant"}
}
- query const_caller_location(key: (rustc_span::Symbol, u32, u32)) -> mir::ConstValue<'tcx> {
- desc { "getting a &core::panic::Location referring to a span" }
- }
-
// FIXME get rid of this with valtrees
query lit_to_const(
key: LitToConstInput<'tcx>
@@ -1509,8 +1499,9 @@ rustc_queries! {
feedable
}
- query check_well_formed(key: hir::OwnerId) -> () {
+ query check_well_formed(key: hir::OwnerId) -> Result<(), ErrorGuaranteed> {
desc { |tcx| "checking that `{}` is well-formed", tcx.def_path_str(key) }
+ ensure_forwards_result_if_red
}
// The `DefId`s of all non-generic functions and statics in the given crate
@@ -1892,12 +1883,6 @@ rustc_queries! {
desc { |tcx| "determining whether `{}` needs codegen", tcx.def_path_str(def_id) }
}
- /// All items participating in code generation together with items inlined into them.
- query codegened_and_inlined_items(_: ()) -> &'tcx DefIdSet {
- eval_always
- desc { "collecting codegened and inlined items" }
- }
-
query codegen_unit(sym: Symbol) -> &'tcx CodegenUnit<'tcx> {
desc { "getting codegen unit `{sym}`" }
}
@@ -2202,6 +2187,11 @@ rustc_queries! {
query generics_require_sized_self(def_id: DefId) -> bool {
desc { "check whether the item has a `where Self: Sized` bound" }
}
+
+ query cross_crate_inlinable(def_id: DefId) -> bool {
+ desc { "whether the item should be made inlinable across crates" }
+ separate_provide_extern
+ }
}
rustc_query_append! { define_callbacks! }