News for hackers. Stuff that matters.
Re:Rust, Lifetimes, and Collections by Animats on Wednesday November 19, 2014 @02:12PM (#8631982)
Thanks. I don't see a call to test::black_box(x), so I assume that was an empty function optimized out.

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.

Re:Rust, Lifetimes, and Collections by pbsd on Wednesday November 19, 2014 @02:15PM (#8632000)
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`.
Re:Rust, Lifetimes, and Collections by masklinn on Wednesday November 19, 2014 @04:01PM (#8632594)
> 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.