about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-10-27 15:14:25 +0200
committerRalf Jung <post@ralfj.de>2023-10-27 15:18:32 +0200
commitccb36a688d2b67e8df05142a0f525882dae19709 (patch)
tree45ae13868495f9251a59e4c32ba80a01ae9ffdc8
parent95f6a01e8f8fb121ded7d0eaa86906437cb08652 (diff)
downloadrust-ccb36a688d2b67e8df05142a0f525882dae19709.tar.gz
rust-ccb36a688d2b67e8df05142a0f525882dae19709.zip
std::thread: add SAFETY comment
-rw-r--r--library/std/src/thread/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs
index 68ea486933a..4097eb5549e 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<dyn FnOnce() + 'a>, Box<dyn FnOnce() + 'static>>(main) };