diff options
| author | bors <bors@rust-lang.org> | 2013-09-19 19:31:13 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-19 19:31:13 -0700 |
| commit | 407d179f4e0b625e6911ebaf72c87cd35935fb06 (patch) | |
| tree | 03a0d29757c7b5ba7b3f1eb579b3184174c40fb2 /src/test | |
| parent | 570431fcacb115eb0bc3bd9f81977b57173a95ef (diff) | |
| parent | 963707f45d935e938adde9e37b56355a915660bd (diff) | |
| download | rust-407d179f4e0b625e6911ebaf72c87cd35935fb06.tar.gz rust-407d179f4e0b625e6911ebaf72c87cd35935fb06.zip | |
auto merge of #9285 : sfackler/rust/future, r=alexcrichton
The `Drop` implementation was used to prevent `Future` from being implicitly copyable. Since `~fn`s are no longer copyable, this is no longer needed. I added a cfail test to make sure that this is actually the case. I method-ized all of the `Future` creation methods and added a new one, `spawn_with`, which is similar to `task::spawn_with`. I also got rid of some unused imports in tests.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/bench/msgsend-ring-mutex-arcs.rs | 4 | ||||
| -rw-r--r-- | src/test/bench/msgsend-ring-rw-arcs.rs | 4 | ||||
| -rw-r--r-- | src/test/compile-fail/future_not_copyable.rs | 19 |
3 files changed, 23 insertions, 4 deletions
diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs index dd56d550e61..b52ba154f43 100644 --- a/src/test/bench/msgsend-ring-mutex-arcs.rs +++ b/src/test/bench/msgsend-ring-mutex-arcs.rs @@ -18,7 +18,7 @@ extern mod extra; use extra::arc; -use extra::future; +use extra::future::Future; use extra::time; use std::cell::Cell; use std::os; @@ -94,7 +94,7 @@ fn main() { let (new_chan, num_port) = init(); let num_chan2 = Cell::new(num_chan.take()); let num_port = Cell::new(num_port); - let new_future = do future::spawn() { + let new_future = do Future::spawn() { let num_chan = num_chan2.take(); let num_port1 = num_port.take(); thread_ring(i, msg_per_task, num_chan, num_port1) diff --git a/src/test/bench/msgsend-ring-rw-arcs.rs b/src/test/bench/msgsend-ring-rw-arcs.rs index 130bd4e7d16..e3d0b4912f9 100644 --- a/src/test/bench/msgsend-ring-rw-arcs.rs +++ b/src/test/bench/msgsend-ring-rw-arcs.rs @@ -18,7 +18,7 @@ extern mod extra; use extra::arc; -use extra::future; +use extra::future::Future; use extra::time; use std::cell::Cell; use std::os; @@ -90,7 +90,7 @@ fn main() { let (new_chan, num_port) = init(); let num_chan2 = Cell::new(num_chan.take()); let num_port = Cell::new(num_port); - let new_future = do future::spawn { + let new_future = do Future::spawn { let num_chan = num_chan2.take(); let num_port1 = num_port.take(); thread_ring(i, msg_per_task, num_chan, num_port1) diff --git a/src/test/compile-fail/future_not_copyable.rs b/src/test/compile-fail/future_not_copyable.rs new file mode 100644 index 00000000000..aef5d0f9b04 --- /dev/null +++ b/src/test/compile-fail/future_not_copyable.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern mod extra; + +use extra::future::Future; + +fn main() { + let f = Future::from_value(()); + let g = f; + f.unwrap(); //~ ERROR use of moved value +} |
