Skip to content

Commit

Permalink
Unrolled build for rust-lang#117281
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#117281 - RalfJung:thread-safety, r=thomcc

std::thread : add SAFETY comment

I forgot to add this in rust-lang#117266.
  • Loading branch information
rust-timer authored Oct 27, 2023
2 parents 59bb950 + ccb36a6 commit 51ca741
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 51ca741

Please sign in to comment.