@@ -142,15 +142,17 @@ fn dump_matched_mir_node<'tcx, F>(
142142 }
143143}
144144
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 > (
148149 tcx : TyCtxt < ' tcx > ,
150+ extension : & str ,
149151 pass_num : bool ,
150152 pass_name : & str ,
151153 disambiguator : & dyn Display ,
152154 body : & Body < ' tcx > ,
153- ) -> String {
155+ ) -> PathBuf {
154156 let source = body. source ;
155157 let promotion_id = match source. promoted {
156158 Some ( id) => format ! ( "-{id:?}" ) ,
@@ -186,19 +188,12 @@ fn dump_file_basename<'tcx>(
186188 _ => String :: new ( ) ,
187189 } ;
188190
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 {
198191 let mut file_path = PathBuf :: new ( ) ;
199192 file_path. push ( Path :: new ( & tcx. sess . opts . unstable_opts . dump_mir_dir ) ) ;
200193
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+ ) ;
202197
203198 file_path. push ( & file_name) ;
204199
@@ -217,11 +212,7 @@ pub fn create_dump_file<'tcx>(
217212 disambiguator : & dyn Display ,
218213 body : & Body < ' tcx > ,
219214) -> 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) ;
225216 if let Some ( parent) = file_path. parent ( ) {
226217 fs:: create_dir_all ( parent) . map_err ( |e| {
227218 io:: Error :: new (
0 commit comments