-
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
Illegal mutable borrow incorrectly allowed #14036
Milestone
Comments
Nominating, closure shouldn't be able to capture borrowed variables. |
I'm pretty sure the proc "code" needs a thorough review, giving this issue along with all the other similar proc bugs. |
cc @flaper87 |
P-backcompat-lang, 1.0. |
pcwalton
added a commit
to pcwalton/rust
that referenced
this issue
Jun 26, 2014
Since procs do not have lifetime bounds, we must do this to maintain safety. This can break code that incorrectly captured references in procedure types. Change such code to not do this, perhaps with a trait object instead. A better solution would be to add higher-rank lifetime support to procs. However, this would be a lot of work for a feature we want to remove in favor of unboxed closures. The corresponding "real fix" is rust-lang#15067. Closes rust-lang#14036. [breaking-change]
bors
added a commit
that referenced
this issue
Jun 26, 2014
Since procs do not have lifetime bounds, we must do this to maintain safety. This can break code that incorrectly captured references in procedure types. Change such code to not do this, perhaps with a trait object instead. Closes #14036. [breaking-change] r? @alexcrichton
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Feb 13, 2023
…ykril Record method resolution for remaining operator expressions This allows goto def and future substituted hover to work for the concrete impls.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example:
The last statement
p(&mut x)
is mutably borrowing x but x is already borrowed (or rather should be) by the proc.The result is a program that compiles fine but segfaults when run.
The text was updated successfully, but these errors were encountered: