Skip to content

Commit 4e61953

Browse files
committed
Inline and remove dump_matched_mir_node.
It has a single call site.
1 parent fd884a0 commit 4e61953

File tree

1 file changed

+22
-36
lines changed

1 file changed

+22
-36
lines changed

compiler/rustc_middle/src/mir/pretty.rs

+22-36
Original file line numberDiff line numberDiff line change
@@ -90,42 +90,6 @@ pub fn maybe_dump_mir<'tcx, F>(
9090
}
9191

9292
pub fn dump_mir<'tcx, F>(
93-
tcx: TyCtxt<'tcx>,
94-
pass_num: Option<&dyn Display>,
95-
pass_name: &str,
96-
disambiguator: &dyn Display,
97-
body: &Body<'tcx>,
98-
extra_data: F,
99-
) where
100-
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
101-
{
102-
// njn: inline this
103-
dump_matched_mir_node(tcx, pass_num, pass_name, disambiguator, body, extra_data);
104-
}
105-
106-
pub fn pass_name_matches_dump_filters<'tcx>(
107-
tcx: TyCtxt<'tcx>,
108-
filters: &str,
109-
pass_name: &str,
110-
def_id: DefId,
111-
) -> bool {
112-
// see notes on #41697 below
113-
let node_path = ty::print::with_forced_impl_filename_line!(tcx.def_path_str(def_id));
114-
filters.split('|').any(|or_filter| {
115-
or_filter.split('&').all(|and_filter| {
116-
let and_filter_trimmed = and_filter.trim();
117-
and_filter_trimmed == "all"
118-
|| pass_name.contains(and_filter_trimmed)
119-
|| node_path.contains(and_filter_trimmed)
120-
})
121-
})
122-
}
123-
124-
// #41697 -- we use `with_forced_impl_filename_line()` because
125-
// `def_path_str()` would otherwise trigger `type_of`, and this can
126-
// run while we are already attempting to evaluate `type_of`.
127-
128-
fn dump_matched_mir_node<'tcx, F>(
12993
tcx: TyCtxt<'tcx>,
13094
pass_num: Option<&dyn Display>,
13195
pass_name: &str,
@@ -135,6 +99,10 @@ fn dump_matched_mir_node<'tcx, F>(
13599
) where
136100
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
137101
{
102+
// #41697 -- we use `with_forced_impl_filename_line()` because
103+
// `def_path_str()` would otherwise trigger `type_of`, and this can
104+
// run while we are already attempting to evaluate `type_of`.
105+
138106
let _: io::Result<()> = try {
139107
let mut file =
140108
create_dump_file(tcx, "mir", pass_num, pass_name, disambiguator, body.source)?;
@@ -177,6 +145,24 @@ fn dump_matched_mir_node<'tcx, F>(
177145
}
178146
}
179147

148+
pub fn pass_name_matches_dump_filters<'tcx>(
149+
tcx: TyCtxt<'tcx>,
150+
filters: &str,
151+
pass_name: &str,
152+
def_id: DefId,
153+
) -> bool {
154+
// see notes on #41697 below
155+
let node_path = ty::print::with_forced_impl_filename_line!(tcx.def_path_str(def_id));
156+
filters.split('|').any(|or_filter| {
157+
or_filter.split('&').all(|and_filter| {
158+
let and_filter_trimmed = and_filter.trim();
159+
and_filter_trimmed == "all"
160+
|| pass_name.contains(and_filter_trimmed)
161+
|| node_path.contains(and_filter_trimmed)
162+
})
163+
})
164+
}
165+
180166
/// Returns the file basename portion (without extension) of a filename path
181167
/// where we should dump a MIR representation output files.
182168
fn dump_file_basename<'tcx>(

0 commit comments

Comments
 (0)