aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/ty/autoderef.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs
index 11f489489..e85e558b2 100644
--- a/crates/ra_hir/src/ty/autoderef.rs
+++ b/crates/ra_hir/src/ty/autoderef.rs
@@ -7,7 +7,7 @@ use std::iter::successors;
7 7
8use log::{info, warn}; 8use log::{info, warn};
9 9
10use crate::{HirDatabase, Name, Resolver}; 10use crate::{HirDatabase, Name, Resolver, HasGenericParams};
11use super::{traits::Solution, Ty, Canonical}; 11use super::{traits::Solution, Ty, Canonical};
12 12
13pub(crate) fn autoderef<'a>( 13pub(crate) fn autoderef<'a>(
@@ -42,7 +42,12 @@ fn deref_by_trait(
42 }; 42 };
43 let target = deref_trait.associated_type_by_name(db, Name::target())?; 43 let target = deref_trait.associated_type_by_name(db, Name::target())?;
44 44
45 // FIXME we should check that Deref has no type parameters, because we assume it below 45 if target.generic_params(db).count_params_including_parent() != 1 {
46 // the Target type + Deref trait should only have one generic parameter,
47 // namely Deref's Self type
48 return None;
49 }
50
46 // FIXME make the Canonical handling nicer 51 // FIXME make the Canonical handling nicer
47 52
48 let projection = super::traits::ProjectionPredicate { 53 let projection = super::traits::ProjectionPredicate {