@@ -2501,6 +2501,7 @@ where
2501
2501
cx : & C ,
2502
2502
sig : ty:: PolyFnSig < ' tcx > ,
2503
2503
extra_args : & [ Ty < ' tcx > ] ,
2504
+ caller_location : Option < Ty < ' tcx > > ,
2504
2505
mk_arg_type : impl Fn ( Ty < ' tcx > , Option < usize > ) -> ArgAbi < ' tcx , Ty < ' tcx > > ,
2505
2506
) -> Self ;
2506
2507
fn adjust_for_abi ( & mut self , cx : & C , abi : SpecAbi ) ;
@@ -2515,13 +2516,19 @@ where
2515
2516
+ HasParamEnv < ' tcx > ,
2516
2517
{
2517
2518
fn of_fn_ptr ( cx : & C , sig : ty:: PolyFnSig < ' tcx > , extra_args : & [ Ty < ' tcx > ] ) -> Self {
2518
- call:: FnAbi :: new_internal ( cx, sig, extra_args, |ty, _| ArgAbi :: new ( cx. layout_of ( ty) ) )
2519
+ call:: FnAbi :: new_internal ( cx, sig, extra_args, None , |ty, _| ArgAbi :: new ( cx. layout_of ( ty) ) )
2519
2520
}
2520
2521
2521
2522
fn of_instance ( cx : & C , instance : ty:: Instance < ' tcx > , extra_args : & [ Ty < ' tcx > ] ) -> Self {
2522
2523
let sig = instance. fn_sig ( cx. tcx ( ) ) ;
2523
2524
2524
- call:: FnAbi :: new_internal ( cx, sig, extra_args, |ty, arg_idx| {
2525
+ let caller_location = if instance. def . requires_caller_location ( cx. tcx ( ) ) {
2526
+ Some ( cx. tcx ( ) . caller_location_ty ( ) )
2527
+ } else {
2528
+ None
2529
+ } ;
2530
+
2531
+ call:: FnAbi :: new_internal ( cx, sig, extra_args, caller_location, |ty, arg_idx| {
2525
2532
let mut layout = cx. layout_of ( ty) ;
2526
2533
// Don't pass the vtable, it's not an argument of the virtual fn.
2527
2534
// Instead, pass just the data pointer, but give it the type `*const/mut dyn Trait`
@@ -2579,6 +2586,7 @@ where
2579
2586
cx : & C ,
2580
2587
sig : ty:: PolyFnSig < ' tcx > ,
2581
2588
extra_args : & [ Ty < ' tcx > ] ,
2589
+ caller_location : Option < Ty < ' tcx > > ,
2582
2590
mk_arg_type : impl Fn ( Ty < ' tcx > , Option < usize > ) -> ArgAbi < ' tcx , Ty < ' tcx > > ,
2583
2591
) -> Self {
2584
2592
debug ! ( "FnAbi::new_internal({:?}, {:?})" , sig, extra_args) ;
@@ -2744,6 +2752,7 @@ where
2744
2752
. iter ( )
2745
2753
. cloned ( )
2746
2754
. chain ( extra_args)
2755
+ . chain ( caller_location)
2747
2756
. enumerate ( )
2748
2757
. map ( |( i, ty) | arg_of ( ty, Some ( i) ) )
2749
2758
. collect ( ) ,
0 commit comments