-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Borrowing #59
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
Borrowing #59
Conversation
|
I wonder if the examples bit shouldn't come after slices, as its own chapter. |
|
This is a great start! Some initial thoughts:
I think we should reframe this as: In languages with pointers, it's easy to crate a "dangling pointer" by freeing some memory while keeping around a pointer to that memory. In Rust, by contrast, the compiler guarantees that references will never be dangling: if we have a reference the something, the compiler will ensure that it will not go out of scope before the reference does.
And, as I said before, I think we want to spend a bit more effort trying to motivate the various rules (but hopefully can do so without major digressions.) |
8d255a8 to
c49844f
Compare
|
I've updated a few things.
What about @Manishearth's post: http://manishearth.github.io/blog/2015/05/17/the-problem-with-shared-mutability/ maybe one of these?
I thought this was sorta implied by the 'dangling' section, but maybe it could be its own section too? Or dangling would be a sub-section of it? |
7c38568 to
fbffce8
Compare
src/references-and-borrowing.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/crate/create/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for both of these, fixing :0
|
I'm going to merge this for now, and we can come back to clean up the details later. Worrying about this is blocking me moving forward, and the details are all fairly minor. I'm going to open up individual issues for the stuff that's not been addressed. |
PR rust-lang#3152 fixed the invalid alt text (so it correctly validates), but was the wrong character. & is the correct ampersand, &rust-lang#59; was a semicolon
r? @aturon
This also needs a diagram before merging.