@@ -274,11 +274,11 @@ impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
274
274
PassMode :: Pair ( ..) => {
275
275
OperandValue :: Pair ( next ( ) , next ( ) ) . store ( bx, dst) ;
276
276
}
277
- PassMode :: Indirect { attrs : _, extra_attrs : Some ( _) , on_stack : _ } => {
277
+ PassMode :: Indirect { attrs : _, meta_attrs : Some ( _) , on_stack : _ } => {
278
278
OperandValue :: Ref ( next ( ) , Some ( next ( ) ) , self . layout . align . abi ) . store ( bx, dst) ;
279
279
}
280
280
PassMode :: Direct ( _)
281
- | PassMode :: Indirect { attrs : _, extra_attrs : None , on_stack : _ }
281
+ | PassMode :: Indirect { attrs : _, meta_attrs : None , on_stack : _ }
282
282
| PassMode :: Cast { .. } => {
283
283
let next_arg = next ( ) ;
284
284
self . store ( bx, next_arg, dst) ;
@@ -378,8 +378,10 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
378
378
llargument_tys. push ( arg. layout . scalar_pair_element_llvm_type ( cx, 1 , true ) ) ;
379
379
continue ;
380
380
}
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) ;
383
385
// Construct the type of a (wide) pointer to `ty`, and pass its two fields.
384
386
// Any two ABI-compatible unsized types have the same metadata type and
385
387
// 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>> {
390
392
llargument_tys. push ( ptr_layout. scalar_pair_element_llvm_type ( cx, 1 , true ) ) ;
391
393
continue ;
392
394
}
395
+ PassMode :: Indirect { attrs : _, meta_attrs : None , on_stack : _ } => {
396
+ assert ! ( arg. layout. is_sized( ) ) ;
397
+ cx. type_ptr ( )
398
+ }
393
399
PassMode :: Cast { cast, pad_i32 } => {
394
400
// `Cast` means "transmute to `CastType`"; that only makes sense for sized types.
395
401
assert ! ( arg. layout. is_sized( ) ) ;
@@ -401,7 +407,6 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
401
407
// We assume here that ABI-compatible Rust types have the same cast type.
402
408
cast. llvm_type ( cx)
403
409
}
404
- PassMode :: Indirect { attrs : _, extra_attrs : None , on_stack : _ } => cx. type_ptr ( ) ,
405
410
} ;
406
411
llargument_tys. push ( llarg_ty) ;
407
412
}
@@ -444,7 +449,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
444
449
PassMode :: Direct ( attrs) => {
445
450
attrs. apply_attrs_to_llfn ( llvm:: AttributePlace :: ReturnValue , cx, llfn) ;
446
451
}
447
- PassMode :: Indirect { attrs, extra_attrs : _, on_stack } => {
452
+ PassMode :: Indirect { attrs, meta_attrs : _, on_stack } => {
448
453
assert ! ( !on_stack) ;
449
454
let i = apply ( attrs) ;
450
455
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>> {
458
463
for arg in self . args . iter ( ) {
459
464
match & arg. mode {
460
465
PassMode :: Ignore => { }
461
- PassMode :: Indirect { attrs, extra_attrs : None , on_stack : true } => {
466
+ PassMode :: Indirect { attrs, meta_attrs : None , on_stack : true } => {
462
467
let i = apply ( attrs) ;
463
468
let byval = llvm:: CreateByValAttr ( cx. llcx , arg. layout . llvm_type ( cx) ) ;
464
469
attributes:: apply_to_llfn ( llfn, llvm:: AttributePlace :: Argument ( i) , & [ byval] ) ;
465
470
}
466
471
PassMode :: Direct ( attrs)
467
- | PassMode :: Indirect { attrs, extra_attrs : None , on_stack : false } => {
472
+ | PassMode :: Indirect { attrs, meta_attrs : None , on_stack : false } => {
468
473
apply ( attrs) ;
469
474
}
470
- PassMode :: Indirect { attrs, extra_attrs : Some ( extra_attrs ) , on_stack } => {
475
+ PassMode :: Indirect { attrs, meta_attrs : Some ( meta_attrs ) , on_stack } => {
471
476
assert ! ( !on_stack) ;
472
477
apply ( attrs) ;
473
- apply ( extra_attrs ) ;
478
+ apply ( meta_attrs ) ;
474
479
}
475
480
PassMode :: Pair ( a, b) => {
476
481
apply ( a) ;
@@ -506,7 +511,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
506
511
PassMode :: Direct ( attrs) => {
507
512
attrs. apply_attrs_to_callsite ( llvm:: AttributePlace :: ReturnValue , bx. cx , callsite) ;
508
513
}
509
- PassMode :: Indirect { attrs, extra_attrs : _, on_stack } => {
514
+ PassMode :: Indirect { attrs, meta_attrs : _, on_stack } => {
510
515
assert ! ( !on_stack) ;
511
516
let i = apply ( bx. cx , attrs) ;
512
517
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>> {
534
539
for arg in self . args . iter ( ) {
535
540
match & arg. mode {
536
541
PassMode :: Ignore => { }
537
- PassMode :: Indirect { attrs, extra_attrs : None , on_stack : true } => {
542
+ PassMode :: Indirect { attrs, meta_attrs : None , on_stack : true } => {
538
543
let i = apply ( bx. cx , attrs) ;
539
544
let byval = llvm:: CreateByValAttr ( bx. cx . llcx , arg. layout . llvm_type ( bx) ) ;
540
545
attributes:: apply_to_callsite (
@@ -544,12 +549,12 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
544
549
) ;
545
550
}
546
551
PassMode :: Direct ( attrs)
547
- | PassMode :: Indirect { attrs, extra_attrs : None , on_stack : false } => {
552
+ | PassMode :: Indirect { attrs, meta_attrs : None , on_stack : false } => {
548
553
apply ( bx. cx , attrs) ;
549
554
}
550
- PassMode :: Indirect { attrs, extra_attrs : Some ( extra_attrs ) , on_stack : _ } => {
555
+ PassMode :: Indirect { attrs, meta_attrs : Some ( meta_attrs ) , on_stack : _ } => {
551
556
apply ( bx. cx , attrs) ;
552
- apply ( bx. cx , extra_attrs ) ;
557
+ apply ( bx. cx , meta_attrs ) ;
553
558
}
554
559
PassMode :: Pair ( a, b) => {
555
560
apply ( bx. cx , a) ;
0 commit comments