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.
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.