Assuming `Clone::clone()` is equivalent to `Copy` semantics for all instances of `Copy`

I think that is a bug in the optimizer. I commented such in https://github.com/rust-lang/rust/pull/31414. If rustc doesn’t optimize that kind of code then there are a lot of (functional) coding patterns that are going to be a disaster in terms of performance.

2 Likes

Oh. For some reason I was interpreting the OP as the compiler magically doing it somehow. Doing it in library code seems less problematic.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.