Closed
Description
rust/library/alloc/src/vec/mod.rs
Lines 2163 to 2182 in 98f8cce
Looking here, the internal length of the vector is only adjusted at the end of the loop
This has the caveat that if cloning panics, the Vec will start to unwind and only drop the first len
elements which doesn't include the most recently appended ones.
Something more in line with how the stdlib does things might look like this:
https://github.com/LeonineKing1199/minivec/blob/424354dfababae7101aacf70fa9332a87e9cdb15/src/lib.rs#L1612-L1700