@@ -211,7 +211,7 @@ impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
211211 OperandValue :: Ref ( val, None , self . layout . align . abi ) . store ( bx, dst)
212212 } else if self . is_unsized_indirect ( ) {
213213 bug ! ( "unsized `ArgAbi` must be handled through `store_fn_arg`" ) ;
214- } else if let PassMode :: Cast ( cast, _ ) = & self . mode {
214+ } else if let PassMode :: Cast { cast, pad_i32 : _ } = & self . mode {
215215 // FIXME(eddyb): Figure out when the simpler Store is safe, clang
216216 // uses it for i16 -> {i8, i8}, but not for i24 -> {i8, i8, i8}.
217217 let can_store_through_cast_ptr = false ;
@@ -279,7 +279,7 @@ impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
279279 }
280280 PassMode :: Direct ( _)
281281 | PassMode :: Indirect { attrs : _, extra_attrs : None , on_stack : _ }
282- | PassMode :: Cast ( .. ) => {
282+ | PassMode :: Cast { .. } => {
283283 let next_arg = next ( ) ;
284284 self . store ( bx, next_arg, dst) ;
285285 }
@@ -332,7 +332,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
332332 let llreturn_ty = match & self . ret . mode {
333333 PassMode :: Ignore => cx. type_void ( ) ,
334334 PassMode :: Direct ( _) | PassMode :: Pair ( ..) => self . ret . layout . immediate_llvm_type ( cx) ,
335- PassMode :: Cast ( cast, _ ) => cast. llvm_type ( cx) ,
335+ PassMode :: Cast { cast, pad_i32 : _ } => cast. llvm_type ( cx) ,
336336 PassMode :: Indirect { .. } => {
337337 llargument_tys. push ( cx. type_ptr ( ) ) ;
338338 cx. type_void ( )
@@ -390,7 +390,9 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
390390 llargument_tys. push ( ptr_layout. scalar_pair_element_llvm_type ( cx, 1 , true ) ) ;
391391 continue ;
392392 }
393- PassMode :: Cast ( cast, pad_i32) => {
393+ PassMode :: Cast { cast, pad_i32 } => {
394+ // `Cast` means "transmute to `CastType`"; that only makes sense for sized types.
395+ assert ! ( arg. layout. is_sized( ) ) ;
394396 // add padding
395397 if * pad_i32 {
396398 llargument_tys. push ( Reg :: i32 ( ) . llvm_type ( cx) ) ;
@@ -448,7 +450,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
448450 let sret = llvm:: CreateStructRetAttr ( cx. llcx , self . ret . layout . llvm_type ( cx) ) ;
449451 attributes:: apply_to_llfn ( llfn, llvm:: AttributePlace :: Argument ( i) , & [ sret] ) ;
450452 }
451- PassMode :: Cast ( cast, _ ) => {
453+ PassMode :: Cast { cast, pad_i32 : _ } => {
452454 cast. attrs . apply_attrs_to_llfn ( llvm:: AttributePlace :: ReturnValue , cx, llfn) ;
453455 }
454456 _ => { }
@@ -474,7 +476,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
474476 apply ( a) ;
475477 apply ( b) ;
476478 }
477- PassMode :: Cast ( cast, pad_i32) => {
479+ PassMode :: Cast { cast, pad_i32 } => {
478480 if * pad_i32 {
479481 apply ( & ArgAttributes :: new ( ) ) ;
480482 }
@@ -510,7 +512,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
510512 let sret = llvm:: CreateStructRetAttr ( bx. cx . llcx , self . ret . layout . llvm_type ( bx) ) ;
511513 attributes:: apply_to_callsite ( callsite, llvm:: AttributePlace :: Argument ( i) , & [ sret] ) ;
512514 }
513- PassMode :: Cast ( cast, _ ) => {
515+ PassMode :: Cast { cast, pad_i32 : _ } => {
514516 cast. attrs . apply_attrs_to_callsite (
515517 llvm:: AttributePlace :: ReturnValue ,
516518 & bx. cx ,
@@ -553,7 +555,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
553555 apply ( bx. cx , a) ;
554556 apply ( bx. cx , b) ;
555557 }
556- PassMode :: Cast ( cast, pad_i32) => {
558+ PassMode :: Cast { cast, pad_i32 } => {
557559 if * pad_i32 {
558560 apply ( bx. cx , & ArgAttributes :: new ( ) ) ;
559561 }
0 commit comments