From 1c0acb9d91e50131d9914991dbf71f69466e7cba Mon Sep 17 00:00:00 2001
From: Adam Roben <adam@roben.org>
Date: Mon, 12 Jan 2015 16:18:02 -0500
Subject: [PATCH 01/36] Match prose with code when discussing Ordering values

Now both the enum values and the prose describing them mention the values in the same order.
---
 src/doc/trpl/compound-data-types.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/doc/trpl/compound-data-types.md b/src/doc/trpl/compound-data-types.md
index afa890b84b401..9f7fa374e6990 100644
--- a/src/doc/trpl/compound-data-types.md
+++ b/src/doc/trpl/compound-data-types.md
@@ -253,7 +253,7 @@ things from the standard library if you need them.
 Okay, let's talk about the actual code in the example. `cmp` is a function that
 compares two things, and returns an `Ordering`. We return either
 `Ordering::Less`, `Ordering::Greater`, or `Ordering::Equal`, depending on if
-the two values are greater, less, or equal. Note that each variant of the
+the two values are less, greater, or equal. Note that each variant of the
 `enum` is namespaced under the `enum` itself: it's `Ordering::Greater` not
 `Greater`.
 

From 935b37a460faf6eb54194f3653daf31efb0b9b3b Mon Sep 17 00:00:00 2001
From: visualfc <visualfc@gmail.com>
Date: Wed, 14 Jan 2015 09:45:41 +0800
Subject: [PATCH 02/36] fix string multi line connector '\' for kate

example:
let m = "hello \
           world";
---
 src/etc/kate/rust.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/etc/kate/rust.xml b/src/etc/kate/rust.xml
index 925034eaa00b0..3ceec0f250a33 100644
--- a/src/etc/kate/rust.xml
+++ b/src/etc/kate/rust.xml
@@ -249,7 +249,7 @@
 			<DetectChar char="=" attribute="Normal Text" context="#pop"/>
 			<DetectChar char="&lt;" attribute="Normal Text" context="#pop"/>
 		</context>
-		<context attribute="String" lineEndContext="#stay" name="String">
+		<context attribute="String" lineEndContext="#pop" name="String">
 			<LineContinue attribute="String" context="#stay"/>
 			<DetectChar char="\" attribute="CharEscape" context="CharEscape"/>
 			<DetectChar attribute="String" context="#pop" char="&quot;"/>

From 5b6d0245b8055f176c606604ac6cc0f50ef79b45 Mon Sep 17 00:00:00 2001
From: Tristan Storch <tstorch@math.uni-bielefeld.de>
Date: Tue, 13 Jan 2015 17:45:04 +0100
Subject: [PATCH 03/36] Small Readability Update

---
 src/libcore/str/mod.rs | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 94ee9b7dcf6ad..cf8a96f439649 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -678,18 +678,15 @@ struct TwoWaySearcher {
 */
 impl TwoWaySearcher {
     fn new(needle: &[u8]) -> TwoWaySearcher {
-        let (crit_pos1, period1) = TwoWaySearcher::maximal_suffix(needle, false);
-        let (crit_pos2, period2) = TwoWaySearcher::maximal_suffix(needle, true);
-
-        let crit_pos;
-        let period;
-        if crit_pos1 > crit_pos2 {
-            crit_pos = crit_pos1;
-            period = period1;
-        } else {
-            crit_pos = crit_pos2;
-            period = period2;
-        }
+        let (crit_pos_false, period_false) = TwoWaySearcher::maximal_suffix(needle, false);
+        let (crit_pos_true, period_true) = TwoWaySearcher::maximal_suffix(needle, true);
+
+        let (crit_pos, period) =
+            if crit_pos_false > crit_pos_true {
+                (crit_pos_false, period_false)
+            } else {
+                (crit_pos_true, period_true)
+            };
 
         // This isn't in the original algorithm, as far as I'm aware.
         let byteset = needle.iter()

From 195fd9a2b41ed9b5294f8803aeb84c1ace673e5e Mon Sep 17 00:00:00 2001
From: "NODA, Kai" <nodakai@gmail.com>
Date: Thu, 15 Jan 2015 13:51:29 +0800
Subject: [PATCH 04/36] reference.md: change "mod" to "self" in "use"
 declaration.

This should have been done together with 56dcbd17fdad5d39b7b02e22a7490d2468718d08
for rust-lang/rust#20361

Signed-off-by: NODA, Kai <nodakai@gmail.com>
---
 src/doc/reference.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/doc/reference.md b/src/doc/reference.md
index 623097b2fc90f..07bb6e5132a26 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -971,7 +971,7 @@ path_glob : ident [ "::" [ path_glob
                           | '*' ] ] ?
           | '{' path_item [ ',' path_item ] * '}' ;
 
-path_item : ident | "mod" ;
+path_item : ident | "self" ;
 ```
 
 A _use declaration_ creates one or more local name bindings synonymous with
@@ -991,15 +991,15 @@ Use declarations support a number of convenient shortcuts:
 * Binding all paths matching a given prefix, using the asterisk wildcard syntax
   `use a::b::*;`
 * Simultaneously binding a list of paths differing only in their final element
-  and their immediate parent module, using the `mod` keyword, such as
-  `use a::b::{mod, c, d};`
+  and their immediate parent module, using the `self` keyword, such as
+  `use a::b::{self, c, d};`
 
 An example of `use` declarations:
 
 ```
 use std::iter::range_step;
 use std::option::Option::{Some, None};
-use std::collections::hash_map::{mod, HashMap};
+use std::collections::hash_map::{self, HashMap};
 
 fn foo<T>(_: T){}
 fn bar(map1: HashMap<String, uint>, map2: hash_map::HashMap<String, uint>){}

From fbcc34f48339f643676a3a06c6c31a9ea47a9b8d Mon Sep 17 00:00:00 2001
From: Tim Parenti <timparenti@gmail.com>
Date: Fri, 16 Jan 2015 22:25:22 -0500
Subject: [PATCH 05/36] Grammar tweak to old guide stub documents.

Removes extra "the" from the phrase "the the Rust Programming Language
book", which isn't particularly grammatical.
---
 src/doc/guide-crates.md         | 2 +-
 src/doc/guide-error-handling.md | 2 +-
 src/doc/guide-ffi.md            | 2 +-
 src/doc/guide-macros.md         | 2 +-
 src/doc/guide-ownership.md      | 2 +-
 src/doc/guide-plugins.md        | 2 +-
 src/doc/guide-pointers.md       | 2 +-
 src/doc/guide-strings.md        | 2 +-
 src/doc/guide-tasks.md          | 2 +-
 src/doc/guide-testing.md        | 2 +-
 src/doc/guide-unsafe.md         | 2 +-
 src/doc/guide.md                | 2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/doc/guide-crates.md b/src/doc/guide-crates.md
index 8277988b7fe29..85badc11d64f0 100644
--- a/src/doc/guide-crates.md
+++ b/src/doc/guide-crates.md
@@ -1,4 +1,4 @@
 % The (old) Rust Crates and Modules Guide
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/crates-and-modules.html).
diff --git a/src/doc/guide-error-handling.md b/src/doc/guide-error-handling.md
index 215fe6a441e0e..54fa529f3aa8e 100644
--- a/src/doc/guide-error-handling.md
+++ b/src/doc/guide-error-handling.md
@@ -1,4 +1,4 @@
 % Error Handling in Rust
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/error-handling.html).
diff --git a/src/doc/guide-ffi.md b/src/doc/guide-ffi.md
index 4c818cacbfaf3..1130a10bd1c55 100644
--- a/src/doc/guide-ffi.md
+++ b/src/doc/guide-ffi.md
@@ -1,4 +1,4 @@
 % The (old) Rust Foreign Function Interface Guide
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/ffi.html).
diff --git a/src/doc/guide-macros.md b/src/doc/guide-macros.md
index 534ae3504c3a2..228cb3c624f89 100644
--- a/src/doc/guide-macros.md
+++ b/src/doc/guide-macros.md
@@ -1,4 +1,4 @@
 % The (old) Rust Macros Guide
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/macros.html).
diff --git a/src/doc/guide-ownership.md b/src/doc/guide-ownership.md
index 26e059aeb2680..884f14726ca87 100644
--- a/src/doc/guide-ownership.md
+++ b/src/doc/guide-ownership.md
@@ -1,4 +1,4 @@
 % The (old) Rust Ownership Guide
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/ownership.html).
diff --git a/src/doc/guide-plugins.md b/src/doc/guide-plugins.md
index abfe7a44703a2..d6495d02e1189 100644
--- a/src/doc/guide-plugins.md
+++ b/src/doc/guide-plugins.md
@@ -1,4 +1,4 @@
 % The (old) Rust Compiler Plugins Guide
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/plugins.html).
diff --git a/src/doc/guide-pointers.md b/src/doc/guide-pointers.md
index e72eaf62720b7..0374166405c62 100644
--- a/src/doc/guide-pointers.md
+++ b/src/doc/guide-pointers.md
@@ -1,4 +1,4 @@
 % The (old) Rust Pointer Guide
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/pointers.html).
diff --git a/src/doc/guide-strings.md b/src/doc/guide-strings.md
index fd1420024c665..d030614489bcc 100644
--- a/src/doc/guide-strings.md
+++ b/src/doc/guide-strings.md
@@ -1,4 +1,4 @@
 % The (old) Guide to Rust Strings
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/strings.html).
diff --git a/src/doc/guide-tasks.md b/src/doc/guide-tasks.md
index be8cb67098620..197559bef0408 100644
--- a/src/doc/guide-tasks.md
+++ b/src/doc/guide-tasks.md
@@ -1,4 +1,4 @@
 % The (old) Rust Threads and Communication Guide
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/tasks.html).
diff --git a/src/doc/guide-testing.md b/src/doc/guide-testing.md
index 79721300d941d..67bcb0a5e546a 100644
--- a/src/doc/guide-testing.md
+++ b/src/doc/guide-testing.md
@@ -1,4 +1,4 @@
 % The (old) Rust Testing Guide
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/testing.html).
diff --git a/src/doc/guide-unsafe.md b/src/doc/guide-unsafe.md
index fe8fcc4c19d84..3c1a82d017449 100644
--- a/src/doc/guide-unsafe.md
+++ b/src/doc/guide-unsafe.md
@@ -1,4 +1,4 @@
 % Writing Safe Low-level and Unsafe Code in Rust
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/unsafe.html).
diff --git a/src/doc/guide.md b/src/doc/guide.md
index ba1e2590e7fa5..b9e70e7cfd7e0 100644
--- a/src/doc/guide.md
+++ b/src/doc/guide.md
@@ -1,4 +1,4 @@
 % The (old) Rust Guide
 
-This content has moved into the
+This content has moved into
 [the Rust Programming Language book](book/README.html).

From 812ce6c190d896cf1cc1bef9f22c00266e962c43 Mon Sep 17 00:00:00 2001
From: we <vadim.petrochenkov@gmail.com>
Date: Sat, 17 Jan 2015 07:34:10 +0300
Subject: [PATCH 06/36] Remove unnecessary explicit conversions to *const T

---
 src/doc/trpl/unsafe.md               |  2 +-
 src/liballoc/heap.rs                 |  2 +-
 src/libcollections/btree/node.rs     |  6 +++---
 src/libcollections/ring_buf.rs       |  6 +++---
 src/libcollections/slice.rs          |  2 +-
 src/libcollections/vec.rs            | 12 ++++++------
 src/libcore/atomic.rs                | 12 ++++++------
 src/libcore/ptr.rs                   |  2 +-
 src/libcore/slice.rs                 |  4 ++--
 src/librustc_trans/trans/builder.rs  |  2 +-
 src/librustdoc/flock.rs              |  4 ++--
 src/libstd/collections/hash/table.rs | 23 ++++++++++-------------
 src/libstd/sys/unix/backtrace.rs     |  2 +-
 src/libstd/thread_local/mod.rs       |  2 +-
 14 files changed, 39 insertions(+), 42 deletions(-)

