Skip to content

Commit 8ac1a67

Browse files
committed
Name the destructure_mir_constant query appropriately
1 parent 46cce98 commit 8ac1a67

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

compiler/rustc_const_eval/src/const_eval/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub(crate) fn eval_to_valtree<'tcx>(
8585
}
8686

8787
#[instrument(skip(tcx), level = "debug")]
88-
pub(crate) fn try_destructure_mir_constant<'tcx>(
88+
pub(crate) fn try_destructure_mir_constant_for_diagnostics<'tcx>(
8989
tcx: TyCtxt<'tcx>,
9090
val: ConstValue<'tcx>,
9191
ty: Ty<'tcx>,

compiler/rustc_const_eval/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ pub fn provide(providers: &mut Providers) {
5252
let (param_env, raw) = param_env_and_value.into_parts();
5353
const_eval::eval_to_valtree(tcx, param_env, raw)
5454
};
55-
providers.try_destructure_mir_constant =
56-
|tcx, (cv, ty)| const_eval::try_destructure_mir_constant(tcx, cv, ty);
55+
providers.try_destructure_mir_constant_for_diagnostics =
56+
|tcx, (cv, ty)| const_eval::try_destructure_mir_constant_for_diagnostics(tcx, cv, ty);
5757
providers.valtree_to_const_val = |tcx, (ty, valtree)| {
5858
const_eval::valtree_to_const_value(tcx, ty::ParamEnv::empty().and(ty), valtree)
5959
};

compiler/rustc_middle/src/mir/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2887,8 +2887,8 @@ fn pretty_print_const_value<'tcx>(
28872887
(_, ty::Array(..) | ty::Tuple(..) | ty::Adt(..)) if !ty.has_non_region_param() => {
28882888
let ct = tcx.lift(ct).unwrap();
28892889
let ty = tcx.lift(ty).unwrap();
2890-
if let Some(contents) = tcx.try_destructure_mir_constant((ct, ty)) {
2891-
let fields = contents.fields.to_vec();
2890+
if let Some(contents) = tcx.try_destructure_mir_constant_for_diagnostics((ct, ty)) {
2891+
let fields: Vec<(ConstValue<'_>, Ty<'_>)> = contents.fields.to_vec();
28922892
match *ty.kind() {
28932893
ty::Array(..) => {
28942894
fmt.write_str("[")?;

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ rustc_queries! {
10881088

10891089
/// Tries to destructure an `mir::ConstantKind` ADT or array into its variant index
10901090
/// and its field values. This should only be used for pretty printing.
1091-
query try_destructure_mir_constant(
1091+
query try_destructure_mir_constant_for_diagnostics(
10921092
key: (ConstValue<'tcx>, Ty<'tcx>)
10931093
) -> Option<mir::DestructuredConstant<'tcx>> {
10941094
desc { "destructuring MIR constant"}

0 commit comments

Comments
 (0)