-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
for
borrowing lasts after the end of the for loop
#38614
Comments
for
borrowing lasts after the end of the for loop
I believe this is a duplicate, but I'm not sure. |
This is because of lexical lifetimes and is thus covered by rust-lang/rfcs#811. |
I was not 100% sure, but this was also a suspicion I had. Thanks for the report, @progval , but yes, it's covered by that linked issue. |
|
You're reading "not a real problem" backwards; @rkruppe is saying that your code is fine, that it doesn't have an actual problem. Borrowck can't understand that, though. |
Oh I see, thanks for the explanation! |
Hi,
The following code:
Raises an error about
vector.iter()
's borrow conflicting withvector.last_mut()
:However, I would have expected the first borrow to end with the first closing bracket.
Playground URL: https://play.rust-lang.org/?gist=36c206ebc1f8c96b96978a628b5c09a9&version=stable&backtrace=0
The text was updated successfully, but these errors were encountered: