//@ have to do that in our previous version?
//@
//@ The answer is already hidden in the type of `vec_min`: `v` is just borrowed, but
//@ the Option<BigInt> that it returns is *owned*. We can't just return one of the elements of `v`,
//@ as that would mean that it is no longer in the vector! In our code, this comes up when we update
//@ have to do that in our previous version?
//@
//@ The answer is already hidden in the type of `vec_min`: `v` is just borrowed, but
//@ the Option<BigInt> that it returns is *owned*. We can't just return one of the elements of `v`,
//@ as that would mean that it is no longer in the vector! In our code, this comes up when we update
//@ `e.clone()`, Rust will complain "Cannot move out of borrowed content". That's because
//@ `e` is a `&BigInt`. Assigning `min = Some(*e)` works just like a function call: Ownership of the
//@ `e.clone()`, Rust will complain "Cannot move out of borrowed content". That's because
//@ `e` is a `&BigInt`. Assigning `min = Some(*e)` works just like a function call: Ownership of the
//@ we just borrowed `e`, so we cannot empty it! We can, however, call `clone` on it. Then we own
//@ the copy that was created, and hence we can store it in `min`. <br/>
//@ we just borrowed `e`, so we cannot empty it! We can, however, call `clone` on it. Then we own
//@ the copy that was created, and hence we can store it in `min`. <br/>
-//@ Of course, making such a full copy is expensive, so we'd like to avoid it. We'll some to that in the next part.
+//@ Of course, making such a full copy is expensive, so we'd like to avoid it. We'll come to that in the next part.
// ## Lifetimes
//@ To fix the performance problems of `vec_min`, we need to avoid using `clone`. We'd like
//@ the return value to not be owned (remember that this was the source of our need for cloning), but *borrowed*.
// ## Lifetimes
//@ To fix the performance problems of `vec_min`, we need to avoid using `clone`. We'd like
//@ the return value to not be owned (remember that this was the source of our need for cloning), but *borrowed*.
-//@ To give the answer to this question, we have to talk about the *lifetime* of a borrow. The point is, saying that
+//@ To give the answer to this question, we have to talk about the *lifetime* of a reference. The point is, saying that
//@ you borrowed your friend a `Vec<i32>`, or a book, is not good enough, unless you also agree on *how long*
//@ your friend can borrow it. After all, you need to know when you can rely on owning your data (or book) again.
//@
//@ you borrowed your friend a `Vec<i32>`, or a book, is not good enough, unless you also agree on *how long*
//@ your friend can borrow it. After all, you need to know when you can rely on owning your data (or book) again.
//@
//@ type of `head` reads as follows: `fn<'a, T>(&'a Vec<T>) -> Option<&'a T>`. Here, `'a` is a *lifetime variable*, which
//@ type of `head` reads as follows: `fn<'a, T>(&'a Vec<T>) -> Option<&'a T>`. Here, `'a` is a *lifetime variable*, which
//@
//@ When analyzing the code of `rust_foo`, Rust has to assign a lifetime to `first`. It will choose the scope
//@ where `first` is valid, which is the entire rest of the function. Because `head` ties the lifetime of its
//@ argument and return value together, this means that `&v` also has to borrow `v` for the entire duration of
//@
//@ When analyzing the code of `rust_foo`, Rust has to assign a lifetime to `first`. It will choose the scope
//@ where `first` is valid, which is the entire rest of the function. Because `head` ties the lifetime of its
//@ argument and return value together, this means that `&v` also has to borrow `v` for the entire duration of
-//@ the function. So when we try to borrow `v` mutable for `push`, Rust complains that the two borrows (the one
-//@ for `head`, and the one for `push`) overlap. Lucky us! Rust caught our mistake and made sure we don't crash the program.
+//@ the function `rust_foo`. So when we try to create a unique reference to `v` for `push`, Rust complains that the two references (the one
+//@ for `head`, and the one for `push`) overlap, so neither of them can be unique. Lucky us! Rust caught our mistake and made sure we don't crash the program.
-//@ So, to sum this up: Lifetimes enable Rust to reason about *how long* a pointer has been borrowed. We can thus
-//@ safely write functions like `head`, that return pointers into data they got as argument, and make sure they
+//@ So, to sum this up: Lifetimes enable Rust to reason about *how long* a reference is valid, how long ownership has been borrowed. We can thus
+//@ safely write functions like `head`, that return references into data they got as argument, and make sure they
//@ are used correctly, *while looking only at the function type*. At no point in our analysis of `rust_foo` did
//@ we have to look *into* `head`. That's, of course, crucial if we want to separate library code from application code.
//@ are used correctly, *while looking only at the function type*. At no point in our analysis of `rust_foo` did
//@ we have to look *into* `head`. That's, of course, crucial if we want to separate library code from application code.
-//@ Most of the time, we don't have to explicitly add lifetimes to function types. This is thanks to *lifetimes elision*,
-//@ where Rust will automatically insert lifetimes we did not specify, following some [simple, well-documented rules](http://doc.rust-lang.org/stable/book/lifetimes.html#lifetime-elision).
+//@ Most of the time, we don't have to explicitly add lifetimes to function types. This is thanks to *lifetime elision*,
+//@ where Rust will automatically insert lifetimes we did not specify, following some [simple, well-documented rules](https://doc.rust-lang.org/stable/book/lifetimes.html#lifetime-elision).