cargo test --doc
from make -j
always triggers "failed to connect to jobserver from environment"
#14407
Labels
A-doctests
Area: rustdoc --test
A-jobserver
Area: jobserver, concurrency, parallelism
C-bug
Category: bug
S-needs-info
Status: Needs more info, such as a reproduction or more background for a feature request.
Problem
Having a Makefile run
cargo test --doc
, even with the command flagged as recursive with+
so thatmake -j
enables the jobserver for it, always triggers the rustc warning about a jobserver issue ("failed to connect to jobserver from environment variable"). I expect this to not happen.I'm not sure what the "actual" impact beyond the warning is, since at least compiling dependency crates seems to follow the
-j
as expected. Maybe it only affects the compilation step for the final doctest binaries?I guessed that this is most likely a cargo issue, although the interaction among cargo/rustdoc/rustc for doctests isn't very clear to me so maybe the root cause lies somewhere else.
Steps
cargo new --lib foo && cd foo && printf 'doctests:\n\t+cargo test --doc' | make -j2 -f -
Results on my system (GNU Make 4.3, cargo 1.80.1):
Changing
--doc
to--lib
does not trigger the issue:And removing
--doc
triggers it only during the doctests stage:Possible Solution(s)
No response
Notes
The only workaround I've come up with is to use
MAKEFLAGS= cargo test --doc
, but that of course causes thecargo test --doc
invocation to use more parallelism than given tomake -j
, potentially oversubscribing the CPU.cargo test --doc -j1
can then be used as an additional workaround, with the natural downside of slowing down compilation a lot.Version
The text was updated successfully, but these errors were encountered: