@@ -103,6 +103,12 @@ impl<'tcx> Visitor<'tcx> for DropRangeVisitor<'tcx> {
103
103
fn visit_expr ( & mut self , expr : & ' tcx Expr < ' tcx > ) {
104
104
let mut reinit = None ;
105
105
match expr. kind {
106
+ ExprKind :: Assign ( lhs, rhs, _) => {
107
+ self . visit_expr ( lhs) ;
108
+ self . visit_expr ( rhs) ;
109
+
110
+ reinit = Some ( lhs) ;
111
+ }
106
112
ExprKind :: If ( test, if_true, if_false) => {
107
113
self . visit_expr ( test) ;
108
114
@@ -119,17 +125,6 @@ impl<'tcx> Visitor<'tcx> for DropRangeVisitor<'tcx> {
119
125
120
126
self . drop_ranges . add_control_edge ( true_end, self . expr_index + 1 ) ;
121
127
}
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
- }
133
128
ExprKind :: Match ( scrutinee, arms, ..) => {
134
129
self . visit_expr ( scrutinee) ;
135
130
@@ -160,12 +155,45 @@ impl<'tcx> Visitor<'tcx> for DropRangeVisitor<'tcx> {
160
155
self . drop_ranges . add_control_edge ( arm_end, self . expr_index + 1 )
161
156
} ) ;
162
157
}
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
+ }
163
163
ExprKind :: Break ( hir:: Destination { target_id : Ok ( target) , .. } , ..)
164
164
| ExprKind :: Continue ( hir:: Destination { target_id : Ok ( target) , .. } , ..) => {
165
165
self . drop_ranges . add_control_edge_hir_id ( self . expr_index , target) ;
166
166
}
167
167
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) ,
169
197
}
170
198
171
199
self . expr_index = self . expr_index + 1 ;
0 commit comments