Description
A rust_library can build with a generated rustc_env_files input while its legacy rust_doc_test fails before rustdoc starts. If the environment file comes through an execution transition, the generated launcher keeps its bazel-out/<exec-configuration>/bin/... path. That path does not exist when the launcher runs from the test's runfiles directory.
The launcher should rewrite the output roots of all declared inputs to their runfiles paths. At the affected revision it discovers roots through crate and C++ library providers, which do not describe this environment file.
Reproduction steps
The fixture in #4271 writes an environment file, forwards it through a rule with cfg = "exec", and attaches it to a library's rustc_env_files. The doctest reads env!("GENERATED_VALUE").
Add those three fixture files to the affected revision, leaving the production rules unchanged, then run:
bazel test //test/rustdoc_generated_inputs:generated_environment_test \
--//rust/settings:experimental_compile_rustdoc_tests=false
The expected result is a passing doctest. Before the fix, the process wrapper cannot open the generated environment file because its argument still contains the execution output root.
Additional context
Proposed fix: #4271. It collects nonempty roots from the action's declared inputs. Source files have an empty root and must not cause / to be stripped from every argument.
This extends the runtime-library root handling in #4220/#4221 to generated inputs that have no crate or C++ provider.
Impact
Legacy doctests fail for otherwise valid crates that use generated compiler inputs from another configuration.
Bazel and rules_rust version
Affected rules_rust revision: c708b236. The existing regression work used Bazel 9.2.0 on macOS arm64.
Description
A
rust_librarycan build with a generatedrustc_env_filesinput while its legacyrust_doc_testfails before rustdoc starts. If the environment file comes through an execution transition, the generated launcher keeps itsbazel-out/<exec-configuration>/bin/...path. That path does not exist when the launcher runs from the test's runfiles directory.The launcher should rewrite the output roots of all declared inputs to their runfiles paths. At the affected revision it discovers roots through crate and C++ library providers, which do not describe this environment file.
Reproduction steps
The fixture in #4271 writes an environment file, forwards it through a rule with
cfg = "exec", and attaches it to a library'srustc_env_files. The doctest readsenv!("GENERATED_VALUE").Add those three fixture files to the affected revision, leaving the production rules unchanged, then run:
bazel test //test/rustdoc_generated_inputs:generated_environment_test \ --//rust/settings:experimental_compile_rustdoc_tests=falseThe expected result is a passing doctest. Before the fix, the process wrapper cannot open the generated environment file because its argument still contains the execution output root.
Additional context
Proposed fix: #4271. It collects nonempty roots from the action's declared inputs. Source files have an empty root and must not cause
/to be stripped from every argument.This extends the runtime-library root handling in #4220/#4221 to generated inputs that have no crate or C++ provider.
Impact
Legacy doctests fail for otherwise valid crates that use generated compiler inputs from another configuration.
Bazel and rules_rust version
Affected rules_rust revision: c708b236. The existing regression work used Bazel 9.2.0 on macOS arm64.