Skip to content

Commit 7ea882d

Browse files
committed
Inline and remove dump_matched_mir_node.
It has a single call site.
1 parent f73bcd5 commit 7ea882d

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

compiler/rustc_middle/src/mir/pretty.rs

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,17 @@ pub fn dump_mir_with_options<'tcx, F>(
125125
return;
126126
}
127127

128-
dump_matched_mir_node(tcx, pass_num, pass_name, disambiguator, body, extra_data, options);
128+
let _: io::Result<()> = try {
129+
let mut file = create_dump_file(tcx, "mir", pass_num, pass_name, disambiguator, body)?;
130+
dump_mir_to_writer(tcx, pass_name, disambiguator, body, &mut file, extra_data, options)?;
131+
};
132+
133+
if tcx.sess.opts.unstable_opts.dump_mir_graphviz {
134+
let _: io::Result<()> = try {
135+
let mut file = create_dump_file(tcx, "dot", pass_num, pass_name, disambiguator, body)?;
136+
write_mir_fn_graphviz(tcx, body, false, &mut file)?;
137+
};
138+
}
129139
}
130140

131141
pub fn dump_enabled(tcx: TyCtxt<'_>, pass_name: &str, def_id: DefId) -> bool {
@@ -187,30 +197,6 @@ where
187197
extra_data(PassWhere::AfterCFG, w)
188198
}
189199

190-
fn dump_matched_mir_node<'tcx, F>(
191-
tcx: TyCtxt<'tcx>,
192-
pass_num: bool,
193-
pass_name: &str,
194-
disambiguator: &dyn Display,
195-
body: &Body<'tcx>,
196-
extra_data: F,
197-
options: PrettyPrintMirOptions,
198-
) where
199-
F: FnMut(PassWhere, &mut dyn io::Write) -> io::Result<()>,
200-
{
201-
let _: io::Result<()> = try {
202-
let mut file = create_dump_file(tcx, "mir", pass_num, pass_name, disambiguator, body)?;
203-
dump_mir_to_writer(tcx, pass_name, disambiguator, body, &mut file, extra_data, options)?;
204-
};
205-
206-
if tcx.sess.opts.unstable_opts.dump_mir_graphviz {
207-
let _: io::Result<()> = try {
208-
let mut file = create_dump_file(tcx, "dot", pass_num, pass_name, disambiguator, body)?;
209-
write_mir_fn_graphviz(tcx, body, false, &mut file)?;
210-
};
211-
}
212-
}
213-
214200
/// Returns the path to the filename where we should dump a given MIR.
215201
/// Also used by other bits of code (e.g., NLL inference) that dump
216202
/// graphviz data or other things.

0 commit comments

Comments
 (0)