about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-05-23 13:04:59 +0000
committerbors <bors@rust-lang.org>2022-05-23 13:04:59 +0000
commitef9b49881ba99248b68dbdebbebd50155587c509 (patch)
tree856a384a9092e21c825a427c6fa80ccb7dd4e658
parent32c8c5df06c025441ad04791d7982d65c79a60e4 (diff)
parentcbc0a15ba1c17962184e35e67e89bd51b37c6e70 (diff)
downloadrust-ef9b49881ba99248b68dbdebbebd50155587c509.tar.gz
rust-ef9b49881ba99248b68dbdebbebd50155587c509.zip
Auto merge of #92461 - rust-lang:const_tls_local_panic_count, r=Mark-Simulacrum
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.
-rw-r--r--library/std/src/panicking.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs
index 9b045980d45..25c9201f2ed 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<usize> = Cell::new(0) }
+    thread_local! { static LOCAL_PANIC_COUNT: Cell<usize> = 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