From bd66f57e469b89a0b8ffbe273cac26c02cdf9874 Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Sat, 28 Mar 2015 10:49:45 -0700
Subject: [PATCH 1/5] libc: Don't use unstable apis

Right now the `std::isize::BYTES` typedef is `#[unstable]`, but liblibc is using
this, preventing it from compiling on stable Rust.
---
 src/liblibc/lib.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs
index 7174b2d2c29fe..b7162c4a177d6 100644
--- a/src/liblibc/lib.rs
+++ b/src/liblibc/lib.rs
@@ -307,7 +307,10 @@ pub mod types {
                 #[derive(Copy)] pub struct sockaddr_storage {
                     pub ss_family: sa_family_t,
                     pub __ss_align: isize,
-                    pub __ss_pad2: [u8; 128 - 2 * (::core::isize::BYTES as usize)],
+                    #[cfg(target_pointer_width = "32")]
+                    pub __ss_pad2: [u8; 128 - 2 * 4],
+                    #[cfg(target_pointer_width = "64")]
+                    pub __ss_pad2: [u8; 128 - 2 * 8],
                 }
                 #[repr(C)]
                 #[derive(Copy)] pub struct sockaddr_in {

From 9fb54f87cca9fa89b64c7720d8c9ac10f0905b7f Mon Sep 17 00:00:00 2001
From: Steve Klabnik <steve@steveklabnik.com>
Date: Fri, 27 Mar 2015 14:31:26 -0400
Subject: [PATCH 2/5] Remove standard io chapter from the book

This was originally used to set up the guessing game, but that no longer
exists. This version uses `old_io`, and updating it involves talking
about `&mut` and such, which we haven't covered yet. So, for now, let's
just remove it.

Fixes #23760
---
 src/doc/trpl/SUMMARY.md        |   1 -
 src/doc/trpl/standard-input.md | 166 ---------------------------------
 2 files changed, 167 deletions(-)
 delete mode 100644 src/doc/trpl/standard-input.md

diff --git a/src/doc/trpl/SUMMARY.md b/src/doc/trpl/SUMMARY.md
index 140086e32d080..d31348d667b57 100644
--- a/src/doc/trpl/SUMMARY.md
+++ b/src/doc/trpl/SUMMARY.md
@@ -13,7 +13,6 @@
     * [Looping](looping.md)
     * [Strings](strings.md)
     * [Arrays, Vectors, and Slices](arrays-vectors-and-slices.md)
-    * [Standard Input](standard-input.md)
 * [Intermediate Rust](intermediate.md)
     * [Crates and Modules](crates-and-modules.md)
     * [Testing](testing.md)
diff --git a/src/doc/trpl/standard-input.md b/src/doc/trpl/standard-input.md
deleted file mode 100644
index 38af0c94954ca..0000000000000
--- a/src/doc/trpl/standard-input.md
+++ /dev/null
@@ -1,166 +0,0 @@
-% Standard Input
-
-Getting input from the keyboard is pretty easy, but uses some things
-we haven't seen before. Here's a simple program that reads some input,
-and then prints it back out:
-
-```{rust,ignore}
-# #![feature(old_io)]
-fn main() {
-    println!("Type something!");
-
-    let input = std::old_io::stdin().read_line().ok().expect("Failed to read line");
-
-    println!("{}", input);
-}
-```
-
-Let's go over these chunks, one by one:
-
-```{rust,ignore}
-std::old_io::stdin();
-```
-
-This calls a function, `stdin()`, that lives inside the `std::old_io` module. As
-you can imagine, everything in `std` is provided by Rust, the 'standard
-library.' We'll talk more about the module system later.
-
-Since writing the fully qualified name all the time is annoying, we can use
-the `use` statement to import it in:
-
-```{rust}
-# #![feature(old_io)]
-use std::old_io::stdin;
-
-stdin();
-```
-
-However, it's considered better practice to not import individual functions, but
-to import the module, and only use one level of qualification:
-
-```{rust}
-# #![feature(old_io)]
-use std::old_io;
-
-old_io::stdin();
-```
-
-Let's update our example to use this style:
-
-```{rust,ignore}
-use std::old_io;
-
-fn main() {
-    println!("Type something!");
-
-    let input = old_io::stdin().read_line().ok().expect("Failed to read line");
-
-    println!("{}", input);
-}
-```
-
-Next up:
-
-```{rust,ignore}
-.read_line()
-```
-
-The `read_line()` method can be called on the result of `stdin()` to return
-a full line of input. Nice and easy.
-
-```{rust,ignore}
-.ok().expect("Failed to read line");
-```
-
-Do you remember this code?
-
-```{rust}
-enum OptionalInt {
-    Value(i32),
-    Missing,
-}
-
-fn main() {
-    let x = OptionalInt::Value(5);
-    let y = OptionalInt::Missing;
-
-    match x {
-        OptionalInt::Value(n) => println!("x is {}", n),
-        OptionalInt::Missing => println!("x is missing!"),
-    }
-
-    match y {
-        OptionalInt::Value(n) => println!("y is {}", n),
-        OptionalInt::Missing => println!("y is missing!"),
-    }
-}
-```
-
-We had to match each time to see if we had a value or not. In this case,
-though, we _know_ that `x` has a `Value`, but `match` forces us to handle
-the `missing` case. This is what we want 99% of the time, but sometimes, we
-know better than the compiler.
-
-Likewise, `read_line()` does not return a line of input. It _might_ return a
-line of input, though it might also fail to do so. This could happen if our program
-isn't running in a terminal, but as part of a cron job, or some other context
-where there's no standard input. Because of this, `read_line` returns a type
-very similar to our `OptionalInt`: an `IoResult<T>`. We haven't talked about
-`IoResult<T>` yet because it is the *generic* form of our `OptionalInt`.
-Until then, you can think of it as being the same thing, just for any type –
-not just `i32`s.
-
-Rust provides a method on these `IoResult<T>`s called `ok()`, which does the
-same thing as our `match` statement but assumes that we have a valid value.
-We then call `expect()` on the result, which will terminate our program if we
-don't have a valid value. In this case, if we can't get input, our program
-doesn't work, so we're okay with that. In most cases, we would want to handle
-the error case explicitly. `expect()` allows us to give an error message if
-this crash happens.
-
-We will cover the exact details of how all of this works later in the Guide in
-[Error Handling]. For now, this gives you enough of a basic understanding to
-work with.
-
-Back to the code we were working on! Here's a refresher:
-
-```{rust,ignore}
-use std::old_io;
-
-fn main() {
-    println!("Type something!");
-
-    let input = old_io::stdin().read_line().ok().expect("Failed to read line");
-
-    println!("{}", input);
-}
-```
-
-With long lines like this, Rust gives you some flexibility with the whitespace.
-We _could_ write the example like this:
-
-```{rust,ignore}
-use std::old_io;
-
-fn main() {
-    println!("Type something!");
-
-    // here, we'll show the types at each step
-
-    let input = old_io::stdin() // std::old_io::stdio::StdinReader
-                  .read_line() // IoResult<String>
-                  .ok() // Option<String>
-                  .expect("Failed to read line"); // String
-
-    println!("{}", input);
-}
-```
-
-Sometimes, this makes things more readable – sometimes, less. Use your judgement
-here.
-
-That's all you need to get basic input from the standard input! It's not too
-complicated, but there are a number of small parts.
-
-
-[Error Handling]: ./error-handling.html

From f6c234fb45327c3e96b4fe8902dd7416e0f61dde Mon Sep 17 00:00:00 2001
From: Steve Klabnik <steve@steveklabnik.com>
Date: Sat, 28 Mar 2015 16:06:37 -0400
Subject: [PATCH 3/5] Document properties for Eq + Hash

Fixes #23320
---
 src/libcore/hash/mod.rs            | 10 ++++++++++
 src/libstd/collections/hash/map.rs |  9 ++++++++-
 src/libstd/collections/hash/set.rs | 11 ++++++++++-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs
index 2feb2f8b1e363..2375ae8965005 100644
--- a/src/libcore/hash/mod.rs
+++ b/src/libcore/hash/mod.rs
@@ -73,6 +73,16 @@ mod sip;
 ///
 /// The `H` type parameter is an abstract hash state that is used by the `Hash`
 /// to compute the hash.
+///
+/// If you are also implementing `Eq`, there is an additional property that
+/// is important:
+///
+/// ```text
+/// k1 == k2 -> hash(k1) == hash(k2)
+/// ```
+///
+/// In other words, if two keys are equal, their hashes should also be equal.
+/// `HashMap` and `HashSet` both rely on this behavior.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait Hash {
     /// Feeds this value into the state given, updating the hasher as necessary.
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index 91225891338a5..30ccb05cdf0ee 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -214,7 +214,14 @@ fn test_resize_policy() {
 /// overridden with one of the constructors.
 ///
 /// It is required that the keys implement the `Eq` and `Hash` traits, although
-/// this can frequently be achieved by using `#[derive(Eq, Hash)]`.
+/// this can frequently be achieved by using `#[derive(Eq, Hash)]`. If you
+/// implement these yourself, it is important that the following property holds:
+///
+/// ```text
+/// k1 == k2 -> hash(k1) == hash(k2)
+/// ```
+///
+/// In other words, if two keys are equal, their hashes must be equal.
 ///
 /// It is a logic error for a key to be modified in such a way that the key's
 /// hash, as determined by the `Hash` trait, or its equality, as determined by
diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs
index 0933b4f662a9d..9bb969c404267 100644
--- a/src/libstd/collections/hash/set.rs
+++ b/src/libstd/collections/hash/set.rs
@@ -36,7 +36,16 @@ use super::state::HashState;
 
 /// An implementation of a hash set using the underlying representation of a
 /// HashMap where the value is (). As with the `HashMap` type, a `HashSet`
-/// requires that the elements implement the `Eq` and `Hash` traits.
+/// requires that the elements implement the `Eq` and `Hash` traits. This can
+/// frequently be achieved by using `#[derive(Eq, Hash)]`. If you implement
+/// these yourself, it is important that the following property holds:
+///
+/// ```text
+/// k1 == k2 -> hash(k1) == hash(k2)
+/// ```
+///
+/// In other words, if two keys are equal, their hashes must be equal.
+///
 ///
 /// It is a logic error for an item to be modified in such a way that the
 /// item's hash, as determined by the `Hash` trait, or its equality, as

From 80c188e3c0f9a58f97e9f25733b7ce72faa13131 Mon Sep 17 00:00:00 2001
From: Phil Dawes <pdawes@drw.com>
Date: Sat, 28 Mar 2015 22:18:03 +0000
Subject: [PATCH 4/5] Correct Phil Dawes email address

---
 AUTHORS.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/AUTHORS.txt b/AUTHORS.txt
index f7934b2fa7051..4109797a55ee7 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -606,7 +606,7 @@ Peter Schuller <peter.schuller@infidyne.com>
 Peter Williams <peter@newton.cx>
 Peter Zotov <whitequark@whitequark.org>
 Petter Remen <petter.remen@gmail.com>
-Phil Dawes <pdawes@drw.com>
+Phil Dawes <phil@phildawes.net>
 Phil Ruffwind <rf@rufflewind.com>
 Philip Munksgaard <pmunksgaard@gmail.com>
 Philipp Brüschweiler <blei42@gmail.com>

From 256e78a39c99f9cc7304dba61caf02e180d68c38 Mon Sep 17 00:00:00 2001
From: Nicholas Bishop <nicholasbishop@gmail.com>
Date: Sat, 28 Mar 2015 22:06:42 -0400
Subject: [PATCH 5/5] Fix typo in docstring for slice

---
 src/libcollections/slice.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index ba1ab75de803a..14dcd52fe8081 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -50,8 +50,8 @@
 //!
 //! ## Iteration
 //!
-//! The slices implement `IntoIterator`. The iterators of yield references
-//! to the slice elements.
+//! The slices implement `IntoIterator`. The iterator yields references to the
+//! slice elements.
 //!
 //! ```
 //! let numbers = &[0, 1, 2];