Skip to content

Commit 6da09c3

Browse files
committed
doc: Fix some inaccuracies in the tutorial.
* Pointers can refer to stack objects as well as heap objects. * Non-managed types can be cyclic if an arena is used.
1 parent f016fd4 commit 6da09c3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

doc/tutorial.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ copied, not just a pointer.
10541054
For small structs like `Point`, this is usually more efficient than
10551055
allocating memory and going through a pointer. But for big structs, or
10561056
those with mutable fields, it can be useful to have a single copy on
1057-
the heap, and refer to that through a pointer.
1057+
the stack or on the heap, and refer to that through a pointer.
10581058

10591059
Rust supports several types of pointers. The safe pointer types are
10601060
`@T` for managed boxes allocated on the local heap, `~T`, for
@@ -1087,8 +1087,7 @@ let y = x; // Copy of a pointer to the same box
10871087
~~~~
10881088

10891089
Any type that contains managed boxes or other managed types is
1090-
considered _managed_. Managed types are the only types that can
1091-
construct cyclic data structures in Rust, such as doubly-linked lists.
1090+
considered _managed_.
10921091

10931092
~~~
10941093
// A linked list node

0 commit comments

Comments
 (0)