]> git.lizzy.rs Git - rust.git/commitdiff
Add -Z print-sysroot commandline option to rustc.
authorMichael Woerister <michaelwoerister@posteo>
Thu, 13 Nov 2014 08:39:27 +0000 (09:39 +0100)
committerMichael Woerister <michaelwoerister@posteo>
Wed, 26 Nov 2014 14:58:17 +0000 (15:58 +0100)
src/librustc/session/config.rs
src/librustc_trans/driver/mod.rs

index 82cf8f28e3dfe8753c08dee1c92492c9c9aa07bd..8b4918b6db0f30c0d99168ca3e86fd3ccf3731a7 100644 (file)
@@ -212,13 +212,14 @@ macro_rules! 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)]
index af5983244dfdd55b7539195539983a3b0f071b73..658be9169afdd5fe0e84f0a1d5287bf05bc48e1d 100644 (file)
@@ -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 => {