rules_rust
rules_rust copied to clipboard
Rust Analyzer does not work in bzlmod
There seems to be a couple of issues with the Rust Analyzer project generator.
- The workaround here: https://github.com/bazelbuild/rules_rust/blob/4136f6fedd033108294138a657b4ccd8ac57c8ef/tools/rust_analyzer/main.rs#L34 does not work with bzlmod and AFAIK is no longer needed for bzlmod. If I just set the name to
rules_rustit works and gets further into generating the project. - The generator uses the runfiles library and that library does not support bzlmod: https://github.com/bazelbuild/rules_rust/blob/4136f6fedd033108294138a657b4ccd8ac57c8ef/tools/rust_analyzer/lib.rs#L67
Updating the Runfiles library to support is a bit bigger task since but there is prior art in e.g. rules_go/python/java/dotnet
The runfiles library needs to be updated to read _repo_mapping from the runfiles base directory to map repo names to the canonical name on disk. It's a simple file format (1 item per line, each line with 3 comma separated values, with no ambiguity as the values cannot contain commas).
More details are available here: https://github.com/bazelbuild/proposals/blob/main/designs/2022-07-21-locating-runfiles-with-bzlmod.md.
After #2450, gen_rust_project works for me. Is there another issue here?
After #2450,
gen_rust_projectworks for me. Is there another issue here?
I believe #2440 is also necessary.
@UebelAndre @illicitonion shall we close this issue? The runfiles library has been fixed to work with bzlmod
@UebelAndre @illicitonion shall we close this issue? The runfiles library has been fixed to work with bzlmod
Seems resolved to me, thanks for the ping!