-
Notifications
You must be signed in to change notification settings - Fork 311
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 by-value iterator for owned arrays #986
Conversation
These return views (don't edit the array in place), so must_use is appropriate here.
Layout is fully pub (but hidden) for legacy reasons - used from NdProducer trait. It's not a stable feature.
929f6a8
to
d5d0892
Compare
The IntoIter iterator will reuse the drop unreachable code from move_into, so we move the needed part into a separate function.
Thank you @bluss . This was included in 0.15.2 and I was surprised to see that it broke our project. It's not a problem at all, it was super easy to fix! I'm more curious about which of the following is true:
Or none of them? Or both ^^ |
Do you have an example of the code? |
Here's one example
I had to remove both |
Thanks. Do you recall the blog post https://blog.rust-lang.org/2021/05/11/edition-2021.html and the part about IntoIterator for arrays, it might be interesting? As it says:
So that means (2) which applies here too. I'm suprised but I could see that it can happen. I would recommend that you convert this code by using |
Oh, ok, that anwers my question. Thank you. I don't want to abuse of your time, but may I ask you why using |
you can see it if you read the implementation? :) It's not a coincidence that we reached version 0.15.x before this method was implemented, it was not so easy to do and it has to do some convoluted stuff (in some cases). |
Implement
IntoIterator
forArray
. This uses the same code for "dropping unreachable elements" that.move_into()
does (from the #932 PR).New features:
Array::into_iter
(same for ArcArray, CowArray)Fixes #196