@@ -103,6 +103,12 @@ impl<'tcx> Visitor<'tcx> for DropRangeVisitor<'tcx> {
103103 fn visit_expr ( & mut self , expr : & ' tcx Expr < ' tcx > ) {
104104 let mut reinit = None ;
105105 match expr. kind {
106+ ExprKind :: Assign ( lhs, rhs, _) => {
107+ self . visit_expr ( lhs) ;
108+ self . visit_expr ( rhs) ;
109+
110+ reinit = Some ( lhs) ;
111+ }
106112 ExprKind :: If ( test, if_true, if_false) => {
107113 self . visit_expr ( test) ;
108114
@@ -119,17 +125,6 @@ impl<'tcx> Visitor<'tcx> for DropRangeVisitor<'tcx> {
119125
120126 self . drop_ranges . add_control_edge ( true_end, self . expr_index + 1 ) ;
121127 }
122- ExprKind :: Assign ( lhs, rhs, _) => {
123- self . visit_expr ( lhs) ;
124- self . visit_expr ( rhs) ;
125-
126- reinit = Some ( lhs) ;
127- }
128- ExprKind :: Loop ( body, ..) => {
129- let loop_begin = self . expr_index + 1 ;
130- self . visit_block ( body) ;
131- self . drop_ranges . add_control_edge ( self . expr_index , loop_begin) ;
132- }
133128 ExprKind :: Match ( scrutinee, arms, ..) => {
134129 self . visit_expr ( scrutinee) ;
135130
@@ -160,12 +155,45 @@ impl<'tcx> Visitor<'tcx> for DropRangeVisitor<'tcx> {
160155 self . drop_ranges . add_control_edge ( arm_end, self . expr_index + 1 )
161156 } ) ;
162157 }
158+ ExprKind :: Loop ( body, ..) => {
159+ let loop_begin = self . expr_index + 1 ;
160+ self . visit_block ( body) ;
161+ self . drop_ranges . add_control_edge ( self . expr_index , loop_begin) ;
162+ }
163163 ExprKind :: Break ( hir:: Destination { target_id : Ok ( target) , .. } , ..)
164164 | ExprKind :: Continue ( hir:: Destination { target_id : Ok ( target) , .. } , ..) => {
165165 self . drop_ranges . add_control_edge_hir_id ( self . expr_index , target) ;
166166 }
167167
168- _ => intravisit:: walk_expr ( self , expr) ,
168+ ExprKind :: AddrOf ( ..)
169+ | ExprKind :: Array ( ..)
170+ | ExprKind :: AssignOp ( ..)
171+ | ExprKind :: Binary ( ..)
172+ | ExprKind :: Block ( ..)
173+ | ExprKind :: Box ( ..)
174+ | ExprKind :: Break ( ..)
175+ | ExprKind :: Call ( ..)
176+ | ExprKind :: Cast ( ..)
177+ | ExprKind :: Closure ( ..)
178+ | ExprKind :: ConstBlock ( ..)
179+ | ExprKind :: Continue ( ..)
180+ | ExprKind :: DropTemps ( ..)
181+ | ExprKind :: Err
182+ | ExprKind :: Field ( ..)
183+ | ExprKind :: Index ( ..)
184+ | ExprKind :: InlineAsm ( ..)
185+ | ExprKind :: Let ( ..)
186+ | ExprKind :: Lit ( ..)
187+ | ExprKind :: LlvmInlineAsm ( ..)
188+ | ExprKind :: MethodCall ( ..)
189+ | ExprKind :: Path ( ..)
190+ | ExprKind :: Repeat ( ..)
191+ | ExprKind :: Ret ( ..)
192+ | ExprKind :: Struct ( ..)
193+ | ExprKind :: Tup ( ..)
194+ | ExprKind :: Type ( ..)
195+ | ExprKind :: Unary ( ..)
196+ | ExprKind :: Yield ( ..) => intravisit:: walk_expr ( self , expr) ,
169197 }
170198
171199 self . expr_index = self . expr_index + 1 ;
0 commit comments