std:🧵 add SAFETY comment

This commit is contained in:
Ralf Jung 2023-10-27 15:14:25 +02:00
parent 95f6a01e8f
commit ccb36a688d

View File

@ -546,6 +546,8 @@ impl Builder {
} }
let main = Box::new(main); 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)] #[cfg(bootstrap)]
let main = let main =
unsafe { mem::transmute::<Box<dyn FnOnce() + 'a>, Box<dyn FnOnce() + 'static>>(main) }; unsafe { mem::transmute::<Box<dyn FnOnce() + 'a>, Box<dyn FnOnce() + 'static>>(main) };