@@ -39,15 +39,15 @@ impl<'a, 'tcx> MoveDataBuilder<'a, 'tcx> {
39
39
. iter_enumerated ( )
40
40
. map ( |( i, l) | {
41
41
if l. is_deref_temp ( ) {
42
- MovePathIndex :: MAX
42
+ None
43
43
} else {
44
- Self :: new_move_path (
44
+ Some ( Self :: new_move_path (
45
45
& mut move_paths,
46
46
& mut path_map,
47
47
& mut init_path_map,
48
48
None ,
49
49
Place :: from ( i) ,
50
- )
50
+ ) )
51
51
}
52
52
} )
53
53
. collect ( ) ,
@@ -100,7 +100,9 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
100
100
let data = & mut self . builder . data ;
101
101
102
102
debug ! ( "lookup({:?})" , place) ;
103
- let mut base = data. rev_lookup . find_local ( place. local ) ;
103
+ let Some ( mut base) = data. rev_lookup . find_local ( place. local ) else {
104
+ return Err ( MoveError :: UntrackedLocal ) ;
105
+ } ;
104
106
105
107
// The move path index of the first union that we find. Once this is
106
108
// some we stop creating child move paths, since moves from unions
@@ -328,17 +330,17 @@ pub(super) fn gather_moves<'tcx>(
328
330
impl < ' a , ' tcx > MoveDataBuilder < ' a , ' tcx > {
329
331
fn gather_args ( & mut self ) {
330
332
for arg in self . body . args_iter ( ) {
331
- let path = self . data . rev_lookup . find_local ( arg) ;
333
+ if let Some ( path) = self . data . rev_lookup . find_local ( arg) {
334
+ let init = self . data . inits . push ( Init {
335
+ path,
336
+ kind : InitKind :: Deep ,
337
+ location : InitLocation :: Argument ( arg) ,
338
+ } ) ;
332
339
333
- let init = self . data . inits . push ( Init {
334
- path,
335
- kind : InitKind :: Deep ,
336
- location : InitLocation :: Argument ( arg) ,
337
- } ) ;
338
-
339
- debug ! ( "gather_args: adding init {:?} of {:?} for argument {:?}" , init, path, arg) ;
340
+ debug ! ( "gather_args: adding init {:?} of {:?} for argument {:?}" , init, path, arg) ;
340
341
341
- self . data . init_path_map [ path] . push ( init) ;
342
+ self . data . init_path_map [ path] . push ( init) ;
343
+ }
342
344
}
343
345
}
344
346
@@ -546,9 +548,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
546
548
self . record_move ( place, path) ;
547
549
return ;
548
550
}
549
- Err ( MoveError :: IllegalMove { .. } ) => {
550
- return ;
551
- }
551
+ Err ( MoveError :: IllegalMove { .. } | MoveError :: UntrackedLocal ) => return ,
552
552
} ;
553
553
let base_ty = base_place. ty ( self . builder . body , self . builder . tcx ) . ty ;
554
554
let len: u64 = match base_ty. kind ( ) {
@@ -567,7 +567,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
567
567
} else {
568
568
match self . move_path_for ( place) {
569
569
Ok ( path) | Err ( MoveError :: UnionMove { path } ) => self . record_move ( place, path) ,
570
- Err ( MoveError :: IllegalMove { .. } ) => { }
570
+ Err ( MoveError :: IllegalMove { .. } | MoveError :: UntrackedLocal ) => { }
571
571
} ;
572
572
}
573
573
}
0 commit comments