Skip to content

Commit a37d098

Browse files
authored
Rollup merge of rust-lang#47426 - varkor:default-mir-dump-dir, r=nikomatsakis
Add a default directory for -Zmir-dump-dir The current behaviour of dumping in the current directory is rarely desirable: a sensible default directory for dumping is much more convenient. This makes sets the default value for `-Zmir-dump-dir` to `mir_dump/`. r? @eddyb
2 parents 9d5dc17 + 394b95f commit a37d098

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

src/librustc/session/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
11721172
"emit noalias metadata for mutable references"),
11731173
dump_mir: Option<String> = (None, parse_opt_string, [UNTRACKED],
11741174
"dump MIR state at various points in translation"),
1175-
dump_mir_dir: Option<String> = (None, parse_opt_string, [UNTRACKED],
1175+
dump_mir_dir: String = (String::from("mir_dump"), parse_string, [UNTRACKED],
11761176
"the directory the MIR is dumped into"),
11771177
dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED],
11781178
"in addition to `.mir` files, create graphviz `.dot` files"),
@@ -2793,7 +2793,7 @@ mod tests {
27932793
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
27942794
opts.debugging_opts.dump_mir = Some(String::from("abc"));
27952795
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
2796-
opts.debugging_opts.dump_mir_dir = Some(String::from("abc"));
2796+
opts.debugging_opts.dump_mir_dir = String::from("abc");
27972797
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
27982798
opts.debugging_opts.dump_mir_graphviz = true;
27992799
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());

src/librustc_mir/util/liveness.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,7 @@ fn dump_matched_mir_node<'a, 'tcx>(
407407
result: &LivenessResult,
408408
) {
409409
let mut file_path = PathBuf::new();
410-
if let Some(ref file_dir) = tcx.sess.opts.debugging_opts.dump_mir_dir {
411-
let p = Path::new(file_dir);
412-
file_path.push(p);
413-
};
410+
file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir));
414411
let item_id = tcx.hir.as_local_node_id(source.def_id).unwrap();
415412
let file_name = format!("rustc.node{}{}-liveness.mir", item_id, pass_name);
416413
file_path.push(&file_name);

src/librustc_mir/util/pretty.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,7 @@ fn dump_path(
189189
};
190190

191191
let mut file_path = PathBuf::new();
192-
193-
if let Some(ref file_dir) = tcx.sess.opts.debugging_opts.dump_mir_dir {
194-
let p = Path::new(file_dir);
195-
file_path.push(p);
196-
};
192+
file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir));
197193

198194
let item_name = tcx.hir
199195
.def_path(source.def_id)

0 commit comments

Comments
 (0)