-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Prevent reads via original path of mutably borrowed content #12624
Comments
Assigning 1.0, P-backcompat-lang. |
cc @flaper87 |
…isitor, remove the moves computation. ExprUseVisitor is a visitor that walks the AST for a function and calls a delegate to inform it where borrows, copies, and moves occur. In this patch, I rewrite the gather_loans visitor to use ExprUseVisitor, but in future patches, I think we could rewrite regionck, check_loans, and possibly other passes to use it as well. This would refactor the repeated code between those places that tries to determine where copies/moves/etc occur.
Pre-step towards issue #12624 and others: Introduce ExprUseVisitor, remove the moves computation. ExprUseVisitor is a visitor that walks the AST for a function and calls a delegate to inform it where borrows, copies, and moves occur. In this patch, I rewrite the gather_loans visitor to use ExprUseVisitor, but in future patches, I think we could rewrite regionck, check_loans, and possibly other passes to use it as well. This would refactor the repeated code between those places that tries to determine where copies/moves/etc occur. r? @alexcrichton
I've got this implemented on top of my changes for #14318. It seems to be a simple change, modulo writing the new diagnostics. There are only 2 code changes required in the actual source base: https://gist.github.com/zwarich/13faf76055c960231ac9. There are more test changes required, but I haven't really looked into those. |
I implemented the rule for field accesses and found a few more changes that had to be made, but they weren't too bad: https://gist.github.com/zwarich/862fda3a95c5968ab2e5. Most of the changes would be unnecessary with other borrowck changes like #6268. |
And after going through all of libsyntax the changes grew quite a bit: https://gist.github.com/zwarich/aba959c57f312c894d49. |
Now that #14318 is merged I will try to submit a PR this weekend that fixes this. |
Implement the stronger guarantees for mutable borrows proposed in #12624.
…eykril fix: completes non exhaustive variant within the defining crate close rust-lang#12624
fix [`large_stack_arrays`] linting in `vec` macro fixes: rust-lang#12586 this PR also adds a wrapper function `matching_root_macro_call` to `clippy_utils::macros`, considering how often that same pattern appears in the codebase. (I'm always very indecisive towards naming, so, if anyone have better idea of how that function should be named, feel free to suggest it) --- changelog: fix [`large_stack_arrays`] linting in `vec` macro; add `matching_root_macro_call` to clippy_utils
RFC: https://gist.github.com/nikomatsakis/9272598
(Same as this blog post)
The text was updated successfully, but these errors were encountered: