Add drop shim

This commit is contained in:
bjorn3 2018-06-28 20:27:43 +02:00
parent d8c5152f30
commit 4bff31e36d
2 changed files with 15 additions and 5 deletions

View File

@ -281,8 +281,14 @@ fn trans_fn<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend>, f: &mut
TerminatorKind::FalseUnwind { .. } => {
bug!("shouldn't exist at trans {:?}", bb_data.terminator());
}
TerminatorKind::Drop { .. } | TerminatorKind::DropAndReplace { .. } | TerminatorKind::GeneratorDrop { .. } => {
unimplemented!("terminator {:?}", bb_data.terminator());
TerminatorKind::Drop { target, .. } | TerminatorKind::DropAndReplace { target, .. } => {
// TODO call drop impl
// unimplemented!("terminator {:?}", bb_data.terminator());
let target_ebb = fx.get_ebb(*target);
fx.bcx.ins().jump(target_ebb, &[]);
}
TerminatorKind::GeneratorDrop => {
unimplemented!("terminator GeneratorDrop");
}
}
}

View File

@ -31,7 +31,7 @@ fn cton_type_from_ty(ty: Ty) -> Option<types::Type> {
UintTy::U16 => types::I16,
UintTy::U32 => types::I32,
UintTy::U64 => types::I64,
UintTy::U128 => unimplemented!(),
UintTy::U128 => unimplemented!("u128"),
UintTy::Usize => types::I64,
}
}
@ -41,7 +41,7 @@ fn cton_type_from_ty(ty: Ty) -> Option<types::Type> {
IntTy::I16 => types::I16,
IntTy::I32 => types::I32,
IntTy::I64 => types::I64,
IntTy::I128 => unimplemented!(),
IntTy::I128 => unimplemented!("i128"),
IntTy::Isize => types::I64,
}
}
@ -213,7 +213,11 @@ impl<'a, 'tcx: 'a> CPlace<'tcx> {
}
pub fn write_cvalue(self, fx: &mut FunctionCx<'a, 'tcx>, from: CValue<'tcx>) {
assert_eq!(self.layout().ty, from.layout().ty, "Can't write value of incompatible type to place");
assert_eq!(
self.layout().ty, from.layout().ty,
"Can't write value of incompatible type to place {:?} {:?}",
self.layout().ty.sty, from.layout().ty.sty
);
match self {
CPlace::Var(var, _) => {