From 0cbe963e51faa7e3e771c1f9cea9aa443a648455 Mon Sep 17 00:00:00 2001 From: Philipp Krones Date: Sun, 2 Jul 2023 14:59:44 +0200 Subject: [PATCH] Fix valtree changes --- src/tools/clippy/clippy_utils/src/consts.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/clippy/clippy_utils/src/consts.rs b/src/tools/clippy/clippy_utils/src/consts.rs index 068820801df..dd3cda8ec52 100644 --- a/src/tools/clippy/clippy_utils/src/consts.rs +++ b/src/tools/clippy/clippy_utils/src/consts.rs @@ -725,8 +725,8 @@ fn field_of_struct<'tcx>( result: mir::ConstantKind<'tcx>, field: &Ident, ) -> Option> { - let dc = lcx.tcx.destructure_mir_constant(lcx.param_env, result); - if let Some(dc_variant) = dc.variant + if let Some(dc) = lcx.tcx.try_destructure_mir_constant(lcx.param_env.and(result)) + && 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) && let Some(dc_field) = dc.fields.get(field_idx)