diff options
| author | bors <bors@rust-lang.org> | 2014-01-03 22:36:53 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-03 22:36:53 -0800 |
| commit | 3dd7c49faf5ae3a9158ab242a264c0f0eb99f657 (patch) | |
| tree | 0393c0b2e10c7579d86c222071bb9c64b0451b60 /doc/tutorial.md | |
| parent | 0ff6c12ce94993dae702d597a213eee6b969231a (diff) | |
| parent | 80921536343e87d2f7d7f19ad90d63f50b557e06 (diff) | |
| download | rust-3dd7c49faf5ae3a9158ab242a264c0f0eb99f657.tar.gz rust-3dd7c49faf5ae3a9158ab242a264c0f0eb99f657.zip | |
auto merge of #11251 : pcwalton/rust/remove-at-mut, r=pcwalton
r? @nikomatsakis for the borrow checker changes. Write guards are now eliminated.
Diffstat (limited to 'doc/tutorial.md')
| -rw-r--r-- | doc/tutorial.md | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/doc/tutorial.md b/doc/tutorial.md index edb93521394..4edbf171065 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1431,8 +1431,8 @@ For a more in-depth explanation of borrowed pointers, read the ## Freezing Lending an immutable pointer to an object freezes it and prevents mutation. -`Freeze` objects have freezing enforced statically at compile-time. Examples -of non-`Freeze` types are `@mut` and [`RefCell<T>`][refcell]. +`Freeze` objects have freezing enforced statically at compile-time. An example +of a non-`Freeze` type is [`RefCell<T>`][refcell]. ~~~~ let mut x = 5; @@ -1443,20 +1443,6 @@ let mut x = 5; # x = 3; ~~~~ -Mutable managed boxes handle freezing dynamically when any of their contents -are borrowed, and the task will fail if an attempt to modify them is made while -they are frozen: - -~~~~ -let x = @mut 5; -let y = x; -{ - let z = &*y; // the managed box is now frozen - // modifying it through x or y will cause a task failure -} -// the box is now unfrozen again -~~~~ - [refcell]: http://static.rust-lang.org/doc/master/std/cell/struct.RefCell.html # Dereferencing pointers @@ -1477,13 +1463,12 @@ assignments. Such an assignment modifies the value that the pointer points to. ~~~ -let managed = @mut 10; +let managed = @10; let mut owned = ~20; let mut value = 30; let borrowed = &mut value; -*managed = *owned + 10; *owned = *borrowed + 100; *borrowed = *managed + 1000; ~~~ @@ -2113,8 +2098,7 @@ unless they contain managed boxes, managed closures, or borrowed pointers. * `Freeze` - Constant (immutable) types. These are types that do not contain anything intrinsically mutable. -Intrinsically mutable values include `@mut` -and `Cell` in the standard library. +Intrinsically mutable values include `Cell` in the standard library. * `'static` - Non-borrowed types. These are types that do not contain any data whose lifetime is bound to |
