aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/lower.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-25 10:12:03 +0000
committerGitHub <[email protected]>2019-11-25 10:12:03 +0000
commit9f7fcc6ecd5334c5e3caa365c4a6d7bf3f37b649 (patch)
tree5dda185ddeba593b7af36f66eeb6098e4f913c05 /crates/ra_hir/src/ty/lower.rs
parente00e6554ddc13be86733dc8a37a0a229931f378a (diff)
parent8c3e372835243c922b0eff7ca23f79f227991e88 (diff)
Merge #2397
2397: Remove Resolver from autoderef r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/lower.rs')
-rw-r--r--crates/ra_hir/src/ty/lower.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs
index a39beb2a0..b76929501 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -19,8 +19,8 @@ use hir_def::{
19use ra_arena::map::ArenaMap; 19use ra_arena::map::ArenaMap;
20 20
21use super::{ 21use super::{
22 FnSig, GenericPredicate, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, 22 FnSig, GenericPredicate, ProjectionPredicate, ProjectionTy, Substs, TraitEnvironment, TraitRef,
23 TypeWalk, 23 Ty, TypeCtor, TypeWalk,
24}; 24};
25use crate::{ 25use crate::{
26 db::HirDatabase, 26 db::HirDatabase,
@@ -591,16 +591,15 @@ pub(crate) fn generic_predicates_for_param_query(
591 .collect() 591 .collect()
592} 592}
593 593
594pub(crate) fn trait_env( 594impl TraitEnvironment {
595 db: &impl HirDatabase, 595 pub(crate) fn lower(db: &impl HirDatabase, resolver: &Resolver) -> Arc<TraitEnvironment> {
596 resolver: &Resolver, 596 let predicates = resolver
597) -> Arc<super::TraitEnvironment> { 597 .where_predicates_in_scope()
598 let predicates = resolver 598 .flat_map(|pred| GenericPredicate::from_where_predicate(db, &resolver, pred))
599 .where_predicates_in_scope() 599 .collect::<Vec<_>>();
600 .flat_map(|pred| GenericPredicate::from_where_predicate(db, &resolver, pred))
601 .collect::<Vec<_>>();
602 600
603 Arc::new(super::TraitEnvironment { predicates }) 601 Arc::new(TraitEnvironment { predicates })
602 }
604} 603}
605 604
606/// Resolve the where clause(s) of an item with generics. 605/// Resolve the where clause(s) of an item with generics.