Skip to content

Commit 96e6e3a

Browse files
authored
Merge pull request #20444 from rust-lang/veykril/push-snuuupqnrqzx
minor: Print fields of interned IDs in hir-ty instead of just the ID
2 parents a9450eb + 216a986 commit 96e6e3a

File tree

2 files changed

+37
-29
lines changed

2 files changed

+37
-29
lines changed

crates/hir-ty/src/db.rs

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
use std::sync;
55

6-
use base_db::{Crate, impl_intern_key};
6+
use base_db::Crate;
77
use hir_def::{
88
AdtId, BlockId, CallableDefId, ConstParamId, DefWithBodyId, EnumVariantId, FunctionId,
99
GeneralConstId, GenericDefId, ImplId, LifetimeParamId, LocalFieldId, StaticId, TraitId,
@@ -459,40 +459,44 @@ fn hir_database_is_dyn_compatible() {
459459
fn _assert_dyn_compatible(_: &dyn HirDatabase) {}
460460
}
461461

462-
#[salsa_macros::interned(no_lifetime, revisions = usize::MAX)]
462+
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
463463
#[derive(PartialOrd, Ord)]
464464
pub struct InternedTypeOrConstParamId {
465465
pub loc: TypeOrConstParamId,
466466
}
467-
impl ::std::fmt::Debug for InternedTypeOrConstParamId {
468-
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
469-
f.debug_tuple(stringify!(InternedTypeOrConstParamId))
470-
.field(&format_args!("{:04x}", self.0.index()))
471-
.finish()
472-
}
473-
}
474467

475-
#[salsa_macros::interned(no_lifetime, revisions = usize::MAX)]
468+
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
476469
#[derive(PartialOrd, Ord)]
477470
pub struct InternedLifetimeParamId {
478471
pub loc: LifetimeParamId,
479472
}
480-
impl ::std::fmt::Debug for InternedLifetimeParamId {
481-
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
482-
f.debug_tuple(stringify!(InternedLifetimeParamId))
483-
.field(&format_args!("{:04x}", self.0.index()))
484-
.finish()
485-
}
486-
}
487473

488-
impl_intern_key!(InternedConstParamId, ConstParamId);
474+
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
475+
#[derive(PartialOrd, Ord)]
476+
pub struct InternedConstParamId {
477+
pub loc: ConstParamId,
478+
}
489479

490-
impl_intern_key!(InternedOpaqueTyId, ImplTraitId);
480+
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
481+
#[derive(PartialOrd, Ord)]
482+
pub struct InternedOpaqueTyId {
483+
pub loc: ImplTraitId,
484+
}
491485

492486
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
493487
pub struct InternedClosure(pub DefWithBodyId, pub ExprId);
494-
impl_intern_key!(InternedClosureId, InternedClosure);
488+
489+
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
490+
#[derive(PartialOrd, Ord)]
491+
pub struct InternedClosureId {
492+
pub loc: InternedClosure,
493+
}
495494

496495
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
497496
pub struct InternedCoroutine(pub DefWithBodyId, pub ExprId);
498-
impl_intern_key!(InternedCoroutineId, InternedCoroutine);
497+
498+
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
499+
#[derive(PartialOrd, Ord)]
500+
pub struct InternedCoroutineId {
501+
pub loc: InternedCoroutine,
502+
}

xtask/src/metrics.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ type Unit = String;
1616
impl flags::Metrics {
1717
pub(crate) fn run(self, sh: &Shell) -> anyhow::Result<()> {
1818
let mut metrics = Metrics::new(sh)?;
19-
if !Path::new("./target/rustc-perf").exists() {
20-
sh.create_dir("./target/rustc-perf")?;
21-
cmd!(sh, "git clone https://github.com/rust-lang/rustc-perf.git ./target/rustc-perf")
22-
.run()?;
19+
if !Path::new("./target/metrics/rustc-perf").exists() {
20+
sh.create_dir("./target/metrics/rustc-perf")?;
21+
cmd!(
22+
sh,
23+
"git clone https://github.com/rust-lang/rustc-perf.git ./target/metrics/rustc-perf"
24+
)
25+
.run()?;
2326
}
2427
{
25-
let _d = sh.push_dir("./target/rustc-perf");
28+
let _d = sh.push_dir("./target/metrics/rustc-perf");
2629
let revision = &metrics.perf_revision;
2730
cmd!(sh, "git reset --hard {revision}").run()?;
2831
}
@@ -88,11 +91,12 @@ impl Metrics {
8891

8992
cmd!(
9093
sh,
91-
"git clone --depth=1 --branch 1.76.0 https://github.com/rust-lang/rust.git --single-branch"
94+
"git clone --depth=1 --branch 1.76.0 https://github.com/rust-lang/rust.git --single-branch ./target/metrics/rust"
9295
)
9396
.run()?;
9497

95-
let output = cmd!(sh, "./target/release/rust-analyzer rustc-tests ./rust").read()?;
98+
let output =
99+
cmd!(sh, "./target/release/rust-analyzer rustc-tests ./target/metrics/rust").read()?;
96100
for (metric, value, unit) in parse_metrics(&output) {
97101
self.report(metric, value, unit.into());
98102
}
@@ -106,7 +110,7 @@ impl Metrics {
106110
self.measure_analysis_stats_path(
107111
sh,
108112
bench,
109-
&format!("./target/rustc-perf/collector/compile-benchmarks/{bench}"),
113+
&format!("./target/metrics/rustc-perf/collector/compile-benchmarks/{bench}"),
110114
)
111115
}
112116
fn measure_analysis_stats_path(

0 commit comments

Comments
 (0)