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

Restrict static mut #228

Closed
wants to merge 2 commits into from
Closed

Conversation

gereeter
Copy link

@gereeter gereeter commented Sep 7, 2014

This is an alternative to #177.

@sfackler
Copy link
Member

sfackler commented Sep 7, 2014

How are you defining "mutation"? Calling MY_ATOMIC_INT.store(1, SeqCst) certainly modifies it.

@gereeter
Copy link
Author

gereeter commented Sep 7, 2014

I should have been more clear - I meant direct mutation, without going through UnsafeCell.

@reem
Copy link

reem commented Sep 8, 2014

I'm unclear as to what "directly" mutating something means. Could you clarify this further? Code examples would really help.

@bharrisau
Copy link

The only issue I have with this is that static effectively becomes const and static mut becomes static. By that, I mean the only distinction is the location in the binary; rodata or data.

Are there any use cases of the current static mut that can't be handed by UnsafeCell? (UnsafeCell can return a *mut for anyone unfamiliar).

@lilyball
Copy link
Contributor

Am I correct in reading this as static mut now differs from static purely in that static mut may contain UnsafeCell?

I'm still in favor of @nikomatsakis's approach that was described in a comment on #177 (possibly modified, as described in the comments after, to remove static mut in favor of static + UnsafeCell).

@Tobba
Copy link

Tobba commented Sep 19, 2014

-1
This isnt even an alternative

@nikomatsakis
Copy link
Contributor

Hello! Thank you for the RFC submission. In triage meeting, we decided to close this RFC in favor of #246, as that design encompasses the goals of this one (providing a safe path for people to use Atomic integers and so forth).

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

Successfully merging this pull request may close these issues.

7 participants