Skip to content

Commit

Permalink
Rollup merge of #117281 - RalfJung:thread-safety, r=thomcc
Browse files Browse the repository at this point in the history
std::thread : add SAFETY comment

I forgot to add this in #117266.
  • Loading branch information
matthiaskrgr authored Oct 27, 2023
2 parents 60b071f + ccb36a6 commit f9d62a8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/std/src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,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.
#[cfg(bootstrap)]
let main =
unsafe { mem::transmute::<Box<dyn FnOnce() + 'a>, Box<dyn FnOnce() + 'static>>(main) };
Expand Down

0 comments on commit f9d62a8

Please sign in to comment.