bazelbuild / bazelbuild/rules_rust

rust_test doesn't know about the aliases in the library target

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

Description

With a `rust_library` target that uses aliases, compiling its test target without aliases will fail:
```
rust_library(
name = "bar",
srcs = glob([
"src/**/*.rs",
]),
aliases = {
"//my_project/foo/id": "foo_id",
},
edition = "2021",
deps = [
"//third_party/cargo:chrono",
"//my_project/foo/id",
],
)

rust_test(
name = "bar_test",
crate = ":bar",
)
```
Took a bit time for me to figure out as I was doing `ibazel build //my_project/...` and thought the library target was failing.

Adding the same aliases to the test target work but feel unnecessary. I think the test target should be able to inherit / merge the aliases in the library target.

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.