X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_codegen_ssa%2Fsrc%2Fmir%2Fblock.rs;h=2a76ad0fb1356ebb1b244e19ba413444a1fcb6b5;hb=8e6d126b7d69281072f16dcc3cfff140e8947c58;hp=b584801a62de2cb91cefe79303dae8bb58d6fb3b;hpb=a0a6babf191847038860207075667effc9a67dec;p=rust.git diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index b584801a62d..2a76ad0fb13 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -132,14 +132,21 @@ fn do_call>( ) { // If there is a cleanup block and the function we're calling can unwind, then // do an invoke, otherwise do a call. + let fn_ty = bx.fn_decl_backend_type(&fn_abi); if let Some(cleanup) = cleanup.filter(|_| fn_abi.can_unwind) { let ret_llbb = if let Some((_, target)) = destination { fx.llbb(target) } else { fx.unreachable_block() }; - let invokeret = - bx.invoke(fn_ptr, &llargs, ret_llbb, self.llblock(fx, cleanup), self.funclet(fx)); + let invokeret = bx.invoke( + fn_ty, + fn_ptr, + &llargs, + ret_llbb, + self.llblock(fx, cleanup), + self.funclet(fx), + ); bx.apply_attrs_callsite(&fn_abi, invokeret); if let Some((ret_dest, target)) = destination { @@ -148,7 +155,7 @@ fn do_call>( fx.store_return(&mut ret_bx, ret_dest, &fn_abi.ret, invokeret); } } else { - let llret = bx.call(fn_ptr, &llargs, self.funclet(fx)); + let llret = bx.call(fn_ty, fn_ptr, &llargs, self.funclet(fx)); bx.apply_attrs_callsite(&fn_abi, llret); if fx.mir[self.bb].is_cleanup { // Cleanup is always the cold path. Don't inline @@ -465,10 +472,8 @@ enum AssertIntrinsic { let layout = bx.layout_of(ty); let do_panic = match intrinsic { Inhabited => layout.abi.is_uninhabited(), - // We unwrap as the error type is `!`. - ZeroValid => !layout.might_permit_raw_init(bx, /*zero:*/ true).unwrap(), - // We unwrap as the error type is `!`. - UninitValid => !layout.might_permit_raw_init(bx, /*zero:*/ false).unwrap(), + ZeroValid => !layout.might_permit_raw_init(bx, /*zero:*/ true), + UninitValid => !layout.might_permit_raw_init(bx, /*zero:*/ false), }; if do_panic { let msg_str = with_no_trimmed_paths(|| { @@ -1391,7 +1396,7 @@ fn codegen_transmute(&mut self, bx: &mut Bx, src: &mir::Operand<'tcx>, dst: mir: LocalRef::UnsizedPlace(_) => bug!("transmute must not involve unsized locals"), LocalRef::Operand(None) => { let dst_layout = bx.layout_of(self.monomorphized_place_ty(dst.as_ref())); - assert!(!dst_layout.ty.has_erasable_regions()); + assert!(!dst_layout.ty.has_erasable_regions(self.cx.tcx())); let place = PlaceRef::alloca(bx, dst_layout); place.storage_live(bx); self.codegen_transmute_into(bx, src, place);