-
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
Deny static mut
declarations entirely
#12896
Comments
@rustbot claim |
@rustbot claim |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
sorry @pitaj it was by mistake that's why i unassigned the issue |
@lolbinarycat are you still working on this issue? |
@aaron-ang not really, no. |
Correct, #13770 is unrelated. I was confused earlier |
@rustbot claim |
@aaron-ang you might want to read through the discussion on #12914 before putting in any work. |
Thanks @pitaj. I'm aware that |
|
What it does
The
static_mut_refs
rustc lint checks for shared or mutable references of mutable statics. This catches most incorrect uses, but doesn't necessarily accomplish the goal of moving the ecosystem away fromstatic mut
entirely.The
static_mut
clippy lint will check for any declarations of mutable statics, and recommend using an immutable static with a type with interior mutability instead.Advantage
Move the ecosystem away from
static mut
. May even catch some unsoundness issues.Drawbacks
Churn
Example
Could be written as:
It would be good to point people to the edition guide explanation and the higher level sync objects docs.
The text was updated successfully, but these errors were encountered: