-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Implement O(1)-time Iterator::nth for Range*, and slim the Step trait #43077
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
src/libcore/iter/range.rs
Outdated
|
||
#[inline] | ||
fn add_n(&self, n: usize) -> Option<Self> { | ||
// FIXME: use faillable conversions when they exist |
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.
Fallible.
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.
Fixed.
A test case needs to be updated. [00:40:46] ---- [compile-fail] compile-fail/range-1.rs stdout ----
[00:40:46]
[00:40:46] error: /checkout/src/test/compile-fail/range-1.rs:19: expected error not found: `for<'a> &'a bool: std::ops::Add` is not satisfied |
Test updated, thanks for pointing this out. |
Need to update Error report
|
Removed the i128/u128 changes as I suspect they were buggy. I’ll look into that separately in another PR. |
Thanks! Could you be sure to add some tests for the |
Done, in a new commit. |
📌 Commit 4e28949 has been approved by |
🔒 Merge conflict |
@bors r=alexcrichton |
📌 Commit e9a61ee has been approved by |
☀️ Test successful - status-appveyor, status-travis |
Fixes #43064.
Fixes part of #39975.
Fixes items 1
and 3of #42168.CC #27741.
I think #42310 and #43012 should not have landed without the
nth
part of this PR, but oh well.