Your modification results in the inclusion of a bounds check in the inner loop:
.LBB0_4:
cmp rdx, rsi
jae .LBB0_7
At `LBB0_7` is a call to `panic_bounds_check`.> Thanks. I don't see a call to test::black_box(x), so I assume that was an empty function optimized out.
black_box is and does nothing, its purpose is to be opaque to the optimiser and make values it is passed "used" for optimiser purposes, otherwise the optimiser would remove the whole thing since it's a noop.
Would you change "let vlen = v.len()" to "let vlen = v.len() + 1" and try again, please? That introduces an off-by-one error and a buffer overflow. Let's see what the compiler does with it. Thanks.