@@ -21,7 +21,7 @@ use crate::infer::canonical::{
21
21
Canonical , CanonicalQueryResponse , CanonicalVarValues , Certainty , OriginalQueryValues ,
22
22
QueryRegionConstraints , QueryResponse ,
23
23
} ;
24
- use crate :: infer:: region_constraints:: { Constraint , RegionConstraintData } ;
24
+ use crate :: infer:: region_constraints:: RegionConstraintData ;
25
25
use crate :: infer:: {
26
26
DefineOpaqueTypes , InferCtxt , InferOk , InferResult , SubregionOrigin , TypeOutlivesConstraint ,
27
27
} ;
@@ -105,8 +105,6 @@ impl<'tcx> InferCtxt<'tcx> {
105
105
where
106
106
T : Debug + TypeFoldable < TyCtxt < ' tcx > > ,
107
107
{
108
- let tcx = self . tcx ;
109
-
110
108
// Select everything, returning errors.
111
109
let errors = fulfill_cx. select_all_or_error ( self ) ;
112
110
@@ -120,7 +118,6 @@ impl<'tcx> InferCtxt<'tcx> {
120
118
debug ! ( ?region_obligations) ;
121
119
let region_constraints = self . with_region_constraints ( |region_constraints| {
122
120
make_query_region_constraints (
123
- tcx,
124
121
region_obligations,
125
122
region_constraints,
126
123
region_assumptions,
@@ -587,7 +584,6 @@ impl<'tcx> InferCtxt<'tcx> {
587
584
/// Given the region obligations and constraints scraped from the infcx,
588
585
/// creates query region constraints.
589
586
pub fn make_query_region_constraints < ' tcx > (
590
- tcx : TyCtxt < ' tcx > ,
591
587
outlives_obligations : Vec < TypeOutlivesConstraint < ' tcx > > ,
592
588
region_constraints : & RegionConstraintData < ' tcx > ,
593
589
assumptions : Vec < ty:: ArgOutlivesPredicate < ' tcx > > ,
@@ -600,22 +596,9 @@ pub fn make_query_region_constraints<'tcx>(
600
596
601
597
let outlives: Vec < _ > = constraints
602
598
. iter ( )
603
- . map ( |( k, origin) | {
604
- let constraint = match * k {
605
- // Swap regions because we are going from sub (<=) to outlives
606
- // (>=).
607
- Constraint :: VarSubVar ( v1, v2) => ty:: OutlivesPredicate (
608
- ty:: Region :: new_var ( tcx, v2) . into ( ) ,
609
- ty:: Region :: new_var ( tcx, v1) ,
610
- ) ,
611
- Constraint :: VarSubReg ( v1, r2) => {
612
- ty:: OutlivesPredicate ( r2. into ( ) , ty:: Region :: new_var ( tcx, v1) )
613
- }
614
- Constraint :: RegSubVar ( r1, v2) => {
615
- ty:: OutlivesPredicate ( ty:: Region :: new_var ( tcx, v2) . into ( ) , r1)
616
- }
617
- Constraint :: RegSubReg ( r1, r2) => ty:: OutlivesPredicate ( r2. into ( ) , r1) ,
618
- } ;
599
+ . map ( |( c, origin) | {
600
+ // Swap regions because we are going from sub (<=) to outlives (>=).
601
+ let constraint = ty:: OutlivesPredicate ( c. sup . into ( ) , c. sub ) ;
619
602
( constraint, origin. to_constraint_category ( ) )
620
603
} )
621
604
. chain ( outlives_obligations. into_iter ( ) . map ( |obl| {
0 commit comments