@@ -2234,8 +2234,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22342234 let target_ty = self
22352235 . autoderef ( sugg_span, rcvr_ty)
22362236 . find ( |( rcvr_ty, _) | {
2237- DeepRejectCtxt :: new ( self . tcx , TreatParams :: ForLookup )
2238- . types_may_unify ( * rcvr_ty, impl_ty)
2237+ DeepRejectCtxt :: new (
2238+ self . tcx ,
2239+ TreatParams :: AsRigid ,
2240+ TreatParams :: InstantiateWithInfer ,
2241+ )
2242+ . types_may_unify ( * rcvr_ty, impl_ty)
22392243 } )
22402244 . map_or ( impl_ty, |( ty, _) | ty)
22412245 . peel_refs ( ) ;
@@ -2497,7 +2501,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
24972501 . into_iter ( )
24982502 . any ( |info| self . associated_value ( info. def_id , item_name) . is_some ( ) ) ;
24992503 let found_assoc = |ty : Ty < ' tcx > | {
2500- simplify_type ( tcx, ty, TreatParams :: AsCandidateKey )
2504+ simplify_type ( tcx, ty, TreatParams :: InstantiateWithInfer )
25012505 . and_then ( |simp| {
25022506 tcx. incoherent_impls ( simp)
25032507 . into_iter ( )
@@ -3927,7 +3931,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
39273931 // cases where a positive bound implies a negative impl.
39283932 ( candidates, Vec :: new ( ) )
39293933 } else if let Some ( simp_rcvr_ty) =
3930- simplify_type ( self . tcx , rcvr_ty, TreatParams :: ForLookup )
3934+ simplify_type ( self . tcx , rcvr_ty, TreatParams :: AsRigid )
39313935 {
39323936 let mut potential_candidates = Vec :: new ( ) ;
39333937 let mut explicitly_negative = Vec :: new ( ) ;
@@ -3945,7 +3949,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
39453949 . any ( |header| {
39463950 let imp = header. trait_ref . instantiate_identity ( ) ;
39473951 let imp_simp =
3948- simplify_type ( self . tcx , imp. self_ty ( ) , TreatParams :: ForLookup ) ;
3952+ simplify_type ( self . tcx , imp. self_ty ( ) , TreatParams :: AsRigid ) ;
39493953 imp_simp. is_some_and ( |s| s == simp_rcvr_ty)
39503954 } )
39513955 {
0 commit comments