Skip to content

Commit 887eae1

Browse files
committed
Add region constraints in recursive solver
1 parent 46658a6 commit 887eae1

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

chalk-solve/src/recursive/fulfill.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ use chalk_ir::interner::{HasInterner, Interner};
1010
use chalk_ir::zip::Zip;
1111
use chalk_ir::{debug, debug_heading};
1212
use chalk_ir::{
13-
Canonical, ConstrainedSubst, Constraint, Environment, EqGoal, Fallible, Goal, GoalData,
14-
InEnvironment, NoSolution, QuantifierKind, Substitution, UCanonical, UniverseMap,
13+
Canonical, ConstrainedSubst, Constraint, DomainGoal, Environment, EqGoal, Fallible, Goal,
14+
GoalData, InEnvironment, LifetimeOutlives, NoSolution, QuantifierKind, Substitution,
15+
UCanonical, UniverseMap, WhereClause,
1516
};
1617
use rustc_hash::FxHashSet;
1718
use std::fmt::Debug;
@@ -207,10 +208,18 @@ impl<'s, 'db, I: Interner> Fulfill<'s, 'db, I> {
207208
let in_env = InEnvironment::new(environment, subgoal.clone());
208209
self.push_obligation(Obligation::Refute(in_env));
209210
}
210-
GoalData::DomainGoal(_) => {
211-
let in_env = InEnvironment::new(environment, goal);
212-
self.push_obligation(Obligation::Prove(in_env));
213-
}
211+
GoalData::DomainGoal(domain_goal) => match domain_goal {
212+
DomainGoal::Holds(WhereClause::LifetimeOutlives(LifetimeOutlives { a, b })) => {
213+
self.constraints.insert(InEnvironment::new(
214+
&environment,
215+
Constraint::Outlives(a.clone(), b.clone()),
216+
));
217+
}
218+
_ => {
219+
let in_env = InEnvironment::new(environment, goal);
220+
self.push_obligation(Obligation::Prove(in_env));
221+
}
222+
},
214223
GoalData::EqGoal(EqGoal { a, b }) => {
215224
self.unify(&environment, &a, &b)?;
216225
}

tests/test/misc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ fn lifetime_outlives_constraints() {
627627
exists<'a, 'b> {
628628
Bar: Foo<'a, 'b>
629629
}
630-
} yields[SolverChoice::slg(10, None)] {
630+
} yields {
631631
"Unique; for<?U0,?U0> { substitution [?0 := '^0.0, ?1 := '^0.1], lifetime constraints [InEnvironment { environment: Env([]), goal: '^0.0: '^0.1 }] }"
632632
}
633633

@@ -637,7 +637,7 @@ fn lifetime_outlives_constraints() {
637637
Bar: Foo<'a, 'b>
638638
}
639639
}
640-
} yields[SolverChoice::slg(10, None)] {
640+
} yields {
641641
"Unique; for<?U1> { substitution [?0 := '^0.0], lifetime constraints [InEnvironment { environment: Env([]), goal: '!1_0: '^0.0 }] }"
642642
}
643643
}

0 commit comments

Comments
 (0)