Rollup merge of #63464 - Mark-Simulacrum:deref-instance, r=eddyb

Copy ty::Instance instead of passing by reference

ty::Instance is small and Copy, we should not be adding additional
indirection.

Fixes #63409.

r? @eddyb
This commit is contained in:
Mark Rousskov
2019-08-11 15:18:49 -04:00
committed by GitHub
3 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -2518,7 +2518,7 @@ pub trait FnTypeExt<'tcx, C>
+ HasTyCtxt<'tcx>
+ HasParamEnv<'tcx>,
{
fn of_instance(cx: &C, instance: &ty::Instance<'tcx>) -> Self;
fn of_instance(cx: &C, instance: ty::Instance<'tcx>) -> Self;
fn new(cx: &C, sig: ty::FnSig<'tcx>, extra_args: &[Ty<'tcx>]) -> Self;
fn new_vtable(cx: &C, sig: ty::FnSig<'tcx>, extra_args: &[Ty<'tcx>]) -> Self;
fn new_internal(
@@ -2538,7 +2538,7 @@ impl<'tcx, C> FnTypeExt<'tcx, C> for call::FnType<'tcx, Ty<'tcx>>
+ HasTyCtxt<'tcx>
+ HasParamEnv<'tcx>,
{
fn of_instance(cx: &C, instance: &ty::Instance<'tcx>) -> Self {
fn of_instance(cx: &C, instance: ty::Instance<'tcx>) -> Self {
let sig = instance.fn_sig(cx.tcx());
let sig = cx
.tcx()
+3 -3
View File
@@ -337,7 +337,7 @@ fn codegen_drop_terminator<'b>(
}
_ => {
(bx.get_fn(drop_fn),
FnType::of_instance(&bx, &drop_fn))
FnType::of_instance(&bx, drop_fn))
}
};
helper.do_call(self, &mut bx, fn_ty, drop_fn, args,
@@ -435,7 +435,7 @@ fn codegen_assert_terminator<'b>(
// Obtain the panic entry point.
let def_id = common::langcall(bx.tcx(), Some(span), "", lang_item);
let instance = ty::Instance::mono(bx.tcx(), def_id);
let fn_ty = FnType::of_instance(&bx, &instance);
let fn_ty = FnType::of_instance(&bx, instance);
let llfn = bx.get_fn(instance);
// Codegen the actual panic invoke/call.
@@ -552,7 +552,7 @@ fn codegen_call_terminator<'b>(
let def_id =
common::langcall(bx.tcx(), Some(span), "", lang_items::PanicFnLangItem);
let instance = ty::Instance::mono(bx.tcx(), def_id);
let fn_ty = FnType::of_instance(&bx, &instance);
let fn_ty = FnType::of_instance(&bx, instance);
let llfn = bx.get_fn(instance);
// Codegen the actual panic invoke/call.
+2 -2
View File
@@ -304,7 +304,7 @@ fn snapshot(&self, ctx: &'a Ctx) -> Self::Item {
#[derive(Eq, PartialEq)]
struct FrameSnapshot<'a, 'tcx> {
instance: &'a ty::Instance<'tcx>,
instance: ty::Instance<'tcx>,
span: Span,
return_to_block: &'a StackPopCleanup,
return_place: Option<Place<(), AllocIdSnapshot<'a>>>,
@@ -344,7 +344,7 @@ fn snapshot(&self, ctx: &'a Ctx) -> Self::Item {
} = self;
FrameSnapshot {
instance,
instance: *instance,
span: *span,
return_to_block,
block,