Skip to content

Conversation

varkor
Copy link
Contributor

@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
Contributor 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.

3 participants