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

Add a values_since_snapshot method to UnificationStore #19

Merged
merged 2 commits into from Mar 19, 2019

Conversation

varkor
Copy link
Member

@varkor varkor commented Mar 14, 2019

We'd like to abstract out the vars_since_snapshot methods for inference variables in rustc:
https://github.com/rust-lang/rust/blob/2a8f6a7806a9072fb5a5279a48bef316b749a433/src/librustc/infer/fudge.rs#L67-L72
At the moment, we can't get this information for an arbitrary UnificationStore, which means there are some awkward workarounds in the compiler.

@@ -10,29 +11,35 @@ use super::{VarValue, UnifyKey, UnifyValue};
#[allow(type_alias_bounds)]
type Key<S: UnificationStore> = <S as UnificationStore>::Key;

pub trait Measurable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a doc comment to this trait? Maybe explain what this len represents? (I realize the old method didn't have a comment, sorry, I'm a hypocrite)

Copy link
Member

Choose a reason for hiding this comment

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

I would've named this trait Length, really.

Or rely on ExactSizeIterator::len somehow.

Copy link
Member Author

@varkor varkor Mar 21, 2019

Choose a reason for hiding this comment

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

Yeah, I considered that (and seeing whether I could incorporate ExactSizeIterator::len), but it didn't quite seem accurate: I wanted a word for something that had a length, rather than was a length. It's only supposed to be used internally though, so it's not too important.

@nikomatsakis
Copy link
Contributor

Never mind, I thought that len was meant to be used from rustc directly, but I see I misunderstood. We should add more docs but it seems ok as is.

@nikomatsakis nikomatsakis merged commit 8e2d120 into rust-lang:master Mar 19, 2019
@varkor varkor deleted the vars_since_snapshot branch March 19, 2019 21:02
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.

None yet

3 participants