diff options
Diffstat (limited to 'crates/ra_hir/src/ty/lower.rs')
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 8b1b2a7f9..b48ada760 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -318,15 +318,13 @@ pub(crate) fn type_for_field(db: &impl HirDatabase, field: StructField) -> Ty { | |||
318 | } | 318 | } |
319 | 319 | ||
320 | /// Resolve the where clause(s) of an item with generics. | 320 | /// Resolve the where clause(s) of an item with generics. |
321 | pub(crate) fn generic_predicates( | 321 | pub(crate) fn generic_predicates_query( |
322 | db: &impl HirDatabase, | 322 | db: &impl HirDatabase, |
323 | def: GenericDef, | 323 | def: GenericDef, |
324 | ) -> Arc<[GenericPredicate]> { | 324 | ) -> Arc<[GenericPredicate]> { |
325 | let resolver = def.resolver(db); | 325 | let resolver = def.resolver(db); |
326 | let generic_params = def.generic_params(db); | 326 | let predicates = resolver |
327 | let predicates = generic_params | 327 | .where_predicates_in_scope() |
328 | .where_predicates | ||
329 | .iter() | ||
330 | .map(|pred| { | 328 | .map(|pred| { |
331 | TraitRef::for_where_predicate(db, &resolver, pred) | 329 | TraitRef::for_where_predicate(db, &resolver, pred) |
332 | .map_or(GenericPredicate::Error, GenericPredicate::Implemented) | 330 | .map_or(GenericPredicate::Error, GenericPredicate::Implemented) |
@@ -336,7 +334,7 @@ pub(crate) fn generic_predicates( | |||
336 | } | 334 | } |
337 | 335 | ||
338 | /// Resolve the default type params from generics | 336 | /// Resolve the default type params from generics |
339 | pub(crate) fn generic_defaults(db: &impl HirDatabase, def: GenericDef) -> Substs { | 337 | pub(crate) fn generic_defaults_query(db: &impl HirDatabase, def: GenericDef) -> Substs { |
340 | let resolver = def.resolver(db); | 338 | let resolver = def.resolver(db); |
341 | let generic_params = def.generic_params(db); | 339 | let generic_params = def.generic_params(db); |
342 | 340 | ||
@@ -511,3 +509,13 @@ pub enum CallableDef { | |||
511 | EnumVariant(EnumVariant), | 509 | EnumVariant(EnumVariant), |
512 | } | 510 | } |
513 | impl_froms!(CallableDef: Function, Struct, EnumVariant); | 511 | impl_froms!(CallableDef: Function, Struct, EnumVariant); |
512 | |||
513 | impl From<CallableDef> for GenericDef { | ||
514 | fn from(def: CallableDef) -> GenericDef { | ||
515 | match def { | ||
516 | CallableDef::Function(f) => f.into(), | ||
517 | CallableDef::Struct(s) => s.into(), | ||
518 | CallableDef::EnumVariant(e) => e.into(), | ||
519 | } | ||
520 | } | ||
521 | } | ||