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

Added ExactSizeIterator bound to return types #67125

Merged
merged 2 commits into from
Dec 10, 2019
Merged

Conversation

hashedone
Copy link

Fixes #66865

in librustc in several places
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 7, 2019
@petrochenkov
Copy link
Contributor

petrochenkov commented Dec 8, 2019

@oli-obk
What is the goal here?
Since this is a compiler and everything is unstable, we can always add these bounds when necessary (the .len() method is actually used), and avoid the noise until they are not necessary.

AFAIR, this shouldn't affect performance as well, specialization (if it's used for ExactSizeIterator at all) considers the underlying type of impl Trait and not bounds.

@petrochenkov
Copy link
Contributor

Let's check the perf anyway.
@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@petrochenkov petrochenkov added S-waiting-on-perf Status: Waiting on a perf run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 8, 2019
@bors
Copy link
Contributor

bors commented Dec 8, 2019

⌛ Trying commit d97379a with merge af6ea8f767c5b62341b6a274297a57641a2ae0ad...

@oli-obk
Copy link
Contributor

oli-obk commented Dec 8, 2019

In miri we had to do some funky workaround with testing whether the iterator still has elements and whether it was finished instead of just asserting the len and then zipping two iterators.

@bors
Copy link
Contributor

bors commented Dec 8, 2019

☀️ Try build successful - checks-azure
Build commit: af6ea8f767c5b62341b6a274297a57641a2ae0ad (af6ea8f767c5b62341b6a274297a57641a2ae0ad)

@rust-timer
Copy link
Collaborator

Queued af6ea8f767c5b62341b6a274297a57641a2ae0ad with parent 5c5c8eb, future comparison URL.

@petrochenkov
Copy link
Contributor

@oli-obk

In miri we had to do some funky workaround with testing whether the iterator still has elements and whether it was finished instead of just asserting the len and then zipping two iterators.

Can the bound be added only to that specific iterator then?
(Miri and rustc are developed synchronously and need to collaborate on things like this anyway.)

@oli-obk
Copy link
Contributor

oli-obk commented Dec 8, 2019

Sure, if that is preferrable, let's limit it to the mir::Body functions

@hashedone
Copy link
Author

hashedone commented Dec 9, 2019

I will correct this todays evening, but I am wondering - if the case is to change some return types clearly for miri usage, maybe it would be better to use this change in the same commit - I mean add a correction to miri. I know about one place where the "hack" is done, I am not sure if there are other places - @oli-obk is there much code to check for similar cases? I am not familiar with miri, but I would bo more than happy to dive into it.

@oli-obk
Copy link
Contributor

oli-obk commented Dec 9, 2019

No I believe right now it's just the one case in miri. I suggest to land the rustc change independently, as otherwise you need to synchronize up the submodule, which can be quite messy. After the change has been merged in rustc, you can do the change to miri without having to worry about submodules.

@hashedone
Copy link
Author

Sure, I will go this way.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit af6ea8f767c5b62341b6a274297a57641a2ae0ad, comparison URL.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Dec 9, 2019

📌 Commit 989bf84 has been approved by petrochenkov

@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 Dec 9, 2019
tmandry added a commit to tmandry/rust that referenced this pull request Dec 9, 2019
Added ExactSizeIterator bound to return types

Fixes rust-lang#66865
bors added a commit that referenced this pull request Dec 10, 2019
Rollup of 11 pull requests

Successful merges:

 - #66892 (Format libcore with rustfmt (including tests and benches))
 - #67106 (resolve: Resolve visibilities on fields with non-builtin attributes)
 - #67113 (Print the visibility in `print_variant`.)
 - #67115 (Simplify `check_decl_no_pat`.)
 - #67119 (libstd miri tests: avoid warnings)
 - #67125 (Added ExactSizeIterator bound to return types)
 - #67138 (Simplify `Layout::extend_packed`)
 - #67145 (fix miri step debug printing)
 - #67149 (Do not ICE #67123)
 - #67155 (Move `Layout`s instead of binding by reference)
 - #67169 (inline some common methods on OsStr)

Failed merges:

r? @ghost
@bors bors merged commit 989bf84 into rust-lang:master Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-perf Status: Waiting on a perf run to be completed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Give many impl Iterator return types an ExactSizeIterator bound
6 participants