cognitive-engineering-lab / rust-book

The Rust Programming Language: Experimental Edition
https://rust-book.cs.brown.edu
Other
636 stars 100 forks source link

Rephrasing example "References Change Permissions on Places" #212

Closed Anemoonvis closed 1 month ago

Anemoonvis commented 1 month ago

In the section on references and borrowing https://rust-book.cs.brown.edu/ch04-02-references-and-borrowing.html#references-change-permissions-on-places

I find the explanation at point four (see image) the unnecessarily confusing:

image

In my opinion, this seems to imply that v.push(4) somehow makes v be out of use/lose all its permissions. However, if I understand correctly, this just happens because we've reached the end of the scope/program. So, in my opinion at least, it would be a bit clearer if it is rephrased to for example "when the end of the program is reached, v is no longer in use (...)".

Thanks a lot for making this version of the book btw! For me the quizzes really help make the learning more fun and efficient!

Anemoonvis commented 1 month ago

I've come to realise that this a standard way of phrasing in the book, so probably this is intentional. Then I take it, it is simply something I had to get used to.