@@ -225,6 +225,50 @@ impl<'a, 'tcx> At<'a, 'tcx> {
225225 }
226226 }
227227
228+ /// Used in the new solver since we don't care about tracking an `ObligationCause`.
229+ pub fn relate_no_trace < T > (
230+ self ,
231+ expected : T ,
232+ variance : ty:: Variance ,
233+ actual : T ,
234+ ) -> Result < Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > , NoSolution >
235+ where
236+ T : Relate < TyCtxt < ' tcx > > ,
237+ {
238+ let mut fields = CombineFields :: new (
239+ self . infcx ,
240+ TypeTrace :: dummy ( self . cause ) ,
241+ self . param_env ,
242+ DefineOpaqueTypes :: Yes ,
243+ ) ;
244+ fields. sub ( ) . relate_with_variance (
245+ variance,
246+ ty:: VarianceDiagInfo :: default ( ) ,
247+ expected,
248+ actual,
249+ ) ?;
250+ Ok ( fields. goals )
251+ }
252+
253+ /// Used in the new solver since we don't care about tracking an `ObligationCause`.
254+ pub fn eq_structurally_relating_aliases_no_trace < T > (
255+ self ,
256+ expected : T ,
257+ actual : T ,
258+ ) -> Result < Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > , NoSolution >
259+ where
260+ T : Relate < TyCtxt < ' tcx > > ,
261+ {
262+ let mut fields = CombineFields :: new (
263+ self . infcx ,
264+ TypeTrace :: dummy ( self . cause ) ,
265+ self . param_env ,
266+ DefineOpaqueTypes :: Yes ,
267+ ) ;
268+ fields. equate ( StructurallyRelateAliases :: Yes ) . relate ( expected, actual) ?;
269+ Ok ( fields. goals )
270+ }
271+
228272 /// Computes the least-upper-bound, or mutual supertype, of two
229273 /// values. The order of the arguments doesn't matter, but since
230274 /// this can result in an error (e.g., if asked to compute LUB of
@@ -303,7 +347,7 @@ impl<'tcx> ToTrace<'tcx> for Ty<'tcx> {
303347 ) -> TypeTrace < ' tcx > {
304348 TypeTrace {
305349 cause : cause. clone ( ) ,
306- values : Terms ( ExpectedFound :: new ( a_is_expected, a. into ( ) , b. into ( ) ) ) ,
350+ values : ValuePairs :: Terms ( ExpectedFound :: new ( a_is_expected, a. into ( ) , b. into ( ) ) ) ,
307351 }
308352 }
309353}
@@ -315,7 +359,10 @@ impl<'tcx> ToTrace<'tcx> for ty::Region<'tcx> {
315359 a : Self ,
316360 b : Self ,
317361 ) -> TypeTrace < ' tcx > {
318- TypeTrace { cause : cause. clone ( ) , values : Regions ( ExpectedFound :: new ( a_is_expected, a, b) ) }
362+ TypeTrace {
363+ cause : cause. clone ( ) ,
364+ values : ValuePairs :: Regions ( ExpectedFound :: new ( a_is_expected, a, b) ) ,
365+ }
319366 }
320367}
321368
@@ -328,7 +375,7 @@ impl<'tcx> ToTrace<'tcx> for Const<'tcx> {
328375 ) -> TypeTrace < ' tcx > {
329376 TypeTrace {
330377 cause : cause. clone ( ) ,
331- values : Terms ( ExpectedFound :: new ( a_is_expected, a. into ( ) , b. into ( ) ) ) ,
378+ values : ValuePairs :: Terms ( ExpectedFound :: new ( a_is_expected, a. into ( ) , b. into ( ) ) ) ,
332379 }
333380 }
334381}
@@ -344,13 +391,13 @@ impl<'tcx> ToTrace<'tcx> for ty::GenericArg<'tcx> {
344391 cause : cause. clone ( ) ,
345392 values : match ( a. unpack ( ) , b. unpack ( ) ) {
346393 ( GenericArgKind :: Lifetime ( a) , GenericArgKind :: Lifetime ( b) ) => {
347- Regions ( ExpectedFound :: new ( a_is_expected, a, b) )
394+ ValuePairs :: Regions ( ExpectedFound :: new ( a_is_expected, a, b) )
348395 }
349396 ( GenericArgKind :: Type ( a) , GenericArgKind :: Type ( b) ) => {
350- Terms ( ExpectedFound :: new ( a_is_expected, a. into ( ) , b. into ( ) ) )
397+ ValuePairs :: Terms ( ExpectedFound :: new ( a_is_expected, a. into ( ) , b. into ( ) ) )
351398 }
352399 ( GenericArgKind :: Const ( a) , GenericArgKind :: Const ( b) ) => {
353- Terms ( ExpectedFound :: new ( a_is_expected, a. into ( ) , b. into ( ) ) )
400+ ValuePairs :: Terms ( ExpectedFound :: new ( a_is_expected, a. into ( ) , b. into ( ) ) )
354401 }
355402
356403 (
@@ -379,7 +426,10 @@ impl<'tcx> ToTrace<'tcx> for ty::Term<'tcx> {
379426 a : Self ,
380427 b : Self ,
381428 ) -> TypeTrace < ' tcx > {
382- TypeTrace { cause : cause. clone ( ) , values : Terms ( ExpectedFound :: new ( a_is_expected, a, b) ) }
429+ TypeTrace {
430+ cause : cause. clone ( ) ,
431+ values : ValuePairs :: Terms ( ExpectedFound :: new ( a_is_expected, a, b) ) ,
432+ }
383433 }
384434}
385435
@@ -392,7 +442,7 @@ impl<'tcx> ToTrace<'tcx> for ty::TraitRef<'tcx> {
392442 ) -> TypeTrace < ' tcx > {
393443 TypeTrace {
394444 cause : cause. clone ( ) ,
395- values : TraitRefs ( ExpectedFound :: new ( a_is_expected, a, b) ) ,
445+ values : ValuePairs :: TraitRefs ( ExpectedFound :: new ( a_is_expected, a, b) ) ,
396446 }
397447 }
398448}
@@ -406,7 +456,7 @@ impl<'tcx> ToTrace<'tcx> for ty::AliasTy<'tcx> {
406456 ) -> TypeTrace < ' tcx > {
407457 TypeTrace {
408458 cause : cause. clone ( ) ,
409- values : Aliases ( ExpectedFound :: new ( a_is_expected, a. into ( ) , b. into ( ) ) ) ,
459+ values : ValuePairs :: Aliases ( ExpectedFound :: new ( a_is_expected, a. into ( ) , b. into ( ) ) ) ,
410460 }
411461 }
412462}
@@ -418,7 +468,10 @@ impl<'tcx> ToTrace<'tcx> for ty::AliasTerm<'tcx> {
418468 a : Self ,
419469 b : Self ,
420470 ) -> TypeTrace < ' tcx > {
421- TypeTrace { cause : cause. clone ( ) , values : Aliases ( ExpectedFound :: new ( a_is_expected, a, b) ) }
471+ TypeTrace {
472+ cause : cause. clone ( ) ,
473+ values : ValuePairs :: Aliases ( ExpectedFound :: new ( a_is_expected, a, b) ) ,
474+ }
422475 }
423476}
424477
@@ -431,7 +484,7 @@ impl<'tcx> ToTrace<'tcx> for ty::FnSig<'tcx> {
431484 ) -> TypeTrace < ' tcx > {
432485 TypeTrace {
433486 cause : cause. clone ( ) ,
434- values : PolySigs ( ExpectedFound :: new (
487+ values : ValuePairs :: PolySigs ( ExpectedFound :: new (
435488 a_is_expected,
436489 ty:: Binder :: dummy ( a) ,
437490 ty:: Binder :: dummy ( b) ,
@@ -449,7 +502,7 @@ impl<'tcx> ToTrace<'tcx> for ty::PolyFnSig<'tcx> {
449502 ) -> TypeTrace < ' tcx > {
450503 TypeTrace {
451504 cause : cause. clone ( ) ,
452- values : PolySigs ( ExpectedFound :: new ( a_is_expected, a, b) ) ,
505+ values : ValuePairs :: PolySigs ( ExpectedFound :: new ( a_is_expected, a, b) ) ,
453506 }
454507 }
455508}
@@ -463,7 +516,7 @@ impl<'tcx> ToTrace<'tcx> for ty::PolyExistentialTraitRef<'tcx> {
463516 ) -> TypeTrace < ' tcx > {
464517 TypeTrace {
465518 cause : cause. clone ( ) ,
466- values : ExistentialTraitRef ( ExpectedFound :: new ( a_is_expected, a, b) ) ,
519+ values : ValuePairs :: ExistentialTraitRef ( ExpectedFound :: new ( a_is_expected, a, b) ) ,
467520 }
468521 }
469522}
@@ -477,7 +530,7 @@ impl<'tcx> ToTrace<'tcx> for ty::PolyExistentialProjection<'tcx> {
477530 ) -> TypeTrace < ' tcx > {
478531 TypeTrace {
479532 cause : cause. clone ( ) ,
480- values : ExistentialProjection ( ExpectedFound :: new ( a_is_expected, a, b) ) ,
533+ values : ValuePairs :: ExistentialProjection ( ExpectedFound :: new ( a_is_expected, a, b) ) ,
481534 }
482535 }
483536}
0 commit comments