Fix valtree changes

This commit is contained in:
Philipp Krones 2023-07-02 14:59:44 +02:00
parent beb0e731de
commit 0cbe963e51
No known key found for this signature in database
GPG Key ID: 1CA0DF2AF59D68A5

View File

@ -725,8 +725,8 @@ fn field_of_struct<'tcx>(
result: mir::ConstantKind<'tcx>, result: mir::ConstantKind<'tcx>,
field: &Ident, field: &Ident,
) -> Option<mir::ConstantKind<'tcx>> { ) -> Option<mir::ConstantKind<'tcx>> {
let dc = lcx.tcx.destructure_mir_constant(lcx.param_env, result); if let Some(dc) = lcx.tcx.try_destructure_mir_constant(lcx.param_env.and(result))
if let Some(dc_variant) = dc.variant && let Some(dc_variant) = dc.variant
&& let Some(variant) = adt_def.variants().get(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(field_idx) = variant.fields.iter().position(|el| el.name == field.name)
&& let Some(dc_field) = dc.fields.get(field_idx) && let Some(dc_field) = dc.fields.get(field_idx)