Skip to content

Commit 0e94e3d

Browse files
committed
add a fast path
1 parent 2e759c1 commit 0e94e3d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

chalk-recursive/src/solve.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ trait SolveIterationHelpers<I: Interner>: SolveDatabase<I> {
179179
} else {
180180
debug!("Error");
181181
}
182+
183+
if let Some((cur_solution, _)) = cur_solution {
184+
if cur_solution.is_trivial_and_always_true(self.interner()) {
185+
break;
186+
}
187+
}
182188
}
183189

184190
if let Some((s, _)) = cur_solution {

chalk-solve/src/solve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<I: Interner> Solution<I> {
101101
Solution::Ambig(guidance)
102102
}
103103

104-
fn is_trivial_and_always_true(&self, interner: I) -> bool {
104+
pub fn is_trivial_and_always_true(&self, interner: I) -> bool {
105105
match self {
106106
Solution::Unique(constrained_subst) => {
107107
constrained_subst.value.subst.is_identity_subst(interner)

0 commit comments

Comments
 (0)