diff --git a/doc/tutorial.md b/doc/tutorial.md index fd92a4cc0800f..0efe7e3fdf4a0 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1020,10 +1020,10 @@ being destroyed along with the owner. Since the `list` variable above is immutable, the whole list is immutable. The memory allocation itself is the box, while the owner holds onto a pointer to it: - Cons cell Cons cell Cons cell - +-----------+ +-----+-----+ +-----+-----+ - | 1 | ~ | -> | 2 | ~ | -> | 3 | ~ | -> Nil - +-----------+ +-----+-----+ +-----+-----+ + List box List box List box List box + +--------------+ +--------------+ +--------------+ +--------------+ + list -> | Cons | 1 | ~ | -> | Cons | 2 | ~ | -> | Cons | 3 | ~ | -> | Nil | + +--------------+ +--------------+ +--------------+ +--------------+ An owned box is a common example of a type with a destructor. The allocated memory is cleaned up when the box is destroyed.