Skip to content

Commit afdcae2

Browse files
committed
Rename mir_const query to mir_built
1 parent 36728f1 commit afdcae2

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

compiler/rustc_middle/src/hooks/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ declare_hooks! {
8181
/// Create the MIR for a given `DefId` - this includes
8282
/// unreachable code.
8383
/// You do not want to call this yourself, instead use the cached version
84-
/// via `mir_const`
84+
/// via `mir_built`
8585
hook build_mir(key: LocalDefId) -> mir::Body<'tcx>;
8686
}

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ rustc_queries! {
489489
/// ready for const qualification.
490490
///
491491
/// See the README for the `mir` module for details.
492-
query mir_const(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
492+
query mir_built(key: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
493493
desc { |tcx| "preparing `{}` for borrow checking", tcx.def_path_str(key) }
494494
}
495495

compiler/rustc_mir_build/src/check_unsafety.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
139139
fn visit_inner_body(&mut self, def: LocalDefId) {
140140
if let Ok((inner_thir, expr)) = self.tcx.thir_body(def) {
141141
// Runs all other queries that depend on THIR.
142-
self.tcx.ensure_with_value().mir_const(def);
142+
self.tcx.ensure_with_value().mir_built(def);
143143
let inner_thir = &inner_thir.steal();
144144
let hir_context = self.tcx.local_def_id_to_hir_id(def);
145145
let safety_context = mem::replace(&mut self.safety_context, SafetyContext::Safe);
@@ -921,7 +921,7 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) {
921921

922922
let Ok((thir, expr)) = tcx.thir_body(def) else { return };
923923
// Runs all other queries that depend on THIR.
924-
tcx.ensure_with_value().mir_const(def);
924+
tcx.ensure_with_value().mir_built(def);
925925
let thir = &thir.steal();
926926
// If `thir` is empty, a type error occurred, skip this body.
927927
if thir.exprs.is_empty() {

compiler/rustc_mir_transform/src/check_unsafety.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ fn mir_unsafety_check_result(tcx: TyCtxt<'_>, def: LocalDefId) -> &UnsafetyCheck
497497
debug!("unsafety_violations({:?})", def);
498498

499499
// N.B., this borrow is valid because all the consumers of
500-
// `mir_const` force this.
501-
let body = &tcx.mir_const(def).borrow();
500+
// `mir_built` force this.
501+
let body = &tcx.mir_built(def).borrow();
502502

503503
if body.is_custom_mir() || body.tainted_by_errors.is_some() {
504504
return tcx.arena.alloc(UnsafetyCheckResult {

compiler/rustc_mir_transform/src/ffi_unwind_calls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
5353
return false;
5454
}
5555

56-
let body = &*tcx.mir_const(local_def_id).borrow();
56+
let body = &*tcx.mir_built(local_def_id).borrow();
5757

5858
let body_ty = tcx.type_of(def_id).skip_binder();
5959
let body_abi = match body_ty.kind() {

compiler/rustc_mir_transform/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ pub fn provide(providers: &mut Providers) {
127127
cross_crate_inline::provide(providers);
128128
providers.queries = query::Providers {
129129
mir_keys,
130-
mir_const,
130+
mir_built,
131131
mir_const_qualif,
132132
mir_promoted,
133133
mir_drops_elaborated_and_const_checked,
@@ -259,9 +259,9 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: LocalDefId) -> ConstQualifs {
259259

260260
// N.B., this `borrow()` is guaranteed to be valid (i.e., the value
261261
// cannot yet be stolen), because `mir_promoted()`, which steals
262-
// from `mir_const()`, forces this query to execute before
262+
// from `mir_built()`, forces this query to execute before
263263
// performing the steal.
264-
let body = &tcx.mir_const(def).borrow();
264+
let body = &tcx.mir_built(def).borrow();
265265

266266
if body.return_ty().references_error() {
267267
// 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 {
282282
/// Make MIR ready for const evaluation. This is run on all MIR, not just on consts!
283283
/// FIXME(oli-obk): it's unclear whether we still need this phase (and its corresponding query).
284284
/// We used to have this for pre-miri MIR based const eval.
285-
fn mir_const(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal<Body<'_>> {
285+
fn mir_built(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal<Body<'_>> {
286286
// MIR unsafety check uses the raw mir, so make sure it is run.
287287
if !tcx.sess.opts.unstable_opts.thir_unsafeck {
288288
tcx.ensure_with_value().mir_unsafety_check_result(def);
@@ -338,7 +338,7 @@ fn mir_promoted(
338338
};
339339
// has_ffi_unwind_calls query uses the raw mir, so make sure it is run.
340340
tcx.ensure_with_value().has_ffi_unwind_calls(def);
341-
let mut body = tcx.mir_const(def).steal();
341+
let mut body = tcx.mir_built(def).steal();
342342
if let Some(error_reported) = const_qualifs.tainted_by_errors {
343343
body.tainted_by_errors = Some(error_reported);
344344
}

tests/ui/resolve/multiple_definitions_attribute_merging.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LL | struct Dealigned<T>(u8, T);
1818
|
1919
= Box<dyn Any>
2020
query stack during panic:
21-
#0 [mir_const] preparing `<impl at $DIR/multiple_definitions_attribute_merging.rs:15:10: 15:19>::eq` for borrow checking
21+
#0 [mir_built] preparing `<impl at $DIR/multiple_definitions_attribute_merging.rs:15:10: 15:19>::eq` for borrow checking
2222
#1 [check_unsafety] unsafety-checking `<impl at $DIR/multiple_definitions_attribute_merging.rs:15:10: 15:19>::eq`
2323
end of query stack
2424
error: aborting due to 2 previous errors

tests/ui/resolve/proc_macro_generated_packed.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | struct Dealigned<T>(u8, T);
99
|
1010
= Box<dyn Any>
1111
query stack during panic:
12-
#0 [mir_const] preparing `<impl at $DIR/proc_macro_generated_packed.rs:15:10: 15:19>::eq` for borrow checking
12+
#0 [mir_built] preparing `<impl at $DIR/proc_macro_generated_packed.rs:15:10: 15:19>::eq` for borrow checking
1313
#1 [check_unsafety] unsafety-checking `<impl at $DIR/proc_macro_generated_packed.rs:15:10: 15:19>::eq`
1414
end of query stack
1515
error: aborting due to 1 previous error

0 commit comments

Comments
 (0)