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

fix(corelib): Add missing impl for type conversions between U256 #3293

Merged
merged 3 commits into from
Jun 6, 2023

Conversation

lambda-0x
Copy link
Contributor

@lambda-0x lambda-0x commented Jun 1, 2023

This change is Reviewable

@lambda-0x lambda-0x changed the title fix(corelib): Add missing impl U128IntoU256 fix(corelib): Add missing impl for type conversions between U256 Jun 2, 2023
Copy link
Contributor

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @lambda-0x)


corelib/src/integer.cairo line 1572 at r1 (raw file):

    }
}

Wdyt about adding all the others


corelib/src/integer.cairo line 1454 at r2 (raw file):

}

// impls for (where X > 8):

I think it's better without these comments.
The impl signature is clear enough.

@lambda-0x
Copy link
Contributor Author

Wdyt about adding all the others

which other are missing?

Copy link
Contributor

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lambda-0x)

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lambda-0x)

@lambda-0x
Copy link
Contributor Author

CI is failing due to this file having:

impl U256TryIntoU64 of TryInto<u256, u64> {
#[inline(always)]
fn try_into(self: u256) -> Option<u64> {
if (self.high == 0) {
self.low.try_into()
} else {
Option::None(())
}
}
}

Which causes there to be duplicate implementation error, what should i do with the duplicate impl in that test?

Copy link
Contributor

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

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

Be explicit when using this impl.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lambda-0x)

Copy link
Contributor

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

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

i.e. refer to the specific impl by name

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lambda-0x)

@lambda-0x
Copy link
Contributor Author

lambda-0x commented Jun 6, 2023

the problem is both have the same name, should rename the one used in test something else @spapinistarkware?

they are essentially the same impl as well but in there its used to test some compiler branching issue, so removing it wouldn't make sense.

Copy link
Contributor

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

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

You don't have to rename, it shadows the core one. u can rename if u want.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lambda-0x)

@spapinistarkware spapinistarkware added this pull request to the merge queue Jun 6, 2023
Merged via the queue into starkware-libs:main with commit 59c7ff3 Jun 6, 2023
@lambda-0x lambda-0x mentioned this pull request Jun 6, 2023
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