X-Git-Url: https://git.ralfj.de/rust-101.git/blobdiff_plain/7fdd4203f19f2fa9096d0a662acf22d447e57af1..174314786770835cff60100f9ea66aeec59745a4:/src/part16.rs diff --git a/src/part16.rs b/src/part16.rs index fefccdf..5ae6a48 100644 --- a/src/part16.rs +++ b/src/part16.rs @@ -166,7 +166,7 @@ impl<'a, T> Iterator for IterMut<'a, T> { //@ The linked list we wrote is already working quite nicely, but there is one problem: When the list is dropped, //@ nobody bothers to deallocate the remaining nodes. Even worse, if `T` itself has a destructor that needs to //@ clean up, it is not called for the element remaining in the list. We need to take care of that ourselves. -//@ + //@ In Rust, adding a destructor for a type is done by implementing the `Drop` trait. This is a very special trait. //@ It can only be implemented for *nominal types*, i.e., you cannot implement `Drop` for `&mut T`. You also cannot //@ restrict the type and lifetime parameters further than the type does - the `Drop` implementation has to apply to *all* instances