From 4bff31e36d5fcc67275cfc420adc8c6018b817a0 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Thu, 28 Jun 2018 20:27:43 +0200 Subject: [PATCH] Add drop shim --- src/base.rs | 10 ++++++++-- src/common.rs | 10 +++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/base.rs b/src/base.rs index 4546d23225e..5e6fa126c31 100644 --- a/src/base.rs +++ b/src/base.rs @@ -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"); } } } diff --git a/src/common.rs b/src/common.rs index df6c88a2270..157e3000bd8 100644 --- a/src/common.rs +++ b/src/common.rs @@ -31,7 +31,7 @@ fn cton_type_from_ty(ty: Ty) -> Option { 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 { 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, _) => {