@@ -169,8 +169,8 @@ fn produce_final_output_artifacts(
169
169
if codegen_results. modules . len ( ) == 1 {
170
170
// 1) Only one codegen unit. In this case it's no difficulty
171
171
// 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 ) ;
174
174
let output = crate_output. path ( output_type) ;
175
175
if !output_type. is_text_output ( ) && output. is_tty ( ) {
176
176
sess. dcx ( )
@@ -183,22 +183,16 @@ fn produce_final_output_artifacts(
183
183
ensure_removed ( sess. dcx ( ) , & path) ;
184
184
}
185
185
} 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
-
194
186
if crate_output. outputs . contains_explicit_name ( & output_type) {
195
187
// 2) Multiple codegen units, with `--emit foo=some_name`. We have
196
188
// 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 ( ) } ) ;
198
191
} else if crate_output. single_output_file . is_some ( ) {
199
192
// 3) Multiple codegen units, with `-o some_name`. We have
200
193
// 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 ( ) } ) ;
202
196
} else {
203
197
// 4) Multiple codegen units, but no explicit name. We
204
198
// just leave the `foo.0.x` files in place.
@@ -409,7 +403,7 @@ fn emit_module(
409
403
object. set_section_data ( comment_section, producer, 1 ) ;
410
404
}
411
405
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) ;
413
407
let file = match File :: create ( & tmp_file) {
414
408
Ok ( file) => file,
415
409
Err ( err) => return Err ( format ! ( "error creating object file: {}" , err) ) ,
@@ -450,7 +444,7 @@ fn reuse_workproduct_for_cgu(
450
444
) -> Result < ModuleCodegenResult , String > {
451
445
let work_product = cgu. previous_work_product ( tcx) ;
452
446
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 ( ) ) ;
454
448
let source_file_regular = rustc_incremental:: in_incr_comp_dir_sess (
455
449
& tcx. sess ,
456
450
& 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
627
621
. to_string ( ) ;
628
622
629
623
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) ;
631
625
632
626
let symbol_name = rustc_middle:: middle:: exported_symbols:: metadata_symbol_name ( tcx) ;
633
627
let obj = create_compressed_metadata_file ( tcx. sess , metadata, & symbol_name) ;
0 commit comments