about summary refs log tree commit diff
path: root/library/std/src/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-24 13:35:50 +0000
committerbors <bors@rust-lang.org>2024-10-24 13:35:50 +0000
commitf61306d47bc98af8bb9d15f1adf6086785590a8c (patch)
tree0500da4d67b3ec4f77a8cb011074779c5c0315fb /library/std/src/lib.rs
parent5ae4d75effa366176dd75cd0d5662da26385cfc5 (diff)
parent0747f2898e83df7e601189c0f31762e84328becb (diff)
downloadrust-f61306d47bc98af8bb9d15f1adf6086785590a8c.tar.gz
rust-f61306d47bc98af8bb9d15f1adf6086785590a8c.zip
Auto merge of #123550 - GnomedDev:remove-initial-arc, r=Noratrieb
Remove the `Arc` rt::init allocation for thread info

Removes an allocation pre-main by just not storing anything in std::thread::Thread for the main thread.
- The thread name can just be a hard coded literal, as was done in #123433.
- Storing ThreadId and Parker in a static that is initialized once at startup. This uses SyncUnsafeCell and MaybeUninit as this is quite performance critical and we don't need synchronization or to store a tag value and possibly leave in a panic.
Diffstat (limited to 'library/std/src/lib.rs')
-rw-r--r--library/std/src/lib.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 8c1a3c76829..1de52eb7b21 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -364,6 +364,7 @@
 #![feature(std_internals)]
 #![feature(str_internals)]
 #![feature(strict_provenance_atomic_ptr)]
+#![feature(sync_unsafe_cell)]
 #![feature(ub_checks)]
 // tidy-alphabetical-end
 //