1
+ use crate :: move_paths:: FxHashMap ;
1
2
use crate :: un_derefer:: UnDerefer ;
2
3
use rustc_index:: vec:: IndexVec ;
3
4
use rustc_middle:: mir:: tcx:: RvalueInitializationState ;
@@ -206,10 +207,13 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
206
207
}
207
208
}
208
209
210
+ pub type MoveDat < ' tcx > = Result <
211
+ ( FxHashMap < Local , Place < ' tcx > > , MoveData < ' tcx > ) ,
212
+ ( MoveData < ' tcx > , Vec < ( Place < ' tcx > , MoveError < ' tcx > ) > ) ,
213
+ > ;
214
+
209
215
impl < ' a , ' tcx > MoveDataBuilder < ' a , ' tcx > {
210
- fn finalize (
211
- self ,
212
- ) -> Result < MoveData < ' tcx > , ( MoveData < ' tcx > , Vec < ( Place < ' tcx > , MoveError < ' tcx > ) > ) > {
216
+ fn finalize ( self ) -> MoveDat < ' tcx > {
213
217
debug ! ( "{}" , {
214
218
debug!( "moves for {:?}:" , self . body. span) ;
215
219
for ( j, mo) in self . data. moves. iter_enumerated( ) {
@@ -222,15 +226,19 @@ impl<'a, 'tcx> MoveDataBuilder<'a, 'tcx> {
222
226
"done dumping moves"
223
227
} ) ;
224
228
225
- if !self . errors . is_empty ( ) { Err ( ( self . data , self . errors ) ) } else { Ok ( self . data ) }
229
+ if self . errors . is_empty ( ) {
230
+ Ok ( ( self . un_derefer . derefer_sidetable , self . data ) )
231
+ } else {
232
+ Err ( ( self . data , self . errors ) )
233
+ }
226
234
}
227
235
}
228
236
229
237
pub ( super ) fn gather_moves < ' tcx > (
230
238
body : & Body < ' tcx > ,
231
239
tcx : TyCtxt < ' tcx > ,
232
240
param_env : ty:: ParamEnv < ' tcx > ,
233
- ) -> Result < MoveData < ' tcx > , ( MoveData < ' tcx > , Vec < ( Place < ' tcx > , MoveError < ' tcx > ) > ) > {
241
+ ) -> MoveDat < ' tcx > {
234
242
let mut builder = MoveDataBuilder :: new ( body, tcx, param_env) ;
235
243
236
244
builder. gather_args ( ) ;
0 commit comments