From ccb36a688d2b67e8df05142a0f525882dae19709 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 27 Oct 2023 15:14:25 +0200 Subject: [PATCH] std::thread: add SAFETY comment --- library/std/src/thread/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 68ea486933ab1..4097eb5549efe 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -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>(main) };