Skip to content
6 changes: 6 additions & 0 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ enum RustupSubcmd {
#[arg(long)]
no_self_update: bool,

/// Allow downgrading the toolchain
#[arg(long)]
allow_downgrade: bool,

/// Force an update, even if some components are missing
#[arg(long)]
force: bool,
Expand Down Expand Up @@ -744,6 +748,7 @@ pub async fn main(
RustupSubcmd::Update {
toolchain,
no_self_update,
allow_downgrade,
force,
force_non_host,
} => {
Expand All @@ -752,6 +757,7 @@ pub async fn main(
UpdateOpts {
toolchain,
no_self_update,
allow_downgrade,
force,
force_non_host,
..UpdateOpts::default()
Expand Down
31 changes: 11 additions & 20 deletions src/dist/manifestation/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use url::Url;
use crate::{
Comment thread
rami3l marked this conversation as resolved.
config::Cfg,
dist::{
DEFAULT_DIST_SERVER, Profile, TargetTuple, ToolchainDesc,
DEFAULT_DIST_SERVER, DistOptions, Profile, TargetTuple, ToolchainDesc,
download::{DownloadCfg, DownloadTracker},
manifest::{Component, Manifest},
manifestation::{Changes, Manifestation, UpdateStatus},
Expand Down Expand Up @@ -1573,25 +1573,16 @@ async fn v2_manifest_checksum_mismatch_surfaces_error() {

let tp = TestProcess::new(env::current_dir().unwrap(), &["rustup"], vars, "");
let cfg = Cfg::from_env(tp.process.current_dir().unwrap(), false, true, &tp.process).unwrap();
let dl_cfg = DownloadCfg::new(&cfg);
let update_hash = cfg.get_hash_file(&cx.toolchain, true).unwrap();
let mut fetched = String::new();

let err = super::super::try_update_from_dist_(
&dl_cfg,
&update_hash,
&cx.toolchain,
Some(Profile::Default),
&cx.prefix,
false,
&[],
&[],
&mut fetched,
&cfg,
None,
)
.await
.unwrap_err();

let dist_opts =
DistOptions::new(&[], &[], &cx.toolchain, Profile::Default, false, &cfg).unwrap();
let manifest_result = dist_opts
.dl_v2_manifest(&cx.prefix, dist_opts.toolchain)
.await;
let err = dist_opts
.try_update(None, &cx.prefix, manifest_result)
.await
.unwrap_err();

match err.downcast_ref::<RustupError>() {
Some(RustupError::ChecksumFailed { .. }) => {}
Expand Down
Loading
Loading