-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Revamp borrowck treatment of closures #6801
Comments
Part of #2202 |
triage bump. @nikomatsakis should this and the related bug be nominated? How does this interact with @fn being gone, etc? |
If I understand this correctly, fixing this will significantly impact anyone who's using a closure in a destructor for RAII purposes (e.g. #11905). Nominating for backwards compat. |
Accepted for 1.0, backcompat-lang. |
I've got a patch for this nearly ready to land. It definitely impacts some existing code. The patch is code complete but I've been working on writing up docs on the affected code patterns and how they must be updated. |
* src/test/run-pass/issue-3559.rs was fixed in rust-lang#4726 * src/test/compile-fail/borrowck-call-sendfn.rs was fixed in rust-lang#2978 * update src/test/compile-fail/issue-5500-1.rs to work with current Rust * removed src/test/compile-fail/issue-5500.rs because it is tested in src/test/run-fail/issue-5500.rs * src/test/compile-fail/view-items-at-top.rs fixed * rust-lang#897 fixed * compile-fail/issue-6762.rs issue was closed as dup of rust-lang#6801 * deleted compile-fail/issue-2074.rs because it became irelevant and is irrelevant rust-lang#2074, a test covering this was added in 4f92f45
Fix `manual_map` false positives fixes: rust-lang#6795 fixes: rust-lang#6797 fixes: rust-lang#6811 fixes: rust-lang#6819 changelog: Fix false positives for `manual_map` when `return`, `break`, `continue`, `yield`, `await`, and partially moved values are used. changelog: Don't expand macros in suggestions for `manual_map`
As described in #2202 and this blog post, the borrow checker's treatment of closures needs to be changed. When a new closure is created, we should analyze the upvars that it accesses and create suitable borrows of those upvars that persist for the closure's lifetime. This is interrelated with #3696.
The text was updated successfully, but these errors were encountered: