Skip to content

Commit

Permalink
add a fast path
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Mar 16, 2022
1 parent 2e759c1 commit 0e94e3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions chalk-recursive/src/solve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ trait SolveIterationHelpers<I: Interner>: SolveDatabase<I> {
} else {
debug!("Error");
}

if let Some((cur_solution, _)) = cur_solution {
if cur_solution.is_trivial_and_always_true(self.interner()) {
break;
}
}
}

if let Some((s, _)) = cur_solution {
Expand Down
2 changes: 1 addition & 1 deletion chalk-solve/src/solve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl<I: Interner> Solution<I> {
Solution::Ambig(guidance)
}

fn is_trivial_and_always_true(&self, interner: I) -> bool {
pub fn is_trivial_and_always_true(&self, interner: I) -> bool {
match self {
Solution::Unique(constrained_subst) => {
constrained_subst.value.subst.is_identity_subst(interner)
Expand Down

0 comments on commit 0e94e3d

Please sign in to comment.