diff options
Diffstat (limited to 'crates/ra_hir/src/ty/infer.rs')
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index e8ae33ead..1723921e6 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -848,28 +848,23 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
848 | } | 848 | } |
849 | 849 | ||
850 | fn register_obligations_for_call(&mut self, callable_ty: &Ty) { | 850 | fn register_obligations_for_call(&mut self, callable_ty: &Ty) { |
851 | match callable_ty { | 851 | if let Ty::Apply(a_ty) = callable_ty { |
852 | Ty::Apply(a_ty) => match a_ty.ctor { | 852 | if let TypeCtor::FnDef(def) = a_ty.ctor { |
853 | TypeCtor::FnDef(def) => { | 853 | // add obligation for trait implementation, if this is a trait method |
854 | // add obligation for trait implementation, if this is a trait method | 854 | // FIXME also register obligations from where clauses from the trait or impl and method |
855 | // FIXME also register obligations from where clauses from the trait or impl and method | 855 | match def { |
856 | match def { | 856 | CallableDef::Function(f) => { |
857 | CallableDef::Function(f) => { | 857 | if let Some(trait_) = f.parent_trait(self.db) { |
858 | if let Some(trait_) = f.parent_trait(self.db) { | 858 | // construct a TraitDef |
859 | // construct a TraitDef | 859 | let substs = a_ty.parameters.prefix( |
860 | let substs = a_ty.parameters.prefix( | 860 | trait_.generic_params(self.db).count_params_including_parent(), |
861 | trait_.generic_params(self.db).count_params_including_parent(), | 861 | ); |
862 | ); | 862 | self.obligations.push(Obligation::Trait(TraitRef { trait_, substs })); |
863 | self.obligations | ||
864 | .push(Obligation::Trait(TraitRef { trait_, substs })); | ||
865 | } | ||
866 | } | 863 | } |
867 | CallableDef::Struct(_) | CallableDef::EnumVariant(_) => {} | ||
868 | } | 864 | } |
865 | CallableDef::Struct(_) | CallableDef::EnumVariant(_) => {} | ||
869 | } | 866 | } |
870 | _ => {} | 867 | } |
871 | }, | ||
872 | _ => {} | ||
873 | } | 868 | } |
874 | } | 869 | } |
875 | 870 | ||