@@ -142,15 +142,17 @@ fn dump_matched_mir_node<'tcx, F>(
142
142
}
143
143
}
144
144
145
- /// Returns the file basename portion (without extension) of a filename path
146
- /// where we should dump a MIR representation output files.
147
- fn dump_file_basename < ' tcx > (
145
+ /// Returns the path to the filename where we should dump a given MIR.
146
+ /// Also used by other bits of code (e.g., NLL inference) that dump
147
+ /// graphviz data or other things.
148
+ fn dump_path < ' tcx > (
148
149
tcx : TyCtxt < ' tcx > ,
150
+ extension : & str ,
149
151
pass_num : bool ,
150
152
pass_name : & str ,
151
153
disambiguator : & dyn Display ,
152
154
body : & Body < ' tcx > ,
153
- ) -> String {
155
+ ) -> PathBuf {
154
156
let source = body. source ;
155
157
let promotion_id = match source. promoted {
156
158
Some ( id) => format ! ( "-{id:?}" ) ,
@@ -186,19 +188,12 @@ fn dump_file_basename<'tcx>(
186
188
_ => String :: new ( ) ,
187
189
} ;
188
190
189
- format ! (
190
- "{crate_name}.{item_name}{shim_disambiguator}{promotion_id}{pass_num}.{pass_name}.{disambiguator}" ,
191
- )
192
- }
193
-
194
- /// Returns the path to the filename where we should dump a given MIR.
195
- /// Also used by other bits of code (e.g., NLL inference) that dump
196
- /// graphviz data or other things.
197
- fn dump_path ( tcx : TyCtxt < ' _ > , basename : & str , extension : & str ) -> PathBuf {
198
191
let mut file_path = PathBuf :: new ( ) ;
199
192
file_path. push ( Path :: new ( & tcx. sess . opts . unstable_opts . dump_mir_dir ) ) ;
200
193
201
- let file_name = format ! ( "{basename}.{extension}" , ) ;
194
+ let file_name = format ! (
195
+ "{crate_name}.{item_name}{shim_disambiguator}{promotion_id}{pass_num}.{pass_name}.{disambiguator}.{extension}" ,
196
+ ) ;
202
197
203
198
file_path. push ( & file_name) ;
204
199
@@ -217,11 +212,7 @@ pub fn create_dump_file<'tcx>(
217
212
disambiguator : & dyn Display ,
218
213
body : & Body < ' tcx > ,
219
214
) -> io:: Result < io:: BufWriter < fs:: File > > {
220
- let file_path = dump_path (
221
- tcx,
222
- & dump_file_basename ( tcx, pass_num, pass_name, disambiguator, body) ,
223
- extension,
224
- ) ;
215
+ let file_path = dump_path ( tcx, extension, pass_num, pass_name, disambiguator, body) ;
225
216
if let Some ( parent) = file_path. parent ( ) {
226
217
fs:: create_dir_all ( parent) . map_err ( |e| {
227
218
io:: Error :: new (
0 commit comments