diff --git a/src/doc/trpl/unsafe.md b/src/doc/trpl/unsafe.md
index 075340660df15..997dda98ef369 100644
--- a/src/doc/trpl/unsafe.md
+++ b/src/doc/trpl/unsafe.md
@@ -254,7 +254,7 @@ impl<T: Send> Drop for Unique<T> {
             // Copy the object out from the pointer onto the stack,
             // where it is covered by normal Rust destructor semantics
             // and cleans itself up, if necessary
-            ptr::read(self.ptr as *const T);
+            ptr::read(self.ptr);
 
             // clean-up our allocation
             free(self.ptr as *mut c_void)
diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs
index b7bc1b4764614..bd5b43b782e8d 100644
--- a/src/liballoc/heap.rs
+++ b/src/liballoc/heap.rs
@@ -298,7 +298,7 @@ mod imp {
             libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8
         } else {
             let new_ptr = allocate(size, align);
-            ptr::copy_memory(new_ptr, ptr as *const u8, cmp::min(size, old_size));
+            ptr::copy_memory(new_ptr, ptr, cmp::min(size, old_size));
             deallocate(ptr, old_size, align);
             new_ptr
         }
diff --git a/src/libcollections/btree/node.rs b/src/libcollections/btree/node.rs
index 7d5422290e25a..19c48f88caa5c 100644
--- a/src/libcollections/btree/node.rs
+++ b/src/libcollections/btree/node.rs
@@ -326,11 +326,11 @@ impl<K, V> Node<K, V> {
     pub fn as_slices<'a>(&'a self) -> (&'a [K], &'a [V]) {
         unsafe {(
             mem::transmute(raw::Slice {
-                data: self.keys.0 as *const K,
+                data: self.keys.0,
                 len: self.len()
             }),
             mem::transmute(raw::Slice {
-                data: self.vals.0 as *const V,
+                data: self.vals.0,
                 len: self.len()
             })
         )}
@@ -349,7 +349,7 @@ impl<K, V> Node<K, V> {
         } else {
             unsafe {
                 mem::transmute(raw::Slice {
-                    data: self.edges.0 as *const Node<K, V>,
+                    data: self.edges.0,
                     len: self.len() + 1
                 })
             }
diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs
index c3d2267586837..b9cb4be7c1891 100644
--- a/src/libcollections/ring_buf.rs
+++ b/src/libcollections/ring_buf.rs
@@ -88,19 +88,19 @@ impl<T> RingBuf<T> {
     /// Turn ptr into a slice
     #[inline]
     unsafe fn buffer_as_slice(&self) -> &[T] {
-        mem::transmute(RawSlice { data: self.ptr as *const T, len: self.cap })
+        mem::transmute(RawSlice { data: self.ptr, len: self.cap })
     }
 
     /// Turn ptr into a mut slice
     #[inline]
     unsafe fn buffer_as_mut_slice(&mut self) -> &mut [T] {
-        mem::transmute(RawSlice { data: self.ptr as *const T, len: self.cap })
+        mem::transmute(RawSlice { data: self.ptr, len: self.cap })
     }
 
     /// Moves an element out of the buffer
     #[inline]
     unsafe fn buffer_read(&mut self, off: uint) -> T {
-        ptr::read(self.ptr.offset(off as int) as *const T)
+        ptr::read(self.ptr.offset(off as int))
     }
 
     /// Writes an element into the buffer, moving it.
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index 4812ecc2c0b75..988ec4c661faa 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -1222,7 +1222,7 @@ fn insertion_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> O
                                  &*buf_v.offset(j),
                                  (i - j) as uint);
                 ptr::copy_nonoverlapping_memory(buf_v.offset(j),
-                                                &tmp as *const T,
+                                                &tmp,
                                                 1);
                 mem::forget(tmp);
             }
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index 73afefc5a0331..adc7ce8f07214 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -426,7 +426,7 @@ impl<T> Vec<T> {
     pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
         unsafe {
             mem::transmute(RawSlice {
-                data: *self.ptr as *const T,
+                data: *self.ptr,
                 len: self.len,
             })
         }
@@ -574,7 +574,7 @@ impl<T> Vec<T> {
                 let ptr = self.as_mut_ptr().offset(index as int);
                 // copy it out, unsafely having a copy of the value on
                 // the stack and in the vector at the same time.
-                ret = ptr::read(ptr as *const T);
+                ret = ptr::read(ptr);
 
                 // Shift everything down to fill in that spot.
                 ptr::copy_memory(ptr, &*ptr.offset(1), len - index - 1);
@@ -842,7 +842,7 @@ impl<T> Vec<T> {
                     //          |         |
                     //          end_u     end_t
 
-                    let t = ptr::read(pv.start_t as *const T);
+                    let t = ptr::read(pv.start_t);
                     //  start_u start_t
                     //  |       |
                     // +-+-+-+-+-+-+-+-+-+
@@ -1414,7 +1414,7 @@ impl<T> AsSlice<T> for Vec<T> {
     fn as_slice<'a>(&'a self) -> &'a [T] {
         unsafe {
             mem::transmute(RawSlice {
-                data: *self.ptr as *const T,
+                data: *self.ptr,
                 len: self.len
             })
         }
@@ -1777,11 +1777,11 @@ impl<T,U> Drop for PartialVecNonZeroSized<T,U> {
 
             // We have instances of `U`s and `T`s in `vec`. Destruct them.
             while self.start_u != self.end_u {
-                let _ = ptr::read(self.start_u as *const U); // Run a `U` destructor.
+                let _ = ptr::read(self.start_u); // Run a `U` destructor.
                 self.start_u = self.start_u.offset(1);
             }
             while self.start_t != self.end_t {
-                let _ = ptr::read(self.start_t as *const T); // Run a `T` destructor.
+                let _ = ptr::read(self.start_t); // Run a `T` destructor.
                 self.start_t = self.start_t.offset(1);
             }
             // After this destructor ran, the destructor of `vec` will run,
diff --git a/src/libcore/atomic.rs b/src/libcore/atomic.rs
index aa93d9ed83792..18f7fff9053ce 100644
--- a/src/libcore/atomic.rs
+++ b/src/libcore/atomic.rs
@@ -199,7 +199,7 @@ impl AtomicBool {
     #[inline]
     #[stable]
     pub fn load(&self, order: Ordering) -> bool {
-        unsafe { atomic_load(self.v.get() as *const usize, order) > 0 }
+        unsafe { atomic_load(self.v.get(), order) > 0 }
     }
 
     /// Stores a value into the bool.
@@ -438,7 +438,7 @@ impl AtomicIsize {
     /// ```
     #[inline]
     pub fn load(&self, order: Ordering) -> isize {
-        unsafe { atomic_load(self.v.get() as *const isize, order) }
+        unsafe { atomic_load(self.v.get(), order) }
     }
 
     /// Stores a value into the isize.
@@ -615,7 +615,7 @@ impl AtomicUsize {
     /// ```
     #[inline]
     pub fn load(&self, order: Ordering) -> usize {
-        unsafe { atomic_load(self.v.get() as *const usize, order) }
+        unsafe { atomic_load(self.v.get(), order) }
     }
 
     /// Stores a value into the usize.
@@ -796,7 +796,7 @@ impl<T> AtomicPtr<T> {
     #[stable]
     pub fn load(&self, order: Ordering) -> *mut T {
         unsafe {
-            atomic_load(self.p.get() as *const *mut T, order) as *mut T
+            atomic_load(self.p.get(), order) as *mut T
         }
     }
 
@@ -1070,7 +1070,7 @@ impl AtomicInt {
 
     #[inline]
     pub fn load(&self, order: Ordering) -> int {
-        unsafe { atomic_load(self.v.get() as *const int, order) }
+        unsafe { atomic_load(self.v.get(), order) }
     }
 
     #[inline]
@@ -1123,7 +1123,7 @@ impl AtomicUint {
 
     #[inline]
     pub fn load(&self, order: Ordering) -> uint {
-        unsafe { atomic_load(self.v.get() as *const uint, order) }
+        unsafe { atomic_load(self.v.get(), order) }
     }
 
     #[inline]
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index baf998d0828a2..0b89467d63b83 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -329,7 +329,7 @@ impl<T> PtrExt for *mut T {
     #[inline]
     #[stable]
     unsafe fn offset(self, count: int) -> *mut T {
-        intrinsics::offset(self as *const T, count) as *mut T
+        intrinsics::offset(self, count) as *mut T
     }
 
     #[inline]
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index 22da168911daa..50cbb7a61dce3 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -741,7 +741,7 @@ macro_rules! make_slice {
             diff / mem::size_of::<$t>()
         };
         unsafe {
-            transmute::<_, $result>(RawSlice { data: $start as *const T, len: len })
+            transmute::<_, $result>(RawSlice { data: $start, len: len })
         }
     }}
 }
@@ -1409,7 +1409,7 @@ pub unsafe fn from_raw_buf<'a, T>(p: &'a *const T, len: uint) -> &'a [T] {
 #[inline]
 #[unstable = "should be renamed to from_raw_parts_mut"]
 pub unsafe fn from_raw_mut_buf<'a, T>(p: &'a *mut T, len: uint) -> &'a mut [T] {
-    transmute(RawSlice { data: *p as *const T, len: len })
+    transmute(RawSlice { data: *p, len: len })
 }
 
 //
diff --git a/src/librustc_trans/trans/builder.rs b/src/librustc_trans/trans/builder.rs
index 75194e3d21fcb..2ad4211034240 100644
--- a/src/librustc_trans/trans/builder.rs
+++ b/src/librustc_trans/trans/builder.rs
@@ -33,7 +33,7 @@ pub struct Builder<'a, 'tcx: 'a> {
 // lot more efficient) than doing str::as_c_str("", ...) every time.
 pub fn noname() -> *const c_char {
     static CNULL: c_char = 0;
-    &CNULL as *const c_char
+    &CNULL
 }
 
 impl<'a, 'tcx> Builder<'a, 'tcx> {
diff --git a/src/librustdoc/flock.rs b/src/librustdoc/flock.rs
index dcc90117d2660..b682723631d3f 100644
--- a/src/librustdoc/flock.rs
+++ b/src/librustdoc/flock.rs
@@ -126,7 +126,7 @@ mod imp {
                 l_sysid: 0,
             };
             let ret = unsafe {
-                libc::fcntl(fd, os::F_SETLKW, &flock as *const os::flock)
+                libc::fcntl(fd, os::F_SETLKW, &flock)
             };
             if ret == -1 {
                 unsafe { libc::close(fd); }
@@ -147,7 +147,7 @@ mod imp {
                 l_sysid: 0,
             };
             unsafe {
-                libc::fcntl(self.fd, os::F_SETLK, &flock as *const os::flock);
+                libc::fcntl(self.fd, os::F_SETLK, &flock);
                 libc::close(self.fd);
             }
         }
diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs
index f28b95dbe95c4..d810460a7d497 100644
--- a/src/libstd/collections/hash/table.rs
+++ b/src/libstd/collections/hash/table.rs
@@ -395,9 +395,6 @@ impl<K, V, M: Deref<Target=RawTable<K, V>> + DerefMut> FullBucket<K, V, M> {
     /// This works similarly to `put`, building an `EmptyBucket` out of the
     /// taken bucket.
     pub fn take(mut self) -> (EmptyBucket<K, V, M>, K, V) {
-        let key = self.raw.key as *const K;
-        let val = self.raw.val as *const V;
-
         self.table.size -= 1;
 
         unsafe {
@@ -408,8 +405,8 @@ impl<K, V, M: Deref<Target=RawTable<K, V>> + DerefMut> FullBucket<K, V, M> {
                     idx: self.idx,
                     table: self.table
                 },
-                ptr::read(key),
-                ptr::read(val)
+                ptr::read(self.raw.key),
+                ptr::read(self.raw.val)
             )
         }
     }
@@ -477,8 +474,8 @@ impl<K, V, M: Deref<Target=RawTable<K, V>>> GapThenFull<K, V, M> {
     pub fn shift(mut self) -> Option<GapThenFull<K, V, M>> {
         unsafe {
             *self.gap.raw.hash = mem::replace(&mut *self.full.raw.hash, EMPTY_BUCKET);
-            copy_nonoverlapping_memory(self.gap.raw.key, self.full.raw.key as *const K, 1);
-            copy_nonoverlapping_memory(self.gap.raw.val, self.full.raw.val as *const V, 1);
+            copy_nonoverlapping_memory(self.gap.raw.key, self.full.raw.key, 1);
+            copy_nonoverlapping_memory(self.gap.raw.val, self.full.raw.val, 1);
         }
 
         let FullBucket { raw: prev_raw, idx: prev_idx, .. } = self.full;
@@ -781,8 +778,8 @@ impl<'a, K, V> Iterator for RevMoveBuckets<'a, K, V> {
                 if *self.raw.hash != EMPTY_BUCKET {
                     self.elems_left -= 1;
                     return Some((
-                        ptr::read(self.raw.key as *const K),
-                        ptr::read(self.raw.val as *const V)
+                        ptr::read(self.raw.key),
+                        ptr::read(self.raw.val)
                     ));
                 }
             }
@@ -878,8 +875,8 @@ impl<K, V> Iterator for IntoIter<K, V> {
                     SafeHash {
                         hash: *bucket.hash,
                     },
-                    ptr::read(bucket.key as *const K),
-                    ptr::read(bucket.val as *const V)
+                    ptr::read(bucket.key),
+                    ptr::read(bucket.val)
                 )
             }
         })
@@ -906,8 +903,8 @@ impl<'a, K, V> Iterator for Drain<'a, K, V> {
                     SafeHash {
                         hash: ptr::replace(bucket.hash, EMPTY_BUCKET),
                     },
-                    ptr::read(bucket.key as *const K),
-                    ptr::read(bucket.val as *const V)
+                    ptr::read(bucket.key),
+                    ptr::read(bucket.val)
                 )
             }
         })
diff --git a/src/libstd/sys/unix/backtrace.rs b/src/libstd/sys/unix/backtrace.rs
index 7164931c55acd..70b9c012b008a 100644
--- a/src/libstd/sys/unix/backtrace.rs
+++ b/src/libstd/sys/unix/backtrace.rs
@@ -229,7 +229,7 @@ fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
     }
 
     let mut info: Dl_info = unsafe { intrinsics::init() };
-    if unsafe { dladdr(addr as *const libc::c_void, &mut info) == 0 } {
+    if unsafe { dladdr(addr, &mut info) == 0 } {
         output(w, idx,addr, None)
     } else {
         output(w, idx, addr, Some(unsafe {
diff --git a/src/libstd/thread_local/mod.rs b/src/libstd/thread_local/mod.rs
index e7c4e4ccdfb88..4c99cff34da65 100644
--- a/src/libstd/thread_local/mod.rs
+++ b/src/libstd/thread_local/mod.rs
@@ -449,7 +449,7 @@ mod imp {
         // destructor as running for this thread so calls to `get` will return
         // `None`.
         *(*ptr).dtor_running.get() = true;
-        ptr::read((*ptr).inner.get() as *const T);
+        ptr::read((*ptr).inner.get());
     }
 }
 

From 35d46fabaf63c0b1b607bd91cd5680eeaa2f9a14 Mon Sep 17 00:00:00 2001
From: Benjamin Peterson <benjamin@python.org>
Date: Sat, 17 Jan 2015 11:29:24 -0500
Subject: [PATCH 07/36] remove test_find_equiv, since find_equiv doesn't exist
 anymore

---
 src/libstd/collections/hash/map.rs | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index 80ae3076df37a..d3ac632617dc7 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -2112,23 +2112,6 @@ mod test_map {
         assert_eq!(m.remove(&0), Some(0));
     }
 
-    #[test]
-    fn test_find_equiv() {
-        let mut m = HashMap::new();
-
-        let (foo, bar, baz) = (1i,2i,3i);
-        m.insert("foo".to_string(), foo);
-        m.insert("bar".to_string(), bar);
-        m.insert("baz".to_string(), baz);
-
-
-        assert_eq!(m.get("foo"), Some(&foo));
-        assert_eq!(m.get("bar"), Some(&bar));
-        assert_eq!(m.get("baz"), Some(&baz));
-
-        assert_eq!(m.get("qux"), None);
-    }
-
     #[test]
     fn test_from_iter() {
         let xs = [(1i, 1i), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)];

From 6ab95bdd62095429139f1b24717cbf0e5aa4a235 Mon Sep 17 00:00:00 2001
From: Earl St Sauver <estsauver@gmail.com>
Date: Mon, 12 Jan 2015 02:02:38 -0800
Subject: [PATCH 08/36] s/deriving/derives in Comments/Docs

There are a large number of places that incorrectly refer
to deriving in comments, instead of derives.

Fixes #20984
---
 src/doc/reference.md                       |  2 +-
 src/etc/generate-deriving-span-tests.py    | 16 ++++++++--------
 src/etc/unicode.py                         |  2 +-
 src/libcollections/lib.rs                  |  8 ++++----
 src/librustc_back/svh.rs                   |  2 +-
 src/libstd/fmt.rs                          |  2 +-
 src/libsyntax/ext/deriving/clone.rs        |  6 +++---
 src/libsyntax/ext/deriving/cmp/eq.rs       |  4 ++--
 src/libsyntax/ext/deriving/cmp/ord.rs      |  8 ++++----
 src/libsyntax/ext/deriving/cmp/totaleq.rs  |  2 +-
 src/libsyntax/ext/deriving/cmp/totalord.rs |  4 ++--
 src/libsyntax/ext/deriving/decodable.rs    |  2 +-
 src/libsyntax/ext/deriving/default.rs      |  2 +-
 src/libsyntax/ext/deriving/encodable.rs    |  2 +-
 src/libsyntax/ext/deriving/generic/mod.rs  |  2 +-
 src/libsyntax/ext/deriving/generic/ty.rs   |  4 ++--
 src/libsyntax/ext/deriving/primitive.rs    |  4 ++--
 src/libsyntax/ext/deriving/rand.rs         |  4 ++--
 18 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/src/doc/reference.md b/src/doc/reference.md
index c8e31f27b3507..b039198cf1dd9 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -2430,7 +2430,7 @@ There are three different types of inline attributes:
 * `#[inline(always)]` asks the compiler to always perform an inline expansion.
 * `#[inline(never)]` asks the compiler to never perform an inline expansion.
 
-### Derive
+### `derive`
 
 The `derive` attribute allows certain traits to be automatically implemented
 for data structures. For example, the following will create an `impl` for the
diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py
index 1e5d5ccf339c3..eeb1b89472b3d 100755
--- a/src/etc/generate-deriving-span-tests.py
+++ b/src/etc/generate-deriving-span-tests.py
@@ -12,8 +12,8 @@
 
 """
 This script creates a pile of compile-fail tests check that all the
-derivings have spans that point to the fields, rather than the
-#[deriving(...)] line.
+derives have spans that point to the fields, rather than the
+#[derive(...)] line.
 
 sample usage: src/etc/generate-deriving-span-tests.py
 """
@@ -46,7 +46,7 @@
 """
 
 ENUM_STRING = """
-#[deriving({traits})]
+#[derive({traits})]
 enum Enum {{
    A(
      Error {errors}
@@ -54,7 +54,7 @@
 }}
 """
 ENUM_STRUCT_VARIANT_STRING = """
-#[deriving({traits})]
+#[derive({traits})]
 enum Enum {{
    A {{
      x: Error {errors}
@@ -62,13 +62,13 @@
 }}
 """
 STRUCT_STRING = """
-#[deriving({traits})]
+#[derive({traits})]
 struct Struct {{
     x: Error {errors}
 }}
 """
 STRUCT_TUPLE_STRING = """
-#[deriving({traits})]
+#[derive({traits})]
 struct Struct(
     Error {errors}
 );
@@ -80,14 +80,14 @@ def create_test_case(type, trait, super_traits, number_of_errors):
     string = [ENUM_STRING, ENUM_STRUCT_VARIANT_STRING, STRUCT_STRING, STRUCT_TUPLE_STRING][type]
     all_traits = ','.join([trait] + super_traits)
     super_traits = ','.join(super_traits)
-    error_deriving = '#[deriving(%s)]' % super_traits if super_traits else ''
+    error_deriving = '#[derive(%s)]' % super_traits if super_traits else ''
 
     errors = '\n'.join('//~%s ERROR' % ('^' * n) for n in range(error_count))
     code = string.format(traits = all_traits, errors = errors)
     return TEMPLATE.format(year = YEAR, error_deriving=error_deriving, code = code)
 
 def write_file(name, string):
-    test_file = os.path.join(TEST_DIR, 'deriving-span-%s.rs' % name)
+    test_file = os.path.join(TEST_DIR, 'derives-span-%s.rs' % name)
 
     # set write permission if file exists, so it can be changed
     if os.path.exists(test_file):
diff --git a/src/etc/unicode.py b/src/etc/unicode.py
index 63f1b3dcd4414..4a0bb992fd989 100755
--- a/src/etc/unicode.py
+++ b/src/etc/unicode.py
@@ -392,7 +392,7 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
     use core::slice;
 
     #[allow(non_camel_case_types)]
-    #[deriving(Clone)]
+    #[derive(Clone)]
     pub enum GraphemeCat {
 """)
     for cat in grapheme_cats + ["Any"]:
diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs
index 54ab26c4f7763..36ff35536e41c 100644
--- a/src/libcollections/lib.rs
+++ b/src/libcollections/lib.rs
@@ -102,10 +102,10 @@ pub fn fixme_14344_be_sure_to_link_to_collections() {}
 mod std {
     pub use core::fmt;      // necessary for panic!()
     pub use core::option;   // necessary for panic!()
-    pub use core::clone;    // deriving(Clone)
-    pub use core::cmp;      // deriving(Eq, Ord, etc.)
-    pub use core::marker;  // deriving(Copy)
-    pub use core::hash;     // deriving(Hash)
+    pub use core::clone;    // derive(Clone)
+    pub use core::cmp;      // derive(Eq, Ord, etc.)
+    pub use core::marker;  // derive(Copy)
+    pub use core::hash;     // derive(Hash)
 }
 
 #[cfg(test)]
diff --git a/src/librustc_back/svh.rs b/src/librustc_back/svh.rs
index 789a87bbcdafc..b71e465b938f5 100644
--- a/src/librustc_back/svh.rs
+++ b/src/librustc_back/svh.rs
@@ -156,7 +156,7 @@ mod svh_visitor {
         StrictVersionHashVisitor { st: st }
     }
 
-    // To off-load the bulk of the hash-computation on deriving(Hash),
+    // To off-load the bulk of the hash-computation on #[derive(Hash)],
     // we define a set of enums corresponding to the content that our
     // crate visitor will encounter as it traverses the ast.
     //
diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs
index 907925e93d399..5cd54c08ccb1d 100644
--- a/src/libstd/fmt.rs
+++ b/src/libstd/fmt.rs
@@ -225,7 +225,7 @@
 //! - `fmt::Show` implementations should be implemented for **all** public types.
 //!   Output will typically represent the internal state as faithfully as possible.
 //!   The purpose of the `Show` trait is to facilitate debugging Rust code. In
-//!   most cases, using `#[deriving(Show)]` is sufficient and recommended.
+//!   most cases, using `#[derive(Show)]` is sufficient and recommended.
 //!
 //! Some examples of the output from both traits:
 //!
diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs
index 784a92b9a0e55..6498e8d2d587a 100644
--- a/src/libsyntax/ext/deriving/clone.rs
+++ b/src/libsyntax/ext/deriving/clone.rs
@@ -80,11 +80,11 @@ fn cs_clone(
         EnumNonMatchingCollapsed (..) => {
             cx.span_bug(trait_span,
                         &format!("non-matching enum variants in \
-                                 `deriving({})`", name)[])
+                                 `derive({})`", name)[])
         }
         StaticEnum(..) | StaticStruct(..) => {
             cx.span_bug(trait_span,
-                        &format!("static method in `deriving({})`", name)[])
+                        &format!("static method in `derive({})`", name)[])
         }
     }
 
@@ -101,7 +101,7 @@ fn cs_clone(
                 None => {
                     cx.span_bug(trait_span,
                                 &format!("unnamed field in normal struct in \
-                                         `deriving({})`", name)[])
+                                         `derive({})`", name)[])
                 }
             };
             cx.field_imm(field.span, ident, subcall(field))
diff --git a/src/libsyntax/ext/deriving/cmp/eq.rs b/src/libsyntax/ext/deriving/cmp/eq.rs
index 7cb7ee3d35533..c550c26c74572 100644
--- a/src/libsyntax/ext/deriving/cmp/eq.rs
+++ b/src/libsyntax/ext/deriving/cmp/eq.rs
@@ -32,7 +32,7 @@ pub fn expand_deriving_eq<F>(cx: &mut ExtCtxt,
             |cx, span, subexpr, self_f, other_fs| {
                 let other_f = match other_fs {
                     [ref o_f] => o_f,
-                    _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialEq)`")
+                    _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`")
                 };
 
                 let eq = cx.expr_binary(span, ast::BiEq, self_f, other_f.clone());
@@ -49,7 +49,7 @@ pub fn expand_deriving_eq<F>(cx: &mut ExtCtxt,
             |cx, span, subexpr, self_f, other_fs| {
                 let other_f = match other_fs {
                     [ref o_f] => o_f,
-                    _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialEq)`")
+                    _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`")
                 };
 
                 let eq = cx.expr_binary(span, ast::BiNe, self_f, other_f.clone());
diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs
index c126238be8293..9f1850145b6c5 100644
--- a/src/libsyntax/ext/deriving/cmp/ord.rs
+++ b/src/libsyntax/ext/deriving/cmp/ord.rs
@@ -152,7 +152,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
             let new = {
                 let other_f = match other_fs {
                     [ref o_f] => o_f,
-                    _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`"),
+                    _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`"),
                 };
 
                 let args = vec![
@@ -176,7 +176,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
         equals_expr.clone(),
         box |cx, span, (self_args, tag_tuple), _non_self_args| {
             if self_args.len() != 2 {
-                cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`")
+                cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`")
             } else {
                 some_ordering_collapsed(cx, span, PartialCmpOp, tag_tuple)
             }
@@ -210,7 +210,7 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt,
             */
             let other_f = match other_fs {
                 [ref o_f] => o_f,
-                _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`")
+                _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`")
             };
 
             let cmp = cx.expr_binary(span, op, self_f.clone(), other_f.clone());
@@ -224,7 +224,7 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt,
         cx.expr_bool(span, equal),
         box |cx, span, (self_args, tag_tuple), _non_self_args| {
             if self_args.len() != 2 {
-                cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`")
+                cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`")
             } else {
                 let op = match (less, equal) {
                     (true,  true) => LeOp, (true,  false) => LtOp,
diff --git a/src/libsyntax/ext/deriving/cmp/totaleq.rs b/src/libsyntax/ext/deriving/cmp/totaleq.rs
index cdb36ede65da9..9a2af6a3e0bee 100644
--- a/src/libsyntax/ext/deriving/cmp/totaleq.rs
+++ b/src/libsyntax/ext/deriving/cmp/totaleq.rs
@@ -32,7 +32,7 @@ pub fn expand_deriving_totaleq<F>(cx: &mut ExtCtxt,
             let block = cx.block(span, stmts, None);
             cx.expr_block(block)
         },
-                       box |cx, sp, _, _| cx.span_bug(sp, "non matching enums in deriving(Eq)?"),
+                       box |cx, sp, _, _| cx.span_bug(sp, "non matching enums in derive(Eq)?"),
                        cx,
                        span,
                        substr)
diff --git a/src/libsyntax/ext/deriving/cmp/totalord.rs b/src/libsyntax/ext/deriving/cmp/totalord.rs
index 10ecc86bda530..29d327142a6cf 100644
--- a/src/libsyntax/ext/deriving/cmp/totalord.rs
+++ b/src/libsyntax/ext/deriving/cmp/totalord.rs
@@ -108,7 +108,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
             let new = {
                 let other_f = match other_fs {
                     [ref o_f] => o_f,
-                    _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`"),
+                    _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`"),
                 };
 
                 let args = vec![
@@ -132,7 +132,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
         cx.expr_path(equals_path.clone()),
         box |cx, span, (self_args, tag_tuple), _non_self_args| {
             if self_args.len() != 2 {
-                cx.span_bug(span, "not exactly 2 arguments in `deriving(Ord)`")
+                cx.span_bug(span, "not exactly 2 arguments in `derives(Ord)`")
             } else {
                 ordering_collapsed(cx, span, tag_tuple)
             }
diff --git a/src/libsyntax/ext/deriving/decodable.rs b/src/libsyntax/ext/deriving/decodable.rs
index f73023ddd1eb0..8edbf018f22e3 100644
--- a/src/libsyntax/ext/deriving/decodable.rs
+++ b/src/libsyntax/ext/deriving/decodable.rs
@@ -173,7 +173,7 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                 cx.lambda_expr_1(trait_span, result, blkarg)
             ))
         }
-        _ => cx.bug("expected StaticEnum or StaticStruct in deriving(Decodable)")
+        _ => cx.bug("expected StaticEnum or StaticStruct in derive(Decodable)")
     };
 }
 
diff --git a/src/libsyntax/ext/deriving/default.rs b/src/libsyntax/ext/deriving/default.rs
index 047c4fef3c4f1..36c3f2c0ccb34 100644
--- a/src/libsyntax/ext/deriving/default.rs
+++ b/src/libsyntax/ext/deriving/default.rs
@@ -81,6 +81,6 @@ fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructur
             // let compilation continue
             cx.expr_uint(trait_span, 0)
         }
-        _ => cx.span_bug(trait_span, "Non-static method in `deriving(Default)`")
+        _ => cx.span_bug(trait_span, "Non-static method in `derive(Default)`")
     };
 }
diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs
index 616390467f06f..801ae213a7bcf 100644
--- a/src/libsyntax/ext/deriving/encodable.rs
+++ b/src/libsyntax/ext/deriving/encodable.rs
@@ -276,6 +276,6 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
             cx.expr_block(cx.block(trait_span, vec!(me), Some(ret)))
         }
 
-        _ => cx.bug("expected Struct or EnumMatching in deriving(Encodable)")
+        _ => cx.bug("expected Struct or EnumMatching in derive(Encodable)")
     };
 }
diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs
index 161b27d7abb59..293e4befd3bb1 100644
--- a/src/libsyntax/ext/deriving/generic/mod.rs
+++ b/src/libsyntax/ext/deriving/generic/mod.rs
@@ -1191,7 +1191,7 @@ impl<'a> TraitDef<'a> {
         to_set.expn_id = cx.codemap().record_expansion(codemap::ExpnInfo {
             call_site: to_set,
             callee: codemap::NameAndSpan {
-                name: format!("deriving({})", trait_name),
+                name: format!("derive({})", trait_name),
                 format: codemap::MacroAttribute,
                 span: Some(self.span)
             }
diff --git a/src/libsyntax/ext/deriving/generic/ty.rs b/src/libsyntax/ext/deriving/generic/ty.rs
index a236fa33eb1fe..5e6a9c91ce032 100644
--- a/src/libsyntax/ext/deriving/generic/ty.rs
+++ b/src/libsyntax/ext/deriving/generic/ty.rs
@@ -182,8 +182,8 @@ impl<'a> Ty<'a> {
             Literal(ref p) => {
                 p.to_path(cx, span, self_ty, self_generics)
             }
-            Ptr(..) => { cx.span_bug(span, "pointer in a path in generic `deriving`") }
-            Tuple(..) => { cx.span_bug(span, "tuple in a path in generic `deriving`") }
+            Ptr(..) => { cx.span_bug(span, "pointer in a path in generic `derive`") }
+            Tuple(..) => { cx.span_bug(span, "tuple in a path in generic `derive`") }
         }
     }
 }
diff --git a/src/libsyntax/ext/deriving/primitive.rs b/src/libsyntax/ext/deriving/primitive.rs
index d36bb2cd1c2aa..c45fe1ceb2049 100644
--- a/src/libsyntax/ext/deriving/primitive.rs
+++ b/src/libsyntax/ext/deriving/primitive.rs
@@ -74,7 +74,7 @@ pub fn expand_deriving_from_primitive<F>(cx: &mut ExtCtxt,
 fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<Expr> {
     let n = match substr.nonself_args {
         [ref n] => n,
-        _ => cx.span_bug(trait_span, "incorrect number of arguments in `deriving(FromPrimitive)`")
+        _ => cx.span_bug(trait_span, "incorrect number of arguments in `derive(FromPrimitive)`")
     };
 
     match *substr.fields {
@@ -144,6 +144,6 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure
 
             cx.expr_match(trait_span, n.clone(), arms)
         }
-        _ => cx.span_bug(trait_span, "expected StaticEnum in deriving(FromPrimitive)")
+        _ => cx.span_bug(trait_span, "expected StaticEnum in derive(FromPrimitive)")
     }
 }
diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs
index 1359cada67396..b5435896791cd 100644
--- a/src/libsyntax/ext/deriving/rand.rs
+++ b/src/libsyntax/ext/deriving/rand.rs
@@ -57,7 +57,7 @@ pub fn expand_deriving_rand<F>(cx: &mut ExtCtxt,
 fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<Expr> {
     let rng = match substr.nonself_args {
         [ref rng] => rng,
-        _ => cx.bug("Incorrect number of arguments to `rand` in `deriving(Rand)`")
+        _ => cx.bug("Incorrect number of arguments to `rand` in `derive(Rand)`")
     };
     let rand_ident = vec!(
         cx.ident_of("std"),
@@ -131,7 +131,7 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
             let block = cx.block(trait_span, vec!( let_statement ), Some(match_expr));
             cx.expr_block(block)
         }
-        _ => cx.bug("Non-static method in `deriving(Rand)`")
+        _ => cx.bug("Non-static method in `derive(Rand)`")
     };
 
     fn rand_thing<F>(cx: &mut ExtCtxt,

From 4d31700067e5bc549b475e4b2560657b8483003f Mon Sep 17 00:00:00 2001
From: Chris Thorn <thorn@thoughtbot.com>
Date: Sat, 17 Jan 2015 11:45:59 -0800
Subject: [PATCH 09/36] Update rustdoc man page

Brings the rustdoc man page in sync with the options specified in
src/librustdoc/lib.rs. The text was taken verbatim, but I tweaked the
order to be (what I think is) somewhat logical.
---
 man/rustdoc.1 | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/man/rustdoc.1 b/man/rustdoc.1
index 4c6557f0f6580..830884b19bde2 100644
--- a/man/rustdoc.1
+++ b/man/rustdoc.1
@@ -35,9 +35,27 @@ space-separated list of plugins to run (default: '')
 --plugin-path <val>
 directory to load plugins from (default: /tmp/rustdoc_ng/plugins)
 .TP
+--target <val>
+target triple to document
+.TP
+--crate-name <val>
+specify the name of this crate
+.TP
 -L --library-path <val>
 directory to add to crate search path
 .TP
+--cfg <val>
+pass a --cfg to rustc
+.TP
+--extern <val>
+pass an --extern to rustc
+.TP
+--test
+run code examples as tests
+.TP
+--test-args <val>
+pass arguments to the test runner
+.TP
 --html-in-header <val>
 file to add to <head>
 .TP
@@ -47,8 +65,20 @@ file to add in <body>, before content
 --html-after-content <val>
 file to add in <body>, after content
 .TP
+--markdown-css <val>
+CSS files to include via <link> in a rendered Markdown file
+.TP
+--markdown-playground-url <val>
+URL to send code snippets to
+.TP
+--markdown-no-toc
+don't include table of contents
+.TP
 -h, --help
 Print help
+.TP
+-V, --version
+Print rustdoc's version
 
 .SH "OUTPUT FORMATS"
 

From 97a2b2638d36fbd9f69c80bd146cdbe9d87e7bcc Mon Sep 17 00:00:00 2001
From: Michael Sproul <micsproul@gmail.com>
Date: Sat, 17 Jan 2015 12:20:11 -0800
Subject: [PATCH 10/36] Remove Send bound from Error trait.

---
 src/libstd/error.rs  | 4 ++--
 src/libstd/io/mod.rs | 6 +++---
 src/libstd/os.rs     | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/libstd/error.rs b/src/libstd/error.rs
index 9963e4861b778..ff12846197806 100644
--- a/src/libstd/error.rs
+++ b/src/libstd/error.rs
@@ -18,7 +18,7 @@
 //! chain information:
 //!
 //! ```
-//! trait Error: Send {
+//! trait Error {
 //!     fn description(&self) -> &str;
 //!
 //!     fn detail(&self) -> Option<String> { None }
@@ -87,7 +87,7 @@ use string::{FromUtf8Error, FromUtf16Error};
 
 /// Base functionality for all errors in Rust.
 #[unstable = "the exact API of this trait may change"]
-pub trait Error: Send {
+pub trait Error {
     /// A short description of the error; usually a static string.
     fn description(&self) -> &str;
 
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index bab4dafd090bd..86afc6decab5c 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -234,7 +234,7 @@ use error::{FromError, Error};
 use fmt;
 use int;
 use iter::{Iterator, IteratorExt};
-use marker::Sized;
+use marker::{Sized, Send};
 use mem::transmute;
 use ops::FnOnce;
 use option::Option;
@@ -363,8 +363,8 @@ impl Error for IoError {
     }
 }
 
-impl FromError<IoError> for Box<Error> {
-    fn from_error(err: IoError) -> Box<Error> {
+impl FromError<IoError> for Box<Error + Send> {
+    fn from_error(err: IoError) -> Box<Error + Send> {
         box err
     }
 }
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index fc0c838a3f118..78db6c158a89d 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -37,7 +37,7 @@ use error::{FromError, Error};
 use fmt;
 use io::{IoResult, IoError};
 use iter::{Iterator, IteratorExt};
-use marker::Copy;
+use marker::{Copy, Send};
 use libc::{c_void, c_int, c_char};
 use libc;
 use boxed::Box;
@@ -937,8 +937,8 @@ impl Error for MapError {
     fn detail(&self) -> Option<String> { Some(format!("{:?}", self)) }
 }
 
-impl FromError<MapError> for Box<Error> {
-    fn from_error(err: MapError) -> Box<Error> {
+impl FromError<MapError> for Box<Error + Send> {
+    fn from_error(err: MapError) -> Box<Error + Send> {
         box err
     }
 }

From a8b2f1794119be05b24240ddff013b1d533c3f5d Mon Sep 17 00:00:00 2001
From: Fenhl <fenhl@fenhl.net>
Date: Sat, 17 Jan 2015 20:44:54 +0000
Subject: [PATCH 11/36] Use singular they in the serialize::json docs

See [https://gist.github.com/0xabad1dea/8870b192fd1758743f66](this document) by @0xabad1dea for the rationale.
---
 src/libserialize/json.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index 41499b5ae0efe..a07b653cb26e2 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -34,7 +34,7 @@
 //!
 //! An object is a series of string keys mapping to values, in `"key": value` format.
 //! Arrays are enclosed in square brackets ([ ... ]) and objects in curly brackets ({ ... }).
-//! A simple JSON document encoding a person, his/her age, address and phone numbers could look like
+//! A simple JSON document encoding a person, their age, address and phone numbers could look like
 //!
 //! ```ignore
 //! {
@@ -192,8 +192,8 @@
 //! }
 //! ```
 
-use self::JsonEvent::*;
 use self::ErrorCode::*;
+use self::JsonEvent::*;
 use self::ParserError::*;
 use self::DecoderError::*;
 use self::ParserState::*;

From 5aa2f9c651546d420c8da551b3d95849f4ade310 Mon Sep 17 00:00:00 2001
From: Fenhl <fenhl@fenhl.net>
Date: Sat, 17 Jan 2015 20:56:34 +0000
Subject: [PATCH 12/36] Undo accidental change unrelated to my PR

---
 src/libserialize/json.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index a07b653cb26e2..05480828dd5a8 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -192,8 +192,8 @@
 //! }
 //! ```
 
-use self::ErrorCode::*;
 use self::JsonEvent::*;
+use self::ErrorCode::*;
 use self::ParserError::*;
 use self::DecoderError::*;
 use self::ParserState::*;

From ac4baca72a392bf683d513e5cd3aa00b01f5e7a8 Mon Sep 17 00:00:00 2001
From: Luke Francl <look@recursion.org>
Date: Sat, 17 Jan 2015 13:59:49 -0800
Subject: [PATCH 13/36] Passable nano syntax highlighting

rust.nanorc provides syntax highlighting for Rust. An attempt has been made to
make the syntax highlighting look good on both dark and light terminals.
Issue #21286.
---
 src/etc/nano/rust.nanorc | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 src/etc/nano/rust.nanorc

diff --git a/src/etc/nano/rust.nanorc b/src/etc/nano/rust.nanorc
new file mode 100644
index 0000000000000..1217769096df0
--- /dev/null
+++ b/src/etc/nano/rust.nanorc
@@ -0,0 +1,35 @@
+# Nano configuration for Rust
+# Copyright 2015 The Rust Project Developers.
+#
+# NOTE: Rules are applied in order: later rules re-colorize matching text.
+syntax "rust" "\.rs"
+
+# function definition
+color magenta "fn [a-z0-9_]+"
+
+# Reserved words
+color yellow "\<(abstract|alignof|as|be|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\>"
+
+# macros
+color red "[a-z_]+!"
+
+# Constants
+color magenta "[A-Z][A-Z_]+"
+
+# Traits/Enums/Structs/Types/etc.
+color magenta "[A-Z][a-z]+"
+
+# Strings
+color green "\".*\""
+color green start="\".*\\$" end=".*\""
+# NOTE: This isn't accurate but matching "#{0,} for the end of the string is too liberal
+color green start="r#+\"" end="\"#+"
+
+# Comments
+color blue "//.*"
+
+# Attributes
+color magenta start="#!\[" end="\]"
+
+# Some common markers
+color brightcyan "(XXX|TODO|FIXME|\?\?\?)"

From ffdf1118d5f86b4d55cbf8ec86aa488d9dfc88b2 Mon Sep 17 00:00:00 2001
From: Michael Sproul <micsproul@gmail.com>
Date: Sat, 17 Jan 2015 11:31:55 -0800
Subject: [PATCH 14/36] Implement the error trait for errors in std::sync.

---
 src/libstd/sync/poison.rs | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/libstd/sync/poison.rs b/src/libstd/sync/poison.rs
index cc8c331ef3997..e28c3c37b6f76 100644
--- a/src/libstd/sync/poison.rs
+++ b/src/libstd/sync/poison.rs
@@ -11,7 +11,7 @@
 use prelude::v1::*;
 
 use cell::UnsafeCell;
-use error::FromError;
+use error::{Error, FromError};
 use fmt;
 use thread::Thread;
 
@@ -92,7 +92,13 @@ pub type TryLockResult<Guard> = Result<Guard, TryLockError<Guard>>;
 
 impl<T> fmt::Show for PoisonError<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        "poisoned lock: another task failed inside".fmt(f)
+        self.description().fmt(f)
+    }
+}
+
+impl<T> Error for PoisonError<T> {
+    fn description(&self) -> &str {
+        "poisoned lock: another task failed inside"
     }
 }
 
@@ -126,11 +132,22 @@ impl<T> FromError<PoisonError<T>> for TryLockError<T> {
 
 impl<T> fmt::Show for TryLockError<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        self.description().fmt(f)
+    }
+}
+
+impl<T> Error for TryLockError<T> {
+    fn description(&self) -> &str {
+        match *self {
+            TryLockError::Poisoned(ref p) => p.description(),
+            TryLockError::WouldBlock => "try_lock failed because the operation would block"
+        }
+    }
+
+    fn cause(&self) -> Option<&Error> {
         match *self {
-            TryLockError::Poisoned(ref p) => p.fmt(f),
-            TryLockError::WouldBlock => {
-                "try_lock failed because the operation would block".fmt(f)
-            }
+            TryLockError::Poisoned(ref p) => Some(p),
+            _ => None
         }
     }
 }

From 8da284a045c4d59a850f63fe9a11ab7ddb38ef17 Mon Sep 17 00:00:00 2001
From: Alfie John <alfiej@fastmail.fm>
Date: Sat, 17 Jan 2015 23:31:13 +0000
Subject: [PATCH 15/36] docs: typo

---
 src/doc/reference.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/doc/reference.md b/src/doc/reference.md
index a27d6c6e268a9..5c3c075e01cdd 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -3423,7 +3423,7 @@ Used inside an array pattern, `..` stands for any number of elements, when the
 `advanced_slice_patterns` feature gate is turned on. This wildcard can be used
 at most once for a given array, which implies that it cannot be used to
 specifically match elements that are at an unknown distance from both ends of a
-array, like `[.., 42, ..]`. If followed by a variable name, it will bind the
+array, like `[.., 42, ..]`. If preceded by a variable name, it will bind the
 corresponding slice to the variable. Example:
 
 ```

From b6b8880f0ec3f057dc56320f6886be173a8f0d8e Mon Sep 17 00:00:00 2001
From: Ryan Levick <ryan@6wunderkinder.com>
Date: Sun, 18 Jan 2015 00:49:50 +0100
Subject: [PATCH 16/36] Improve the error message when source file cannot be
 read

Contribution from @look!
---
 src/libsyntax/parse/mod.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index f1f547ba0c7dd..10fb0a73cec7b 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -253,9 +253,10 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
     let bytes = match File::open(path).read_to_end() {
         Ok(bytes) => bytes,
         Err(e) => {
-            err(&format!("couldn't read {:?}: {:?}",
+            let error_msg = e.desc;
+            err(&format!("couldn't read {:?}: {}",
                         path.display(),
-                        e)[]);
+                        error_msg)[]);
             unreachable!()
         }
     };

From f355747a195080c915b68820eeef7bc368b1e19c Mon Sep 17 00:00:00 2001
From: Chris Thorn <thorn@thoughtbot.com>
Date: Sat, 17 Jan 2015 16:14:14 -0800
Subject: [PATCH 17/36] Increase docs search box delay

Increases the delay of the search box to 500ms after key up. I tried
adding a three character minimum for setting the delay, but didn't find
it very useful.

Should close #20095
---
 src/librustdoc/html/static/main.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index ba0dda8a9a0a2..f27f0cd70f4ef 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -635,7 +635,7 @@
             $('.do-search').on('click', search);
             $('.search-input').on('keyup', function() {
                 clearTimeout(keyUpTimeout);
-                keyUpTimeout = setTimeout(search, 100);
+                keyUpTimeout = setTimeout(search, 500);
             });
 
             // Push and pop states are used to add search results to the browser

From 2b6efbf92dfabbe0a938e68becdd87e3cbc8fdbc Mon Sep 17 00:00:00 2001
From: Jay True <glacjay@gmail.com>
Date: Sun, 18 Jan 2015 10:58:55 +0800
Subject: [PATCH 18/36] fix an error about the static lifetime

The reference should be `x`, not `FOO` itself.
---
 src/doc/trpl/ownership.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/doc/trpl/ownership.md b/src/doc/trpl/ownership.md
index 9ced5bb656c42..8b7e37dd4c2fd 100644
--- a/src/doc/trpl/ownership.md
+++ b/src/doc/trpl/ownership.md
@@ -395,7 +395,7 @@ static FOO: i32 = 5;
 let x: &'static i32 = &FOO;
 ```
 
-This adds an `i32` to the data segment of the binary, and `FOO` is a reference
+This adds an `i32` to the data segment of the binary, and `x` is a reference
 to it.
 
 # Shared Ownership

From d0eb85dc3fb7b04f828075e72de2ce763d5eebfb Mon Sep 17 00:00:00 2001
From: Michael Neumann <mneumann@ntecs.de>
Date: Sun, 18 Jan 2015 08:25:52 +0100
Subject: [PATCH 19/36] Redo Segmented stack support for DragonFly

It got accidentially reverted in 44440e5.
---
 src/llvm                             | 2 +-
 src/rustllvm/llvm-auto-clean-trigger | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/llvm b/src/llvm
index ec1fdb3b9d3b1..b820135911e17 160000
--- a/src/llvm
+++ b/src/llvm
@@ -1 +1 @@
-Subproject commit ec1fdb3b9d3b1fb9e1dae97a65dd3a13db9bfb23
+Subproject commit b820135911e17c7a46b901db56baa48e5155bf46
diff --git a/src/rustllvm/llvm-auto-clean-trigger b/src/rustllvm/llvm-auto-clean-trigger
index 4a16b9c257cbe..9dd66ac0a3059 100644
--- a/src/rustllvm/llvm-auto-clean-trigger
+++ b/src/rustllvm/llvm-auto-clean-trigger
@@ -1,4 +1,4 @@
 # If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
 # The actual contents of this file do not matter, but to trigger a change on the
 # build bots then the contents should be changed so git updates the mtime.
-2015-01-13
+2015-01-18

From 66003c06a19836f049996a629e8db4b6a118d5fa Mon Sep 17 00:00:00 2001
From: Alfie John <alfiej@fastmail.fm>
Date: Sun, 18 Jan 2015 11:49:37 +0000
Subject: [PATCH 20/36] docs: replace deprecated integer suffixes from examples

---
 src/doc/reference.md | 56 ++++++++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/doc/reference.md b/src/doc/reference.md
index a27d6c6e268a9..882486e292c04 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -257,10 +257,10 @@ cases mentioned in [Number literals](#number-literals) below.
 
 | [Number literals](#number-literals)`*` | Example | Exponentiation | Suffixes |
 |----------------------------------------|---------|----------------|----------|
-| Decimal integer | `98_222i` | `N/A` | Integer suffixes |
-| Hex integer | `0xffi` | `N/A` | Integer suffixes |
-| Octal integer | `0o77i` | `N/A` | Integer suffixes |
-| Binary integer | `0b1111_0000i` | `N/A` | Integer suffixes |
+| Decimal integer | `98_222is` | `N/A` | Integer suffixes |
+| Hex integer | `0xffis` | `N/A` | Integer suffixes |
+| Octal integer | `0o77is` | `N/A` | Integer suffixes |
+| Binary integer | `0b1111_0000is` | `N/A` | Integer suffixes |
 | Floating-point | `123.0E+77f64` | `Optional` | Floating-point suffixes |
 
 `*` All number literals allow `_` as a visual separator: `1_234.0E+18f64`
@@ -268,7 +268,7 @@ cases mentioned in [Number literals](#number-literals) below.
 ##### Suffixes
 | Integer | Floating-point |
 |---------|----------------|
-| `i` (`int`), `u` (`uint`), `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64` | `f32`, `f64` |
+| `is` (`isize`), `us` (`usize`), `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64` | `f32`, `f64` |
 
 #### Character and string literals
 
@@ -468,7 +468,7 @@ Like any literal, an integer literal may be followed (immediately,
 without any spaces) by an _integer suffix_, which forcibly sets the
 type of the literal. There are 10 valid values for an integer suffix:
 
-* The `i` and `u` suffixes give the literal type `int` or `uint`,
+* The `is` and `us` suffixes give the literal type `isize` or `usize`,
   respectively.
 * Each of the signed and unsigned machine types `u8`, `i8`,
   `u16`, `i16`, `u32`, `i32`, `u64` and `i64`
@@ -483,9 +483,9 @@ context overconstrains the type, it is also considered a static type error.
 Examples of integer literals of various forms:
 
 ```
-123i;                              // type int
-123u;                              // type uint
-123_u;                             // type uint
+123is;                             // type isize
+123us;                             // type usize
+123_us                             // type usize
 0xff_u8;                           // type u8
 0o70_i16;                          // type i16
 0b1111_1111_1001_0000_i32;         // type i32
@@ -1002,11 +1002,11 @@ use std::option::Option::{Some, None};
 use std::collections::hash_map::{mod, HashMap};
 
 fn foo<T>(_: T){}
-fn bar(map1: HashMap<String, uint>, map2: hash_map::HashMap<String, uint>){}
+fn bar(map1: HashMap<String, usize>, map2: hash_map::HashMap<String, usize>){}
 
 fn main() {
-    // Equivalent to 'std::iter::range_step(0u, 10u, 2u);'
-    range_step(0u, 10u, 2u);
+    // Equivalent to 'std::iter::range_step(0us, 10, 2);'
+    range_step(0us, 10, 2);
 
     // Equivalent to 'foo(vec![std::option::Option::Some(1.0f64),
     // std::option::Option::None]);'
@@ -1611,7 +1611,7 @@ trait is in scope) to pointers to the trait name, used as a type.
 ```
 # trait Shape { }
 # impl Shape for int { }
-# let mycircle = 0i;
+# let mycircle = 0is;
 let myshape: Box<Shape> = Box::new(mycircle) as Box<Shape>;
 ```
 
@@ -2821,7 +2821,7 @@ parentheses. They are used to create [tuple-typed](#tuple-types) values.
 ```{.tuple}
 (0,);
 (0.0, 4.5);
-("a", 4u, true);
+("a", 4us, true);
 ```
 
 ### Unit expressions
@@ -2958,9 +2958,9 @@ constant expression that can be evaluated at compile time, such as a
 [literal](#literals) or a [static item](#static-items).
 
 ```
-[1i, 2, 3, 4];
+[1is, 2, 3, 4];
 ["a", "b", "c", "d"];
-[0i; 128];             // array with 128 zeros
+[0is; 128];            // array with 128 zeros
 [0u8, 0u8, 0u8, 0u8];
 ```
 
@@ -3133,7 +3133,7 @@ moves](#moved-and-copied-types) its right-hand operand to its left-hand
 operand.
 
 ```
-# let mut x = 0i;
+# let mut x = 0is;
 # let y = 0;
 
 x = y;
@@ -3270,7 +3270,7 @@ conditional expression evaluates to `false`, the `while` expression completes.
 An example:
 
 ```
-let mut i = 0u;
+let mut i = 0us;
 
 while i < 10 {
     println!("hello");
@@ -3349,8 +3349,8 @@ for e in v.iter() {
 An example of a for loop over a series of integers:
 
 ```
-# fn bar(b:uint) { }
-for i in range(0u, 256) {
+# fn bar(b:usize) { }
+for i in range(0us, 256) {
     bar(i);
 }
 ```
@@ -3520,11 +3520,11 @@ fn main() {
 ```
 
 Patterns can also dereference pointers by using the `&`, `&mut` and `box`
-symbols, as appropriate. For example, these two matches on `x: &int` are
+symbols, as appropriate. For example, these two matches on `x: &isize` are
 equivalent:
 
 ```
-# let x = &3i;
+# let x = &3is;
 let y = match *x { 0 => "zero", _ => "some" };
 let z = match x { &0 => "zero", _ => "some" };
 
@@ -3545,7 +3545,7 @@ Multiple match patterns may be joined with the `|` operator. A range of values
 may be specified with `...`. For example:
 
 ```
-# let x = 2i;
+# let x = 2is;
 
 let message = match x {
   0 | 1  => "not many",
@@ -3886,16 +3886,16 @@ The type of a closure mapping an input of type `A` to an output of type `B` is
 An example of creating and calling a closure:
 
 ```rust
-let captured_var = 10i;
+let captured_var = 10is;
 
 let closure_no_args = |&:| println!("captured_var={}", captured_var);
 
-let closure_args = |&: arg: int| -> int {
+let closure_args = |&: arg: isize| -> isize {
   println!("captured_var={}, arg={}", captured_var, arg);
   arg // Note lack of semicolon after 'arg'
 };
 
-fn call_closure<F: Fn(), G: Fn(int) -> int>(c1: F, c2: G) {
+fn call_closure<F: Fn(), G: Fn(isize) -> isize>(c1: F, c2: G) {
   c1();
   c2(2);
 }
@@ -3927,7 +3927,7 @@ trait Printable {
   fn stringify(&self) -> String;
 }
 
-impl Printable for int {
+impl Printable for isize {
   fn stringify(&self) -> String { self.to_string() }
 }
 
@@ -3936,7 +3936,7 @@ fn print(a: Box<Printable>) {
 }
 
 fn main() {
-   print(Box::new(10i) as Box<Printable>);
+   print(Box::new(10is) as Box<Printable>);
 }
 ```
 

From 17ffe51aa366d51719da0eeb452ad05b9ac23d90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kim=20R=C3=B8en?= <kim@pam.no>
Date: Sun, 18 Jan 2015 13:24:13 +0100
Subject: [PATCH 21/36] Remove redundant "Right now"

Having both "Right now" and "at the moment" in the same statement is redundant.
---
 src/doc/trpl/crates-and-modules.md | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/doc/trpl/crates-and-modules.md b/src/doc/trpl/crates-and-modules.md
index 6c5c14fe3111d..25870d84a754f 100644
--- a/src/doc/trpl/crates-and-modules.md
+++ b/src/doc/trpl/crates-and-modules.md
@@ -208,9 +208,8 @@ Again, these declarations tell Rust to look for either
 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!
 
-Right now, the contents of `src/english/greetings.rs` and
-`src/japanese/farewells.rs` are both empty at the moment. Let's add some
-functions.
+The contents of `src/english/greetings.rs` and `src/japanese/farewells.rs` are
+both empty at the moment. Let's add some functions.
 
 Put this in `src/english/greetings.rs`:
 

From 5431727b6e521548419ec2606ef22ffa43097f72 Mon Sep 17 00:00:00 2001
From: Alfie John <alfiej@fastmail.fm>
Date: Sun, 18 Jan 2015 12:43:12 +0000
Subject: [PATCH 22/36] docs: replacing more deprecated integer suffixes

---
 src/doc/reference.md | 160 +++++++++++++++++++++----------------------
 1 file changed, 80 insertions(+), 80 deletions(-)

diff --git a/src/doc/reference.md b/src/doc/reference.md
index 882486e292c04..8d5a895c2a8c3 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -578,8 +578,8 @@ Two examples of paths with type arguments:
 # struct HashMap<K, V>;
 # fn f() {
 # fn id<T>(t: T) -> T { t }
-type T = HashMap<int,String>;  // Type arguments used in a type expression
-let x = id::<int>(10);       // Type arguments used in a call expression
+type T = HashMap<i32,String>; // Type arguments used in a type expression
+let x  = id::<i32>(10);       // Type arguments used in a call expression
 # }
 ```
 
@@ -1104,7 +1104,7 @@ interpreted as an implicit `return` expression applied to the final-expression.
 An example of a function:
 
 ```
-fn add(x: int, y: int) -> int {
+fn add(x: i32, y: i32) -> i32 {
     return x + y;
 }
 ```
@@ -1113,7 +1113,7 @@ As with `let` bindings, function arguments are irrefutable patterns, so any
 pattern that is valid in a let binding is also valid as an argument.
 
 ```
-fn first((value, _): (int, int)) -> int { value }
+fn first((value, _): (i32, i32)) -> i32 { value }
 ```
 
 
@@ -1139,8 +1139,8 @@ used as a type name.
 
 When a generic function is referenced, its type is instantiated based on the
 context of the reference. For example, calling the `iter` function defined
-above on `[1, 2]` will instantiate type parameter `T` with `int`, and require
-the closure parameter to have type `fn(int)`.
+above on `[1, 2]` will instantiate type parameter `T` with `isize`, and require
+the closure parameter to have type `fn(isize)`.
 
 The type parameters can also be explicitly supplied in a trailing
 [path](#paths) component after the function name. This might be necessary if
@@ -1272,7 +1272,7 @@ typecheck:
 ```
 # fn my_err(s: &str) -> ! { panic!() }
 
-fn f(i: int) -> int {
+fn f(i: i32) -> i32 {
    if i == 42 {
      return 42;
    }
@@ -1283,7 +1283,7 @@ fn f(i: int) -> int {
 ```
 
 This will not compile without the `!` annotation on `my_err`, since the `else`
-branch of the conditional in `f` does not return an `int`, as required by the
+branch of the conditional in `f` does not return an `i32`, as required by the
 signature of `f`. Adding the `!` annotation to `my_err` informs the
 typechecker that, should control ever enter `my_err`, no further type judgments
 about `f` need to hold, since control will never resume in any context that
@@ -1301,18 +1301,18 @@ modifier.
 
 ```
 // Declares an extern fn, the ABI defaults to "C"
-extern fn new_int() -> int { 0 }
+extern fn new_i32() -> i32 { 0 }
 
 // Declares an extern fn with "stdcall" ABI
-extern "stdcall" fn new_int_stdcall() -> int { 0 }
+extern "stdcall" fn new_i32_stdcall() -> i32 { 0 }
 ```
 
 Unlike normal functions, extern fns have an `extern "ABI" fn()`. This is the
 same type as the functions declared in an extern block.
 
 ```
-# extern fn new_int() -> int { 0 }
-let fptr: extern "C" fn() -> int = new_int;
+# extern fn new_i32() -> i32 { 0 }
+let fptr: extern "C" fn() -> i32 = new_i32;
 ```
 
 Extern functions may be called directly from Rust code as Rust uses large,
@@ -1348,18 +1348,18 @@ keyword `struct`.
 An example of a `struct` item and its use:
 
 ```
-struct Point {x: int, y: int}
+struct Point {x: i32, y: i32}
 let p = Point {x: 10, y: 11};
-let px: int = p.x;
+let px: i32 = p.x;
 ```
 
 A _tuple structure_ is a nominal [tuple type](#tuple-types), also defined with
 the keyword `struct`. For example:
 
 ```
-struct Point(int, int);
+struct Point(i32, i32);
 let p = Point(10, 11);
-let px: int = match p { Point(x, _) => x };
+let px: i32 = match p { Point(x, _) => x };
 ```
 
 A _unit-like struct_ is a structure without any fields, defined by leaving off
@@ -1457,14 +1457,14 @@ a type derived from those primitive types. The derived types are references with
 the `static` lifetime, fixed-size arrays, tuples, enum variants, and structs.
 
 ```
-const BIT1: uint = 1 << 0;
-const BIT2: uint = 1 << 1;
+const BIT1: u32 = 1 << 0;
+const BIT2: u32 = 1 << 1;
 
-const BITS: [uint; 2] = [BIT1, BIT2];
+const BITS: [u32; 2] = [BIT1, BIT2];
 const STRING: &'static str = "bitstring";
 
 struct BitsNStrings<'a> {
-    mybits: [uint; 2],
+    mybits: [u32; 2],
     mystring: &'a str
 }
 
@@ -1500,14 +1500,14 @@ Constants should in general be preferred over statics, unless large amounts of
 data are being stored, or single-address and mutability properties are required.
 
 ```
-use std::sync::atomic::{AtomicUint, Ordering, ATOMIC_UINT_INIT};;
+use std::sync::atomic::{AtomicUint, Ordering, ATOMIC_USIZE_INIT};;
 
-// Note that ATOMIC_UINT_INIT is a *const*, but it may be used to initialize a
+// Note that ATOMIC_USIZE_INIT is a *const*, but it may be used to initialize a
 // static. This static can be modified, so it is not placed in read-only memory.
-static COUNTER: AtomicUint = ATOMIC_UINT_INIT;
+static COUNTER: AtomicUint = ATOMIC_USIZE_INIT;
 
 // This table is a candidate to be placed in read-only memory.
-static TABLE: &'static [uint] = &[1, 2, 3, /* ... */];
+static TABLE: &'static [usize] = &[1, 2, 3, /* ... */];
 
 for slot in TABLE.iter() {
     println!("{}", slot);
@@ -1529,13 +1529,13 @@ Mutable statics are still very useful, however. They can be used with C
 libraries and can also be bound from C libraries (in an `extern` block).
 
 ```
-# fn atomic_add(_: &mut uint, _: uint) -> uint { 2 }
+# fn atomic_add(_: &mut u32, _: u32) -> u32 { 2 }
 
-static mut LEVELS: uint = 0;
+static mut LEVELS: u32 = 0;
 
 // This violates the idea of no shared state, and this doesn't internally
 // protect against races, so this function is `unsafe`
-unsafe fn bump_levels_unsafe1() -> uint {
+unsafe fn bump_levels_unsafe1() -> u32 {
     let ret = LEVELS;
     LEVELS += 1;
     return ret;
@@ -1544,7 +1544,7 @@ unsafe fn bump_levels_unsafe1() -> uint {
 // Assuming that we have an atomic_add function which returns the old value,
 // this function is "safe" but the meaning of the return value may not be what
 // callers expect, so it's still marked as `unsafe`
-unsafe fn bump_levels_unsafe2() -> uint {
+unsafe fn bump_levels_unsafe2() -> u32 {
     return atomic_add(&mut LEVELS, 1);
 }
 ```
@@ -1564,8 +1564,8 @@ Traits are implemented for specific types through separate
 [implementations](#implementations).
 
 ```
-# type Surface = int;
-# type BoundingBox = int;
+# type Surface = i32;
+# type BoundingBox = i32;
 trait Shape {
     fn draw(&self, Surface);
     fn bounding_box(&self) -> BoundingBox;
@@ -1583,8 +1583,8 @@ functions](#generic-functions).
 
 ```
 trait Seq<T> {
-   fn len(&self) -> uint;
-   fn elt_at(&self, n: uint) -> T;
+   fn len(&self) -> u32;
+   fn elt_at(&self, n: u32) -> T;
    fn iter<F>(&self, F) where F: Fn(T);
 }
 ```
@@ -1595,7 +1595,7 @@ parameter, and within the generic function, the methods of the trait can be
 called on values that have the parameter's type. For example:
 
 ```
-# type Surface = int;
+# type Surface = i32;
 # trait Shape { fn draw(&self, Surface); }
 fn draw_twice<T: Shape>(surface: Surface, sh: T) {
     sh.draw(surface);
@@ -1610,8 +1610,8 @@ trait is in scope) to pointers to the trait name, used as a type.
 
 ```
 # trait Shape { }
-# impl Shape for int { }
-# let mycircle = 0is;
+# impl Shape for i32 { }
+# let mycircle = 0i32;
 let myshape: Box<Shape> = Box::new(mycircle) as Box<Shape>;
 ```
 
@@ -1629,12 +1629,12 @@ module. For example:
 
 ```
 trait Num {
-    fn from_int(n: int) -> Self;
+    fn from_i32(n: i32) -> Self;
 }
 impl Num for f64 {
-    fn from_int(n: int) -> f64 { n as f64 }
+    fn from_i32(n: i32) -> f64 { n as f64 }
 }
-let x: f64 = Num::from_int(42);
+let x: f64 = Num::from_i32(42);
 ```
 
 Traits may inherit from other traits. For example, in
@@ -1669,9 +1669,9 @@ Likewise, supertrait methods may also be called on trait objects.
 ```{.ignore}
 # trait Shape { fn area(&self) -> f64; }
 # trait Circle : Shape { fn radius(&self) -> f64; }
-# impl Shape for int { fn area(&self) -> f64 { 0.0 } }
-# impl Circle for int { fn radius(&self) -> f64 { 0.0 } }
-# let mycircle = 0;
+# impl Shape for i32 { fn area(&self) -> f64 { 0.0 } }
+# impl Circle for i32 { fn radius(&self) -> f64 { 0.0 } }
+# let mycircle = 0i32;
 let mycircle = Box::new(mycircle) as Box<Circle>;
 let nonsense = mycircle.radius() * mycircle.area();
 ```
@@ -1686,7 +1686,7 @@ Implementations are defined with the keyword `impl`.
 ```
 # struct Point {x: f64, y: f64};
 # impl Copy for Point {}
-# type Surface = int;
+# type Surface = i32;
 # struct BoundingBox {x: f64, y: f64, width: f64, height: f64};
 # trait Shape { fn draw(&self, Surface); fn bounding_box(&self) -> BoundingBox; }
 # fn do_draw_circle(s: Surface, c: Circle) { }
@@ -1715,7 +1715,7 @@ limited to nominal types (enums, structs), and the implementation must appear
 in the same module or a sub-module as the `self` type:
 
 ```
-struct Point {x: int, y: int}
+struct Point {x: i32, y: i32}
 
 impl Point {
     fn log(&self) {
@@ -1826,7 +1826,7 @@ struct Foo;
 
 // Declare a public struct with a private field
 pub struct Bar {
-    field: int
+    field: i32
 }
 
 // Declare a public enum with two public variants
@@ -2226,15 +2226,15 @@ plugins](book/plugin.html#lint-plugins) can provide additional lint checks.
 mod m1 {
     // Missing documentation is ignored here
     #[allow(missing_docs)]
-    pub fn undocumented_one() -> int { 1 }
+    pub fn undocumented_one() -> i32 { 1 }
 
     // Missing documentation signals a warning here
     #[warn(missing_docs)]
-    pub fn undocumented_too() -> int { 2 }
+    pub fn undocumented_too() -> i32 { 2 }
 
     // Missing documentation signals an error here
     #[deny(missing_docs)]
-    pub fn undocumented_end() -> int { 3 }
+    pub fn undocumented_end() -> i32 { 3 }
 }
 ```
 
@@ -2247,16 +2247,16 @@ mod m2{
     #[allow(missing_docs)]
     mod nested {
         // Missing documentation is ignored here
-        pub fn undocumented_one() -> int { 1 }
+        pub fn undocumented_one() -> i32 { 1 }
 
         // Missing documentation signals a warning here,
         // despite the allow above.
         #[warn(missing_docs)]
-        pub fn undocumented_two() -> int { 2 }
+        pub fn undocumented_two() -> i32 { 2 }
     }
 
     // Missing documentation signals a warning here
-    pub fn undocumented_too() -> int { 3 }
+    pub fn undocumented_too() -> i32 { 3 }
 }
 ```
 
@@ -2269,7 +2269,7 @@ mod m3 {
     // Attempting to toggle warning signals an error here
     #[allow(missing_docs)]
     /// Returns 2.
-    pub fn undocumented_too() -> int { 2 }
+    pub fn undocumented_too() -> i32 { 2 }
 }
 ```
 
@@ -2461,7 +2461,7 @@ the `PartialEq` or `Clone` constraints for the appropriate `impl`:
 ```
 #[derive(PartialEq, Clone)]
 struct Foo<T> {
-    a: int,
+    a: i32,
     b: T
 }
 ```
@@ -2469,7 +2469,7 @@ struct Foo<T> {
 The generated `impl` for `PartialEq` is equivalent to
 
 ```
-# struct Foo<T> { a: int, b: T }
+# struct Foo<T> { a: i32, b: T }
 impl<T: PartialEq> PartialEq for Foo<T> {
     fn eq(&self, other: &Foo<T>) -> bool {
         self.a == other.a && self.b == other.b
@@ -2862,7 +2862,7 @@ The following are examples of structure expressions:
 ```
 # struct Point { x: f64, y: f64 }
 # struct TuplePoint(f64, f64);
-# mod game { pub struct User<'a> { pub name: &'a str, pub age: uint, pub score: uint } }
+# mod game { pub struct User<'a> { pub name: &'a str, pub age: u32, pub score: uint } }
 # struct Cookie; fn some_fn<T>(t: T) {}
 Point {x: 10.0, y: 20.0};
 TuplePoint(10.0, 20.0);
@@ -2883,7 +2883,7 @@ were explicitly specified and the values in the base expression for all other
 fields.
 
 ```
-# struct Point3d { x: int, y: int, z: int }
+# struct Point3d { x: i32, y: i32, z: i32 }
 let base = Point3d {x: 1, y: 2, z: 3};
 Point3d {y: 0, z: 10, .. base};
 ```
@@ -3113,7 +3113,7 @@ An example of an `as` expression:
 
 ```
 # fn sum(v: &[f64]) -> f64 { 0.0 }
-# fn len(v: &[f64]) -> int { 0 }
+# fn len(v: &[f64]) -> i32 { 0 }
 
 fn avg(v: &[f64]) -> f64 {
   let sum: f64 = sum(v);
@@ -3184,7 +3184,7 @@ paren_expr : '(' expr ')' ;
 An example of a parenthesized expression:
 
 ```
-let x: int = (2 + 3) * 4;
+let x: i32 = (2 + 3) * 4;
 ```
 
 
@@ -3204,9 +3204,9 @@ then the expression completes.
 Some examples of call expressions:
 
 ```
-# fn add(x: int, y: int) -> int { 0 }
+# fn add(x: i32, y: i32) -> i32 { 0 }
 
-let x: int = add(1, 2);
+let x: i32 = add(1i32, 2i32);
 let pi: Option<f32> = "3.14".parse();
 ```
 
@@ -3245,8 +3245,8 @@ In this example, we define a function `ten_times` that takes a higher-order
 function argument, and call it with a lambda expression as an argument:
 
 ```
-fn ten_times<F>(f: F) where F: Fn(int) {
-    let mut i = 0;
+fn ten_times<F>(f: F) where F: Fn(i32) {
+    let mut i = 0i32;
     while i < 10 {
         f(i);
         i += 1;
@@ -3333,7 +3333,7 @@ by an implementation of `std::iter::Iterator`.
 An example of a for loop over the contents of an array:
 
 ```
-# type Foo = int;
+# type Foo = i32;
 # fn bar(f: Foo) { }
 # let a = 0;
 # let b = 0;
@@ -3402,7 +3402,7 @@ fields of a particular variant. For example:
 enum List<X> { Nil, Cons(X, Box<List<X>>) }
 
 fn main() {
-    let x: List<int> = List::Cons(10, box List::Cons(11, box List::Nil));
+    let x: List<i32> = List::Cons(10, box List::Cons(11, box List::Nil));
 
     match x {
         List::Cons(_, box List::Nil) => panic!("singleton list"),
@@ -3428,7 +3428,7 @@ corresponding slice to the variable. Example:
 
 ```
 # #![feature(advanced_slice_patterns)]
-fn is_symmetric(list: &[uint]) -> bool {
+fn is_symmetric(list: &[u32]) -> bool {
     match list {
         [] | [_]                   => true,
         [x, inside.., y] if x == y => is_symmetric(inside),
@@ -3437,8 +3437,8 @@ fn is_symmetric(list: &[uint]) -> bool {
 }
 
 fn main() {
-    let sym     = &[0, 1, 4, 2, 4, 1, 0];
-    let not_sym = &[0, 1, 7, 2, 4, 1, 0];
+    let sym     = &[0us, 1, 4, 2, 4, 1, 0];
+    let not_sym = &[0us, 1, 7, 2, 4, 1, 0];
     assert!(is_symmetric(sym));
     assert!(!is_symmetric(not_sym));
 }
@@ -3462,13 +3462,13 @@ An example of a `match` expression:
 
 ```
 #![feature(box_syntax)]
-# fn process_pair(a: int, b: int) { }
+# fn process_pair(a: i32, b: i32) { }
 # fn process_ten() { }
 
 enum List<X> { Nil, Cons(X, Box<List<X>>) }
 
 fn main() {
-    let x: List<int> = List::Cons(10, box List::Cons(11, box List::Nil));
+    let x: List<i32> = List::Cons(10, box List::Cons(11, box List::Nil));
 
     match x {
         List::Cons(a, box List::Cons(b, _)) => {
@@ -3565,8 +3565,8 @@ may refer to the variables bound within the pattern they follow.
 
 ```
 # let maybe_digit = Some(0);
-# fn process_digit(i: int) { }
-# fn process_other(i: int) { }
+# fn process_digit(i: i32) { }
+# fn process_other(i: i32) { }
 
 let message = match maybe_digit {
   Some(x) if x < 10 => process_digit(x),
@@ -3614,7 +3614,7 @@ caller frame.
 An example of a `return` expression:
 
 ```
-fn max(a: int, b: int) -> int {
+fn max(a: i32, b: i32) -> i32 {
    if a > b {
       return a;
    }
@@ -3666,12 +3666,12 @@ The machine types are the following:
 
 #### Machine-dependent integer types
 
-The `uint` type is an unsigned integer type with the same number of bits as the
+The `usize` type is an unsigned integer type with the same number of bits as the
 platform's pointer type. It can represent every memory address in the process.
 
-The `int` type is a signed integer type with the same number of bits as the
+The `isize` type is a signed integer type with the same number of bits as the
 platform's pointer type. The theoretical upper bound on object and array size
-is the maximum `int` value. This ensures that `int` can be used to calculate
+is the maximum `isize` value. This ensures that `isize` can be used to calculate
 differences between pointers into an object or array and can address every byte
 within an object along with one byte past the end.
 
@@ -3707,7 +3707,7 @@ by the tuple type.
 An example of a tuple type and its use:
 
 ```
-type Pair<'a> = (int, &'a str);
+type Pair<'a> = (i32, &'a str);
 let p: Pair<'static> = (10, "hello");
 let (a, b) = p;
 assert!(b != "world");
@@ -3858,13 +3858,13 @@ or `extern`), a sequence of input types and an output type.
 An example of a `fn` type:
 
 ```
-fn add(x: int, y: int) -> int {
+fn add(x: i32, y: i32) -> i32 {
   return x + y;
 }
 
 let mut x = add(5,7);
 
-type Binop = fn(int, int) -> int;
+type Binop = fn(i32, i32) -> i32;
 let bo: Binop = add;
 x = bo(5,7);
 ```
@@ -4102,7 +4102,7 @@ Local variables are immutable unless declared otherwise like: `let mut x = ...`.
 
 Function parameters are immutable unless declared with `mut`. The `mut` keyword
 applies only to the following parameter (so `|mut x, y|` and `fn f(mut x:
-Box<int>, y: Box<int>)` declare one mutable variable `x` and one immutable
+Box<i32>, y: Box<i32>)` declare one mutable variable `x` and one immutable
 variable `y`).
 
 Methods that take either `self` or `Box<Self>` can optionally place them in a
@@ -4130,7 +4130,7 @@ the type of a box is `std::owned::Box<T>`.
 An example of a box type and value:
 
 ```
-let x: Box<int> = Box::new(10);
+let x: Box<i32> = Box::new(10);
 ```
 
 Box values exist in 1:1 correspondence with their heap allocation, copying a
@@ -4139,7 +4139,7 @@ copy of a box to move ownership of the value. After a value has been moved,
 the source location cannot be used unless it is reinitialized.
 
 ```
-let x: Box<int> = Box::new(10);
+let x: Box<i32> = Box::new(10);
 let y = x;
 // attempting to use `x` will result in an error here
 ```

From ab73d455fe38b1fc18e15302b98a5cbfdb0dc94e Mon Sep 17 00:00:00 2001
From: Jay True <glacjay@gmail.com>
Date: Sun, 18 Jan 2015 21:23:22 +0800
Subject: [PATCH 23/36] fix formatting

---
 src/doc/trpl/macros.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/doc/trpl/macros.md b/src/doc/trpl/macros.md
index e0bccb1b86f32..f429e9df19657 100644
--- a/src/doc/trpl/macros.md
+++ b/src/doc/trpl/macros.md
@@ -101,6 +101,7 @@ So `($x:ident -> (($e:expr)))`, though excessively fancy, would designate a macr
 that could be invoked like: `my_macro!(i->(( 2+2 )))`.
 
 To avoid ambiguity, macro invocation syntax must conform to the following rules:
+
 * `expr` must be followed by `=>`, `,` or `;`.
 * `ty` and `path` must be followed by `=>`, `,`, `:`, `=`, `>` or `as`.
 * `pat` must be followed by `=>`, `,` or `=`.

From e28da7ad4428ff9b377269676abe7f183f3f0182 Mon Sep 17 00:00:00 2001
From: Wangshan Lu <wisagan@gmail.com>
Date: Sun, 18 Jan 2015 22:17:44 +0800
Subject: [PATCH 24/36] Fix std::marker.

From std::markers to std::marker.
---
 src/doc/trpl/unsafe.md | 4 ++--
 src/libstd/lib.rs      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/doc/trpl/unsafe.md b/src/doc/trpl/unsafe.md
index de6d311be57ed..79b2f9998b664 100644
--- a/src/doc/trpl/unsafe.md
+++ b/src/doc/trpl/unsafe.md
@@ -703,10 +703,10 @@ Other features provided by lang items include:
   `deref`, and `add` respectively.
 - stack unwinding and general failure; the `eh_personality`, `fail`
   and `fail_bounds_checks` lang items.
-- the traits in `std::markers` used to indicate types of
+- the traits in `std::marker` used to indicate types of
   various kinds; lang items `send`, `sync` and `copy`.
 - the marker types and variance indicators found in
-  `std::markers`; lang items `covariant_type`,
+  `std::marker`; lang items `covariant_type`,
   `contravariant_lifetime`, `no_sync_bound`, etc.
 
 Lang items are loaded lazily by the compiler; e.g. if one never uses
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index ddb8129630f75..648326eee9946 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -18,7 +18,7 @@
 //!
 //! The [`ptr`](ptr/index.html) and [`mem`](mem/index.html)
 //! modules deal with unsafe pointers and memory manipulation.
-//! [`markers`](markers/index.html) defines the special built-in traits,
+//! [`marker`](marker/index.html) defines the special built-in traits,
 //! and [`raw`](raw/index.html) the runtime representation of Rust types.
 //! These are some of the lowest-level building blocks in Rust.
 //!

From d1b1b62ae8512c3324f774124b772aac2aba2c89 Mon Sep 17 00:00:00 2001
From: Kevin Yap <me@kevinyap.ca>
Date: Sun, 18 Jan 2015 08:47:05 -0800
Subject: [PATCH 25/36] Ignore NOTEs when Travis runs `make tidy`

Only print NOTE warnings if the 'TRAVIS' environment variable has not
been set. Addresses #21322.
---
 src/etc/tidy.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/etc/tidy.py b/src/etc/tidy.py
index 3d44c27a16e6f..373536d419ba9 100644
--- a/src/etc/tidy.py
+++ b/src/etc/tidy.py
@@ -8,7 +8,7 @@
 # option. This file may not be copied, modified, or distributed
 # except according to those terms.
 
-import sys, fileinput, subprocess, re
+import sys, fileinput, subprocess, re, os
 from licenseck import *
 import snapshot
 
@@ -71,7 +71,7 @@ def do_license_check(name, contents):
             if match:
                 report_err("XXX is no longer necessary, use FIXME")
             match = re.match(r'^.*//\s*(NOTE.*)$', line)
-            if match:
+            if match and "TRAVIS" not in os.environ:
                 m = match.group(1)
                 if "snap" in m.lower():
                     report_warn(match.group(1))

From 21f4483de3a78c843db2a6de49b14d4777b83918 Mon Sep 17 00:00:00 2001
From: Kevin Yap <me@kevinyap.ca>
Date: Sun, 18 Jan 2015 14:52:59 -0800
Subject: [PATCH 26/36] Use 'in' instead of 'find()' in tidy.py

'x in y' is more Pythonic and faster than 'y.find(x) != -1'.
---
 src/etc/tidy.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/etc/tidy.py b/src/etc/tidy.py
index 3d44c27a16e6f..68b276559c5c4 100644
--- a/src/etc/tidy.py
+++ b/src/etc/tidy.py
@@ -58,14 +58,14 @@ def do_license_check(name, contents):
     for line in fileinput.input(file_names,
                                 openhook=fileinput.hook_encoded("utf-8")):
 
-        if fileinput.filename().find("tidy.py") == -1:
-            if line.find(cr_flag) != -1:
+        if "tidy.py" not in fileinput.filename():
+            if cr_flag in line:
                 check_cr = False
-            if line.find(tab_flag) != -1:
+            if tab_flag in line:
                 check_tab = False
-            if line.find(linelength_flag) != -1:
+            if linelength_flag in line:
                 check_linelength = False
-            if line.find("TODO") != -1:
+            if "TODO" in line:
                 report_err("TODO is deprecated; use FIXME")
             match = re.match(r'^.*/(\*|/!?)\s*XXX', line)
             if match:
@@ -86,10 +86,10 @@ def do_license_check(name, contents):
                 if "SNAP" in line:
                     report_warn("unmatched SNAP line: " + line)
 
-        if check_tab and (line.find('\t') != -1 and
-            fileinput.filename().find("Makefile") == -1):
+        if check_tab and ('\t' in line and
+            "Makefile" not in fileinput.filename()):
             report_err("tab character")
-        if check_cr and not autocrlf and line.find('\r') != -1:
+        if check_cr and not autocrlf and '\r' in line:
             report_err("CR character")
         if line.endswith(" \n") or line.endswith("\t\n"):
             report_err("trailing whitespace")

From fccc2cfb3094226528013da7540a48ec7d55e023 Mon Sep 17 00:00:00 2001
From: Tshepang Lekhonkhobe <tshepang@gmail.com>
Date: Mon, 19 Jan 2015 03:14:36 +0200
Subject: [PATCH 27/36] doc: typo fix

---
 src/libtest/lib.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index b9e37156dc7a0..f9fb767f77ed9 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -187,7 +187,7 @@ impl fmt::Show for TestFn {
 
 /// Manager of the benchmarking runs.
 ///
-/// This is feed into functions marked with `#[bench]` to allow for
+/// This is fed into functions marked with `#[bench]` to allow for
 /// set-up & tear-down before running a piece of code repeatedly via a
 /// call to `iter`.
 #[derive(Copy)]

From a674f852db184f07b6ccc81b9fab230036873e57 Mon Sep 17 00:00:00 2001
From: Diggory Blake <diggsey@googlemail.com>
Date: Mon, 19 Jan 2015 05:43:15 +0000
Subject: [PATCH 28/36] Ranges implement Clone where possible

---
 src/libcore/ops.rs               |  8 ++++----
 src/test/run-pass/issue-21384.rs | 27 +++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 4 deletions(-)
 create mode 100644 src/test/run-pass/issue-21384.rs

diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs
index db7177e26fa27..7131253d5c40c 100644
--- a/src/libcore/ops.rs
+++ b/src/libcore/ops.rs
@@ -880,7 +880,7 @@ pub trait IndexMut<Index: ?Sized> {
 }
 
 /// An unbounded range.
-#[derive(Copy, PartialEq, Eq)]
+#[derive(Copy, Clone, PartialEq, Eq)]
 #[lang="full_range"]
 #[unstable = "API still in development"]
 pub struct FullRange;
@@ -893,7 +893,7 @@ impl fmt::Show for FullRange {
 }
 
 /// A (half-open) range which is bounded at both ends.
-#[derive(Copy, PartialEq, Eq)]
+#[derive(Copy, Clone, PartialEq, Eq)]
 #[lang="range"]
 #[unstable = "API still in development"]
 pub struct Range<Idx> {
@@ -952,7 +952,7 @@ impl<Idx: fmt::Show> fmt::Show for Range<Idx> {
 }
 
 /// A range which is only bounded below.
-#[derive(Copy, PartialEq, Eq)]
+#[derive(Copy, Clone, PartialEq, Eq)]
 #[lang="range_from"]
 #[unstable = "API still in development"]
 pub struct RangeFrom<Idx> {
@@ -981,7 +981,7 @@ impl<Idx: fmt::Show> fmt::Show for RangeFrom<Idx> {
 }
 
 /// A range which is only bounded above.
-#[derive(Copy, PartialEq, Eq)]
+#[derive(Copy, Clone, PartialEq, Eq)]
 #[lang="range_to"]
 #[unstable = "API still in development"]
 pub struct RangeTo<Idx> {
diff --git a/src/test/run-pass/issue-21384.rs b/src/test/run-pass/issue-21384.rs
new file mode 100644
index 0000000000000..0ec33d218f9a9
--- /dev/null
+++ b/src/test/run-pass/issue-21384.rs
@@ -0,0 +1,27 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn test<T : Clone>(arg: T) -> T {
+    arg.clone()
+}
+
+#[derive(PartialEq)]
+struct Test(int);
+
+fn main() {
+    // Check that ranges implement clone
+    assert!(test(1..5) == (1..5));
+    assert!(test(..5) == (..5));
+    assert!(test(1..) == (1..));
+    assert!(test(FullRange) == (FullRange));
+
+    // Check that ranges can still be used with non-clone limits
+    assert!((Test(1)..Test(5)) == (Test(1)..Test(5)));
+}

From b57662aed70fefd03cc50279644b736ddf4d72aa Mon Sep 17 00:00:00 2001
From: Peter Atashian <retep998@gmail.com>
Date: Mon, 19 Jan 2015 03:43:44 -0500
Subject: [PATCH 29/36] Fix HMODULE

Signed-off-by: Peter Atashian <retep998@gmail.com>
---
 src/liblibc/lib.rs           | 3 ++-
 src/libstd/sys/windows/os.rs | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs
index d010615a24c8a..fa6468517e699 100644
--- a/src/liblibc/lib.rs
+++ b/src/liblibc/lib.rs
@@ -1541,7 +1541,8 @@ pub mod types {
                 pub type DWORDLONG = c_ulonglong;
 
                 pub type HANDLE = LPVOID;
-                pub type HMODULE = c_uint;
+                pub type HINSTANCE = HANDLE;
+                pub type HMODULE = HINSTANCE;
 
                 pub type LONG = c_long;
                 pub type PLONG = *mut c_long;
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs
index 4540068133bd7..e9490dc95c940 100644
--- a/src/libstd/sys/windows/os.rs
+++ b/src/libstd/sys/windows/os.rs
@@ -281,7 +281,7 @@ pub fn join_paths<T: BytesContainer>(paths: &[T]) -> Result<Vec<u8>, &'static st
 pub fn load_self() -> Option<Vec<u8>> {
     unsafe {
         fill_utf16_buf_and_decode(|buf, sz| {
-            libc::GetModuleFileNameW(0u as libc::DWORD, buf, sz)
+            libc::GetModuleFileNameW(ptr::null_mut(), buf, sz)
         }).map(|s| s.to_string().into_bytes())
     }
 }

From 2366dee8e9cb41d963900c8d5128f810a87fc6bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= <aochagavia92@gmail.com>
Date: Mon, 19 Jan 2015 10:48:01 +0100
Subject: [PATCH 30/36] Make VecMap::into_iter consume the VecMap

This is a breaking change. To fix it you should pass the VecMap by value
instead of by reference.

[breaking-change]
---
 src/libcollections/vec_map.rs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs
index d4ce266d3e211..94ae1bece86f7 100644
--- a/src/libcollections/vec_map.rs
+++ b/src/libcollections/vec_map.rs
@@ -265,7 +265,7 @@ impl<V> VecMap<V> {
     }
 
     /// Returns an iterator visiting all key-value pairs in ascending order by
-    /// the keys, emptying (but not consuming) the original `VecMap`.
+    /// the keys, consuming the original `VecMap`.
     /// The iterator's element type is `(uint, &'r V)`.
     ///
     /// # Examples
@@ -284,14 +284,13 @@ impl<V> VecMap<V> {
     /// assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
     /// ```
     #[stable]
-    pub fn into_iter(&mut self) -> IntoIter<V> {
+    pub fn into_iter(self) -> IntoIter<V> {
         fn filter<A>((i, v): (uint, Option<A>)) -> Option<(uint, A)> {
             v.map(|v| (i, v))
         }
         let filter: fn((uint, Option<V>)) -> Option<(uint, V)> = filter; // coerce to fn ptr
 
-        let values = replace(&mut self.v, vec!());
-        IntoIter { iter: values.into_iter().enumerate().filter_map(filter) }
+        IntoIter { iter: self.v.into_iter().enumerate().filter_map(filter) }
     }
 
     /// Return the number of elements in the map.

From c3ac929ba966666fbe9c72eb97e38d5e37ad11e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= <aochagavia92@gmail.com>
Date: Mon, 19 Jan 2015 11:06:15 +0100
Subject: [PATCH 31/36] Add a Drain iterator to VecMap

---
 src/libcollections/vec_map.rs | 61 +++++++++++++++++++++++++++++++----
 1 file changed, 55 insertions(+), 6 deletions(-)

diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs
index 94ae1bece86f7..93f3e192d6d5e 100644
--- a/src/libcollections/vec_map.rs
+++ b/src/libcollections/vec_map.rs
@@ -186,7 +186,7 @@ impl<V> VecMap<V> {
         }
     }
 
-    /// Returns an iterator visiting all keys in ascending order by the keys.
+    /// Returns an iterator visiting all keys in ascending order of the keys.
     /// The iterator's element type is `uint`.
     #[stable]
     pub fn keys<'r>(&'r self) -> Keys<'r, V> {
@@ -196,7 +196,7 @@ impl<V> VecMap<V> {
         Keys { iter: self.iter().map(first) }
     }
 
-    /// Returns an iterator visiting all values in ascending order by the keys.
+    /// Returns an iterator visiting all values in ascending order of the keys.
     /// The iterator's element type is `&'r V`.
     #[stable]
     pub fn values<'r>(&'r self) -> Values<'r, V> {
@@ -206,7 +206,7 @@ impl<V> VecMap<V> {
         Values { iter: self.iter().map(second) }
     }
 
-    /// Returns an iterator visiting all key-value pairs in ascending order by the keys.
+    /// Returns an iterator visiting all key-value pairs in ascending order of the keys.
     /// The iterator's element type is `(uint, &'r V)`.
     ///
     /// # Examples
@@ -233,7 +233,7 @@ impl<V> VecMap<V> {
         }
     }
 
-    /// Returns an iterator visiting all key-value pairs in ascending order by the keys,
+    /// Returns an iterator visiting all key-value pairs in ascending order of the keys,
     /// with mutable references to the values.
     /// The iterator's element type is `(uint, &'r mut V)`.
     ///
@@ -264,7 +264,7 @@ impl<V> VecMap<V> {
         }
     }
 
-    /// Returns an iterator visiting all key-value pairs in ascending order by
+    /// Returns an iterator visiting all key-value pairs in ascending order of
     /// the keys, consuming the original `VecMap`.
     /// The iterator's element type is `(uint, &'r V)`.
     ///
@@ -278,7 +278,6 @@ impl<V> VecMap<V> {
     /// map.insert(3, "c");
     /// map.insert(2, "b");
     ///
-    /// // Not possible with .iter()
     /// let vec: Vec<(uint, &str)> = map.into_iter().collect();
     ///
     /// assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
@@ -293,6 +292,34 @@ impl<V> VecMap<V> {
         IntoIter { iter: self.v.into_iter().enumerate().filter_map(filter) }
     }
 
+    /// Returns an iterator visiting all key-value pairs in ascending order of
+    /// the keys, emptying (but not consuming) the original `VecMap`.
+    /// The iterator's element type is `(uint, &'r V)`. Keeps the allocated memory for reuse.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::collections::VecMap;
+    ///
+    /// let mut map = VecMap::new();
+    /// map.insert(1, "a");
+    /// map.insert(3, "c");
+    /// map.insert(2, "b");
+    ///
+    /// let vec: Vec<(uint, &str)> = map.drain().collect();
+    ///
+    /// assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
+    /// ```
+    #[unstable = "matches collection reform specification, waiting for dust to settle"]
+    pub fn drain<'a>(&'a mut self) -> Drain<'a, V> {
+        fn filter<A>((i, v): (uint, Option<A>)) -> Option<(uint, A)> {
+            v.map(|v| (i, v))
+        }
+        let filter: fn((uint, Option<V>)) -> Option<(uint, V)> = filter; // coerce to fn ptr
+
+        Drain { iter: self.v.drain().enumerate().filter_map(filter) }
+    }
+
     /// Return the number of elements in the map.
     ///
     /// # Examples
@@ -672,6 +699,28 @@ pub struct IntoIter<V> {
     fn((uint, Option<V>)) -> Option<(uint, V)>>
 }
 
+#[unstable]
+pub struct Drain<'a, V> {
+    iter: FilterMap<
+    (uint, Option<V>),
+    (uint, V),
+    Enumerate<vec::Drain<'a, Option<V>>>,
+    fn((uint, Option<V>)) -> Option<(uint, V)>>
+}
+
+#[unstable]
+impl<'a, V> Iterator for Drain<'a, V> {
+    type Item = (uint, V);
+
+    fn next(&mut self) -> Option<(uint, V)> { self.iter.next() }
+    fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+}
+
+#[unstable]
+impl<'a, V> DoubleEndedIterator for Drain<'a, V> {
+    fn next_back(&mut self) -> Option<(uint, V)> { self.iter.next_back() }
+}
+
 #[stable]
 impl<'a, V> Iterator for Keys<'a, V> {
     type Item = uint;

From b4090aa730640bc0dbd06a8ec5cf32b842c166e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= <aochagavia92@gmail.com>
Date: Mon, 19 Jan 2015 15:36:07 +0100
Subject: [PATCH 32/36] Add test for #21328

---
 src/libcollections/vec_map.rs | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs
index 93f3e192d6d5e..7ff2e9535886c 100644
--- a/src/libcollections/vec_map.rs
+++ b/src/libcollections/vec_map.rs
@@ -966,7 +966,19 @@ mod test_map {
             assert_eq!(v, box 2i);
         }
         assert!(called);
-        m.insert(2, box 1i);
+    }
+
+    #[test]
+    fn test_drain_iterator() {
+        let mut map = VecMap::new();
+        map.insert(1, "a");
+        map.insert(3, "c");
+        map.insert(2, "b");
+
+        let vec: Vec<(usize, &str)> = map.drain().collect();
+
+        assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
+        assert_eq!(map.len(), 0);
     }
 
     #[test]

From c1660174454d5baccf10efdc9bf634624ee18ff5 Mon Sep 17 00:00:00 2001
From: Kevin Ballard <kevin@sb.org>
Date: Mon, 19 Jan 2015 10:59:57 -0800
Subject: [PATCH 33/36] Fix `make check PLEASE_BENCH=1`

611ef49f2fa573edf9cff4442eddb8ee7e48878d removed all the metrics stuff
from tests.mk, but this meant that `PLEASE_BENCH=1` no longer did
anything.

Fixes #21324.
---
 mk/tests.mk | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mk/tests.mk b/mk/tests.mk
index c8c4beb11531b..933cbce0cc675 100644
--- a/mk/tests.mk
+++ b/mk/tests.mk
@@ -38,16 +38,14 @@ ifdef CHECK_IGNORED
   TESTARGS += --ignored
 endif
 
-TEST_BENCH =
 
 # Arguments to the cfail/rfail/rpass/bench tests
 ifdef CFG_VALGRIND
   CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
-  TEST_BENCH =
 endif
 
 ifdef PLEASE_BENCH
-  TEST_BENCH = --bench
+  TESTARGS += --bench
 endif
 
 # Arguments to the perf tests

From a09df2cb9d1e6025a9565f3ef7983cb743b421a3 Mon Sep 17 00:00:00 2001
From: Jorge Aparicio <japaricious@gmail.com>
Date: Mon, 19 Jan 2015 15:16:48 -0500
Subject: [PATCH 34/36] impl Hash for arrays

closes #21402
cc #15294
---
 src/libcore/array.rs             |  7 +++++++
 src/test/run-pass/issue-21402.rs | 18 ++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 src/test/run-pass/issue-21402.rs

diff --git a/src/libcore/array.rs b/src/libcore/array.rs
index c07fac108d6f3..0cc31bf70dee6 100644
--- a/src/libcore/array.rs
+++ b/src/libcore/array.rs
@@ -17,6 +17,7 @@
 use clone::Clone;
 use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
 use fmt;
+use hash::{Hash, Hasher, self};
 use marker::Copy;
 use ops::{Deref, FullRange};
 use option::Option;
@@ -32,6 +33,12 @@ macro_rules! array_impls {
                 }
             }
 
+            impl<S: hash::Writer + Hasher, T: Hash<S>> Hash<S> for [T; $N] {
+                fn hash(&self, state: &mut S) {
+                    Hash::hash(&self[], state)
+                }
+            }
+
             #[unstable = "waiting for Show to stabilize"]
             impl<T:fmt::Show> fmt::Show for [T; $N] {
                 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
diff --git a/src/test/run-pass/issue-21402.rs b/src/test/run-pass/issue-21402.rs
new file mode 100644
index 0000000000000..6be7cea29280d
--- /dev/null
+++ b/src/test/run-pass/issue-21402.rs
@@ -0,0 +1,18 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[derive(Hash)]
+struct Foo {
+    a: Vec<bool>,
+    b: (bool, bool),
+    c: [bool; 2],
+}
+
+fn main() {}

From 5cd9a69832f304c0bbb52d92ad3a0a7893760ae2 Mon Sep 17 00:00:00 2001
From: Seo Sanghyeon <sanxiyn@gmail.com>
Date: Tue, 20 Jan 2015 22:56:53 +0900
Subject: [PATCH 35/36] Forbid coercing &T to &mut T

---
 src/librustc/middle/infer/coercion.rs      |  7 ++++++-
 src/test/compile-fail/coerce-mut.rs        | 20 ++++++++++++++++++++
 src/test/compile-fail/issue-12028.rs       |  2 +-
 src/test/compile-fail/method-self-arg-2.rs |  5 +++--
 src/test/compile-fail/slice-mut.rs         |  6 +++++-
 5 files changed, 35 insertions(+), 5 deletions(-)
 create mode 100644 src/test/compile-fail/coerce-mut.rs

diff --git a/src/librustc/middle/infer/coercion.rs b/src/librustc/middle/infer/coercion.rs
index 9f87e73d4af9d..e8b8ecc701f91 100644
--- a/src/librustc/middle/infer/coercion.rs
+++ b/src/librustc/middle/infer/coercion.rs
@@ -213,7 +213,12 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
 
         let inner_ty = match a.sty {
             ty::ty_uniq(_) => return Err(ty::terr_mismatch),
-            ty::ty_rptr(_, mt_a) => mt_a.ty,
+            ty::ty_rptr(_, mt_a) => {
+                if !can_coerce_mutbls(mt_a.mutbl, mutbl_b) {
+                    return Err(ty::terr_mutability);
+                }
+                mt_a.ty
+            }
             _ => {
                 return self.subtype(a, b);
             }
diff --git a/src/test/compile-fail/coerce-mut.rs b/src/test/compile-fail/coerce-mut.rs
new file mode 100644
index 0000000000000..30c1b66a7b81f
--- /dev/null
+++ b/src/test/compile-fail/coerce-mut.rs
@@ -0,0 +1,20 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f(x: &mut i32) {}
+
+fn main() {
+    let x = 0;
+    f(&x);
+    //~^ ERROR mismatched types
+    //~| expected `&mut i32`
+    //~| found `&_`
+    //~| values differ in mutability
+}
diff --git a/src/test/compile-fail/issue-12028.rs b/src/test/compile-fail/issue-12028.rs
index 24ffc5e9ee373..980385ce4cc6b 100644
--- a/src/test/compile-fail/issue-12028.rs
+++ b/src/test/compile-fail/issue-12028.rs
@@ -43,7 +43,7 @@ impl<H: StreamHasher> Hash<H> for u8 {
 
 impl<H: StreamHasher> StreamHash<H> for u8 {
     fn input_stream(&self, stream: &mut H::S) {
-        Stream::input(&*stream, &[*self]);
+        Stream::input(stream, &[*self]);
     }
 }
 
diff --git a/src/test/compile-fail/method-self-arg-2.rs b/src/test/compile-fail/method-self-arg-2.rs
index ad255ecd9c064..dd5b2004145c2 100644
--- a/src/test/compile-fail/method-self-arg-2.rs
+++ b/src/test/compile-fail/method-self-arg-2.rs
@@ -22,6 +22,7 @@ fn main() {
     let y = &mut x;
     Foo::bar(&x); //~ERROR cannot borrow `x`
 
-    let x = Foo;
-    Foo::baz(&x); //~ERROR cannot borrow immutable borrowed content as mutable
+    let mut x = Foo;
+    let y = &mut x;
+    Foo::baz(&mut x); //~ERROR cannot borrow `x`
 }
diff --git a/src/test/compile-fail/slice-mut.rs b/src/test/compile-fail/slice-mut.rs
index 0e1dd0d8f6c3f..a1747f3b6bdc7 100644
--- a/src/test/compile-fail/slice-mut.rs
+++ b/src/test/compile-fail/slice-mut.rs
@@ -13,5 +13,9 @@
 fn main() {
     let x: &[isize] = &[1, 2, 3, 4, 5];
     // Immutable slices are not mutable.
-    let y: &mut[_] = &x[2..4]; //~ ERROR cannot borrow immutable borrowed content as mutable
+    let y: &mut[_] = &x[2..4];
+    //~^ ERROR mismatched types
+    //~| expected `&mut [_]`
+    //~| found `&_`
+    //~| values differ in mutability
 }

From e361b38888f817200efb202c1add7aac875c92bc Mon Sep 17 00:00:00 2001
From: Steve Klabnik <steve@steveklabnik.com>
Date: Tue, 20 Jan 2015 11:36:27 -0500
Subject: [PATCH 36/36] Small fix in TRPL 3.9

Multiple people have asked me if this is a reference to Hacker News, and
I _certainly_ don't want to give them that impression.
---
 src/doc/trpl/generics.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/doc/trpl/generics.md b/src/doc/trpl/generics.md
index 74cb4530935df..3e4e0a66eae05 100644
--- a/src/doc/trpl/generics.md
+++ b/src/doc/trpl/generics.md
@@ -79,9 +79,9 @@ This type is generic over _two_ types: `T` and `E`. By the way, the capital lett
 can be any letter you'd like. We could define `Result<T, E>` as:
 
 ```{rust}
-enum Result<H, N> {
-    Ok(H),
-    Err(N),
+enum Result<A, Z> {
+    Ok(A),
+    Err(Z),
 }
 ```