File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
src/tools/clippy/clippy_utils/src Expand file tree Collapse file tree 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>(
725725 result : mir:: ConstantKind < ' tcx > ,
726726 field : & Ident ,
727727) -> 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) )
729730 && let Some ( dc_variant) = dc. variant
730731 && let Some ( variant) = adt_def. variants ( ) . get ( dc_variant)
731732 && 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)
733734 {
734- Some ( * dc_field )
735+ Some ( mir :: ConstantKind :: Val ( val , ty ) )
735736 }
736737 else {
737738 None
You can’t perform that action at this time.
0 commit comments