@@ -102,7 +102,7 @@ use std::path::{Path, PathBuf};
102102
103103use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
104104use rustc_data_structures:: sync;
105- use rustc_hir:: def_id:: DefIdSet ;
105+ use rustc_hir:: def_id:: { DefIdSet , LOCAL_CRATE } ;
106106use rustc_middle:: mir;
107107use rustc_middle:: mir:: mono:: MonoItem ;
108108use rustc_middle:: mir:: mono:: { CodegenUnit , Linkage } ;
@@ -417,7 +417,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Co
417417 // Output monomorphization stats per def_id
418418 if let SwitchWithOptPath :: Enabled ( ref path) = tcx. sess . opts . unstable_opts . dump_mono_stats {
419419 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 ) )
421421 {
422422 tcx. sess . emit_fatal ( CouldntDumpMonoStats { error : err. to_string ( ) } ) ;
423423 }
@@ -483,7 +483,7 @@ fn dump_mono_items_stats<'tcx>(
483483 tcx : TyCtxt < ' tcx > ,
484484 codegen_units : & [ CodegenUnit < ' tcx > ] ,
485485 output_directory : & Option < PathBuf > ,
486- crate_name : Option < & str > ,
486+ crate_name : Symbol ,
487487) -> Result < ( ) , Box < dyn std:: error:: Error > > {
488488 let output_directory = if let Some ( ref directory) = output_directory {
489489 fs:: create_dir_all ( directory) ?;
@@ -494,7 +494,7 @@ fn dump_mono_items_stats<'tcx>(
494494
495495 let format = tcx. sess . opts . unstable_opts . dump_mono_stats_format ;
496496 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}" ) ;
498498 let output_path = output_directory. join ( & filename) ;
499499 let file = File :: create ( & output_path) ?;
500500 let mut file = BufWriter :: new ( file) ;
0 commit comments