//@ have aliasing (of `first` and `v`) and mutation. But this time, the bug is hidden behind the
//@ call to `head`. How does Rust solve this? If we translate the code above to Rust, it doesn't
//@ compile, so clearly we are good - but how and why?
-//@ (Notice that have to explicitly assert using //@ `unwrap` that `first` is not `None`, whereas
-//@ the C++ code above would silently dereference a //@ `NULL`-pointer. But that's another point.)
+//@ (Notice that we use `unwrap` to explicitly assert that `first` is not `None`, whereas
+//@ the C++ code above would silently dereference a `NULL`-pointer. But that's another point.)
fn rust_foo(mut v: Vec<i32>) -> i32 {
let first: Option<&i32> = head(&v);
/* v.push(42); */
//@ application code. 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).
+//@ [rules](https://doc.rust-lang.org/stable/book/lifetimes.html#lifetime-elision).
//@ [index](main.html) | [previous](part05.html) | [raw source](workspace/src/part06.rs) |
//@ [next](part07.html)