diff options
| author | Jeff Olson <olson.jeffery@gmail.com> | 2012-08-28 21:28:25 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-09-08 14:22:15 -0700 |
| commit | 02ddbadc10d19a5cfa2dd6f8de89068bf4dfb852 (patch) | |
| tree | a744891d0ca6c6d42e7c2a281258acd89c98d8a3 /src/libcore | |
| parent | 27129c6aba153299100887de5c8643cbe3e9b8ef (diff) | |
core: patch from nmatsakis to make futures non-copyable
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/future.rs | 8 | ||||
| -rw-r--r-- | src/libcore/unsafe.rs | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/libcore/future.rs b/src/libcore/future.rs index 82deaf89537..48fad44ff47 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -33,7 +33,11 @@ export future_pipe; #[doc = "The future type"] struct Future<A> { - /*priv*/ mut state: FutureState<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 5539aa7d89e..6f2e3f94ca2 100644 --- a/src/libcore/unsafe.rs +++ b/src/libcore/unsafe.rs @@ -415,13 +415,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() } |
