-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Incomplete borrow checking with closures #16361
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
Labels
A-lifetimes
Area: Lifetimes / regions
Comments
Nominating for 1.0 P-backcompat-lang |
pcwalton
added a commit
to pcwalton/rust
that referenced
this issue
Aug 12, 2014
This fixes borrow checking for closures. Code like this will break: struct Foo { x: int, } pub fn main() { let mut this = &mut Foo { x: 1, }; let r = || { let p = &this.x; &mut this.x; }; r() } Change this code to not take multiple mutable references to the same value. For example: struct Foo { x: int, } pub fn main() { let mut this = &mut Foo { x: 1, }; let r = || { &mut this.x; }; r() } Closes rust-lang#16361. [breaking-change]
bors
added a commit
that referenced
this issue
Aug 13, 2014
…tsakis This fixes borrow checking for closures. Code like this will break: struct Foo { x: int, } pub fn main() { let mut this = &mut Foo { x: 1, }; let r = || { let p = &this.x; &mut this.x; }; r() } Change this code to not take multiple mutable references to the same value. For example: struct Foo { x: int, } pub fn main() { let mut this = &mut Foo { x: 1, }; let r = || { &mut this.x; }; r() } Closes #16361. [breaking-change] r? @nikomatsakis
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jan 21, 2024
Add a stable #visual-studio anchor to the Manual Helpful for rust-lang/www.rust-lang.org#1915 so we have a persistent place to link as "Visual Studio" from the Rust website. Syntax reference: https://docs.asciidoctor.org/asciidoc/latest/sections/custom-ids/#assign-auxiliary-ids
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code allows me to create two mutable references to a given variable without failure; this is used to non-obviously invalidate a value. Removing the closure from the body of
bar
causes compile-time failure.rustc 0.12.0-pre-nightly (8fe73f1 2014-08-06 23:41:05 +0000)
The text was updated successfully, but these errors were encountered: