Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ struct UpdateOpts {
/// Install toolchains that require an emulator. See https://github.com/rust-lang/rustup/wiki/Non-host-toolchains
#[arg(long)]
force_non_host: bool,

/// Set the installed toolchain as the override for the current directory
#[arg(long)]
r#override: bool,
}

#[derive(Debug, Default, Args)]
Expand Down Expand Up @@ -946,6 +950,7 @@ async fn update(
let self_update_mode = SelfUpdateMode::from_cfg(cfg)?;
let should_self_update = !opts.no_self_update;
let force_non_host = opts.force_non_host;
let set_override = opts.r#override;
cfg.profile_override = opts.profile;

let cfg = &cfg;
Expand Down Expand Up @@ -1003,6 +1008,11 @@ async fn update(
PackageUpdate::Toolchain(desc.clone()),
Ok(status.clone()),
)?;

if set_override {
cfg.make_override(&cfg.current_dir, &desc.clone().into())?;
}

if cfg.get_default()?.is_none() && matches!(status, UpdateStatus::Installed) {
cfg.set_default(Some(&desc.into()))?;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.