diff options
author | Florian Diebold <[email protected]> | 2019-07-14 18:40:19 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-07-15 07:49:55 +0100 |
commit | dcb0c02e3afa8e163379b56a943f04e6e4879dd6 (patch) | |
tree | d9d029c027f550318544b8bbaa4b31b05f7494f1 /crates/ra_hir/src/ty/traits | |
parent | e2bce9e7ebd1879825f74aa34329911a6d3efa79 (diff) |
Remove blacklist, instead mark `Sized` as non-enumerable
This seems to be enough to prevent hanging in rust-analyzer, Chalk and the rustc
repo.
Diffstat (limited to 'crates/ra_hir/src/ty/traits')
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index 203ec3b1b..9e7ae0724 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -276,11 +276,6 @@ impl ToChalk for Arc<super::TraitEnvironment> { | |||
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) |
@@ -322,10 +317,10 @@ fn make_binders<T>(value: T, num_vars: usize) -> chalk_ir::Binders<T> { | |||
322 | } | 317 | } |
323 | } | 318 | } |
324 | 319 | ||
325 | fn blacklisted_trait(db: &impl HirDatabase, trait_: Trait) -> bool { | 320 | fn 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_) |
@@ -477,8 +463,8 @@ pub(crate) fn trait_datum_query( | |||
477 | let flags = chalk_rust_ir::TraitFlags { | 463 | let flags = chalk_rust_ir::TraitFlags { |
478 | auto: trait_.is_auto(db), | 464 | auto: trait_.is_auto(db), |
479 | 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_), | ||
480 | // FIXME set these flags correctly | 467 | // FIXME set these flags correctly |
481 | non_enumerable: false, | ||
482 | marker: false, | 468 | marker: false, |
483 | fundamental: false, | 469 | fundamental: false, |
484 | }; | 470 | }; |