-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Warn when casting & to *mut when &mut is available. #1087
Comments
|
Const vs mut in raw pointers is really just a lint. Once you have a raw pointer Rust's model is to not expect it to be valid 😄 plus casting is nicer than requiring transmute, which would mean that an additional extra & in the type could mess things up. |
Actually, I think that this lint should be unconditional (and deny-by-default). Mutating a |
It isn't. In most situations it can be, but not all of them. It is possible to do it safely, and you may end up doing it often in FFI code. |
Probably, but if you disable that lint you deserve everything you bring upon yourself... |
Warn when casting from
&
to*mut
whenever it's possible to use&mut
. I don't think this is UB currently but it still seems a bit too handwavey for unsafe code.The text was updated successfully, but these errors were encountered: