diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2016-04-06 12:12:07 -0700 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2016-04-06 12:12:07 -0700 |
| commit | be862ca5b8ff34ccc04e2b07a2f2ebb863bced69 (patch) | |
| tree | 4970fd411811755ce772c87b5277f91a3fe9b82b /src | |
| parent | 2bbdbd267aaf455789df4647587ba77246dac6d7 (diff) | |
| parent | a7d15ce6a647670ca555b12f0f3b45b0c939fe66 (diff) | |
| download | rust-be862ca5b8ff34ccc04e2b07a2f2ebb863bced69.tar.gz rust-be862ca5b8ff34ccc04e2b07a2f2ebb863bced69.zip | |
Rollup merge of #32634 - varunvats:docs-fix, r=steveklabnik
Minor doc fixes in "Crates and Modules" and "Lifetimes" chapters These commits fix a couple of (minor) issues in the _Crates and Modules_ and the _Lifetimes_ chapters of the book. r? @steveklabnik
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/book/crates-and-modules.md | 22 | ||||
| -rw-r--r-- | src/doc/book/lifetimes.md | 4 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/doc/book/crates-and-modules.md b/src/doc/book/crates-and-modules.md index 0c9ed0bf122..b3ccefe0a6b 100644 --- a/src/doc/book/crates-and-modules.md +++ b/src/doc/book/crates-and-modules.md @@ -118,7 +118,7 @@ build deps examples libphrases-a7448e02a0468eaa.rlib native `libphrases-hash.rlib` is the compiled crate. Before we see how to use this crate from another crate, let’s break it up into multiple files. -# Multiple file crates +# Multiple File Crates If each crate were just one file, these files would get very large. It’s often easier to split up crates into multiple files, and Rust supports this in two @@ -190,13 +190,19 @@ mod farewells; ``` Again, these declarations tell Rust to look for either -`src/english/greetings.rs` and `src/japanese/greetings.rs` or -`src/english/farewells/mod.rs` and `src/japanese/farewells/mod.rs`. Because -these sub-modules don’t have their own sub-modules, we’ve chosen to make them -`src/english/greetings.rs` and `src/japanese/farewells.rs`. Whew! - -The contents of `src/english/greetings.rs` and `src/japanese/farewells.rs` are -both empty at the moment. Let’s add some functions. +`src/english/greetings.rs`, `src/english/farewells.rs`, +`src/japanese/greetings.rs` and `src/japanese/farewells.rs` or +`src/english/greetings/mod.rs`, `src/english/farewells/mod.rs`, +`src/japanese/greetings/mod.rs` and +`src/japanese/farewells/mod.rs`. Because these sub-modules don’t have +their own sub-modules, we’ve chosen to make them +`src/english/greetings.rs`, `src/english/farewells.rs`, +`src/japanese/greetings.rs` and `src/japanese/farewells.rs`. Whew! + +The contents of `src/english/greetings.rs`, +`src/english/farewells.rs`, `src/japanese/greetings.rs` and +`src/japanese/farewells.rs` are all empty at the moment. Let’s add +some functions. Put this in `src/english/greetings.rs`: diff --git a/src/doc/book/lifetimes.md b/src/doc/book/lifetimes.md index e7a4045d9b2..695b1614fb7 100644 --- a/src/doc/book/lifetimes.md +++ b/src/doc/book/lifetimes.md @@ -56,8 +56,8 @@ To fix this, we have to make sure that step four never happens after step three. The ownership system in Rust does this through a concept called lifetimes, which describe the scope that a reference is valid for. -When we have a function that takes a reference by argument, we can be implicit -or explicit about the lifetime of the reference: +When we have a function that takes an argument by reference, we can be +implicit or explicit about the lifetime of the reference: ```rust // implicit |
