diff options
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 b60e4bb31..41c99d227 100644 --- a/crates/ra_hir/src/ty/autoderef.rs +++ b/crates/ra_hir/src/ty/autoderef.rs | |||
@@ -5,12 +5,13 @@ | |||
5 | 5 | ||
6 | use std::iter::successors; | 6 | use std::iter::successors; |
7 | 7 | ||
8 | use hir_def::resolver::Resolver; | 8 | use hir_def::{lang_item::LangItemTarget, resolver::Resolver}; |
9 | use hir_expand::name; | 9 | use hir_expand::name; |
10 | use log::{info, warn}; | 10 | use log::{info, warn}; |
11 | 11 | ||
12 | use crate::{db::HirDatabase, Trait}; | ||
13 | |||
12 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; | 14 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; |
13 | use crate::db::HirDatabase; | ||
14 | 15 | ||
15 | const AUTODEREF_RECURSION_LIMIT: usize = 10; | 16 | const AUTODEREF_RECURSION_LIMIT: usize = 10; |
16 | 17 | ||
@@ -41,7 +42,7 @@ fn deref_by_trait( | |||
41 | ) -> Option<Canonical<Ty>> { | 42 | ) -> Option<Canonical<Ty>> { |
42 | let krate = resolver.krate()?; | 43 | let krate = resolver.krate()?; |
43 | let deref_trait = match db.lang_item(krate.into(), "deref".into())? { | 44 | let deref_trait = match db.lang_item(krate.into(), "deref".into())? { |
44 | crate::lang_item::LangItemTarget::Trait(t) => t, | 45 | LangItemTarget::TraitId(t) => Trait::from(t), |
45 | _ => return None, | 46 | _ => return None, |
46 | }; | 47 | }; |
47 | let target = deref_trait.associated_type_by_name(db, &name::TARGET_TYPE)?; | 48 | let target = deref_trait.associated_type_by_name(db, &name::TARGET_TYPE)?; |