Skip to content

Commit fdd511d

Browse files
committed
Fix terminology around boxes
it's just 'box' not 'owned box'
1 parent 72c27ab commit fdd511d

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

src/doc/reference.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3950,16 +3950,16 @@ to each function as the task executes. A stack allocation is reclaimed when
39503950
control leaves the frame containing it.
39513951

39523952
The _heap_ is a general term that describes two separate sets of boxes: managed
3953-
boxes — which may be subject to garbage collection — and owned
3954-
boxes. The lifetime of an allocation in the heap depends on the lifetime of
3955-
the box values pointing to it. Since box values may themselves be passed in and
3956-
out of frames, or stored in the heap, heap allocations may outlive the frame
3957-
they are allocated within.
3953+
boxes — which may be subject to garbage collection — and boxes. The
3954+
lifetime of an allocation in the heap depends on the lifetime of the box values
3955+
pointing to it. Since box values may themselves be passed in and out of frames,
3956+
or stored in the heap, heap allocations may outlive the frame they are
3957+
allocated within.
39583958

39593959
### Memory ownership
39603960

39613961
A task owns all memory it can *safely* reach through local variables, as well
3962-
as managed, owned boxes and references.
3962+
as managed, boxes and references.
39633963

39643964
When a task sends a value that has the `Send` trait to another task, it loses
39653965
ownership of the value sent and can no longer refer to it. This is statically
@@ -4013,23 +4013,22 @@ state. Subsequent statements within a function may or may not initialize the
40134013
local variables. Local variables can be used only after they have been
40144014
initialized; this is enforced by the compiler.
40154015

4016-
### Owned boxes
4016+
### Boxes
40174017

4018-
An _owned box_ is a reference to a heap allocation holding another value,
4019-
which is constructed by the prefix operator `box`. When the standard library is
4020-
in use, the type of an owned box is `std::owned::Box<T>`.
4018+
An _box_ is a reference to a heap allocation holding another value, which is
4019+
constructed by the prefix operator `box`. When the standard library is in use,
4020+
the type of an box is `std::owned::Box<T>`.
40214021

4022-
An example of an owned box type and value:
4022+
An example of an box type and value:
40234023

40244024
```
40254025
let x: Box<int> = box 10;
40264026
```
40274027

4028-
Owned box values exist in 1:1 correspondence with their heap allocation,
4029-
copying an owned box value makes a shallow copy of the pointer. Rust will
4030-
consider a shallow copy of an owned box to move ownership of the value. After a
4031-
value has been moved, the source location cannot be used unless it is
4032-
reinitialized.
4028+
Box values exist in 1:1 correspondence with their heap allocation, copying an
4029+
box value makes a shallow copy of the pointer. Rust will consider a shallow
4030+
copy of an box to move ownership of the value. After a value has been moved,
4031+
the source location cannot be used unless it is reinitialized.
40334032

40344033
```
40354034
let x: Box<int> = box 10;

0 commit comments

Comments
 (0)