]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/expr_use_visitor.rs
Auto merge of #30341 - pnkfelix:call-site-scope, r=nikomatsakis
[rust.git] / src / librustc / middle / expr_use_visitor.rs
index 6e469da33f98e14de55cf2712307621ed5b07943..4861f0a6b643641aa8d5ed13b29242732480a4fe 100644 (file)
@@ -458,9 +458,13 @@ pub fn walk_expr(&mut self, expr: &hir::Expr) {
                     self.consume_expr(&**input);
                 }
 
-                for &(_, ref output, is_rw) in &ia.outputs {
-                    self.mutate_expr(expr, &**output,
-                                           if is_rw { WriteAndRead } else { JustWrite });
+                for output in &ia.outputs {
+                    if output.is_indirect {
+                        self.consume_expr(&*output.expr);
+                    } else {
+                        self.mutate_expr(expr, &*output.expr,
+                                         if output.is_rw { WriteAndRead } else { JustWrite });
+                    }
                 }
             }
 
@@ -637,7 +641,7 @@ fn walk_block(&mut self, blk: &hir::Block) {
         debug!("walk_block(blk.id={})", blk.id);
 
         for stmt in &blk.stmts {
-            self.walk_stmt(&**stmt);
+            self.walk_stmt(stmt);
         }
 
         if let Some(ref tail_expr) = blk.expr {
@@ -934,7 +938,7 @@ fn determine_pat_move_mode(&mut self,
         return_if_err!(self.mc.cat_pattern(cmt_discr, pat, |_mc, cmt_pat, pat| {
             let tcx = self.tcx();
             let def_map = &self.tcx().def_map;
-            if pat_util::pat_is_binding(def_map, pat) {
+            if pat_util::pat_is_binding(&def_map.borrow(), pat) {
                 match pat.node {
                     hir::PatIdent(hir::BindByRef(_), _, _) =>
                         mode.lub(BorrowingMatch),
@@ -969,7 +973,7 @@ fn walk_pat(&mut self,
         let def_map = &self.tcx().def_map;
         let delegate = &mut self.delegate;
         return_if_err!(mc.cat_pattern(cmt_discr.clone(), pat, |mc, cmt_pat, pat| {
-            if pat_util::pat_is_binding(def_map, pat) {
+            if pat_util::pat_is_binding(&def_map.borrow(), pat) {
                 let tcx = typer.tcx;
 
                 debug!("binding cmt_pat={:?} pat={:?} match_mode={:?}",