rust-lang / rust-lang/rust

Revisit the `rust_test_helpers` setup

Open
#140,680 0 comments 0 reactions 1 assignee View on GitHub

@jieyouxu is already working on this.

Since Sep 7, 2026.

A-test-infra A-testsuite C-bug T-bootstrap T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

ui, incremental test suites all have implicit access to a C helper static library built for the host/target platforms, called rust_test_helpers.

EDIT: two copies, one for host, one for target, see https://github.com/rust-lang/rust/blob/243c5a35e18b2634892fe7091d5ee888a18f77f5/src/bootstrap/src/core/build_steps/test.rs#L1791-L1798.

https://github.com/rust-lang/rust/blob/master/tests/auxiliary/rust_test_helpers.c

https://github.com/search?q=repo%3Arust-lang%2Frust%20rust_test_helpers&type=code

This is kinda strange for a few reasons:

  • All tests/{ui,incremental} tests implicitly have the built C static lib in the linker search paths, even if the test doesn't need it
  • A test might not need rust_test_helpers, but during bootstrap, it will be unconditionally built for the target anyway (requires a working target C compiler toolchain).
  • You can't specify or override what C compiler flags rust_test_helpers is built with. Notably, this includes optimization levels or debuginfo levels, or sanitizers or whatever. Every tests/{ui,incremental} gets access to the same prebuilt copy.

I'm not looking to change this any time soon, since it needs some surveying on what use cases tests using rust_test_helpers are exercising to come up with more robust alternative designs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.