Description
#126245 merged support in Edition 2024 for consolidating doctests into as few binaries as possible, with an opt-out of a standalone
attribute.
I propose by default doc-tests should be run in parallel in the same process.
What's the motivation for the proposed change? For example when working on the Rust standard library, I usually run the tests for core
and std/alloc
, that takes incremental ~84s on my Zen 3 5900X machine. Out of that ~66s are spent running the ~4k core doc tests. That's on Linux, on Windows I expect this to be even slower, due to a higher process spawning overhead. Merged doc tests is tied to the Rust 2024 edition because it can break behavior. So there is already precedent for having a new default that is better in the common case, but may break existing projects that opt into the new edition, requiring some work. I believe and doing some code analysis via grep.app would support that the majority of doc tests can be run in parallel in the same binary. So that should be the default. For the cases that depend on some kind of singleton, log lib init, etc. they can be marked with an attribute as requiring a standalone process. That would make for two possible attributes: build isolated and run isolated. If this is deemed too complex, it's imaginable that there is only a single attribute that implies both build and run isolated.
Tagging @GuillaumeGomez