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

Change NonZero* TypeInfo implementation to not be recursive #171

Merged
merged 2 commits into from Nov 15, 2022

Conversation

benluelo
Copy link
Contributor

@benluelo benluelo commented Nov 14, 2022

The current TypeInfo implementation for the NonZero* types is recursive, defining the types as containing a field of itself. This PR fixes the implementation to properly define the inner field as the NonZero*'s wrapped type.

I also considered if the NonZero* types should be encoded as their wrapped type (i.e. <NonZeroU64 as TypeInfo>::Identity == u64), but I'm not sure what implications that would have.

NOTE: I've forked this off of b881bfb since our current lockfile contains scale-info = 2.2.

Copy link
Member

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

also considered if the NonZero* types should be encoded as their wrapped type (i.e. ::Identity == u64), but I'm not sure what implications that would have.

The Identity associated type is used to uniquely identify a type for registering in the type registry, so it is correct to be Self in this case. If it were e.g. u64 it would collide with that u64 primitive type.

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

2 participants