aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/lower.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/lower.rs')
-rw-r--r--crates/ra_hir/src/ty/lower.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs
index b48ada760..ca47d6e96 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -317,6 +317,18 @@ pub(crate) fn type_for_field(db: &impl HirDatabase, field: StructField) -> Ty {
317 Ty::from_hir(db, &resolver, type_ref) 317 Ty::from_hir(db, &resolver, type_ref)
318} 318}
319 319
320pub(crate) fn trait_env(db: &impl HirDatabase, resolver: &Resolver) -> Arc<super::Environment> {
321 let predicates = resolver
322 .where_predicates_in_scope()
323 .map(|pred| {
324 TraitRef::for_where_predicate(db, &resolver, pred)
325 .map_or(GenericPredicate::Error, GenericPredicate::Implemented)
326 })
327 .collect::<Vec<_>>();
328
329 Arc::new(super::Environment { predicates })
330}
331
320/// Resolve the where clause(s) of an item with generics. 332/// Resolve the where clause(s) of an item with generics.
321pub(crate) fn generic_predicates_query( 333pub(crate) fn generic_predicates_query(
322 db: &impl HirDatabase, 334 db: &impl HirDatabase,