Skip to content

Commit

Permalink
Auto merge of #26599 - richo:richo-stage-info, r=brson
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Jul 6, 2015
2 parents 9d9e267 + e66ac43 commit 6d71ce5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);
}
}
}

Expand Down

0 comments on commit 6d71ce5

Please sign in to comment.