Skip to content

Commit 553e78a

Browse files
authored
Unrolled build for #155689
Rollup merge of #155689 - zetanumbers:lock_latch_thread_local, r=ShoyuVanilla Const initialize `LOCK_LATCH` thread local A simple refactor to avoid runtime thread-local initialization.
2 parents 9836b06 + 892f176 commit 553e78a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

compiler/rustc_thread_pool/src/latch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ pub(super) struct LockLatch {
220220

221221
impl LockLatch {
222222
#[inline]
223-
pub(super) fn new() -> LockLatch {
223+
pub(super) const fn new() -> LockLatch {
224224
LockLatch { m: Mutex::new(false), v: Condvar::new() }
225225
}
226226

compiler/rustc_thread_pool/src/registry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ impl Registry {
524524
OP: FnOnce(&WorkerThread, bool) -> R + Send,
525525
R: Send,
526526
{
527-
thread_local!(static LOCK_LATCH: LockLatch = LockLatch::new());
527+
thread_local!(static LOCK_LATCH: LockLatch = const { LockLatch::new() });
528528

529529
LOCK_LATCH.with(|l| {
530530
// This thread isn't a member of *any* thread pool, so just block.

0 commit comments

Comments
 (0)