fix for using a nightly channel after https://github.com/bazelbuild/rules_rust/commit/841fc6fb82141576d91aecb1d3f2656d58b0ab71 (#1302)

The commit https://github.com/bazelbuild/rules_rust/commit/841fc6fb82141576d91aecb1d3f2656d58b0ab71 for https://github.com/bazelbuild/rules_rust/pull/1284 broke the ability to use rust_register_toolchains with a nightly channel, see https://github.com/bazelbuild/rules_rust/commit/841fc6fb82141576d91aecb1d3f2656d58b0ab71#commitcomment-72310891.
I tracked the issue down to this line which was updated there. While using a dated nightly, these variables look like:
* tool_path:  `rust-nightly-x86_64-unknown-linux-gnu`
* tool_suburl:  `2022-04-06/rust-nightly-x86_64-unknown-linux-gnu`

Using tool_suburl causes the extract to fail like in the comment above:
`Prefix "2022-04-06/rust-nightly-x86_64-unknown-linux-gnu/rustc" was given, but not found in the archive. Here are possible prefixes for this archive: "rust-nightly-x86_64-unknown-linux-gnu".`

Switching back to the old behaviour fixes the glitch. I'm not sure if this breaks novel use cases introduced by https://github.com/bazelbuild/rules_rust/commit/841fc6fb82141576d91aecb1d3f2656d58b0ab71; @wt, could you please take a look.

On a sidenote, this is an instance where having some some build bot CI that uses nightly would have noticed this.
1 file changed
tree: 9cb074db93627bda8b25f397dec04949190fd29a
  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. .gitignore
  18. ARCHITECTURE.md
  19. AUTHORS
  20. BUILD.bazel
  21. CODEOWNERS
  22. COMPATIBILITY.md
  23. CONTRIBUTING.md
  24. CONTRIBUTORS
  25. LICENSE.txt
  26. README.md
  27. version.bzl
  28. WORKSPACE.bazel
  29. 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.