Skip to content

std tests: avoid duplicating thread-local machinery#157416

Open
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:dedup-thread-local
Open

std tests: avoid duplicating thread-local machinery#157416
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:dedup-thread-local

Conversation

@RalfJung
Copy link
Copy Markdown
Member

@RalfJung RalfJung commented Jun 4, 2026

Under cfg(test) we have two copies of the standard library loaded, including two copies of all its global variables. Something about how that interacts with #148799 results in memory leaks on windows-gnu targets, which are caught by Miri.

I'm not sure if it's worth debugging this. It's easier to just avoid duplicating the thread-local machinery.

(This is something we had already done in the past, and then at some point stopped doing as Miri showed no more problems with the duplicate machinery. Now the problems are back.)

Cc @joboet @ChrisDenton

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

rustbot commented Jun 4, 2026

r? @clarfonthey

rustbot has assigned @clarfonthey.
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: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 10 candidates
  • Random selection from Mark-Simulacrum, clarfonthey, jhpratt

@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the dedup-thread-local branch from d9f4393 to 316f09f Compare June 4, 2026 08:20
@clarfonthey
Copy link
Copy Markdown
Contributor

Duplicating libstd in tests was probably bound to do something like this eventually, honestly. The code looks fine and I guess while it's tempting to find a permanent fix I feel more inclined to just merge as a direct improvement.

r=me from the libs side but will let you tell bors to merge in case you wanted more input on the review first. Your comment implies no, but since this is sufficiently weird and you have r+ permissions anyway I think it's fine to let you do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants