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

RalfJung commented Dec 21, 2018

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.

This comment has been minimized.

Copy link
@nikomatsakis

nikomatsakis Jan 10, 2019

Collaborator

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.

This comment has been minimized.

Copy link
@RalfJung

RalfJung Jan 10, 2019

Author Member

Better like this?

Copy link
Collaborator

nikomatsakis left a comment

Nice

@RalfJung RalfJung merged commit 50c65d0 into rust-lang:master Jan 24, 2019
@RalfJung RalfJung deleted the RalfJung:interior-mutability branch Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.