Skip to content

Commit

Permalink
std::thread: add SAFETY comment
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Oct 27, 2023
1 parent 95f6a01 commit 186295b
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
// lfetime 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 186295b

Please sign in to comment.