about summary refs log tree commit diff
path: root/doc/tutorial.md
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-10-05 17:07:57 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-10-07 13:00:52 -0700
commit2c76cdae3e091ee8fe662713e89a56ceffc6e19c (patch)
tree804c557da6346fa3351a6e8061858a71bb71a8fc /doc/tutorial.md
parentde7d1431760c788e5a471194fa85675033d0ed72 (diff)
downloadrust-2c76cdae3e091ee8fe662713e89a56ceffc6e19c.tar.gz
rust-2c76cdae3e091ee8fe662713e89a56ceffc6e19c.zip
Document visibility in the manual/tutorial
This removes the warning "Note" about visibility not being fully defined, as it
should now be considered fully defined with further bugs being considered just
bugs in the implementation.
Diffstat (limited to 'doc/tutorial.md')
-rw-r--r--doc/tutorial.md25
1 files changed, 13 insertions, 12 deletions
diff --git a/doc/tutorial.md b/doc/tutorial.md
index 49ba38954b3..b2da355b122 100644
--- a/doc/tutorial.md
+++ b/doc/tutorial.md
@@ -2322,19 +2322,18 @@ fn main() {
 
 The `::farm::chicken` construct is what we call a 'path'.
 
-Because it's starting with a `::`, it's also a 'global path',
-which qualifies an item by its full path in the module hierarchy
-relative to the crate root.
+Because it's starting with a `::`, it's also a 'global path', which qualifies
+an item by its full path in the module hierarchy relative to the crate root.
 
-If the path were to start with a regular identifier, like `farm::chicken`, it would be
-a 'local path' instead. We'll get to them later.
+If the path were to start with a regular identifier, like `farm::chicken`, it
+would be a 'local path' instead. We'll get to them later.
 
-Now, if you actually tried to compile this code example, you'll notice
-that you get a `unresolved name: 'farm::chicken'` error. That's because per default,
-items (`fn`, `struct`, `static`, `mod`, ...) are only visible inside the module
-they are defined in.
+Now, if you actually tried to compile this code example, you'll notice that you
+get a `function 'chicken' is private` error. That's because by default, items
+(`fn`, `struct`, `static`, `mod`, ...) are private.
 
-To make them visible outside their containing modules, you need to mark them _public_ with `pub`:
+To make them visible outside their containing modules, you need to mark them
+_public_ with `pub`:
 
 ~~~~
 mod farm {
@@ -2356,7 +2355,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:
+For convenience, fields are _public_ by default, and can be made _private_ with
+the `priv` keyword:
 
 ~~~
 mod farm {
@@ -2393,7 +2393,8 @@ fn main() {
 # fn make_me_a_chicken() -> farm::Chicken { 0 }
 ~~~
 
-> ***Note:*** Visibility rules are currently buggy and not fully defined, you might have to add or remove `pub` along a path until it works.
+Exact details and specifications about visibility rules can be found in the Rust
+manual.
 
 ## Files and modules