@@ -10,7 +10,7 @@ use hir_def::{
10
10
generics:: { TypeParamProvenance , WherePredicate , WherePredicateTypeTarget } ,
11
11
path:: { GenericArg , GenericArgs , Path , PathSegment , PathSegments } ,
12
12
resolver:: { ResolveValueResult , TypeNs , ValueNs } ,
13
- type_ref:: { TypeBound , TypeRef } ,
13
+ type_ref:: { TypeBound , TypeRef , TypesMap } ,
14
14
GenericDefId , GenericParamId , ItemContainerId , Lookup , TraitId ,
15
15
} ;
16
16
use smallvec:: SmallVec ;
@@ -837,17 +837,22 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
837
837
}
838
838
( _, ImplTraitLoweringMode :: Param | ImplTraitLoweringMode :: Variable ) => {
839
839
// Find the generic index for the target of our `bound`
840
- let target_param_idx = self
841
- . ctx
842
- . resolver
843
- . where_predicates_in_scope ( )
844
- . find_map ( |( p, ( _, types_map) ) | match p {
845
- WherePredicate :: TypeBound {
846
- target : WherePredicateTypeTarget :: TypeOrConstParam ( idx) ,
847
- bound : b,
848
- } if b == bound && self . ctx . types_map == types_map => Some ( idx) ,
849
- _ => None ,
850
- } ) ;
840
+ let target_param_idx =
841
+ self . ctx . resolver . where_predicates_in_scope ( ) . find_map (
842
+ |( p, ( _, types_map) ) | match p {
843
+ WherePredicate :: TypeBound {
844
+ target : WherePredicateTypeTarget :: TypeOrConstParam ( idx) ,
845
+ bound : b,
846
+ } if std:: ptr:: eq :: < TypesMap > (
847
+ self . ctx . types_map ,
848
+ types_map,
849
+ ) && bound == b =>
850
+ {
851
+ Some ( idx)
852
+ }
853
+ _ => None ,
854
+ } ,
855
+ ) ;
851
856
let ty = if let Some ( target_param_idx) = target_param_idx {
852
857
let mut counter = 0 ;
853
858
let generics = self . ctx . generics ( ) . expect ( "generics in scope" ) ;
0 commit comments