Skip to content

Commit f19e6d7

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

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
@@ -212,13 +212,14 @@ debugging_opts!(
212212
FLOWGRAPH_PRINT_LOANS,
213213
FLOWGRAPH_PRINT_MOVES,
214214
FLOWGRAPH_PRINT_ASSIGNS,
215-
FLOWGRAPH_PRINT_ALL
215+
FLOWGRAPH_PRINT_ALL,
216+
PRINT_SYSROOT
216217
]
217218
0
218219
)
219220

220221
pub fn debugging_opts_map() -> Vec<(&'static str, &'static str, u64)> {
221-
vec!(("verbose", "in general, enable more debug printouts", VERBOSE),
222+
vec![("verbose", "in general, enable more debug printouts", VERBOSE),
222223
("time-passes", "measure time of each rustc pass", TIME_PASSES),
223224
("count-llvm-insns", "count where LLVM \
224225
instrs originate", COUNT_LLVM_INSNS),
@@ -256,7 +257,9 @@ pub fn debugging_opts_map() -> Vec<(&'static str, &'static str, u64)> {
256257
("flowgraph-print-assigns", "Include assignment analysis data in \
257258
--pretty flowgraph output", FLOWGRAPH_PRINT_ASSIGNS),
258259
("flowgraph-print-all", "Include all dataflow analysis data in \
259-
--pretty flowgraph output", FLOWGRAPH_PRINT_ALL))
260+
--pretty flowgraph output", FLOWGRAPH_PRINT_ALL),
261+
("print-sysroot", "Print the sysroot as used by this rustc invocation",
262+
PRINT_SYSROOT)]
260263
}
261264

262265
#[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)