Rollup merge of #117281 - RalfJung:thread-safety, r=thomcc

std::thread : add SAFETY comment

I forgot to add this in https://github.com/rust-lang/rust/pull/117266.
This commit is contained in:
Matthias Krüger 2023-10-27 19:46:10 +02:00 committed by GitHub
commit f9d62a84f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) };