Skip to content

prost: rust_prost_aspect requires a rustfmt toolchain #4440

Open

Description

@TrapsterDK

rust_prost_aspect lists @rules_rust//rust/rustfmt:toolchain_type as a mandatory toolchain, so rust_prost_library fails analysis on any execution platform without a registered rustfmt_toolchain:

ERROR: No matching toolchains found for types:
  @@rules_rust+//rust/rustfmt:toolchain_type

The formatting is cosmetic: _compile_proto already skips --rustfmt when the toolchain is None, and protoc_wrapper treats it as optional. A mandatory toolchain also means prost codegen always fetches a rustfmt repository, which today unpacks a full rustc as well (roughly 400 MB).

Repro: a module with rust.toolchain(rustfmt_toolchain_triples = {"s390x-unknown-linux-gnu": "..."}) on an x86_64 host and any rust_prost_library.

Proposal: declare the toolchain with config_common.toolchain_type(..., mandatory = False) and leave the generated code unformatted when none resolves, as rustfmt_toolchain_alias already allows.

Assisted by Claude.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageThe ticket needs maintainer attention.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions