@@ -92,12 +92,7 @@ impl<'tcx> InferCtxt<'tcx> {
92
92
}
93
93
94
94
pub trait ToTrace < ' tcx > : Relate < TyCtxt < ' tcx > > + Copy {
95
- fn to_trace (
96
- cause : & ObligationCause < ' tcx > ,
97
- a_is_expected : bool ,
98
- a : Self ,
99
- b : Self ,
100
- ) -> TypeTrace < ' tcx > ;
95
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > ;
101
96
}
102
97
103
98
impl < ' a , ' tcx > At < ' a , ' tcx > {
@@ -116,7 +111,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
116
111
{
117
112
let mut fields = CombineFields :: new (
118
113
self . infcx ,
119
- ToTrace :: to_trace ( self . cause , true , expected, actual) ,
114
+ ToTrace :: to_trace ( self . cause , expected, actual) ,
120
115
self . param_env ,
121
116
define_opaque_types,
122
117
) ;
@@ -136,7 +131,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
136
131
{
137
132
let mut fields = CombineFields :: new (
138
133
self . infcx ,
139
- ToTrace :: to_trace ( self . cause , true , expected, actual) ,
134
+ ToTrace :: to_trace ( self . cause , expected, actual) ,
140
135
self . param_env ,
141
136
define_opaque_types,
142
137
) ;
@@ -154,10 +149,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
154
149
where
155
150
T : ToTrace < ' tcx > ,
156
151
{
157
- let mut fields = CombineFields :: new (
158
- self . infcx ,
159
- ToTrace :: to_trace ( self . cause , true , expected, actual) ,
160
- self . param_env ,
152
+ self . eq_trace (
161
153
define_opaque_types,
162
154
ToTrace :: to_trace ( self . cause , expected, actual) ,
163
155
expected,
@@ -209,7 +201,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
209
201
assert ! ( self . infcx. next_trait_solver( ) ) ;
210
202
let mut fields = CombineFields :: new (
211
203
self . infcx ,
212
- ToTrace :: to_trace ( self . cause , true , expected, actual) ,
204
+ ToTrace :: to_trace ( self . cause , expected, actual) ,
213
205
self . param_env ,
214
206
DefineOpaqueTypes :: Yes ,
215
207
) ;
@@ -301,7 +293,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
301
293
{
302
294
let mut fields = CombineFields :: new (
303
295
self . infcx ,
304
- ToTrace :: to_trace ( self . cause , true , expected, actual) ,
296
+ ToTrace :: to_trace ( self . cause , expected, actual) ,
305
297
self . param_env ,
306
298
define_opaque_types,
307
299
) ;
@@ -323,7 +315,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
323
315
{
324
316
let mut fields = CombineFields :: new (
325
317
self . infcx ,
326
- ToTrace :: to_trace ( self . cause , true , expected, actual) ,
318
+ ToTrace :: to_trace ( self . cause , expected, actual) ,
327
319
self . param_env ,
328
320
define_opaque_types,
329
321
) ;
@@ -333,18 +325,13 @@ impl<'a, 'tcx> At<'a, 'tcx> {
333
325
}
334
326
335
327
impl < ' tcx > ToTrace < ' tcx > for ImplSubject < ' tcx > {
336
- fn to_trace (
337
- cause : & ObligationCause < ' tcx > ,
338
- a_is_expected : bool ,
339
- a : Self ,
340
- b : Self ,
341
- ) -> TypeTrace < ' tcx > {
328
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
342
329
match ( a, b) {
343
330
( ImplSubject :: Trait ( trait_ref_a) , ImplSubject :: Trait ( trait_ref_b) ) => {
344
- ToTrace :: to_trace ( cause, a_is_expected , trait_ref_a, trait_ref_b)
331
+ ToTrace :: to_trace ( cause, trait_ref_a, trait_ref_b)
345
332
}
346
333
( ImplSubject :: Inherent ( ty_a) , ImplSubject :: Inherent ( ty_b) ) => {
347
- ToTrace :: to_trace ( cause, a_is_expected , ty_a, ty_b)
334
+ ToTrace :: to_trace ( cause, ty_a, ty_b)
348
335
}
349
336
( ImplSubject :: Trait ( _) , ImplSubject :: Inherent ( _) )
350
337
| ( ImplSubject :: Inherent ( _) , ImplSubject :: Trait ( _) ) => {
@@ -355,65 +342,45 @@ impl<'tcx> ToTrace<'tcx> for ImplSubject<'tcx> {
355
342
}
356
343
357
344
impl < ' tcx > ToTrace < ' tcx > for Ty < ' tcx > {
358
- fn to_trace (
359
- cause : & ObligationCause < ' tcx > ,
360
- a_is_expected : bool ,
361
- a : Self ,
362
- b : Self ,
363
- ) -> TypeTrace < ' tcx > {
345
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
364
346
TypeTrace {
365
347
cause : cause. clone ( ) ,
366
- values : ValuePairs :: Terms ( ExpectedFound :: new ( a_is_expected , a. into ( ) , b. into ( ) ) ) ,
348
+ values : ValuePairs :: Terms ( ExpectedFound :: new ( true , a. into ( ) , b. into ( ) ) ) ,
367
349
}
368
350
}
369
351
}
370
352
371
353
impl < ' tcx > ToTrace < ' tcx > for ty:: Region < ' tcx > {
372
- fn to_trace (
373
- cause : & ObligationCause < ' tcx > ,
374
- a_is_expected : bool ,
375
- a : Self ,
376
- b : Self ,
377
- ) -> TypeTrace < ' tcx > {
354
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
378
355
TypeTrace {
379
356
cause : cause. clone ( ) ,
380
- values : ValuePairs :: Regions ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
357
+ values : ValuePairs :: Regions ( ExpectedFound :: new ( true , a, b) ) ,
381
358
}
382
359
}
383
360
}
384
361
385
362
impl < ' tcx > ToTrace < ' tcx > for Const < ' tcx > {
386
- fn to_trace (
387
- cause : & ObligationCause < ' tcx > ,
388
- a_is_expected : bool ,
389
- a : Self ,
390
- b : Self ,
391
- ) -> TypeTrace < ' tcx > {
363
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
392
364
TypeTrace {
393
365
cause : cause. clone ( ) ,
394
- values : ValuePairs :: Terms ( ExpectedFound :: new ( a_is_expected , a. into ( ) , b. into ( ) ) ) ,
366
+ values : ValuePairs :: Terms ( ExpectedFound :: new ( true , a. into ( ) , b. into ( ) ) ) ,
395
367
}
396
368
}
397
369
}
398
370
399
371
impl < ' tcx > ToTrace < ' tcx > for ty:: GenericArg < ' tcx > {
400
- fn to_trace (
401
- cause : & ObligationCause < ' tcx > ,
402
- a_is_expected : bool ,
403
- a : Self ,
404
- b : Self ,
405
- ) -> TypeTrace < ' tcx > {
372
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
406
373
TypeTrace {
407
374
cause : cause. clone ( ) ,
408
375
values : match ( a. unpack ( ) , b. unpack ( ) ) {
409
376
( GenericArgKind :: Lifetime ( a) , GenericArgKind :: Lifetime ( b) ) => {
410
- ValuePairs :: Regions ( ExpectedFound :: new ( a_is_expected , a, b) )
377
+ ValuePairs :: Regions ( ExpectedFound :: new ( true , a, b) )
411
378
}
412
379
( GenericArgKind :: Type ( a) , GenericArgKind :: Type ( b) ) => {
413
- ValuePairs :: Terms ( ExpectedFound :: new ( a_is_expected , a. into ( ) , b. into ( ) ) )
380
+ ValuePairs :: Terms ( ExpectedFound :: new ( true , a. into ( ) , b. into ( ) ) )
414
381
}
415
382
( GenericArgKind :: Const ( a) , GenericArgKind :: Const ( b) ) => {
416
- ValuePairs :: Terms ( ExpectedFound :: new ( a_is_expected , a. into ( ) , b. into ( ) ) )
383
+ ValuePairs :: Terms ( ExpectedFound :: new ( true , a. into ( ) , b. into ( ) ) )
417
384
}
418
385
419
386
(
@@ -436,72 +403,47 @@ impl<'tcx> ToTrace<'tcx> for ty::GenericArg<'tcx> {
436
403
}
437
404
438
405
impl < ' tcx > ToTrace < ' tcx > for ty:: Term < ' tcx > {
439
- fn to_trace (
440
- cause : & ObligationCause < ' tcx > ,
441
- a_is_expected : bool ,
442
- a : Self ,
443
- b : Self ,
444
- ) -> TypeTrace < ' tcx > {
406
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
445
407
TypeTrace {
446
408
cause : cause. clone ( ) ,
447
- values : ValuePairs :: Terms ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
409
+ values : ValuePairs :: Terms ( ExpectedFound :: new ( true , a, b) ) ,
448
410
}
449
411
}
450
412
}
451
413
452
414
impl < ' tcx > ToTrace < ' tcx > for ty:: TraitRef < ' tcx > {
453
- fn to_trace (
454
- cause : & ObligationCause < ' tcx > ,
455
- a_is_expected : bool ,
456
- a : Self ,
457
- b : Self ,
458
- ) -> TypeTrace < ' tcx > {
415
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
459
416
TypeTrace {
460
417
cause : cause. clone ( ) ,
461
- values : ValuePairs :: TraitRefs ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
418
+ values : ValuePairs :: TraitRefs ( ExpectedFound :: new ( true , a, b) ) ,
462
419
}
463
420
}
464
421
}
465
422
466
423
impl < ' tcx > ToTrace < ' tcx > for ty:: AliasTy < ' tcx > {
467
- fn to_trace (
468
- cause : & ObligationCause < ' tcx > ,
469
- a_is_expected : bool ,
470
- a : Self ,
471
- b : Self ,
472
- ) -> TypeTrace < ' tcx > {
424
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
473
425
TypeTrace {
474
426
cause : cause. clone ( ) ,
475
- values : ValuePairs :: Aliases ( ExpectedFound :: new ( a_is_expected , a. into ( ) , b. into ( ) ) ) ,
427
+ values : ValuePairs :: Aliases ( ExpectedFound :: new ( true , a. into ( ) , b. into ( ) ) ) ,
476
428
}
477
429
}
478
430
}
479
431
480
432
impl < ' tcx > ToTrace < ' tcx > for ty:: AliasTerm < ' tcx > {
481
- fn to_trace (
482
- cause : & ObligationCause < ' tcx > ,
483
- a_is_expected : bool ,
484
- a : Self ,
485
- b : Self ,
486
- ) -> TypeTrace < ' tcx > {
433
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
487
434
TypeTrace {
488
435
cause : cause. clone ( ) ,
489
- values : ValuePairs :: Aliases ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
436
+ values : ValuePairs :: Aliases ( ExpectedFound :: new ( true , a, b) ) ,
490
437
}
491
438
}
492
439
}
493
440
494
441
impl < ' tcx > ToTrace < ' tcx > for ty:: FnSig < ' tcx > {
495
- fn to_trace (
496
- cause : & ObligationCause < ' tcx > ,
497
- a_is_expected : bool ,
498
- a : Self ,
499
- b : Self ,
500
- ) -> TypeTrace < ' tcx > {
442
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
501
443
TypeTrace {
502
444
cause : cause. clone ( ) ,
503
445
values : ValuePairs :: PolySigs ( ExpectedFound :: new (
504
- a_is_expected ,
446
+ true ,
505
447
ty:: Binder :: dummy ( a) ,
506
448
ty:: Binder :: dummy ( b) ,
507
449
) ) ,
@@ -510,43 +452,28 @@ impl<'tcx> ToTrace<'tcx> for ty::FnSig<'tcx> {
510
452
}
511
453
512
454
impl < ' tcx > ToTrace < ' tcx > for ty:: PolyFnSig < ' tcx > {
513
- fn to_trace (
514
- cause : & ObligationCause < ' tcx > ,
515
- a_is_expected : bool ,
516
- a : Self ,
517
- b : Self ,
518
- ) -> TypeTrace < ' tcx > {
455
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
519
456
TypeTrace {
520
457
cause : cause. clone ( ) ,
521
- values : ValuePairs :: PolySigs ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
458
+ values : ValuePairs :: PolySigs ( ExpectedFound :: new ( true , a, b) ) ,
522
459
}
523
460
}
524
461
}
525
462
526
463
impl < ' tcx > ToTrace < ' tcx > for ty:: PolyExistentialTraitRef < ' tcx > {
527
- fn to_trace (
528
- cause : & ObligationCause < ' tcx > ,
529
- a_is_expected : bool ,
530
- a : Self ,
531
- b : Self ,
532
- ) -> TypeTrace < ' tcx > {
464
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
533
465
TypeTrace {
534
466
cause : cause. clone ( ) ,
535
- values : ValuePairs :: ExistentialTraitRef ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
467
+ values : ValuePairs :: ExistentialTraitRef ( ExpectedFound :: new ( true , a, b) ) ,
536
468
}
537
469
}
538
470
}
539
471
540
472
impl < ' tcx > ToTrace < ' tcx > for ty:: PolyExistentialProjection < ' tcx > {
541
- fn to_trace (
542
- cause : & ObligationCause < ' tcx > ,
543
- a_is_expected : bool ,
544
- a : Self ,
545
- b : Self ,
546
- ) -> TypeTrace < ' tcx > {
473
+ fn to_trace ( cause : & ObligationCause < ' tcx > , a : Self , b : Self ) -> TypeTrace < ' tcx > {
547
474
TypeTrace {
548
475
cause : cause. clone ( ) ,
549
- values : ValuePairs :: ExistentialProjection ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
476
+ values : ValuePairs :: ExistentialProjection ( ExpectedFound :: new ( true , a, b) ) ,
550
477
}
551
478
}
552
479
}
0 commit comments