File tree 1 file changed +11
-7
lines changed
compiler/rustc_ty_utils/src
1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -785,13 +785,17 @@ fn fn_abi_adjust_for_abi<'tcx>(
785
785
// so we pick an appropriately sized integer type instead.
786
786
arg. cast_to ( Reg { kind : RegKind :: Integer , size } ) ;
787
787
788
- // Fixup arg attribute with `noundef`.
789
- let PassMode :: Cast { ref mut cast, .. } = & mut arg. mode else {
790
- bug ! ( "this cannot fail because of the previous cast_to `Reg`" ) ;
791
- } ;
792
-
793
- let box CastTarget { ref mut attrs, .. } = cast;
794
- attrs. set ( ArgAttribute :: NoUndef ) ;
788
+ // Let's see if we can add a `noundef`. This is only legal for arrays, definitely
789
+ // not for unions.
790
+ if arg. layout . ty . is_array ( ) {
791
+ // Fixup arg attribute with `noundef`.
792
+ let PassMode :: Cast { ref mut cast, .. } = & mut arg. mode else {
793
+ bug ! ( "this cannot fail because of the previous cast_to `Reg`" ) ;
794
+ } ;
795
+
796
+ let box CastTarget { ref mut attrs, .. } = cast;
797
+ attrs. set ( ArgAttribute :: NoUndef ) ;
798
+ }
795
799
}
796
800
797
801
// If we deduced that this parameter was read-only, add that to the attribute list now.
You can’t perform that action at this time.
0 commit comments