aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty
diff options
context:
space:
mode:
authorGrayJack <[email protected]>2020-10-26 18:20:33 +0000
committerGrayJack <[email protected]>2020-10-26 18:20:33 +0000
commit08e95a5dc1035c57f2cfe6f61f0d64280b940b10 (patch)
tree6a132d4c6520941694d0ed5407038730ce18db45 /crates/hir_ty
parentd01e412eb1572676a33ad145f3370a7157dbc9df (diff)
Fix case where non FnOnce variables is marked callable
Diffstat (limited to 'crates/hir_ty')
-rw-r--r--crates/hir_ty/src/method_resolution.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs
index 8961df404..5a6f0c67f 100644
--- a/crates/hir_ty/src/method_resolution.rs
+++ b/crates/hir_ty/src/method_resolution.rs
@@ -740,6 +740,19 @@ pub fn implements_trait(
740 solution.is_some() 740 solution.is_some()
741} 741}
742 742
743pub fn implements_trait_unique(
744 ty: &Canonical<Ty>,
745 db: &dyn HirDatabase,
746 env: Arc<TraitEnvironment>,
747 krate: CrateId,
748 trait_: TraitId,
749) -> bool {
750 let goal = generic_implements_goal(db, env, trait_, ty.clone());
751 let solution = db.trait_solve(krate, goal);
752
753 matches!(solution, Some(crate::traits::Solution::Unique(_)))
754}
755
743/// This creates Substs for a trait with the given Self type and type variables 756/// This creates Substs for a trait with the given Self type and type variables
744/// for all other parameters, to query Chalk with it. 757/// for all other parameters, to query Chalk with it.
745fn generic_implements_goal( 758fn generic_implements_goal(