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

feat(types): impl PartialEq and Hash for Ident instead of ModulePath #108

Merged
merged 4 commits into from
Jun 14, 2024

Conversation

eightfilms
Copy link
Contributor

@eightfilms eightfilms commented Jun 8, 2024

Extracted from #100

This follows the original implementation. 2 Idents should be equal if their values are equal, even if their Spans are different. This also includes manually implementing Hash to allow for this.

…lePath`

This follows the original implementation. 2 `Ident`s should be equal if their values are equal,
even if their `Span`s are different. This also includes manually implementing `Hash` to allow
for this.
impl Hash for Ident {
fn hash<H: Hasher>(&self, state: &mut H) {
self.value.hash(state);
self.span.hash(state);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the TODO was explicitly about not having the span in the hash :o

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm I see, I misunderstood the intention. I can fix it in this PR (or restore the TODO if that's preferable).

I think the derivative crate is unmaintained and still uses syn v1, so that may not be a great idea. However an alternative (educe) was also presented in that issue, and that uses syn v2. We can bring that in, if this is preferable over manual implementation(s).

Copy link
Contributor Author

@eightfilms eightfilms Jun 10, 2024

Choose a reason for hiding this comment

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

Using educe in c72d5c3 dfc03ad

Copy link
Contributor

@mimoo mimoo left a comment

Choose a reason for hiding this comment

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

awesome thanks a lot!

@mimoo mimoo merged commit 2b4bfc5 into zksecurity:main Jun 14, 2024
1 check passed
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