@@ -102,7 +102,7 @@ use std::path::{Path, PathBuf};
102
102
103
103
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
104
104
use rustc_data_structures:: sync;
105
- use rustc_hir:: def_id:: DefIdSet ;
105
+ use rustc_hir:: def_id:: { DefIdSet , LOCAL_CRATE } ;
106
106
use rustc_middle:: mir;
107
107
use rustc_middle:: mir:: mono:: MonoItem ;
108
108
use rustc_middle:: mir:: mono:: { CodegenUnit , Linkage } ;
@@ -417,7 +417,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Co
417
417
// Output monomorphization stats per def_id
418
418
if let SwitchWithOptPath :: Enabled ( ref path) = tcx. sess . opts . unstable_opts . dump_mono_stats {
419
419
if let Err ( err) =
420
- dump_mono_items_stats ( tcx, & codegen_units, path, tcx. sess . opts . crate_name . as_deref ( ) )
420
+ dump_mono_items_stats ( tcx, & codegen_units, path, tcx. crate_name ( LOCAL_CRATE ) )
421
421
{
422
422
tcx. sess . emit_fatal ( CouldntDumpMonoStats { error : err. to_string ( ) } ) ;
423
423
}
@@ -483,7 +483,7 @@ fn dump_mono_items_stats<'tcx>(
483
483
tcx : TyCtxt < ' tcx > ,
484
484
codegen_units : & [ CodegenUnit < ' tcx > ] ,
485
485
output_directory : & Option < PathBuf > ,
486
- crate_name : Option < & str > ,
486
+ crate_name : Symbol ,
487
487
) -> Result < ( ) , Box < dyn std:: error:: Error > > {
488
488
let output_directory = if let Some ( ref directory) = output_directory {
489
489
fs:: create_dir_all ( directory) ?;
@@ -494,7 +494,7 @@ fn dump_mono_items_stats<'tcx>(
494
494
495
495
let format = tcx. sess . opts . unstable_opts . dump_mono_stats_format ;
496
496
let ext = format. extension ( ) ;
497
- let filename = format ! ( "{}.mono_items.{ext}" , crate_name . unwrap_or ( "unknown-crate" ) ) ;
497
+ let filename = format ! ( "{crate_name }.mono_items.{ext}" ) ;
498
498
let output_path = output_directory. join ( & filename) ;
499
499
let file = File :: create ( & output_path) ?;
500
500
let mut file = BufWriter :: new ( file) ;
0 commit comments