Remove an outdated example that says it won't compile but it does

Fixes #1656.
This commit is contained in:
Carol (Nichols || Goulding)
2022-01-11 16:47:40 -05:00
committed by Carol (Nichols || Goulding)
parent f17df27fc1
commit 45fe0fc9af

View File

@@ -70,9 +70,8 @@ creating `c`, were not allowed to because `a` has been moved.
We could change the definition of `Cons` to hold references instead, but then
we would have to specify lifetime parameters. By specifying lifetime
parameters, we would be specifying that every element in the list will live at
least as long as the entire list. The borrow checker wouldnt let us compile
`let a = Cons(10, &Nil);` for example, because the temporary `Nil` value would
be dropped before `a` could take a reference to it.
least as long as the entire list. This is the case for the elements and lists
in Listing 15-17, but not in every scenario.
Instead, well change our definition of `List` to use `Rc<T>` in place of
`Box<T>`, as shown in Listing 15-18. Each `Cons` variant will now hold a value