Skip to content

refactor(toolchain): clean up toolchain hierarchy, pt. 2 - #5131

Merged
rami3l merged 9 commits into
rust-lang:mainfrom
rami3l:refactor/toolchain-type-simp
Oct 9, 2026
Merged

rami3l merged 9 commits into
rust-lang:mainfrom
rami3l:refactor/toolchain-type-simp

Conversation

@rami3l

@rami3l rami3l commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Part of #5092.

The main changes in this patch are:

  • This patch has created a new trait ToolchainNameExt to accommodate the current Cfg::toolchain_path() and Toolchain::exists() functions. The rationale is:

    • These functions currently live in different impl blocks, however they are intended for different types of the toolchain name layer, which has been a source of confusion for me.
    • In addition, unfortunately, they currently only accept &ToolchainNameOrPath so values of other types would require a conversion to the former type first in order to to call these methods, which is not really necessary.
  • DistributableToolchain has been renamed to ChannelToolchain to mirror ChannelToolchainName as previously discussed here.

    • The redundant ChannelToolchain::desc field has been removed, making ChannelToolchain a transparent newtype over Toolchain. This is a more conservative version of the original plan1.
  • To mirror the above type name change, mod toolchain::distributable has been renamed to mod toolchain::channels.

Footnotes

  1. The original plan was to make the Toolchain type generic like so: struct Toolchain<'a, T: ToolchainNameExt = ToolchainNameOrPath>, so we can have type ChannelToolchain<'a> = Toolchain<'a, ChannelToolchainName>. Although this is completely feasible, after some experiments, I think this is making rustc quite unhappy because it is requiring explicit type annotations everywhere on Toolchain::new(), even when the original Toolchain::new() and the aliased ChannelToolchain::new() have completely incompatible output types. ↩

@rami3l rami3l changed the title style(docs): simplify log formatting refactor(toolchain): clean up toolchain hierarchy, pt. 2 Oct 6, 2026
@rustbot

This comment has been minimized.

@rami3l
rami3l force-pushed the refactor/toolchain-type-simp branch 4 times, most recently from b80321f to 03fb4ca Compare October 7, 2026 12:39
@rami3l
rami3l marked this pull request as ready for review October 7, 2026 13:12
@rami3l
rami3l requested a review from djc October 7, 2026 13:13
Comment thread src/toolchain.rs Outdated
Comment thread src/toolchain/names/ext.rs Outdated
Comment thread src/toolchain/names/ext.rs Outdated
Comment thread src/toolchain/channel.rs Outdated
Comment thread src/toolchain/channel.rs Outdated
@rami3l
rami3l force-pushed the refactor/toolchain-type-simp branch from 03fb4ca to 23d4739 Compare October 8, 2026 09:07
@rami3l
rami3l requested a review from djc October 8, 2026 09:13
@rustbot

This comment has been minimized.

@rami3l
rami3l force-pushed the refactor/toolchain-type-simp branch from 23d4739 to 76da643 Compare October 8, 2026 22:10
@rustbot

rustbot commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Comment thread src/toolchain/names.rs Outdated
Comment thread src/toolchain/names.rs Outdated
@rami3l
rami3l force-pushed the refactor/toolchain-type-simp branch from 76da643 to 9d1a7b2 Compare October 9, 2026 08:24
@rami3l
rami3l enabled auto-merge October 9, 2026 08:26
@rami3l
rami3l added this pull request to the merge queue Oct 9, 2026
Merged via the queue into rust-lang:main with commit ddb2113 Oct 9, 2026
29 checks passed
@rami3l
rami3l deleted the refactor/toolchain-type-simp branch October 9, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants