From d5b10f0c7e8db174b53cf09d2d2fe4c822447f9d Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Fri, 11 Jul 2025 13:45:33 +0200 Subject: [PATCH] Use `$RUSTC` instead of `rustc` to get version if var is available --- rustc_tools_util/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rustc_tools_util/src/lib.rs b/rustc_tools_util/src/lib.rs index b45edf234558..194ed84d04c2 100644 --- a/rustc_tools_util/src/lib.rs +++ b/rustc_tools_util/src/lib.rs @@ -157,7 +157,8 @@ pub fn get_commit_date() -> Option { #[must_use] pub fn get_compiler_version() -> Option { - get_output("rustc", &["-V"]) + let compiler = std::option_env!("RUSTC").unwrap_or("rustc"); + get_output(compiler, &["-V"]) } #[must_use] @@ -172,6 +173,8 @@ pub fn get_channel(compiler_version: Option) -> String { return String::from("beta"); } else if rustc_output.contains("nightly") { return String::from("nightly"); + } else if rustc_output.contains("dev") { + return String::from("dev"); } }