Skip to content
Closed
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
18 changes: 18 additions & 0 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,24 @@ pub async fn main(
)?;
cfg.toolchain_override = matches.plus_toolchain;

let is_install_cmd = match &subcmd {
RustupSubcmd::Install { .. } => true,
RustupSubcmd::Toolchain { subcmd } => {
matches!(subcmd, ToolchainSubcmd::Install { .. })
}
_ => false,
};

if !is_install_cmd && cfg.list_toolchains()?.is_empty() && cfg.find_default()?.is_none() {
use std::io::Write;
let mut stderr = cfg.process.stderr().lock();
writeln!(stderr, "info: no toolchains installed")?;
writeln!(
stderr,
"hint: run 'rustup toolchain install stable' to install the default toolchain"
)?;
}

match subcmd {
RustupSubcmd::DumpTestament => common::dump_testament(process),
RustupSubcmd::Install { opts } => update(cfg, opts, true).await,
Expand Down
Loading