Fix case where non FnOnce variables is marked callable
This commit is contained in:
parent
d01e412eb1
commit
08e95a5dc1
2 changed files with 14 additions and 1 deletions
|
@ -1398,7 +1398,7 @@ impl Type {
|
|||
};
|
||||
|
||||
let canonical_ty = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) };
|
||||
method_resolution::implements_trait(
|
||||
method_resolution::implements_trait_unique(
|
||||
&canonical_ty,
|
||||
db,
|
||||
self.ty.environment.clone(),
|
||||
|
|
|
@ -740,6 +740,19 @@ pub fn implements_trait(
|
|||
solution.is_some()
|
||||
}
|
||||
|
||||
pub fn implements_trait_unique(
|
||||
ty: &Canonical<Ty>,
|
||||
db: &dyn HirDatabase,
|
||||
env: Arc<TraitEnvironment>,
|
||||
krate: CrateId,
|
||||
trait_: TraitId,
|
||||
) -> bool {
|
||||
let goal = generic_implements_goal(db, env, trait_, ty.clone());
|
||||
let solution = db.trait_solve(krate, goal);
|
||||
|
||||
matches!(solution, Some(crate::traits::Solution::Unique(_)))
|
||||
}
|
||||
|
||||
/// This creates Substs for a trait with the given Self type and type variables
|
||||
/// for all other parameters, to query Chalk with it.
|
||||
fn generic_implements_goal(
|
||||
|
|
Loading…
Add table
Reference in a new issue