diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2015-07-17 08:20:23 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2015-07-24 04:53:19 -0400 |
| commit | 6b49f4ded7c92da2323043bcda59886c881023e9 (patch) | |
| tree | 49276c72671107010a365ead2eb946686b091432 | |
| parent | 1e2677be72e2b0c180ed1be38d1868b4829ad530 (diff) | |
| download | rust-6b49f4ded7c92da2323043bcda59886c881023e9.tar.gz rust-6b49f4ded7c92da2323043bcda59886c881023e9.zip | |
Run the analysis process only once per closure, on the way up the tree.
This was the intention before but silly coding caused it to run twice if there are nested closures.
| -rw-r--r-- | src/librustc_typeck/check/upvar.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index c7f084e27cd..20db3b69bd1 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -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); @@ -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); } } } |
