Skip to content

Commit 34be151

Browse files
committed
fix comment, remove redundant code
1 parent 830d65c commit 34be151

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

src/librustc_mir/dataflow/drop_flag_effects.rs

+1-18
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use syntax_pos::DUMMY_SP;
12-
1311
use rustc::mir::{self, Mir, Location};
1412
use rustc::ty::{self, TyCtxt};
1513
use util::elaborate_drops::DropFlagState;
@@ -187,23 +185,13 @@ pub(crate) fn drop_flag_effects_for_location<'a, 'gcx, 'tcx, F>(
187185
where F: FnMut(MovePathIndex, DropFlagState)
188186
{
189187
let move_data = &ctxt.move_data;
190-
let param_env = ctxt.param_env;
191188
debug!("drop_flag_effects_for_location({:?})", loc);
192189

193190
// first, move out of the RHS
194191
for mi in &move_data.loc_map[loc] {
195192
let path = mi.move_path_index(move_data);
196193
debug!("moving out of path {:?}", move_data.move_paths[path]);
197194

198-
// don't move out of non-Copy things
199-
let lvalue = &move_data.move_paths[path].lvalue;
200-
let ty = lvalue.ty(mir, tcx).to_ty(tcx);
201-
let gcx = tcx.global_tcx();
202-
let erased_ty = gcx.lift(&tcx.erase_regions(&ty)).unwrap();
203-
if !erased_ty.moves_by_default(gcx, param_env, DUMMY_SP) {
204-
continue;
205-
}
206-
207195
on_all_children_bits(tcx, mir, move_data,
208196
path,
209197
|mpi| callback(mpi, DropFlagState::Absent))
@@ -231,13 +219,8 @@ pub(crate) fn drop_flag_effects_for_location<'a, 'gcx, 'tcx, F>(
231219
}
232220
}
233221
}
234-
mir::StatementKind::StorageDead(local) => {
235-
on_lookup_result_bits(tcx, mir, move_data,
236-
move_data.rev_lookup.find(&mir::Lvalue::Local(local)),
237-
|mpi| callback(mpi, DropFlagState::Absent))
238-
239-
}
240222
mir::StatementKind::StorageLive(_) |
223+
mir::StatementKind::StorageDead(_) |
241224
mir::StatementKind::InlineAsm { .. } |
242225
mir::StatementKind::EndRegion(_) |
243226
mir::StatementKind::Validate(..) |

src/librustc_mir/dataflow/impls/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,10 @@ impl<'a, 'gcx, 'tcx> BitDenotation for MovingOutStatements<'a, 'gcx, 'tcx> {
457457
let rev_lookup = &move_data.rev_lookup;
458458

459459
match stmt.kind {
460-
// skip move out for StorageDead
460+
// this analysis only tries to find moves explicitly
461+
// written by the user, so we ignore the move-outs
462+
// created by `StorageDead` and at the beginning
463+
// of a function.
461464
mir::StatementKind::StorageDead(_) => {}
462465
_ => {
463466
debug!("stmt {:?} at loc {:?} moves out of move_indexes {:?}",

0 commit comments

Comments
 (0)