Fix calling drop_in_place_real with empty drop glue

fixes #209
This commit is contained in:
bjorn3 2018-12-20 14:57:21 +01:00
parent 43a68c33fe
commit d94fe1d717

View File

@ -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);
let instance = ty::Instance::resolve(
fx.tcx,
ty::ParamEnv::reveal_all(),
def_id,
substs,
).unwrap();
if sig.abi == Abi::RustIntrinsic {
crate::intrinsics::codegen_intrinsic_call(fx, def_id, substs, args, destination);
return;
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;
}
_ => {}
}
}