@@ -13,13 +13,7 @@ use serde::{Deserialize, Serialize};
1313use thiserror:: Error as ThisError ;
1414use tracing:: { debug, info, warn} ;
1515
16- use crate :: {
17- config:: { Cfg , dist_root_server} ,
18- errors:: RustupError ,
19- process:: Process ,
20- toolchain:: ToolchainName ,
21- utils,
22- } ;
16+ use crate :: { config:: Cfg , errors:: RustupError , process:: Process , toolchain:: ToolchainName , utils} ;
2317
2418pub mod component;
2519pub ( crate ) mod config;
@@ -977,7 +971,7 @@ pub(crate) async fn update_from_dist(
977971 opts. components ,
978972 opts. targets ,
979973 & mut fetched,
980- & opts. cfg . dist_root_url ,
974+ opts. cfg ,
981975 )
982976 . await ;
983977
@@ -1074,15 +1068,14 @@ async fn try_update_from_dist_(
10741068 components : & [ & str ] ,
10751069 targets : & [ & str ] ,
10761070 fetched : & mut String ,
1077- dist_root : & str ,
1071+ cfg : & Cfg < ' _ > ,
10781072) -> Result < Option < String > > {
10791073 let toolchain_str = toolchain. to_string ( ) ;
10801074 let manifestation = Manifestation :: open ( prefix. clone ( ) , toolchain. target . clone ( ) ) ?;
10811075
10821076 // TODO: Add a notification about which manifest version is going to be used
10831077 info ! ( "syncing channel updates for {toolchain_str}" ) ;
10841078 match dl_v2_manifest (
1085- dist_root,
10861079 download,
10871080 // Even if manifest has not changed, we must continue to install requested components.
10881081 // So if components or targets is not empty, we skip passing `update_hash` so that
@@ -1093,6 +1086,7 @@ async fn try_update_from_dist_(
10931086 None
10941087 } ,
10951088 toolchain,
1089+ cfg,
10961090 )
10971091 . await
10981092 {
@@ -1190,7 +1184,7 @@ async fn try_update_from_dist_(
11901184 }
11911185
11921186 // If the v2 manifest is not found then try v1
1193- let manifest = match dl_v1_manifest ( dist_root , download, toolchain) . await {
1187+ let manifest = match dl_v1_manifest ( & cfg . dist_root_url , download, toolchain) . await {
11941188 Ok ( m) => m,
11951189 Err ( err) => match err. downcast_ref :: < RustupError > ( ) {
11961190 Some ( RustupError :: ChecksumFailed { .. } ) => return Err ( err) ,
@@ -1227,12 +1221,12 @@ async fn try_update_from_dist_(
12271221}
12281222
12291223pub ( crate ) async fn dl_v2_manifest (
1230- dist_root : & str ,
12311224 download : & DownloadCfg < ' _ > ,
12321225 update_hash : Option < & Path > ,
12331226 toolchain : & ToolchainDesc ,
1227+ cfg : & Cfg < ' _ > ,
12341228) -> Result < Option < ( ManifestV2 , String ) > > {
1235- let manifest_url = toolchain. manifest_v2_url ( dist_root , download. process ) ;
1229+ let manifest_url = toolchain. manifest_v2_url ( & cfg . dist_root_url , download. process ) ;
12361230 match download
12371231 . download_and_check ( & manifest_url, update_hash, None , ".toml" )
12381232 . await
@@ -1258,15 +1252,15 @@ pub(crate) async fn dl_v2_manifest(
12581252 // Manifest checksum mismatched.
12591253 warn ! ( "{err}" ) ;
12601254
1261- let server = dist_root_server ( download. process ) ?;
1262- if server == DEFAULT_DIST_SERVER {
1255+ if cfg. dist_root_url . starts_with ( DEFAULT_DIST_SERVER ) {
12631256 info ! (
12641257 "this is likely due to an ongoing update of the official release server, please try again later"
12651258 ) ;
12661259 info ! ( "see <https://github.com/rust-lang/rustup/issues/3390> for more details" ) ;
12671260 } else {
12681261 info ! (
1269- "this might indicate an issue with the third-party release server '{server}'"
1262+ "this might indicate an issue with the third-party release server '{}'" ,
1263+ cfg. dist_root_url
12701264 ) ;
12711265 info ! ( "see <https://github.com/rust-lang/rustup/issues/3885> for more details" ) ;
12721266 }
0 commit comments