-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add a vars_since_snapshot
method to UnificationTable
#21
Conversation
@eddyb suggested a cleaner API, so I'm going to update this PR soon accordingly. Edit: I've updated the API. |
src/unify/mod.rs
Outdated
snapshot: &Snapshot<S>, | ||
) -> impl Iterator<Item = S::Key> + '_ { | ||
self.values.values_since_snapshot(&snapshot.snapshot).map(move |idx| { | ||
self.values[idx].parent |
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.
Wait, this is wrong, isn't it? parent
is (I think) the unification parent, which would mean this method may return variables older than the snapshot, and may miss some of the newer variables (which, while unified in the unification table, may still be found in values that haven't been normalized since the unification).
You should probably return Range<S::Key>
by using UnifyKey::from_index
, AFAICT (look for other uses of from_index
- I assume some u32
check may be involved?)
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.
@nikomatsakis Why doesn't ena
rely entirely on usize
and leave u32
(or smaller) key handling to the users?
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.
Convenience for end-users, I guess. But I think the code you highlighted here @eddyb is outdated, no?
1835c4f
to
b37bb32
Compare
vars_since_snapshot
method to UnificationTable
vars_since_snapshot
method to UnificationTable
vars_since_snapshot
method to UnificationTable
vars_since_snapshot
method to UnificationTable
Refactor InferenceFudger (née RegionFudger) - Rename `RegionFudger` (and related methods) to `InferenceFudger`. - Take integer and float inference variables into account. - Refactor `types_created_since_snapshot` and `vars_created_since_snapshot` with the [new version of ena](rust-lang/ena#21). - Some other refactoring in the area. r? @eddyb
Follow up to #19.
Adds
UnificationTable::vars_since_snapshot
, makingUnificationStore::values_since_snapshot
accessible publicly.Also do a little refactoring to clean things up.
These changes are necessary for refactoring in rustc. Apologies for not making these changes at the same time: I didn't previously test the new version of ena in rustc. I've integrated these changes in a local branch of rustc, so this should be the last change.