@@ -3950,16 +3950,16 @@ to each function as the task executes. A stack allocation is reclaimed when
3950
3950
control leaves the frame containing it.
3951
3951
3952
3952
The _ heap_ is a general term that describes two separate sets of boxes: managed
3953
- boxes &mdash ; which may be subject to garbage collection &mdash ; 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 &mdash ; which may be subject to garbage collection &mdash ; 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.
3958
3958
3959
3959
### Memory ownership
3960
3960
3961
3961
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.
3963
3963
3964
3964
When a task sends a value that has the ` Send ` trait to another task, it loses
3965
3965
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
4013
4013
local variables. Local variables can be used only after they have been
4014
4014
initialized; this is enforced by the compiler.
4015
4015
4016
- ### Owned boxes
4016
+ ### Boxes
4017
4017
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> ` .
4021
4021
4022
- An example of an owned box type and value:
4022
+ An example of an box type and value:
4023
4023
4024
4024
```
4025
4025
let x: Box<int> = box 10;
4026
4026
```
4027
4027
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.
4033
4032
4034
4033
```
4035
4034
let x: Box<int> = box 10;
0 commit comments