From ff4ab9e147b0be4126b8b70ca6ab27173a46077a Mon Sep 17 00:00:00 2001 From: Ben Blum Date: Fri, 21 Jun 2013 20:08:35 -0400 Subject: 'Borrow' stack closures rather than copying them (e.g., "|x|f(x)"), in prep for making them noncopyable. --- src/libstd/task/spawn.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/libstd/task') diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index 8f06fede057..c932a9660c2 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -230,11 +230,15 @@ fn each_ancestor(list: &mut AncestorList, // 'do_continue' - Did the forward_blk succeed at this point? (i.e., // should we recurse? or should our callers unwind?) + let forward_blk = Cell::new(forward_blk); + // The map defaults to None, because if ancestors is None, we're at // the end of the list, which doesn't make sense to coalesce. return do (**ancestors).map_default((None,false)) |ancestor_arc| { // NB: Takes a lock! (this ancestor node) do access_ancestors(ancestor_arc) |nobe| { + // Argh, but we couldn't give it to coalesce() otherwise. + let forward_blk = forward_blk.take(); // Check monotonicity assert!(last_generation > nobe.generation); /*##########################################################* -- cgit 1.4.1-3-g733a5