File tree 2 files changed +6
-13
lines changed
rustc_mir_dataflow/src/move_paths
2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -108,9 +108,7 @@ impl LocalsStateAtExit {
108
108
has_storage_dead. visit_body ( body) ;
109
109
let mut has_storage_dead_or_moved = has_storage_dead. 0 ;
110
110
for move_out in & move_data. moves {
111
- if let Some ( index) = move_data. base_local ( move_out. path ) {
112
- has_storage_dead_or_moved. insert ( index) ;
113
- }
111
+ has_storage_dead_or_moved. insert ( move_data. base_local ( move_out. path ) ) ;
114
112
}
115
113
LocalsStateAtExit :: SomeAreInvalidated { has_storage_dead_or_moved }
116
114
}
Original file line number Diff line number Diff line change @@ -358,20 +358,15 @@ impl<'tcx> MoveData<'tcx> {
358
358
builder:: gather_moves ( body, tcx, param_env, filter)
359
359
}
360
360
361
- /// For the move path `mpi`, returns the root local variable (if any) that starts the path.
362
- /// (e.g., for a path like `a.b.c` returns `Some(a) `)
363
- pub fn base_local ( & self , mut mpi : MovePathIndex ) -> Option < Local > {
361
+ /// For the move path `mpi`, returns the root local variable that starts the path.
362
+ /// (e.g., for a path like `a.b.c` returns `a `)
363
+ pub fn base_local ( & self , mut mpi : MovePathIndex ) -> Local {
364
364
loop {
365
365
let path = & self . move_paths [ mpi] ;
366
366
if let Some ( l) = path. place . as_local ( ) {
367
- return Some ( l) ;
368
- }
369
- if let Some ( parent) = path. parent {
370
- mpi = parent;
371
- continue ;
372
- } else {
373
- return None ;
367
+ return l;
374
368
}
369
+ mpi = path. parent . expect ( "root move paths should be locals" ) ;
375
370
}
376
371
}
377
372
You can’t perform that action at this time.
0 commit comments