Skip to content

Const initialize LOCK_LATCH thread local#155689

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
zetanumbers:lock_latch_thread_local
Apr 24, 2026
Merged

Const initialize LOCK_LATCH thread local#155689
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
zetanumbers:lock_latch_thread_local

Conversation

@zetanumbers
Copy link
Copy Markdown
Contributor

A simple refactor to avoid runtime thread-local initialization.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 23, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 23, 2026

r? @ShoyuVanilla

rustbot has assigned @ShoyuVanilla.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 19 candidates

@ShoyuVanilla
Copy link
Copy Markdown
Member

I'm not sure this would give us a perf gain, since it occurs on a cold path.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 23, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 23, 2026
Const initialize `LOCK_LATCH` thread local
@cuviper
Copy link
Copy Markdown
Member

cuviper commented Apr 23, 2026

FWIW, I also did this in rayon: rayon-rs/rayon@85dfae1

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 23, 2026

☀️ Try build successful (CI)
Build commit: 2ca292b (2ca292ba1c7d0dec9d293d1ff8017aedb25ee171, parent: 827651f2200cefab42dac4c2ae7f80a7149340de)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2ca292b): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 2.7%, secondary 1.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.7% [2.7%, 2.7%] 1
Regressions ❌
(secondary)
1.9% [1.9%, 1.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.7% [2.7%, 2.7%] 1

Cycles

Results (secondary 5.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.9% [5.9%, 5.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 490.734s -> 492.373s (0.33%)
Artifact size: 394.28 MiB -> 394.32 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 23, 2026
@ShoyuVanilla
Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 23, 2026

📌 Commit 892f176 has been approved by ShoyuVanilla

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 23, 2026
rust-bors Bot pushed a commit that referenced this pull request Apr 24, 2026
Rollup of 7 pull requests

Successful merges:

 - #155660 (c-variadic: fix for sparc64)
 - #153482 (tests/ui/macros: add annotations for reference rules)
 - #155075 (Add docs about SDKs and C compilation on armv7a-vex-v5)
 - #155685 (Fix `get_child_at_index` return type hints)
 - #155686 (Fix array template arg lookup behavior)
 - #155689 (Const initialize `LOCK_LATCH` thread local)
 - #155690 (Fix classify_union to return Union for regular unions)
@rust-bors rust-bors Bot merged commit b7f0235 into rust-lang:main Apr 24, 2026
12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 24, 2026
rust-timer added a commit that referenced this pull request Apr 24, 2026
Rollup merge of #155689 - zetanumbers:lock_latch_thread_local, r=ShoyuVanilla

Const initialize `LOCK_LATCH` thread local

A simple refactor to avoid runtime thread-local initialization.
@zetanumbers zetanumbers deleted the lock_latch_thread_local branch April 24, 2026 07:37
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 24, 2026
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#155660 (c-variadic: fix for sparc64)
 - rust-lang/rust#153482 (tests/ui/macros: add annotations for reference rules)
 - rust-lang/rust#155075 (Add docs about SDKs and C compilation on armv7a-vex-v5)
 - rust-lang/rust#155685 (Fix `get_child_at_index` return type hints)
 - rust-lang/rust#155686 (Fix array template arg lookup behavior)
 - rust-lang/rust#155689 (Const initialize `LOCK_LATCH` thread local)
 - rust-lang/rust#155690 (Fix classify_union to return Union for regular unions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants