File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
compiler/rustc_driver_impl/src Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -383,14 +383,11 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
383383}
384384
385385fn dump_feature_usage_metrics( tcxt: TyCtxt <' _>, metrics_dir: & Path ) {
386- let output_filenames = tcxt. output_filenames( ( ) ) ;
387- let mut metrics_file_name = std:: ffi:: OsString :: from( "unstable_feature_usage_metrics-" ) ;
388- let mut metrics_path = output_filenames. with_directory_and_extension( metrics_dir, "json" ) ;
389- let metrics_file_stem =
390- metrics_path. file_name( ) . expect( "there should be a valid default output filename" ) ;
391- metrics_file_name. push( metrics_file_stem) ;
392- metrics_path. pop( ) ;
393- metrics_path. push( metrics_file_name) ;
386+ let crate_id = rustc_span:: def_id:: LOCAL_CRATE ;
387+ let hash = tcxt. crate_hash( crate_id) ;
388+ let crate_name = tcxt. crate_name( crate_id) ;
389+ let metrics_file_name = format!( "unstable_feature_usage_metrics-{crate_name}-{hash}.json" ) ;
390+ let metrics_path = metrics_dir. join( metrics_file_name) ;
394391 if let Err ( error) = tcxt. features( ) . dump_feature_usage_metrics( metrics_path) {
395392 // FIXME(yaahc): once metrics can be enabled by default we will want "failure to emit
396393 // default metrics" to only produce a warning when metrics are enabled by default and emit
You can’t perform that action at this time.
0 commit comments