File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -268,18 +268,22 @@ impl<'tcx> Visitor<'tcx> for SideEffectVisit<'tcx> {
268268 pat, init : Some ( init) , ..
269269 } ) => {
270270 self . visit_pat_expr ( pat, init, false ) ;
271+ self . ret_vars . clear ( ) ;
271272 } ,
272273 StmtKind :: Item ( i) => {
273274 let item = self . ty_ctx . hir ( ) . item ( i) ;
274275 self . visit_item ( item) ;
276+ self . ret_vars . clear ( ) ;
277+ } ,
278+ StmtKind :: Expr ( e) | StmtKind :: Semi ( e) => {
279+ self . visit_expr ( e) ;
280+ self . ret_vars . clear ( ) ;
275281 } ,
276- StmtKind :: Expr ( e) | StmtKind :: Semi ( e) => self . visit_expr ( e) ,
277282 StmtKind :: Local ( _) => { } ,
278283 }
279284 }
280285
281286 fn visit_expr ( & mut self , ex : & ' tcx Expr < ' tcx > ) {
282- debug_assert ! ( self . ret_vars. is_empty( ) ) ;
283287 match ex. kind {
284288 ExprKind :: Array ( exprs) | ExprKind :: Tup ( exprs) => {
285289 self . ret_vars = exprs
You can’t perform that action at this time.
0 commit comments