Rollup merge of #26599 - richo:richo-stage-info, r=brson
This will add information about the stage that a rustc was built with to the verbose version info
I have symlinks into $(HOST)/stage{0,1,2} into the rust version switcher thing I use, and occasionally need to know which stage a given rustc is.
This commit is contained in:
commit
b959f256bf
1 changed files with 14 additions and 0 deletions
|
|
@ -481,6 +481,17 @@ pub fn commit_date_str() -> Option<&'static str> {
|
|||
option_env!("CFG_VER_DATE")
|
||||
}
|
||||
|
||||
/// Returns a stage string, such as "stage0".
|
||||
pub fn stage_str() -> Option<&'static str> {
|
||||
if cfg!(stage0) {
|
||||
Some("stage0")
|
||||
} else if cfg!(stage1) {
|
||||
Some("stage1")
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Prints version information
|
||||
pub fn version(binary: &str, matches: &getopts::Matches) {
|
||||
let verbose = matches.opt_present("verbose");
|
||||
|
|
@ -493,6 +504,9 @@ pub fn version(binary: &str, matches: &getopts::Matches) {
|
|||
println!("commit-date: {}", unw(commit_date_str()));
|
||||
println!("host: {}", config::host_triple());
|
||||
println!("release: {}", unw(release_str()));
|
||||
if let Some(stage) = stage_str() {
|
||||
println!("stage: {}", stage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue