Merge pull request #20444 from rust-lang/veykril/push-snuuupqnrqzx
minor: Print fields of interned IDs in hir-ty instead of just the ID
This commit is contained in:
commit
0387ecb5d4
2 changed files with 37 additions and 29 deletions
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
use std::sync;
|
||||
|
||||
use base_db::{Crate, impl_intern_key};
|
||||
use base_db::Crate;
|
||||
use hir_def::{
|
||||
AdtId, BlockId, CallableDefId, ConstParamId, DefWithBodyId, EnumVariantId, FunctionId,
|
||||
GeneralConstId, GenericDefId, ImplId, LifetimeParamId, LocalFieldId, StaticId, TraitId,
|
||||
|
|
@ -459,40 +459,44 @@ fn hir_database_is_dyn_compatible() {
|
|||
fn _assert_dyn_compatible(_: &dyn HirDatabase) {}
|
||||
}
|
||||
|
||||
#[salsa_macros::interned(no_lifetime, revisions = usize::MAX)]
|
||||
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
|
||||
#[derive(PartialOrd, Ord)]
|
||||
pub struct InternedTypeOrConstParamId {
|
||||
pub loc: TypeOrConstParamId,
|
||||
}
|
||||
impl ::std::fmt::Debug for InternedTypeOrConstParamId {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
f.debug_tuple(stringify!(InternedTypeOrConstParamId))
|
||||
.field(&format_args!("{:04x}", self.0.index()))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[salsa_macros::interned(no_lifetime, revisions = usize::MAX)]
|
||||
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
|
||||
#[derive(PartialOrd, Ord)]
|
||||
pub struct InternedLifetimeParamId {
|
||||
pub loc: LifetimeParamId,
|
||||
}
|
||||
impl ::std::fmt::Debug for InternedLifetimeParamId {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
f.debug_tuple(stringify!(InternedLifetimeParamId))
|
||||
.field(&format_args!("{:04x}", self.0.index()))
|
||||
.finish()
|
||||
}
|
||||
|
||||
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
|
||||
#[derive(PartialOrd, Ord)]
|
||||
pub struct InternedConstParamId {
|
||||
pub loc: ConstParamId,
|
||||
}
|
||||
|
||||
impl_intern_key!(InternedConstParamId, ConstParamId);
|
||||
|
||||
impl_intern_key!(InternedOpaqueTyId, ImplTraitId);
|
||||
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
|
||||
#[derive(PartialOrd, Ord)]
|
||||
pub struct InternedOpaqueTyId {
|
||||
pub loc: ImplTraitId,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub struct InternedClosure(pub DefWithBodyId, pub ExprId);
|
||||
impl_intern_key!(InternedClosureId, InternedClosure);
|
||||
|
||||
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
|
||||
#[derive(PartialOrd, Ord)]
|
||||
pub struct InternedClosureId {
|
||||
pub loc: InternedClosure,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub struct InternedCoroutine(pub DefWithBodyId, pub ExprId);
|
||||
impl_intern_key!(InternedCoroutineId, InternedCoroutine);
|
||||
|
||||
#[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
|
||||
#[derive(PartialOrd, Ord)]
|
||||
pub struct InternedCoroutineId {
|
||||
pub loc: InternedCoroutine,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,13 +16,16 @@ type Unit = String;
|
|||
impl flags::Metrics {
|
||||
pub(crate) fn run(self, sh: &Shell) -> anyhow::Result<()> {
|
||||
let mut metrics = Metrics::new(sh)?;
|
||||
if !Path::new("./target/rustc-perf").exists() {
|
||||
sh.create_dir("./target/rustc-perf")?;
|
||||
cmd!(sh, "git clone https://github.com/rust-lang/rustc-perf.git ./target/rustc-perf")
|
||||
.run()?;
|
||||
if !Path::new("./target/metrics/rustc-perf").exists() {
|
||||
sh.create_dir("./target/metrics/rustc-perf")?;
|
||||
cmd!(
|
||||
sh,
|
||||
"git clone https://github.com/rust-lang/rustc-perf.git ./target/metrics/rustc-perf"
|
||||
)
|
||||
.run()?;
|
||||
}
|
||||
{
|
||||
let _d = sh.push_dir("./target/rustc-perf");
|
||||
let _d = sh.push_dir("./target/metrics/rustc-perf");
|
||||
let revision = &metrics.perf_revision;
|
||||
cmd!(sh, "git reset --hard {revision}").run()?;
|
||||
}
|
||||
|
|
@ -88,11 +91,12 @@ impl Metrics {
|
|||
|
||||
cmd!(
|
||||
sh,
|
||||
"git clone --depth=1 --branch 1.76.0 https://github.com/rust-lang/rust.git --single-branch"
|
||||
"git clone --depth=1 --branch 1.76.0 https://github.com/rust-lang/rust.git --single-branch ./target/metrics/rust"
|
||||
)
|
||||
.run()?;
|
||||
|
||||
let output = cmd!(sh, "./target/release/rust-analyzer rustc-tests ./rust").read()?;
|
||||
let output =
|
||||
cmd!(sh, "./target/release/rust-analyzer rustc-tests ./target/metrics/rust").read()?;
|
||||
for (metric, value, unit) in parse_metrics(&output) {
|
||||
self.report(metric, value, unit.into());
|
||||
}
|
||||
|
|
@ -106,7 +110,7 @@ impl Metrics {
|
|||
self.measure_analysis_stats_path(
|
||||
sh,
|
||||
bench,
|
||||
&format!("./target/rustc-perf/collector/compile-benchmarks/{bench}"),
|
||||
&format!("./target/metrics/rustc-perf/collector/compile-benchmarks/{bench}"),
|
||||
)
|
||||
}
|
||||
fn measure_analysis_stats_path(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue