Skip to content

Commit 619cfb8

Browse files
committed
Use const initializer for LOCAL_PANIC_COUNT
This reduces the size of the __getit function for LOCAL_PANIC_COUNT and should speed up accesses of LOCAL_PANIC_COUNT a bit.
1 parent 6305f7f commit 619cfb8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

std/src/panicking.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ pub mod panic_count {
325325
pub const ALWAYS_ABORT_FLAG: usize = 1 << (usize::BITS - 1);
326326

327327
// Panic count for the current thread.
328-
thread_local! { static LOCAL_PANIC_COUNT: Cell<usize> = Cell::new(0) }
328+
thread_local! { static LOCAL_PANIC_COUNT: Cell<usize> = const { Cell::new(0) } }
329329

330330
// Sum of panic counts from all threads. The purpose of this is to have
331331
// a fast path in `is_zero` (which is used by `panicking`). In any particular

0 commit comments

Comments
 (0)