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