diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2015-02-13 22:58:37 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2015-02-18 08:19:21 +1100 |
| commit | d7b5bc3c2f673ac3edd818cb7bd42555c2cbc2a2 (patch) | |
| tree | 9fc5d0740225f18a41e9dda8ef5bfbc132a858c2 /src/libstd/thread.rs | |
| parent | cae969e2a755bd7e8ec22758a8a02146ddb599a4 (diff) | |
| download | rust-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/thread.rs')
| -rw-r--r-- | src/libstd/thread.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index cc9d7492441..3b758c83980 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -175,9 +175,9 @@ pub struct Builder { // The size of the stack for the spawned thread stack_size: Option<uint>, // Thread-local stdout - stdout: Option<Box<Writer + Send>>, + stdout: Option<Box<Writer + Send + 'static>>, // Thread-local stderr - stderr: Option<Box<Writer + Send>>, + stderr: Option<Box<Writer + Send + 'static>>, } impl Builder { @@ -211,7 +211,7 @@ impl Builder { /// Redirect thread-local stdout. #[unstable(feature = "std_misc", reason = "Will likely go away after proc removal")] - pub fn stdout(mut self, stdout: Box<Writer + Send>) -> Builder { + pub fn stdout(mut self, stdout: Box<Writer + Send + 'static>) -> Builder { self.stdout = Some(stdout); self } @@ -219,7 +219,7 @@ impl Builder { /// Redirect thread-local stderr. #[unstable(feature = "std_misc", reason = "Will likely go away after proc removal")] - pub fn stderr(mut self, stderr: Box<Writer + Send>) -> Builder { + pub fn stderr(mut self, stderr: Box<Writer + Send + 'static>) -> Builder { self.stderr = Some(stderr); self } @@ -469,11 +469,11 @@ impl thread_info::NewThread for Thread { /// /// A thread that completes without panicking is considered to exit successfully. #[stable(feature = "rust1", since = "1.0.0")] -pub type Result<T> = ::result::Result<T, Box<Any + Send>>; +pub type Result<T> = ::result::Result<T, Box<Any + Send + 'static>>; struct Packet<T>(Arc<UnsafeCell<Option<Result<T>>>>); -unsafe impl<T:'static+Send> Send for Packet<T> {} +unsafe impl<T:Send> Send for Packet<T> {} unsafe impl<T> Sync for Packet<T> {} /// An RAII-style guard that will block until thread termination when dropped. @@ -515,7 +515,7 @@ impl<'a, T: Send + 'a> JoinGuard<'a, T> { } } -impl<T: Send> JoinGuard<'static, T> { +impl<T: Send + 'static> JoinGuard<'static, T> { /// Detaches the child thread, allowing it to outlive its parent. #[unstable(feature = "std_misc", reason = "unsure whether this API imposes limitations elsewhere")] |
