diff options
Diffstat (limited to 'crates/ra_hir_ty/src/traits')
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index c5f1b5232..e05fea843 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -16,8 +16,8 @@ use ra_db::{ | |||
16 | 16 | ||
17 | use super::{builtin, AssocTyValue, Canonical, ChalkContext, Impl, Obligation}; | 17 | use super::{builtin, AssocTyValue, Canonical, ChalkContext, Impl, Obligation}; |
18 | use crate::{ | 18 | use crate::{ |
19 | db::HirDatabase, display::HirDisplay, utils::generics, ApplicationTy, GenericPredicate, | 19 | db::HirDatabase, display::HirDisplay, method_resolution::TyFingerprint, utils::generics, |
20 | ProjectionTy, Substs, TraitRef, Ty, TypeCtor, | 20 | ApplicationTy, GenericPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, |
21 | }; | 21 | }; |
22 | 22 | ||
23 | pub(super) mod tls; | 23 | pub(super) mod tls; |
@@ -647,19 +647,22 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
647 | debug!("impls_for_trait {:?}", trait_id); | 647 | debug!("impls_for_trait {:?}", trait_id); |
648 | let trait_: hir_def::TraitId = from_chalk(self.db, trait_id); | 648 | let trait_: hir_def::TraitId = from_chalk(self.db, trait_id); |
649 | 649 | ||
650 | let ty: Ty = from_chalk(self.db, parameters[0].assert_ty_ref(&Interner).clone()); | ||
651 | |||
652 | let self_ty_fp = TyFingerprint::for_impl(&ty); | ||
653 | |||
650 | // Note: Since we're using impls_for_trait, only impls where the trait | 654 | // Note: Since we're using impls_for_trait, only impls where the trait |
651 | // can be resolved should ever reach Chalk. `impl_datum` relies on that | 655 | // can be resolved should ever reach Chalk. `impl_datum` relies on that |
652 | // and will panic if the trait can't be resolved. | 656 | // and will panic if the trait can't be resolved. |
653 | let mut result: Vec<_> = self | 657 | let mut result: Vec<_> = self |
654 | .db | 658 | .db |
655 | .impls_for_trait(self.krate, trait_) | 659 | .impls_for_trait(self.krate, trait_, self_ty_fp) |
656 | .iter() | 660 | .iter() |
657 | .copied() | 661 | .copied() |
658 | .map(Impl::ImplDef) | 662 | .map(Impl::ImplDef) |
659 | .map(|impl_| impl_.to_chalk(self.db)) | 663 | .map(|impl_| impl_.to_chalk(self.db)) |
660 | .collect(); | 664 | .collect(); |
661 | 665 | ||
662 | let ty: Ty = from_chalk(self.db, parameters[0].assert_ty_ref(&Interner).clone()); | ||
663 | let arg: Option<Ty> = | 666 | let arg: Option<Ty> = |
664 | parameters.get(1).map(|p| from_chalk(self.db, p.assert_ty_ref(&Interner).clone())); | 667 | parameters.get(1).map(|p| from_chalk(self.db, p.assert_ty_ref(&Interner).clone())); |
665 | 668 | ||