That's what currently happens (if reserve(1)
's triggers an allocator realloc
(although increasing a Vec
's capacity does not guarantee an "actual Allocator realloc
"), it will copy the whole slice); but you are right, the code could be optimized into skipping the [middle, len())
first copy. You could file an issue to get that changed.