diff options
author | Florian Diebold <[email protected]> | 2021-03-20 10:23:59 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-03-20 11:47:12 +0000 |
commit | 7ec3b66f7a3ac0a33cf435bc3596fdac542fc52a (patch) | |
tree | 70a77a26ca09d8d5cd843b1cd9d59af229cd0daf /crates/hir/src | |
parent | 8e7e405f6ab0c1ee10bfdd3d55a97628fe4cd6dd (diff) |
Turn Obligation into something similar to chalk_ir::DomainGoal
This includes starting to make use of Chalk's `Cast` trait.
Diffstat (limited to 'crates/hir/src')
-rw-r--r-- | crates/hir/src/lib.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 268a2b901..30e577671 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -56,8 +56,8 @@ use hir_ty::{ | |||
56 | primitive::UintTy, | 56 | primitive::UintTy, |
57 | to_assoc_type_id, | 57 | to_assoc_type_id, |
58 | traits::{FnTrait, Solution, SolutionVariables}, | 58 | traits::{FnTrait, Solution, SolutionVariables}, |
59 | AliasEq, AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, DebruijnIndex, | 59 | AliasEq, AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, Cast, DebruijnIndex, |
60 | InEnvironment, Interner, Obligation, ProjectionTy, Scalar, Substitution, Ty, TyDefId, TyKind, | 60 | InEnvironment, Interner, ProjectionTy, Scalar, Substitution, Ty, TyDefId, TyKind, |
61 | TyVariableKind, WhereClause, | 61 | TyVariableKind, WhereClause, |
62 | }; | 62 | }; |
63 | use itertools::Itertools; | 63 | use itertools::Itertools; |
@@ -1767,7 +1767,7 @@ impl Type { | |||
1767 | let goal = Canonical { | 1767 | let goal = Canonical { |
1768 | value: hir_ty::InEnvironment::new( | 1768 | value: hir_ty::InEnvironment::new( |
1769 | self.ty.environment.clone(), | 1769 | self.ty.environment.clone(), |
1770 | hir_ty::Obligation::Trait(trait_ref), | 1770 | trait_ref.cast(&Interner), |
1771 | ), | 1771 | ), |
1772 | kinds: Arc::new([]), | 1772 | kinds: Arc::new([]), |
1773 | }; | 1773 | }; |
@@ -1789,14 +1789,15 @@ impl Type { | |||
1789 | let goal = Canonical { | 1789 | let goal = Canonical { |
1790 | value: InEnvironment::new( | 1790 | value: InEnvironment::new( |
1791 | self.ty.environment.clone(), | 1791 | self.ty.environment.clone(), |
1792 | Obligation::AliasEq(AliasEq { | 1792 | AliasEq { |
1793 | alias: AliasTy::Projection(ProjectionTy { | 1793 | alias: AliasTy::Projection(ProjectionTy { |
1794 | associated_ty_id: to_assoc_type_id(alias.id), | 1794 | associated_ty_id: to_assoc_type_id(alias.id), |
1795 | substitution: subst, | 1795 | substitution: subst, |
1796 | }), | 1796 | }), |
1797 | ty: TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)) | 1797 | ty: TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)) |
1798 | .intern(&Interner), | 1798 | .intern(&Interner), |
1799 | }), | 1799 | } |
1800 | .cast(&Interner), | ||
1800 | ), | 1801 | ), |
1801 | kinds: Arc::new([TyVariableKind::General]), | 1802 | kinds: Arc::new([TyVariableKind::General]), |
1802 | }; | 1803 | }; |