mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Fix case where non FnOnce variables is marked callable
This commit is contained in:
parent
d01e412eb1
commit
08e95a5dc1
@ -1398,7 +1398,7 @@ impl Type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let canonical_ty = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) };
|
let canonical_ty = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) };
|
||||||
method_resolution::implements_trait(
|
method_resolution::implements_trait_unique(
|
||||||
&canonical_ty,
|
&canonical_ty,
|
||||||
db,
|
db,
|
||||||
self.ty.environment.clone(),
|
self.ty.environment.clone(),
|
||||||
|
@ -740,6 +740,19 @@ pub fn implements_trait(
|
|||||||
solution.is_some()
|
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
|
/// This creates Substs for a trait with the given Self type and type variables
|
||||||
/// for all other parameters, to query Chalk with it.
|
/// for all other parameters, to query Chalk with it.
|
||||||
fn generic_implements_goal(
|
fn generic_implements_goal(
|
||||||
|
Loading…
Reference in New Issue
Block a user