// Queries marked with `fatal_cycle` do not need the latter implementation,
// as they will raise an fatal error on query cycles instead.
rustc_queries! {
+ Other {
+ query trigger_delay_span_bug(key: DefId) -> () {
+ desc { "trigger a delay span bug" }
+ }
+ }
+
Other {
/// Records the type of every item.
query type_of(key: DefId) -> Ty<'tcx> {
}
/// Maps DefId's that have an associated `mir::Body` to the result
- /// of the MIR qualify_consts pass. The actual meaning of
- /// the value isn't known except to the pass itself.
- query mir_const_qualif(key: DefId) -> (u8, &'tcx BitSet<mir::Local>) {
+ /// of the MIR const-checking pass. This is the set of qualifs in
+ /// the final value of a `const`.
+ query mir_const_qualif(key: DefId) -> mir::ConstQualifs {
desc { |tcx| "const checking `{}`", tcx.def_path_str(key) }
cache_on_disk_if { key.is_local() }
}
/// Fetch the MIR for a given `DefId` right after it's built - this includes
/// unreachable code.
- query mir_built(_: DefId) -> &'tcx Steal<mir::Body<'tcx>> {}
+ query mir_built(_: DefId) -> &'tcx Steal<mir::BodyAndCache<'tcx>> {}
/// Fetch the MIR for a given `DefId` up till the point where it is
/// ready for const evaluation.
///
/// See the README for the `mir` module for details.
- query mir_const(_: DefId) -> &'tcx Steal<mir::Body<'tcx>> {
+ query mir_const(_: DefId) -> &'tcx Steal<mir::BodyAndCache<'tcx>> {
no_hash
}
query mir_validated(_: DefId) ->
(
- &'tcx Steal<mir::Body<'tcx>>,
- &'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>>
+ &'tcx Steal<mir::BodyAndCache<'tcx>>,
+ &'tcx Steal<IndexVec<mir::Promoted, mir::BodyAndCache<'tcx>>>
) {
no_hash
}
/// MIR after our optimization passes have run. This is MIR that is ready
/// for codegen. This is also the only query that can fetch non-local MIR, at present.
- query optimized_mir(key: DefId) -> &'tcx mir::Body<'tcx> {
+ query optimized_mir(key: DefId) -> &'tcx mir::BodyAndCache<'tcx> {
cache_on_disk_if { key.is_local() }
load_cached(tcx, id) {
- let mir: Option<crate::mir::Body<'tcx>> = tcx.queries.on_disk_cache
- .try_load_query_result(tcx, id);
- mir.map(|x| &*tcx.arena.alloc(x))
+ let mir: Option<crate::mir::BodyAndCache<'tcx>>
+ = tcx.queries.on_disk_cache.try_load_query_result(tcx, id);
+ mir.map(|x| {
+ let cache = tcx.arena.alloc(x);
+ cache.ensure_predecessors();
+ &*cache
+ })
}
}
- query promoted_mir(key: DefId) -> &'tcx IndexVec<mir::Promoted, mir::Body<'tcx>> {
+ query promoted_mir(key: DefId) -> &'tcx IndexVec<mir::Promoted, mir::BodyAndCache<'tcx>> {
cache_on_disk_if { key.is_local() }
load_cached(tcx, id) {
let promoted: Option<
rustc_index::vec::IndexVec<
crate::mir::Promoted,
- crate::mir::Body<'tcx>
+ crate::mir::BodyAndCache<'tcx>
>> = tcx.queries.on_disk_cache.try_load_query_result(tcx, id);
- promoted.map(|p| &*tcx.arena.alloc(p))
+ promoted.map(|p| {
+ let cache = tcx.arena.alloc(p);
+ for body in cache.iter_mut() {
+ body.ensure_predecessors();
+ }
+ &*cache
+ })
}
}
}
cycle_delay_bug
}
- query trivial_dropck_outlives(ty: Ty<'tcx>) -> bool {
- anon
- no_force
- desc { "checking if `{:?}` has trivial dropck", ty }
- }
-
query adt_dtorck_constraint(
_: DefId
) -> Result<DtorckConstraint<'tcx>, NoSolution> {}
desc { |tcx| "checking for unstable API usage in {}", key.describe_as_module(tcx) }
}
+ /// Checks the const bodies in the module for illegal operations (e.g. `if` or `loop`).
+ query check_mod_const_bodies(key: DefId) -> () {
+ desc { |tcx| "checking consts in {}", key.describe_as_module(tcx) }
+ }
+
/// Checks the loops in the module.
query check_mod_loops(key: DefId) -> () {
desc { |tcx| "checking loops in {}", key.describe_as_module(tcx) }
/// in the case of closures, this will be redirected to the enclosing function.
query region_scope_tree(_: DefId) -> &'tcx region::ScopeTree {}
- query mir_shims(key: ty::InstanceDef<'tcx>) -> &'tcx mir::Body<'tcx> {
+ query mir_shims(key: ty::InstanceDef<'tcx>) -> &'tcx mir::BodyAndCache<'tcx> {
no_force
desc { |tcx| "generating MIR shim for `{}`", tcx.def_path_str(key.def_id()) }
}
eval_always
}
query lookup_stability(_: DefId) -> Option<&'tcx attr::Stability> {}
+ query lookup_const_stability(_: DefId) -> Option<&'tcx attr::ConstStability> {}
query lookup_deprecation_entry(_: DefId) -> Option<DeprecationEntry> {}
query item_attrs(_: DefId) -> Lrc<[ast::Attribute]> {}
}
desc { |tcx| "estimating size for `{}`", tcx.def_path_str(def.def_id()) }
}
- query features_query(_: CrateNum) -> &'tcx feature_gate::Features {
+ query features_query(_: CrateNum) -> &'tcx rustc_feature::Features {
eval_always
desc { "looking up enabled feature gates" }
}