Skip to content

Commit

Permalink
Auto merge of #92461 - rust-lang:const_tls_local_panic_count, r=Mark-…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
bors committed May 23, 2022
2 parents 32c8c5d + cbc0a15 commit ef9b498
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/std/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ef9b498

Please sign in to comment.