about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-07-06 22:55:07 +0000
committerbors <bors@rust-lang.org>2015-07-06 22:55:07 +0000
commit6d71ce536439a9160100259c95c9c252a4061b86 (patch)
tree85cda1125a7b372e09b74313283886b0d141b85f /src
parent9d9e2678f504b4e9389d6a62d27ba4f5ee17a2f6 (diff)
parente66ac43ea4ca489486c5c5dc59974577449fad44 (diff)
downloadrust-6d71ce536439a9160100259c95c9c252a4061b86.tar.gz
rust-6d71ce536439a9160100259c95c9c252a4061b86.zip
Auto 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.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_driver/lib.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index a9787987611..36438ccc784 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -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);
+        }
     }
 }