File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -14,5 +14,5 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
14
14
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
15
15
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
16
16
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17
- refs/heads/auto: f78af18127e2bc0075479e8495bfa63807e938fc
17
+ refs/heads/auto: 0189ef360092dbebfef5bdfd7a2ebe0c0ccc0f3c
18
18
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
Original file line number Diff line number Diff line change @@ -1173,10 +1173,7 @@ For a more in-depth explanation of borrowed pointers, read the
1173
1173
## Freezing
1174
1174
1175
1175
Borrowing an immutable pointer to an object freezes it and prevents mutation.
1176
- `Owned` objects have freezing enforced statically at compile-time. Mutable
1177
- managed boxes handle freezing dynamically when any of their contents are
1178
- borrowed, and the task will fail if an attempt to modify them is made while
1179
- they are frozen.
1176
+ `Owned` objects have freezing enforced statically at compile-time.
1180
1177
1181
1178
~~~~
1182
1179
let mut x = 5;
@@ -1186,6 +1183,20 @@ let mut x = 5;
1186
1183
// x is now unfrozen again
1187
1184
~~~~
1188
1185
1186
+ Mutable managed boxes handle freezing dynamically when any of their contents
1187
+ are borrowed, and the task will fail if an attempt to modify them is made while
1188
+ they are frozen:
1189
+
1190
+ ~~~~
1191
+ let x = @mut 5;
1192
+ let y = x;
1193
+ {
1194
+ let y = &*y; // the managed box is now frozen
1195
+ // modifying it through x or y will cause a task failure
1196
+ }
1197
+ // the box is now unfrozen again
1198
+ ~~~~
1199
+
1189
1200
# Dereferencing pointers
1190
1201
1191
1202
Rust uses the unary star operator (`*`) to access the contents of a
You can’t perform that action at this time.
0 commit comments