How to avoid bounds checking?

I cannot reproduce the first example having bounds checks, e.g.

#![crate_type = "lib"]
#![feature(test)]

extern crate test;

pub fn with_bounds(some_slice: &[usize]) {
    let len = some_slice.len();

    for it in 0..len {
        test::black_box(some_slice[it]);
    }
}

pub fn boundless(some_slice: &[usize]) {
    let some_slice = &some_slice[0..];
    let len = some_slice.len();
    
    for it in 0..len {
        test::black_box(some_slice[it]);
    }
}

produces exactly the same (optimised) asm for both functions: Rust Playground

However, in the past there has been some... LLVM difficulties with removing bounds checks on slices that were passed as function parameters, and simply explicitly moving them to let'd local variables improved the optimisations, i.e. fn boundless(some_slice: &[usize]) { let some_slice = some_slice; ... }. These may still exist.

That said, unless the loop is seriously tight (and the conventional some_slice.iter() doesn't work) bounds checks are often unnoticable: they're generally a comparison and a branch (i.e. two instructions), and the latter should be well predicted.