bazelbuild / bazelbuild/rules_rust

rust_proto example fails with missing crate reference

Open
#2,287 0 comments 0 reactions 0 assignees View on GitHub
bug needs-triage proto
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

Following https://bazelbuild.github.io/rules_rust/rust_proto.html#customizing-prost-and-tonic-dependencies which has a workspace like so:

```
load("//crate_universe:defs.bzl", "crate", "crates_repository")

crates_repository(
...
"prost": crate.spec(
version = "0",
),
"prost-types": crate.spec(
version = "0",
),
...
```

fails like so:

```
$ bazel build third-party/...
ERROR: C:/users/robertc/_bazel_robertc/wjtwge7c/external/crate_index/BUILD.bazel:58:6: no such package '@crate_index__protoc-gen-prost-0.2.3//': The repository '@crate_index__protoc-gen-prost-0.2.3' could not be resolved: Repository '@crate_index__protoc-gen-prost-0.2.3' is not defined and referenced by '@crate_index//:protoc-gen-prost__protoc-gen-prost'
ERROR: Analysis of target '//third-party/plugin-proto:compiler_plugin_rust_proto' failed; build aborted:
```

Until a call to `crate_repositories()` is added:
```

load(
"@//:defs.bzl",
cargo_aliases_crate_repositories = "crate_repositories",
)
cargo_aliases_crate_repositories ()
```

Further, that example `crates_repository` call uses removed parameters like `repository_name` - I suspect it is stale docs and needs a review by an expert.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.