-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Replace the global fulfillment cache with the evaluation cache #42840
Merged
+239
−169
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
14875fd
prevent illegal coinductive matching in trait evaluation
arielb1 16d1700
use dep-graph reads for the evaluation cache
arielb1 87a1181
use the evaluation cache instead of the global fulfillment cache
arielb1 b7b965a
return EvaluatedToRecur when evaluating a recursive obligation tree
arielb1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
prevent illegal coinductive matching in trait evaluation
Previously, coinductive matching was only blocked on the fulfillment path, and ignored on the evaluation path.
- 1.85.1
- 1.85.0
- 1.84.1
- 1.84.0
- 1.83.0
- 1.82.0
- 1.81.0
- 1.80.1
- 1.80.0
- 1.79.0
- 1.78.0
- 1.77.2
- 1.77.1
- 1.77.0
- 1.76.0
- 1.75.0
- 1.74.1
- 1.74.0
- 1.73.0
- 1.72.1
- 1.72.0
- 1.71.1
- 1.71.0
- 1.70.0
- 1.69.0
- 1.68.2
- 1.68.1
- 1.68.0
- 1.67.1
- 1.67.0
- 1.66.1
- 1.66.0
- 1.65.0
- 1.64.0
- 1.63.0
- 1.62.1
- 1.62.0
- 1.61.0
- 1.60.0
- 1.59.0
- 1.58.1
- 1.58.0
- 1.57.0
- 1.56.1
- 1.56.0
- 1.55.0
- 1.54.0
- 1.53.0
- 1.52.1
- 1.52.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.2
- 1.45.1
- 1.45.0
- 1.44.1
- 1.44.0
- 1.43.1
- 1.43.0
- 1.42.0
- 1.41.1
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.36.0
- 1.35.0
- 1.34.2
- 1.34.1
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.1
- 1.31.0
- 1.30.1
- 1.30.0
- 1.29.2
- 1.29.1
- 1.29.0
- 1.28.0
- 1.27.2
- 1.27.1
- 1.27.0
- 1.26.2
- 1.26.1
- 1.26.0
- 1.25.0
- 1.24.1
- 1.24.0
- 1.23.0
- 1.22.1
- 1.22.0
- 1.21.0
- 1.20.0
commit 14875fd3b7d623a21dd252ab80d6e3e6c772151d
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we've been working through this logic in the context of chalk -- it turns out that error isn't really the right answer here. In particular, it can lead you to "overconfidence". The correct answer probably requires iteration (at least, that's what we're doing in chalk). Maybe might be tolerable for now, but may break stuff, I'm not sure.
PR rust-lang/chalk#47 by @scalexm outlines the chalk strategy, which is based on a technique called tabling. In short, you start out by saying error, but then -- if you find solutions -- you iterate again, and this time, on the cycle, you return the solution that you found. This may allow you to find a second solution, in which case you can report ambiguity (no unique solution).
This example test is relevant -- on the first iteration, we encounter a cycle testing whether
exists<T> { T: Foo }
(that is,S<T>: Foo
inquires whetherS<T>: Foo
), but we also encounter a solution --T = i32
. This then enables (on the second round) us to uncover thatS<i32>: Foo
is another solution. (Indeed, there are infinitely many, iirc.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current logic actually reports an overflow error in this case, which aborts compilation. Maybe it's better to do that here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we return "OK" for the "evaluation" result, but abort in the fulfillment cx..? If we aborted in both, it might cause trouble? Maybe worth a try though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other option is
EvaluatedToAmbiguity
.