You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"borrowing" is used extensively before any explanation, especially in Capturing #2023
The page on Capturing (fn/closures/capture.md) makes many references to borrowing to explain the semantics. But borrowing won't be explained for another six full sections.
(There are earlier references to borrowing as well, in primitives/array.md, custom_types/enum/testcase_linked_list.md, flow_control/for.md, and flow_control/match/destructuring/destructure_pointers.md. But those are fairly incidental, and easy to skim past while still getting the general gist of things. Not so with Capturing.)
I certainly don't think it would be a good idea to move the section on Scopes to someplace before Capturing. But I don't think it would hurt to add a short, basic explanation at an earlier point — maybe in Primitives? — noting that a full treatment will come later.
Alternatively, it might be a good idea to include at the very start a short discussion of what kind of language Rust is (or maybe why someone would want to learn Rust) … the goal of having both efficiency and safety, what safety means, and Rust's approach is to make the notion of ownership of data a first-class concept in the language. The term "borrowing" fits very naturally in such a discussion. That would also be a good place to actually explain & and *, which as far as I can tell are never explained at all.
(If that alternative suggestion is appealing, I'm happy to file a different issue just for that.)
Confirmed that Capturing introduces borrowing before the detailed explanation in Scoping rules. I am adding a brief primer and links to those later sections without reordering the chapters.
Activity
TXyy2023 commentedon Oct 17, 2026
Confirmed that Capturing introduces borrowing before the detailed explanation in Scoping rules. I am adding a brief primer and links to those later sections without reordering the chapters.
TXyy2023 commentedon Oct 17, 2026
Submitted #2040 with a brief ownership and borrowing primer before the capturing examples, plus links to the later detailed chapters.