fix: `rust_doc_test` failure to find params file (#1418)

**Context**
Today `rust_doc_test` fails when Bazel [Args](https://docs.bazel.build/versions/main/skylark/lib/Args.html) "spill" over to a file. To a user this failure is seemingly random because Bazel will auto-magically spill `Args` onto a file when there are too many args for the command line, or when it can improve performance. The generated test script, e.g. `hellolib.rustdoc_test.sh`, is then run from runfiles, which is separate from the Arg file Bazel created.

It's especially tricky because the amount of command line args Windows supports is < macOS < Linux, so there's a "silent" OS dependency here too.

**Solution**
This PR fixes the issue by manually declaring a params file, e.g. `hellolib.rustdoc_opt_params`, that is a sibling file to our test runner, `hellolib.rustdoc_test.sh`. We then pass the path of this optional params file to our test writer. The test writer checks for the presence of the Bazel Args file, and if it finds one, copies the content into our manually declared params file. 

Our manually declared params file then gets moved into runfiles with our test script. The test script can then find the file, and `rustdoc` picks up the args.

Note: Today we detect the params file by matching a prefix of `@` and suffix of `.rustdoc_test.sh-0.params`. I'm not sure if this is accurate for all systems, or all versions of bazel. I tried the [`use_param_file`](https://docs.bazel.build/versions/main/skylark/lib/Args.html#use_param_file) option on `Args` to make it easier to detect a params file, but that seem to overwrite (or just generally effect) the other arguments we'd pass to `rustdoc_test_writer.rs`.

Fixes #1233 
8 files changed
tree: bf7cfdf315f3c1b491a76102ecfbf89f14cd38cb
  1. .bazelci/
  2. .github/
  3. bindgen/
  4. cargo/
  5. crate_universe/
  6. distro/
  7. docs/
  8. examples/
  9. proto/
  10. rust/
  11. test/
  12. tools/
  13. util/
  14. wasm_bindgen/
  15. .bazelignore
  16. .bazelrc
  17. .clang-format
  18. .gitignore
  19. ARCHITECTURE.md
  20. AUTHORS
  21. BUILD.bazel
  22. CODEOWNERS
  23. COMPATIBILITY.md
  24. CONTRIBUTING.md
  25. CONTRIBUTORS
  26. LICENSE.txt
  27. README.md
  28. version.bzl
  29. WORKSPACE.bazel
  30. workspace.bzl
README.md

Rust Rules

  • Postsubmit Build status

Overview

This repository provides rules for building Rust projects with Bazel.

Community

General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust.

Documentation

Please refer to the full documentation.