Skip to content

Commit d5b10f0

Browse files
committed
Use $RUSTC instead of rustc to get version if var is available
1 parent e2270bb commit d5b10f0

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)