Skip to content

Commit

Permalink
guarantee has_no_projection in uniform_array_moveout
Browse files Browse the repository at this point in the history
  • Loading branch information
csmoe committed Sep 6, 2018
1 parent ba7feb1 commit 552a935
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/librustc_mir/transform/uniform_array_move_out.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,19 @@ impl MirPass for RestoreSubsliceArrayMoveOut {
let items : Vec<_> = items.iter().map(|item| {
if let Operand::Move(place) = item {
if let PlaceBase::Local(local) = place.base {
let local_use = &visitor.locals_use[local];
let opt_index_and_place = Self::try_get_item_source(
tcx,
local_use,
mir
);
// each local should be used twice:
// in assign and in aggregate statments
if local_use.use_count == 2 && opt_index_and_place.is_some() {
let (index, src_place) = opt_index_and_place.unwrap();
return Some((local_use, index, src_place));
if place.has_no_projection() {
let local_use = &visitor.locals_use[local];
let opt_index_and_place = Self::try_get_item_source(
tcx,
local_use,
mir
);
// each local should be used twice:
// in assign and in aggregate statments
if local_use.use_count == 2 && opt_index_and_place.is_some() {
let (index, src_place) = opt_index_and_place.unwrap();
return Some((local_use, index, src_place));
}
}
}
}
Expand Down

0 comments on commit 552a935

Please sign in to comment.