fix comment, remove redundant code
This commit is contained in:
parent
830d65c1ff
commit
34be1516aa
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use syntax_pos::DUMMY_SP;
|
||||
|
||||
use rustc::mir::{self, Mir, Location};
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
use util::elaborate_drops::DropFlagState;
|
||||
@ -187,7 +185,6 @@ pub(crate) fn drop_flag_effects_for_location<'a, 'gcx, 'tcx, F>(
|
||||
where F: FnMut(MovePathIndex, DropFlagState)
|
||||
{
|
||||
let move_data = &ctxt.move_data;
|
||||
let param_env = ctxt.param_env;
|
||||
debug!("drop_flag_effects_for_location({:?})", loc);
|
||||
|
||||
// first, move out of the RHS
|
||||
@ -195,15 +192,6 @@ pub(crate) fn drop_flag_effects_for_location<'a, 'gcx, 'tcx, F>(
|
||||
let path = mi.move_path_index(move_data);
|
||||
debug!("moving out of path {:?}", move_data.move_paths[path]);
|
||||
|
||||
// don't move out of non-Copy things
|
||||
let lvalue = &move_data.move_paths[path].lvalue;
|
||||
let ty = lvalue.ty(mir, tcx).to_ty(tcx);
|
||||
let gcx = tcx.global_tcx();
|
||||
let erased_ty = gcx.lift(&tcx.erase_regions(&ty)).unwrap();
|
||||
if !erased_ty.moves_by_default(gcx, param_env, DUMMY_SP) {
|
||||
continue;
|
||||
}
|
||||
|
||||
on_all_children_bits(tcx, mir, move_data,
|
||||
path,
|
||||
|mpi| callback(mpi, DropFlagState::Absent))
|
||||
@ -231,13 +219,8 @@ pub(crate) fn drop_flag_effects_for_location<'a, 'gcx, 'tcx, F>(
|
||||
}
|
||||
}
|
||||
}
|
||||
mir::StatementKind::StorageDead(local) => {
|
||||
on_lookup_result_bits(tcx, mir, move_data,
|
||||
move_data.rev_lookup.find(&mir::Lvalue::Local(local)),
|
||||
|mpi| callback(mpi, DropFlagState::Absent))
|
||||
|
||||
}
|
||||
mir::StatementKind::StorageLive(_) |
|
||||
mir::StatementKind::StorageDead(_) |
|
||||
mir::StatementKind::InlineAsm { .. } |
|
||||
mir::StatementKind::EndRegion(_) |
|
||||
mir::StatementKind::Validate(..) |
|
||||
|
@ -457,7 +457,10 @@ impl<'a, 'gcx, 'tcx> BitDenotation for MovingOutStatements<'a, 'gcx, 'tcx> {
|
||||
let rev_lookup = &move_data.rev_lookup;
|
||||
|
||||
match stmt.kind {
|
||||
// skip move out for StorageDead
|
||||
// this analysis only tries to find moves explicitly
|
||||
// written by the user, so we ignore the move-outs
|
||||
// created by `StorageDead` and at the beginning
|
||||
// of a function.
|
||||
mir::StatementKind::StorageDead(_) => {}
|
||||
_ => {
|
||||
debug!("stmt {:?} at loc {:?} moves out of move_indexes {:?}",
|
||||
|
Loading…
Reference in New Issue
Block a user