File tree 1 file changed +18
-2
lines changed
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -378,11 +378,27 @@ impl FnType {
378
378
if abi == Abi :: Rust || abi == Abi :: RustCall ||
379
379
abi == Abi :: RustIntrinsic || abi == Abi :: PlatformIntrinsic {
380
380
let fixup = |arg : & mut ArgType | {
381
- if !arg. ty . is_aggregate ( ) {
381
+ let mut llty = arg. ty ;
382
+
383
+ // Replace newtypes with their inner-most type.
384
+ while llty. kind ( ) == llvm:: TypeKind :: Struct {
385
+ let inner = llty. field_types ( ) ;
386
+ if inner. len ( ) != 1 {
387
+ break ;
388
+ }
389
+ llty = inner[ 0 ] ;
390
+ }
391
+
392
+ if !llty. is_aggregate ( ) {
382
393
// Scalars and vectors, always immediate.
394
+ if llty != arg. ty {
395
+ // Needs a cast as we've unpacked a newtype.
396
+ arg. cast = Some ( llty) ;
397
+ }
383
398
return ;
384
399
}
385
- let size = llsize_of_real ( ccx, arg. ty ) ;
400
+
401
+ let size = llsize_of_real ( ccx, llty) ;
386
402
if size > llsize_of_real ( ccx, ccx. int_type ( ) ) {
387
403
arg. make_indirect ( ccx) ;
388
404
} else if size > 0 {
You can’t perform that action at this time.
0 commit comments