diff options
| author | bors <bors@rust-lang.org> | 2014-04-03 17:17:02 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-04-03 17:17:02 -0700 |
| commit | e7fe20722904cd2829a65f845ee7a1718cdf7292 (patch) | |
| tree | de906a26828f4a01fcdec0112047d16250d5c991 /src/doc/tutorial.md | |
| parent | bb31cb8d2e4e415cbb71d368918d72902e655e01 (diff) | |
| parent | 487fa9568b69753fecb74a8460109239f4bf3631 (diff) | |
| download | rust-e7fe20722904cd2829a65f845ee7a1718cdf7292.tar.gz rust-e7fe20722904cd2829a65f845ee7a1718cdf7292.zip | |
auto merge of #13290 : alexcrichton/rust/rollup, r=alexcrichton
Closes #13285 (rustc: Stop using LLVMGetSectionName) Closes #13280 (std: override clone_from for Vec.) Closes #13277 (serialize: add a few missing pubs to base64) Closes #13275 (Add and remove some ignore-win32 flags) Closes #13273 (Removed managed boxes from libarena.) Closes #13270 (Minor copy-editing for the tutorial) Closes #13267 (fix Option<~ZeroSizeType>) Closes #13265 (Update emacs mode to support new `#![inner(attribute)]` syntax.) Closes #13263 (syntax: Remove AbiSet, use one Abi)
Diffstat (limited to 'src/doc/tutorial.md')
| -rw-r--r-- | src/doc/tutorial.md | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index 7997ed77b5b..b52fe81f7cd 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -2107,7 +2107,7 @@ references, or types where the only contained references have the `'static` lifetime. (For more on named lifetimes and their uses, see the [references and lifetimes guide][lifetimes].) -> ***Note:*** These two traits were referred to as 'kinds' in earlier +> ***Note:*** These built-in traits were referred to as 'kinds' in earlier > iterations of the language, and often still are. Additionally, the `Drop` trait is used to define destructors. This @@ -2600,8 +2600,6 @@ As you can see, your module hierarchy is now three modules deep: There is the cr function, and the module `farm`. The module `farm` also contains two functions and a third module `barn`, which contains a function `hay`. -(In case you already stumbled over `extern crate`: It isn't directly related to a bare `mod`, we'll get to it later. ) - ## Paths and visibility We've now defined a nice module hierarchy. But how do we access the items in it from our `main` function? @@ -2843,11 +2841,11 @@ use farm::cow; The path you give to `use` is per default global, meaning relative to the crate root, no matter how deep the module hierarchy is, or whether the module body it's written in -is contained in its own file (remember: files are irrelevant). +is contained in its own file. (Remember: files are irrelevant.) -This is different to other languages, where you often only find a single import construct that combines the semantic +This is different from other languages, where you often only find a single import construct that combines the semantic of `mod foo;` and `use`-statements, and which tend to work relative to the source file or use an absolute file path -- Rubys `require` or C/C++'s `#include` come to mind. +- Ruby's `require` or C/C++'s `#include` come to mind. However, it's also possible to import things relative to the module of the `use`-statement: Adding a `super::` in front of the path will start in the parent module, @@ -3027,7 +3025,7 @@ The nested `barn` module is private, but the `pub use` allows users of the module `farm` to access a function from `barn` without needing to know that `barn` exists. -In other words, you can use them to decouple an public api from their internal implementation. +In other words, you can use it to decouple a public api from its internal implementation. ## Using libraries @@ -3050,7 +3048,6 @@ fn main() { } ~~~ -Despite its name, `extern crate` is a distinct construct from regular `mod` declarations: A statement of the form `extern crate foo;` will cause `rustc` to search for the crate `foo`, and if it finds a matching binary it lets you use it from inside your crate. |
