@@ -169,8 +169,8 @@ fn produce_final_output_artifacts(
169169 if codegen_results. modules . len ( ) == 1 {
170170 // 1) Only one codegen unit. In this case it's no difficulty
171171 // to copy `foo.0.x` to `foo.x`.
172- let module_name = Some ( & codegen_results . modules [ 0 ] . name [ .. ] ) ;
173- let path = crate_output. temp_path ( output_type, module_name ) ;
172+ let path =
173+ crate_output. temp_path_for_cgu ( output_type, & codegen_results . modules [ 0 ] . name ) ;
174174 let output = crate_output. path ( output_type) ;
175175 if !output_type. is_text_output ( ) && output. is_tty ( ) {
176176 sess. dcx ( )
@@ -183,22 +183,16 @@ fn produce_final_output_artifacts(
183183 ensure_removed ( sess. dcx ( ) , & path) ;
184184 }
185185 } else {
186- let extension = crate_output
187- . temp_path ( output_type, None )
188- . extension ( )
189- . unwrap ( )
190- . to_str ( )
191- . unwrap ( )
192- . to_owned ( ) ;
193-
194186 if crate_output. outputs . contains_explicit_name ( & output_type) {
195187 // 2) Multiple codegen units, with `--emit foo=some_name`. We have
196188 // no good solution for this case, so warn the user.
197- sess. dcx ( ) . emit_warn ( ssa_errors:: IgnoringEmitPath { extension } ) ;
189+ sess. dcx ( )
190+ . emit_warn ( ssa_errors:: IgnoringEmitPath { extension : output_type. extension ( ) } ) ;
198191 } else if crate_output. single_output_file . is_some ( ) {
199192 // 3) Multiple codegen units, with `-o some_name`. We have
200193 // no good solution for this case, so warn the user.
201- sess. dcx ( ) . emit_warn ( ssa_errors:: IgnoringOutput { extension } ) ;
194+ sess. dcx ( )
195+ . emit_warn ( ssa_errors:: IgnoringOutput { extension : output_type. extension ( ) } ) ;
202196 } else {
203197 // 4) Multiple codegen units, but no explicit name. We
204198 // just leave the `foo.0.x` files in place.
@@ -409,7 +403,7 @@ fn emit_module(
409403 object. set_section_data ( comment_section, producer, 1 ) ;
410404 }
411405
412- let tmp_file = output_filenames. temp_path ( OutputType :: Object , Some ( & name) ) ;
406+ let tmp_file = output_filenames. temp_path_for_cgu ( OutputType :: Object , & name) ;
413407 let file = match File :: create ( & tmp_file) {
414408 Ok ( file) => file,
415409 Err ( err) => return Err ( format ! ( "error creating object file: {}" , err) ) ,
@@ -450,7 +444,7 @@ fn reuse_workproduct_for_cgu(
450444) -> Result < ModuleCodegenResult , String > {
451445 let work_product = cgu. previous_work_product ( tcx) ;
452446 let obj_out_regular =
453- tcx. output_filenames ( ( ) ) . temp_path ( OutputType :: Object , Some ( cgu. name ( ) . as_str ( ) ) ) ;
447+ tcx. output_filenames ( ( ) ) . temp_path_for_cgu ( OutputType :: Object , cgu. name ( ) . as_str ( ) ) ;
454448 let source_file_regular = rustc_incremental:: in_incr_comp_dir_sess (
455449 & tcx. sess ,
456450 & work_product. saved_files . get ( "o" ) . expect ( "no saved object file in work product" ) ,
@@ -627,7 +621,7 @@ fn emit_metadata_module(tcx: TyCtxt<'_>, metadata: &EncodedMetadata) -> Compiled
627621 . to_string ( ) ;
628622
629623 let tmp_file =
630- tcx. output_filenames ( ( ) ) . temp_path ( OutputType :: Metadata , Some ( & metadata_cgu_name) ) ;
624+ tcx. output_filenames ( ( ) ) . temp_path_for_cgu ( OutputType :: Metadata , & metadata_cgu_name) ;
631625
632626 let symbol_name = rustc_middle:: middle:: exported_symbols:: metadata_symbol_name ( tcx) ;
633627 let obj = create_compressed_metadata_file ( tcx. sess , metadata, & symbol_name) ;
0 commit comments