@@ -92,6 +92,26 @@ impl<I: Interner> context::ResolventOps<I, SlgContext<I>> for TruncatingInferenc
9292 debug ! ( "consequence = {:?}" , consequence) ;
9393 debug ! ( "conditions = {:?}" , conditions) ;
9494
95+ let constraints = conditions
96+ . iter ( interner)
97+ . filter_map ( |c| match c. data ( interner) {
98+ GoalData :: DomainGoal ( DomainGoal :: Holds ( WhereClause :: LifetimeOutlives ( a, b) ) ) => {
99+ Some ( InEnvironment :: new (
100+ environment,
101+ Constraint :: Outlives ( a. clone ( ) , b. clone ( ) ) ,
102+ ) )
103+ }
104+ GoalData :: Not ( c1) => match c1. data ( interner) {
105+ GoalData :: DomainGoal ( DomainGoal :: Holds ( WhereClause :: LifetimeOutlives (
106+ _a,
107+ _b,
108+ ) ) ) => panic ! ( "Not allowed." ) ,
109+ _ => None ,
110+ } ,
111+ _ => None ,
112+ } )
113+ . collect ( ) ;
114+
95115 // Unify the selected literal Li with C'.
96116 let unification_result = self
97117 . infer
@@ -101,7 +121,7 @@ impl<I: Interner> context::ResolventOps<I, SlgContext<I>> for TruncatingInferenc
101121 let mut ex_clause = ExClause {
102122 subst : subst. clone ( ) ,
103123 ambiguous : false ,
104- constraints : vec ! [ ] ,
124+ constraints,
105125 subgoals : vec ! [ ] ,
106126 delayed_subgoals : vec ! [ ] ,
107127 answer_time : TimeStamp :: default ( ) ,
@@ -111,15 +131,26 @@ impl<I: Interner> context::ResolventOps<I, SlgContext<I>> for TruncatingInferenc
111131 // Add the subgoals/region-constraints that unification gave us.
112132 slg:: into_ex_clause ( interner, unification_result, & mut ex_clause) ;
113133
114- // Add the `conditions` from the program clause into the result too.
115- ex_clause
116- . subgoals
117- . extend ( conditions. iter ( interner) . map ( |c| match c. data ( interner) {
134+ let conditions_iter = conditions
135+ . iter ( interner)
136+ . filter ( |c| match c. data ( interner) {
137+ GoalData :: DomainGoal ( DomainGoal :: Holds ( WhereClause :: LifetimeOutlives ( ..) ) ) => false ,
138+ GoalData :: Not ( c1) => match c1. data ( interner) {
139+ GoalData :: DomainGoal ( DomainGoal :: Holds ( WhereClause :: LifetimeOutlives ( ..) ) ) => {
140+ false
141+ }
142+ _ => true ,
143+ } ,
144+ _ => true ,
145+ } )
146+ . map ( |c| match c. data ( interner) {
118147 GoalData :: Not ( c1) => {
119148 Literal :: Negative ( InEnvironment :: new ( environment, Goal :: clone ( c1) ) )
120149 }
121150 _ => Literal :: Positive ( InEnvironment :: new ( environment, Goal :: clone ( c) ) ) ,
122- } ) ) ;
151+ } ) ;
152+ // Add the `conditions` from the program clause into the result too.
153+ ex_clause. subgoals . extend ( conditions_iter) ;
123154
124155 Ok ( ex_clause)
125156 }
0 commit comments