From d0e576d639de735d13914fd3e9f226cd313d1b57 Mon Sep 17 00:00:00 2001 From: Yuvinscria Werdxz Date: Sat, 6 Jun 2026 20:35:08 -0700 Subject: [PATCH] fix: properly determine output plugin or rustc version --- crates/rustc_plugin/src/driver.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/rustc_plugin/src/driver.rs b/crates/rustc_plugin/src/driver.rs index acc07a901..a7634f431 100644 --- a/crates/rustc_plugin/src/driver.rs +++ b/crates/rustc_plugin/src/driver.rs @@ -108,12 +108,6 @@ pub fn driver_main(plugin: T) -> ExitCode { let (have_sys_root_arg, sys_root) = get_sysroot(&orig_args); - if orig_args.iter().any(|a| a == "--version" || a == "-V") { - let version_info = rustc_tools_util::get_version_info!(); - println!("{version_info}"); - exit(0); - } - // Setting RUSTC_WRAPPER causes Cargo to pass 'rustc' as the first argument. // We're invoking the compiler programmatically, so we ignore this let wrapper_mode = @@ -122,6 +116,10 @@ pub fn driver_main(plugin: T) -> ExitCode { if wrapper_mode { // we still want to be able to invoke it normally though orig_args.remove(1); + } else if orig_args.iter().any(|a| a == "--version" || a == "-V") { + let version_info = rustc_tools_util::get_version_info!(); + println!("{version_info}"); + exit(0); } // this conditional check for the --sysroot flag is there so users can call