@@ -92,12 +92,7 @@ impl<'tcx> InferCtxt<'tcx> {
9292}
9393
9494pub 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 > ;
10196}
10297
10398impl < ' a , ' tcx > At < ' a , ' tcx > {
@@ -116,7 +111,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
116111{
117112let mut fields = CombineFields :: new (
118113self . infcx ,
119- ToTrace :: to_trace ( self . cause , true , expected, actual) ,
114+ ToTrace :: to_trace ( self . cause , expected, actual) ,
120115self . param_env ,
121116 define_opaque_types,
122117) ;
@@ -136,7 +131,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
136131{
137132let mut fields = CombineFields :: new (
138133self . infcx ,
139- ToTrace :: to_trace ( self . cause , true , expected, actual) ,
134+ ToTrace :: to_trace ( self . cause , expected, actual) ,
140135self . param_env ,
141136 define_opaque_types,
142137) ;
@@ -154,10 +149,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
154149where
155150T : ToTrace < ' tcx > ,
156151{
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 (
161153 define_opaque_types,
162154ToTrace :: to_trace ( self . cause , expected, actual) ,
163155 expected,
@@ -209,7 +201,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
209201assert ! ( self . infcx. next_trait_solver( ) ) ;
210202let mut fields = CombineFields :: new (
211203self . infcx ,
212- ToTrace :: to_trace ( self . cause , true , expected, actual) ,
204+ ToTrace :: to_trace ( self . cause , expected, actual) ,
213205self . param_env ,
214206DefineOpaqueTypes :: Yes ,
215207) ;
@@ -301,7 +293,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
301293{
302294let mut fields = CombineFields :: new (
303295self . infcx ,
304- ToTrace :: to_trace ( self . cause , true , expected, actual) ,
296+ ToTrace :: to_trace ( self . cause , expected, actual) ,
305297self . param_env ,
306298 define_opaque_types,
307299) ;
@@ -323,7 +315,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
323315{
324316let mut fields = CombineFields :: new (
325317self . infcx ,
326- ToTrace :: to_trace ( self . cause , true , expected, actual) ,
318+ ToTrace :: to_trace ( self . cause , expected, actual) ,
327319self . param_env ,
328320 define_opaque_types,
329321) ;
@@ -333,18 +325,13 @@ impl<'a, 'tcx> At<'a, 'tcx> {
333325}
334326
335327impl < ' 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 > {
342329match ( a, b) {
343330( 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)
345332}
346333( 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)
348335}
349336( ImplSubject :: Trait ( _) , ImplSubject :: Inherent ( _) )
350337 | ( ImplSubject :: Inherent ( _) , ImplSubject :: Trait ( _) ) => {
@@ -355,65 +342,45 @@ impl<'tcx> ToTrace<'tcx> for ImplSubject<'tcx> {
355342}
356343
357344impl < ' 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 > {
364346TypeTrace {
365347cause : 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 ( ) ) ) ,
367349}
368350}
369351}
370352
371353impl < ' 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 > {
378355TypeTrace {
379356cause : cause. clone ( ) ,
380- values : ValuePairs :: Regions ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
357+ values : ValuePairs :: Regions ( ExpectedFound :: new ( true , a, b) ) ,
381358}
382359}
383360}
384361
385362impl < ' 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 > {
392364TypeTrace {
393365cause : 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 ( ) ) ) ,
395367}
396368}
397369}
398370
399371impl < ' 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 > {
406373TypeTrace {
407374cause : cause. clone ( ) ,
408375values : match ( a. unpack ( ) , b. unpack ( ) ) {
409376( GenericArgKind :: Lifetime ( a) , GenericArgKind :: Lifetime ( b) ) => {
410- ValuePairs :: Regions ( ExpectedFound :: new ( a_is_expected , a, b) )
377+ ValuePairs :: Regions ( ExpectedFound :: new ( true , a, b) )
411378}
412379( 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 ( ) ) )
414381}
415382( 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 ( ) ) )
417384}
418385
419386(
@@ -436,72 +403,47 @@ impl<'tcx> ToTrace<'tcx> for ty::GenericArg<'tcx> {
436403}
437404
438405impl < ' 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 > {
445407TypeTrace {
446408cause : cause. clone ( ) ,
447- values : ValuePairs :: Terms ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
409+ values : ValuePairs :: Terms ( ExpectedFound :: new ( true , a, b) ) ,
448410}
449411}
450412}
451413
452414impl < ' 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 > {
459416TypeTrace {
460417cause : cause. clone ( ) ,
461- values : ValuePairs :: TraitRefs ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
418+ values : ValuePairs :: TraitRefs ( ExpectedFound :: new ( true , a, b) ) ,
462419}
463420}
464421}
465422
466423impl < ' 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 > {
473425TypeTrace {
474426cause : 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 ( ) ) ) ,
476428}
477429}
478430}
479431
480432impl < ' 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 > {
487434TypeTrace {
488435cause : cause. clone ( ) ,
489- values : ValuePairs :: Aliases ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
436+ values : ValuePairs :: Aliases ( ExpectedFound :: new ( true , a, b) ) ,
490437}
491438}
492439}
493440
494441impl < ' 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 > {
501443TypeTrace {
502444cause : cause. clone ( ) ,
503445values : ValuePairs :: PolySigs ( ExpectedFound :: new (
504- a_is_expected ,
446+ true ,
505447 ty:: Binder :: dummy ( a) ,
506448 ty:: Binder :: dummy ( b) ,
507449) ) ,
@@ -510,43 +452,28 @@ impl<'tcx> ToTrace<'tcx> for ty::FnSig<'tcx> {
510452}
511453
512454impl < ' 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 > {
519456TypeTrace {
520457cause : cause. clone ( ) ,
521- values : ValuePairs :: PolySigs ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
458+ values : ValuePairs :: PolySigs ( ExpectedFound :: new ( true , a, b) ) ,
522459}
523460}
524461}
525462
526463impl < ' 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 > {
533465TypeTrace {
534466cause : cause. clone ( ) ,
535- values : ValuePairs :: ExistentialTraitRef ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
467+ values : ValuePairs :: ExistentialTraitRef ( ExpectedFound :: new ( true , a, b) ) ,
536468}
537469}
538470}
539471
540472impl < ' 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 > {
547474TypeTrace {
548475cause : cause. clone ( ) ,
549- values : ValuePairs :: ExistentialProjection ( ExpectedFound :: new ( a_is_expected , a, b) ) ,
476+ values : ValuePairs :: ExistentialProjection ( ExpectedFound :: new ( true , a, b) ) ,
550477}
551478}
552479}
0 commit comments