Auto merge of #30445 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #30370, #30404, #30415, #30419, #30428, #30437, #30439, #30441, #30442, #30443
- Failed merges:
This commit is contained in:
bors 2015-12-17 20:08:48 +00:00
commit 48700be9cb
10 changed files with 31 additions and 44 deletions

View file

@ -130,63 +130,64 @@ on the stack is the first one you retrieve from it.
Lets 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).

View file

@ -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

View file

@ -909,15 +909,6 @@ pub trait SliceConcatExt<T: ?Sized> {
#[stable(feature = "rename_connect_to_join", since = "1.3.0")]
fn join(&self, sep: &T) -> Self::Output;
/// Flattens a slice of `T` into a single value `Self::Output`, placing a
/// given separator between each.
///
/// # Examples
///
/// ```
/// # #![allow(deprecated)]
/// assert_eq!(["hello", "world"].connect(" "), "hello world");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
fn connect(&self, sep: &T) -> Self::Output;

View file

@ -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

View file

@ -644,7 +644,7 @@ pub fn wrapping_shl(self, rhs: u32) -> Self {
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 @@ pub fn wrapping_shl(self, rhs: u32) -> Self {
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.
///

View file

@ -1616,7 +1616,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
}
/// The `Deref` trait is used to specify the functionality of dereferencing
/// operations like `*v`.
/// operations, like `*v`.
///
/// `Deref` also enables ['`Deref` coercions'][coercions].
///

View file

@ -1337,7 +1337,7 @@ fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
// `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 {
// ~ ~~~

View file

@ -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.
//!

View file

@ -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.
//!

View file

@ -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