diff options
Diffstat (limited to 'src/librustc_mir/util/elaborate_drops.rs')
| -rw-r--r-- | src/librustc_mir/util/elaborate_drops.rs | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index bb8dbd64c36..fc40682c9b6 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -105,7 +105,7 @@ struct DropCtxt<'l, 'b: 'l, 'tcx: 'b, D> source_info: SourceInfo, - lvalue: &'l Lvalue<'tcx>, + lvalue: &'l Place<'tcx>, path: D::Path, succ: BasicBlock, unwind: Unwind, @@ -114,7 +114,7 @@ struct DropCtxt<'l, 'b: 'l, 'tcx: 'b, D> pub fn elaborate_drop<'b, 'tcx, D>( elaborator: &mut D, source_info: SourceInfo, - lvalue: &Lvalue<'tcx>, + lvalue: &Place<'tcx>, path: D::Path, succ: BasicBlock, unwind: Unwind, @@ -129,7 +129,7 @@ pub fn elaborate_drop<'b, 'tcx, D>( impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> where D: DropElaborator<'b, 'tcx> { - fn lvalue_ty(&self, lvalue: &Lvalue<'tcx>) -> Ty<'tcx> { + fn lvalue_ty(&self, lvalue: &Place<'tcx>) -> Ty<'tcx> { lvalue.ty(self.elaborator.mir(), self.tcx()).to_ty(self.tcx()) } @@ -194,11 +194,11 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> /// Return the lvalue and move path for each field of `variant`, /// (the move path is `None` if the field is a rest field). fn move_paths_for_fields(&self, - base_lv: &Lvalue<'tcx>, + base_lv: &Place<'tcx>, variant_path: D::Path, variant: &'tcx ty::VariantDef, substs: &'tcx Substs<'tcx>) - -> Vec<(Lvalue<'tcx>, Option<D::Path>)> + -> Vec<(Place<'tcx>, Option<D::Path>)> { variant.fields.iter().enumerate().map(|(i, f)| { let field = Field::new(i); @@ -214,7 +214,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> } fn drop_subpath(&mut self, - lvalue: &Lvalue<'tcx>, + lvalue: &Place<'tcx>, path: Option<D::Path>, succ: BasicBlock, unwind: Unwind) @@ -251,7 +251,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> fn drop_halfladder(&mut self, unwind_ladder: &[Unwind], mut succ: BasicBlock, - fields: &[(Lvalue<'tcx>, Option<D::Path>)]) + fields: &[(Place<'tcx>, Option<D::Path>)]) -> Vec<BasicBlock> { Some(succ).into_iter().chain( @@ -294,7 +294,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> /// NOTE: this does not clear the master drop flag, so you need /// to point succ/unwind on a `drop_ladder_bottom`. fn drop_ladder<'a>(&mut self, - fields: Vec<(Lvalue<'tcx>, Option<D::Path>)>, + fields: Vec<(Place<'tcx>, Option<D::Path>)>, succ: BasicBlock, unwind: Unwind) -> (BasicBlock, Unwind) @@ -491,7 +491,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> // discriminant after it is free-ed, because that // way lies only trouble. let discr_ty = adt.repr.discr_type().to_ty(self.tcx()); - let discr = Lvalue::Local(self.new_temp(discr_ty)); + let discr = Place::Local(self.new_temp(discr_ty)); let discr_rv = Rvalue::Discriminant(self.lvalue.clone()); let switch_block = BasicBlockData { statements: vec![self.assign(&discr, discr_rv)], @@ -525,18 +525,18 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> mutbl: hir::Mutability::MutMutable }); let ref_lvalue = self.new_temp(ref_ty); - let unit_temp = Lvalue::Local(self.new_temp(tcx.mk_nil())); + let unit_temp = Place::Local(self.new_temp(tcx.mk_nil())); let result = BasicBlockData { statements: vec![self.assign( - &Lvalue::Local(ref_lvalue), + &Place::Local(ref_lvalue), Rvalue::Ref(tcx.types.re_erased, BorrowKind::Mut, self.lvalue.clone()) )], terminator: Some(Terminator { kind: TerminatorKind::Call { func: Operand::function_handle(tcx, drop_fn.def_id, substs, self.source_info.span), - args: vec![Operand::Move(Lvalue::Local(ref_lvalue))], + args: vec![Operand::Move(Place::Local(ref_lvalue))], destination: Some((unit_temp, succ)), cleanup: unwind.into_option(), }, @@ -566,39 +566,39 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> fn drop_loop(&mut self, succ: BasicBlock, cur: Local, - length_or_end: &Lvalue<'tcx>, + length_or_end: &Place<'tcx>, ety: Ty<'tcx>, unwind: Unwind, ptr_based: bool) -> BasicBlock { - let copy = |lv: &Lvalue<'tcx>| Operand::Copy(lv.clone()); - let move_ = |lv: &Lvalue<'tcx>| Operand::Move(lv.clone()); + let copy = |lv: &Place<'tcx>| Operand::Copy(lv.clone()); + let move_ = |lv: &Place<'tcx>| Operand::Move(lv.clone()); let tcx = self.tcx(); let ref_ty = tcx.mk_ref(tcx.types.re_erased, ty::TypeAndMut { ty: ety, mutbl: hir::Mutability::MutMutable }); - let ptr = &Lvalue::Local(self.new_temp(ref_ty)); - let can_go = &Lvalue::Local(self.new_temp(tcx.types.bool)); + let ptr = &Place::Local(self.new_temp(ref_ty)); + let can_go = &Place::Local(self.new_temp(tcx.types.bool)); let one = self.constant_usize(1); let (ptr_next, cur_next) = if ptr_based { - (Rvalue::Use(copy(&Lvalue::Local(cur))), - Rvalue::BinaryOp(BinOp::Offset, copy(&Lvalue::Local(cur)), one)) + (Rvalue::Use(copy(&Place::Local(cur))), + Rvalue::BinaryOp(BinOp::Offset, copy(&Place::Local(cur)), one)) } else { (Rvalue::Ref( tcx.types.re_erased, BorrowKind::Mut, self.lvalue.clone().index(cur)), - Rvalue::BinaryOp(BinOp::Add, copy(&Lvalue::Local(cur)), one)) + Rvalue::BinaryOp(BinOp::Add, copy(&Place::Local(cur)), one)) }; let drop_block = BasicBlockData { statements: vec![ self.assign(ptr, ptr_next), - self.assign(&Lvalue::Local(cur), cur_next) + self.assign(&Place::Local(cur), cur_next) ], is_cleanup: unwind.is_cleanup(), terminator: Some(Terminator { @@ -612,7 +612,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> let loop_block = BasicBlockData { statements: vec![ self.assign(can_go, Rvalue::BinaryOp(BinOp::Eq, - copy(&Lvalue::Local(cur)), + copy(&Place::Local(cur)), copy(length_or_end))) ], is_cleanup: unwind.is_cleanup(), @@ -643,9 +643,9 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> let tcx = self.tcx(); - let move_ = |lv: &Lvalue<'tcx>| Operand::Move(lv.clone()); - let size = &Lvalue::Local(self.new_temp(tcx.types.usize)); - let size_is_zero = &Lvalue::Local(self.new_temp(tcx.types.bool)); + let move_ = |lv: &Place<'tcx>| Operand::Move(lv.clone()); + let size = &Place::Local(self.new_temp(tcx.types.usize)); + let size_is_zero = &Place::Local(self.new_temp(tcx.types.bool)); let base_block = BasicBlockData { statements: vec![ self.assign(size, Rvalue::NullaryOp(NullOp::SizeOf, ety)), @@ -680,9 +680,9 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> }; let cur = self.new_temp(iter_ty); - let length = Lvalue::Local(self.new_temp(tcx.types.usize)); + let length = Place::Local(self.new_temp(tcx.types.usize)); let length_or_end = if ptr_based { - Lvalue::Local(self.new_temp(iter_ty)) + Place::Local(self.new_temp(iter_ty)) } else { length.clone() }; @@ -705,13 +705,13 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> unwind, ptr_based); - let cur = Lvalue::Local(cur); + let cur = Place::Local(cur); let zero = self.constant_usize(0); let mut drop_block_stmts = vec![]; drop_block_stmts.push(self.assign(&length, Rvalue::Len(self.lvalue.clone()))); if ptr_based { let tmp_ty = tcx.mk_mut_ptr(self.lvalue_ty(self.lvalue)); - let tmp = Lvalue::Local(self.new_temp(tmp_ty)); + let tmp = Place::Local(self.new_temp(tmp_ty)); // tmp = &LV; // cur = tmp as *mut T; // end = Offset(cur, len); @@ -849,7 +849,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> unwind: Unwind ) -> BasicBlock { let tcx = self.tcx(); - let unit_temp = Lvalue::Local(self.new_temp(tcx.mk_nil())); + let unit_temp = Place::Local(self.new_temp(tcx.mk_nil())); let free_func = tcx.require_lang_item(lang_items::BoxFreeFnLangItem); let substs = tcx.mk_substs(iter::once(Kind::from(ty))); @@ -932,7 +932,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> }) } - fn assign(&self, lhs: &Lvalue<'tcx>, rhs: Rvalue<'tcx>) -> Statement<'tcx> { + fn assign(&self, lhs: &Place<'tcx>, rhs: Rvalue<'tcx>) -> Statement<'tcx> { Statement { source_info: self.source_info, kind: StatementKind::Assign(lhs.clone(), rhs) |
