Skip to content

Commit 733e93b

Browse files
committed
Use const-TLS for the WorkerThread pointer (MSRV 1.59)
This enables more efficient code -- stabilized in rust-lang/rust#91355.
1 parent 1341ce3 commit 733e93b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rayon-core/src/registry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ pub(super) struct WorkerThread {
686686
// worker is fully unwound. Using an unsafe pointer avoids the need
687687
// for a RefCell<T> etc.
688688
thread_local! {
689-
static WORKER_THREAD_STATE: Cell<*const WorkerThread> = Cell::new(ptr::null());
689+
static WORKER_THREAD_STATE: Cell<*const WorkerThread> = const { Cell::new(ptr::null()) };
690690
}
691691

692692
impl From<ThreadBuilder> for WorkerThread {

0 commit comments

Comments
 (0)