about summary refs log tree commit diff
path: root/src/libstd/task
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-29 04:22:53 -0700
committerbors <bors@rust-lang.org>2013-06-29 04:22:53 -0700
commit132cfcdd8898a12b19ba01ae64cd9cff9a4c45d9 (patch)
tree53a9a390765ba6af5988811ee3f23944cf888af8 /src/libstd/task
parentc80e3bac3e676abb106f7ef8ac7da5b153c65c8e (diff)
parentd7544fe987104ad0a82b1929b819cfd7e2321bb2 (diff)
downloadrust-132cfcdd8898a12b19ba01ae64cd9cff9a4c45d9.tar.gz
rust-132cfcdd8898a12b19ba01ae64cd9cff9a4c45d9.zip
auto merge of #7363 : bblum/rust/soundness, r=nikomatsakis
The commit f9a5453 is meant to be a temporary hold-over. Whether or not there is added a way for the compiler to "implicitly borrow" stack closures in this way, there should be a codegen optimization that prevents having to traverse possibly-very-many function pointers to find the function you ultimately wanted to call. I tried to separate out the changes so this particular commit could be straight-up reverted if auto-borrowing happens in the future.

r? @nikomatsakis
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);
                 /*##########################################################*