aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/traits
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-06-29 18:14:52 +0100
committerFlorian Diebold <[email protected]>2019-07-08 20:20:17 +0100
commitb1b12072eddaf989fb08ed7a2e39ec2dbbb83dde (patch)
tree63bb052a39df80dcd0771a18a7a475df3e6a5fe1 /crates/ra_hir/src/ty/traits
parent638100dc8bea69cc4093d15f1641ed39a8d27a43 (diff)
Start handling environment in trait resolution
I.e. if we are inside a function with some where clauses, we assume these where clauses hold.
Diffstat (limited to 'crates/ra_hir/src/ty/traits')
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index bee35fa62..f36ff2fc6 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -239,15 +239,28 @@ where
239impl ToChalk for Arc<super::Environment> { 239impl ToChalk for Arc<super::Environment> {
240 type Chalk = Arc<chalk_ir::Environment>; 240 type Chalk = Arc<chalk_ir::Environment>;
241 241
242 fn to_chalk(self, _db: &impl HirDatabase) -> Arc<chalk_ir::Environment> { 242 fn to_chalk(self, db: &impl HirDatabase) -> Arc<chalk_ir::Environment> {
243 chalk_ir::Environment::new() 243 let mut clauses = Vec::new();
244 for pred in &self.predicates {
245 if pred.is_error() {
246 // for env, we just ignore errors
247 continue;
248 }
249 if let GenericPredicate::Implemented(trait_ref) = pred {
250 if blacklisted_trait(db, trait_ref.trait_) {
251 continue;
252 }
253 }
254 clauses.push(pred.clone().to_chalk(db).cast());
255 }
256 chalk_ir::Environment::new().add_clauses(clauses)
244 } 257 }
245 258
246 fn from_chalk( 259 fn from_chalk(
247 _db: &impl HirDatabase, 260 _db: &impl HirDatabase,
248 _env: Arc<chalk_ir::Environment>, 261 _env: Arc<chalk_ir::Environment>,
249 ) -> Arc<super::Environment> { 262 ) -> Arc<super::Environment> {
250 Arc::new(super::Environment) 263 unimplemented!()
251 } 264 }
252} 265}
253 266