fix: repair toolchains missing their installed manifest#4954
Open
ychampion wants to merge 2 commits into
Open
Conversation
rami3l
requested changes
Jul 12, 2026
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.
46a54f0 to
3a17c15
Compare
rami3l
reviewed
Jul 12, 2026
| 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() { |
Member
There was a problem hiding this comment.
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.
| 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() { |
Member
There was a problem hiding this comment.
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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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 passedcargo test --features=test --lib v2_manifest_checksum_mismatch_surfaces_error- passedcargo clippy --features=test --all-targets -- -D warnings- passedcargo fmt --all -- --check- passed