@@ -2434,6 +2434,7 @@ where
24342434 cx : & C ,
24352435 sig : ty:: PolyFnSig < ' tcx > ,
24362436 extra_args : & [ Ty < ' tcx > ] ,
2437+ caller_location : Option < Ty < ' tcx > > ,
24372438 mk_arg_type : impl Fn ( Ty < ' tcx > , Option < usize > ) -> ArgAbi < ' tcx , Ty < ' tcx > > ,
24382439 ) -> Self ;
24392440 fn adjust_for_abi ( & mut self , cx : & C , abi : SpecAbi ) ;
@@ -2448,13 +2449,19 @@ where
24482449 + HasParamEnv < ' tcx > ,
24492450{
24502451 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) ) )
24522453 }
24532454
24542455 fn of_instance ( cx : & C , instance : ty:: Instance < ' tcx > , extra_args : & [ Ty < ' tcx > ] ) -> Self {
24552456 let sig = instance. fn_sig_for_fn_abi ( cx. tcx ( ) ) ;
24562457
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| {
24582465 let mut layout = cx. layout_of ( ty) ;
24592466 // Don't pass the vtable, it's not an argument of the virtual fn.
24602467 // Instead, pass just the data pointer, but give it the type `*const/mut dyn Trait`
@@ -2512,6 +2519,7 @@ where
25122519 cx : & C ,
25132520 sig : ty:: PolyFnSig < ' tcx > ,
25142521 extra_args : & [ Ty < ' tcx > ] ,
2522+ caller_location : Option < Ty < ' tcx > > ,
25152523 mk_arg_type : impl Fn ( Ty < ' tcx > , Option < usize > ) -> ArgAbi < ' tcx , Ty < ' tcx > > ,
25162524 ) -> Self {
25172525 debug ! ( "FnAbi::new_internal({:?}, {:?})" , sig, extra_args) ;
@@ -2684,6 +2692,7 @@ where
26842692 . iter ( )
26852693 . cloned ( )
26862694 . chain ( extra_args)
2695+ . chain ( caller_location)
26872696 . enumerate ( )
26882697 . map ( |( i, ty) | arg_of ( ty, Some ( i) ) )
26892698 . collect ( ) ,
0 commit comments