Skip to content

Commit

Permalink
Run the analysis process only once per closure, on the way up the tree.
Browse files Browse the repository at this point in the history
This was the intention before but silly coding caused it to run twice if
there are nested closures.
  • Loading branch information
nikomatsakis committed Jul 24, 2015
1 parent 1e2677b commit 6b49f4d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/librustc_typeck/check/upvar.rs
Expand Up @@ -183,9 +183,8 @@ impl<'a,'tcx> AdjustBorrowKind<'a,'tcx> {
* Analysis starting point.
*/

self.visit_block(body);
debug!("analyze_closure(id={:?}, body.id={:?})", id, body.id);

debug!("analyzing closure `{}` with fn body id `{}`", id, body.id);

let mut euv = euv::ExprUseVisitor::new(self, self.fcx.infcx());
euv.walk_fn(decl, body);
Expand Down Expand Up @@ -485,8 +484,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for AdjustBorrowKind<'a, 'tcx> {
// ignore nested fn items
}
visit::FkFnBlock => {
self.analyze_closure(id, decl, body);
visit::walk_fn(self, fn_kind, decl, body, span);
self.analyze_closure(id, span, decl, body);
}
}
}
Expand Down

0 comments on commit 6b49f4d

Please sign in to comment.