Skip to content

Commit ae1d3ae

Browse files
authored
Use $RUSTC instead of rustc to get version if var is available (rust-lang#15250)
Fixes rust-lang/rust-clippy#15249 For the builtin rustc, it should return "dev" as the release channel. Clippy tests pass with this patch in both the Clippy standalone repository and from within the compiler repository. changelog: none
2 parents fc44198 + d5b10f0 commit ae1d3ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rustc_tools_util/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ pub fn get_commit_date() -> Option<String> {
157157

158158
#[must_use]
159159
pub fn get_compiler_version() -> Option<String> {
160-
get_output("rustc", &["-V"])
160+
let compiler = std::option_env!("RUSTC").unwrap_or("rustc");
161+
get_output(compiler, &["-V"])
161162
}
162163

163164
#[must_use]
@@ -172,6 +173,8 @@ pub fn get_channel(compiler_version: Option<String>) -> String {
172173
return String::from("beta");
173174
} else if rustc_output.contains("nightly") {
174175
return String::from("nightly");
176+
} else if rustc_output.contains("dev") {
177+
return String::from("dev");
175178
}
176179
}
177180

0 commit comments

Comments
 (0)