@@ -95,21 +95,25 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> {
95
95
-> Result < MovePathIndex , MoveError < ' tcx > >
96
96
{
97
97
debug ! ( "lookup({:?})" , place) ;
98
- match * place {
99
- Place :: Base ( PlaceBase :: Local ( local) ) => Ok ( self . builder . data . rev_lookup . locals [ local] ) ,
100
- Place :: Base ( PlaceBase :: Static ( ..) ) => {
101
- Err ( MoveError :: cannot_move_out_of ( self . loc , Static ) )
102
- }
103
- Place :: Projection ( ref proj) => {
104
- let base = self . move_path_for ( & proj. base ) ?;
98
+ place. iterate ( |place_base, place_projection| {
99
+ let mut base = match place_base {
100
+ PlaceBase :: Local ( local) => self . builder . data . rev_lookup . locals [ * local] ,
101
+ PlaceBase :: Static ( ..) => {
102
+ return Err ( MoveError :: cannot_move_out_of ( self . loc , Static ) ) ;
103
+ }
104
+ } ;
105
+
106
+ for proj in place_projection {
105
107
let mir = self . builder . mir ;
106
108
let tcx = self . builder . tcx ;
107
109
let place_ty = proj. base . ty ( mir, tcx) . ty ;
108
110
match place_ty. sty {
109
111
ty:: Ref ( ..) | ty:: RawPtr ( ..) =>
110
112
return Err ( MoveError :: cannot_move_out_of (
111
113
self . loc ,
112
- BorrowedContent { target_place : place. clone ( ) } ) ) ,
114
+ BorrowedContent {
115
+ target_place : Place :: Projection ( Box :: new ( proj. clone ( ) ) ) ,
116
+ } ) ) ,
113
117
ty:: Adt ( adt, _) if adt. has_dtor ( tcx) && !adt. is_box ( ) =>
114
118
return Err ( MoveError :: cannot_move_out_of ( self . loc ,
115
119
InteriorOfTypeWithDestructor {
@@ -140,22 +144,31 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> {
140
144
} ,
141
145
_ => { }
142
146
} ;
143
- match self . builder . data . rev_lookup . projections . entry ( ( base, proj. elem . lift ( ) ) ) {
144
- Entry :: Occupied ( ent) => Ok ( * ent. get ( ) ) ,
147
+
148
+ base = match self
149
+ . builder
150
+ . data
151
+ . rev_lookup
152
+ . projections
153
+ . entry ( ( base, proj. elem . lift ( ) ) )
154
+ {
155
+ Entry :: Occupied ( ent) => * ent. get ( ) ,
145
156
Entry :: Vacant ( ent) => {
146
157
let path = MoveDataBuilder :: new_move_path (
147
158
& mut self . builder . data . move_paths ,
148
159
& mut self . builder . data . path_map ,
149
160
& mut self . builder . data . init_path_map ,
150
161
Some ( base) ,
151
- place . clone ( )
162
+ Place :: Projection ( Box :: new ( proj . clone ( ) ) ) ,
152
163
) ;
153
164
ent. insert ( path) ;
154
- Ok ( path)
165
+ path
155
166
}
156
- }
167
+ } ;
157
168
}
158
- }
169
+
170
+ Ok ( base)
171
+ } )
159
172
}
160
173
161
174
fn create_move_path ( & mut self , place : & Place < ' tcx > ) {
0 commit comments