diff --git a/src/librustc_trans/callee.rs b/src/librustc_trans/callee.rs index 44e94a1dfe3e5937be8e07d5fd9548d16a3ade54..dea0a2664a07ce6d1798a1c17087218c15363a04 100644 --- a/src/librustc_trans/callee.rs +++ b/src/librustc_trans/callee.rs @@ -385,13 +385,14 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>( if fn_ret.0.is_never() { bcx.unreachable(); - } - self_scope.trans(&bcx); - - if fcx.fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() { - bcx.ret_void(); } else { - bcx.ret(llret); + self_scope.trans(&bcx); + + if fcx.fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() { + bcx.ret_void(); + } else { + bcx.ret(llret); + } } ccx.instances().borrow_mut().insert(method_instance, lloncefn); @@ -521,13 +522,14 @@ fn trans_fn_pointer_shim<'a, 'tcx>( if fn_ret.0.is_never() { bcx.unreachable(); - } - - if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() { - bcx.ret_void(); } else { - bcx.ret(llret); + if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() { + bcx.ret_void(); + } else { + bcx.ret(llret); + } } + ccx.fn_pointer_shims().borrow_mut().insert(bare_fn_ty_maybe_ref, llfn); llfn diff --git a/src/librustc_trans/meth.rs b/src/librustc_trans/meth.rs index df893ac7ab074a163db8ac01ff59c2011b88abec..89ea7a760d491e2f52c0a6ad75e3383320e95bb2 100644 --- a/src/librustc_trans/meth.rs +++ b/src/librustc_trans/meth.rs @@ -102,12 +102,12 @@ pub fn trans_object_shim<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>, if fn_ret.0.is_never() { bcx.unreachable(); - } - - if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() { - bcx.ret_void(); } else { - bcx.ret(llret); + if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() { + bcx.ret_void(); + } else { + bcx.ret(llret); + } } llfn