aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/autoderef.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/autoderef.rs')
-rw-r--r--crates/ra_hir/src/ty/autoderef.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs
index 9e7593b8b..ae68234ac 100644
--- a/crates/ra_hir/src/ty/autoderef.rs
+++ b/crates/ra_hir/src/ty/autoderef.rs
@@ -10,7 +10,7 @@ use hir_expand::name;
10use log::{info, warn}; 10use log::{info, warn};
11use ra_db::CrateId; 11use ra_db::CrateId;
12 12
13use crate::{db::HirDatabase, Trait}; 13use crate::db::HirDatabase;
14 14
15use super::{ 15use super::{
16 traits::{InEnvironment, Solution}, 16 traits::{InEnvironment, Solution},
@@ -49,12 +49,12 @@ fn deref_by_trait(
49 ty: InEnvironment<&Canonical<Ty>>, 49 ty: InEnvironment<&Canonical<Ty>>,
50) -> Option<Canonical<Ty>> { 50) -> Option<Canonical<Ty>> {
51 let deref_trait = match db.lang_item(krate.into(), "deref".into())? { 51 let deref_trait = match db.lang_item(krate.into(), "deref".into())? {
52 LangItemTarget::TraitId(t) => Trait::from(t), 52 LangItemTarget::TraitId(it) => it,
53 _ => return None, 53 _ => return None,
54 }; 54 };
55 let target = deref_trait.associated_type_by_name(db, &name::TARGET_TYPE)?; 55 let target = db.trait_data(deref_trait).associated_type_by_name(&name::TARGET_TYPE)?;
56 56
57 let generic_params = db.generic_params(target.id.into()); 57 let generic_params = db.generic_params(target.into());
58 if generic_params.count_params_including_parent() != 1 { 58 if generic_params.count_params_including_parent() != 1 {
59 // the Target type + Deref trait should only have one generic parameter, 59 // the Target type + Deref trait should only have one generic parameter,
60 // namely Deref's Self type 60 // namely Deref's Self type
@@ -69,7 +69,7 @@ fn deref_by_trait(
69 69
70 let projection = super::traits::ProjectionPredicate { 70 let projection = super::traits::ProjectionPredicate {
71 ty: Ty::Bound(0), 71 ty: Ty::Bound(0),
72 projection_ty: super::ProjectionTy { associated_ty: target.id, parameters }, 72 projection_ty: super::ProjectionTy { associated_ty: target, parameters },
73 }; 73 };
74 74
75 let obligation = super::Obligation::Projection(projection); 75 let obligation = super::Obligation::Projection(projection);