]> git.proxmox.com Git - rustc.git/blobdiff - src/doc/book/src/ch10-00-generics.md
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / doc / book / src / ch10-00-generics.md
index 032f4374bcd62b4f702a640c7cd3862c3c1da356..c0375a12ba756eae8185892ef01df8b75b7d5fb4 100644 (file)
@@ -94,7 +94,11 @@ in two lists</span>
 The `largest` function has a parameter called `list`, which represents any
 concrete slice of `i32` values that we might pass into the function. As a
 result, when we call the function, the code runs on the specific values that we
-pass in.
+pass in. Don't worry about the syntax of the `for` loop for now. We aren't
+referencing a reference to an `i32` here; we're pattern matching and
+destructuring each `&i32` that the `for` loop gets so that `item` will be an
+`i32` inside the loop body. We'll cover pattern matching in detail in [Chapter
+18][ch18]<!-- ignore -->.
 
 In sum, here are the steps we took to change the code from Listing 10-2 to
 Listing 10-3:
@@ -112,3 +116,5 @@ abstract types.
 For example, say we had two functions: one that finds the largest item in a
 slice of `i32` values and one that finds the largest item in a slice of `char`
 values. How would we eliminate that duplication? Let’s find out!
+
+[ch18]: ch18-00-patterns.html