Overload Iterator::last() for IntoIter.#76087
Overload Iterator::last() for IntoIter.#76087hbina wants to merge 3 commits intorust-lang:masterfrom
Iterator::last() for IntoIter.#76087Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
IntoIter::last() for Vec.Iterator::last() for Vec.
Iterator::last() for Vec.Iterator::last() for IntoIter.
|
This is unsound. The |
|
I changed the implementation a bit copying what |
|
This was attempted before in #57246 EDIT: looking at this closer the drop order should be the same so this should be fine. |
|
Yeah, the |
|
☔ The latest upstream changes (presumably #70793) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@hbina any updates on this? |
Simply use the fact that `IntoIter` stores the end pointer and we can perform pointer arithmetic.
Simply does what next() does except it goes straight to the end of the array. Woopsie
0307fd1 to
76d06f0
Compare
|
@Dylan-DPC I have rebased to latest and accepted the change requested by @pickfire |
|
As I mentioned in #76087 (comment) all |
Suggested by @pickfire. Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
76d06f0 to
91984e7
Compare
Just testing for functionality can be done in |
|
r? @KodrAus |
|
Does this make any difference in performance or binary size? Both the previous and the proposed implementation end up iterating through all elements to Drop them. |
|
☔ The latest upstream changes (presumably #80530) made this pull request unmergeable. Please resolve the merge conflicts. |
Simply use the fact that
IntoIterstores the end pointer and wecan perform pointer arithmetic.
NOTE: Where is the test for this?