File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use std::iter::successors;
7
7
8
8
use log:: { info, warn} ;
9
9
10
- use crate :: { HirDatabase , Name , Resolver } ;
10
+ use crate :: { HirDatabase , Name , Resolver , HasGenericParams } ;
11
11
use super :: { traits:: Solution , Ty , Canonical } ;
12
12
13
13
pub ( crate ) fn autoderef < ' a > (
@@ -42,7 +42,12 @@ fn deref_by_trait(
42
42
} ;
43
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
51
// FIXME make the Canonical handling nicer
47
52
48
53
let projection = super :: traits:: ProjectionPredicate {
You can’t perform that action at this time.
0 commit comments