Auto merge of #95576 - DrMeepster:box_erasure, r=oli-obk
Remove dereferencing of Box from codegen Through #94043, #94414, #94873, and #95328, I've been fixing issues caused by Box being treated like a pointer when it is not a pointer. However, these PRs just introduced special cases for Box. This PR removes those special cases and instead transforms a deref of Box into a deref of the pointer it contains. Hopefully, this is the end of the Box<T, A> ICEs.
This commit is contained in:
commit
a25b1315ee
18 changed files with 477 additions and 162 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