Open
Description
Consider this code:
fn main() {
let mut v = vec![1, 2];
let x = &mut v[v[0]..];
}
It doesn't compile ( https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b69d691f31f8c8ef9e7ca949c4be542b, rustc 1.68.2).
Of course, this example can be simply fixed by extracting v[0]
. But I still argue that this is correct code, and it should compile. Even if this is not possible to fix in short time, I still think this should be fixed in some next-generation borrow checker.
I actually got similar code in my actual production code base. This is simplified example from my production code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e56a648d80a8af7c3eabdcfe504df774
Adding -Zpolonius
changes nothing