Skip to content

Commit 2b02df2

Browse files
committed
Auto merge of rust-lang#16380 - Veykril:sysroot-ci, r=Veykril
Run metadata on sysroot for CI metrics
2 parents f4fec4f + 21723cb commit 2b02df2

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

crates/rust-analyzer/src/cli/analysis_stats.rs

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ impl flags::AnalysisStats {
6363
true => None,
6464
false => Some(RustLibSource::Discover),
6565
};
66+
cargo_config.sysroot_query_metadata = self.query_sysroot_metadata;
6667
let no_progress = &|_| ();
6768

6869
let mut db_load_sw = self.stop_watch();

crates/rust-analyzer/src/cli/flags.rs

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ xflags::xflags! {
7171
optional --with-deps
7272
/// Don't load sysroot crates (`std`, `core` & friends).
7373
optional --no-sysroot
74+
/// Run cargo metadata on the sysroot to analyze its third-pary dependencies.
75+
/// Requires --no-sysroot to not be set.
76+
optional --query-sysroot-metadata
7477

7578
/// Don't run build scripts or load `OUT_DIR` values by running `cargo check` before analysis.
7679
optional --disable-build-scripts
@@ -206,6 +209,7 @@ pub struct AnalysisStats {
206209
pub only: Option<String>,
207210
pub with_deps: bool,
208211
pub no_sysroot: bool,
212+
pub query_sysroot_metadata: bool,
209213
pub disable_build_scripts: bool,
210214
pub disable_proc_macros: bool,
211215
pub skip_lowering: bool,

xtask/src/metrics.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ impl Metrics {
113113
) -> anyhow::Result<()> {
114114
assert!(Path::new(path).exists(), "unable to find bench in {path}");
115115
eprintln!("\nMeasuring analysis-stats/{name}");
116-
let output = cmd!(sh, "./target/release/rust-analyzer -q analysis-stats {path}").read()?;
116+
let output = cmd!(
117+
sh,
118+
"./target/release/rust-analyzer -q analysis-stats {path} --query-sysroot-metadata"
119+
)
120+
.read()?;
117121
for (metric, value, unit) in parse_metrics(&output) {
118122
self.report(&format!("analysis-stats/{name}/{metric}"), value, unit.into());
119123
}

0 commit comments

Comments
 (0)