@@ -3,7 +3,7 @@ use crate::pointer_id::PointerTable;
33use crate :: type_desc:: { self , Ownership , Quantity } ;
44use crate :: util:: { self , Callee } ;
55use rustc_middle:: mir:: {
6- BasicBlock , Body , Location , Operand , Rvalue , Statement , StatementKind , Terminator ,
6+ BasicBlock , Body , Location , Operand , Place , Rvalue , Statement , StatementKind , Terminator ,
77 TerminatorKind ,
88} ;
99use rustc_span:: { Span , DUMMY_SP } ;
@@ -132,6 +132,7 @@ impl<'a, 'tcx> ExprRewriteVisitor<'a, 'tcx> {
132132 }
133133 StatementKind :: FakeRead ( ..) => { }
134134 StatementKind :: SetDiscriminant { .. } => todo ! ( "statement {:?}" , stmt) ,
135+ StatementKind :: Deinit ( ..) => { }
135136 StatementKind :: StorageLive ( ..) => { }
136137 StatementKind :: StorageDead ( ..) => { }
137138 StatementKind :: Retag ( ..) => { }
@@ -251,23 +252,29 @@ impl<'a, 'tcx> ExprRewriteVisitor<'a, 'tcx> {
251252 Rvalue :: ShallowInitBox ( ref _op, _ty) => {
252253 // TODO
253254 }
255+ Rvalue :: CopyForDeref ( pl) => {
256+ self . enter_rvalue_operand ( 0 , |v| v. visit_place ( pl, expect_ty) ) ;
257+ }
254258 }
255259 }
256260
257261 fn visit_operand ( & mut self , op : & Operand < ' tcx > , expect_ty : LTy < ' tcx > ) {
258262 match * op {
259263 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) ;
266265 }
267266 Operand :: Constant ( ..) => { }
268267 }
269268 }
270269
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+
271278 fn visit_operand_desc (
272279 & mut self ,
273280 op : & Operand < ' tcx > ,
0 commit comments