Skip to content

Commit 8bf3085

Browse files
Add -Z print-sysroot commandline option to rustc.
1 parent 1d81776 commit 8bf3085

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/librustc/session/config.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,14 @@ debugging_opts!(
211211
FLOWGRAPH_PRINT_LOANS,
212212
FLOWGRAPH_PRINT_MOVES,
213213
FLOWGRAPH_PRINT_ASSIGNS,
214-
FLOWGRAPH_PRINT_ALL
214+
FLOWGRAPH_PRINT_ALL,
215+
PRINT_SYSROOT
215216
]
216217
0
217218
)
218219

219220
pub fn debugging_opts_map() -> Vec<(&'static str, &'static str, u64)> {
220-
vec!(("verbose", "in general, enable more debug printouts", VERBOSE),
221+
vec![("verbose", "in general, enable more debug printouts", VERBOSE),
221222
("time-passes", "measure time of each rustc pass", TIME_PASSES),
222223
("count-llvm-insns", "count where LLVM \
223224
instrs originate", COUNT_LLVM_INSNS),
@@ -253,7 +254,9 @@ pub fn debugging_opts_map() -> Vec<(&'static str, &'static str, u64)> {
253254
("flowgraph-print-assigns", "Include assignment analysis data in \
254255
--pretty flowgraph output", FLOWGRAPH_PRINT_ASSIGNS),
255256
("flowgraph-print-all", "Include all dataflow analysis data in \
256-
--pretty flowgraph output", FLOWGRAPH_PRINT_ALL))
257+
--pretty flowgraph output", FLOWGRAPH_PRINT_ALL),
258+
("print-sysroot", "Print the sysroot as used by this rustc invocation",
259+
PRINT_SYSROOT)]
257260
}
258261

259262
#[deriving(Clone)]

src/librustc_trans/driver/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ fn run_compiler(args: &[String]) {
7575
describe_lints(&ls, false);
7676
return;
7777
}
78+
79+
let sess = build_session(sopts, None, descriptions);
80+
if sess.debugging_opt(config::PRINT_SYSROOT) {
81+
println!("{}", sess.sysroot().display());
82+
return;
83+
}
84+
7885
early_error("no input filename given");
7986
}
8087
1u => {

0 commit comments

Comments
 (0)