From a16f3d282a991ef1c28fded477f9a1d30c6f3b5c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 28 Apr 2023 15:34:47 +0200 Subject: [PATCH] more typos --- src/part06.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/part06.rs b/src/part06.rs index de90cb6..4c7ee24 100644 --- a/src/part06.rs +++ b/src/part06.rs @@ -127,7 +127,7 @@ fn head(v: &Vec) -> Option<&T> { //@ 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 +//@ (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 { let first: Option<&i32> = head(&v); -- 2.30.2