diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-08-11 15:18:49 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-11 15:18:49 -0400 |
| commit | 4229dc3538bbf473ab142fd708bc3ebbebb7bc1f (patch) | |
| tree | a0e1a3e4c92814f3487c1df5d13af152f1d496dc /src | |
| parent | 86ceab47b1caff6928ba04dbcffd058f6cd37a29 (diff) | |
| parent | 43de341f19e702f6efa2fe30c07dd5099b1a8efb (diff) | |
| download | rust-4229dc3538bbf473ab142fd708bc3ebbebb7bc1f.tar.gz rust-4229dc3538bbf473ab142fd708bc3ebbebb7bc1f.zip | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/ty/layout.rs | 4 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/mir/block.rs | 6 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/snapshot.rs | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index a9d1fd1fffc..19c753bc304 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -2518,7 +2518,7 @@ where + 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 @@ where + 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() diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index 006ebcbdec6..ce98979cc0c 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -337,7 +337,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } _ => { (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 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // 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 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { 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. diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index fad9fafbb08..47289064f4d 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -304,7 +304,7 @@ impl_stable_hash_for!(enum crate::interpret::eval_context::StackPopCleanup { #[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 @@ impl<'a, 'mir, 'tcx, Ctx> Snapshot<'a, Ctx> for &'a Frame<'mir, 'tcx> } = self; FrameSnapshot { - instance, + instance: *instance, span: *span, return_to_block, block, |
