about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2014-11-13 09:39:27 +0100
committerMichael Woerister <michaelwoerister@posteo>2014-11-26 15:58:17 +0100
commitf19e6d71cd53bf67c6c03dc5f96c17225276c3c6 (patch)
tree3c53b41612a03b4e09aa4534273192ab4a5f235f
parent8fb027e398ef756b7b02a270ef0304be92e70f4d (diff)
Add -Z print-sysroot commandline option to rustc.
-rw-r--r--src/librustc/session/config.rs9
-rw-r--r--src/librustc_trans/driver/mod.rs7
2 files changed, 13 insertions, 3 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 82cf8f28e3d..8b4918b6db0 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -212,13 +212,14 @@ debugging_opts!(
         FLOWGRAPH_PRINT_LOANS,
         FLOWGRAPH_PRINT_MOVES,
         FLOWGRAPH_PRINT_ASSIGNS,
-        FLOWGRAPH_PRINT_ALL
+        FLOWGRAPH_PRINT_ALL,
+        PRINT_SYSROOT
     ]
     0
 )
 
 pub fn debugging_opts_map() -> Vec<(&'static str, &'static str, u64)> {
-    vec!(("verbose", "in general, enable more debug printouts", VERBOSE),
+    vec![("verbose", "in general, enable more debug printouts", VERBOSE),
      ("time-passes", "measure time of each rustc pass", TIME_PASSES),
      ("count-llvm-insns", "count where LLVM \
                            instrs originate", COUNT_LLVM_INSNS),
@@ -256,7 +257,9 @@ pub fn debugging_opts_map() -> Vec<(&'static str, &'static str, u64)> {
      ("flowgraph-print-assigns", "Include assignment analysis data in \
                        --pretty flowgraph output", FLOWGRAPH_PRINT_ASSIGNS),
      ("flowgraph-print-all", "Include all dataflow analysis data in \
-                       --pretty flowgraph output", FLOWGRAPH_PRINT_ALL))
+                       --pretty flowgraph output", FLOWGRAPH_PRINT_ALL),
+     ("print-sysroot", "Print the sysroot as used by this rustc invocation",
+      PRINT_SYSROOT)]
 }
 
 #[deriving(Clone)]
diff --git a/src/librustc_trans/driver/mod.rs b/src/librustc_trans/driver/mod.rs
index af5983244df..658be9169af 100644
--- a/src/librustc_trans/driver/mod.rs
+++ b/src/librustc_trans/driver/mod.rs
@@ -75,6 +75,13 @@ fn run_compiler(args: &[String]) {
                 describe_lints(&ls, false);
                 return;
             }
+
+            let sess = build_session(sopts, None, descriptions);
+            if sess.debugging_opt(config::PRINT_SYSROOT) {
+                println!("{}", sess.sysroot().display());
+                return;
+            }
+
             early_error("no input filename given");
         }
         1u => {