@@ -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 ;
@@ -838,15 +838,21 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
838
838
( _, ImplTraitLoweringMode :: Param | ImplTraitLoweringMode :: Variable ) => {
839
839
// Find the generic index for the target of our `bound`
840
840
let target_param_idx =
841
- self . ctx . resolver . where_predicates_in_scope ( ) . find_map ( | ( p , _ ) | {
842
- match p {
841
+ self . ctx . resolver . where_predicates_in_scope ( ) . find_map (
842
+ | ( p , ( _ , types_map ) ) | match p {
843
843
WherePredicate :: TypeBound {
844
844
target : WherePredicateTypeTarget :: TypeOrConstParam ( idx) ,
845
845
bound : b,
846
- } if b == bound => Some ( idx) ,
846
+ } if std:: ptr:: eq :: < TypesMap > (
847
+ self . ctx . types_map ,
848
+ types_map,
849
+ ) && bound == b =>
850
+ {
851
+ Some ( idx)
852
+ }
847
853
_ => None ,
848
- }
849
- } ) ;
854
+ } ,
855
+ ) ;
850
856
let ty = if let Some ( target_param_idx) = target_param_idx {
851
857
let mut counter = 0 ;
852
858
let generics = self . ctx . generics ( ) . expect ( "generics in scope" ) ;
0 commit comments