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

hashedone commented Dec 7, 2019

Fixes #66865

in librustc in several places
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 7, 2019

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.

@petrochenkov

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

petrochenkov commented Dec 8, 2019

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

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Dec 8, 2019

Awaiting bors try build completion

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 8, 2019

⌛️ Trying commit d97379a with merge af6ea8f...

bors added a commit that referenced this pull request Dec 8, 2019
Added ExactSizeIterator bound to return types

Fixes #66865
@oli-obk

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

bors commented Dec 8, 2019

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

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Dec 8, 2019

Queued af6ea8f with parent 5c5c8eb, future comparison URL.

@petrochenkov

This comment has been minimized.

Copy link
Contributor

petrochenkov commented Dec 8, 2019

@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

This comment has been minimized.

Copy link
Contributor

oli-obk commented Dec 8, 2019

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

@hashedone

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Author

hashedone commented Dec 9, 2019

Sure, I will go this way.

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Dec 9, 2019

Finished benchmarking try commit af6ea8f, comparison URL.

@hashedone hashedone force-pushed the hashedone:master branch from 499801f to b193a57 Dec 9, 2019
This reverts commit d97379a.
@hashedone hashedone force-pushed the hashedone:master branch from b193a57 to 989bf84 Dec 9, 2019
@petrochenkov

This comment has been minimized.

Copy link
Contributor

petrochenkov commented Dec 9, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 9, 2019

📌 Commit 989bf84 has been approved by petrochenkov

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
4 checks passed
4 checks passed
pr #20191209.43 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.