Skip to content

Commit f8ef356

Browse files
committed
Print fields of interned IDs in hir-ty instead of just the ID
1 parent a9450eb commit f8ef356

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
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+
}

0 commit comments

Comments
 (0)