@@ -2501,6 +2501,7 @@ where
25012501 cx : & C ,
25022502 sig : ty:: PolyFnSig < ' tcx > ,
25032503 extra_args : & [ Ty < ' tcx > ] ,
2504+ caller_location : Option < Ty < ' tcx > > ,
25042505 mk_arg_type : impl Fn ( Ty < ' tcx > , Option < usize > ) -> ArgAbi < ' tcx , Ty < ' tcx > > ,
25052506 ) -> Self ;
25062507 fn adjust_for_abi ( & mut self , cx : & C , abi : SpecAbi ) ;
@@ -2515,13 +2516,19 @@ where
25152516 + HasParamEnv < ' tcx > ,
25162517{
25172518 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) ) )
25192520 }
25202521
25212522 fn of_instance ( cx : & C , instance : ty:: Instance < ' tcx > , extra_args : & [ Ty < ' tcx > ] ) -> Self {
25222523 let sig = instance. fn_sig ( cx. tcx ( ) ) ;
25232524
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| {
25252532 let mut layout = cx. layout_of ( ty) ;
25262533 // Don't pass the vtable, it's not an argument of the virtual fn.
25272534 // Instead, pass just the data pointer, but give it the type `*const/mut dyn Trait`
@@ -2579,6 +2586,7 @@ where
25792586 cx : & C ,
25802587 sig : ty:: PolyFnSig < ' tcx > ,
25812588 extra_args : & [ Ty < ' tcx > ] ,
2589+ caller_location : Option < Ty < ' tcx > > ,
25822590 mk_arg_type : impl Fn ( Ty < ' tcx > , Option < usize > ) -> ArgAbi < ' tcx , Ty < ' tcx > > ,
25832591 ) -> Self {
25842592 debug ! ( "FnAbi::new_internal({:?}, {:?})" , sig, extra_args) ;
@@ -2744,6 +2752,7 @@ where
27442752 . iter ( )
27452753 . cloned ( )
27462754 . chain ( extra_args)
2755+ . chain ( caller_location)
27472756 . enumerate ( )
27482757 . map ( |( i, ty) | arg_of ( ty, Some ( i) ) )
27492758 . collect ( ) ,
0 commit comments