diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 44a1d25a3125..c33bb249f256 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -260,17 +260,6 @@ impl<'tcx, B: Backend + 'static> FunctionCx<'_, 'tcx, B> { _ => unreachable!(), } } - - fn self_sig(&self) -> FnSig<'tcx> { - self.tcx.normalize_erasing_late_bound_regions( - ParamEnv::reveal_all(), - &fn_sig_for_fn_abi(self.tcx, self.instance), - ) - } - - fn return_layout(&self) -> TyLayout<'tcx> { - self.layout_of(self.self_sig().output()) - } } fn local_place<'tcx>( diff --git a/src/abi/returning.rs b/src/abi/returning.rs index b2f39bef13c6..9286787d8b6d 100644 --- a/src/abi/returning.rs +++ b/src/abi/returning.rs @@ -1,15 +1,17 @@ use crate::abi::pass_mode::*; use crate::prelude::*; +fn return_layout<'a, 'tcx>(fx: &mut FunctionCx<'a, 'tcx, impl Backend>) -> TyLayout<'tcx> { + fx.layout_of(fx.monomorphize(&fx.mir.local_decls[RETURN_PLACE].ty)) +} + pub fn codegen_return_param( fx: &mut FunctionCx, ssa_analyzed: &rustc_index::vec::IndexVec, start_ebb: Ebb, ) { - let ret_layout = fx.return_layout(); - let output_pass_mode = get_pass_mode(fx.tcx, fx.return_layout()); - - let ret_param = match output_pass_mode { + let ret_layout = return_layout(fx); + let ret_param = match get_pass_mode(fx.tcx, ret_layout) { PassMode::NoPass => { fx.local_map .insert(RETURN_PLACE, CPlace::no_place(ret_layout)); @@ -85,7 +87,7 @@ pub fn codegen_with_call_return_arg<'tcx, B: Backend, T>( } pub fn codegen_return(fx: &mut FunctionCx) { - match get_pass_mode(fx.tcx, fx.return_layout()) { + match get_pass_mode(fx.tcx, return_layout(fx)) { PassMode::NoPass | PassMode::ByRef => { fx.bcx.ins().return_(&[]); }