remove box derefs from codgen
This commit is contained in:
parent
3e9d3d917a
commit
cb417881a9
16 changed files with 385 additions and 146 deletions
|
@ -410,7 +410,18 @@ where
|
|||
fn open_drop_for_box(&mut self, adt: ty::AdtDef<'tcx>, substs: SubstsRef<'tcx>) -> BasicBlock {
|
||||
debug!("open_drop_for_box({:?}, {:?}, {:?})", self, adt, substs);
|
||||
|
||||
let interior = self.tcx().mk_place_deref(self.place);
|
||||
// drop glue is sent straight to codegen
|
||||
// box cannot be directly dereferenced
|
||||
let unique_ty = adt.non_enum_variant().fields[0].ty(self.tcx(), substs);
|
||||
let nonnull_ty =
|
||||
unique_ty.ty_adt_def().unwrap().non_enum_variant().fields[0].ty(self.tcx(), substs);
|
||||
let ptr_ty = self.tcx().mk_imm_ptr(substs[0].expect_ty());
|
||||
|
||||
let unique_place = self.tcx().mk_place_field(self.place, Field::new(0), unique_ty);
|
||||
let nonnull_place = self.tcx().mk_place_field(unique_place, Field::new(0), nonnull_ty);
|
||||
let ptr_place = self.tcx().mk_place_field(nonnull_place, Field::new(0), ptr_ty);
|
||||
let interior = self.tcx().mk_place_deref(ptr_place);
|
||||
|
||||
let interior_path = self.elaborator.deref_subpath(self.path);
|
||||
|
||||
let succ = self.box_free_block(adt, substs, self.succ, self.unwind);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue