Skip to content

Commit 8f93d39

Browse files
author
Div Shekhar
committed
doc: add note below diagram about memory layout.
1 parent 065f936 commit 8f93d39

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/tutorial.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,11 @@ box, while the owner holds onto a pointer to it:
10251025
list -> | Cons | 1 | ~ | -> | Cons | 2 | ~ | -> | Cons | 3 | ~ | -> | Nil |
10261026
+--------------+ +--------------+ +--------------+ +--------------+
10271027

1028+
> Note: the above diagram shows the logical contents of the enum. The actual
1029+
> memory layout of the enum may vary. For example, for the `List` enum shown
1030+
> above, Rust guarantees that there will be no enum tag field in the actual
1031+
> structure. See the language reference for more details.
1032+
10281033
An owned box is a common example of a type with a destructor. The allocated
10291034
memory is cleaned up when the box is destroyed.
10301035

0 commit comments

Comments
 (0)