aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/traits
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/traits')
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs24
1 files changed, 6 insertions, 18 deletions
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index 2df4dd13f..9e7ae0724 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -266,7 +266,7 @@ where
266 } 266 }
267} 267}
268 268
269impl ToChalk for Arc<super::Environment> { 269impl ToChalk for Arc<super::TraitEnvironment> {
270 type Chalk = Arc<chalk_ir::Environment>; 270 type Chalk = Arc<chalk_ir::Environment>;
271 271
272 fn to_chalk(self, db: &impl HirDatabase) -> Arc<chalk_ir::Environment> { 272 fn to_chalk(self, db: &impl HirDatabase) -> Arc<chalk_ir::Environment> {
@@ -276,11 +276,6 @@ impl ToChalk for Arc<super::Environment> {
276 // for env, we just ignore errors 276 // for env, we just ignore errors
277 continue; 277 continue;
278 } 278 }
279 if let GenericPredicate::Implemented(trait_ref) = pred {
280 if blacklisted_trait(db, trait_ref.trait_) {
281 continue;
282 }
283 }
284 clauses.push(pred.clone().to_chalk(db).cast()); 279 clauses.push(pred.clone().to_chalk(db).cast());
285 } 280 }
286 chalk_ir::Environment::new().add_clauses(clauses) 281 chalk_ir::Environment::new().add_clauses(clauses)
@@ -289,7 +284,7 @@ impl ToChalk for Arc<super::Environment> {
289 fn from_chalk( 284 fn from_chalk(
290 _db: &impl HirDatabase, 285 _db: &impl HirDatabase,
291 _env: Arc<chalk_ir::Environment>, 286 _env: Arc<chalk_ir::Environment>,
292 ) -> Arc<super::Environment> { 287 ) -> Arc<super::TraitEnvironment> {
293 unimplemented!() 288 unimplemented!()
294 } 289 }
295} 290}
@@ -322,10 +317,10 @@ fn make_binders<T>(value: T, num_vars: usize) -> chalk_ir::Binders<T> {
322 } 317 }
323} 318}
324 319
325fn blacklisted_trait(db: &impl HirDatabase, trait_: Trait) -> bool { 320fn is_non_enumerable_trait(db: &impl HirDatabase, trait_: Trait) -> bool {
326 let name = trait_.name(db).unwrap_or_else(crate::Name::missing).to_string(); 321 let name = trait_.name(db).unwrap_or_else(crate::Name::missing).to_string();
327 match &*name { 322 match &*name {
328 "Send" | "Sync" | "Sized" | "Fn" | "FnMut" | "FnOnce" => true, 323 "Sized" => true,
329 _ => false, 324 _ => false,
330 } 325 }
331} 326}
@@ -343,11 +338,6 @@ fn convert_where_clauses(
343 // anyway), otherwise Chalk can easily get into slow situations 338 // anyway), otherwise Chalk can easily get into slow situations
344 return vec![pred.clone().subst(substs).to_chalk(db)]; 339 return vec![pred.clone().subst(substs).to_chalk(db)];
345 } 340 }
346 if let GenericPredicate::Implemented(trait_ref) = pred {
347 if blacklisted_trait(db, trait_ref.trait_) {
348 continue;
349 }
350 }
351 result.push(pred.clone().subst(substs).to_chalk(db)); 341 result.push(pred.clone().subst(substs).to_chalk(db));
352 } 342 }
353 result 343 result
@@ -375,10 +365,6 @@ where
375 return Vec::new(); 365 return Vec::new();
376 } 366 }
377 let trait_: Trait = from_chalk(self.db, trait_id); 367 let trait_: Trait = from_chalk(self.db, trait_id);
378 let blacklisted = blacklisted_trait(self.db, trait_);
379 if blacklisted {
380 return Vec::new();
381 }
382 let result: Vec<_> = self 368 let result: Vec<_> = self
383 .db 369 .db
384 .impls_for_trait(self.krate, trait_) 370 .impls_for_trait(self.krate, trait_)
@@ -460,6 +446,7 @@ pub(crate) fn trait_datum_query(
460 associated_ty_ids: Vec::new(), 446 associated_ty_ids: Vec::new(),
461 where_clauses: Vec::new(), 447 where_clauses: Vec::new(),
462 flags: chalk_rust_ir::TraitFlags { 448 flags: chalk_rust_ir::TraitFlags {
449 non_enumerable: false,
463 auto: false, 450 auto: false,
464 marker: false, 451 marker: false,
465 upstream: true, 452 upstream: true,
@@ -476,6 +463,7 @@ pub(crate) fn trait_datum_query(
476 let flags = chalk_rust_ir::TraitFlags { 463 let flags = chalk_rust_ir::TraitFlags {
477 auto: trait_.is_auto(db), 464 auto: trait_.is_auto(db),
478 upstream: trait_.module(db).krate(db) != Some(krate), 465 upstream: trait_.module(db).krate(db) != Some(krate),
466 non_enumerable: is_non_enumerable_trait(db, trait_),
479 // FIXME set these flags correctly 467 // FIXME set these flags correctly
480 marker: false, 468 marker: false,
481 fundamental: false, 469 fundamental: false,