Revisit the `rust_test_helpers` setup
@jieyouxu is already working on this.
Since Sep 7, 2026.
- 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_helpersis built with. Notably, this includes optimization levels or debuginfo levels, or sanitizers or whatever. Everytests/{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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.