diff --git a/compiler/rustc_thread_pool/src/latch.rs b/compiler/rustc_thread_pool/src/latch.rs index 29c85146e4f1..da3937a5ff41 100644 --- a/compiler/rustc_thread_pool/src/latch.rs +++ b/compiler/rustc_thread_pool/src/latch.rs @@ -220,7 +220,7 @@ pub(super) struct LockLatch { impl LockLatch { #[inline] - pub(super) fn new() -> LockLatch { + pub(super) const fn new() -> LockLatch { LockLatch { m: Mutex::new(false), v: Condvar::new() } } diff --git a/compiler/rustc_thread_pool/src/registry.rs b/compiler/rustc_thread_pool/src/registry.rs index 92bb8961e7df..9510c1842f86 100644 --- a/compiler/rustc_thread_pool/src/registry.rs +++ b/compiler/rustc_thread_pool/src/registry.rs @@ -524,7 +524,7 @@ unsafe fn in_worker_cold(&self, op: OP) -> R OP: FnOnce(&WorkerThread, bool) -> R + Send, R: Send, { - thread_local!(static LOCK_LATCH: LockLatch = LockLatch::new()); + thread_local!(static LOCK_LATCH: LockLatch = const { LockLatch::new() }); LOCK_LATCH.with(|l| { // This thread isn't a member of *any* thread pool, so just block.