@@ -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 // `Cast` means "transmute to `CastType`"; that only makes sense for sized types.
395401 assert ! ( arg. layout. is_sized( ) ) ;
@@ -401,7 +407,6 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
401407 // We assume here that ABI-compatible Rust types have the same cast type.
402408 cast. llvm_type ( cx)
403409 }
404- PassMode :: Indirect { attrs : _, extra_attrs : None , on_stack : _ } => cx. type_ptr ( ) ,
405410 } ;
406411 llargument_tys. push ( llarg_ty) ;
407412 }
@@ -444,7 +449,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
444449 PassMode :: Direct ( attrs) => {
445450 attrs. apply_attrs_to_llfn ( llvm:: AttributePlace :: ReturnValue , cx, llfn) ;
446451 }
447- PassMode :: Indirect { attrs, extra_attrs : _, on_stack } => {
452+ PassMode :: Indirect { attrs, meta_attrs : _, on_stack } => {
448453 assert ! ( !on_stack) ;
449454 let i = apply ( attrs) ;
450455 let sret = llvm:: CreateStructRetAttr ( cx. llcx , self . ret . layout . llvm_type ( cx) ) ;
@@ -458,19 +463,19 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
458463 for arg in self . args . iter ( ) {
459464 match & arg. mode {
460465 PassMode :: Ignore => { }
461- PassMode :: Indirect { attrs, extra_attrs : None , on_stack : true } => {
466+ PassMode :: Indirect { attrs, meta_attrs : None , on_stack : true } => {
462467 let i = apply ( attrs) ;
463468 let byval = llvm:: CreateByValAttr ( cx. llcx , arg. layout . llvm_type ( cx) ) ;
464469 attributes:: apply_to_llfn ( llfn, llvm:: AttributePlace :: Argument ( i) , & [ byval] ) ;
465470 }
466471 PassMode :: Direct ( attrs)
467- | PassMode :: Indirect { attrs, extra_attrs : None , on_stack : false } => {
472+ | PassMode :: Indirect { attrs, meta_attrs : None , on_stack : false } => {
468473 apply ( attrs) ;
469474 }
470- PassMode :: Indirect { attrs, extra_attrs : Some ( extra_attrs ) , on_stack } => {
475+ PassMode :: Indirect { attrs, meta_attrs : Some ( meta_attrs ) , on_stack } => {
471476 assert ! ( !on_stack) ;
472477 apply ( attrs) ;
473- apply ( extra_attrs ) ;
478+ apply ( meta_attrs ) ;
474479 }
475480 PassMode :: Pair ( a, b) => {
476481 apply ( a) ;
@@ -506,7 +511,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
506511 PassMode :: Direct ( attrs) => {
507512 attrs. apply_attrs_to_callsite ( llvm:: AttributePlace :: ReturnValue , bx. cx , callsite) ;
508513 }
509- PassMode :: Indirect { attrs, extra_attrs : _, on_stack } => {
514+ PassMode :: Indirect { attrs, meta_attrs : _, on_stack } => {
510515 assert ! ( !on_stack) ;
511516 let i = apply ( bx. cx , attrs) ;
512517 let sret = llvm:: CreateStructRetAttr ( bx. cx . llcx , self . ret . layout . llvm_type ( bx) ) ;
@@ -534,7 +539,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
534539 for arg in self . args . iter ( ) {
535540 match & arg. mode {
536541 PassMode :: Ignore => { }
537- PassMode :: Indirect { attrs, extra_attrs : None , on_stack : true } => {
542+ PassMode :: Indirect { attrs, meta_attrs : None , on_stack : true } => {
538543 let i = apply ( bx. cx , attrs) ;
539544 let byval = llvm:: CreateByValAttr ( bx. cx . llcx , arg. layout . llvm_type ( bx) ) ;
540545 attributes:: apply_to_callsite (
@@ -544,12 +549,12 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
544549 ) ;
545550 }
546551 PassMode :: Direct ( attrs)
547- | PassMode :: Indirect { attrs, extra_attrs : None , on_stack : false } => {
552+ | PassMode :: Indirect { attrs, meta_attrs : None , on_stack : false } => {
548553 apply ( bx. cx , attrs) ;
549554 }
550- PassMode :: Indirect { attrs, extra_attrs : Some ( extra_attrs ) , on_stack : _ } => {
555+ PassMode :: Indirect { attrs, meta_attrs : Some ( meta_attrs ) , on_stack : _ } => {
551556 apply ( bx. cx , attrs) ;
552- apply ( bx. cx , extra_attrs ) ;
557+ apply ( bx. cx , meta_attrs ) ;
553558 }
554559 PassMode :: Pair ( a, b) => {
555560 apply ( bx. cx , a) ;
0 commit comments