about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-09-13 15:15:00 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-09-28 14:12:51 +0000
commitb76caa1a08cd46f3123dba13568f4a3ab85c11cb (patch)
tree40c9fa4af2633627c1b8ccc995ee51d74439f75d
parent7c76587edc7f5edb73cb8a1c45faa352cd036c62 (diff)
downloadrust-b76caa1a08cd46f3123dba13568f4a3ab85c11cb.tar.gz
rust-b76caa1a08cd46f3123dba13568f4a3ab85c11cb.zip
Expose try_destructure_mir_constant_for_diagnostics directly to clippy
Otherwise clippy tries to use the query in ways that incremental caching will inevitably cause problems with.
-rw-r--r--compiler/rustc_const_eval/src/const_eval/mod.rs2
-rw-r--r--src/tools/clippy/clippy_utils/src/consts.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/mod.rs b/compiler/rustc_const_eval/src/const_eval/mod.rs
index ef31155215a..854104622f1 100644
--- a/compiler/rustc_const_eval/src/const_eval/mod.rs
+++ b/compiler/rustc_const_eval/src/const_eval/mod.rs
@@ -85,7 +85,7 @@ pub(crate) fn eval_to_valtree<'tcx>(
 }
 
 #[instrument(skip(tcx), level = "debug")]
-pub(crate) fn try_destructure_mir_constant_for_diagnostics<'tcx>(
+pub fn try_destructure_mir_constant_for_diagnostics<'tcx>(
     tcx: TyCtxt<'tcx>,
     val: ConstValue<'tcx>,
     ty: Ty<'tcx>,
diff --git a/src/tools/clippy/clippy_utils/src/consts.rs b/src/tools/clippy/clippy_utils/src/consts.rs
index adeb673b6b9..6d57af3250c 100644
--- a/src/tools/clippy/clippy_utils/src/consts.rs
+++ b/src/tools/clippy/clippy_utils/src/consts.rs
@@ -724,7 +724,7 @@ fn field_of_struct<'tcx>(
     field: &Ident,
 ) -> Option<mir::ConstantKind<'tcx>> {
     if let mir::ConstantKind::Val(result, ty) = result
-        && let Some(dc) = lcx.tcx.try_destructure_mir_constant_for_diagnostics((result, ty))
+        && let Some(dc) = rustc_const_eval::const_eval::try_destructure_mir_constant_for_diagnostics(lcx.tcx, result, ty)
         && let Some(dc_variant) = dc.variant
         && let Some(variant) = adt_def.variants().get(dc_variant)
         && let Some(field_idx) = variant.fields.iter().position(|el| el.name == field.name)