From 555b021c6e531fc375c62160a176dcc4fe77b798 Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Fri, 26 Jun 2015 10:32:42 -0700 Subject: [PATCH] rustc_driver: Print stage info in --version --verbose --- src/librustc_driver/lib.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index a9787987611..9a9ac2706a6 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -481,6 +481,21 @@ 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 if cfg!(stage2) { + Some("stage2") + } else if cfg!(stage3) { + Some("stage3") + } else { + None + } +} + /// Prints version information pub fn version(binary: &str, matches: &getopts::Matches) { let verbose = matches.opt_present("verbose"); @@ -493,6 +508,7 @@ fn unw(x: Option<&str>) -> &str { x.unwrap_or("unknown") } println!("commit-date: {}", unw(commit_date_str())); println!("host: {}", config::host_triple()); println!("release: {}", unw(release_str())); + println!("stage: {}", unw(stage_str())); } }