Skip to content

Commit 00ea895

Browse files
committed
feat(dist): refine suggestions regarding manifest checksum mismatches
1 parent cb92b60 commit 00ea895

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/dist/mod.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ use once_cell::sync::Lazy;
1010
use regex::Regex;
1111
use serde::{Deserialize, Serialize};
1212
use thiserror::Error as ThisError;
13-
use tracing::info;
13+
use tracing::{info, warn};
1414

1515
use crate::{
16-
config::Cfg, currentprocess::Process, errors::RustupError, toolchain::ToolchainName,
16+
config::{dist_root_server, Cfg},
17+
currentprocess::Process,
18+
errors::RustupError,
19+
toolchain::ToolchainName,
1720
utils::utils,
1821
};
1922

@@ -1166,9 +1169,20 @@ pub(crate) async fn dl_v2_manifest(
11661169
Ok(Some((manifest, manifest_hash)))
11671170
}
11681171
Err(any) => {
1169-
if let Some(RustupError::ChecksumFailed { .. }) = any.downcast_ref::<RustupError>() {
1170-
// Checksum failed - issue warning to try again later
1171-
info!("update not yet available, sorry! try again later")
1172+
if let Some(err @ RustupError::ChecksumFailed { .. }) =
1173+
any.downcast_ref::<RustupError>()
1174+
{
1175+
// Manifest checksum mismatched.
1176+
warn!("{err}");
1177+
1178+
let server = dist_root_server(download.process)?;
1179+
if server == DEFAULT_DIST_SERVER {
1180+
// https://github.com/rust-lang/rustup/issues/3390
1181+
info!("this is likely due to an ongoing update of the official release server, please try again later");
1182+
} else {
1183+
// https://github.com/rust-lang/rustup/issues/3885
1184+
info!("this might indicate an issue with the third-party release server `{server}`");
1185+
}
11721186
}
11731187
Err(any)
11741188
}

tests/suite/cli_v2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ async fn bad_sha_on_manifest() {
381381
cx.config
382382
.expect_err(
383383
&["rustup", "default", "nightly"],
384-
"update not yet available",
384+
"info: this might indicate an issue with the third-party release server",
385385
)
386386
.await;
387387
}

0 commit comments

Comments
 (0)