bazelbuild / bazelbuild/rules_rust
Running crates_vendor on a cargo workspace containing a crate named config fails
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
Trying to generate vendored inputs for a Rust project that uses a cargo workspace and contains a crate called "config" fails. Renaming the crate to something else, e.g. "config2" succeeds. This was found on linux running the 0.15.0 release.
To reproduce.
- Create a crate called config `cargo init config`
- Create a Cargo.toml workspace file listing the crate
```
[workspace]
members = [
"config",
]
```
- Create an empty Cargo.lock file
- Create a BUILD file
```
load("@rules_rust//crate_universe:defs.bzl", "crates_vendor")
crates_vendor(
name = "crates_vendor",
cargo_lockfile = ":Cargo.lock",
manifests = [
":Cargo.toml",
"//:config/Cargo.toml",
],
mode = "local",
tags = ["manual"],
vendor_path = "crates",
)
```
- Run the rule `bazel run //:crates_vendor -- --repin`
This fails with the following error
```
error: failed to load manifest for workspace member `/tmp/.tmpM0u454/config`
Caused by:
failed to read `/tmp/.tmpM0u454/config/Cargo.toml`
Caused by:
No such file or directory (os error 2)
Error: Failed to update lockfile: exit status: 101
```
Note: The "config" crate doesn't need to be directly referenced in the workspace for this problem to occur. Adding a second crate that does and having it depend on the "config" crate also fails. Additionally, building the crate directly, rather than as part of the workspace (e.g. by removing `":Cargo.toml"` from `manifests`) succeeds.
Contributor guide
Assessment
This issue has not been assessed yet.