Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 92b604f

Browse files
committedJun 4, 2024
Pass function for Thread as Send to Thread::imp
1 parent 8943103 commit 92b604f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎std/src/thread/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,8 @@ impl Builder {
561561
let main = Box::new(main);
562562
// SAFETY: dynamic size and alignment of the Box remain the same. See below for why the
563563
// lifetime change is justified.
564-
let main = unsafe { Box::from_raw(Box::into_raw(main) as *mut (dyn FnOnce() + 'static)) };
564+
let main =
565+
unsafe { Box::from_raw(Box::into_raw(main) as *mut (dyn FnOnce() + Send + 'static)) };
565566

566567
Ok(JoinInner {
567568
// SAFETY:
@@ -1544,7 +1545,7 @@ struct Packet<'scope, T> {
15441545
// The type `T` should already always be Send (otherwise the thread could not
15451546
// have been created) and the Packet is Sync because all access to the
15461547
// `UnsafeCell` synchronized (by the `join()` boundary), and `ScopeData` is Sync.
1547-
unsafe impl<'scope, T: Sync> Sync for Packet<'scope, T> {}
1548+
unsafe impl<'scope, T: Send> Sync for Packet<'scope, T> {}
15481549

15491550
impl<'scope, T> Drop for Packet<'scope, T> {
15501551
fn drop(&mut self) {

0 commit comments

Comments
 (0)
Failed to load comments.