Skip to content

Conversation

steffahn
Copy link
Member

@steffahn steffahn commented Aug 12, 2021

Adds extensive test (of size_hint) for all the [r]split* iterators.
Fixes size_hint upper bound for split_inclusive* iterators which was one higher than necessary for non-empty slices.
Fixes size_hint lower bound for [r]splitn* iterators when n == 0, which was one too high.

Lower bound being one too high was a logic error, violating the correctness condition of size_hint.

Edit: I’ve opened an issue for that bug, so this PR fixes #87978

@steffahn steffahn force-pushed the slice_split_size_hints branch from 389953b to 8d1d63e Compare August 12, 2021 15:19
Adds extensive test for all the [r]split* iterators.
Fixes size_hint upper bound for split_inclusive* iterators which was one higher than necessary for non-empty slices.
Fixes size_hint lower bound for [r]splitn* iterators when n==0, which was one too high.
@steffahn steffahn force-pushed the slice_split_size_hints branch from 8d1d63e to 31e49f0 Compare August 12, 2021 15:26
@steffahn
Copy link
Member Author

steffahn commented Aug 12, 2021

@rustbot label T-libs, A-iterators, A-slice

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Aug 12, 2021
@steffahn
Copy link
Member Author

steffahn commented Aug 12, 2021

@rust-highfive failed. I’m choosing at random from this list.

r? @dtolnay

@rustbot rustbot added A-iterators Area: Iterators A-slice Area: `[T]` labels Aug 12, 2021
@steffahn steffahn force-pushed the slice_split_size_hints branch 2 times, most recently from a467715 to 8cb1cec Compare August 12, 2021 20:49
@rust-log-analyzer

This comment has been minimized.

@steffahn
Copy link
Member Author

Ah, the damn tidy check -.-

By the way (note for review:) I was only force-pushing to amend the new commit.

@steffahn steffahn force-pushed the slice_split_size_hints branch from 8cb1cec to 0bb11f4 Compare August 12, 2021 21:11
@rust-log-analyzer

This comment has been minimized.

@steffahn steffahn force-pushed the slice_split_size_hints branch from 67ac748 to 3f0d04e Compare August 13, 2021 13:27
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thanks!

@dtolnay
Copy link
Member

dtolnay commented Aug 14, 2021

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 14, 2021

📌 Commit 3f0d04e has been approved by dtolnay

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 14, 2021
@bors
Copy link
Collaborator

bors commented Aug 15, 2021

⌛ Testing commit 3f0d04e with merge 40db258...

@bors
Copy link
Collaborator

bors commented Aug 15, 2021

☀️ Test successful - checks-actions
Approved by: dtolnay
Pushing 40db258 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 15, 2021
@bors bors merged commit 40db258 into rust-lang:master Aug 15, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 15, 2021
@steffahn steffahn deleted the slice_split_size_hints branch August 15, 2021 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-iterators Area: Iterators A-slice Area: `[T]` merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect lower bound on size hint for <[T]>::splitn if n==0
5 participants