Skip to content

Commit d8de324

Browse files
authored
Use cheaper init in thread_local (#701)
`thread_local!` has special case for `const {}` syntax, and avoids creating an extra lazy init function in such case.
1 parent b70de06 commit d8de324

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ mod lock {
150150
static mut LOCK: *mut Mutex<()> = ptr::null_mut();
151151
static INIT: Once = Once::new();
152152
// Whether this thread is the one that holds the lock
153-
thread_local!(static LOCK_HELD: Cell<bool> = Cell::new(false));
153+
thread_local!(static LOCK_HELD: Cell<bool> = const { Cell::new(false) });
154154

155155
impl Drop for LockGuard {
156156
fn drop(&mut self) {

0 commit comments

Comments
 (0)