diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-05 16:04:49 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-05 16:04:49 +0000 |
commit | 6c27c55041953327d341f4e7c705e8887fc4dd50 (patch) | |
tree | bcc8bcac74fa61c816986b0635defa7c7512660f /crates/hir_ty/src/traits/chalk/mapping.rs | |
parent | 25a43e24c81f7b51234fc4e65e5e36ddbe3d60f1 (diff) | |
parent | 50e01d2bc7429d718e0783d75458a6a047ee2b70 (diff) |
Merge #7870
7870: Use chalk_ir::AdtId r=Veykril a=Veykril
It's a bit unfortunate that we got two AdtId's now(technically 3 with the alias in the chalk module but that one won't allow pattern matching), one from hir_def and one from chalk_ir(hir_ty). But the hir_ty/chalk one doesn't leave hir so it shouldn't be that bad I suppose. Though if I see this right this will happen for almost all IDs.
I imagine most of the intermediate changes to using chalk ids will turn out not too nice until the refactor is over.
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/traits/chalk/mapping.rs')
-rw-r--r-- | crates/hir_ty/src/traits/chalk/mapping.rs | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index db1760e6c..3a08b67e9 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs | |||
@@ -86,7 +86,7 @@ impl ToChalk for Ty { | |||
86 | 86 | ||
87 | Ty::Adt(adt_id, substs) => { | 87 | Ty::Adt(adt_id, substs) => { |
88 | let substitution = substs.to_chalk(db); | 88 | let substitution = substs.to_chalk(db); |
89 | chalk_ir::TyKind::Adt(chalk_ir::AdtId(adt_id), substitution).intern(&Interner) | 89 | chalk_ir::TyKind::Adt(adt_id, substitution).intern(&Interner) |
90 | } | 90 | } |
91 | Ty::Alias(AliasTy::Projection(proj_ty)) => { | 91 | Ty::Alias(AliasTy::Projection(proj_ty)) => { |
92 | let associated_ty_id = TypeAliasAsAssocType(proj_ty.associated_ty).to_chalk(db); | 92 | let associated_ty_id = TypeAliasAsAssocType(proj_ty.associated_ty).to_chalk(db); |
@@ -183,7 +183,7 @@ impl ToChalk for Ty { | |||
183 | Ty::Dyn(predicates) | 183 | Ty::Dyn(predicates) |
184 | } | 184 | } |
185 | 185 | ||
186 | chalk_ir::TyKind::Adt(struct_id, subst) => Ty::Adt(struct_id.0, from_chalk(db, subst)), | 186 | chalk_ir::TyKind::Adt(adt_id, subst) => Ty::Adt(adt_id, from_chalk(db, subst)), |
187 | chalk_ir::TyKind::AssociatedType(type_id, subst) => Ty::AssociatedType( | 187 | chalk_ir::TyKind::AssociatedType(type_id, subst) => Ty::AssociatedType( |
188 | from_chalk::<TypeAliasAsAssocType, _>(db, type_id).0, | 188 | from_chalk::<TypeAliasAsAssocType, _>(db, type_id).0, |
189 | from_chalk(db, subst), | 189 | from_chalk(db, subst), |
@@ -325,18 +325,6 @@ impl ToChalk for hir_def::ImplId { | |||
325 | } | 325 | } |
326 | } | 326 | } |
327 | 327 | ||
328 | impl ToChalk for hir_def::AdtId { | ||
329 | type Chalk = AdtId; | ||
330 | |||
331 | fn to_chalk(self, _db: &dyn HirDatabase) -> Self::Chalk { | ||
332 | chalk_ir::AdtId(self.into()) | ||
333 | } | ||
334 | |||
335 | fn from_chalk(_db: &dyn HirDatabase, id: AdtId) -> Self { | ||
336 | id.0 | ||
337 | } | ||
338 | } | ||
339 | |||
340 | impl ToChalk for CallableDefId { | 328 | impl ToChalk for CallableDefId { |
341 | type Chalk = FnDefId; | 329 | type Chalk = FnDefId; |
342 | 330 | ||