rust-lang / nomicon

The Dark Arts of Advanced and Unsafe Rust Programming
https://doc.rust-lang.org/nomicon/
Apache License 2.0
1.75k stars 258 forks source link

Rephrase improperly reduced borrows introduction #352

Closed Arthur-Milchior closed 2 years ago

Arthur-Milchior commented 2 years ago

The issue with the current version of this paragraph is that it refers to code that will occur later. It can only be understood once we know what is borrowed and when, which only becomes clear when the error message is shown.

With this new phrasing, I hope that the introduction prepares the reader to what they'll find out.

Another solution would be to imitate the first example of this page. Introduce the code with just "Given the following code:" and then comment why it failed.