Skip to content

Commit c659713

Browse files
committedApr 4, 2025
Auto merge of rust-lang#139377 - matthiaskrgr:rollup-hxkmxzl, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - rust-lang#138546 (Add integer to string formatting tests) - rust-lang#138950 (replace extra_filename with strict version hash in metrics file names) - rust-lang#139028 (Make target maintainers more easily pingable) - rust-lang#139274 (Rustdoc: typecheck settings.js) - rust-lang#139328 (Fix 2024 edition doctest panic output) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5337252 + 6a70a42 commit c659713

File tree

99 files changed

+395
-222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+395
-222
lines changed
 

‎compiler/rustc_driver_impl/src/lib.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ use rustc_session::lint::{Lint, LintId};
6464
use rustc_session::output::{CRATE_TYPES, collect_crate_types, invalid_output_for_target};
6565
use rustc_session::{EarlyDiagCtxt, Session, config, filesearch};
6666
use rustc_span::FileName;
67+
use rustc_span::def_id::LOCAL_CRATE;
6768
use rustc_target::json::ToJson;
6869
use rustc_target::spec::{Target, TargetTuple};
6970
use time::OffsetDateTime;
@@ -392,14 +393,10 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
392393
}
393394

394395
fn dump_feature_usage_metrics(tcxt: TyCtxt<'_>, metrics_dir: &Path) {
395-
let output_filenames = tcxt.output_filenames(());
396-
let mut metrics_file_name = std::ffi::OsString::from("unstable_feature_usage_metrics-");
397-
let mut metrics_path = output_filenames.with_directory_and_extension(metrics_dir, "json");
398-
let metrics_file_stem =
399-
metrics_path.file_name().expect("there should be a valid default output filename");
400-
metrics_file_name.push(metrics_file_stem);
401-
metrics_path.pop();
402-
metrics_path.push(metrics_file_name);
396+
let hash = tcxt.crate_hash(LOCAL_CRATE);
397+
let crate_name = tcxt.crate_name(LOCAL_CRATE);
398+
let metrics_file_name = format!("unstable_feature_usage_metrics-{crate_name}-{hash}.json");
399+
let metrics_path = metrics_dir.join(metrics_file_name);
403400
if let Err(error) = tcxt.features().dump_feature_usage_metrics(metrics_path) {
404401
// FIXME(yaahc): once metrics can be enabled by default we will want "failure to emit
405402
// default metrics" to only produce a warning when metrics are enabled by default and emit

‎compiler/rustc_middle/src/ty/context.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1804,10 +1804,15 @@ impl<'tcx> TyCtxt<'tcx> {
18041804
// - needs_metadata: for putting into crate metadata.
18051805
// - instrument_coverage: for putting into coverage data (see
18061806
// `hash_mir_source`).
1807+
// - metrics_dir: metrics use the strict version hash in the filenames
1808+
// for dumped metrics files to prevent overwriting distinct metrics
1809+
// for similar source builds (may change in the future, this is part
1810+
// of the proof of concept impl for the metrics initiative project goal)
18071811
cfg!(debug_assertions)
18081812
|| self.sess.opts.incremental.is_some()
18091813
|| self.needs_metadata()
18101814
|| self.sess.instrument_coverage()
1815+
|| self.sess.opts.unstable_opts.metrics_dir.is_some()
18111816
}
18121817

18131818
#[inline]

0 commit comments

Comments
 (0)