Skip to content

fix: repair toolchains missing their installed manifest#4954

Open
ychampion wants to merge 2 commits into
rust-lang:mainfrom
ychampion:fix/missing-toolchain-manifest
Open

fix: repair toolchains missing their installed manifest#4954
ychampion wants to merge 2 commits into
rust-lang:mainfrom
ychampion:fix/missing-toolchain-manifest

Conversation

@ychampion

@ychampion ychampion commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • fetch the channel manifest when the installed v2 manifest is missing
  • repair damaged toolchains through both explicit install and all-channel update paths

Why

A matching update hash could skip the channel manifest download even after the installed manifest was deleted, leaving the toolchain broken while rustup reported it as unchanged.

Fixes #4825.

Validation

  • cargo test --features=test --test test_bonanza suite::cli_rustup:: - 130 passed
  • cargo test --features=test --lib v2_manifest_checksum_mismatch_surfaces_error - passed
  • cargo clippy --features=test --all-targets -- -D warnings - passed
  • cargo fmt --all -- --check - passed

Comment thread src/toolchain/distributable.rs Outdated
Comment thread src/dist/mod.rs Outdated
Comment thread src/dist/mod.rs Outdated
Give installation prefixes one version-neutral way to detect their on-disk manifest.

Constraint: V1 and V2 manifests share the same installed path.
Rejected: Keep call-site path checks | duplicates manifestation layout knowledge.
Confidence: high
Scope-risk: narrow
Directive: Use InstallPrefix::has_manifest for installed-manifest presence checks.
Tested: cargo test --features=test v2_manifest_checksum_mismatch_surfaces_error; cargo clippy --features=test --all-targets -- -D warnings; cargo fmt --all -- --check.
Bypass cached channel hashes when the installed manifest must be restored.

Constraint: Preserve no-change behavior for intact and legacy V1 toolchains.
Rejected: Thread a version-specific manifest boolean | the prefix can answer the version-neutral presence question directly.
Confidence: high
Scope-risk: narrow
Directive: Keep hash bypass limited to missing manifests or explicit component and target requests.
Tested: focused reinstall and update-all missing-manifest regressions; existing missing-manifest diagnostic; checksum unit test; strict all-target Clippy; rustfmt; diff checks.
@ychampion ychampion force-pushed the fix/missing-toolchain-manifest branch from 46a54f0 to 3a17c15 Compare July 12, 2026 18:52
Comment thread src/dist/manifestation.rs
let prefix = self.installation.prefix();
let old_manifest_path = prefix.manifest_file(DIST_MANIFEST);
if utils::path_exists(&old_manifest_path) {
if prefix.has_manifest() {

@rami3l rami3l Jul 12, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies 🙏

Judging from the access pattern here it seems that it'd be better to change .has_manifest() to .dist_manifest() which returns Option<PathBuf>. This way we will be able to use:

Suggested change
if prefix.has_manifest() {
if let Some(old_manifest_path) = prefix.dist_manifest() {

... and that it'd be clearer that the manifest path is actually not used in the sad path.

View changes since the review

Comment thread src/dist/mod.rs
if components.is_empty() && targets.is_empty() {
// Skip the update hash when the installed manifest is missing or when components
// or targets were requested, since either case still requires the channel manifest.
if prefix.has_manifest() && components.is_empty() && targets.is_empty() {

@rami3l rami3l Jul 12, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following https://github.com/rust-lang/rustup/pull/4954/changes#r3567067397, this should be changed to:

Suggested change
if prefix.has_manifest() && components.is_empty() && targets.is_empty() {
if prefix.dist_manifest().is_some() && components.is_empty() && targets.is_empty() {

View changes since the review

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.

rustup toolchain install <toolchain> reports unchanged for toolchains missing their manifest

2 participants