Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/db.rs')
-rw-r--r--crates/hir-ty/src/db.rs28
1 files changed, 18 insertions, 10 deletions
diff --git a/crates/hir-ty/src/db.rs b/crates/hir-ty/src/db.rs
index 821ab5fc04..2e130c1028 100644
--- a/crates/hir-ty/src/db.rs
+++ b/crates/hir-ty/src/db.rs
@@ -6,8 +6,12 @@ use either::Either;
use hir_def::{
AdtId, BuiltinDeriveImplId, CallableDefId, ConstId, ConstParamId, DefWithBodyId, EnumVariantId,
ExpressionStoreOwnerId, FunctionId, GenericDefId, ImplId, LifetimeParamId, LocalFieldId,
- StaticId, TraitId, TypeAliasId, VariantId, builtin_derive::BuiltinDeriveImplMethod,
- db::DefDatabase, expr_store::ExpressionStore, hir::ExprId, layout::TargetDataLayout,
+ StaticId, TraitId, TypeAliasId, VariantId,
+ builtin_derive::BuiltinDeriveImplMethod,
+ db::DefDatabase,
+ expr_store::ExpressionStore,
+ hir::{ClosureKind, ExprId},
+ layout::TargetDataLayout,
};
use la_arena::ArenaMap;
use salsa::plumbing::AsId;
@@ -229,8 +233,12 @@ pub struct InternedOpaqueTyId {
pub loc: ImplTraitId,
}
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
-pub struct InternedClosure(pub ExpressionStoreOwnerId, pub ExprId);
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+pub struct InternedClosure {
+ pub owner: ExpressionStoreOwnerId,
+ pub expr: ExprId,
+ pub kind: ClosureKind,
+}
#[salsa_macros::interned(constructor = new_impl, no_lifetime, debug, revisions = usize::MAX)]
#[derive(PartialOrd, Ord)]
@@ -242,8 +250,8 @@ impl InternedClosureId {
#[inline]
pub fn new(db: &dyn HirDatabase, loc: InternedClosure) -> Self {
if cfg!(debug_assertions) {
- let store = ExpressionStore::of(db, loc.0);
- let expr = &store[loc.1];
+ let store = ExpressionStore::of(db, loc.owner);
+ let expr = &store[loc.expr];
assert!(
matches!(
expr,
@@ -270,8 +278,8 @@ impl InternedCoroutineId {
#[inline]
pub fn new(db: &dyn HirDatabase, loc: InternedClosure) -> Self {
if cfg!(debug_assertions) {
- let store = ExpressionStore::of(db, loc.0);
- let expr = &store[loc.1];
+ let store = ExpressionStore::of(db, loc.owner);
+ let expr = &store[loc.expr];
assert!(
matches!(
expr,
@@ -299,8 +307,8 @@ impl InternedCoroutineClosureId {
#[inline]
pub fn new(db: &dyn HirDatabase, loc: InternedClosure) -> Self {
if cfg!(debug_assertions) {
- let store = ExpressionStore::of(db, loc.0);
- let expr = &store[loc.1];
+ let store = ExpressionStore::of(db, loc.owner);
+ let expr = &store[loc.expr];
assert!(
matches!(
expr,