bazelbuild / bazelbuild/rules_rust

rustfmt not working on 0.27.0

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

Description

When I run `bazel run @rules_rust//:rustfmt`, I'm greeted with the following error. Building rust targets, and even generating rust-project.json is all working fine so I think the issue is with rules_rust.

```
INFO: Invocation ID: 52d96c64-af30-4467-92a4-269c4b357569
ERROR: /home/adamsnaider/.cache/bazel/_bazel_adamsnaider/530c9f87a009472f6e6354126a0e8581/external/rules_rust/rust/toolchain/BUILD.bazel:40:26: While resolving toolchains for target @rules_rust//rust/toolchain:current_rustfmt_toolchain: No matching toolchains found for types @rules_rust//rust/rustfmt:toolchain_type.
To debug, rerun with --toolchain_resolution_debug='@rules_rust//rust/rustfmt:toolchain_type'
If platforms or toolchains are a new concept for you, we'd encourage reading https://bazel.build/concepts/platforms-intro.
ERROR: Analysis of target '@rules_rust//:rustfmt' failed; build aborted:
INFO: Elapsed time: 1.872s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
ERROR: Build failed. Not running target
```

This was working before upgrading to 0.27.0.

I'm currently getting around it by manually referring to the `@rust__x86_64-unknown-linux-gnu__stable_tools//:rustfmt` and wrapping it on a shell script that runs it on all rust files in the project.

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.