@@ -2235,8 +2235,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22352235 let target_ty = self
22362236 . autoderef ( sugg_span, rcvr_ty)
22372237 . find ( |( rcvr_ty, _) | {
2238- DeepRejectCtxt :: new ( self . tcx , TreatParams :: ForLookup )
2239- . types_may_unify ( * rcvr_ty, impl_ty)
2238+ DeepRejectCtxt :: new (
2239+ self . tcx ,
2240+ TreatParams :: AsRigid ,
2241+ TreatParams :: InstantiateWithInfer ,
2242+ )
2243+ . types_may_unify ( * rcvr_ty, impl_ty)
22402244 } )
22412245 . map_or ( impl_ty, |( ty, _) | ty)
22422246 . peel_refs ( ) ;
@@ -2498,7 +2502,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
24982502 . into_iter ( )
24992503 . any ( |info| self . associated_value ( info. def_id , item_name) . is_some ( ) ) ;
25002504 let found_assoc = |ty : Ty < ' tcx > | {
2501- simplify_type ( tcx, ty, TreatParams :: AsCandidateKey )
2505+ simplify_type ( tcx, ty, TreatParams :: InstantiateWithInfer )
25022506 . and_then ( |simp| {
25032507 tcx. incoherent_impls ( simp)
25042508 . into_iter ( )
@@ -3928,7 +3932,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
39283932 // cases where a positive bound implies a negative impl.
39293933 ( candidates, Vec :: new ( ) )
39303934 } else if let Some ( simp_rcvr_ty) =
3931- simplify_type ( self . tcx , rcvr_ty, TreatParams :: ForLookup )
3935+ simplify_type ( self . tcx , rcvr_ty, TreatParams :: AsRigid )
39323936 {
39333937 let mut potential_candidates = Vec :: new ( ) ;
39343938 let mut explicitly_negative = Vec :: new ( ) ;
@@ -3946,7 +3950,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
39463950 . any ( |header| {
39473951 let imp = header. trait_ref . instantiate_identity ( ) ;
39483952 let imp_simp =
3949- simplify_type ( self . tcx , imp. self_ty ( ) , TreatParams :: ForLookup ) ;
3953+ simplify_type ( self . tcx , imp. self_ty ( ) , TreatParams :: AsRigid ) ;
39503954 imp_simp. is_some_and ( |s| s == simp_rcvr_ty)
39513955 } )
39523956 {
0 commit comments