@@ -22,6 +22,7 @@ use rustc_data_structures::captures::Captures;
22
22
use rustc_index:: vec:: Idx ;
23
23
use rustc_index:: vec:: IndexVec ;
24
24
use rustc_middle:: arena:: ArenaAllocatable ;
25
+ use rustc_middle:: mir:: ConstraintCategory ;
25
26
use rustc_middle:: ty:: error:: TypeError ;
26
27
use rustc_middle:: ty:: fold:: TypeFoldable ;
27
28
use rustc_middle:: ty:: relate:: TypeRelation ;
@@ -248,6 +249,8 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
248
249
// the original values `v_o` that was canonicalized into a
249
250
// variable...
250
251
252
+ let constraint_category = ConstraintCategory :: BoringNoLocation ;
253
+
251
254
for ( index, original_value) in original_values. var_values . iter ( ) . enumerate ( ) {
252
255
// ...with the value `v_r` of that variable from the query.
253
256
let result_value = query_response. substitute_projected ( self . tcx , & result_subst, |v| {
@@ -263,12 +266,14 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
263
266
( GenericArgKind :: Lifetime ( v_o) , GenericArgKind :: Lifetime ( v_r) ) => {
264
267
// To make `v_o = v_r`, we emit `v_o: v_r` and `v_r: v_o`.
265
268
if v_o != v_r {
266
- output_query_region_constraints
267
- . outlives
268
- . push ( ty:: Binder :: dummy ( ty:: OutlivesPredicate ( v_o. into ( ) , v_r) ) ) ;
269
- output_query_region_constraints
270
- . outlives
271
- . push ( ty:: Binder :: dummy ( ty:: OutlivesPredicate ( v_r. into ( ) , v_o) ) ) ;
269
+ output_query_region_constraints. outlives . push ( (
270
+ ty:: Binder :: dummy ( ty:: OutlivesPredicate ( v_o. into ( ) , v_r) ) ,
271
+ constraint_category,
272
+ ) ) ;
273
+ output_query_region_constraints. outlives . push ( (
274
+ ty:: Binder :: dummy ( ty:: OutlivesPredicate ( v_r. into ( ) , v_o) ) ,
275
+ constraint_category,
276
+ ) ) ;
272
277
}
273
278
}
274
279
@@ -314,7 +319,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
314
319
// Screen out `'a: 'a` cases -- we skip the binder here but
315
320
// only compare the inner values to one another, so they are still at
316
321
// consistent binding levels.
317
- let ty:: OutlivesPredicate ( k1, r2) = r_c. skip_binder ( ) ;
322
+ let ty:: OutlivesPredicate ( k1, r2) = r_c. 0 . skip_binder ( ) ;
318
323
if k1 != r2. into ( ) { Some ( r_c) } else { None }
319
324
} ) ,
320
325
) ;
@@ -559,7 +564,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
559
564
cause : ObligationCause < ' tcx > ,
560
565
param_env : ty:: ParamEnv < ' tcx > ,
561
566
) -> Obligation < ' tcx , ty:: Predicate < ' tcx > > {
562
- let ty:: OutlivesPredicate ( k1, r2) = predicate. skip_binder ( ) ;
567
+ let ty:: OutlivesPredicate ( k1, r2) = predicate. 0 . skip_binder ( ) ;
563
568
564
569
let atom = match k1. unpack ( ) {
565
570
GenericArgKind :: Lifetime ( r1) => {
@@ -574,7 +579,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
574
579
span_bug ! ( cause. span, "unexpected const outlives {:?}" , predicate) ;
575
580
}
576
581
} ;
577
- let predicate = predicate. rebind ( atom) . to_predicate ( self . tcx ) ;
582
+ let predicate = predicate. 0 . rebind ( atom) . to_predicate ( self . tcx ) ;
578
583
579
584
Obligation :: new ( cause, param_env, predicate)
580
585
}
@@ -638,26 +643,34 @@ pub fn make_query_region_constraints<'tcx>(
638
643
639
644
let outlives: Vec < _ > = constraints
640
645
. iter ( )
641
- . map ( |( k, _) | match * k {
642
- // Swap regions because we are going from sub (<=) to outlives
643
- // (>=).
644
- Constraint :: VarSubVar ( v1, v2) => ty:: OutlivesPredicate (
645
- tcx. mk_region ( ty:: ReVar ( v2) ) . into ( ) ,
646
- tcx. mk_region ( ty:: ReVar ( v1) ) ,
647
- ) ,
648
- Constraint :: VarSubReg ( v1, r2) => {
649
- ty:: OutlivesPredicate ( r2. into ( ) , tcx. mk_region ( ty:: ReVar ( v1) ) )
650
- }
651
- Constraint :: RegSubVar ( r1, v2) => {
652
- ty:: OutlivesPredicate ( tcx. mk_region ( ty:: ReVar ( v2) ) . into ( ) , r1)
653
- }
654
- Constraint :: RegSubReg ( r1, r2) => ty:: OutlivesPredicate ( r2. into ( ) , r1) ,
646
+ . map ( |( k, _) | {
647
+ let constraint = ty:: Binder :: dummy ( match * k {
648
+ // Swap regions because we are going from sub (<=) to outlives
649
+ // (>=).
650
+ Constraint :: VarSubVar ( v1, v2) => ty:: OutlivesPredicate (
651
+ tcx. mk_region ( ty:: ReVar ( v2) ) . into ( ) ,
652
+ tcx. mk_region ( ty:: ReVar ( v1) ) ,
653
+ ) ,
654
+ Constraint :: VarSubReg ( v1, r2) => {
655
+ ty:: OutlivesPredicate ( r2. into ( ) , tcx. mk_region ( ty:: ReVar ( v1) ) )
656
+ }
657
+ Constraint :: RegSubVar ( r1, v2) => {
658
+ ty:: OutlivesPredicate ( tcx. mk_region ( ty:: ReVar ( v2) ) . into ( ) , r1)
659
+ }
660
+ Constraint :: RegSubReg ( r1, r2) => ty:: OutlivesPredicate ( r2. into ( ) , r1) ,
661
+ } ) ;
662
+
663
+ ( constraint, ConstraintCategory :: BoringNoLocation )
655
664
} )
656
- . map ( ty:: Binder :: dummy) // no bound vars in the code above
657
665
. chain (
658
666
outlives_obligations
659
- . map ( |( ty, r) | ty:: OutlivesPredicate ( ty. into ( ) , r) )
660
- . map ( ty:: Binder :: dummy) , // no bound vars in the code above
667
+ // no bound vars in the code above
668
+ . map ( |( ty, r) | {
669
+ (
670
+ ty:: Binder :: dummy ( ty:: OutlivesPredicate ( ty. into ( ) , r) ) ,
671
+ ConstraintCategory :: BoringNoLocation ,
672
+ )
673
+ } ) ,
661
674
)
662
675
. collect ( ) ;
663
676
0 commit comments