]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/dataflow/move_paths/builder.rs
Reorder yield visitation order to match call
[rust.git] / src / librustc_mir / dataflow / move_paths / builder.rs
index adba38d2a816ae1860875840e42f8d24dfb29f8c..57aa5de7f7a318de09ab76bf2534e5f572ea601f 100644 (file)
@@ -109,7 +109,7 @@ fn move_path_for(&mut self, place: &Place<'tcx>) -> Result<MovePathIndex, MoveEr
             let proj_base = &place.projection[..i];
             let body = self.builder.body;
             let tcx = self.builder.tcx;
-            let place_ty = Place::ty_from(&place.local, proj_base, body, tcx).ty;
+            let place_ty = Place::ty_from(place.local, proj_base, body, tcx).ty;
             match place_ty.kind {
                 ty::Ref(..) | ty::RawPtr(..) => {
                     let proj = &place.projection[..i + 1];
@@ -380,8 +380,10 @@ fn gather_terminator(&mut self, term: &Terminator<'tcx>) {
                 self.gather_operand(discr);
             }
 
-            TerminatorKind::Yield { ref value, .. } => {
+            TerminatorKind::Yield { ref value, resume_arg: ref place, .. } => {
                 self.gather_operand(value);
+                self.create_move_path(place);
+                self.gather_init(place.as_ref(), InitKind::Deep);
             }
 
             TerminatorKind::Drop { ref location, target: _, unwind: _ } => {