"&mut v[v[0]..]" doesn't compile #110351
Labels
A-borrow-checker
Area: The borrow checker
A-lifetimes
Area: Lifetimes / regions
A-NLL
Area: Non-lexical lifetimes (NLL)
C-bug
Category: This is a bug.
NLL-polonius
Issues related for using Polonius in the borrow checker
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Consider this code:
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 nothingThe text was updated successfully, but these errors were encountered: