Closed
Description
See https://play.rust-lang.org/?gist=2754f11f7236754b2121eb9e4c12aa73&version=nightly&mode=release. The length of the Vec
is read before being written to.
I would have expected the peephole optimizer in LLVM to recognize that pattern. Interestingly, it's not a regression; according to https://rust.godbolt.org/, the issue was even present in rustc 1.0
.