File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed
rustc_mir_dataflow/src/move_paths Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -108,9 +108,7 @@ impl LocalsStateAtExit {
108108 has_storage_dead. visit_body ( body) ;
109109 let mut has_storage_dead_or_moved = has_storage_dead. 0 ;
110110 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 ) ) ;
114112 }
115113 LocalsStateAtExit :: SomeAreInvalidated { has_storage_dead_or_moved }
116114 }
Original file line number Diff line number Diff line change @@ -358,20 +358,15 @@ impl<'tcx> MoveData<'tcx> {
358358 builder:: gather_moves ( body, tcx, param_env, filter)
359359 }
360360
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 {
364364 loop {
365365 let path = & self . move_paths [ mpi] ;
366366 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;
374368 }
369+ mpi = path. parent . expect ( "root move paths should be locals" ) ;
375370 }
376371 }
377372
You can’t perform that action at this time.
0 commit comments