diff --git a/src/doc/book/the-stack-and-the-heap.md b/src/doc/book/the-stack-and-the-heap.md index 9cc3e12aa04ac..63b73a7fc31fc 100644 --- a/src/doc/book/the-stack-and-the-heap.md +++ b/src/doc/book/the-stack-and-the-heap.md @@ -130,63 +130,64 @@ on the stack is the first one you retrieve from it. Let’s try a three-deep example: ```rust -fn bar() { +fn italic() { let i = 6; } -fn foo() { +fn bold() { let a = 5; let b = 100; let c = 1; - bar(); + italic(); } fn main() { let x = 42; - foo(); + bold(); } ``` +We have some kooky function names to make the diagrams clearer. + Okay, first, we call `main()`: | Address | Name | Value | |---------|------|-------| | 0 | x | 42 | -Next up, `main()` calls `foo()`: +Next up, `main()` calls `bold()`: | Address | Name | Value | |---------|------|-------| -| 3 | c | 1 | -| 2 | b | 100 | -| 1 | a | 5 | +| **3** | **c**|**1** | +| **2** | **b**|**100**| +| **1** | **a**| **5** | | 0 | x | 42 | -And then `foo()` calls `bar()`: +And then `bold()` calls `italic()`: | Address | Name | Value | |---------|------|-------| -| 4 | i | 6 | -| 3 | c | 1 | -| 2 | b | 100 | -| 1 | a | 5 | +| *4* | *i* | *6* | +| **3** | **c**|**1** | +| **2** | **b**|**100**| +| **1** | **a**| **5** | | 0 | x | 42 | - Whew! Our stack is growing tall. -After `bar()` is over, its frame is deallocated, leaving just `foo()` and +After `italic()` is over, its frame is deallocated, leaving just `bold()` and `main()`: | Address | Name | Value | |---------|------|-------| -| 3 | c | 1 | -| 2 | b | 100 | -| 1 | a | 5 | -| 0 | x | 42 | +| **3** | **c**|**1** | +| **2** | **b**|**100**| +| **1** | **a**| **5** | +| 0 | x | 42 | -And then `foo()` ends, leaving just `main()`: +And then `bold()` ends, leaving just `main()`: | Address | Name | Value | |---------|------|-------| @@ -578,3 +579,4 @@ comes at the cost of either significant runtime support (e.g. in the form of a garbage collector) or significant programmer effort (in the form of explicit memory management calls that require verification not provided by the Rust compiler). + diff --git a/src/doc/nomicon/lifetimes.md b/src/doc/nomicon/lifetimes.md index e21207efdcf9d..45eb68baeb732 100644 --- a/src/doc/nomicon/lifetimes.md +++ b/src/doc/nomicon/lifetimes.md @@ -107,8 +107,8 @@ This signature of `as_str` takes a reference to a u32 with *some* lifetime, and promises that it can produce a reference to a str that can live *just as long*. Already we can see why this signature might be trouble. That basically implies that we're going to find a str somewhere in the scope the reference -to the u32 originated in, or somewhere *even earlier*. That's a bit of a big -ask. +to the u32 originated in, or somewhere *even earlier*. That's a bit of a tall +order. We then proceed to compute the string `s`, and return a reference to it. Since the contract of our function says the reference must outlive `'a`, that's the diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 454e2b02b1ca0..cde86230d7509 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -23,12 +23,6 @@ //! nor does it provide concurrency or I/O. These things require //! platform integration, and this library is platform-agnostic. //! -//! *It is not recommended to use the core library*. The stable -//! functionality of libcore is reexported from the -//! [standard library](../std/index.html). The composition of this library is -//! subject to change over time; only the interface exposed through libstd is -//! intended to be stable. -//! //! # How to use the core library //! // FIXME: Fill me in with more detail when the interface settles diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 4f3c12567095e..8abb12706a5e3 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -644,7 +644,7 @@ macro_rules! int_impl { self.overflowing_shl(rhs).0 } - /// Panic-free bitwise shift-left; yields `self >> mask(rhs)`, + /// Panic-free bitwise shift-right; yields `self >> mask(rhs)`, /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. /// @@ -1446,7 +1446,7 @@ macro_rules! uint_impl { self.overflowing_shl(rhs).0 } - /// Panic-free bitwise shift-left; yields `self >> mask(rhs)`, + /// Panic-free bitwise shift-right; yields `self >> mask(rhs)`, /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. /// diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 0abbd70762d68..dd4702376d43c 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -1616,7 +1616,7 @@ impl fmt::Debug for RangeTo { } /// The `Deref` trait is used to specify the functionality of dereferencing -/// operations like `*v`. +/// operations, like `*v`. /// /// `Deref` also enables ['`Deref` coercions'][coercions]. /// diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index cde8e7a6d1e13..6a5910074d915 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -1337,7 +1337,7 @@ explanatory comments for the same example: // `for`-loops use a protocol based on the `Iterator` // trait. Each item yielded in a `for` loop has the - // type `Iterator::Item` -- that is,I `Item` is the + // type `Iterator::Item` -- that is, `Item` is the // associated type of the concrete iterator impl. for v in &vs { // ~ ~~~ diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 054f281c07071..0f8b2f6e17b25 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -25,7 +25,7 @@ //! //! # How to read this documentation //! -//! If you already know the name of what you are looking for the fastest way to +//! If you already know the name of what you are looking for, the fastest way to //! find it is to use the search //! bar at the top of the page. //! diff --git a/src/libstd/prelude/mod.rs b/src/libstd/prelude/mod.rs index bda4cdfb43733..04568ad85bffe 100644 --- a/src/libstd/prelude/mod.rs +++ b/src/libstd/prelude/mod.rs @@ -43,7 +43,7 @@ //! //! [`std::io::prelude`]: ../io/prelude/index.html //! -//! The differece between 'the prelude' and these other preludes is that they +//! The difference between 'the prelude' and these other preludes is that they //! are not automatically `use`'d, and must be imported manually. This is still //! easier than importing all of their consitutent components. //! diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs index afeb4231aba48..ed59c51b0f0d8 100644 --- a/src/libstd/primitive_docs.rs +++ b/src/libstd/primitive_docs.rs @@ -333,7 +333,7 @@ mod prim_slice { } /// let ptr = story.as_ptr(); /// let len = story.len(); /// -/// // story has thirteen bytes +/// // story has nineteen bytes /// assert_eq!(19, len); /// /// // We can re-build a str out of ptr and len. This is all unsafe becuase