Skip to content

Commit 4229dc3

Browse files
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
2 parents 86ceab4 + 43de341 commit 4229dc3

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/librustc/ty/layout.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2518,7 +2518,7 @@ where
25182518
+ HasTyCtxt<'tcx>
25192519
+ HasParamEnv<'tcx>,
25202520
{
2521-
fn of_instance(cx: &C, instance: &ty::Instance<'tcx>) -> Self;
2521+
fn of_instance(cx: &C, instance: ty::Instance<'tcx>) -> Self;
25222522
fn new(cx: &C, sig: ty::FnSig<'tcx>, extra_args: &[Ty<'tcx>]) -> Self;
25232523
fn new_vtable(cx: &C, sig: ty::FnSig<'tcx>, extra_args: &[Ty<'tcx>]) -> Self;
25242524
fn new_internal(
@@ -2538,7 +2538,7 @@ where
25382538
+ HasTyCtxt<'tcx>
25392539
+ HasParamEnv<'tcx>,
25402540
{
2541-
fn of_instance(cx: &C, instance: &ty::Instance<'tcx>) -> Self {
2541+
fn of_instance(cx: &C, instance: ty::Instance<'tcx>) -> Self {
25422542
let sig = instance.fn_sig(cx.tcx());
25432543
let sig = cx
25442544
.tcx()

src/librustc_codegen_ssa/mir/block.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
337337
}
338338
_ => {
339339
(bx.get_fn(drop_fn),
340-
FnType::of_instance(&bx, &drop_fn))
340+
FnType::of_instance(&bx, drop_fn))
341341
}
342342
};
343343
helper.do_call(self, &mut bx, fn_ty, drop_fn, args,
@@ -435,7 +435,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
435435
// Obtain the panic entry point.
436436
let def_id = common::langcall(bx.tcx(), Some(span), "", lang_item);
437437
let instance = ty::Instance::mono(bx.tcx(), def_id);
438-
let fn_ty = FnType::of_instance(&bx, &instance);
438+
let fn_ty = FnType::of_instance(&bx, instance);
439439
let llfn = bx.get_fn(instance);
440440

441441
// Codegen the actual panic invoke/call.
@@ -552,7 +552,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
552552
let def_id =
553553
common::langcall(bx.tcx(), Some(span), "", lang_items::PanicFnLangItem);
554554
let instance = ty::Instance::mono(bx.tcx(), def_id);
555-
let fn_ty = FnType::of_instance(&bx, &instance);
555+
let fn_ty = FnType::of_instance(&bx, instance);
556556
let llfn = bx.get_fn(instance);
557557

558558
// Codegen the actual panic invoke/call.

src/librustc_mir/interpret/snapshot.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl_stable_hash_for!(enum crate::interpret::eval_context::StackPopCleanup {
304304

305305
#[derive(Eq, PartialEq)]
306306
struct FrameSnapshot<'a, 'tcx> {
307-
instance: &'a ty::Instance<'tcx>,
307+
instance: ty::Instance<'tcx>,
308308
span: Span,
309309
return_to_block: &'a StackPopCleanup,
310310
return_place: Option<Place<(), AllocIdSnapshot<'a>>>,
@@ -344,7 +344,7 @@ impl<'a, 'mir, 'tcx, Ctx> Snapshot<'a, Ctx> for &'a Frame<'mir, 'tcx>
344344
} = self;
345345

346346
FrameSnapshot {
347-
instance,
347+
instance: *instance,
348348
span: *span,
349349
return_to_block,
350350
block,

0 commit comments

Comments
 (0)