diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index 2e2f88138..8731d6ba4 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -15,7 +15,7 @@ use crate::{ | |||
15 | resolve::Resolver, | 15 | resolve::Resolver, |
16 | traits::TraitItem, | 16 | traits::TraitItem, |
17 | ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy}, | 17 | ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy}, |
18 | ty::{Ty, TypeCtor, traits::Solution}, | 18 | ty::{traits::Solution, Ty, TypeCtor}, |
19 | Crate, Function, HirDatabase, Module, Name, Trait, | 19 | Crate, Function, HirDatabase, Module, Name, Trait, |
20 | }; | 20 | }; |
21 | 21 | ||
@@ -255,14 +255,20 @@ fn iterate_inherent_methods<T>( | |||
255 | None | 255 | None |
256 | } | 256 | } |
257 | 257 | ||
258 | pub(crate) fn implements_trait(ty: &Canonical<Ty>, db: &impl HirDatabase, resolver: &Resolver, krate: Crate, trait_: Trait) -> bool { | 258 | pub(crate) fn implements_trait( |
259 | ty: &Canonical<Ty>, | ||
260 | db: &impl HirDatabase, | ||
261 | resolver: &Resolver, | ||
262 | krate: Crate, | ||
263 | trait_: Trait, | ||
264 | ) -> bool { | ||
259 | let env = lower::trait_env(db, resolver); | 265 | let env = lower::trait_env(db, resolver); |
260 | let goal = generic_implements_goal(db, env.clone(), trait_, ty.clone()); | 266 | let goal = generic_implements_goal(db, env.clone(), trait_, ty.clone()); |
261 | let solution = db.trait_solve(krate, goal); | 267 | let solution = db.trait_solve(krate, goal); |
262 | 268 | ||
263 | if let Some(solution) = solution { | 269 | if let Some(solution) = solution { |
264 | if let Solution::Unique(_) = solution { | 270 | if let Solution::Unique(_) = solution { |
265 | return true | 271 | return true; |
266 | } | 272 | } |
267 | } | 273 | } |
268 | 274 | ||