diff options
author | Florian Diebold <[email protected]> | 2021-03-13 18:27:09 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-03-13 18:27:09 +0000 |
commit | 2d69eb131f58dee1bc188b8df8d5cf0ebf9d97f2 (patch) | |
tree | b22507ea0b79fcd5d38dcf5ae8b731467a38cc41 /crates/hir_ty/src/traits | |
parent | be7a31fbd64943f71afe11b0413c99496526dddc (diff) |
Use chalk_ir::ClosureId
Diffstat (limited to 'crates/hir_ty/src/traits')
-rw-r--r-- | crates/hir_ty/src/traits/chalk.rs | 6 | ||||
-rw-r--r-- | crates/hir_ty/src/traits/chalk/mapping.rs | 11 |
2 files changed, 6 insertions, 11 deletions
diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs index bb92d8e2a..e7217bc11 100644 --- a/crates/hir_ty/src/traits/chalk.rs +++ b/crates/hir_ty/src/traits/chalk.rs | |||
@@ -716,14 +716,14 @@ impl From<crate::db::InternedOpaqueTyId> for OpaqueTyId { | |||
716 | } | 716 | } |
717 | } | 717 | } |
718 | 718 | ||
719 | impl From<chalk_ir::ClosureId<Interner>> for crate::db::ClosureId { | 719 | impl From<chalk_ir::ClosureId<Interner>> for crate::db::InternedClosureId { |
720 | fn from(id: chalk_ir::ClosureId<Interner>) -> Self { | 720 | fn from(id: chalk_ir::ClosureId<Interner>) -> Self { |
721 | Self::from_intern_id(id.0) | 721 | Self::from_intern_id(id.0) |
722 | } | 722 | } |
723 | } | 723 | } |
724 | 724 | ||
725 | impl From<crate::db::ClosureId> for chalk_ir::ClosureId<Interner> { | 725 | impl From<crate::db::InternedClosureId> for chalk_ir::ClosureId<Interner> { |
726 | fn from(id: crate::db::ClosureId) -> Self { | 726 | fn from(id: crate::db::InternedClosureId) -> Self { |
727 | chalk_ir::ClosureId(id.as_intern_id()) | 727 | chalk_ir::ClosureId(id.as_intern_id()) |
728 | } | 728 | } |
729 | } | 729 | } |
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index 23ef07d77..56a30363b 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs | |||
@@ -72,10 +72,9 @@ impl ToChalk for Ty { | |||
72 | } | 72 | } |
73 | TyKind::Never => chalk_ir::TyKind::Never.intern(&Interner), | 73 | TyKind::Never => chalk_ir::TyKind::Never.intern(&Interner), |
74 | 74 | ||
75 | TyKind::Closure(def, expr, substs) => { | 75 | TyKind::Closure(closure_id, substs) => { |
76 | let closure_id = db.intern_closure((def, expr)); | ||
77 | let substitution = substs.to_chalk(db); | 76 | let substitution = substs.to_chalk(db); |
78 | chalk_ir::TyKind::Closure(closure_id.into(), substitution).intern(&Interner) | 77 | chalk_ir::TyKind::Closure(closure_id, substitution).intern(&Interner) |
79 | } | 78 | } |
80 | 79 | ||
81 | TyKind::Adt(adt_id, substs) => { | 80 | TyKind::Adt(adt_id, substs) => { |
@@ -203,11 +202,7 @@ impl ToChalk for Ty { | |||
203 | TyKind::FnDef(fn_def_id, from_chalk(db, subst)) | 202 | TyKind::FnDef(fn_def_id, from_chalk(db, subst)) |
204 | } | 203 | } |
205 | 204 | ||
206 | chalk_ir::TyKind::Closure(id, subst) => { | 205 | chalk_ir::TyKind::Closure(id, subst) => TyKind::Closure(id, from_chalk(db, subst)), |
207 | let id: crate::db::ClosureId = id.into(); | ||
208 | let (def, expr) = db.lookup_intern_closure(id); | ||
209 | TyKind::Closure(def, expr, from_chalk(db, subst)) | ||
210 | } | ||
211 | 206 | ||
212 | chalk_ir::TyKind::Foreign(foreign_def_id) => TyKind::ForeignType(foreign_def_id), | 207 | chalk_ir::TyKind::Foreign(foreign_def_id) => TyKind::ForeignType(foreign_def_id), |
213 | chalk_ir::TyKind::Generator(_, _) => unimplemented!(), // FIXME | 208 | chalk_ir::TyKind::Generator(_, _) => unimplemented!(), // FIXME |