Skip to content
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

Closed
nikomatsakis opened this issue Feb 28, 2014 · 6 comments
Closed

Prevent reads via original path of mutably borrowed content #12624

nikomatsakis opened this issue Feb 28, 2014 · 6 comments
Milestone

Comments

@nikomatsakis
Copy link
Contributor

RFC: https://gist.github.com/nikomatsakis/9272598

(Same as this blog post)

@pnkfelix
Copy link
Member

Assigning 1.0, P-backcompat-lang.

@pnkfelix pnkfelix added this to the 1.0 milestone Mar 13, 2014
@flaper87
Copy link
Contributor

cc @flaper87

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Apr 24, 2014
…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.
bors added a commit that referenced this issue May 1, 2014
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
@zwarich
Copy link

zwarich commented May 25, 2014

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.

@zwarich
Copy link

zwarich commented May 26, 2014

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.

@zwarich
Copy link

zwarich commented May 26, 2014

And after going through all of libsyntax the changes grew quite a bit: https://gist.github.com/zwarich/aba959c57f312c894d49.

@zwarich
Copy link

zwarich commented Jun 7, 2014

Now that #14318 is merged I will try to submit a PR this weekend that fixes this.

bors added a commit that referenced this issue Jun 14, 2014
Implement the stronger guarantees for mutable borrows proposed in #12624.
@bors bors closed this as completed in d7de4e9 Jun 14, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
…eykril

fix: completes non exhaustive variant within the defining crate

close rust-lang#12624
flip1995 pushed a commit to flip1995/rust that referenced this issue May 2, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants