File tree 1 file changed +13
-11
lines changed
src/librustc_mir/transform
1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -210,17 +210,19 @@ impl MirPass for RestoreSubsliceArrayMoveOut {
210
210
let items : Vec < _ > = items. iter ( ) . map ( |item| {
211
211
if let Operand :: Move ( place) = item {
212
212
if let PlaceBase :: Local ( local) = place. base {
213
- let local_use = & visitor. locals_use [ local] ;
214
- let opt_index_and_place = Self :: try_get_item_source (
215
- tcx,
216
- local_use,
217
- mir
218
- ) ;
219
- // each local should be used twice:
220
- // in assign and in aggregate statments
221
- if local_use. use_count == 2 && opt_index_and_place. is_some ( ) {
222
- let ( index, src_place) = opt_index_and_place. unwrap ( ) ;
223
- return Some ( ( local_use, index, src_place) ) ;
213
+ if place. has_no_projection ( ) {
214
+ let local_use = & visitor. locals_use [ local] ;
215
+ let opt_index_and_place = Self :: try_get_item_source (
216
+ tcx,
217
+ local_use,
218
+ mir
219
+ ) ;
220
+ // each local should be used twice:
221
+ // in assign and in aggregate statments
222
+ if local_use. use_count == 2 && opt_index_and_place. is_some ( ) {
223
+ let ( index, src_place) = opt_index_and_place. unwrap ( ) ;
224
+ return Some ( ( local_use, index, src_place) ) ;
225
+ }
224
226
}
225
227
}
226
228
}
You can’t perform that action at this time.
0 commit comments