We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
--version
1 parent 7f157dc commit d708b11Copy full SHA for d708b11
src/cli/rustup_mode.rs
@@ -75,12 +75,10 @@ pub fn main() -> Result<utils::ExitCode> {
75
info!("This is the version for the rustup toolchain manager, not the rustc compiler.");
76
77
fn rustc_version() -> std::result::Result<String, Box<dyn std::error::Error>> {
78
- let cmd = Command::new("rustc").arg("--version").output()?;
79
- if cmd.status.success() {
80
- Ok(String::from_utf8_lossy(&cmd.stdout).trim().into())
81
- } else {
82
- Err(String::from_utf8_lossy(&cmd.stderr).into())
83
- }
+ let cfg = &mut common::set_globals(false, true)?;
+ let cwd = std::env::current_dir()?;
+ let toolchain = cfg.find_or_install_override_toolchain_or_default(&cwd)?.0;
+ Ok(toolchain.rustc_version())
84
}
85
86
match rustc_version() {
0 commit comments