2 ms·
The particular optimisation for non-copying Vec -> IntoIter -> Vec transform is actually hard coded in the standard library as a special case of collecting an I
by mjmas 1y ago
The particular optimisation for non-copying Vec -> IntoIter -> Vec transform is actually hard coded in the standard library as a special case of collecting an Iterator into a Vec. It doesn't rely on the backend for this.
Though this optimisation is treated as an implementation detail [1].
[1]: https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#impl-FromIterator%3CT%3E-for-Vec%3CT%3E https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#imp...
- ComputerGuru 1y agoThanks for pointing that out, TIL!