bazelbuild / bazelbuild/rules_rust

Support local cargo dependencies outside of a workspace

Open
#1,525 3 comments 3 reactions 0 assignees View on GitHub
crate-universe enhancement needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

If you have a dependency on a local crate that isn't in the same workspace, `cargo-bazel` seems to fail with:

```
error: failed to load manifest for dependency `foo`

Caused by:
failed to read `/foo/Cargo.toml`
```

My situation is almost identical to the [multi-package example](https://github.com/bazelbuild/rules_rust/tree/main/examples/crate_universe/multi_package), but where there is a dependency between the packages, for example `pkg_a` has the following dependency:

```
pkg_b = { path = "../sub_pkgs/pkg_b" }
```

I know I could arrange these into a cargo workspace, but I would prefer not to if possible.

Contributor guide

Open the contributing guide

Research direction

Start with the cargo-bazel handling described in the issue and compare it with the multi-package example. Reproduce the failure using pkg_a, pkg_b, and the path dependency in Cargo.toml. Done means a local crate outside the workspace can be resolved without the failed-to-read Cargo.toml error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.