Skip to content

Commit

Permalink
Fix calling drop_in_place_real with empty drop glue
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Dec 20, 2018
1 parent 43a68c3 commit d94fe1d
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,26 @@ pub fn codegen_terminator_call<'a, 'tcx: 'a>(
.map(|&(ref place, bb)| (trans_place(fx, place), bb));

if let ty::FnDef(def_id, substs) = fn_ty.sty {
let sig = ty_fn_sig(fx.tcx, fn_ty);

if sig.abi == Abi::RustIntrinsic {
crate::intrinsics::codegen_intrinsic_call(fx, def_id, substs, args, destination);
return;
let instance = ty::Instance::resolve(
fx.tcx,
ty::ParamEnv::reveal_all(),
def_id,
substs,
).unwrap();

match instance.def {
InstanceDef::Intrinsic(_) => {
crate::intrinsics::codegen_intrinsic_call(fx, def_id, substs, args, destination);
return;
}
InstanceDef::DropGlue(_, None) => {
// empty drop glue - a nop.
let (_, dest) = destination.expect("Non terminating drop_in_place_real???");
let ret_ebb = fx.get_ebb(dest);
fx.bcx.ins().jump(ret_ebb, &[]);
return;
}
_ => {}
}
}

Expand Down

0 comments on commit d94fe1d

Please sign in to comment.