Skip to content

Commit

Permalink
Auto merge of rust-lang#16560 - lnicola:sysroot-metadata, r=Veykril
Browse files Browse the repository at this point in the history
internal: Set channel override when querying the sysroot metadata

This is pretty hard to discover, and makes the setting useless, we should probably enable it for now.

CC rust-lang#16486
  • Loading branch information
bors committed Feb 14, 2024
2 parents 113f054 + c738655 commit efe68e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 9 additions & 1 deletion crates/project-model/src/sysroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,18 @@ impl Sysroot {
.ok()?;
let current_dir =
AbsPathBuf::try_from(&*format!("{sysroot_src_dir}/sysroot")).ok()?;

let mut cargo_config = CargoConfig::default();
// the sysroot uses `public-dependency`, so we make cargo think it's a nightly
cargo_config.extra_env.insert(
"__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS".to_owned(),
"nightly".to_owned(),
);

let res = CargoWorkspace::fetch_metadata(
&sysroot_cargo_toml,
&current_dir,
&CargoConfig::default(),
&cargo_config,
None,
&|_| (),
)
Expand Down
2 changes: 0 additions & 2 deletions xtask/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ impl Metrics {
sh,
"./target/release/rust-analyzer -q analysis-stats {path} --query-sysroot-metadata"
)
// the sysroot uses `public-dependency`, so we make cargo think it's a nightly
.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly")
.read()?;
for (metric, value, unit) in parse_metrics(&output) {
self.report(&format!("analysis-stats/{name}/{metric}"), value, unit.into());
Expand Down

0 comments on commit efe68e3

Please sign in to comment.