about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-03-28 15:00:40 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-03-31 15:47:37 -0700
commit37a3131640d0fa2633aa26db7f849d110250ce51 (patch)
tree1e66451d207e19694d62608a8e1724c71796dc00 /src/doc
parent809342719541db989bee43e695f1d88b8340ac4e (diff)
downloadrust-37a3131640d0fa2633aa26db7f849d110250ce51.tar.gz
rust-37a3131640d0fa2633aa26db7f849d110250ce51.zip
doc: Update with changes in field privacy
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/guide-unsafe.md2
-rw-r--r--src/doc/rust.md15
-rw-r--r--src/doc/tutorial.md8
3 files changed, 11 insertions, 14 deletions
diff --git a/src/doc/guide-unsafe.md b/src/doc/guide-unsafe.md
index 2339f23f56e..4c8e32982c1 100644
--- a/src/doc/guide-unsafe.md
+++ b/src/doc/guide-unsafe.md
@@ -200,7 +200,7 @@ use std::ptr;
 // Unique<T> has the same semantics as ~T
 pub struct Unique<T> {
     // It contains a single raw, mutable pointer to the object in question.
-    priv ptr: *mut T
+    ptr: *mut T
 }
 
 // Implement methods for creating and using the values in the box.
diff --git a/src/doc/rust.md b/src/doc/rust.md
index 359a9c8052b..98db4cb5367 100644
--- a/src/doc/rust.md
+++ b/src/doc/rust.md
@@ -1527,12 +1527,9 @@ of an item to see whether it should be allowed or not. This is where privacy
 warnings are generated, or otherwise "you used a private item of another module
 and weren't allowed to."
 
-By default, everything in rust is *private*, with two exceptions. The first
-exception is that struct fields are public by default (but the struct itself is
-still private by default), and the remaining exception is that enum variants in
-a `pub` enum are the default visibility of the enum container itself.. You are
-allowed to alter this default visibility with the `pub` keyword (or `priv`
-keyword for struct fields and enum variants). When an item is declared as `pub`,
+By default, everything in rust is *private*, with one exception. Enum variants
+in a `pub` enum are also public by default. You are allowed to alter this
+default visibility with the `priv` keyword. When an item is declared as `pub`,
 it can be thought of as being accessible to the outside world. For example:
 
 ~~~~
@@ -1542,7 +1539,7 @@ struct Foo;
 
 // Declare a public struct with a private field
 pub struct Bar {
-    priv field: int
+    field: int
 }
 
 // Declare a public enum with public and private variants
@@ -2354,7 +2351,7 @@ The following are examples of structure expressions:
 ~~~~
 # struct Point { x: f64, y: f64 }
 # struct TuplePoint(f64, f64);
-# mod game { pub struct User<'a> { name: &'a str, age: uint, score: uint } }
+# mod game { pub struct User<'a> { pub name: &'a str, pub age: uint, pub score: uint } }
 # struct Cookie; fn some_fn<T>(t: T) {}
 Point {x: 10.0, y: 20.0};
 TuplePoint(10.0, 20.0);
@@ -3140,7 +3137,7 @@ The types `char` and `str` hold textual data.
 A value of type `char` is a [Unicode scalar value](
 http://www.unicode.org/glossary/#unicode_scalar_value)
 (ie. a code point that is not a surrogate),
-represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF 
+represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF
 or 0xE000 to 0x10FFFF range.
 A `[char]` vector is effectively an UCS-4 / UTF-32 string.
 
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md
index e15145e5f1d..3423a5e090e 100644
--- a/src/doc/tutorial.md
+++ b/src/doc/tutorial.md
@@ -2657,8 +2657,8 @@ Rust doesn't support encapsulation: both struct fields and methods can
 be private. But this encapsulation is at the module level, not the
 struct level.
 
-For convenience, fields are _public_ by default, and can be made _private_ with
-the `priv` keyword:
+Fields are _private_ by default, and can be made _public_ with
+the `pub` keyword:
 
 ~~~
 mod farm {
@@ -2667,8 +2667,8 @@ mod farm {
 # impl Human { pub fn rest(&self) { } }
 # pub fn make_me_a_farm() -> Farm { Farm { chickens: ~[], farmer: Human(0) } }
     pub struct Farm {
-        priv chickens: ~[Chicken],
-        farmer: Human
+        chickens: ~[Chicken],
+        pub farmer: Human
     }
 
     impl Farm {