@@ -775,17 +775,13 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
775
775
) ;
776
776
}
777
777
ty:: Array ( tys, ..) | ty:: Slice ( tys)
778
- if {
779
- // This optimization applies for types that can hold arbitrary bytes (such as
780
- // integer and floating point types) or for structs or tuples with no fields.
781
- // FIXME(wesleywiser) This logic could be extended further to arbitrary structs
782
- // or tuples made up of integer/floating point types or inhabited ZSTs with no
783
- // padding.
784
- match tys. kind ( ) {
785
- ty:: Int ( ..) | ty:: Uint ( ..) | ty:: Float ( ..) => true ,
786
- _ => false ,
787
- }
788
- } =>
778
+ // This optimization applies for types that can hold arbitrary bytes (such as
779
+ // integer and floating point types) or for structs or tuples with no fields.
780
+ // FIXME(wesleywiser) This logic could be extended further to arbitrary structs
781
+ // or tuples made up of integer/floating point types or inhabited ZSTs with no
782
+ // padding.
783
+ if matches ! ( tys. kind( ) , ty:: Int ( ..) | ty:: Uint ( ..) | ty:: Float ( ..) )
784
+ =>
789
785
{
790
786
// Optimized handling for arrays of integer/float type.
791
787
@@ -853,7 +849,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
853
849
// of an array and not all of them, because there's only a single value of a specific
854
850
// ZST type, so either validation fails for all elements or none.
855
851
ty:: Array ( tys, ..) | ty:: Slice ( tys) if self . ecx . layout_of ( tys) ?. is_zst ( ) => {
856
- // Validate just the first element
852
+ // Validate just the first element (if any).
857
853
self . walk_aggregate ( op, fields. take ( 1 ) ) ?
858
854
}
859
855
_ => {
0 commit comments