@@ -2235,8 +2235,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2235
2235
let target_ty = self
2236
2236
. autoderef ( sugg_span, rcvr_ty)
2237
2237
. 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)
2240
2244
} )
2241
2245
. map_or ( impl_ty, |( ty, _) | ty)
2242
2246
. peel_refs ( ) ;
@@ -2498,7 +2502,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2498
2502
. into_iter ( )
2499
2503
. any ( |info| self . associated_value ( info. def_id , item_name) . is_some ( ) ) ;
2500
2504
let found_assoc = |ty : Ty < ' tcx > | {
2501
- simplify_type ( tcx, ty, TreatParams :: AsCandidateKey )
2505
+ simplify_type ( tcx, ty, TreatParams :: InstantiateWithInfer )
2502
2506
. and_then ( |simp| {
2503
2507
tcx. incoherent_impls ( simp)
2504
2508
. into_iter ( )
@@ -3928,7 +3932,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3928
3932
// cases where a positive bound implies a negative impl.
3929
3933
( candidates, Vec :: new ( ) )
3930
3934
} 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 )
3932
3936
{
3933
3937
let mut potential_candidates = Vec :: new ( ) ;
3934
3938
let mut explicitly_negative = Vec :: new ( ) ;
@@ -3946,7 +3950,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3946
3950
. any ( |header| {
3947
3951
let imp = header. trait_ref . instantiate_identity ( ) ;
3948
3952
let imp_simp =
3949
- simplify_type ( self . tcx , imp. self_ty ( ) , TreatParams :: ForLookup ) ;
3953
+ simplify_type ( self . tcx , imp. self_ty ( ) , TreatParams :: AsRigid ) ;
3950
3954
imp_simp. is_some_and ( |s| s == simp_rcvr_ty)
3951
3955
} )
3952
3956
{
0 commit comments