File tree 1 file changed +4
-3
lines changed
src/tools/clippy/clippy_utils/src
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -725,13 +725,14 @@ fn field_of_struct<'tcx>(
725
725
result : mir:: ConstantKind < ' tcx > ,
726
726
field : & Ident ,
727
727
) -> Option < mir:: ConstantKind < ' tcx > > {
728
- if let Some ( dc) = lcx. tcx . try_destructure_mir_constant ( lcx. param_env . and ( result) )
728
+ if let mir:: ConstantKind :: Val ( result, ty) = result
729
+ && let Some ( dc) = lcx. tcx . try_destructure_mir_constant_for_diagnostics ( ( result, ty) )
729
730
&& let Some ( dc_variant) = dc. variant
730
731
&& let Some ( variant) = adt_def. variants ( ) . get ( dc_variant)
731
732
&& let Some ( field_idx) = variant. fields . iter ( ) . position ( |el| el. name == field. name )
732
- && let Some ( dc_field ) = dc. fields . get ( field_idx)
733
+ && let Some ( & ( val , ty ) ) = dc. fields . get ( field_idx)
733
734
{
734
- Some ( * dc_field )
735
+ Some ( mir :: ConstantKind :: Val ( val , ty ) )
735
736
}
736
737
else {
737
738
None
You can’t perform that action at this time.
0 commit comments