aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/traits.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-12 21:20:36 +0100
committerGitHub <[email protected]>2020-07-12 21:20:36 +0100
commit39e049d2a1d7e0adbd9546f9e8124843443b31ce (patch)
treec4bd56eaa24b25db28d8f213bae39c3b47703c46 /crates/ra_hir_ty/src/traits.rs
parentab1ad19f552e1b11055ed60f87cc420871d902eb (diff)
parentd885f38011b6d4265b527744234b3c317fe86501 (diff)
Merge #5319
5319: Chalk upgrade r=flodiebold a=flodiebold - upgrade Chalk - make use of Chalk's `Unsize` impls, remove ours - use Chalk's built-in array type - search efficiently for impls for an int/float variable - output Chalk tracing logs in hir_ty tests Fixes #2534. Fixes #5057. Fixes #4374. Fixes #4281. Co-authored-by: Florian Diebold <[email protected]> Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/traits.rs')
-rw-r--r--crates/ra_hir_ty/src/traits.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs
index 2a6d7faef..f7edb4c8b 100644
--- a/crates/ra_hir_ty/src/traits.rs
+++ b/crates/ra_hir_ty/src/traits.rs
@@ -2,6 +2,7 @@
2use std::sync::Arc; 2use std::sync::Arc;
3 3
4use chalk_ir::cast::Cast; 4use chalk_ir::cast::Cast;
5use chalk_solve::Solver;
5use hir_def::{ 6use hir_def::{
6 expr::ExprId, lang_item::LangItemTarget, DefWithBodyId, ImplId, TraitId, TypeAliasId, 7 expr::ExprId, lang_item::LangItemTarget, DefWithBodyId, ImplId, TraitId, TypeAliasId,
7}; 8};
@@ -32,9 +33,10 @@ struct ChalkContext<'a> {
32 krate: CrateId, 33 krate: CrateId,
33} 34}
34 35
35fn create_chalk_solver() -> chalk_solve::Solver<Interner> { 36fn create_chalk_solver() -> chalk_recursive::RecursiveSolver<Interner> {
36 let solver_choice = chalk_solve::SolverChoice::recursive(); 37 let overflow_depth = 100;
37 solver_choice.into_solver() 38 let caching_enabled = true;
39 chalk_recursive::RecursiveSolver::new(overflow_depth, caching_enabled)
38} 40}
39 41
40/// A set of clauses that we assume to be true. E.g. if we are inside this function: 42/// A set of clauses that we assume to be true. E.g. if we are inside this function:
@@ -293,13 +295,8 @@ pub enum Impl {
293 /// A normal impl from an impl block. 295 /// A normal impl from an impl block.
294 ImplDef(ImplId), 296 ImplDef(ImplId),
295 /// Closure types implement the Fn traits synthetically. 297 /// Closure types implement the Fn traits synthetically.
298 // FIXME: implement closure support from Chalk, remove this
296 ClosureFnTraitImpl(ClosureFnTraitImplData), 299 ClosureFnTraitImpl(ClosureFnTraitImplData),
297 /// [T; n]: Unsize<[T]>
298 UnsizeArray,
299 /// T: Unsize<dyn Trait> where T: Trait
300 UnsizeToTraitObject(TraitId),
301 /// dyn Trait: Unsize<dyn SuperTrait> if Trait: SuperTrait
302 UnsizeToSuperTraitObject(UnsizeToSuperTraitObjectData),
303} 300}
304/// This exists just for Chalk, because our ImplIds are only unique per module. 301/// This exists just for Chalk, because our ImplIds are only unique per module.
305#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 302#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]