-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v[v.len()-1]
not accepted by borrow checker
#105678
Comments
This is a duplicate of We deliberately made a (conservative) choice to not apply two-phase borrow in the rust/compiler/rustc_typeck/src/check/place_op.rs Lines 376 to 380 in 96859db
as documented here: rust/compiler/rustc_middle/src/ty/adjustment.rs Lines 135 to 151 in 96859db
Closing as duplicate of |
I tried this code:
and expected it to compile, but the borrow checker does not accept it.
This looks like a bug, because the following similar code works thanks to two-phase borrow:
Another case which works fine:
The text was updated successfully, but these errors were encountered: