Skip to content

rustfmt toolchain repository downloads a second rustc #4441

Open

Description

@TrapsterDK

rustfmt_toolchain_tools_repository downloads and unpacks the rustc component next to rustfmt (since #1769) because rustfmt loads librustc_driver relative to its own path. That is about 400 MB unpacked per execution platform.

When rustfmt_version is the release the Rust toolchains compile with (for example rust.toolchain(versions = ["1.99.1"], rustfmt_version = "1.99.1"), or WORKSPACE rust_register_toolchains with a single version, where rustfmt_version defaults to it), the same rustc is already in the shared <name>__<channel>__rustc repository added in #4397. Any build that runs rustfmt then holds two copies.

Proposal: pass that compiler repository to the rustfmt repository as rustc_anchor and link its lib/ beside rustfmt, the way the Clippy repository already does, instead of downloading rustc again. Only do this for the default channel's release, so a nightly rustfmt does not pull the nightly compiler repository (with its standard library and llvm-tools) into stable builds.

Related: #1768.

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