Skip to content

Some cleanups and add a solve_limited #321

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

Merged
merged 6 commits into from
Jan 17, 2020

Conversation

jackh726
Copy link
Member

This could be two separate PRs, but the cleanups are small:

  • Moved methods from InferenceTable onto Context directly, since they don't need an &self
  • Made any_future_answer take a &self instead of a &mut self

The bulk of the PR involves adding a should_continue argument to peek_answer and next_answer, which allows stopping of solving before an answer is ready, when a QuantumExceeded has been returned. Right now, it's a argument-less function, so there's no real "feedback", so it's pretty much limited to either a time-based or call number-based implementation.
However, some ideas for how to extend this:

  • Pass the current (or expected) substitution to the function. This could allow the caller to accept that an answer is "good enough".
  • Be a bit smarter with the returned answer after false is returned. Right now, the returned answer is the current substitution as Guidance(Suggested(...)). Instead, we could take into account the possible answers (similar to how any_future_answer works). Or, maybe we just return None instead.

@jackh726
Copy link
Member Author

jackh726 commented Jan 11, 2020

So I'm not sure why CI is complaining. It builds/tests fine locally on stable 1.40.0. And the CI is complaining that Fn is a struct not a trait?

EDIT: because this wasn't rebased onto the current master, where Fn is a chalk-ir type

@nikomatsakis nikomatsakis merged commit 5b196f9 into rust-lang:master Jan 17, 2020
@jackh726 jackh726 deleted the cleanups branch January 17, 2020 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants