From deeae2fce46cba99a2dcce835b85f7d42238c3c8 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Fri, 30 Aug 2019 12:42:18 +0200 Subject: [PATCH] Small change --- src/abi/mod.rs | 7 +------ src/abi/pass_mode.rs | 6 +++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/abi/mod.rs b/src/abi/mod.rs index a724ea2d8ec0..dc6bac0e426b 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -49,12 +49,7 @@ fn clif_sig_from_fn_sig<'tcx>(tcx: TyCtxt<'tcx>, sig: FnSig<'tcx>, is_vtable_fn: // See https://github.com/rust-lang/rust/blob/37b6a5e5e82497caf5353d9d856e4eb5d14cbe06/src/librustc/ty/layout.rs#L2519-L2572 for more info layout = tcx.layout_of(ParamEnv::reveal_all().and(tcx.mk_mut_ptr(tcx.mk_unit()))).unwrap(); } - match get_pass_mode(tcx, layout) { - PassMode::NoPass => Empty, - PassMode::ByVal(clif_ty) => Single(clif_ty), - PassMode::ByValPair(clif_ty_a, clif_ty_b) => Pair(clif_ty_a, clif_ty_b), - PassMode::ByRef => Single(pointer_ty(tcx)), - }.into_iter() + get_pass_mode(tcx, layout).get_param_ty(tcx).into_iter() }).flatten(); let (params, returns) = match get_pass_mode(tcx, tcx.layout_of(ParamEnv::reveal_all().and(output)).unwrap()) { diff --git a/src/abi/pass_mode.rs b/src/abi/pass_mode.rs index c3a479578bcc..4608562e993e 100644 --- a/src/abi/pass_mode.rs +++ b/src/abi/pass_mode.rs @@ -65,12 +65,12 @@ impl EmptySinglePair { pub use EmptySinglePair::*; impl PassMode { - pub fn get_param_ty(self, fx: &FunctionCx) -> EmptySinglePair { + pub fn get_param_ty(self, tcx: TyCtxt<'_>) -> EmptySinglePair { match self { PassMode::NoPass => Empty, PassMode::ByVal(clif_type) => Single(clif_type), PassMode::ByValPair(a, b) => Pair(a, b), - PassMode::ByRef => Single(fx.pointer_type), + PassMode::ByRef => Single(pointer_ty(tcx)), } } } @@ -141,7 +141,7 @@ pub fn cvalue_for_param<'tcx>( return None; } - let clif_types = pass_mode.get_param_ty(fx); + let clif_types = pass_mode.get_param_ty(fx.tcx); let ebb_params = clif_types.map(|t| fx.bcx.append_ebb_param(start_ebb, t)); #[cfg(debug_assertions)]