Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created August 29, 2012 01:10
Show Gist options
  • Save nikomatsakis/3505824 to your computer and use it in GitHub Desktop.
Save nikomatsakis/3505824 to your computer and use it in GitHub Desktop.
diff --git a/src/libcore/future.rs b/src/libcore/future.rs
index c24d482..22fb9ce 100644
--- a/src/libcore/future.rs
+++ b/src/libcore/future.rs
@@ -34,6 +34,10 @@ export future_pipe;
#[doc = "The future type"]
struct Future<A> {
/*priv*/ mut state: FutureState<A>;
+
+ // FIXME(#2829) -- futures should not be copyable, because they close
+ // over fn~'s that have pipes and so forth within!
+ drop {}
}
priv enum FutureState<A> {
@@ -88,7 +92,7 @@ fn from_port<A:send>(+port: future_pipe::client::waiting<A>) -> Future<A> {
port_ <-> *port;
let port = option::unwrap(port_);
match recv(port) {
- future_pipe::completed(move data) => data
+ future_pipe::completed(move data) => data
}
}
}
diff --git a/src/libcore/unsafe.rs b/src/libcore/unsafe.rs
index ffebf57..4c508ce 100644
--- a/src/libcore/unsafe.rs
+++ b/src/libcore/unsafe.rs
@@ -402,13 +402,13 @@ mod tests {
for uint::range(0u, num_tasks) |_i| {
let total = total.clone();
- futures += ~[future::spawn(|| {
+ vec::push(futures, future::spawn(|| {
for uint::range(0u, count) |_i| {
do total.with |count| {
**count += 1u;
}
}
- })];
+ }));
};
for futures.each |f| { f.get() }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment