@@ -3,7 +3,7 @@ use crate::pointer_id::PointerTable;
3
3
use crate :: type_desc:: { self , Ownership , Quantity } ;
4
4
use crate :: util:: { self , Callee } ;
5
5
use rustc_middle:: mir:: {
6
- BasicBlock , Body , Location , Operand , Rvalue , Statement , StatementKind , Terminator ,
6
+ BasicBlock , Body , Location , Operand , Place , Rvalue , Statement , StatementKind , Terminator ,
7
7
TerminatorKind ,
8
8
} ;
9
9
use rustc_span:: { Span , DUMMY_SP } ;
@@ -132,6 +132,7 @@ impl<'a, 'tcx> ExprRewriteVisitor<'a, 'tcx> {
132
132
}
133
133
StatementKind :: FakeRead ( ..) => { }
134
134
StatementKind :: SetDiscriminant { .. } => todo ! ( "statement {:?}" , stmt) ,
135
+ StatementKind :: Deinit ( ..) => { }
135
136
StatementKind :: StorageLive ( ..) => { }
136
137
StatementKind :: StorageDead ( ..) => { }
137
138
StatementKind :: Retag ( ..) => { }
@@ -251,23 +252,29 @@ impl<'a, 'tcx> ExprRewriteVisitor<'a, 'tcx> {
251
252
Rvalue :: ShallowInitBox ( ref _op, _ty) => {
252
253
// TODO
253
254
}
255
+ Rvalue :: CopyForDeref ( pl) => {
256
+ self . enter_rvalue_operand ( 0 , |v| v. visit_place ( pl, expect_ty) ) ;
257
+ }
254
258
}
255
259
}
256
260
257
261
fn visit_operand ( & mut self , op : & Operand < ' tcx > , expect_ty : LTy < ' tcx > ) {
258
262
match * op {
259
263
Operand :: Copy ( pl) | Operand :: Move ( pl) => {
260
- if let Some ( ptr) = self . acx . ptr_of ( pl) {
261
- let expect_ptr = expect_ty. label ;
262
- self . emit_ptr_cast ( ptr, expect_ptr) ;
263
- }
264
-
265
- // TODO: walk over `pl` to handle all derefs (casts, `*x` -> `(*x).get()`)
264
+ self . visit_place ( pl, expect_ty) ;
266
265
}
267
266
Operand :: Constant ( ..) => { }
268
267
}
269
268
}
270
269
270
+ fn visit_place ( & mut self , pl : Place < ' tcx > , expect_ty : LTy < ' tcx > ) {
271
+ if let Some ( ptr) = self . acx . ptr_of ( pl) {
272
+ let expect_ptr = expect_ty. label ;
273
+ self . emit_ptr_cast ( ptr, expect_ptr) ;
274
+ }
275
+ // TODO: walk over `pl` to handle all derefs (casts, `*x` -> `(*x).get()`)
276
+ }
277
+
271
278
fn visit_operand_desc (
272
279
& mut self ,
273
280
op : & Operand < ' tcx > ,
0 commit comments