-
Notifications
You must be signed in to change notification settings - Fork 556
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: Iterator::count #7094
feat: Iterator::count #7094
Conversation
86444ff
to
8950d43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you based over latest? there was a fix for something similar merged lately.
Reviewed all commit messages.
Reviewable status: 0 of 2 files reviewed, all discussions resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this is based on 3e611b5
Reviewable status: 0 of 2 files reviewed, all discussions resolved (waiting on @orizi)
There was a problem hiding this 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 2 files reviewed, 1 unresolved discussion (waiting on @MagisterDallis)
corelib/src/iter/traits/iterator.cairo
line 80 at r1 (raw file):
) -> usize { let mut self = self; Self::fold(ref self, 0_usize, |count, _x| {
can you try removing anything that would need to be inferred?
(specifically - i highly suspect Self::Item
of being the culprit of this not working)
Suggestion:
Self::fold::<usize>(ref self, 0_usize, |count: usize, _x: Self::Item| {
There was a problem hiding this 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 2 files reviewed, 1 unresolved discussion (waiting on @orizi)
corelib/src/iter/traits/iterator.cairo
line 80 at r1 (raw file):
Previously, orizi wrote…
can you try removing anything that would need to be inferred?
(specifically - i highly suspect
Self::Item
of being the culprit of this not working)
Even with explicit types, this still happens.
There was a problem hiding this 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 2 files reviewed, all discussions resolved
corelib/src/iter/traits/iterator.cairo
line 80 at r1 (raw file):
Previously, MagisterDallis wrote…
Even with explicit types, this still happens.
Should work now - no need for explicit types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try again.
Reviewable status: 0 of 2 files reviewed, all discussions resolved
8950d43
to
ab881ef
Compare
There was a problem hiding this 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 2 files reviewed, all discussions resolved (waiting on @orizi)
corelib/src/iter/traits/iterator.cairo
line 80 at r1 (raw file):
Previously, orizi wrote…
Should work now - no need for explicit types.
Done. Works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @MagisterDallis)
a discussion (no related file):
@ilyalesokhin-starkware for 2nd eye.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @MagisterDallis)
a discussion (no related file):
Previously, orizi wrote…
@ilyalesokhin-starkware for 2nd eye.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @MagisterDallis)
corelib/src/iter/traits/iterator.cairo
line 56 at r2 (raw file):
/// The method does no guarding against overflows, so counting elements of /// an iterator with more than [`Bounded::<usize>::MAX`] elements either produces the /// wrong result or panics.
It will panic, we don't have an option to run with no overflow checks.
Code quote:
/// an iterator with more than [`Bounded::<usize>::MAX`] elements either produces the
/// wrong result or panics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware)
corelib/src/iter/traits/iterator.cairo
line 56 at r2 (raw file):
Previously, gilbens-starkware (Gil Ben-Shachar) wrote…
It will panic, we don't have an option to run with no overflow checks.
The default implementation will panic but custom implementations might decide to add overflow checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @MagisterDallis)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @MagisterDallis)
Encountering a compilation panic on this one. I'm wondering if it's because of the unused closure argument?