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

extend def.n of interior mutability #59

Merged
merged 2 commits into from Jan 24, 2019

Conversation

RalfJung
Copy link
Member

We usually also disallow mutating through pointers obtained from shared references. That's a separate condition from there being live shared references.

See https://internals.rust-lang.org/t/writing-through-a-pointer-derived-from-a-shared-reference-after-that-reference-is-dead/9078 for how this might matter.

@@ -2,14 +2,15 @@

#### Interior mutability

*Interior Mutability* means mutating memory where there also exists a live shared reference immediately (i.e., non-transitively) pointing to the same memory.
This propagates recursively through references, but not through raw pointers.
*Interior Mutability* means mutating memory where there also exists a live shared reference pointing to the same memory; or mutating memory through a pointer derived from a shared reference.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grammatical nit: I believe this is a definition of "interior mutation". I guess interior mutability is the ability to do interior mutation without it being UB.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better like this?

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@RalfJung RalfJung merged commit 50c65d0 into rust-lang:master Jan 24, 2019
@RalfJung RalfJung deleted the interior-mutability branch February 22, 2019 09:45
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.

None yet

2 participants