Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/next_solver/def_id.rs')
| -rw-r--r-- | crates/hir-ty/src/next_solver/def_id.rs | 386 |
1 files changed, 304 insertions, 82 deletions
diff --git a/crates/hir-ty/src/next_solver/def_id.rs b/crates/hir-ty/src/next_solver/def_id.rs index ce66dbc77c..09b999ae5f 100644 --- a/crates/hir-ty/src/next_solver/def_id.rs +++ b/crates/hir-ty/src/next_solver/def_id.rs @@ -10,6 +10,7 @@ use hir_def::{ }, }; use rustc_type_ir::inherent; +use salsa::Update; use stdx::impl_from; use crate::{ @@ -28,26 +29,26 @@ pub enum Ctor { Enum(EnumVariantId), } -#[derive(PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash)] -pub enum SolverDefId { +#[derive(PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, Update)] +pub enum SolverDefId<'db> { AdtId(AdtId), ConstId(ConstId), FunctionId(FunctionId), ImplId(ImplId), BuiltinDeriveImplId(BuiltinDeriveImplId), StaticId(StaticId), - AnonConstId(AnonConstId), + AnonConstId(AnonConstId<'db>), TraitId(TraitId), TypeAliasId(TypeAliasId), - InternedClosureId(InternedClosureId), - InternedCoroutineId(InternedCoroutineId), - InternedCoroutineClosureId(InternedCoroutineClosureId), + InternedClosureId(InternedClosureId<'db>), + InternedCoroutineId(InternedCoroutineId<'db>), + InternedCoroutineClosureId(InternedCoroutineClosureId<'db>), InternedOpaqueTyId(InternedOpaqueTyId), EnumVariantId(EnumVariantId), Ctor(Ctor), } -impl std::fmt::Debug for SolverDefId { +impl std::fmt::Debug for SolverDefId<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let interner = DbInterner::conjure(); let db = interner.db; @@ -121,26 +122,98 @@ impl std::fmt::Debug for SolverDefId { } } -impl_from!( - AdtId(StructId, EnumId, UnionId), - ConstId, - FunctionId, - ImplId, - BuiltinDeriveImplId, - StaticId, - AnonConstId, - TraitId, - TypeAliasId, - InternedClosureId, - InternedCoroutineId, - InternedCoroutineClosureId, - InternedOpaqueTyId, - EnumVariantId, - Ctor - for SolverDefId -); - -impl From<GenericDefId> for SolverDefId { +impl<'db> From<AdtId> for SolverDefId<'db> { + fn from(it: AdtId) -> SolverDefId<'db> { + SolverDefId::AdtId(it) + } +} +impl<'db> From<StructId> for SolverDefId<'db> { + fn from(it: StructId) -> SolverDefId<'db> { + SolverDefId::AdtId(AdtId::StructId(it)) + } +} +impl<'db> From<EnumId> for SolverDefId<'db> { + fn from(it: EnumId) -> SolverDefId<'db> { + SolverDefId::AdtId(AdtId::EnumId(it)) + } +} +impl<'db> From<UnionId> for SolverDefId<'db> { + fn from(it: UnionId) -> SolverDefId<'db> { + SolverDefId::AdtId(AdtId::UnionId(it)) + } +} +impl<'db> From<ConstId> for SolverDefId<'db> { + fn from(it: ConstId) -> SolverDefId<'db> { + SolverDefId::ConstId(it) + } +} +impl<'db> From<FunctionId> for SolverDefId<'db> { + fn from(it: FunctionId) -> SolverDefId<'db> { + SolverDefId::FunctionId(it) + } +} +impl<'db> From<ImplId> for SolverDefId<'db> { + fn from(it: ImplId) -> SolverDefId<'db> { + SolverDefId::ImplId(it) + } +} +impl<'db> From<BuiltinDeriveImplId> for SolverDefId<'db> { + fn from(it: BuiltinDeriveImplId) -> SolverDefId<'db> { + SolverDefId::BuiltinDeriveImplId(it) + } +} +impl<'db> From<StaticId> for SolverDefId<'db> { + fn from(it: StaticId) -> SolverDefId<'db> { + SolverDefId::StaticId(it) + } +} +impl<'db> From<AnonConstId<'db>> for SolverDefId<'db> { + fn from(it: AnonConstId<'db>) -> SolverDefId<'db> { + SolverDefId::AnonConstId(it) + } +} +impl<'db> From<TraitId> for SolverDefId<'db> { + fn from(it: TraitId) -> SolverDefId<'db> { + SolverDefId::TraitId(it) + } +} +impl<'db> From<TypeAliasId> for SolverDefId<'db> { + fn from(it: TypeAliasId) -> SolverDefId<'db> { + SolverDefId::TypeAliasId(it) + } +} +impl<'db> From<InternedClosureId<'db>> for SolverDefId<'db> { + fn from(it: InternedClosureId<'db>) -> SolverDefId<'db> { + SolverDefId::InternedClosureId(it) + } +} +impl<'db> From<InternedCoroutineId<'db>> for SolverDefId<'db> { + fn from(it: InternedCoroutineId<'db>) -> SolverDefId<'db> { + SolverDefId::InternedCoroutineId(it) + } +} +impl<'db> From<InternedCoroutineClosureId<'db>> for SolverDefId<'db> { + fn from(it: InternedCoroutineClosureId<'db>) -> SolverDefId<'db> { + SolverDefId::InternedCoroutineClosureId(it) + } +} +impl<'db> From<InternedOpaqueTyId> for SolverDefId<'db> { + fn from(it: InternedOpaqueTyId) -> SolverDefId<'db> { + SolverDefId::InternedOpaqueTyId(it) + } +} +impl<'db> From<EnumVariantId> for SolverDefId<'db> { + fn from(it: EnumVariantId) -> SolverDefId<'db> { + SolverDefId::EnumVariantId(it) + } +} +impl<'db> From<Ctor> for SolverDefId<'db> { + fn from(it: Ctor) -> SolverDefId<'db> { + SolverDefId::Ctor(it) + } +} + +impl<'db> From<GenericDefId> for SolverDefId<'db> { fn from(value: GenericDefId) -> Self { match value { GenericDefId::AdtId(adt_id) => SolverDefId::AdtId(adt_id), @@ -154,9 +227,9 @@ impl From<GenericDefId> for SolverDefId { } } -impl From<GeneralConstId> for SolverDefId { +impl<'db> From<GeneralConstId<'db>> for SolverDefId<'db> { #[inline] - fn from(value: GeneralConstId) -> Self { + fn from(value: GeneralConstId<'db>) -> Self { match value { GeneralConstId::ConstId(const_id) => SolverDefId::ConstId(const_id), GeneralConstId::StaticId(static_id) => SolverDefId::StaticId(static_id), @@ -165,7 +238,7 @@ impl From<GeneralConstId> for SolverDefId { } } -impl From<CallableDefId> for SolverDefId { +impl<'db> From<CallableDefId> for SolverDefId<'db> { #[inline] fn from(value: CallableDefId) -> Self { match value { @@ -176,7 +249,7 @@ impl From<CallableDefId> for SolverDefId { } } -impl From<DefWithBodyId> for SolverDefId { +impl<'db> From<DefWithBodyId> for SolverDefId<'db> { #[inline] fn from(value: DefWithBodyId) -> Self { match value { @@ -188,9 +261,9 @@ impl From<DefWithBodyId> for SolverDefId { } } -impl From<InferBodyId> for SolverDefId { +impl<'db> From<InferBodyId<'db>> for SolverDefId<'db> { #[inline] - fn from(value: InferBodyId) -> Self { + fn from(value: InferBodyId<'db>) -> Self { match value { InferBodyId::DefWithBodyId(id) => id.into(), InferBodyId::AnonConstId(id) => id.into(), @@ -198,7 +271,7 @@ impl From<InferBodyId> for SolverDefId { } } -impl From<VariantId> for SolverDefId { +impl<'db> From<VariantId> for SolverDefId<'db> { #[inline] fn from(value: VariantId) -> Self { match value { @@ -209,7 +282,7 @@ impl From<VariantId> for SolverDefId { } } -impl From<ExpressionStoreOwnerId> for SolverDefId { +impl<'db> From<ExpressionStoreOwnerId> for SolverDefId<'db> { #[inline] fn from(value: ExpressionStoreOwnerId) -> Self { match value { @@ -220,10 +293,10 @@ impl From<ExpressionStoreOwnerId> for SolverDefId { } } -impl TryFrom<SolverDefId> for AttrDefId { +impl TryFrom<SolverDefId<'_>> for AttrDefId { type Error = (); #[inline] - fn try_from(value: SolverDefId) -> Result<Self, Self::Error> { + fn try_from(value: SolverDefId<'_>) -> Result<Self, Self::Error> { match value { SolverDefId::AdtId(it) => Ok(it.into()), SolverDefId::ConstId(it) => Ok(it.into()), @@ -245,11 +318,11 @@ impl TryFrom<SolverDefId> for AttrDefId { } } -impl TryFrom<SolverDefId> for DefWithBodyId { +impl TryFrom<SolverDefId<'_>> for DefWithBodyId { type Error = (); #[inline] - fn try_from(value: SolverDefId) -> Result<Self, Self::Error> { + fn try_from(value: SolverDefId<'_>) -> Result<Self, Self::Error> { let id = match value { SolverDefId::ConstId(id) => id.into(), SolverDefId::FunctionId(id) => id.into(), @@ -271,11 +344,11 @@ impl TryFrom<SolverDefId> for DefWithBodyId { } } -impl TryFrom<SolverDefId> for InferBodyId { +impl<'db> TryFrom<SolverDefId<'db>> for InferBodyId<'db> { type Error = (); #[inline] - fn try_from(value: SolverDefId) -> Result<Self, Self::Error> { + fn try_from(value: SolverDefId<'db>) -> Result<Self, Self::Error> { let id = match value { SolverDefId::ConstId(id) => id.into(), SolverDefId::FunctionId(id) => id.into(), @@ -297,10 +370,10 @@ impl TryFrom<SolverDefId> for InferBodyId { } } -impl TryFrom<SolverDefId> for GenericDefId { +impl TryFrom<SolverDefId<'_>> for GenericDefId { type Error = (); - fn try_from(value: SolverDefId) -> Result<Self, Self::Error> { + fn try_from(value: SolverDefId<'_>) -> Result<Self, Self::Error> { Ok(match value { SolverDefId::AdtId(adt_id) => GenericDefId::AdtId(adt_id), SolverDefId::ConstId(const_id) => GenericDefId::ConstId(const_id), @@ -321,8 +394,8 @@ impl TryFrom<SolverDefId> for GenericDefId { } } -impl<'db> inherent::DefId<DbInterner<'db>> for SolverDefId { - fn as_local(self) -> Option<SolverDefId> { +impl<'db> inherent::DefId<DbInterner<'db>> for SolverDefId<'db> { + fn as_local(self) -> Option<SolverDefId<'db>> { Some(self) } fn is_local(self) -> bool { @@ -332,17 +405,17 @@ impl<'db> inherent::DefId<DbInterner<'db>> for SolverDefId { macro_rules! declare_id_wrapper { ($name:ident, $wraps:ident) => { - declare_id_wrapper!($name, $wraps, SolverDefId); + declare_id_wrapper!($name, $wraps, SolverDefId<'db>); }; - ($name:ident, $wraps:ident, $local:ident) => { + ($name:ident, $wraps:ident, $local:ty) => { declare_id_wrapper!($name, $wraps, $local, no_try_from); - impl TryFrom<SolverDefId> for $name { + impl TryFrom<SolverDefId<'_>> for $name { type Error = (); #[inline] - fn try_from(value: SolverDefId) -> Result<Self, Self::Error> { + fn try_from(value: SolverDefId<'_>) -> Result<Self, Self::Error> { match value { SolverDefId::$wraps(it) => Ok(Self(it)), _ => Err(()), @@ -351,7 +424,7 @@ macro_rules! declare_id_wrapper { } }; - ($name:ident, $wraps:ident, $local:ident, no_try_from) => { + ($name:ident, $wraps:ident, $local:ty, no_try_from) => { #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub struct $name(pub $wraps); @@ -375,9 +448,9 @@ macro_rules! declare_id_wrapper { } } - impl From<$name> for SolverDefId { + impl<'db> From<$name> for SolverDefId<'db> { #[inline] - fn from(value: $name) -> SolverDefId { + fn from(value: $name) -> SolverDefId<'db> { value.0.into() } } @@ -395,9 +468,158 @@ macro_rules! declare_id_wrapper { declare_id_wrapper!(TraitIdWrapper, TraitId); declare_id_wrapper!(TypeAliasIdWrapper, TypeAliasId); -declare_id_wrapper!(ClosureIdWrapper, InternedClosureId); -declare_id_wrapper!(CoroutineIdWrapper, InternedCoroutineId); -declare_id_wrapper!(CoroutineClosureIdWrapper, InternedCoroutineClosureId); +#[derive(Clone, Copy, PartialEq, Eq, Hash)] +pub struct ClosureIdWrapper<'db>(pub InternedClosureId<'db>); + +impl std::fmt::Debug for ClosureIdWrapper<'_> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Debug::fmt(&SolverDefId::from(self.0), f) + } +} + +impl<'db> From<ClosureIdWrapper<'db>> for InternedClosureId<'db> { + #[inline] + fn from(value: ClosureIdWrapper<'db>) -> InternedClosureId<'db> { + value.0 + } +} + +impl<'db> From<InternedClosureId<'db>> for ClosureIdWrapper<'db> { + #[inline] + fn from(value: InternedClosureId<'db>) -> ClosureIdWrapper<'db> { + Self(value) + } +} + +impl<'db> From<ClosureIdWrapper<'db>> for SolverDefId<'db> { + #[inline] + fn from(value: ClosureIdWrapper<'db>) -> SolverDefId<'db> { + value.0.into() + } +} + +impl<'db> TryFrom<SolverDefId<'db>> for ClosureIdWrapper<'db> { + type Error = (); + + #[inline] + fn try_from(value: SolverDefId<'db>) -> Result<Self, Self::Error> { + match value { + SolverDefId::InternedClosureId(it) => Ok(Self(it)), + _ => Err(()), + } + } +} + +impl<'db> inherent::DefId<DbInterner<'db>, SolverDefId<'db>> for ClosureIdWrapper<'db> { + fn as_local(self) -> Option<SolverDefId<'db>> { + Some(self.into()) + } + fn is_local(self) -> bool { + true + } +} + +#[derive(Clone, Copy, PartialEq, Eq, Hash)] +pub struct CoroutineIdWrapper<'db>(pub InternedCoroutineId<'db>); + +impl std::fmt::Debug for CoroutineIdWrapper<'_> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Debug::fmt(&SolverDefId::from(self.0), f) + } +} + +impl<'db> From<CoroutineIdWrapper<'db>> for InternedCoroutineId<'db> { + #[inline] + fn from(value: CoroutineIdWrapper<'db>) -> InternedCoroutineId<'db> { + value.0 + } +} + +impl<'db> From<InternedCoroutineId<'db>> for CoroutineIdWrapper<'db> { + #[inline] + fn from(value: InternedCoroutineId<'db>) -> CoroutineIdWrapper<'db> { + Self(value) + } +} + +impl<'db> From<CoroutineIdWrapper<'db>> for SolverDefId<'db> { + #[inline] + fn from(value: CoroutineIdWrapper<'db>) -> SolverDefId<'db> { + value.0.into() + } +} + +impl<'db> TryFrom<SolverDefId<'db>> for CoroutineIdWrapper<'db> { + type Error = (); + + #[inline] + fn try_from(value: SolverDefId<'db>) -> Result<Self, Self::Error> { + match value { + SolverDefId::InternedCoroutineId(it) => Ok(Self(it)), + _ => Err(()), + } + } +} + +impl<'db> inherent::DefId<DbInterner<'db>, SolverDefId<'db>> for CoroutineIdWrapper<'db> { + fn as_local(self) -> Option<SolverDefId<'db>> { + Some(self.into()) + } + fn is_local(self) -> bool { + true + } +} + +#[derive(Clone, Copy, PartialEq, Eq, Hash)] +pub struct CoroutineClosureIdWrapper<'db>(pub InternedCoroutineClosureId<'db>); + +impl std::fmt::Debug for CoroutineClosureIdWrapper<'_> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Debug::fmt(&SolverDefId::from(self.0), f) + } +} + +impl<'db> From<CoroutineClosureIdWrapper<'db>> for InternedCoroutineClosureId<'db> { + #[inline] + fn from(value: CoroutineClosureIdWrapper<'db>) -> InternedCoroutineClosureId<'db> { + value.0 + } +} + +impl<'db> From<InternedCoroutineClosureId<'db>> for CoroutineClosureIdWrapper<'db> { + #[inline] + fn from(value: InternedCoroutineClosureId<'db>) -> CoroutineClosureIdWrapper<'db> { + Self(value) + } +} + +impl<'db> From<CoroutineClosureIdWrapper<'db>> for SolverDefId<'db> { + #[inline] + fn from(value: CoroutineClosureIdWrapper<'db>) -> SolverDefId<'db> { + value.0.into() + } +} + +impl<'db> TryFrom<SolverDefId<'db>> for CoroutineClosureIdWrapper<'db> { + type Error = (); + + #[inline] + fn try_from(value: SolverDefId<'db>) -> Result<Self, Self::Error> { + match value { + SolverDefId::InternedCoroutineClosureId(it) => Ok(Self(it)), + _ => Err(()), + } + } +} + +impl<'db> inherent::DefId<DbInterner<'db>, SolverDefId<'db>> for CoroutineClosureIdWrapper<'db> { + fn as_local(self) -> Option<SolverDefId<'db>> { + Some(self.into()) + } + fn is_local(self) -> bool { + true + } +} declare_id_wrapper!(AdtIdWrapper, AdtId); declare_id_wrapper!(OpaqueTyIdWrapper, InternedOpaqueTyId, OpaqueTyIdWrapper); @@ -405,13 +627,13 @@ macro_rules! declare_ty_const_pair { ( $ty_id_name:ident, $const_id_name:ident, $term_id_name:ident ) => { declare_id_wrapper!($ty_id_name, TypeAliasId); declare_id_wrapper!($const_id_name, ConstId); - declare_id_wrapper!($term_id_name, TermId, SolverDefId, no_try_from); + declare_id_wrapper!($term_id_name, TermId, SolverDefId<'db>, no_try_from); - impl TryFrom<SolverDefId> for $term_id_name { + impl TryFrom<SolverDefId<'_>> for $term_id_name { type Error = (); #[inline] - fn try_from(value: SolverDefId) -> Result<Self, Self::Error> { + fn try_from(value: SolverDefId<'_>) -> Result<Self, Self::Error> { match value { SolverDefId::TypeAliasId(it) => Ok(Self(TermId::TypeAliasId(it))), SolverDefId::ConstId(it) => Ok(Self(TermId::ConstId(it))), @@ -454,7 +676,7 @@ macro_rules! declare_ty_const_pair { } } - impl From<$const_id_name> for GeneralConstIdWrapper { + impl<'db> From<$const_id_name> for GeneralConstIdWrapper<'db> { fn from(value: $const_id_name) -> Self { GeneralConstIdWrapper(GeneralConstId::ConstId(value.0)) } @@ -474,7 +696,7 @@ pub enum TermId { } impl_from!(TypeAliasId, ConstId for TermId); -impl From<TermId> for SolverDefId { +impl<'db> From<TermId> for SolverDefId<'db> { fn from(value: TermId) -> Self { match value { TermId::TypeAliasId(id) => id.into(), @@ -484,28 +706,28 @@ impl From<TermId> for SolverDefId { } #[derive(Clone, Copy, PartialEq, Eq, Hash)] -pub struct GeneralConstIdWrapper(pub GeneralConstId); +pub struct GeneralConstIdWrapper<'db>(pub GeneralConstId<'db>); -impl std::fmt::Debug for GeneralConstIdWrapper { +impl std::fmt::Debug for GeneralConstIdWrapper<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Debug::fmt(&self.0, f) } } -impl From<GeneralConstIdWrapper> for GeneralConstId { +impl<'db> From<GeneralConstIdWrapper<'db>> for GeneralConstId<'db> { #[inline] - fn from(value: GeneralConstIdWrapper) -> GeneralConstId { + fn from(value: GeneralConstIdWrapper<'db>) -> GeneralConstId<'db> { value.0 } } -impl From<GeneralConstId> for GeneralConstIdWrapper { +impl<'db> From<GeneralConstId<'db>> for GeneralConstIdWrapper<'db> { #[inline] - fn from(value: GeneralConstId) -> GeneralConstIdWrapper { + fn from(value: GeneralConstId<'db>) -> GeneralConstIdWrapper<'db> { Self(value) } } -impl From<GeneralConstIdWrapper> for SolverDefId { +impl<'db> From<GeneralConstIdWrapper<'db>> for SolverDefId<'db> { #[inline] - fn from(value: GeneralConstIdWrapper) -> SolverDefId { + fn from(value: GeneralConstIdWrapper<'db>) -> SolverDefId<'db> { match value.0 { GeneralConstId::ConstId(id) => SolverDefId::ConstId(id), GeneralConstId::StaticId(id) => SolverDefId::StaticId(id), @@ -513,10 +735,10 @@ impl From<GeneralConstIdWrapper> for SolverDefId { } } } -impl TryFrom<SolverDefId> for GeneralConstIdWrapper { +impl<'db> TryFrom<SolverDefId<'db>> for GeneralConstIdWrapper<'db> { type Error = (); #[inline] - fn try_from(value: SolverDefId) -> Result<Self, Self::Error> { + fn try_from(value: SolverDefId<'db>) -> Result<Self, Self::Error> { match value { SolverDefId::ConstId(it) => Ok(Self(it.into())), SolverDefId::StaticId(it) => Ok(Self(it.into())), @@ -525,8 +747,8 @@ impl TryFrom<SolverDefId> for GeneralConstIdWrapper { } } } -impl<'db> inherent::DefId<DbInterner<'db>> for GeneralConstIdWrapper { - fn as_local(self) -> Option<SolverDefId> { +impl<'db> inherent::DefId<DbInterner<'db>> for GeneralConstIdWrapper<'db> { + fn as_local(self) -> Option<SolverDefId<'db>> { Some(self.into()) } fn is_local(self) -> bool { @@ -554,9 +776,9 @@ impl From<CallableDefId> for CallableIdWrapper { Self(value) } } -impl From<CallableIdWrapper> for SolverDefId { +impl<'db> From<CallableIdWrapper> for SolverDefId<'db> { #[inline] - fn from(value: CallableIdWrapper) -> SolverDefId { + fn from(value: CallableIdWrapper) -> SolverDefId<'db> { match value.0 { CallableDefId::FunctionId(it) => it.into(), CallableDefId::StructId(it) => Ctor::Struct(it).into(), @@ -564,10 +786,10 @@ impl From<CallableIdWrapper> for SolverDefId { } } } -impl TryFrom<SolverDefId> for CallableIdWrapper { +impl TryFrom<SolverDefId<'_>> for CallableIdWrapper { type Error = (); #[inline] - fn try_from(value: SolverDefId) -> Result<Self, Self::Error> { + fn try_from(value: SolverDefId<'_>) -> Result<Self, Self::Error> { match value { SolverDefId::FunctionId(it) => Ok(Self(it.into())), SolverDefId::Ctor(Ctor::Struct(it)) => Ok(Self(it.into())), @@ -577,7 +799,7 @@ impl TryFrom<SolverDefId> for CallableIdWrapper { } } impl<'db> inherent::DefId<DbInterner<'db>> for CallableIdWrapper { - fn as_local(self) -> Option<SolverDefId> { + fn as_local(self) -> Option<SolverDefId<'db>> { Some(self.into()) } fn is_local(self) -> bool { @@ -593,19 +815,19 @@ pub enum AnyImplId { impl_from!(ImplId, BuiltinDeriveImplId for AnyImplId); -impl From<AnyImplId> for SolverDefId { +impl<'db> From<AnyImplId> for SolverDefId<'db> { #[inline] - fn from(value: AnyImplId) -> SolverDefId { + fn from(value: AnyImplId) -> SolverDefId<'db> { match value { AnyImplId::ImplId(it) => it.into(), AnyImplId::BuiltinDeriveImplId(it) => it.into(), } } } -impl TryFrom<SolverDefId> for AnyImplId { +impl TryFrom<SolverDefId<'_>> for AnyImplId { type Error = (); #[inline] - fn try_from(value: SolverDefId) -> Result<Self, Self::Error> { + fn try_from(value: SolverDefId<'_>) -> Result<Self, Self::Error> { match value { SolverDefId::ImplId(it) => Ok(it.into()), SolverDefId::BuiltinDeriveImplId(it) => Ok(it.into()), @@ -614,7 +836,7 @@ impl TryFrom<SolverDefId> for AnyImplId { } } impl<'db> inherent::DefId<DbInterner<'db>> for AnyImplId { - fn as_local(self) -> Option<SolverDefId> { + fn as_local(self) -> Option<SolverDefId<'db>> { Some(self.into()) } fn is_local(self) -> bool { |