about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-08-14 10:56:18 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-09-01 08:52:33 +1000
commit7ea882d4c475855fe3e453f709429cf2c8be295f (patch)
treeecac8e1b4572b9ffdc419c145619a14b90acec2a /compiler/rustc_middle
parentf73bcd50a433b7c17225ca98b44064236e7e84b3 (diff)
downloadrust-7ea882d4c475855fe3e453f709429cf2c8be295f.tar.gz
rust-7ea882d4c475855fe3e453f709429cf2c8be295f.zip
Inline and remove `dump_matched_mir_node`.
It has a single call site.
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/mir/pretty.rs36
1 files changed, 11 insertions, 25 deletions
diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs
index 128ae8549f7..94f9c58b5cf 100644
--- a/compiler/rustc_middle/src/mir/pretty.rs
+++ b/compiler/rustc_middle/src/mir/pretty.rs
@@ -125,7 +125,17 @@ pub fn dump_mir_with_options<'tcx, F>(
         return;
     }
 
-    dump_matched_mir_node(tcx, pass_num, pass_name, disambiguator, body, extra_data, options);
+    let _: io::Result<()> = try {
+        let mut file = create_dump_file(tcx, "mir", pass_num, pass_name, disambiguator, body)?;
+        dump_mir_to_writer(tcx, pass_name, disambiguator, body, &mut file, extra_data, options)?;
+    };
+
+    if tcx.sess.opts.unstable_opts.dump_mir_graphviz {
+        let _: io::Result<()> = try {
+            let mut file = create_dump_file(tcx, "dot", pass_num, pass_name, disambiguator, body)?;
+            write_mir_fn_graphviz(tcx, body, false, &mut file)?;
+        };
+    }
 }
 
 pub fn dump_enabled(tcx: TyCtxt<'_>, pass_name: &str, def_id: DefId) -> bool {
@@ -187,30 +197,6 @@ where
     extra_data(PassWhere::AfterCFG, w)
 }
 
-fn dump_matched_mir_node<'tcx, F>(
-    tcx: TyCtxt<'tcx>,
-    pass_num: bool,
-    pass_name: &str,
-    disambiguator: &dyn Display,
-    body: &Body<'tcx>,
-    extra_data: F,
-    options: PrettyPrintMirOptions,
-) where
-    F: FnMut(PassWhere, &mut dyn io::Write) -> io::Result<()>,
-{
-    let _: io::Result<()> = try {
-        let mut file = create_dump_file(tcx, "mir", pass_num, pass_name, disambiguator, body)?;
-        dump_mir_to_writer(tcx, pass_name, disambiguator, body, &mut file, extra_data, options)?;
-    };
-
-    if tcx.sess.opts.unstable_opts.dump_mir_graphviz {
-        let _: io::Result<()> = try {
-            let mut file = create_dump_file(tcx, "dot", pass_num, pass_name, disambiguator, body)?;
-            write_mir_fn_graphviz(tcx, body, false, &mut file)?;
-        };
-    }
-}
-
 /// Returns the path to the filename where we should dump a given MIR.
 /// Also used by other bits of code (e.g., NLL inference) that dump
 /// graphviz data or other things.