Merge pull request #458 from evectant/ch10-edits

Fix grammar in ch10-03
This commit is contained in:
Carol (Nichols || Goulding)
2017-02-21 21:01:54 -05:00
committed by GitHub
+4 -4
View File
@@ -345,14 +345,14 @@ By specifying the lifetime parameters in this function signature, we are not
changing the lifetimes of any values passed in or returned, but we are saying changing the lifetimes of any values passed in or returned, but we are saying
that any values that do not adhere to this contract should be rejected by the that any values that do not adhere to this contract should be rejected by the
borrow checker. This function does not know (or need to know) exactly how long borrow checker. This function does not know (or need to know) exactly how long
`x` and `y` will live, but only needs to knows that there is some scope that `x` and `y` will live, but only needs to know that there is some scope that
can be substituted for `'a` that will satisfy this signature. can be substituted for `'a` that will satisfy this signature.
When annotating lifetimes in functions, the annotations go on the function When annotating lifetimes in functions, the annotations go on the function
signature, and not in any of the code in the function body. This is because signature, and not in any of the code in the function body. This is because
Rust is able analyze the code within the function without any help, but when a Rust is able to analyze the code within the function without any help, but when
function has references to or from code outside that function, the lifetimes of a function has references to or from code outside that function, the lifetimes
the arguments or return values will potentially be different each time the of the arguments or return values will potentially be different each time the
function is called. This would be incredibly costly and often impossible for function is called. This would be incredibly costly and often impossible for
Rust to figure out. In this case, we need to annotate the lifetimes ourselves. Rust to figure out. In this case, we need to annotate the lifetimes ourselves.