Skip to content

Commit 2f50607

Browse files
committed
Reword memory-ownership section.
1 parent df98cb8 commit 2f50607

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

doc/rust.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,20 +2733,17 @@ the box values pointing to it. Since box values may themselves be passed in
27332733
and out of frames, or stored in the heap, heap allocations may outlive the
27342734
frame they are allocated within.
27352735

2736-
27372736
### Memory ownership
27382737

27392738
A task owns all memory it can *safely* reach through local variables,
2740-
shared or unique boxes, and/or references. Sharing memory between tasks can
2741-
only be accomplished using *unsafe* constructs, such as raw pointer
2742-
operations or calling C code.
2743-
2744-
When a task sends a value that has the `send` trait over a channel, it
2745-
loses ownership of the value sent and can no longer refer to it. This is
2746-
statically guaranteed by the combined use of "move semantics" and the
2747-
compiler-checked _meaning_ of the `send` trait: it is only instantiated
2748-
for (transitively) unique kinds of data constructor and pointers, never shared
2749-
pointers.
2739+
as well as managed, owning and borrowed pointers.
2740+
2741+
When a task sends a value that has the `Send` trait to another task,
2742+
it loses ownership of the value sent and can no longer refer to it.
2743+
This is statically guaranteed by the combined use of "move semantics",
2744+
and the compiler-checked _meaning_ of the `Send` trait:
2745+
it is only instantiated for (transitively) sendable kinds of data constructor and pointers,
2746+
never including managed or borrowed pointers.
27502747

27512748
When a stack frame is exited, its local allocations are all released, and its
27522749
references to boxes (both shared and owned) are dropped.

0 commit comments

Comments
 (0)