about summary refs log tree commit diff
path: root/src/libstd/task
diff options
context:
space:
mode:
authorBen Blum <bblum@andrew.cmu.edu>2013-06-21 20:08:35 -0400
committerBen Blum <bblum@andrew.cmu.edu>2013-06-29 04:39:34 -0400
commitff4ab9e147b0be4126b8b70ca6ab27173a46077a (patch)
treef028c640cd8a3efd7f8ec5661ba255d269250dbe /src/libstd/task
parent89110fdf55c000096fc24a78d35256544c7b523f (diff)
downloadrust-ff4ab9e147b0be4126b8b70ca6ab27173a46077a.tar.gz
rust-ff4ab9e147b0be4126b8b70ca6ab27173a46077a.zip
'Borrow' stack closures rather than copying them (e.g., "|x|f(x)"), in prep for making them noncopyable.
Diffstat (limited to 'src/libstd/task')
-rw-r--r--src/libstd/task/spawn.rs4
1 files changed, 4 insertions, 0 deletions
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);
                 /*##########################################################*