This commit is contained in:
parent
87d262acb5
commit
7dec440340
@ -96,6 +96,8 @@ pub enum TerminatorKind<'tcx> {
|
|||||||
/// P <- V
|
/// P <- V
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// Note that DropAndReplace is eliminated as part of the `ElaborateDrops` pass.
|
||||||
DropAndReplace {
|
DropAndReplace {
|
||||||
place: Place<'tcx>,
|
place: Place<'tcx>,
|
||||||
value: Operand<'tcx>,
|
value: Operand<'tcx>,
|
||||||
|
@ -38,8 +38,7 @@ impl<'tcx> MirPass<'tcx> for RemoveUnneededDrops {
|
|||||||
impl<'a, 'tcx> Visitor<'tcx> for RemoveUnneededDropsOptimizationFinder<'a, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for RemoveUnneededDropsOptimizationFinder<'a, 'tcx> {
|
||||||
fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) {
|
fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) {
|
||||||
match terminator.kind {
|
match terminator.kind {
|
||||||
TerminatorKind::Drop { place, target, .. }
|
TerminatorKind::Drop { place, target, .. } => {
|
||||||
| TerminatorKind::DropAndReplace { place, target, .. } => {
|
|
||||||
let ty = place.ty(self.body, self.tcx);
|
let ty = place.ty(self.body, self.tcx);
|
||||||
let needs_drop = ty.ty.needs_drop(self.tcx, self.tcx.param_env(self.def_id));
|
let needs_drop = ty.ty.needs_drop(self.tcx, self.tcx.param_env(self.def_id));
|
||||||
if !needs_drop {
|
if !needs_drop {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user