about summary refs log tree commit diff
path: root/src/libstd/sync/future.rs
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2015-02-18 23:50:21 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2015-02-18 23:50:21 +1100
commitdfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5 (patch)
treee9c32f2e58b3462a23dd9c472d2f236640b78811 /src/libstd/sync/future.rs
parent6c065fc8cb036785f61ff03e05c1563cbb2dd081 (diff)
parent47f91a9484eceef10536d4caac6ef578cd254567 (diff)
downloadrust-dfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5.tar.gz
rust-dfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5.zip
Manual merge of #22475 - alexcrichton:rollup, r=alexcrichton
 One windows bot failed spuriously.
Diffstat (limited to 'src/libstd/sync/future.rs')
-rw-r--r--src/libstd/sync/future.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs
index a230e35dac8..d60e2738808 100644
--- a/src/libstd/sync/future.rs
+++ b/src/libstd/sync/future.rs
@@ -38,7 +38,7 @@ use core::mem::replace;
 use self::FutureState::*;
 use sync::mpsc::{Receiver, channel};
 use thunk::{Thunk};
-use thread::Thread;
+use thread;
 
 /// A type encapsulating the result of a computation which may not be complete
 pub struct Future<A> {
@@ -46,7 +46,7 @@ pub struct Future<A> {
 }
 
 enum FutureState<A> {
-    Pending(Thunk<(),A>),
+    Pending(Thunk<'static,(),A>),
     Evaluating,
     Forced(A)
 }
@@ -103,7 +103,7 @@ impl<A> Future<A> {
     }
 
     pub fn from_fn<F>(f: F) -> Future<A>
-        where F : FnOnce() -> A, F : Send
+        where F : FnOnce() -> A, F : Send + 'static
     {
         /*!
          * Create a future from a function.
@@ -117,7 +117,7 @@ impl<A> Future<A> {
     }
 }
 
-impl<A:Send> Future<A> {
+impl<A:Send+'static> Future<A> {
     pub fn from_receiver(rx: Receiver<A>) -> Future<A> {
         /*!
          * Create a future from a port
@@ -132,7 +132,7 @@ impl<A:Send> Future<A> {
     }
 
     pub fn spawn<F>(blk: F) -> Future<A>
-        where F : FnOnce() -> A, F : Send
+        where F : FnOnce() -> A, F : Send + 'static
     {
         /*!
          * Create a future from a unique closure.
@@ -143,7 +143,7 @@ impl<A:Send> Future<A> {
 
         let (tx, rx) = channel();
 
-        Thread::spawn(move || {
+        thread::spawn(move || {
             // Don't panic if the other end has hung up
             let _ = tx.send(blk());
         });
@@ -157,7 +157,7 @@ mod test {
     use prelude::v1::*;
     use sync::mpsc::channel;
     use sync::Future;
-    use thread::Thread;
+    use thread;
 
     #[test]
     fn test_from_value() {
@@ -215,7 +215,7 @@ mod test {
         let expected = "schlorf";
         let (tx, rx) = channel();
         let f = Future::spawn(move|| { expected });
-        let _t = Thread::spawn(move|| {
+        let _t = thread::spawn(move|| {
             let mut f = f;
             tx.send(f.get()).unwrap();
         });