@@ -274,11 +274,11 @@ impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
274274 PassMode :: Pair ( ..) => {
275275 OperandValue :: Pair ( next ( ) , next ( ) ) . store ( bx, dst) ;
276276 }
277- PassMode :: Indirect { attrs : _, extra_attrs : Some ( _) , on_stack : _ } => {
277+ PassMode :: Indirect { attrs : _, meta_attrs : Some ( _) , on_stack : _ } => {
278278 OperandValue :: Ref ( next ( ) , Some ( next ( ) ) , self . layout . align . abi ) . store ( bx, dst) ;
279279 }
280280 PassMode :: Direct ( _)
281- | PassMode :: Indirect { attrs : _, extra_attrs : None , on_stack : _ }
281+ | PassMode :: Indirect { attrs : _, meta_attrs : None , on_stack : _ }
282282 | PassMode :: Cast ( ..) => {
283283 let next_arg = next ( ) ;
284284 self . store ( bx, next_arg, dst) ;
@@ -378,8 +378,10 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
378378 llargument_tys. push ( arg. layout . scalar_pair_element_llvm_type ( cx, 1 , true ) ) ;
379379 continue ;
380380 }
381- PassMode :: Indirect { attrs : _, extra_attrs : Some ( _) , on_stack : _ } => {
382- assert ! ( arg. layout. is_unsized( ) ) ;
381+ PassMode :: Indirect { attrs : _, meta_attrs : Some ( _) , on_stack } => {
382+ // `Indirect` with metadata is only for unsized types, and doesn't work with
383+ // on-stack passing.
384+ assert ! ( arg. layout. is_unsized( ) && !on_stack) ;
383385 // Construct the type of a (wide) pointer to `ty`, and pass its two fields.
384386 // Any two ABI-compatible unsized types have the same metadata type and
385387 // moreover the same metadata value leads to the same dynamic size and
@@ -390,6 +392,10 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
390392 llargument_tys. push ( ptr_layout. scalar_pair_element_llvm_type ( cx, 1 , true ) ) ;
391393 continue ;
392394 }
395+ PassMode :: Indirect { attrs : _, meta_attrs : None , on_stack : _ } => {
396+ assert ! ( arg. layout. is_sized( ) ) ;
397+ cx. type_ptr ( )
398+ }
393399 PassMode :: Cast ( cast, pad_i32) => {
394400 // add padding
395401 if * pad_i32 {
@@ -399,7 +405,6 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
399405 // We assume here that ABI-compatible Rust types have the same cast type.
400406 cast. llvm_type ( cx)
401407 }
402- PassMode :: Indirect { attrs : _, extra_attrs : None , on_stack : _ } => cx. type_ptr ( ) ,
403408 } ;
404409 llargument_tys. push ( llarg_ty) ;
405410 }
@@ -442,7 +447,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
442447 PassMode :: Direct ( attrs) => {
443448 attrs. apply_attrs_to_llfn ( llvm:: AttributePlace :: ReturnValue , cx, llfn) ;
444449 }
445- PassMode :: Indirect { attrs, extra_attrs : _, on_stack } => {
450+ PassMode :: Indirect { attrs, meta_attrs : _, on_stack } => {
446451 assert ! ( !on_stack) ;
447452 let i = apply ( attrs) ;
448453 let sret = llvm:: CreateStructRetAttr ( cx. llcx , self . ret . layout . llvm_type ( cx) ) ;
@@ -456,19 +461,19 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
456461 for arg in self . args . iter ( ) {
457462 match & arg. mode {
458463 PassMode :: Ignore => { }
459- PassMode :: Indirect { attrs, extra_attrs : None , on_stack : true } => {
464+ PassMode :: Indirect { attrs, meta_attrs : None , on_stack : true } => {
460465 let i = apply ( attrs) ;
461466 let byval = llvm:: CreateByValAttr ( cx. llcx , arg. layout . llvm_type ( cx) ) ;
462467 attributes:: apply_to_llfn ( llfn, llvm:: AttributePlace :: Argument ( i) , & [ byval] ) ;
463468 }
464469 PassMode :: Direct ( attrs)
465- | PassMode :: Indirect { attrs, extra_attrs : None , on_stack : false } => {
470+ | PassMode :: Indirect { attrs, meta_attrs : None , on_stack : false } => {
466471 apply ( attrs) ;
467472 }
468- PassMode :: Indirect { attrs, extra_attrs : Some ( extra_attrs ) , on_stack } => {
473+ PassMode :: Indirect { attrs, meta_attrs : Some ( meta_attrs ) , on_stack } => {
469474 assert ! ( !on_stack) ;
470475 apply ( attrs) ;
471- apply ( extra_attrs ) ;
476+ apply ( meta_attrs ) ;
472477 }
473478 PassMode :: Pair ( a, b) => {
474479 apply ( a) ;
@@ -504,7 +509,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
504509 PassMode :: Direct ( attrs) => {
505510 attrs. apply_attrs_to_callsite ( llvm:: AttributePlace :: ReturnValue , bx. cx , callsite) ;
506511 }
507- PassMode :: Indirect { attrs, extra_attrs : _, on_stack } => {
512+ PassMode :: Indirect { attrs, meta_attrs : _, on_stack } => {
508513 assert ! ( !on_stack) ;
509514 let i = apply ( bx. cx , attrs) ;
510515 let sret = llvm:: CreateStructRetAttr ( bx. cx . llcx , self . ret . layout . llvm_type ( bx) ) ;
@@ -532,7 +537,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
532537 for arg in self . args . iter ( ) {
533538 match & arg. mode {
534539 PassMode :: Ignore => { }
535- PassMode :: Indirect { attrs, extra_attrs : None , on_stack : true } => {
540+ PassMode :: Indirect { attrs, meta_attrs : None , on_stack : true } => {
536541 let i = apply ( bx. cx , attrs) ;
537542 let byval = llvm:: CreateByValAttr ( bx. cx . llcx , arg. layout . llvm_type ( bx) ) ;
538543 attributes:: apply_to_callsite (
@@ -542,12 +547,12 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
542547 ) ;
543548 }
544549 PassMode :: Direct ( attrs)
545- | PassMode :: Indirect { attrs, extra_attrs : None , on_stack : false } => {
550+ | PassMode :: Indirect { attrs, meta_attrs : None , on_stack : false } => {
546551 apply ( bx. cx , attrs) ;
547552 }
548- PassMode :: Indirect { attrs, extra_attrs : Some ( extra_attrs ) , on_stack : _ } => {
553+ PassMode :: Indirect { attrs, meta_attrs : Some ( meta_attrs ) , on_stack : _ } => {
549554 apply ( bx. cx , attrs) ;
550- apply ( bx. cx , extra_attrs ) ;
555+ apply ( bx. cx , meta_attrs ) ;
551556 }
552557 PassMode :: Pair ( a, b) => {
553558 apply ( bx. cx , a) ;
0 commit comments