about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Clements <clements@racket-lang.org>2013-01-10 16:28:36 -0800
committerBrian Anderson <banderson@mozilla.com>2013-01-10 20:48:49 -0800
commit08275826ca44e736dab4925ea0450aeb731f1d80 (patch)
tree9b45bc1439f444b35d88297279f1cd80a54ec62d
parent42095221f496a4df47c3aee502a3509d969d268e (diff)
corrected imprecision in description of mutable fields
-rw-r--r--doc/tutorial.md10
1 files changed, 8 insertions, 2 deletions
diff --git a/doc/tutorial.md b/doc/tutorial.md
index bce03c4a5ff..40dba7afda4 100644
--- a/doc/tutorial.md
+++ b/doc/tutorial.md
@@ -562,7 +562,12 @@ Structs are quite similar to C structs and are even laid out the same way in
 memory (so you can read from a Rust struct in C, and vice-versa). Use the dot
 operator to access struct fields, as in `mypoint.x`.
 
-Fields that you want to mutate must be explicitly marked `mut`.
+Inherited mutability means that any field of a struct may be mutable, if the
+struct is in a mutable slot (or a field of a struct in a mutable slot, and
+so forth).
+
+A struct that is not mutable due to inherited mutability may declare some
+of its fields nevertheless mutable, using the `mut` keyword.
 
 ~~~~
 struct Stack {
@@ -572,7 +577,8 @@ struct Stack {
 ~~~~
 
 With a value of such a type, you can do `mystack.head += 1`. If `mut` were
-omitted from the type, such an assignment would result in a type error.
+omitted from the type, such an assignment to a struct without inherited
+mutability would result in a type error.
 
 `match` patterns destructure structs. The basic syntax is
 `Name { fieldname: pattern, ... }`: