Skip to content

Commit 910b6ae

Browse files
committed
+toolchain --version shows correct rustc version
1 parent d708b11 commit 910b6ae

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/cli/rustup_mode.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ pub fn main() -> Result<utils::ExitCode> {
7777
fn rustc_version() -> std::result::Result<String, Box<dyn std::error::Error>> {
7878
let cfg = &mut common::set_globals(false, true)?;
7979
let cwd = std::env::current_dir()?;
80+
81+
if let Some(t) = process().args().find(|x| x.starts_with('+')) {
82+
debug!("Fetching rustc version from toolchain `{}`", t);
83+
cfg.set_toolchain_override(&t[1..]);
84+
}
85+
8086
let toolchain = cfg.find_or_install_override_toolchain_or_default(&cwd)?.0;
87+
8188
Ok(toolchain.rustc_version())
8289
}
8390

0 commit comments

Comments
 (0)