-
Notifications
You must be signed in to change notification settings - Fork 13.4k
v[v.len()-1]
not accepted by borrow checker
#105678
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
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 |
Uh oh!
There was an error while loading. Please reload this page.
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: