Skip to content

Commit f2758dc

Browse files
committed
---
yaml --- r: 139452 b: refs/heads/try2 c: 0189ef3 h: refs/heads/master v: v3
1 parent a41fd27 commit f2758dc

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: f78af18127e2bc0075479e8495bfa63807e938fc
8+
refs/heads/try2: 0189ef360092dbebfef5bdfd7a2ebe0c0ccc0f3c
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/tutorial.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,10 +1173,7 @@ For a more in-depth explanation of borrowed pointers, read the
11731173
## Freezing
11741174
11751175
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.
11801177
11811178
~~~~
11821179
let mut x = 5;
@@ -1186,6 +1183,20 @@ let mut x = 5;
11861183
// x is now unfrozen again
11871184
~~~~
11881185
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+
11891200
# Dereferencing pointers
11901201
11911202
Rust uses the unary star operator (`*`) to access the contents of a

0 commit comments

Comments
 (0)