mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 20:46:48 +00:00
Rename mir_const query to mir_built
This commit is contained in:
parent
36728f1cdd
commit
afdcae2860
@ -81,6 +81,6 @@ declare_hooks! {
|
||||
/// Create the MIR for a given `DefId` - this includes
|
||||
/// unreachable code.
|
||||
/// You do not want to call this yourself, instead use the cached version
|
||||
/// via `mir_const`
|
||||
/// via `mir_built`
|
||||
hook build_mir(key: LocalDefId) -> mir::Body<'tcx>;
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ rustc_queries! {
|
||||
/// ready for const qualification.
|
||||
///
|
||||
/// See the README for the `mir` module for details.
|
||||
query mir_const(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
|
||||
query mir_built(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
|
||||
desc { |tcx| "preparing `{}` for borrow checking", tcx.def_path_str(key) }
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
|
||||
fn visit_inner_body(&mut self, def: LocalDefId) {
|
||||
if let Ok((inner_thir, expr)) = self.tcx.thir_body(def) {
|
||||
// Runs all other queries that depend on THIR.
|
||||
self.tcx.ensure_with_value().mir_const(def);
|
||||
self.tcx.ensure_with_value().mir_built(def);
|
||||
let inner_thir = &inner_thir.steal();
|
||||
let hir_context = self.tcx.local_def_id_to_hir_id(def);
|
||||
let safety_context = mem::replace(&mut self.safety_context, SafetyContext::Safe);
|
||||
@ -921,7 +921,7 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) {
|
||||
|
||||
let Ok((thir, expr)) = tcx.thir_body(def) else { return };
|
||||
// Runs all other queries that depend on THIR.
|
||||
tcx.ensure_with_value().mir_const(def);
|
||||
tcx.ensure_with_value().mir_built(def);
|
||||
let thir = &thir.steal();
|
||||
// If `thir` is empty, a type error occurred, skip this body.
|
||||
if thir.exprs.is_empty() {
|
||||
|
@ -497,8 +497,8 @@ fn mir_unsafety_check_result(tcx: TyCtxt<'_>, def: LocalDefId) -> &UnsafetyCheck
|
||||
debug!("unsafety_violations({:?})", def);
|
||||
|
||||
// N.B., this borrow is valid because all the consumers of
|
||||
// `mir_const` force this.
|
||||
let body = &tcx.mir_const(def).borrow();
|
||||
// `mir_built` force this.
|
||||
let body = &tcx.mir_built(def).borrow();
|
||||
|
||||
if body.is_custom_mir() || body.tainted_by_errors.is_some() {
|
||||
return tcx.arena.alloc(UnsafetyCheckResult {
|
||||
|
@ -53,7 +53,7 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
let body = &*tcx.mir_const(local_def_id).borrow();
|
||||
let body = &*tcx.mir_built(local_def_id).borrow();
|
||||
|
||||
let body_ty = tcx.type_of(def_id).skip_binder();
|
||||
let body_abi = match body_ty.kind() {
|
||||
|
@ -127,7 +127,7 @@ pub fn provide(providers: &mut Providers) {
|
||||
cross_crate_inline::provide(providers);
|
||||
providers.queries = query::Providers {
|
||||
mir_keys,
|
||||
mir_const,
|
||||
mir_built,
|
||||
mir_const_qualif,
|
||||
mir_promoted,
|
||||
mir_drops_elaborated_and_const_checked,
|
||||
@ -259,9 +259,9 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: LocalDefId) -> ConstQualifs {
|
||||
|
||||
// N.B., this `borrow()` is guaranteed to be valid (i.e., the value
|
||||
// cannot yet be stolen), because `mir_promoted()`, which steals
|
||||
// from `mir_const()`, forces this query to execute before
|
||||
// from `mir_built()`, forces this query to execute before
|
||||
// performing the steal.
|
||||
let body = &tcx.mir_const(def).borrow();
|
||||
let body = &tcx.mir_built(def).borrow();
|
||||
|
||||
if body.return_ty().references_error() {
|
||||
// It's possible to reach here without an error being emitted (#121103).
|
||||
@ -282,7 +282,7 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: LocalDefId) -> ConstQualifs {
|
||||
/// Make MIR ready for const evaluation. This is run on all MIR, not just on consts!
|
||||
/// FIXME(oli-obk): it's unclear whether we still need this phase (and its corresponding query).
|
||||
/// We used to have this for pre-miri MIR based const eval.
|
||||
fn mir_const(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal<Body<'_>> {
|
||||
fn mir_built(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal<Body<'_>> {
|
||||
// MIR unsafety check uses the raw mir, so make sure it is run.
|
||||
if !tcx.sess.opts.unstable_opts.thir_unsafeck {
|
||||
tcx.ensure_with_value().mir_unsafety_check_result(def);
|
||||
@ -338,7 +338,7 @@ fn mir_promoted(
|
||||
};
|
||||
// has_ffi_unwind_calls query uses the raw mir, so make sure it is run.
|
||||
tcx.ensure_with_value().has_ffi_unwind_calls(def);
|
||||
let mut body = tcx.mir_const(def).steal();
|
||||
let mut body = tcx.mir_built(def).steal();
|
||||
if let Some(error_reported) = const_qualifs.tainted_by_errors {
|
||||
body.tainted_by_errors = Some(error_reported);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ LL | struct Dealigned<T>(u8, T);
|
||||
|
|
||||
= Box<dyn Any>
|
||||
query stack during panic:
|
||||
#0 [mir_const] preparing `<impl at $DIR/multiple_definitions_attribute_merging.rs:15:10: 15:19>::eq` for borrow checking
|
||||
#0 [mir_built] preparing `<impl at $DIR/multiple_definitions_attribute_merging.rs:15:10: 15:19>::eq` for borrow checking
|
||||
#1 [check_unsafety] unsafety-checking `<impl at $DIR/multiple_definitions_attribute_merging.rs:15:10: 15:19>::eq`
|
||||
end of query stack
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -9,7 +9,7 @@ LL | struct Dealigned<T>(u8, T);
|
||||
|
|
||||
= Box<dyn Any>
|
||||
query stack during panic:
|
||||
#0 [mir_const] preparing `<impl at $DIR/proc_macro_generated_packed.rs:15:10: 15:19>::eq` for borrow checking
|
||||
#0 [mir_built] preparing `<impl at $DIR/proc_macro_generated_packed.rs:15:10: 15:19>::eq` for borrow checking
|
||||
#1 [check_unsafety] unsafety-checking `<impl at $DIR/proc_macro_generated_packed.rs:15:10: 15:19>::eq`
|
||||
end of query stack
|
||||
error: aborting due to 1 previous error
|
||||
|
Loading…
Reference in New Issue
Block a user