From 3517ebebe460b8cd2234c398c65fb311e9d24fdf Mon Sep 17 00:00:00 2001 From: Antoine Wacheux Date: Tue, 22 Jan 2019 11:24:33 +0000 Subject: [PATCH] Reword explanations on the return type's lifetime The current explantion is telling that the return type's lifetime is at leat 'a. It suggests that this reference outlives the `&str`s given in the input arguments. This is not correct as this would create invalid references. --- src/ch10-03-lifetime-syntax.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch10-03-lifetime-syntax.md b/src/ch10-03-lifetime-syntax.md index b0d5ed6ee1..1a63a9959e 100644 --- a/src/ch10-03-lifetime-syntax.md +++ b/src/ch10-03-lifetime-syntax.md @@ -276,7 +276,7 @@ This code should compile and produce the result we want when we use it with the The function signature now tells Rust that for some lifetime `'a`, the function takes two parameters, both of which are string slices that live at least as long as lifetime `'a`. The function signature also tells Rust that the string -slice returned from the function will live at least as long as lifetime `'a`. +slice returned from the function will live at most as long as lifetime `'a`. These constraints are what we want Rust to enforce. Remember, when we specify the lifetime parameters in this function signature, we’re not changing the lifetimes of any values passed in or returned. Rather, we’re specifying that