From cbc0a15ba1c17962184e35e67e89bd51b37c6e70 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Fri, 31 Dec 2021 18:42:06 +0100 Subject: [PATCH] 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. --- library/std/src/panicking.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index f1baf077580e6..62f0357145e84 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -325,7 +325,7 @@ pub mod panic_count { pub const ALWAYS_ABORT_FLAG: usize = 1 << (usize::BITS - 1); // Panic count for the current thread. - thread_local! { static LOCAL_PANIC_COUNT: Cell = Cell::new(0) } + thread_local! { static LOCAL_PANIC_COUNT: Cell = const { Cell::new(0) } } // Sum of panic counts from all threads. The purpose of this is to have // a fast path in `is_zero` (which is used by `panicking`). In any particular