@@ -3380,11 +3380,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
3380
3380
fn report_cyclic_signature_error (
3381
3381
& self ,
3382
3382
obligation : & PredicateObligation < ' tcx > ,
3383
- found_trait_ref : ty:: Binder < ' tcx , ty :: TraitRef < ' tcx > > ,
3384
- expected_trait_ref : ty:: Binder < ' tcx , ty :: TraitRef < ' tcx > > ,
3383
+ found_trait_ref : ty:: TraitRef < ' tcx > ,
3384
+ expected_trait_ref : ty:: TraitRef < ' tcx > ,
3385
3385
terr : TypeError < ' tcx > ,
3386
3386
) -> Diag < ' tcx > {
3387
- let self_ty = found_trait_ref. self_ty ( ) . skip_binder ( ) ;
3387
+ let self_ty = found_trait_ref. self_ty ( ) ;
3388
3388
let ( cause, terr) = if let ty:: Closure ( def_id, _) = self_ty. kind ( ) {
3389
3389
(
3390
3390
ObligationCause :: dummy_with_span ( self . tcx . def_span ( def_id) ) ,
@@ -3394,7 +3394,12 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
3394
3394
( obligation. cause . clone ( ) , terr)
3395
3395
} ;
3396
3396
self . report_and_explain_type_error (
3397
- TypeTrace :: poly_trait_refs ( & cause, true , expected_trait_ref, found_trait_ref) ,
3397
+ TypeTrace :: poly_trait_refs (
3398
+ & cause,
3399
+ true ,
3400
+ ty:: Binder :: dummy ( expected_trait_ref) ,
3401
+ ty:: Binder :: dummy ( found_trait_ref) ,
3402
+ ) ,
3398
3403
terr,
3399
3404
)
3400
3405
}
@@ -3434,17 +3439,14 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
3434
3439
& self ,
3435
3440
obligation : & PredicateObligation < ' tcx > ,
3436
3441
span : Span ,
3437
- found_trait_ref : ty:: Binder < ' tcx , ty :: TraitRef < ' tcx > > ,
3438
- expected_trait_ref : ty:: Binder < ' tcx , ty :: TraitRef < ' tcx > > ,
3442
+ found_trait_ref : ty:: TraitRef < ' tcx > ,
3443
+ expected_trait_ref : ty:: TraitRef < ' tcx > ,
3439
3444
) -> Result < Diag < ' tcx > , ErrorGuaranteed > {
3440
3445
let found_trait_ref = self . resolve_vars_if_possible ( found_trait_ref) ;
3441
3446
let expected_trait_ref = self . resolve_vars_if_possible ( expected_trait_ref) ;
3442
3447
3443
3448
expected_trait_ref. self_ty ( ) . error_reported ( ) ?;
3444
-
3445
- let Some ( found_trait_ty) = found_trait_ref. self_ty ( ) . no_bound_vars ( ) else {
3446
- self . dcx ( ) . bug ( "bound vars outside binder" ) ;
3447
- } ;
3449
+ let found_trait_ty = found_trait_ref. self_ty ( ) ;
3448
3450
3449
3451
let found_did = match * found_trait_ty. kind ( ) {
3450
3452
ty:: Closure ( did, _) | ty:: FnDef ( did, _) | ty:: Coroutine ( did, ..) => Some ( did) ,
@@ -3462,15 +3464,15 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
3462
3464
3463
3465
let mut not_tupled = false ;
3464
3466
3465
- let found = match found_trait_ref. skip_binder ( ) . args . type_at ( 1 ) . kind ( ) {
3467
+ let found = match found_trait_ref. args . type_at ( 1 ) . kind ( ) {
3466
3468
ty:: Tuple ( tys) => vec ! [ ArgKind :: empty( ) ; tys. len( ) ] ,
3467
3469
_ => {
3468
3470
not_tupled = true ;
3469
3471
vec ! [ ArgKind :: empty( ) ]
3470
3472
}
3471
3473
} ;
3472
3474
3473
- let expected_ty = expected_trait_ref. skip_binder ( ) . args . type_at ( 1 ) ;
3475
+ let expected_ty = expected_trait_ref. args . type_at ( 1 ) ;
3474
3476
let expected = match expected_ty. kind ( ) {
3475
3477
ty:: Tuple ( tys) => {
3476
3478
tys. iter ( ) . map ( |t| ArgKind :: from_expected_ty ( t, Some ( span) ) ) . collect ( )
@@ -3487,15 +3489,15 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
3487
3489
// traits manually, but don't make it more confusing when it does
3488
3490
// happen.
3489
3491
Ok (
3490
- if Some ( expected_trait_ref. def_id ( ) ) != self . tcx . lang_items ( ) . coroutine_trait ( )
3492
+ if Some ( expected_trait_ref. def_id ) != self . tcx . lang_items ( ) . coroutine_trait ( )
3491
3493
&& not_tupled
3492
3494
{
3493
3495
self . report_and_explain_type_error (
3494
3496
TypeTrace :: poly_trait_refs (
3495
3497
& obligation. cause ,
3496
3498
true ,
3497
- expected_trait_ref,
3498
- found_trait_ref,
3499
+ ty :: Binder :: dummy ( expected_trait_ref) ,
3500
+ ty :: Binder :: dummy ( found_trait_ref) ,
3499
3501
) ,
3500
3502
ty:: error:: TypeError :: Mismatch ,
3501
3503
)
0 commit comments