Commit ef196ae 1 parent 36c46c0 commit ef196ae Copy full SHA for ef196ae
File tree 5 files changed +6
-6
lines changed
src/tools/clippy/clippy_utils/src
5 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ pub(crate) fn eval_to_valtree<'tcx>(
72
72
}
73
73
74
74
#[ 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 > (
76
76
tcx : TyCtxtAt < ' tcx > ,
77
77
val : mir:: ConstValue < ' tcx > ,
78
78
ty : Ty < ' tcx > ,
Original file line number Diff line number Diff line change @@ -54,8 +54,8 @@ pub fn provide(providers: &mut Providers) {
54
54
let ( param_env, raw) = param_env_and_value. into_parts ( ) ;
55
55
const_eval:: eval_to_valtree ( tcx, param_env, raw)
56
56
} ;
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 ;
59
59
providers. valtree_to_const_val = |tcx, ( ty, valtree) | {
60
60
const_eval:: valtree_to_const_value ( tcx, ty:: ParamEnv :: empty ( ) . and ( ty) , valtree)
61
61
} ;
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ macro_rules! declare_hooks {
66
66
declare_hooks ! {
67
67
/// Tries to destructure an `mir::Const` ADT or array into its variant index
68
68
/// 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>>;
70
70
71
71
/// Getting a &core::panic::Location referring to a span.
72
72
hook const_caller_location( file: rustc_span:: Symbol , line: u32 , col: u32 ) -> mir:: ConstValue <' tcx>;
Original file line number Diff line number Diff line change @@ -1713,7 +1713,7 @@ fn pretty_print_const_value_tcx<'tcx>(
1713
1713
( _, ty:: Array ( ..) | ty:: Tuple ( ..) | ty:: Adt ( ..) ) if !ty. has_non_region_param ( ) => {
1714
1714
let ct = tcx. lift ( ct) . unwrap ( ) ;
1715
1715
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) {
1717
1717
let fields: Vec < ( ConstValue < ' _ > , Ty < ' _ > ) > = contents. fields . to_vec ( ) ;
1718
1718
match * ty. kind ( ) {
1719
1719
ty:: Array ( ..) => {
Original file line number Diff line number Diff line change @@ -710,7 +710,7 @@ fn field_of_struct<'tcx>(
710
710
field : & Ident ,
711
711
) -> Option < mir:: Const < ' tcx > > {
712
712
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)
714
714
&& let Some ( dc_variant) = dc. variant
715
715
&& let Some ( variant) = adt_def. variants ( ) . get ( dc_variant)
716
716
&& let Some ( field_idx) = variant. fields . iter ( ) . position ( |el| el. name == field. name )
You can’t perform that action at this time.
0 commit comments