The optimization should also apply for DropAndReplace
This commit is contained in:
parent
d3338dcf4d
commit
f472303a93
@ -29,7 +29,8 @@ impl<'tcx> MirPass<'tcx> for RemoveUnneededDrops {
|
||||
impl<'a, 'tcx> Visitor<'tcx> for RemoveUnneededDropsOptimizationFinder<'a, 'tcx> {
|
||||
fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) {
|
||||
match terminator.kind {
|
||||
TerminatorKind::Drop { place, target, .. } => {
|
||||
TerminatorKind::Drop { place, target, .. }
|
||||
| TerminatorKind::DropAndReplace { place, target, .. } => {
|
||||
let ty = place.ty(self.body, self.tcx);
|
||||
let needs_drop = ty.ty.needs_drop(self.tcx, self.tcx.param_env(self.def_id));
|
||||
if !needs_drop {
|
||||
|
Loading…
Reference in New Issue
Block a user