-
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
mark &mut parameters noalias if there are no potentially aliasing parameters #6785
Comments
Visiting for triage; nothing to add. |
There are too many special cases involved here, so this really requires type-based alias analysis. |
Note that the killer issue involves |
I don't understand why TLS |
There is nothing stopping |
They might alias (i.e. point at the same memory), but if a fn at_and(x: &mut int, y: @mut int) {
*x += 1;
printfln!(*y);
}
fn at_at(x: @mut int, y: @mut int) {
*x += 1;
printfln!(*y);
}
fn main() {
let x = @mut 1;
at_at(x, x); // prints 2
at_and(x, x); // the *y fails
} That said, I agree that there are too many special cases for a simplistic implementation like this bug. |
One danger is that you can still read from |
Oh! (I retract what I said above about |
Is there still a problem, given |
This may still be a problem with |
I guess this might be possible again. It requires input from @nikomatsakis or @pcwalton because I don't know whether there are any plans to have borrows aliasing with unchecked plain old data reads again. |
In my branch addressing #2202, closures could sometimes produce the equivalent of |
Still, I wonder if when it comes to |
same for RefCell |
I guess though that we can apply aggressive mutability annotations so long as the types are not considered to be mutable. |
Duplicate of #12436. |
…-lints, r=flip1995 Move conf.rs back into clippy_lints This is an alternative solution to rust-lang#6785 to fix the CI break caused by rust-lang#6756. changelog: none
&mut
can alias with&const
,@mut
, other types like@mut
that allow a&mut
borrow while still allowing reads and closures containing captured aliases.The text was updated successfully, but these errors were encountered: