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

this rustbook sentence is confusing (to me) #29730

Closed
ghost opened this issue Nov 10, 2015 · 5 comments
Closed

this rustbook sentence is confusing (to me) #29730

ghost opened this issue Nov 10, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented Nov 10, 2015

If you are writing, you need two or more pointers to the same memory, and you can only have one &mut at a time.
from: https://doc.rust-lang.org/nightly/book/references-and-borrowing.html#the-rules

@steveklabnik
Copy link
Member

I agree that it's a bit odd, yeah. I'll try to figure out a better phrasing.

It's trying to say that if you don't have two pointers to the same location in memory, you can't get a race, since a race inherently means two simultaneous load/stores.

@norcalli
Copy link
Contributor

What about "However, as we can only have one &mut at a time (the only kind of reference that can write), it is impossible to have a data race." It works as a drop in replacement for that sentence. You could drop the stuff in parentheses as well for succinctness.

@steveklabnik
Copy link
Member

I like it.

@norcalli
Copy link
Contributor

Should I make a PR or is there an aggregate PR for minor changes like this?

@steveklabnik
Copy link
Member

We don't do aggregate PRs, feel free to send one in for just this, thanks!
:)

On Thu, Nov 12, 2015 at 11:04 AM, Ashkan Kiani notifications@github.com
wrote:

Should I make a PR or is there an aggregate PR for minor changes like this?


Reply to this email directly or view it on GitHub
#29730 (comment).

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

No branches or pull requests

2 participants