Add caller_location paramter to FnAbi::new_internal.
We pass it in `of_instance` when the instance requires caller location.
This commit is contained in:
parent
4773ded15b
commit
fa6bb39855
1 changed files with 11 additions and 2 deletions
|
|
@ -2434,6 +2434,7 @@ where
|
|||
cx: &C,
|
||||
sig: ty::PolyFnSig<'tcx>,
|
||||
extra_args: &[Ty<'tcx>],
|
||||
caller_location: Option<Ty<'tcx>>,
|
||||
mk_arg_type: impl Fn(Ty<'tcx>, Option<usize>) -> ArgAbi<'tcx, Ty<'tcx>>,
|
||||
) -> Self;
|
||||
fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi);
|
||||
|
|
@ -2448,13 +2449,19 @@ where
|
|||
+ HasParamEnv<'tcx>,
|
||||
{
|
||||
fn of_fn_ptr(cx: &C, sig: ty::PolyFnSig<'tcx>, extra_args: &[Ty<'tcx>]) -> Self {
|
||||
call::FnAbi::new_internal(cx, sig, extra_args, |ty, _| ArgAbi::new(cx.layout_of(ty)))
|
||||
call::FnAbi::new_internal(cx, sig, extra_args, None, |ty, _| ArgAbi::new(cx.layout_of(ty)))
|
||||
}
|
||||
|
||||
fn of_instance(cx: &C, instance: ty::Instance<'tcx>, extra_args: &[Ty<'tcx>]) -> Self {
|
||||
let sig = instance.fn_sig_for_fn_abi(cx.tcx());
|
||||
|
||||
call::FnAbi::new_internal(cx, sig, extra_args, |ty, arg_idx| {
|
||||
let caller_location = if instance.def.requires_caller_location(cx.tcx()) {
|
||||
Some(cx.tcx().caller_location_ty())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
call::FnAbi::new_internal(cx, sig, extra_args, caller_location, |ty, arg_idx| {
|
||||
let mut layout = cx.layout_of(ty);
|
||||
// Don't pass the vtable, it's not an argument of the virtual fn.
|
||||
// Instead, pass just the data pointer, but give it the type `*const/mut dyn Trait`
|
||||
|
|
@ -2512,6 +2519,7 @@ where
|
|||
cx: &C,
|
||||
sig: ty::PolyFnSig<'tcx>,
|
||||
extra_args: &[Ty<'tcx>],
|
||||
caller_location: Option<Ty<'tcx>>,
|
||||
mk_arg_type: impl Fn(Ty<'tcx>, Option<usize>) -> ArgAbi<'tcx, Ty<'tcx>>,
|
||||
) -> Self {
|
||||
debug!("FnAbi::new_internal({:?}, {:?})", sig, extra_args);
|
||||
|
|
@ -2684,6 +2692,7 @@ where
|
|||
.iter()
|
||||
.cloned()
|
||||
.chain(extra_args)
|
||||
.chain(caller_location)
|
||||
.enumerate()
|
||||
.map(|(i, ty)| arg_of(ty, Some(i)))
|
||||
.collect(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue