diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-21 12:50:12 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-21 12:50:12 +0000 |
commit | 1f61915bde4c5d8d4fe2e9b8dfa9445008730b79 (patch) | |
tree | a6fd0b6ad8b6c87d28e6e1b36bb9b2fbae2c1b09 /crates/ra_hir/src/ty/autoderef.rs | |
parent | 612a72fc4ea4376920f2a7da7b3c334227c1716c (diff) | |
parent | c37d1c5b381365ce2d07dfe4b871e43995ccea2d (diff) |
Merge #2337
2337: Move resolver to hir_def r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/autoderef.rs')
-rw-r--r-- | crates/ra_hir/src/ty/autoderef.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs index 872a4517d..5d8518041 100644 --- a/crates/ra_hir/src/ty/autoderef.rs +++ b/crates/ra_hir/src/ty/autoderef.rs | |||
@@ -5,11 +5,12 @@ | |||
5 | 5 | ||
6 | use std::iter::successors; | 6 | use std::iter::successors; |
7 | 7 | ||
8 | use hir_def::resolver::Resolver; | ||
8 | use hir_expand::name; | 9 | use hir_expand::name; |
9 | use log::{info, warn}; | 10 | use log::{info, warn}; |
10 | 11 | ||
11 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; | 12 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; |
12 | use crate::{db::HirDatabase, generics::HasGenericParams, Resolver}; | 13 | use crate::{db::HirDatabase, generics::HasGenericParams}; |
13 | 14 | ||
14 | const AUTODEREF_RECURSION_LIMIT: usize = 10; | 15 | const AUTODEREF_RECURSION_LIMIT: usize = 10; |
15 | 16 | ||
@@ -39,7 +40,7 @@ fn deref_by_trait( | |||
39 | ty: &Canonical<Ty>, | 40 | ty: &Canonical<Ty>, |
40 | ) -> Option<Canonical<Ty>> { | 41 | ) -> Option<Canonical<Ty>> { |
41 | let krate = resolver.krate()?; | 42 | let krate = resolver.krate()?; |
42 | let deref_trait = match db.lang_item(krate, "deref".into())? { | 43 | let deref_trait = match db.lang_item(krate.into(), "deref".into())? { |
43 | crate::lang_item::LangItemTarget::Trait(t) => t, | 44 | crate::lang_item::LangItemTarget::Trait(t) => t, |
44 | _ => return None, | 45 | _ => return None, |
45 | }; | 46 | }; |
@@ -71,7 +72,7 @@ fn deref_by_trait( | |||
71 | 72 | ||
72 | let canonical = super::Canonical { num_vars: 1 + ty.num_vars, value: in_env }; | 73 | let canonical = super::Canonical { num_vars: 1 + ty.num_vars, value: in_env }; |
73 | 74 | ||
74 | let solution = db.trait_solve(krate, canonical)?; | 75 | let solution = db.trait_solve(krate.into(), canonical)?; |
75 | 76 | ||
76 | match &solution { | 77 | match &solution { |
77 | Solution::Unique(vars) => { | 78 | Solution::Unique(vars) => { |