Is there a place to report missed optimisation?

Right. Optimizations are usually couched in "as-if" language. The collect induces a reallocation which does not have a forced link to the old capacity, so that is "observable behavior" as far as the optimizer is concerned.

AFAIU, Clone can only be optimized away if it is also Copy (though I'm not sure if this is actually happening). See these threads:

There was a more recent one mentioning it too, but I'm not seeing it right now.

2 Likes