Closed
Description
Playground link: https://play.rust-lang.org/?version=stable&mode=release&edition=2018&gist=2e2d548aa3a7b89bfb074456d971450d
pub fn boundcheck(mut lit: &[u8]) -> Option<&[u8]> {
if lit.first() == Some(&b'_') {
lit = &lit[1..];
// lit = unsafe { lit.get_unchecked(1..) };
}
Some(lit)
}
This slice always exists because of the branch, but it performs bound check.
Real case: RustPython/RustPython#2077