diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-20 11:47:50 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-20 11:47:50 +0000 |
commit | 4d67032bbb3e1f97ee7af43cb6f056d01f791ca2 (patch) | |
tree | 70a77a26ca09d8d5cd843b1cd9d59af229cd0daf /crates/hir_ty/src/method_resolution.rs | |
parent | 5ac0290f533eed295c6e92564d7530d41cf45d6e (diff) | |
parent | 7ec3b66f7a3ac0a33cf435bc3596fdac542fc52a (diff) |
Merge #8117
8117: Turn Obligation into something similar to chalk_ir::DomainGoal r=flodiebold a=flodiebold
This includes starting to make use of Chalk's `Cast` trait.
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/method_resolution.rs')
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 01b78fb44..da6bc2a4a 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -6,7 +6,7 @@ use std::{iter, sync::Arc}; | |||
6 | 6 | ||
7 | use arrayvec::ArrayVec; | 7 | use arrayvec::ArrayVec; |
8 | use base_db::CrateId; | 8 | use base_db::CrateId; |
9 | use chalk_ir::Mutability; | 9 | use chalk_ir::{cast::Cast, Mutability}; |
10 | use hir_def::{ | 10 | use hir_def::{ |
11 | lang_item::LangItemTarget, AssocContainerId, AssocItemId, FunctionId, GenericDefId, HasModule, | 11 | lang_item::LangItemTarget, AssocContainerId, AssocItemId, FunctionId, GenericDefId, HasModule, |
12 | ImplId, Lookup, ModuleId, TraitId, | 12 | ImplId, Lookup, ModuleId, TraitId, |
@@ -767,7 +767,7 @@ fn generic_implements_goal( | |||
767 | env: Arc<TraitEnvironment>, | 767 | env: Arc<TraitEnvironment>, |
768 | trait_: TraitId, | 768 | trait_: TraitId, |
769 | self_ty: Canonical<Ty>, | 769 | self_ty: Canonical<Ty>, |
770 | ) -> Canonical<InEnvironment<super::Obligation>> { | 770 | ) -> Canonical<InEnvironment<super::DomainGoal>> { |
771 | let mut kinds = self_ty.kinds.to_vec(); | 771 | let mut kinds = self_ty.kinds.to_vec(); |
772 | let substs = super::Substitution::build_for_def(db, trait_) | 772 | let substs = super::Substitution::build_for_def(db, trait_) |
773 | .push(self_ty.value) | 773 | .push(self_ty.value) |
@@ -775,7 +775,7 @@ fn generic_implements_goal( | |||
775 | .build(); | 775 | .build(); |
776 | kinds.extend(iter::repeat(chalk_ir::TyVariableKind::General).take(substs.len() - 1)); | 776 | kinds.extend(iter::repeat(chalk_ir::TyVariableKind::General).take(substs.len() - 1)); |
777 | let trait_ref = TraitRef { trait_id: to_chalk_trait_id(trait_), substitution: substs }; | 777 | let trait_ref = TraitRef { trait_id: to_chalk_trait_id(trait_), substitution: substs }; |
778 | let obligation = super::Obligation::Trait(trait_ref); | 778 | let obligation = trait_ref.cast(&Interner); |
779 | Canonical { kinds: kinds.into(), value: InEnvironment::new(env, obligation) } | 779 | Canonical { kinds: kinds.into(), value: InEnvironment::new(env, obligation) } |
780 | } | 780 | } |
781 | 781 | ||