Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto traits #54

Merged
merged 14 commits into from
Jul 17, 2017
7 changes: 6 additions & 1 deletion src/solve/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,12 @@ impl Solver {
// if all the components of the cycle also have coinductive semantics, we accept
// the cycle `(?0: AutoTrait) :- ... :- (?0: AutoTrait)` as an infinite proof for
// `?0: AutoTrait` and we do not perform any substitution.
if self.stack.iter().skip(index).all(|s| s.goal.is_coinductive(&*self.program)) {
if self.stack.iter()
.skip(index)
.map(|s| &s.goal)
.chain(Some(&goal))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh. =) Funny oversight. Maybe add a test for this? Maybe not worth it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I realised that from a correctness point of view, that's the same thing because we already know that there is a cycle starting at index index, so the very first element of our iterator is also our current goal already. Anyway, let's keep it that way :)

.all(|g| g.is_coinductive(&*self.program))
{
let value = ConstrainedSubst {
subst: Substitution::empty(),
constraints: vec![],
Expand Down