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-13 22:58:37 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2015-02-18 08:19:21 +1100
commitd7b5bc3c2f673ac3edd818cb7bd42555c2cbc2a2 (patch)
tree9fc5d0740225f18a41e9dda8ef5bfbc132a858c2 /src/libstd/sync/future.rs
parentcae969e2a755bd7e8ec22758a8a02146ddb599a4 (diff)
downloadrust-d7b5bc3c2f673ac3edd818cb7bd42555c2cbc2a2.tar.gz
rust-d7b5bc3c2f673ac3edd818cb7bd42555c2cbc2a2.zip
Update the libraries to reflect Send loosing the 'static bound.
In most places this preserves the current API by adding an explicit
`'static` bound.

Notably absent are some impls like `unsafe impl<T: Send> Send for
Foo<T>` and the `std::thread` module. It is likely that it will be
possible to remove these after auditing the code to ensure restricted
lifetimes are safe.

More progress on #22251.
Diffstat (limited to 'src/libstd/sync/future.rs')
-rw-r--r--src/libstd/sync/future.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs
index a230e35dac8..ae2a8db0342 100644
--- a/src/libstd/sync/future.rs
+++ b/src/libstd/sync/future.rs
@@ -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.