File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -378,11 +378,27 @@ impl FnType {
378378 if abi == Abi :: Rust || abi == Abi :: RustCall ||
379379 abi == Abi :: RustIntrinsic || abi == Abi :: PlatformIntrinsic {
380380 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 ( ) {
382393 // 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+ }
383398 return ;
384399 }
385- let size = llsize_of_real ( ccx, arg. ty ) ;
400+
401+ let size = llsize_of_real ( ccx, llty) ;
386402 if size > llsize_of_real ( ccx, ccx. int_type ( ) ) {
387403 arg. make_indirect ( ccx) ;
388404 } else if size > 0 {
You can’t perform that action at this time.
0 commit comments