Skip to content

Commit 1434889

Browse files
committed
Auto merge of #1120 - crazymerlyn:checksum_fail_is_ok, r=Diggsey
Exit successfully on "update not yet available" Fixes #990.
2 parents 53a3ee1 + 1203d6e commit 1434889

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/rustup-dist/src/dist.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,9 @@ pub fn update_from_dist_<'a>(download: DownloadCfg<'a>,
667667
// Proceed to try v1 as a fallback
668668
(download.notify_handler)(Notification::DownloadingLegacyManifest);
669669
}
670+
Err(Error(ErrorKind::ChecksumFailed { .. }, _)) => {
671+
return Ok(None)
672+
}
670673
Err(e) => return Err(e),
671674
}
672675

src/rustup/toolchain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl<'a> Toolchain<'a> {
123123
(true, false) => UpdateStatus::Installed,
124124
(true, true) => UpdateStatus::Updated,
125125
(false, true) => UpdateStatus::Unchanged,
126-
(false, false) => unreachable!(),
126+
(false, false) => UpdateStatus::Unchanged,
127127
};
128128

129129
Ok(status)

tests/cli-v2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ fn bad_sha_on_manifest() {
198198
sha_bytes[..10].clone_from_slice(b"aaaaaaaaaa");
199199
let sha_str = String::from_utf8(sha_bytes).unwrap();
200200
rustup_utils::raw::write_file(&sha_file, &sha_str).unwrap();
201-
expect_err(config, &["rustup", "default", "nightly"],
202-
"checksum failed");
201+
expect_ok(config, &["rustup", "default", "nightly"]);
203202
});
204203
}
205204

0 commit comments

Comments
 (0)