diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-11-05 18:06:27 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-11-17 21:28:18 -0800 |
| commit | dab8fec4af85c94b65d7036129f89a7e7bf6cbac (patch) | |
| tree | bb1e749c9ffbdd1899ad8c3dfa51c1cf77479075 /doc | |
| parent | ade310cbb6e949b27285ca592e34371c1cc6677f (diff) | |
Forbid privacy in inner functions
Closes #10111
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/rust.md | 1 | ||||
| -rw-r--r-- | doc/tutorial-container.md | 2 | ||||
| -rw-r--r-- | doc/tutorial-macros.md | 6 | ||||
| -rw-r--r-- | doc/tutorial.md | 7 |
4 files changed, 11 insertions, 5 deletions
diff --git a/doc/rust.md b/doc/rust.md index 389ea58ee15..c0104e0f756 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -1548,6 +1548,7 @@ keyword for struct fields and enum variants). When an item is declared as `pub`, it can be thought of as being accessible to the outside world. For example: ~~~~ +# fn main() {} // Declare a private struct struct Foo; diff --git a/doc/tutorial-container.md b/doc/tutorial-container.md index bd0510c4fb3..65f536fa9f2 100644 --- a/doc/tutorial-container.md +++ b/doc/tutorial-container.md @@ -87,6 +87,7 @@ Reaching the end of the iterator is signalled by returning `None` instead of `Some(item)`: ~~~ +# fn main() {} /// A stream of N zeroes struct ZeroStream { priv remaining: uint @@ -301,6 +302,7 @@ the iterator can provide better information. The `ZeroStream` from earlier can provide an exact lower and upper bound: ~~~ +# fn main() {} /// A stream of N zeroes struct ZeroStream { priv remaining: uint diff --git a/doc/tutorial-macros.md b/doc/tutorial-macros.md index 4117faa1a6b..0ad8adf3cc7 100644 --- a/doc/tutorial-macros.md +++ b/doc/tutorial-macros.md @@ -216,7 +216,7 @@ Now consider code like the following: ~~~~ # enum t1 { good_1(t2, uint), bad_1 }; -# pub struct t2 { body: t3 } +# struct t2 { body: t3 } # enum t3 { good_2(uint), bad_2}; # fn f(x: t1) -> uint { match x { @@ -262,7 +262,7 @@ macro_rules! biased_match ( ) # enum t1 { good_1(t2, uint), bad_1 }; -# pub struct t2 { body: t3 } +# struct t2 { body: t3 } # enum t3 { good_2(uint), bad_2}; # fn f(x: t1) -> uint { biased_match!((x) ~ (good_1(g1, val)) else { return 0 }; @@ -364,7 +364,7 @@ macro_rules! biased_match ( # enum t1 { good_1(t2, uint), bad_1 }; -# pub struct t2 { body: t3 } +# struct t2 { body: t3 } # enum t3 { good_2(uint), bad_2}; # fn f(x: t1) -> uint { biased_match!( diff --git a/doc/tutorial.md b/doc/tutorial.md index 685c9f72217..1b414c40834 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -2568,6 +2568,7 @@ pub fn foo() { bar(); } ~~~ // c.rs pub fn bar() { println("Baz!"); } +# fn main() {} ~~~ There also exist two short forms for importing multiple names at once: @@ -2743,7 +2744,7 @@ Therefore, if you plan to compile your crate as a library, you should annotate i #[link(name = "farm", vers = "2.5")]; // ... -# pub fn farm() {} +# fn farm() {} ~~~~ You can also in turn require in a `extern mod` statement that certain link metadata items match some criteria. @@ -2769,7 +2770,7 @@ or setting the crate type (library or executable) explicitly: // Turn on a warning #[warn(non_camel_case_types)] -# pub fn farm() {} +# fn farm() {} ~~~~ If you're compiling your crate with `rustpkg`, @@ -2790,7 +2791,9 @@ We define two crates, and use one of them as a library in the other. ~~~~ // world.rs #[link(name = "world", vers = "0.42")]; +# extern mod extra; pub fn explore() -> &'static str { "world" } +# fn main() {} ~~~~ ~~~~ {.xfail-test} |
