Skip to content

Commit ef196ae

Browse files
committed
Rename hook.
1 parent 36c46c0 commit ef196ae

File tree

5 files changed

+6
-6
lines changed

5 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
@@ -72,7 +72,7 @@ pub(crate) fn eval_to_valtree<'tcx>(
7272
}
7373

7474
#[instrument(skip(tcx), level = "debug")]
75-
pub(crate) fn try_destructure_mir_constant_for_diagnostics<'tcx>(
75+
pub(crate) fn try_destructure_mir_constant_for_user_output<'tcx>(
7676
tcx: TyCtxtAt<'tcx>,
7777
val: mir::ConstValue<'tcx>,
7878
ty: Ty<'tcx>,

compiler/rustc_const_eval/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ pub fn provide(providers: &mut Providers) {
5454
let (param_env, raw) = param_env_and_value.into_parts();
5555
const_eval::eval_to_valtree(tcx, param_env, raw)
5656
};
57-
providers.hooks.try_destructure_mir_constant_for_diagnostics =
58-
const_eval::try_destructure_mir_constant_for_diagnostics;
57+
providers.hooks.try_destructure_mir_constant_for_user_output =
58+
const_eval::try_destructure_mir_constant_for_user_output;
5959
providers.valtree_to_const_val = |tcx, (ty, valtree)| {
6060
const_eval::valtree_to_const_value(tcx, ty::ParamEnv::empty().and(ty), valtree)
6161
};

compiler/rustc_middle/src/hooks/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ macro_rules! declare_hooks {
6666
declare_hooks! {
6767
/// Tries to destructure an `mir::Const` ADT or array into its variant index
6868
/// and its field values. This should only be used for pretty printing.
69-
hook try_destructure_mir_constant_for_diagnostics(val: mir::ConstValue<'tcx>, ty: Ty<'tcx>) -> Option<mir::DestructuredConstant<'tcx>>;
69+
hook try_destructure_mir_constant_for_user_output(val: mir::ConstValue<'tcx>, ty: Ty<'tcx>) -> Option<mir::DestructuredConstant<'tcx>>;
7070

7171
/// Getting a &core::panic::Location referring to a span.
7272
hook const_caller_location(file: rustc_span::Symbol, line: u32, col: u32) -> mir::ConstValue<'tcx>;

compiler/rustc_middle/src/mir/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@ fn pretty_print_const_value_tcx<'tcx>(
17131713
(_, ty::Array(..) | ty::Tuple(..) | ty::Adt(..)) if !ty.has_non_region_param() => {
17141714
let ct = tcx.lift(ct).unwrap();
17151715
let ty = tcx.lift(ty).unwrap();
1716-
if let Some(contents) = tcx.try_destructure_mir_constant_for_diagnostics(ct, ty) {
1716+
if let Some(contents) = tcx.try_destructure_mir_constant_for_user_output(ct, ty) {
17171717
let fields: Vec<(ConstValue<'_>, Ty<'_>)> = contents.fields.to_vec();
17181718
match *ty.kind() {
17191719
ty::Array(..) => {

src/tools/clippy/clippy_utils/src/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ fn field_of_struct<'tcx>(
710710
field: &Ident,
711711
) -> Option<mir::Const<'tcx>> {
712712
if let mir::Const::Val(result, ty) = result
713-
&& let Some(dc) = lcx.tcx.try_destructure_mir_constant_for_diagnostics(result, ty)
713+
&& let Some(dc) = lcx.tcx.try_destructure_mir_constant_for_user_output(result, ty)
714714
&& let Some(dc_variant) = dc.variant
715715
&& let Some(variant) = adt_def.variants().get(dc_variant)
716716
&& let Some(field_idx) = variant.fields.iter().position(|el| el.name == field.name)

0 commit comments

Comments
 (0)