@@ -95,21 +95,25 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> {
9595 -> Result < MovePathIndex , MoveError < ' tcx > >
9696 {
9797 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 {
105107 let mir = self . builder . mir ;
106108 let tcx = self . builder . tcx ;
107109 let place_ty = proj. base . ty ( mir, tcx) . ty ;
108110 match place_ty. sty {
109111 ty:: Ref ( ..) | ty:: RawPtr ( ..) =>
110112 return Err ( MoveError :: cannot_move_out_of (
111113 self . loc ,
112- BorrowedContent { target_place : place. clone ( ) } ) ) ,
114+ BorrowedContent {
115+ target_place : Place :: Projection ( Box :: new ( proj. clone ( ) ) ) ,
116+ } ) ) ,
113117 ty:: Adt ( adt, _) if adt. has_dtor ( tcx) && !adt. is_box ( ) =>
114118 return Err ( MoveError :: cannot_move_out_of ( self . loc ,
115119 InteriorOfTypeWithDestructor {
@@ -140,22 +144,31 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> {
140144 } ,
141145 _ => { }
142146 } ;
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 ( ) ,
145156 Entry :: Vacant ( ent) => {
146157 let path = MoveDataBuilder :: new_move_path (
147158 & mut self . builder . data . move_paths ,
148159 & mut self . builder . data . path_map ,
149160 & mut self . builder . data . init_path_map ,
150161 Some ( base) ,
151- place . clone ( )
162+ Place :: Projection ( Box :: new ( proj . clone ( ) ) ) ,
152163 ) ;
153164 ent. insert ( path) ;
154- Ok ( path)
165+ path
155166 }
156- }
167+ } ;
157168 }
158- }
169+
170+ Ok ( base)
171+ } )
159172 }
160173
161174 fn create_move_path ( & mut self , place : & Place < ' tcx > ) {
0 commit comments