bazelbuild / bazelbuild/rules_rust

rust_binary with crate_type = cdylib doesn't produce expected providers

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

Description

We have a rule like this:

```bzl
rust_binary(
name = ...,
edition = "2018",
crate_type = "cdylib",
out_binary = True,
...
)
```

which since https://github.com/bazelbuild/rules_rust/commit/5abeb93333db6ca1c44dbb55860987c408553a11 (in release 0.4.0) fails with:

```
ERROR: /Users/ksmiley/dev/envoy/test/extensions/common/wasm/test_data/BUILD:12:17: in rust_binary rule //test/extensions/common/wasm/test_data:_wasm_test_rust_wasm:
/private/var/tmp/_bazel_ksmiley/4096f01a2eae006dd7eb0d708a9f3935/external/rules_rust/rust/private/rust.bzl:295:5: rule advertised the 'CrateInfo' provider, but this provider was not among those returned
ERROR: /Users/ksmiley/dev/envoy/test/extensions/common/wasm/test_data/BUILD:12:17: Analysis of target '//test/extensions/common/wasm/test_data:_wasm_test_rust_wasm' failed
ERROR: Analysis of target '//test/extensions/common/wasm:wasm_vm_test' failed; build aborted:
```

It looks like the issue is that `rust_binary` still states that it will create `CrateInfo` yet it does not in this case. Our use case doesn't seem to care about this, so just removing that requirement is enough. This is reproducible on this branch https://github.com/envoyproxy/envoy/pull/21208 with `bazel build --nobuild //test/extensions/common/wasm:wasm_vm_test --define=wasm=wamr`.

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.