diff options
author | Aleksey Kladov <[email protected]> | 2019-11-25 13:26:52 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-25 13:26:52 +0000 |
commit | 78791d6fac1ff426264e636545a07664d83d2039 (patch) | |
tree | bd0825246d6f26f7831f50dad8e39a131848a513 /crates/ra_hir/src/ty/infer | |
parent | 9047a4ad4620d3b37d17a11e6dee0ea4ffbd7af1 (diff) |
Use ids for Callable
Diffstat (limited to 'crates/ra_hir/src/ty/infer')
-rw-r--r-- | crates/ra_hir/src/ty/infer/expr.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/ra_hir/src/ty/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs index 194e55819..1d6df2b7a 100644 --- a/crates/ra_hir/src/ty/infer/expr.rs +++ b/crates/ra_hir/src/ty/infer/expr.rs | |||
@@ -8,6 +8,7 @@ use hir_def::{ | |||
8 | generics::GenericParams, | 8 | generics::GenericParams, |
9 | path::{GenericArg, GenericArgs}, | 9 | path::{GenericArg, GenericArgs}, |
10 | resolver::resolver_for_expr, | 10 | resolver::resolver_for_expr, |
11 | ContainerId, Lookup, | ||
11 | }; | 12 | }; |
12 | use hir_expand::name; | 13 | use hir_expand::name; |
13 | 14 | ||
@@ -660,18 +661,21 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
660 | } | 661 | } |
661 | // add obligation for trait implementation, if this is a trait method | 662 | // add obligation for trait implementation, if this is a trait method |
662 | match def { | 663 | match def { |
663 | CallableDef::Function(f) => { | 664 | CallableDef::FunctionId(f) => { |
664 | if let Some(trait_) = f.parent_trait(self.db) { | 665 | if let ContainerId::TraitId(trait_) = f.lookup(self.db).container { |
665 | // construct a TraitDef | 666 | // construct a TraitDef |
666 | let substs = a_ty.parameters.prefix( | 667 | let substs = a_ty.parameters.prefix( |
667 | self.db | 668 | self.db |
668 | .generic_params(trait_.id.into()) | 669 | .generic_params(trait_.into()) |
669 | .count_params_including_parent(), | 670 | .count_params_including_parent(), |
670 | ); | 671 | ); |
671 | self.obligations.push(Obligation::Trait(TraitRef { trait_, substs })); | 672 | self.obligations.push(Obligation::Trait(TraitRef { |
673 | trait_: trait_.into(), | ||
674 | substs, | ||
675 | })); | ||
672 | } | 676 | } |
673 | } | 677 | } |
674 | CallableDef::Struct(_) | CallableDef::EnumVariant(_) => {} | 678 | CallableDef::StructId(_) | CallableDef::EnumVariantId(_) => {} |
675 | } | 679 | } |
676 | } | 680 | } |
677 | } | 681 | } |