Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #30445

Merged
merged 19 commits into from
Dec 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
dc7c3cd
fix copy-paste typo in docs for wrapping_shr
zachreizner Dec 13, 2015
bf14d8f
Remove incorrect words about libcore's stability
steveklabnik Dec 16, 2015
936149f
Remove rogue I
shepmaster Dec 16, 2015
62fa40f
Used bold and italic in the markdown to make the stack and heap docum…
Shiney Dec 15, 2015
4e2ec9a
small fix to str doc example
steveklabnik Dec 17, 2015
22b30fa
doc: improve clarity by introducing a pause
tshepang Dec 17, 2015
fc86218
Change "big ask" to "tall order" in Rustonomicon.
swooster Dec 17, 2015
6fdde01
doc: add a missing comma
tshepang Dec 17, 2015
bd4aa64
doc: fix typo
tshepang Dec 17, 2015
dbec8c4
Rollup merge of #30370 - zachreizner:patch-1, r=apasel422
steveklabnik Dec 17, 2015
7963529
Rollup merge of #30404 - Shiney:ImprovedStackHeap, r=steveklabnik
steveklabnik Dec 17, 2015
7fa08d5
Rollup merge of #30415 - steveklabnik:remove_bad_stability_note, r=al…
steveklabnik Dec 17, 2015
6c065b6
Rollup merge of #30419 - shepmaster:rogue-I, r=alexcrichton
steveklabnik Dec 17, 2015
b84de0c
Rollup merge of #30428 - steveklabnik:quickfix, r=apasel422
steveklabnik Dec 17, 2015
6565bc2
Rollup merge of #30437 - tshepang:clarity, r=steveklabnik
steveklabnik Dec 17, 2015
8cd2374
Rollup merge of #30439 - swooster:swooster-nomicon-patch-1, r=stevekl…
steveklabnik Dec 17, 2015
e42f97d
Rollup merge of #30441 - tshepang:missing-comma, r=steveklabnik
steveklabnik Dec 17, 2015
b3bf43c
Rollup merge of #30442 - tshepang:typo, r=steveklabnik
steveklabnik Dec 17, 2015
7ad8fb9
Rollup merge of #30443 - tshepang:just-a-rename, r=steveklabnik
steveklabnik Dec 17, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions src/doc/book/the-stack-and-the-heap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
|---------|------|-------|
Expand Down Expand Up @@ -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).

4 changes: 2 additions & 2 deletions src/doc/nomicon/lifetimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1616,7 +1616,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeTo<Idx> {
}

/// The `Deref` trait is used to specify the functionality of dereferencing
/// operations like `*v`.
/// operations, like `*v`.
///
/// `Deref` also enables ['`Deref` coercions'][coercions].
///
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
// ~ ~~~
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="#" onclick="focusSearchBar();">search
//! bar</a> at the top of the page.
//!
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/prelude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//!
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down