Dependencies with "+" no longer work. (No Such Target serde_yaml-0.9.34+deprecated, phonenumber-0.3.7+8.13.52)
Hello, I am running into the following error when updating to rules_rust version 0.58.0:
ERROR: <bazel tmp>/external/rules_rust~~crate~crate_index/BUILD.bazel: no such target '@@rules_rust~~crate~crate_index//:serde_yaml-0.9.34+deprecated': target 'serde_yaml-0.9.34+deprecated' not declared in package '' defined by <bazel tmp>/external/rules_rust~~crate~crate_index/BUILD.bazel (did you mean serde_yaml-0.9.34-deprecated?)
This seems to be related to this issue which was fixed in 0.58.0:
- https://github.com/bazelbuild/rules_rust/issues/3195
- https://github.com/bazelbuild/rules_rust/issues/3232
- https://github.com/bazelbuild/rules_rust/pull/3277
I checked the file (<bazel tmp>/external/rules_rust~~crate~crate_index/BUILD.bazel) and it contains these lines related to serde_yaml:
alias_fix(
name = "serde_yaml-0.8.26",
actual = "@crate_index__serde_yaml-0.8.26//:serde_yaml",
tags = ["manual"],
)
alias_fix(
name = "serde_yaml-0.9.34+deprecated",
actual = "@crate_index__serde_yaml-0.9.34-deprecated//:serde_yaml",
tags = ["manual"],
)
Please let me know if I can provide any additional information.
I have tested with 1.59.1 and the issue is still present.
It seems to impact all dependencies that have a + as well, like this one:
no such target '@@rules_rust~~crate~crate_index//:phonenumber-0.3.7+8.13.52': target 'phonenumber-0.3.7+8.13.52' not declared in package '' defined by <bazel tmp>/external/rules_rust~~crate~crate_index/BUILD.bazel (did you mean phonenumber-0.3.7-8.13.52?) and referenced by '<my project>'
<bazel tmp>/external/rules_rust~~crate~crate_index/BUILD.bazel contains this:
alias_fix(
name = "phonenumber-0.3.7+8.13.52",
actual = "@crate_index__phonenumber-0.3.7-8.13.52//:phonenumber",
tags = ["manual"],
)
alias_fix(
name = "phonenumber",
actual = "@crate_index__phonenumber-0.3.7-8.13.52//:phonenumber",
tags = ["manual"],
)
I will look at this today and see If ic an knock it out
Hi @ericmcbride I'm very sorry but I think my issue is invalid, or at least mostly invalid.
It turns out we had our own workaround for https://github.com/bazelbuild/rules_rust/issues/3195 by setting
default_alias_rule_bzl = "@@//:Cargo.alias.bzl",
default_alias_rule_name = "alias_fix",
Where alias_fix was changing the name
def alias_fix(name, actual, tags):
name = name.replace("+", "-")
native.alias(
name = name,
actual = actual,
tags = tags,
)
This was incompatible with the real fix you implemented.
Cool thanks i went ahead and added additional coverage
Thank you! Running into bugs in systems like this is especially tricky, so if you add more coverage then it becomes easier for me to immediately blame myself for the issues :)