@@ -2434,6 +2434,7 @@ where
2434
2434
cx : & C ,
2435
2435
sig : ty:: PolyFnSig < ' tcx > ,
2436
2436
extra_args : & [ Ty < ' tcx > ] ,
2437
+ caller_location : Option < Ty < ' tcx > > ,
2437
2438
mk_arg_type : impl Fn ( Ty < ' tcx > , Option < usize > ) -> ArgAbi < ' tcx , Ty < ' tcx > > ,
2438
2439
) -> Self ;
2439
2440
fn adjust_for_abi ( & mut self , cx : & C , abi : SpecAbi ) ;
@@ -2448,13 +2449,19 @@ where
2448
2449
+ HasParamEnv < ' tcx > ,
2449
2450
{
2450
2451
fn of_fn_ptr ( cx : & C , sig : ty:: PolyFnSig < ' tcx > , extra_args : & [ Ty < ' tcx > ] ) -> Self {
2451
- call:: FnAbi :: new_internal ( cx, sig, extra_args, |ty, _| ArgAbi :: new ( cx. layout_of ( ty) ) )
2452
+ call:: FnAbi :: new_internal ( cx, sig, extra_args, None , |ty, _| ArgAbi :: new ( cx. layout_of ( ty) ) )
2452
2453
}
2453
2454
2454
2455
fn of_instance ( cx : & C , instance : ty:: Instance < ' tcx > , extra_args : & [ Ty < ' tcx > ] ) -> Self {
2455
2456
let sig = instance. fn_sig_for_fn_abi ( cx. tcx ( ) ) ;
2456
2457
2457
- call:: FnAbi :: new_internal ( cx, sig, extra_args, |ty, arg_idx| {
2458
+ let caller_location = if instance. def . requires_caller_location ( cx. tcx ( ) ) {
2459
+ Some ( cx. tcx ( ) . caller_location_ty ( ) )
2460
+ } else {
2461
+ None
2462
+ } ;
2463
+
2464
+ call:: FnAbi :: new_internal ( cx, sig, extra_args, caller_location, |ty, arg_idx| {
2458
2465
let mut layout = cx. layout_of ( ty) ;
2459
2466
// Don't pass the vtable, it's not an argument of the virtual fn.
2460
2467
// Instead, pass just the data pointer, but give it the type `*const/mut dyn Trait`
@@ -2512,6 +2519,7 @@ where
2512
2519
cx : & C ,
2513
2520
sig : ty:: PolyFnSig < ' tcx > ,
2514
2521
extra_args : & [ Ty < ' tcx > ] ,
2522
+ caller_location : Option < Ty < ' tcx > > ,
2515
2523
mk_arg_type : impl Fn ( Ty < ' tcx > , Option < usize > ) -> ArgAbi < ' tcx , Ty < ' tcx > > ,
2516
2524
) -> Self {
2517
2525
debug ! ( "FnAbi::new_internal({:?}, {:?})" , sig, extra_args) ;
@@ -2684,6 +2692,7 @@ where
2684
2692
. iter ( )
2685
2693
. cloned ( )
2686
2694
. chain ( extra_args)
2695
+ . chain ( caller_location)
2687
2696
. enumerate ( )
2688
2697
. map ( |( i, ty) | arg_of ( ty, Some ( i) ) )
2689
2698
. collect ( ) ,
0 commit comments