-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
A lint for taking a mutable reference to a constant #829
Comments
😕 Rust |
haha great catch! |
I think the As an intermediate step, simply linting against having a constant on the lhs of an assignment op or taking a mutable reference to it would be good. |
@oli-obk |
This is probably obvious, but just want to point out that this applies to calling methods that take
Also, I think that this would be more appropriate as a compiler warning or error, FWIW. |
This is resolved by the new rustc lint 👆 |
i.e. rust-lang/rfcs#885
This is currently legal and prints
0 1
becausea
andARR[0]
are actually references to temporaries and not toC
andARR
, but this is confusing as hell.The text was updated successfully, but these errors were encountered: