diff options
| author | Raoul Strackx <raoul.strackx@fortanix.com> | 2024-05-30 15:22:12 +0200 |
|---|---|---|
| committer | Raoul Strackx <raoul.strackx@fortanix.com> | 2024-06-04 08:45:48 +0200 |
| commit | 9b2e41a21800bcd56c5ce3307ab7e484f83d51b3 (patch) | |
| tree | a4baec03a7e44956de2c3b1f99c27609c5528c52 /library/std/src/thread/mod.rs | |
| parent | 7cd732f990ec341efdac53f6519a44b72e07861f (diff) | |
| download | rust-9b2e41a21800bcd56c5ce3307ab7e484f83d51b3.tar.gz rust-9b2e41a21800bcd56c5ce3307ab7e484f83d51b3.zip | |
Pass function for `Thread` as `Send` to `Thread::imp`
Diffstat (limited to 'library/std/src/thread/mod.rs')
| -rw-r--r-- | library/std/src/thread/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 22215873933..83e27dfb746 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -561,7 +561,8 @@ impl Builder { let main = Box::new(main); // SAFETY: dynamic size and alignment of the Box remain the same. See below for why the // lifetime change is justified. - let main = unsafe { Box::from_raw(Box::into_raw(main) as *mut (dyn FnOnce() + 'static)) }; + let main = + unsafe { Box::from_raw(Box::into_raw(main) as *mut (dyn FnOnce() + Send + 'static)) }; Ok(JoinInner { // SAFETY: @@ -1544,7 +1545,7 @@ struct Packet<'scope, T> { // The type `T` should already always be Send (otherwise the thread could not // have been created) and the Packet is Sync because all access to the // `UnsafeCell` synchronized (by the `join()` boundary), and `ScopeData` is Sync. -unsafe impl<'scope, T: Sync> Sync for Packet<'scope, T> {} +unsafe impl<'scope, T: Send> Sync for Packet<'scope, T> {} impl<'scope, T> Drop for Packet<'scope, T> { fn drop(&mut self) { |
