From 7e2e4ce59284a68ced232e72b9c01f2e074d4bd2 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Mon, 27 Oct 2014 16:31:41 -0400
Subject: [PATCH 01/34] return &mut T from the arenas, not &T

The arenas write the value to memory and then return a non-aliasing
reference to it. The returned reference can be mutable and can be
coerced to an immutable one.

[breaking-change]
---
 src/libarena/lib.rs                    | 14 +++++++-------
 src/librustc/middle/typeck/variance.rs |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs
index 1cd6f7f66851f..5682bb76d5560 100644
--- a/src/libarena/lib.rs
+++ b/src/libarena/lib.rs
@@ -208,13 +208,13 @@ impl Arena {
     }
 
     #[inline]
-    fn alloc_copy<T>(&self, op: || -> T) -> &T {
+    fn alloc_copy<T>(&self, op: || -> T) -> &mut T {
         unsafe {
             let ptr = self.alloc_copy_inner(mem::size_of::<T>(),
                                             mem::min_align_of::<T>());
             let ptr = ptr as *mut T;
             ptr::write(&mut (*ptr), op());
-            return &*ptr;
+            return &mut *ptr;
         }
     }
 
@@ -262,7 +262,7 @@ impl Arena {
     }
 
     #[inline]
-    fn alloc_noncopy<T>(&self, op: || -> T) -> &T {
+    fn alloc_noncopy<T>(&self, op: || -> T) -> &mut T {
         unsafe {
             let tydesc = get_tydesc::<T>();
             let (ty_ptr, ptr) =
@@ -279,14 +279,14 @@ impl Arena {
             // the object is there.
             *ty_ptr = bitpack_tydesc_ptr(tydesc, true);
 
-            return &*ptr;
+            return &mut *ptr;
         }
     }
 
     /// Allocates a new item in the arena, using `op` to initialize the value,
     /// and returns a reference to it.
     #[inline]
-    pub fn alloc<T>(&self, op: || -> T) -> &T {
+    pub fn alloc<T>(&self, op: || -> T) -> &mut T {
         unsafe {
             if intrinsics::needs_drop::<T>() {
                 self.alloc_noncopy(op)
@@ -459,12 +459,12 @@ impl<T> TypedArena<T> {
 
     /// Allocates an object in the `TypedArena`, returning a reference to it.
     #[inline]
-    pub fn alloc(&self, object: T) -> &T {
+    pub fn alloc(&self, object: T) -> &mut T {
         if self.ptr == self.end {
             self.grow()
         }
 
-        let ptr: &T = unsafe {
+        let ptr: &mut T = unsafe {
             let ptr: &mut T = mem::transmute(self.ptr);
             ptr::write(ptr, object);
             self.ptr.set(self.ptr.get().offset(1));
diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs
index d9838cc6444e8..1b64d90427bd0 100644
--- a/src/librustc/middle/typeck/variance.rs
+++ b/src/librustc/middle/typeck/variance.rs
@@ -715,7 +715,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
             }
 
             _ => {
-                self.terms_cx.arena.alloc(|| TransformTerm(v1, v2))
+                &*self.terms_cx.arena.alloc(|| TransformTerm(v1, v2))
             }
         }
     }

From 7163d65e24b9ccdd596c0af8d07bcb52b972ea15 Mon Sep 17 00:00:00 2001
From: Peter Elmers <peter.elmers@yahoo.com>
Date: Mon, 27 Oct 2014 20:58:05 -0500
Subject: [PATCH 02/34] Small grammar fix in rustdoc.md

Happened to be reading through
---
 src/doc/rustdoc.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/doc/rustdoc.md b/src/doc/rustdoc.md
index f5fbad960a3f5..402687a812eee 100644
--- a/src/doc/rustdoc.md
+++ b/src/doc/rustdoc.md
@@ -221,7 +221,7 @@ testing this code, the `fib` function will be included (so it can compile).
 
 Running tests often requires some special configuration to filter tests, find
 libraries, or try running ignored examples. The testing framework that rustdoc
-uses is build on crate `test`, which is also used when you compile crates with
+uses is built on crate `test`, which is also used when you compile crates with
 rustc's `--test` flag. Extra arguments can be passed to rustdoc's test harness
 with the `--test-args` flag.
 

From c6ab5b0829febc13d231f4b1629eda42588785bb Mon Sep 17 00:00:00 2001
From: Brian Koropoff <bkoropoff@gmail.com>
Date: Tue, 28 Oct 2014 00:01:23 -0700
Subject: [PATCH 03/34] Respect mut in &mut str in astconv

Closes #17361
---
 src/librustc/middle/typeck/astconv.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs
index 15e3ee4c8fad3..abdf1a26adff6 100644
--- a/src/librustc/middle/typeck/astconv.rs
+++ b/src/librustc/middle/typeck/astconv.rs
@@ -674,7 +674,7 @@ fn mk_pointer<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
                             return constr(ty::mk_str(tcx));
                         }
                         RPtr(r) => {
-                            return ty::mk_str_slice(tcx, r, ast::MutImmutable);
+                            return ty::mk_str_slice(tcx, r, a_seq_mutbl);
                         }
                     }
                 }

From 374da5b16daccf15872f939772e682001bf0da8a Mon Sep 17 00:00:00 2001
From: Brian Koropoff <bkoropoff@gmail.com>
Date: Tue, 28 Oct 2014 00:03:02 -0700
Subject: [PATCH 04/34] Add regression test for issue #17361

---
 src/test/run-pass/issue-17361.rs | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 src/test/run-pass/issue-17361.rs

diff --git a/src/test/run-pass/issue-17361.rs b/src/test/run-pass/issue-17361.rs
new file mode 100644
index 0000000000000..fa38dcc198673
--- /dev/null
+++ b/src/test/run-pass/issue-17361.rs
@@ -0,0 +1,16 @@
+// 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.
+
+// Test that astconv doesn't forget about mutability of &mut str
+
+fn main() {
+    fn foo<Sized? T>(_: &mut T) {}
+    let _f: fn(&mut str) = foo;
+}

From 348a46f9c101feeef0479539bb956edb57b2e785 Mon Sep 17 00:00:00 2001
From: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Date: Tue, 28 Oct 2014 15:07:22 +0100
Subject: [PATCH 05/34] Remove double negation from sqrt's doc comment

---
 src/libcore/num/mod.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 3dceb42e20653..56e5cd34bd1aa 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -1502,7 +1502,7 @@ pub trait Float: Signed + Primitive {
 
     /// Take the square root of a number.
     ///
-    /// Returns NaN if `self` is not a non-negative number.
+    /// Returns NaN if `self` is a negative number.
     fn sqrt(self) -> Self;
     /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
     fn rsqrt(self) -> Self;

From a33b7441db5c2835d93837725e17dd809309cbe4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= <aochagavia92@gmail.com>
Date: Tue, 28 Oct 2014 15:53:09 +0100
Subject: [PATCH 06/34] Add ptr::RawMutPtr to prelude

Closes https://github.com/rust-lang/rust/issues/18196
---
 src/libstd/prelude.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs
index db9f3114cda14..48be404b0d02a 100644
--- a/src/libstd/prelude.rs
+++ b/src/libstd/prelude.rs
@@ -76,7 +76,7 @@
 #[doc(no_inline)] pub use num::{FloatMath, ToPrimitive, FromPrimitive};
 #[doc(no_inline)] pub use boxed::Box;
 #[doc(no_inline)] pub use path::{GenericPath, Path, PosixPath, WindowsPath};
-#[doc(no_inline)] pub use ptr::RawPtr;
+#[doc(no_inline)] pub use ptr::{RawPtr, RawMutPtr};
 #[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek};
 #[doc(no_inline)] pub use str::{Str, StrVector, StrSlice};
 #[doc(no_inline)] pub use str::{IntoMaybeOwned, StrAllocating, UnicodeStrSlice};

From 54babf8aa3d2f9943c875cab52316b87dccc8f36 Mon Sep 17 00:00:00 2001
From: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Date: Tue, 28 Oct 2014 16:09:14 +0100
Subject: [PATCH 07/34] Guide: Fix use of sqrt() in example

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

diff --git a/src/doc/guide-lifetimes.md b/src/doc/guide-lifetimes.md
index dd79d63d51453..b6ea1ddb3949d 100644
--- a/src/doc/guide-lifetimes.md
+++ b/src/doc/guide-lifetimes.md
@@ -56,7 +56,7 @@ a reference.
 fn compute_distance(p1: &Point, p2: &Point) -> f64 {
     let x_d = p1.x - p2.x;
     let y_d = p1.y - p2.y;
-    sqrt(x_d * x_d + y_d * y_d)
+    (x_d * x_d + y_d * y_d).sqrt()
 }
 ~~~
 

From 012cc6dd04f18d960e952991c2db929f3b1ff72f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= <aochagavia92@gmail.com>
Date: Tue, 28 Oct 2014 16:32:24 +0100
Subject: [PATCH 08/34] Remove unnecessary clone in ascii.rs

---
 src/libstd/ascii.rs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs
index c2e88bfdbcfb9..98445efafd238 100644
--- a/src/libstd/ascii.rs
+++ b/src/libstd/ascii.rs
@@ -330,8 +330,7 @@ impl IntoStr for Vec<Ascii> {
     #[inline]
     fn into_string(self) -> String {
         unsafe {
-            let s: &str = mem::transmute(self.as_slice());
-            String::from_str(s)
+            string::raw::from_utf8(self.into_bytes())
         }
     }
 }

From e0ad0fcb95f0bd6e69e9032c23b66515a590dfe5 Mon Sep 17 00:00:00 2001
From: Aaron Turon <aturon@mozilla.com>
Date: Mon, 27 Oct 2014 15:37:07 -0700
Subject: [PATCH 09/34] Update code with new lint names

---
 src/libarena/lib.rs                           |  2 +-
 src/libcollections/priority_queue.rs          |  2 +-
 src/libcollections/slice.rs                   |  2 +-
 src/libcollections/smallintmap.rs             |  2 +-
 src/libcore/failure.rs                        |  4 +--
 src/libcore/fmt/float.rs                      |  2 +-
 src/libcore/fmt/mod.rs                        |  4 +--
 src/libcore/fmt/num.rs                        |  2 +-
 src/libcore/intrinsics.rs                     |  2 +-
 src/libcore/lib.rs                            |  2 +-
 src/libcore/num/f32.rs                        |  2 +-
 src/libcore/num/f64.rs                        |  2 +-
 src/libcore/num/mod.rs                        |  2 +-
 src/libcore/raw.rs                            |  2 +-
 src/libcore/simd.rs                           |  2 +-
 src/libcore/str.rs                            |  4 +--
 src/libcore/tuple/mod.rs                      |  8 ++---
 src/libcoretest/fmt/num.rs                    |  2 +-
 src/libgetopts/lib.rs                         |  4 +--
 src/liblibc/lib.rs                            |  4 +--
 src/liblog/lib.rs                             |  2 +-
 src/libnative/io/c_windows.rs                 |  2 +-
 src/libnative/lib.rs                          |  2 +-
 src/librand/isaac.rs                          |  2 +-
 src/librbml/lib.rs                            |  2 +-
 src/libregex/lib.rs                           |  2 +-
 src/libregex_macros/lib.rs                    |  4 +--
 src/librustc/driver/config.rs                 |  4 +--
 src/librustc/lint/builtin.rs                  | 22 ++++++-------
 src/librustc/lint/mod.rs                      |  2 +-
 src/librustc/metadata/common.rs               |  2 +-
 src/librustc/metadata/decoder.rs              |  4 +--
 src/librustc/metadata/encoder.rs              |  2 +-
 src/librustc/middle/borrowck/move_data.rs     |  4 +--
 src/librustc/middle/const_eval.rs             |  2 +-
 src/librustc/middle/graph.rs                  |  8 ++---
 src/librustc/middle/resolve.rs                |  2 +-
 src/librustc/middle/trans/adt.rs              |  6 ++--
 src/librustc/middle/trans/cabi_arm.rs         |  2 +-
 src/librustc/middle/trans/cabi_mips.rs        |  2 +-
 src/librustc/middle/trans/cabi_x86_64.rs      |  2 +-
 src/librustc/middle/trans/debuginfo.rs        | 14 ++++----
 src/librustc/middle/trans/intrinsic.rs        |  2 +-
 src/librustc/middle/trans/type_.rs            |  2 +-
 src/librustc/middle/ty.rs                     |  4 +--
 src/librustc/middle/typeck/infer/resolve.rs   |  2 +-
 src/librustc_back/abi.rs                      |  2 +-
 src/librustc_llvm/lib.rs                      |  2 +-
 src/librustdoc/test.rs                        |  2 +-
 src/librustrt/libunwind.rs                    |  2 +-
 src/librustrt/local_data.rs                   |  2 +-
 src/librustrt/util.rs                         |  4 +--
 src/libserialize/json.rs                      |  2 +-
 src/libstd/bitflags.rs                        |  2 +-
 src/libstd/dynamic_lib.rs                     |  2 +-
 src/libstd/io/extensions.rs                   |  2 +-
 src/libstd/io/mod.rs                          | 32 +++++++++----------
 src/libstd/io/net/addrinfo.rs                 |  4 +--
 src/libstd/io/net/ip.rs                       |  2 +-
 src/libstd/io/net/pipe.rs                     |  2 +-
 src/libstd/io/pipe.rs                         |  2 +-
 src/libstd/io/process.rs                      |  2 +-
 src/libstd/lib.rs                             |  2 +-
 src/libstd/macros.rs                          |  4 +--
 src/libstd/num/f32.rs                         |  4 +--
 src/libstd/num/f64.rs                         |  2 +-
 src/libstd/num/mod.rs                         |  2 +-
 src/libstd/num/strconv.rs                     |  2 +-
 src/libstd/num/uint_macros.rs                 |  2 +-
 src/libstd/os.rs                              |  2 +-
 src/libstd/path/posix.rs                      |  4 +--
 src/libstd/rand/os.rs                         |  2 +-
 src/libstd/rt/mod.rs                          |  2 +-
 src/libstd/sync/future.rs                     |  2 +-
 src/libsync/lib.rs                            |  2 +-
 src/libsync/mpmc_bounded_queue.rs             |  2 +-
 src/libsyntax/abi.rs                          |  6 ++--
 src/libsyntax/ast_util.rs                     |  2 +-
 src/libsyntax/parse/token.rs                  |  4 +--
 src/libsyntax/print/pprust.rs                 |  4 +--
 src/libterm/lib.rs                            |  2 +-
 src/libterm/terminfo/parm.rs                  |  2 +-
 src/libterm/terminfo/parser/compiled.rs       |  2 +-
 src/libtest/stats.rs                          |  4 +--
 src/libunicode/tables.rs                      |  2 +-
 .../syntax-extension-regex-unused-static.rs   |  4 +--
 .../syntax-extension-regex-unused.rs          |  2 +-
 src/test/compile-fail/asm-misplaced-option.rs |  2 +-
 .../compile-fail/borrowck-lend-flow-match.rs  |  4 +--
 src/test/compile-fail/issue-10656.rs          |  2 +-
 src/test/compile-fail/issue-14309.rs          |  2 +-
 src/test/compile-fail/issue-17999.rs          |  2 +-
 src/test/compile-fail/issue-2150.rs           |  2 +-
 src/test/compile-fail/lint-ctypes-enum.rs     |  2 +-
 src/test/compile-fail/lint-ctypes.rs          |  2 +-
 src/test/compile-fail/lint-dead-code-1.rs     |  4 +--
 src/test/compile-fail/lint-dead-code-2.rs     |  2 +-
 src/test/compile-fail/lint-dead-code-3.rs     |  2 +-
 src/test/compile-fail/lint-dead-code-4.rs     |  2 +-
 src/test/compile-fail/lint-dead-code-5.rs     |  2 +-
 ...int-directives-on-use-items-issue-10534.rs |  2 +-
 src/test/compile-fail/lint-misplaced-attr.rs  |  2 +-
 src/test/compile-fail/lint-missing-doc.rs     | 18 +++++------
 .../lint-non-uppercase-statics.rs             |  2 +-
 src/test/compile-fail/lint-obsolete-attr.rs   |  2 +-
 .../compile-fail/lint-owned-heap-memory.rs    |  2 +-
 src/test/compile-fail/lint-qualification.rs   |  2 +-
 src/test/compile-fail/lint-type-overflow.rs   |  4 +--
 src/test/compile-fail/lint-unknown-attr.rs    |  2 +-
 .../compile-fail/lint-unnecessary-casts.rs    |  2 +-
 .../lint-unnecessary-import-braces.rs         |  2 +-
 .../compile-fail/lint-unnecessary-parens.rs   |  2 +-
 src/test/compile-fail/lint-unsafe-block.rs    |  4 +--
 .../compile-fail/lint-unused-extern-crate.rs  |  4 +--
 src/test/compile-fail/lint-unused-mut-self.rs |  4 +--
 .../compile-fail/lint-unused-mut-variables.rs |  4 +--
 src/test/compile-fail/liveness-dead.rs        |  2 +-
 src/test/compile-fail/liveness-unused.rs      | 12 +++----
 .../compile-fail/match-static-const-lc.rs     |  6 ++--
 .../regions-fn-subtyping-return-static.rs     |  2 +-
 src/test/compile-fail/unreachable-code.rs     |  2 +-
 src/test/compile-fail/unused-attr.rs          |  2 +-
 src/test/compile-fail/unused-result.rs        |  6 ++--
 .../compile-fail/warn-foreign-int-types.rs    |  2 +-
 .../debuginfo/basic-types-globals-metadata.rs |  2 +-
 src/test/debuginfo/basic-types-globals.rs     |  2 +-
 src/test/debuginfo/basic-types-metadata.rs    |  2 +-
 src/test/debuginfo/basic-types-mut-globals.rs |  2 +-
 src/test/debuginfo/basic-types.rs             |  2 +-
 src/test/debuginfo/borrowed-basic.rs          |  2 +-
 src/test/debuginfo/borrowed-c-style-enum.rs   |  2 +-
 src/test/debuginfo/borrowed-enum.rs           |  2 +-
 src/test/debuginfo/borrowed-struct.rs         |  2 +-
 src/test/debuginfo/borrowed-tuple.rs          |  2 +-
 src/test/debuginfo/borrowed-unique-basic.rs   |  2 +-
 src/test/debuginfo/box.rs                     |  2 +-
 src/test/debuginfo/boxed-struct.rs            |  2 +-
 .../debuginfo/c-style-enum-in-composite.rs    |  2 +-
 src/test/debuginfo/c-style-enum.rs            |  2 +-
 .../debuginfo/destructured-fn-argument.rs     |  2 +-
 src/test/debuginfo/destructured-local.rs      |  2 +-
 src/test/debuginfo/evec-in-struct.rs          |  2 +-
 .../debuginfo/function-arg-initialization.rs  |  2 +-
 ...nction-prologue-stepping-no-stack-check.rs |  2 +-
 .../function-prologue-stepping-regular.rs     |  2 +-
 src/test/debuginfo/include_string.rs          |  2 +-
 .../lexical-scopes-in-block-expression.rs     |  4 +--
 src/test/debuginfo/limited-debuginfo.rs       |  2 +-
 .../multiple-functions-equal-var-names.rs     |  2 +-
 src/test/debuginfo/multiple-functions.rs      |  2 +-
 src/test/debuginfo/nil-enum.rs                |  2 +-
 src/test/debuginfo/no-debug-attribute.rs      |  2 +-
 .../packed-struct-with-destructor.rs          |  2 +-
 src/test/debuginfo/packed-struct.rs           |  2 +-
 src/test/debuginfo/recursive-enum.rs          |  2 +-
 src/test/debuginfo/recursive-struct.rs        |  2 +-
 src/test/debuginfo/simd.rs                    |  2 +-
 src/test/debuginfo/simple-struct.rs           |  2 +-
 src/test/debuginfo/simple-tuple.rs            |  2 +-
 src/test/debuginfo/struct-in-enum.rs          |  2 +-
 src/test/debuginfo/struct-in-struct.rs        |  2 +-
 src/test/debuginfo/struct-style-enum.rs       |  2 +-
 src/test/debuginfo/struct-with-destructor.rs  |  2 +-
 src/test/debuginfo/trait-pointers.rs          |  2 +-
 src/test/debuginfo/tuple-in-struct.rs         |  2 +-
 src/test/debuginfo/tuple-in-tuple.rs          |  2 +-
 src/test/debuginfo/tuple-style-enum.rs        |  2 +-
 src/test/debuginfo/unique-enum.rs             |  2 +-
 .../var-captured-in-nested-closure.rs         |  2 +-
 .../var-captured-in-sendable-closure.rs       |  2 +-
 .../var-captured-in-stack-closure.rs          |  2 +-
 src/test/debuginfo/vec-slices.rs              |  2 +-
 src/test/debuginfo/vec.rs                     |  2 +-
 src/test/run-fail/explicit-fail-msg.rs        |  4 +--
 src/test/run-fail/issue-3029.rs               |  4 +--
 src/test/run-fail/issue-948.rs                |  2 +-
 src/test/run-fail/match-bot-fail.rs           |  2 +-
 src/test/run-fail/rhs-type.rs                 |  2 +-
 178 files changed, 265 insertions(+), 265 deletions(-)

diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs
index 1cd6f7f66851f..fc1ff2590510c 100644
--- a/src/libarena/lib.rs
+++ b/src/libarena/lib.rs
@@ -29,7 +29,7 @@
        html_root_url = "http://doc.rust-lang.org/nightly/")]
 
 #![feature(unsafe_destructor)]
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use std::cell::{Cell, RefCell};
 use std::cmp;
diff --git a/src/libcollections/priority_queue.rs b/src/libcollections/priority_queue.rs
index 16e04b93777f2..9de2c20c03f3b 100644
--- a/src/libcollections/priority_queue.rs
+++ b/src/libcollections/priority_queue.rs
@@ -151,7 +151,7 @@
 //! }
 //! ```
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use core::prelude::*;
 
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index d4115df7da478..8c165b52df47f 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -108,7 +108,7 @@ pub use core::slice::{Found, NotFound};
 
 // Functional utilities
 
-#[allow(missing_doc)]
+#[allow(missing_docs)]
 pub trait VectorVector<T> {
     // FIXME #5898: calling these .concat and .connect conflicts with
     // StrVector::con{cat,nect}, since they have generic contents.
diff --git a/src/libcollections/smallintmap.rs b/src/libcollections/smallintmap.rs
index 498f86a8bf1e4..aba07513dd788 100644
--- a/src/libcollections/smallintmap.rs
+++ b/src/libcollections/smallintmap.rs
@@ -11,7 +11,7 @@
 //! A simple map based on a vector for small integer keys. Space requirements
 //! are O(highest integer key).
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use core::prelude::*;
 
diff --git a/src/libcore/failure.rs b/src/libcore/failure.rs
index 9b63d325bc89a..7bc7795e19318 100644
--- a/src/libcore/failure.rs
+++ b/src/libcore/failure.rs
@@ -28,7 +28,7 @@
 //! one function. Currently, the actual symbol is declared in the standard
 //! library, but the location of this may change over time.
 
-#![allow(dead_code, missing_doc)]
+#![allow(dead_code, missing_docs)]
 
 use fmt;
 use intrinsics;
@@ -57,7 +57,7 @@ fn fail_bounds_check(file_line: &(&'static str, uint),
 
 #[cold] #[inline(never)]
 pub fn fail_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
-    #[allow(ctypes)]
+    #[allow(improper_ctypes)]
     extern {
         #[lang = "fail_fmt"]
         fn fail_impl(fmt: &fmt::Arguments, file: &'static str,
diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs
index 343ab7cfd28b9..2e5f9aee2131c 100644
--- a/src/libcore/fmt/float.rs
+++ b/src/libcore/fmt/float.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use char;
 use collections::Collection;
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 093f5896aad2d..65107d6ab7d83 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -10,7 +10,7 @@
 
 //! Utilities for formatting and printing strings
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 use any;
 use cell::{Cell, Ref, RefMut};
@@ -733,7 +733,7 @@ macro_rules! tuple (
     () => ();
     ( $($name:ident,)+ ) => (
         impl<$($name:Show),*> Show for ($($name,)*) {
-            #[allow(non_snake_case, dead_assignment)]
+            #[allow(non_snake_case, unused_assignments)]
             fn fmt(&self, f: &mut Formatter) -> Result {
                 try!(write!(f, "("));
                 let ($(ref $name,)*) = *self;
diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs
index e57c499948362..66f5f5921fc35 100644
--- a/src/libcore/fmt/num.rs
+++ b/src/libcore/fmt/num.rs
@@ -12,7 +12,7 @@
 
 // FIXME: #6220 Implement floating point formatting
 
-#![allow(unsigned_negate)]
+#![allow(unsigned_negation)]
 
 use collections::Collection;
 use fmt;
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index 8486535d18876..609706183a688 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -42,7 +42,7 @@ A quick refresher on memory ordering:
 */
 
 #![experimental]
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 pub type GlueFn = extern "Rust" fn(*const i8);
 
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 62a4fbd2e08cd..0c4a41fbf65b5 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -60,7 +60,7 @@
 #![allow(unknown_features)]
 #![feature(globs, intrinsics, lang_items, macro_rules, phase)]
 #![feature(simd, unsafe_destructor, slicing_syntax)]
-#![deny(missing_doc)]
+#![deny(missing_docs)]
 
 mod macros;
 
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index bf362928f61c3..521085bca7638 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -12,7 +12,7 @@
 
 #![doc(primitive = "f32")]
 // FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353
-#![allow(type_overflow)]
+#![allow(overflowing_literals)]
 
 use intrinsics;
 use mem;
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index 5ad2e2f9f8b59..78065d7803e0b 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -12,7 +12,7 @@
 
 #![doc(primitive = "f64")]
 // FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353
-#![allow(type_overflow)]
+#![allow(overflowing_literals)]
 
 use intrinsics;
 use mem;
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 3dceb42e20653..eae0f5f7d29be 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -12,7 +12,7 @@
 
 //! Numeric traits and functions for generic mathematics
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use intrinsics;
 use {int, i8, i16, i32, i64};
diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs
index fe365b43ca6d1..be15115baeb1b 100644
--- a/src/libcore/raw.rs
+++ b/src/libcore/raw.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 #![experimental]
 
 //! Contains struct definitions for the layout of compiler built-in types.
diff --git a/src/libcore/simd.rs b/src/libcore/simd.rs
index 42418ccbc1a6f..2b6f97cf6a5c4 100644
--- a/src/libcore/simd.rs
+++ b/src/libcore/simd.rs
@@ -35,7 +35,7 @@
 //! warning.
 
 #![allow(non_camel_case_types)]
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 #[experimental]
 #[simd]
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index e8cd93ba7dc42..82e0d530269b3 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -767,7 +767,7 @@ Section: Comparing strings
 /// to compare &[u8] byte slices that are not necessarily valid UTF-8.
 #[inline]
 fn eq_slice_(a: &str, b: &str) -> bool {
-    #[allow(ctypes)]
+    #[allow(improper_ctypes)]
     extern { fn memcmp(s1: *const i8, s2: *const i8, n: uint) -> i32; }
     a.len() == b.len() && unsafe {
         memcmp(a.as_ptr() as *const i8,
@@ -1117,7 +1117,7 @@ pub mod raw {
 Section: Trait implementations
 */
 
-#[allow(missing_doc)]
+#[allow(missing_docs)]
 pub mod traits {
     use cmp::{Ord, Ordering, Less, Equal, Greater, PartialEq, PartialOrd, Equiv, Eq};
     use collections::Collection;
diff --git a/src/libcore/tuple/mod.rs b/src/libcore/tuple/mod.rs
index ead3564718018..56ea7a4e7a1e9 100644
--- a/src/libcore/tuple/mod.rs
+++ b/src/libcore/tuple/mod.rs
@@ -81,7 +81,7 @@ macro_rules! tuple_impls {
         }
     )+) => {
         $(
-            #[allow(missing_doc)]
+            #[allow(missing_docs)]
             #[stable]
             pub trait $Tuple<$($T),+> {
                 $(
@@ -97,21 +97,21 @@ macro_rules! tuple_impls {
             impl<$($T),+> $Tuple<$($T),+> for ($($T,)+) {
                 $(
                     #[inline]
-                    #[allow(unused_variable)]
+                    #[allow(unused_variables)]
                     #[unstable = "may rename pending accessor naming conventions"]
                     fn $valN(self) -> $T {
                         let ($($x,)+) = self; $ret
                     }
 
                     #[inline]
-                    #[allow(unused_variable)]
+                    #[allow(unused_variables)]
                     #[unstable = "may rename pending accessor naming conventions"]
                     fn $refN<'a>(&'a self) -> &'a $T {
                         let ($(ref $x,)+) = *self; $ret
                     }
 
                     #[inline]
-                    #[allow(unused_variable)]
+                    #[allow(unused_variables)]
                     #[unstable = "may rename pending accessor naming conventions"]
                     fn $mutN<'a>(&'a mut self) -> &'a mut $T {
                         let ($(ref mut $x,)+) = *self; $ret
diff --git a/src/libcoretest/fmt/num.rs b/src/libcoretest/fmt/num.rs
index baef7e3a11e85..868e14b928a40 100644
--- a/src/libcoretest/fmt/num.rs
+++ b/src/libcoretest/fmt/num.rs
@@ -7,7 +7,7 @@
 // <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.
-#![allow(unsigned_negate)]
+#![allow(unsigned_negation)]
 
 use core::fmt::radix;
 
diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs
index a73f7ddf7f7ed..7ddbb911b0819 100644
--- a/src/libgetopts/lib.rs
+++ b/src/libgetopts/lib.rs
@@ -89,7 +89,7 @@
        html_playground_url = "http://play.rust-lang.org/")]
 #![feature(globs, phase)]
 #![feature(import_shadowing)]
-#![deny(missing_doc)]
+#![deny(missing_docs)]
 
 #[cfg(test)] #[phase(plugin, link)] extern crate log;
 
@@ -201,7 +201,7 @@ pub enum Fail_ {
 
 /// The type of failure that occurred.
 #[deriving(PartialEq, Eq)]
-#[allow(missing_doc)]
+#[allow(missing_docs)]
 pub enum FailType {
     ArgumentMissing_,
     UnrecognizedOption_,
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs
index d1a08660cb9c2..6756d4b21ff78 100644
--- a/src/liblibc/lib.rs
+++ b/src/liblibc/lib.rs
@@ -75,8 +75,8 @@
 
 #![allow(non_camel_case_types)]
 #![allow(non_snake_case)]
-#![allow(non_uppercase_statics)]
-#![allow(missing_doc)]
+#![allow(non_upper_case_globals)]
+#![allow(missing_docs)]
 #![allow(non_snake_case)]
 
 extern crate core;
diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs
index 9d5080522c26e..587be9547ae76 100644
--- a/src/liblog/lib.rs
+++ b/src/liblog/lib.rs
@@ -167,7 +167,7 @@
        html_root_url = "http://doc.rust-lang.org/nightly/",
        html_playground_url = "http://play.rust-lang.org/")]
 #![feature(macro_rules)]
-#![deny(missing_doc)]
+#![deny(missing_docs)]
 
 extern crate regex;
 
diff --git a/src/libnative/io/c_windows.rs b/src/libnative/io/c_windows.rs
index eed3df28b8f33..ee6aa26ede22c 100644
--- a/src/libnative/io/c_windows.rs
+++ b/src/libnative/io/c_windows.rs
@@ -10,7 +10,7 @@
 
 //! C definitions used by libnative that don't belong in liblibc
 
-#![allow(type_overflow)]
+#![allow(overflowing_literals)]
 
 use libc;
 
diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs
index c99143f0a5d7b..0104ac1f2bb9f 100644
--- a/src/libnative/lib.rs
+++ b/src/libnative/lib.rs
@@ -55,7 +55,7 @@
        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
        html_root_url = "http://doc.rust-lang.org/nightly/")]
 
-#![deny(unused_result, unused_must_use)]
+#![deny(unused_results, unused_must_use)]
 #![allow(non_camel_case_types)]
 #![allow(unknown_features)]
 #![feature(default_type_params, lang_items, slicing_syntax)]
diff --git a/src/librand/isaac.rs b/src/librand/isaac.rs
index 3d83012cecbf0..49d60a98b6496 100644
--- a/src/librand/isaac.rs
+++ b/src/librand/isaac.rs
@@ -118,7 +118,7 @@ impl IsaacRng {
 
     /// Refills the output buffer (`self.rsl`)
     #[inline]
-    #[allow(unsigned_negate)]
+    #[allow(unsigned_negation)]
     fn isaac(&mut self) {
         self.c += 1;
         // abbreviations
diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs
index 07474a9f10587..dead09c218655 100644
--- a/src/librbml/lib.rs
+++ b/src/librbml/lib.rs
@@ -26,7 +26,7 @@
        html_playground_url = "http://play.rust-lang.org/")]
 #![allow(unknown_features)]
 #![feature(macro_rules, phase, slicing_syntax)]
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 extern crate serialize;
 
diff --git a/src/libregex/lib.rs b/src/libregex/lib.rs
index bb6df26dab4f5..97265a74c6744 100644
--- a/src/libregex/lib.rs
+++ b/src/libregex/lib.rs
@@ -370,7 +370,7 @@
 
 #![allow(unknown_features)]
 #![feature(macro_rules, phase, slicing_syntax)]
-#![deny(missing_doc)]
+#![deny(missing_docs)]
 
 #[cfg(test)]
 extern crate "test" as stdtest;
diff --git a/src/libregex_macros/lib.rs b/src/libregex_macros/lib.rs
index 04c0e7cc21fb1..71b71599245e8 100644
--- a/src/libregex_macros/lib.rs
+++ b/src/libregex_macros/lib.rs
@@ -179,7 +179,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
     }
 
     impl<'t> Nfa<'t> {
-        #[allow(unused_variable)]
+        #[allow(unused_variables)]
         fn run(&mut self, start: uint, end: uint) -> Vec<Option<uint>> {
             let mut matched = false;
             let prefix_bytes: &[u8] = $prefix_bytes;
@@ -226,7 +226,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
         }
 
         // Sometimes `nlist` is never used (for empty regexes).
-        #[allow(unused_variable)]
+        #[allow(unused_variables)]
         #[inline]
         fn step(&self, groups: &mut Captures, nlist: &mut Threads,
                 caps: &mut Captures, pc: uint) -> StepState {
diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs
index d6798d59ecb3d..864eb603611b0 100644
--- a/src/librustc/driver/config.rs
+++ b/src/librustc/driver/config.rs
@@ -498,7 +498,7 @@ pub fn get_os(triple: &str) -> Option<abi::Os> {
     }
     None
 }
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static os_names : &'static [(&'static str, abi::Os)] = &[
     ("mingw32",   abi::OsWindows),
     ("win32",     abi::OsWindows),
@@ -516,7 +516,7 @@ pub fn get_arch(triple: &str) -> Option<abi::Architecture> {
     }
     None
 }
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static architecture_abis : &'static [(&'static str, abi::Architecture)] = &[
     ("i386",   abi::X86),
     ("i486",   abi::X86),
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 8c44adc55d288..4b63b2537ed1d 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -1021,7 +1021,7 @@ declare_lint!(UNUSED_PARENS, Warn,
 pub struct UnusedParens;
 
 impl UnusedParens {
-    fn check_unnecessary_parens_core(&self, cx: &Context, value: &ast::Expr, msg: &str,
+    fn check_unused_parens_core(&self, cx: &Context, value: &ast::Expr, msg: &str,
                                      struct_lit_needs_parens: bool) {
         match value.node {
             ast::ExprParen(ref inner) => {
@@ -1090,7 +1090,7 @@ impl LintPass for UnusedParens {
             ast::ExprAssignOp(_, _, ref value) => (value, "assigned value", false),
             _ => return
         };
-        self.check_unnecessary_parens_core(cx, &**value, msg, struct_lit_needs_parens);
+        self.check_unused_parens_core(cx, &**value, msg, struct_lit_needs_parens);
     }
 
     fn check_stmt(&mut self, cx: &Context, s: &ast::Stmt) {
@@ -1104,7 +1104,7 @@ impl LintPass for UnusedParens {
             },
             _ => return
         };
-        self.check_unnecessary_parens_core(cx, &**value, msg, false);
+        self.check_unused_parens_core(cx, &**value, msg, false);
     }
 }
 
@@ -1364,7 +1364,7 @@ impl MissingDoc {
         *self.doc_hidden_stack.last().expect("empty doc_hidden_stack")
     }
 
-    fn check_missing_doc_attrs(&self,
+    fn check_missing_docs_attrs(&self,
                                cx: &Context,
                                id: Option<ast::NodeId>,
                                attrs: &[ast::Attribute],
@@ -1374,7 +1374,7 @@ impl MissingDoc {
         // documentation is probably not really relevant right now.
         if cx.sess().opts.test { return }
 
-        // `#[doc(hidden)]` disables missing_doc check.
+        // `#[doc(hidden)]` disables missing_docs check.
         if self.doc_hidden() { return }
 
         // Only check publicly-visible items, using the result from the privacy pass.
@@ -1429,7 +1429,7 @@ impl LintPass for MissingDoc {
     }
 
     fn check_crate(&mut self, cx: &Context, krate: &ast::Crate) {
-        self.check_missing_doc_attrs(cx, None, krate.attrs.as_slice(),
+        self.check_missing_docs_attrs(cx, None, krate.attrs.as_slice(),
                                      krate.span, "crate");
     }
 
@@ -1442,7 +1442,7 @@ impl LintPass for MissingDoc {
             ast::ItemTrait(..) => "a trait",
             _ => return
         };
-        self.check_missing_doc_attrs(cx, Some(it.id), it.attrs.as_slice(),
+        self.check_missing_docs_attrs(cx, Some(it.id), it.attrs.as_slice(),
                                      it.span, desc);
     }
 
@@ -1456,7 +1456,7 @@ impl LintPass for MissingDoc {
 
                 // Otherwise, doc according to privacy. This will also check
                 // doc for default methods defined on traits.
-                self.check_missing_doc_attrs(cx, Some(m.id), m.attrs.as_slice(),
+                self.check_missing_docs_attrs(cx, Some(m.id), m.attrs.as_slice(),
                                              m.span, "a method");
             }
             _ => {}
@@ -1464,7 +1464,7 @@ impl LintPass for MissingDoc {
     }
 
     fn check_ty_method(&mut self, cx: &Context, tm: &ast::TypeMethod) {
-        self.check_missing_doc_attrs(cx, Some(tm.id), tm.attrs.as_slice(),
+        self.check_missing_docs_attrs(cx, Some(tm.id), tm.attrs.as_slice(),
                                      tm.span, "a type method");
     }
 
@@ -1473,7 +1473,7 @@ impl LintPass for MissingDoc {
             ast::NamedField(_, vis) if vis == ast::Public => {
                 let cur_struct_def = *self.struct_def_stack.last()
                     .expect("empty struct_def_stack");
-                self.check_missing_doc_attrs(cx, Some(cur_struct_def),
+                self.check_missing_docs_attrs(cx, Some(cur_struct_def),
                                              sf.node.attrs.as_slice(), sf.span,
                                              "a struct field")
             }
@@ -1482,7 +1482,7 @@ impl LintPass for MissingDoc {
     }
 
     fn check_variant(&mut self, cx: &Context, v: &ast::Variant, _: &ast::Generics) {
-        self.check_missing_doc_attrs(cx, Some(v.node.id), v.node.attrs.as_slice(),
+        self.check_missing_docs_attrs(cx, Some(v.node.id), v.node.attrs.as_slice(),
                                      v.span, "a variant");
     }
 }
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs
index 5afe5326171d7..0202aa185585c 100644
--- a/src/librustc/lint/mod.rs
+++ b/src/librustc/lint/mod.rs
@@ -98,7 +98,7 @@ macro_rules! declare_lint (
 #[macro_export]
 macro_rules! lint_array ( ($( $lint:expr ),*) => (
     {
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         static array: LintArray = &[ $( &$lint ),* ];
         array
     }
diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs
index 492feee6f84b3..bc58097b86072 100644
--- a/src/librustc/metadata/common.rs
+++ b/src/librustc/metadata/common.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(non_camel_case_types, non_uppercase_statics)]
+#![allow(non_camel_case_types, non_upper_case_globals)]
 
 use std::mem;
 use back::svh::Svh;
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs
index fd71e4f7b1fba..23a7c8f3d8aa1 100644
--- a/src/librustc/metadata/decoder.rs
+++ b/src/librustc/metadata/decoder.rs
@@ -1330,9 +1330,9 @@ pub fn get_missing_lang_items(cdata: Cmd)
 {
     let items = reader::get_doc(rbml::Doc::new(cdata.data()), tag_lang_items);
     let mut result = Vec::new();
-    reader::tagged_docs(items, tag_lang_items_missing, |missing_doc| {
+    reader::tagged_docs(items, tag_lang_items_missing, |missing_docs| {
         let item: lang_items::LangItem =
-            FromPrimitive::from_u32(reader::doc_as_u32(missing_doc)).unwrap();
+            FromPrimitive::from_u32(reader::doc_as_u32(missing_docs)).unwrap();
         result.push(item);
         true
     });
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 6fe14a2d12ab5..ad53560a4c2ae 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -2028,7 +2028,7 @@ fn encode_dylib_dependency_formats(rbml_w: &mut Encoder, ecx: &EncodeContext) {
 }
 
 // NB: Increment this as you change the metadata encoding version.
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const metadata_encoding_version : &'static [u8] = &[b'r', b'u', b's', b't', 0, 0, 0, 1 ];
 
 pub fn encode_metadata(parms: EncodeParams, krate: &Crate) -> Vec<u8> {
diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs
index 5f3c46fcf4cd5..9ebbdab03caa0 100644
--- a/src/librustc/middle/borrowck/move_data.rs
+++ b/src/librustc/middle/borrowck/move_data.rs
@@ -83,7 +83,7 @@ impl Clone for MovePathIndex {
     }
 }
 
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static InvalidMovePathIndex: MovePathIndex =
     MovePathIndex(uint::MAX);
 
@@ -97,7 +97,7 @@ impl MoveIndex {
     }
 }
 
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static InvalidMoveIndex: MoveIndex =
     MoveIndex(uint::MAX);
 
diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs
index 3d6b319ac0d62..ad0040608ece8 100644
--- a/src/librustc/middle/const_eval.rs
+++ b/src/librustc/middle/const_eval.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![allow(non_camel_case_types)]
-#![allow(unsigned_negate)]
+#![allow(unsigned_negation)]
 
 use metadata::csearch;
 use middle::astencode;
diff --git a/src/librustc/middle/graph.rs b/src/librustc/middle/graph.rs
index 4775f945f5c1f..5f9d57488f47f 100644
--- a/src/librustc/middle/graph.rs
+++ b/src/librustc/middle/graph.rs
@@ -66,20 +66,20 @@ impl<E: Show> Show for Edge<E> {
 
 #[deriving(Clone, PartialEq, Show)]
 pub struct NodeIndex(pub uint);
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
 
 #[deriving(PartialEq, Show)]
 pub struct EdgeIndex(pub uint);
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
 
 // Use a private field here to guarantee no more instances are created:
 #[deriving(Show)]
 pub struct Direction { repr: uint }
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const Outgoing: Direction = Direction { repr: 0 };
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const Incoming: Direction = Direction { repr: 1 };
 
 impl NodeIndex {
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index fad4ef4f15f6b..49d1f307d9a96 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -3158,7 +3158,7 @@ impl<'a> Resolver<'a> {
                                         (_, _) => {
                                             search_module = module_def.clone();
 
-                                            // track extern crates for unused_extern_crate lint
+                                            // track extern crates for unused_extern_crates lint
                                             match module_def.def_id.get() {
                                                 Some(did) => {
                                                     self.used_crates.insert(did.krate);
diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs
index 2525da8863f55..804d2b71046d6 100644
--- a/src/librustc/middle/trans/adt.rs
+++ b/src/librustc/middle/trans/adt.rs
@@ -43,7 +43,7 @@
  *   taken to it, implementing them for Rust seems difficult.
  */
 
-#![allow(unsigned_negate)]
+#![allow(unsigned_negation)]
 
 use std::collections::Map;
 use std::num::Int;
@@ -393,12 +393,12 @@ fn mk_cenum(cx: &CrateContext, hint: Hint, bounds: &IntBounds) -> Repr {
 fn range_to_inttype(cx: &CrateContext, hint: Hint, bounds: &IntBounds) -> IntType {
     debug!("range_to_inttype: {} {}", hint, bounds);
     // Lists of sizes to try.  u64 is always allowed as a fallback.
-    #[allow(non_uppercase_statics)]
+    #[allow(non_upper_case_globals)]
     static choose_shortest: &'static[IntType] = &[
         attr::UnsignedInt(ast::TyU8), attr::SignedInt(ast::TyI8),
         attr::UnsignedInt(ast::TyU16), attr::SignedInt(ast::TyI16),
         attr::UnsignedInt(ast::TyU32), attr::SignedInt(ast::TyI32)];
-    #[allow(non_uppercase_statics)]
+    #[allow(non_upper_case_globals)]
     static at_least_32: &'static[IntType] = &[
         attr::UnsignedInt(ast::TyU32), attr::SignedInt(ast::TyI32)];
 
diff --git a/src/librustc/middle/trans/cabi_arm.rs b/src/librustc/middle/trans/cabi_arm.rs
index ccfc79ac0c500..0e760ec05cafd 100644
--- a/src/librustc/middle/trans/cabi_arm.rs
+++ b/src/librustc/middle/trans/cabi_arm.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 
 use llvm;
 use llvm::{Integer, Pointer, Float, Double, Struct, Array};
diff --git a/src/librustc/middle/trans/cabi_mips.rs b/src/librustc/middle/trans/cabi_mips.rs
index 90bd1521705f0..4fa2fc0edc7c6 100644
--- a/src/librustc/middle/trans/cabi_mips.rs
+++ b/src/librustc/middle/trans/cabi_mips.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 
 use libc::c_uint;
 use std::cmp;
diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs
index 1b8a354259ad7..2adf4ce455ac7 100644
--- a/src/librustc/middle/trans/cabi_x86_64.rs
+++ b/src/librustc/middle/trans/cabi_x86_64.rs
@@ -11,7 +11,7 @@
 // The classification code for the x86_64 ABI is taken from the clay language
 // https://github.com/jckarter/clay/blob/master/compiler/src/externals.cpp
 
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 
 use llvm;
 use llvm::{Integer, Pointer, Float, Double};
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index 3368b2b7765b8..653141f31f466 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -218,20 +218,20 @@ use syntax::parse::token::special_idents;
 
 static DW_LANG_RUST: c_uint = 0x9000;
 
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static DW_TAG_auto_variable: c_uint = 0x100;
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static DW_TAG_arg_variable: c_uint = 0x101;
 
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static DW_ATE_boolean: c_uint = 0x02;
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static DW_ATE_float: c_uint = 0x04;
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static DW_ATE_signed: c_uint = 0x05;
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static DW_ATE_unsigned: c_uint = 0x07;
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static DW_ATE_unsigned_char: c_uint = 0x08;
 
 static UNKNOWN_LINE_NUMBER: c_uint = 0;
diff --git a/src/librustc/middle/trans/intrinsic.rs b/src/librustc/middle/trans/intrinsic.rs
index 3e75b0772fb10..5798691188f81 100644
--- a/src/librustc/middle/trans/intrinsic.rs
+++ b/src/librustc/middle/trans/intrinsic.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 
 use llvm;
 use llvm::{SequentiallyConsistent, Acquire, Release, AtomicXchg, ValueRef};
diff --git a/src/librustc/middle/trans/type_.rs b/src/librustc/middle/trans/type_.rs
index 6acbde3b2adc9..8c6dcbba54daa 100644
--- a/src/librustc/middle/trans/type_.rs
+++ b/src/librustc/middle/trans/type_.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 
 use llvm;
 use llvm::{TypeRef, Bool, False, True, TypeKind, ValueRef};
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 7fedea67f79af..f33996d6d8eb6 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -2212,7 +2212,7 @@ macro_rules! def_type_content_sets(
         mod $mname {
             use middle::ty::TypeContents;
             $(
-                #[allow(non_uppercase_statics)]
+                #[allow(non_upper_case_globals)]
                 pub const $name: TypeContents = TypeContents { bits: $bits };
              )+
         }
@@ -4661,7 +4661,7 @@ pub fn unboxed_closure_upvars(tcx: &ctxt, closure_id: ast::DefId, substs: &Subst
 }
 
 pub fn is_binopable(cx: &ctxt, ty: t, op: ast::BinOp) -> bool {
-    #![allow(non_uppercase_statics)]
+    #![allow(non_upper_case_globals)]
     static tycat_other: int = 0;
     static tycat_bool: int = 1;
     static tycat_char: int = 2;
diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs
index 87f3fd987871c..0016a80b5005e 100644
--- a/src/librustc/middle/typeck/infer/resolve.rs
+++ b/src/librustc/middle/typeck/infer/resolve.rs
@@ -46,7 +46,7 @@
 // future).  If you want to resolve everything but one type, you are
 // probably better off writing `resolve_all - resolve_ivar`.
 
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 
 use middle::ty::{FloatVar, FloatVid, IntVar, IntVid, RegionVid, TyVar, TyVid};
 use middle::ty::{IntType, UintType};
diff --git a/src/librustc_back/abi.rs b/src/librustc_back/abi.rs
index aa07b9a5034c7..19dd6b8459f04 100644
--- a/src/librustc_back/abi.rs
+++ b/src/librustc_back/abi.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 
 pub const box_field_refcnt: uint = 0u;
 pub const box_field_drop_glue: uint = 1u;
diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs
index 03399e739084a..06456a91e03f3 100644
--- a/src/librustc_llvm/lib.rs
+++ b/src/librustc_llvm/lib.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 #![allow(non_camel_case_types)]
 #![allow(non_snake_case)]
 #![allow(dead_code)]
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 685d76bb5200b..0643caa761008 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -212,7 +212,7 @@ pub fn maketest(s: &str, cratename: Option<&str>, lints: bool, dont_insert_main:
     if lints {
         prog.push_str(r"
 #![deny(warnings)]
-#![allow(unused_variable, dead_assignment, unused_mut, unused_attribute, dead_code)]
+#![allow(unused_variables, unused_assignments, unused_mut, unused_attributes, dead_code)]
 ");
     }
 
diff --git a/src/librustrt/libunwind.rs b/src/librustrt/libunwind.rs
index 6867cb2e76b34..2932a3dd4a824 100644
--- a/src/librustrt/libunwind.rs
+++ b/src/librustrt/libunwind.rs
@@ -10,7 +10,7 @@
 
 //! Unwind library interface
 
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 #![allow(non_camel_case_types)]
 #![allow(non_snake_case)]
 #![allow(dead_code)] // these are just bindings
diff --git a/src/librustrt/local_data.rs b/src/librustrt/local_data.rs
index 8d5c49d767f15..2f15f33c7d476 100644
--- a/src/librustrt/local_data.rs
+++ b/src/librustrt/local_data.rs
@@ -66,7 +66,7 @@ use task::{Task, LocalStorage};
  */
 pub type Key<T> = &'static KeyValue<T>;
 
-#[allow(missing_doc)]
+#[allow(missing_docs)]
 pub enum KeyValue<T> { KeyValueKey }
 
 // The task-local-map stores all TLD information for the currently running
diff --git a/src/librustrt/util.rs b/src/librustrt/util.rs
index a94da33e54357..06d1efdcd704a 100644
--- a/src/librustrt/util.rs
+++ b/src/librustrt/util.rs
@@ -28,9 +28,9 @@ pub const ENFORCE_SANITY: bool = true || !cfg!(rtopt) || cfg!(rtdebug) ||
 
 pub struct Stdio(libc::c_int);
 
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const Stdout: Stdio = Stdio(libc::STDOUT_FILENO);
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const Stderr: Stdio = Stdio(libc::STDERR_FILENO);
 
 impl fmt::FormatWriter for Stdio {
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index 73b4773fb3ff9..1bc90ea688b86 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -12,7 +12,7 @@
 // Copyright (c) 2011 Google Inc.
 
 #![forbid(non_camel_case_types)]
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 /*!
 JSON parsing and serialization
diff --git a/src/libstd/bitflags.rs b/src/libstd/bitflags.rs
index fb5934c6af634..97a1f68606f54 100644
--- a/src/libstd/bitflags.rs
+++ b/src/libstd/bitflags.rs
@@ -258,7 +258,7 @@ macro_rules! bitflags {
 }
 
 #[cfg(test)]
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 mod tests {
     use hash;
     use option::{Some, None};
diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs
index ed8ff821f5cad..b873c9ef6715b 100644
--- a/src/libstd/dynamic_lib.rs
+++ b/src/libstd/dynamic_lib.rs
@@ -17,7 +17,7 @@ A simple wrapper over the platform's dynamic library facilities
 */
 
 #![experimental]
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use clone::Clone;
 use collections::MutableSeq;
diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs
index 57741db5ae218..88c69cee5ce9f 100644
--- a/src/libstd/io/extensions.rs
+++ b/src/libstd/io/extensions.rs
@@ -10,7 +10,7 @@
 
 //! Utility mixins that apply to all Readers and Writers
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 // FIXME: Not sure how this should be structured
 // FIXME: Iteration should probably be considered separately
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 8592d48974a25..b2c1791fd0518 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -1834,60 +1834,60 @@ bitflags! {
         const ALL_PERMISSIONS = USER_RWX.bits | GROUP_RWX.bits | OTHER_RWX.bits,
 
         // Deprecated names
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use USER_READ instead"]
         const UserRead     = USER_READ.bits,
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use USER_WRITE instead"]
         const UserWrite    = USER_WRITE.bits,
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use USER_EXECUTE instead"]
         const UserExecute  = USER_EXECUTE.bits,
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use GROUP_READ instead"]
         const GroupRead    = GROUP_READ.bits,
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use GROUP_WRITE instead"]
         const GroupWrite   = GROUP_WRITE.bits,
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use GROUP_EXECUTE instead"]
         const GroupExecute = GROUP_EXECUTE.bits,
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use OTHER_READ instead"]
         const OtherRead    = OTHER_READ.bits,
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use OTHER_WRITE instead"]
         const OtherWrite   = OTHER_WRITE.bits,
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use OTHER_EXECUTE instead"]
         const OtherExecute = OTHER_EXECUTE.bits,
 
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use USER_RWX instead"]
         const UserRWX  = USER_RWX.bits,
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use GROUP_RWX instead"]
         const GroupRWX = GROUP_RWX.bits,
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use OTHER_RWX instead"]
         const OtherRWX = OTHER_RWX.bits,
 
         #[doc = "Deprecated: use `USER_FILE` instead."]
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use USER_FILE instead"]
         const UserFile = USER_FILE.bits,
 
         #[doc = "Deprecated: use `USER_DIR` instead."]
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use USER_DIR instead"]
         const UserDir  = USER_DIR.bits,
         #[doc = "Deprecated: use `USER_EXEC` instead."]
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use USER_EXEC instead"]
         const UserExec = USER_EXEC.bits,
 
         #[doc = "Deprecated: use `ALL_PERMISSIONS` instead"]
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         #[deprecated = "use ALL_PERMISSIONS instead"]
         const AllPermissions = ALL_PERMISSIONS.bits,
     }
diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs
index 9d85701eb2984..7cdb2669030f0 100644
--- a/src/libstd/io/net/addrinfo.rs
+++ b/src/libstd/io/net/addrinfo.rs
@@ -17,7 +17,7 @@ getaddrinfo()
 
 */
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use iter::Iterator;
 use io::{IoResult, IoError};
@@ -91,7 +91,7 @@ pub fn get_host_addresses(host: &str) -> IoResult<Vec<IpAddr>> {
 ///
 /// FIXME: this is not public because the `Hint` structure is not ready for public
 ///      consumption just yet.
-#[allow(unused_variable)]
+#[allow(unused_variables)]
 fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>)
           -> IoResult<Vec<Info>> {
     let hint = hint.map(|Hint { family, socktype, protocol, flags }| {
diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs
index 5140159e4ea37..e93af7446990a 100644
--- a/src/libstd/io/net/ip.rs
+++ b/src/libstd/io/net/ip.rs
@@ -13,7 +13,7 @@
 //! This module contains functions useful for parsing, formatting, and
 //! manipulating IP addresses.
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use collections::Collection;
 use fmt;
diff --git a/src/libstd/io/net/pipe.rs b/src/libstd/io/net/pipe.rs
index e0cf761fdbd7e..577b8a9f6efff 100644
--- a/src/libstd/io/net/pipe.rs
+++ b/src/libstd/io/net/pipe.rs
@@ -22,7 +22,7 @@ instances as clients.
 
 */
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use prelude::*;
 
diff --git a/src/libstd/io/pipe.rs b/src/libstd/io/pipe.rs
index 9362a48a6f00b..c77cffd561e66 100644
--- a/src/libstd/io/pipe.rs
+++ b/src/libstd/io/pipe.rs
@@ -13,7 +13,7 @@
 //! Currently these aren't particularly useful, there only exists bindings
 //! enough so that pipes can be created to child processes.
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use prelude::*;
 
diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs
index 88f8434b9576e..3c68b1b3b32dd 100644
--- a/src/libstd/io/process.rs
+++ b/src/libstd/io/process.rs
@@ -11,7 +11,7 @@
 //! Bindings for executing child processes
 
 #![allow(experimental)]
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 
 use prelude::*;
 
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index c47cd02599485..1d83994da4f5d 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -113,7 +113,7 @@
 // Don't link to std. We are std.
 #![no_std]
 
-#![deny(missing_doc)]
+#![deny(missing_docs)]
 
 #![reexport_test_harness_main = "test_main"]
 
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index 1ad3d6eed9420..d1d8fa3a0a705 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -304,11 +304,11 @@ macro_rules! println(
 #[macro_export]
 macro_rules! local_data_key(
     ($name:ident: $ty:ty) => (
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         static $name: ::std::local_data::Key<$ty> = &::std::local_data::KeyValueKey;
     );
     (pub $name:ident: $ty:ty) => (
-        #[allow(non_uppercase_statics)]
+        #[allow(non_upper_case_globals)]
         pub static $name: ::std::local_data::Key<$ty> = &::std::local_data::KeyValueKey;
     );
 )
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index 3fa181b84787d..0b2f17b8f93cc 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -11,8 +11,8 @@
 //! Operations and constants for 32-bits floats (`f32` type)
 
 #![experimental]
-#![allow(missing_doc)]
-#![allow(unsigned_negate)]
+#![allow(missing_docs)]
+#![allow(unsigned_negation)]
 #![doc(primitive = "f32")]
 
 use prelude::*;
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index b9d54ba182b07..35555b140815a 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -11,7 +11,7 @@
 //! Operations and constants for 64-bits floats (`f64` type)
 
 #![experimental]
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 #![doc(primitive = "f64")]
 
 use prelude::*;
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index 564b6a25f7faf..ffe162cbc64fc 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -14,7 +14,7 @@
 //! u32, u64, uint, i8, i16, i32, i64, int, f32, f64}`.
 
 #![experimental]
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use option::Option;
 
diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs
index af66e6ca93490..5fc3be4839c4a 100644
--- a/src/libstd/num/strconv.rs
+++ b/src/libstd/num/strconv.rs
@@ -10,7 +10,7 @@
 //
 // ignore-lexer-test FIXME #15679
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use char;
 use clone::Clone;
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index f9bc9eb539a13..c69c3ffa41c0e 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -11,7 +11,7 @@
 #![experimental]
 #![macro_escape]
 #![doc(hidden)]
-#![allow(unsigned_negate)]
+#![allow(unsigned_negation)]
 
 macro_rules! uint_module (($T:ty) => (
 
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index e758dec6bff94..488f5b846988a 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -28,7 +28,7 @@
 
 #![experimental]
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 #![allow(non_snake_case)]
 
 use clone::Clone;
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs
index 69b6dd7667616..eba9b9005ccc0 100644
--- a/src/libstd/path/posix.rs
+++ b/src/libstd/path/posix.rs
@@ -457,9 +457,9 @@ fn normalize_helper<'a>(v: &'a [u8], is_abs: bool) -> Option<Vec<&'a [u8]>> {
     }
 }
 
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static dot_static: &'static [u8] = b".";
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static dot_dot_static: &'static [u8] = b"..";
 
 #[cfg(test)]
diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs
index 91308be21edbd..c4ee6baea4647 100644
--- a/src/libstd/rand/os.rs
+++ b/src/libstd/rand/os.rs
@@ -88,7 +88,7 @@ mod imp {
     #[repr(C)]
     struct SecRandom;
 
-    #[allow(non_uppercase_statics)]
+    #[allow(non_upper_case_globals)]
     static kSecRandomDefault: *const SecRandom = 0 as *const SecRandom;
 
     #[link(name = "Security", kind = "framework")]
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index a91c6c572e686..f6ca5152e1ba5 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -52,7 +52,7 @@ Several modules in `core` are clients of `rt`:
 #![experimental]
 
 // FIXME: this should not be here.
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use failure;
 use rustrt;
diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs
index 621c08fe7bcc0..626aed4670d18 100644
--- a/src/libstd/sync/future.rs
+++ b/src/libstd/sync/future.rs
@@ -24,7 +24,7 @@
  * ```
  */
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use core::prelude::*;
 use core::mem::replace;
diff --git a/src/libsync/lib.rs b/src/libsync/lib.rs
index a33e8a57137fa..ffff32f04c488 100644
--- a/src/libsync/lib.rs
+++ b/src/libsync/lib.rs
@@ -29,7 +29,7 @@
 
 #![feature(phase, globs, macro_rules, unsafe_destructor)]
 #![feature(import_shadowing)]
-#![deny(missing_doc)]
+#![deny(missing_docs)]
 #![no_std]
 
 #[phase(plugin, link)] extern crate core;
diff --git a/src/libsync/mpmc_bounded_queue.rs b/src/libsync/mpmc_bounded_queue.rs
index b3b504f49ca3a..f75511ecbc2e4 100644
--- a/src/libsync/mpmc_bounded_queue.rs
+++ b/src/libsync/mpmc_bounded_queue.rs
@@ -26,7 +26,7 @@
  */
 
 #![experimental]
-#![allow(missing_doc, dead_code)]
+#![allow(missing_docs, dead_code)]
 
 // http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue
 
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs
index 03325ad470668..dc41f3d927957 100644
--- a/src/libsyntax/abi.rs
+++ b/src/libsyntax/abi.rs
@@ -47,9 +47,9 @@ pub enum Architecture {
     Mipsel
 }
 
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 const IntelBits: u32 = (1 << (X86 as uint)) | (1 << (X86_64 as uint));
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 const ArmBits: u32 = (1 << (Arm as uint));
 
 pub struct AbiData {
@@ -72,7 +72,7 @@ pub enum AbiArchitecture {
     Archs(u32)
 }
 
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 static AbiDatas: &'static [AbiData] = &[
     // Platform-specific ABIs
     AbiData {abi: Cdecl, name: "cdecl", abi_arch: Archs(IntelBits)},
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index d5a460dc9dba1..25a3a4ea3a21b 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -291,7 +291,7 @@ pub fn operator_prec(op: ast::BinOp) -> uint {
 
 /// Precedence of the `as` operator, which is a binary operator
 /// not appearing in the prior table.
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub static as_prec: uint = 12u;
 
 pub fn empty_generics() -> Generics {
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index fa6b0c5ad4ae7..769652bd23b20 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -384,14 +384,14 @@ macro_rules! declare_special_idents_and_keywords {(
     pub mod special_idents {
         use ast::{Ident, Name};
         $(
-            #[allow(non_uppercase_statics)]
+            #[allow(non_upper_case_globals)]
             pub const $si_static: Ident = Ident { name: Name($si_name), ctxt: 0 };
          )*
     }
 
     pub mod special_names {
         use ast::Name;
-        $( #[allow(non_uppercase_statics)] pub const $si_static: Name =  Name($si_name); )*
+        $( #[allow(non_upper_case_globals)] pub const $si_static: Name =  Name($si_name); )*
     }
 
     /**
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 69e6d78d16a57..e26848f5bb178 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -89,10 +89,10 @@ pub fn rust_printer_annotated<'a>(writer: Box<io::Writer+'static>,
     }
 }
 
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const indent_unit: uint = 4u;
 
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const default_columns: uint = 78u;
 
 /// Requires you to pass an input filename and reader so that
diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs
index fbf17b76d6201..2943ff99a915c 100644
--- a/src/libterm/lib.rs
+++ b/src/libterm/lib.rs
@@ -52,7 +52,7 @@
 #![allow(unknown_features)]
 #![feature(macro_rules, phase, slicing_syntax)]
 
-#![deny(missing_doc)]
+#![deny(missing_docs)]
 
 #[phase(plugin, link)] extern crate log;
 
diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs
index 586f420dc3e00..b893d69858cd2 100644
--- a/src/libterm/terminfo/parm.rs
+++ b/src/libterm/terminfo/parm.rs
@@ -38,7 +38,7 @@ enum FormatState {
 }
 
 /// Types of parameters a capability can use
-#[allow(missing_doc)]
+#[allow(missing_docs)]
 #[deriving(Clone)]
 pub enum Param {
     Words(String),
diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs
index 6b921144144e2..9eb7216fba0bf 100644
--- a/src/libterm/terminfo/parser/compiled.rs
+++ b/src/libterm/terminfo/parser/compiled.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 
 //! ncurses-compatible compiled terminfo format parsing (term(5))
 
diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs
index 72c61f3afc7cd..a39769d0fa421 100644
--- a/src/libtest/stats.rs
+++ b/src/libtest/stats.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(missing_doc)]
+#![allow(missing_docs)]
 
 use std::collections::hashmap;
 use std::collections::hashmap::{Occupied, Vacant};
@@ -128,7 +128,7 @@ pub trait Stats <T: FloatMath + FromPrimitive>{
 
 /// Extracted collection of all the summary statistics of a sample set.
 #[deriving(Clone, PartialEq)]
-#[allow(missing_doc)]
+#[allow(missing_docs)]
 pub struct Summary<T> {
     pub sum: T,
     pub min: T,
diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs
index 3f15abcad6dcd..5fe91a87056d4 100644
--- a/src/libunicode/tables.rs
+++ b/src/libunicode/tables.rs
@@ -10,7 +10,7 @@
 
 // NOTE: The following code was generated by "src/etc/unicode.py", do not edit directly
 
-#![allow(missing_doc, non_uppercase_statics, non_snake_case)]
+#![allow(missing_docs, non_upper_case_globals, non_snake_case)]
 
 /// The version of [Unicode](http://www.unicode.org/)
 /// that the `UnicodeChar` and `UnicodeStrSlice` traits are based on.
diff --git a/src/test/compile-fail-fulldeps/syntax-extension-regex-unused-static.rs b/src/test/compile-fail-fulldeps/syntax-extension-regex-unused-static.rs
index 1d14da73b7eeb..8f83c9ec94fbd 100644
--- a/src/test/compile-fail-fulldeps/syntax-extension-regex-unused-static.rs
+++ b/src/test/compile-fail-fulldeps/syntax-extension-regex-unused-static.rs
@@ -15,9 +15,9 @@
 extern crate regex;
 #[phase(plugin)] extern crate regex_macros;
 
-#[deny(unused_variable)]
+#[deny(unused_variables)]
 #[deny(dead_code)]
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 
 // Tests to make sure that extraneous dead code warnings aren't emitted from
 // the code generated by regex!.
diff --git a/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs b/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs
index c17f3c6da5063..b4dda05f42d2b 100644
--- a/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs
+++ b/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs
@@ -15,7 +15,7 @@
 extern crate regex;
 #[phase(plugin)] extern crate regex_macros;
 
-#[deny(unused_variable)]
+#[deny(unused_variables)]
 #[deny(dead_code)]
 
 // Tests to make sure that extraneous dead code warnings aren't emitted from
diff --git a/src/test/compile-fail/asm-misplaced-option.rs b/src/test/compile-fail/asm-misplaced-option.rs
index 74bfc6e6ffc1f..b29899e1940e2 100644
--- a/src/test/compile-fail/asm-misplaced-option.rs
+++ b/src/test/compile-fail/asm-misplaced-option.rs
@@ -12,7 +12,7 @@
 
 #![feature(asm)]
 
-#![allow(dead_code, non_uppercase_statics)]
+#![allow(dead_code, non_upper_case_globals)]
 
 #[cfg(any(target_arch = "x86",
           target_arch = "x86_64"))]
diff --git a/src/test/compile-fail/borrowck-lend-flow-match.rs b/src/test/compile-fail/borrowck-lend-flow-match.rs
index 049bec3d37bef..0b40a78425f6e 100644
--- a/src/test/compile-fail/borrowck-lend-flow-match.rs
+++ b/src/test/compile-fail/borrowck-lend-flow-match.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(unused_variable)]
-#![allow(dead_assignment)]
+#![allow(unused_variables)]
+#![allow(unused_assignments)]
 
 fn separate_arms() {
     // Here both arms perform assignments, but only is illegal.
diff --git a/src/test/compile-fail/issue-10656.rs b/src/test/compile-fail/issue-10656.rs
index 5a4ed1d3df8c5..0b335a526a4e3 100644
--- a/src/test/compile-fail/issue-10656.rs
+++ b/src/test/compile-fail/issue-10656.rs
@@ -10,5 +10,5 @@
 
 // error-pattern: missing documentation for crate
 
-#![deny(missing_doc)]
+#![deny(missing_docs)]
 #![crate_type="lib"]
diff --git a/src/test/compile-fail/issue-14309.rs b/src/test/compile-fail/issue-14309.rs
index d4a40ade72c32..9225889ef6348 100644
--- a/src/test/compile-fail/issue-14309.rs
+++ b/src/test/compile-fail/issue-14309.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![deny(ctypes)]
+#![deny(improper_ctypes)]
 #![allow(dead_code)]
 
 struct A {
diff --git a/src/test/compile-fail/issue-17999.rs b/src/test/compile-fail/issue-17999.rs
index 4d4b40ed12daf..e3ad2dd1b067b 100644
--- a/src/test/compile-fail/issue-17999.rs
+++ b/src/test/compile-fail/issue-17999.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![deny(unused_variable)]
+#![deny(unused_variables)]
 
 fn main() {
     for _ in range(1i, 101) {
diff --git a/src/test/compile-fail/issue-2150.rs b/src/test/compile-fail/issue-2150.rs
index 7457a1020cee1..6bbba3b30b861 100644
--- a/src/test/compile-fail/issue-2150.rs
+++ b/src/test/compile-fail/issue-2150.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![deny(unreachable_code)]
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![allow(dead_code)]
 
 fn fail_len(v: Vec<int> ) -> uint {
diff --git a/src/test/compile-fail/lint-ctypes-enum.rs b/src/test/compile-fail/lint-ctypes-enum.rs
index d45a3b027a794..dea933085de4e 100644
--- a/src/test/compile-fail/lint-ctypes-enum.rs
+++ b/src/test/compile-fail/lint-ctypes-enum.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![deny(ctypes)]
+#![deny(improper_ctypes)]
 #![allow(dead_code)]
 
 enum Z { }
diff --git a/src/test/compile-fail/lint-ctypes.rs b/src/test/compile-fail/lint-ctypes.rs
index 9e609814c8b3c..1755a9a2481b4 100644
--- a/src/test/compile-fail/lint-ctypes.rs
+++ b/src/test/compile-fail/lint-ctypes.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![deny(ctypes)]
+#![deny(improper_ctypes)]
 
 extern crate libc;
 
diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs
index 96d40c52657fe..1283c61e41a00 100644
--- a/src/test/compile-fail/lint-dead-code-1.rs
+++ b/src/test/compile-fail/lint-dead-code-1.rs
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 #![no_std]
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![allow(non_camel_case_types)]
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 #![deny(dead_code)]
 
 #![crate_type="lib"]
diff --git a/src/test/compile-fail/lint-dead-code-2.rs b/src/test/compile-fail/lint-dead-code-2.rs
index eb284c4d05426..c7199eec8a3e8 100644
--- a/src/test/compile-fail/lint-dead-code-2.rs
+++ b/src/test/compile-fail/lint-dead-code-2.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![deny(dead_code)]
 
 struct Foo;
diff --git a/src/test/compile-fail/lint-dead-code-3.rs b/src/test/compile-fail/lint-dead-code-3.rs
index f73c19b5fc987..4ef76030bcc54 100644
--- a/src/test/compile-fail/lint-dead-code-3.rs
+++ b/src/test/compile-fail/lint-dead-code-3.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![allow(non_camel_case_types)]
 #![deny(dead_code)]
 
diff --git a/src/test/compile-fail/lint-dead-code-4.rs b/src/test/compile-fail/lint-dead-code-4.rs
index ac8b9c3821ef5..a698bf61f5894 100644
--- a/src/test/compile-fail/lint-dead-code-4.rs
+++ b/src/test/compile-fail/lint-dead-code-4.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![feature(struct_variant)]
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![allow(non_camel_case_types)]
 #![deny(dead_code)]
 
diff --git a/src/test/compile-fail/lint-dead-code-5.rs b/src/test/compile-fail/lint-dead-code-5.rs
index 62afa089bbe23..1f0d91dcb3cd9 100644
--- a/src/test/compile-fail/lint-dead-code-5.rs
+++ b/src/test/compile-fail/lint-dead-code-5.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![feature(struct_variant)]
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![deny(dead_code)]
 
 enum Enum1 {
diff --git a/src/test/compile-fail/lint-directives-on-use-items-issue-10534.rs b/src/test/compile-fail/lint-directives-on-use-items-issue-10534.rs
index bbd88f1f0aade..efb284495648a 100644
--- a/src/test/compile-fail/lint-directives-on-use-items-issue-10534.rs
+++ b/src/test/compile-fail/lint-directives-on-use-items-issue-10534.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![deny(unused_imports)]
-#![allow(non_uppercase_statics)]
+#![allow(non_upper_case_globals)]
 
 // The aim of this test is to ensure that deny/allow/warn directives
 // are applied to individual "use" statements instead of silently
diff --git a/src/test/compile-fail/lint-misplaced-attr.rs b/src/test/compile-fail/lint-misplaced-attr.rs
index dea712e976b35..18ea5a383f6b4 100644
--- a/src/test/compile-fail/lint-misplaced-attr.rs
+++ b/src/test/compile-fail/lint-misplaced-attr.rs
@@ -11,7 +11,7 @@
 // When denying at the crate level, be sure to not get random warnings from the
 // injected intrinsics by the compiler.
 
-#![deny(unused_attribute)]
+#![deny(unused_attributes)]
 
 mod a {
     #![crate_type = "bin"] //~ ERROR unused attribute
diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs
index a63a3a61f68a0..f0b6abe28d37a 100644
--- a/src/test/compile-fail/lint-missing-doc.rs
+++ b/src/test/compile-fail/lint-missing-doc.rs
@@ -12,7 +12,7 @@
 // injected intrinsics by the compiler.
 #![feature(struct_variant)]
 #![feature(globs)]
-#![deny(missing_doc)]
+#![deny(missing_docs)]
 #![allow(dead_code)]
 
 //! Some garbage docs for the crate here
@@ -28,7 +28,7 @@ pub struct PubFoo { //~ ERROR: missing documentation
     b: int,
 }
 
-#[allow(missing_doc)]
+#[allow(missing_docs)]
 pub struct PubFoo2 {
     pub a: int,
     pub c: int,
@@ -41,7 +41,7 @@ pub mod pub_module_no_dox {} //~ ERROR: missing documentation
 pub fn foo() {}
 pub fn foo2() {} //~ ERROR: missing documentation
 fn foo3() {}
-#[allow(missing_doc)] pub fn foo4() {}
+#[allow(missing_docs)] pub fn foo4() {}
 
 /// dox
 pub trait A {
@@ -50,7 +50,7 @@ pub trait A {
     /// dox
     fn foo_with_impl() {}
 }
-#[allow(missing_doc)]
+#[allow(missing_docs)]
 trait B {
     fn foo();
     fn foo_with_impl() {}
@@ -59,7 +59,7 @@ pub trait C { //~ ERROR: missing documentation
     fn foo(); //~ ERROR: missing documentation
     fn foo_with_impl() {} //~ ERROR: missing documentation
 }
-#[allow(missing_doc)] pub trait D {}
+#[allow(missing_docs)] pub trait D {}
 
 impl Foo {
     pub fn foo() {}
@@ -71,10 +71,10 @@ impl PubFoo {
     /// dox
     pub fn foo1() {}
     fn foo2() {}
-    #[allow(missing_doc)] pub fn foo3() {}
+    #[allow(missing_docs)] pub fn foo3() {}
 }
 
-#[allow(missing_doc)]
+#[allow(missing_docs)]
 trait F {
     fn a();
     fn b(&self);
@@ -86,7 +86,7 @@ impl F for Foo {
     fn b(&self) {}
 }
 
-// It sure is nice if doc(hidden) implies allow(missing_doc), and that it
+// It sure is nice if doc(hidden) implies allow(missing_docs), and that it
 // applies recursively
 #[doc(hidden)]
 mod a {
@@ -121,7 +121,7 @@ pub enum PubBaz2 {
     },
 }
 
-#[allow(missing_doc)]
+#[allow(missing_docs)]
 pub enum PubBaz3 {
     PubBaz3A {
         pub a: int,
diff --git a/src/test/compile-fail/lint-non-uppercase-statics.rs b/src/test/compile-fail/lint-non-uppercase-statics.rs
index 2d9f2d8fc1c2a..7ff5cafd097a2 100644
--- a/src/test/compile-fail/lint-non-uppercase-statics.rs
+++ b/src/test/compile-fail/lint-non-uppercase-statics.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![forbid(non_uppercase_statics)]
+#![forbid(non_upper_case_globals)]
 #![allow(dead_code)]
 
 static foo: int = 1; //~ ERROR static constant `foo` should have an uppercase name such as `FOO`
diff --git a/src/test/compile-fail/lint-obsolete-attr.rs b/src/test/compile-fail/lint-obsolete-attr.rs
index 6b46a0c19bddd..e4fd042d09845 100644
--- a/src/test/compile-fail/lint-obsolete-attr.rs
+++ b/src/test/compile-fail/lint-obsolete-attr.rs
@@ -11,7 +11,7 @@
 // When denying at the crate level, be sure to not get random warnings from the
 // injected intrinsics by the compiler.
 
-#![deny(unused_attribute)]
+#![deny(unused_attributes)]
 #![allow(dead_code)]
 
 #[abi="stdcall"] extern {} //~ ERROR unused attribute
diff --git a/src/test/compile-fail/lint-owned-heap-memory.rs b/src/test/compile-fail/lint-owned-heap-memory.rs
index 8f20999a56c8d..5ee16f0aa26e5 100644
--- a/src/test/compile-fail/lint-owned-heap-memory.rs
+++ b/src/test/compile-fail/lint-owned-heap-memory.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![allow(dead_code)]
-#![forbid(owned_heap_memory)]
+#![forbid(box_pointers)]
 
 
 struct Foo {
diff --git a/src/test/compile-fail/lint-qualification.rs b/src/test/compile-fail/lint-qualification.rs
index 7006a2837508d..18a5a8ecc5d52 100644
--- a/src/test/compile-fail/lint-qualification.rs
+++ b/src/test/compile-fail/lint-qualification.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![deny(unnecessary_qualification)]
+#![deny(unused_qualifications)]
 
 mod foo {
     pub fn bar() {}
diff --git a/src/test/compile-fail/lint-type-overflow.rs b/src/test/compile-fail/lint-type-overflow.rs
index 81b186a2998a8..47dc93dae13e9 100644
--- a/src/test/compile-fail/lint-type-overflow.rs
+++ b/src/test/compile-fail/lint-type-overflow.rs
@@ -9,13 +9,13 @@
 // except according to those terms.
 //
 
-#![deny(type_overflow)]
+#![deny(overflowing_literals)]
 
 fn test(x: i8) {
     println!("x {}", x);
 }
 
-#[allow(unused_variable)]
+#[allow(unused_variables)]
 fn main() {
     let x1: u8 = 255; // should be OK
     let x1: u8 = 256; //~ error: literal out of range for its type
diff --git a/src/test/compile-fail/lint-unknown-attr.rs b/src/test/compile-fail/lint-unknown-attr.rs
index 020ed80c0fbba..e4cb92477c299 100644
--- a/src/test/compile-fail/lint-unknown-attr.rs
+++ b/src/test/compile-fail/lint-unknown-attr.rs
@@ -11,7 +11,7 @@
 // When denying at the crate level, be sure to not get random warnings from the
 // injected intrinsics by the compiler.
 
-#![deny(unused_attribute)]
+#![deny(unused_attributes)]
 
 #![mutable_doc] //~ ERROR unused attribute
 
diff --git a/src/test/compile-fail/lint-unnecessary-casts.rs b/src/test/compile-fail/lint-unnecessary-casts.rs
index 644c5d9fb3d57..b3cf8257b8f6e 100644
--- a/src/test/compile-fail/lint-unnecessary-casts.rs
+++ b/src/test/compile-fail/lint-unnecessary-casts.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![forbid(unnecessary_typecast)]
+#![forbid(unused_typecasts)]
 
 fn foo_i32(_: i32) {}
 
diff --git a/src/test/compile-fail/lint-unnecessary-import-braces.rs b/src/test/compile-fail/lint-unnecessary-import-braces.rs
index c44918d9879d8..1c0401ec56b85 100644
--- a/src/test/compile-fail/lint-unnecessary-import-braces.rs
+++ b/src/test/compile-fail/lint-unnecessary-import-braces.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![deny(unnecessary_import_braces)]
+#![deny(unused_import_braces)]
 #![allow(dead_code)]
 #![allow(unused_imports)]
 
diff --git a/src/test/compile-fail/lint-unnecessary-parens.rs b/src/test/compile-fail/lint-unnecessary-parens.rs
index 6c766dec9a3e9..826a4ea5a8080 100644
--- a/src/test/compile-fail/lint-unnecessary-parens.rs
+++ b/src/test/compile-fail/lint-unnecessary-parens.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![deny(unnecessary_parens)]
+#![deny(unused_parens)]
 #![feature(if_let,while_let)]
 
 #[deriving(Eq, PartialEq)]
diff --git a/src/test/compile-fail/lint-unsafe-block.rs b/src/test/compile-fail/lint-unsafe-block.rs
index a4c50781a774b..8899d06804f1e 100644
--- a/src/test/compile-fail/lint-unsafe-block.rs
+++ b/src/test/compile-fail/lint-unsafe-block.rs
@@ -10,12 +10,12 @@
 
 #![allow(unused_unsafe)]
 #![allow(dead_code)]
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
 #![feature(macro_rules)]
 
 unsafe fn allowed() {}
 
-#[allow(unsafe_block)] fn also_allowed() { unsafe {} }
+#[allow(unsafe_blocks)] fn also_allowed() { unsafe {} }
 
 macro_rules! unsafe_in_macro {
     () => {
diff --git a/src/test/compile-fail/lint-unused-extern-crate.rs b/src/test/compile-fail/lint-unused-extern-crate.rs
index a4dfdbdaeae01..a63e8e913f4c4 100644
--- a/src/test/compile-fail/lint-unused-extern-crate.rs
+++ b/src/test/compile-fail/lint-unused-extern-crate.rs
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 #![feature(globs)]
-#![deny(unused_extern_crate)]
-#![allow(unused_variable)]
+#![deny(unused_extern_crates)]
+#![allow(unused_variables)]
 
 extern crate libc; //~ ERROR: unused extern crate
 
diff --git a/src/test/compile-fail/lint-unused-mut-self.rs b/src/test/compile-fail/lint-unused-mut-self.rs
index fc19a1ba06f9b..370f664e43033 100644
--- a/src/test/compile-fail/lint-unused-mut-self.rs
+++ b/src/test/compile-fail/lint-unused-mut-self.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(dead_assignment)]
-#![allow(unused_variable)]
+#![allow(unused_assignments)]
+#![allow(unused_variables)]
 #![allow(dead_code)]
 #![deny(unused_mut)]
 
diff --git a/src/test/compile-fail/lint-unused-mut-variables.rs b/src/test/compile-fail/lint-unused-mut-variables.rs
index c5281bf678185..29b4686198be1 100644
--- a/src/test/compile-fail/lint-unused-mut-variables.rs
+++ b/src/test/compile-fail/lint-unused-mut-variables.rs
@@ -10,8 +10,8 @@
 
 // Exercise the unused_mut attribute in some positive and negative cases
 
-#![allow(dead_assignment)]
-#![allow(unused_variable)]
+#![allow(unused_assignments)]
+#![allow(unused_variables)]
 #![allow(dead_code)]
 #![deny(unused_mut)]
 
diff --git a/src/test/compile-fail/liveness-dead.rs b/src/test/compile-fail/liveness-dead.rs
index cba0a1da7e657..18baf7a9c3f75 100644
--- a/src/test/compile-fail/liveness-dead.rs
+++ b/src/test/compile-fail/liveness-dead.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![allow(dead_code)]
-#![deny(dead_assignment)]
+#![deny(unused_assignments)]
 
 fn f1(x: &mut int) {
     *x = 1; // no error
diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs
index 41a30e23b2221..a747615199e6f 100644
--- a/src/test/compile-fail/liveness-unused.rs
+++ b/src/test/compile-fail/liveness-unused.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![deny(unused_variable)]
-#![deny(dead_assignment)]
+#![deny(unused_variables)]
+#![deny(unused_assignments)]
 #![allow(dead_code, non_camel_case_types)]
 
 fn f1(x: int) {
@@ -20,7 +20,7 @@ fn f1b(x: &mut int) {
     //~^ ERROR unused variable: `x`
 }
 
-#[allow(unused_variable)]
+#[allow(unused_variables)]
 fn f1c(x: int) {}
 
 fn f1d() {
@@ -48,14 +48,14 @@ fn f3b() {
     }
 }
 
-#[allow(unused_variable)]
+#[allow(unused_variables)]
 fn f3c() {
     let mut z = 3i;
     loop { z += 4i; }
 }
 
-#[allow(unused_variable)]
-#[allow(dead_assignment)]
+#[allow(unused_variables)]
+#[allow(unused_assignments)]
 fn f3d() {
     let mut x = 3i;
     x += 4i;
diff --git a/src/test/compile-fail/match-static-const-lc.rs b/src/test/compile-fail/match-static-const-lc.rs
index af7938948a70f..15a832aad89ad 100644
--- a/src/test/compile-fail/match-static-const-lc.rs
+++ b/src/test/compile-fail/match-static-const-lc.rs
@@ -11,9 +11,9 @@
 // Issue #7526: lowercase static constants in patterns look like bindings
 
 #![allow(dead_code)]
-#![deny(non_uppercase_statics)]
+#![deny(non_upper_case_globals)]
 
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const a : int = 97;
 
 fn f() {
@@ -26,7 +26,7 @@ fn f() {
 }
 
 mod m {
-    #[allow(non_uppercase_statics)]
+    #[allow(non_upper_case_globals)]
     pub const aha : int = 7;
 }
 
diff --git a/src/test/compile-fail/regions-fn-subtyping-return-static.rs b/src/test/compile-fail/regions-fn-subtyping-return-static.rs
index 2d20634cdc41d..714abc23c61cb 100644
--- a/src/test/compile-fail/regions-fn-subtyping-return-static.rs
+++ b/src/test/compile-fail/regions-fn-subtyping-return-static.rs
@@ -17,7 +17,7 @@
 // lifetimes are sublifetimes of 'static.
 
 #![allow(dead_code)]
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct S;
 
diff --git a/src/test/compile-fail/unreachable-code.rs b/src/test/compile-fail/unreachable-code.rs
index fb9a6b5201897..87342352e9ae4 100644
--- a/src/test/compile-fail/unreachable-code.rs
+++ b/src/test/compile-fail/unreachable-code.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![deny(unreachable_code)]
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn main() {
   loop{}
diff --git a/src/test/compile-fail/unused-attr.rs b/src/test/compile-fail/unused-attr.rs
index 0a5a9db8fa8e9..e797c7eec5f5f 100644
--- a/src/test/compile-fail/unused-attr.rs
+++ b/src/test/compile-fail/unused-attr.rs
@@ -7,7 +7,7 @@
 // <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.
-#![deny(unused_attribute)]
+#![deny(unused_attributes)]
 #![allow(dead_code, unused_imports)]
 
 #![foo] //~ ERROR unused attribute
diff --git a/src/test/compile-fail/unused-result.rs b/src/test/compile-fail/unused-result.rs
index ecc52c0ee7d58..b5d253c59232c 100644
--- a/src/test/compile-fail/unused-result.rs
+++ b/src/test/compile-fail/unused-result.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![deny(unused_result, unused_must_use)]
+#![deny(unused_results, unused_must_use)]
 #![allow(dead_code)]
 
 #[must_use]
@@ -23,14 +23,14 @@ fn bar() -> int { return foo::<int>(); }
 fn baz() -> MustUse { return foo::<MustUse>(); }
 fn qux() -> MustUseMsg { return foo::<MustUseMsg>(); }
 
-#[allow(unused_result)]
+#[allow(unused_results)]
 fn test() {
     foo::<int>();
     foo::<MustUse>(); //~ ERROR: unused result which must be used
     foo::<MustUseMsg>(); //~ ERROR: unused result which must be used: some message
 }
 
-#[allow(unused_result, unused_must_use)]
+#[allow(unused_results, unused_must_use)]
 fn test2() {
     foo::<int>();
     foo::<MustUse>();
diff --git a/src/test/compile-fail/warn-foreign-int-types.rs b/src/test/compile-fail/warn-foreign-int-types.rs
index cfa6623176ca3..5f7a2f69c4f91 100644
--- a/src/test/compile-fail/warn-foreign-int-types.rs
+++ b/src/test/compile-fail/warn-foreign-int-types.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![forbid(ctypes)]
+#![forbid(improper_ctypes)]
 #![allow(dead_code)]
 
 mod xx {
diff --git a/src/test/debuginfo/basic-types-globals-metadata.rs b/src/test/debuginfo/basic-types-globals-metadata.rs
index 66631f7efba5c..b2f82493fa78d 100644
--- a/src/test/debuginfo/basic-types-globals-metadata.rs
+++ b/src/test/debuginfo/basic-types-globals-metadata.rs
@@ -46,7 +46,7 @@
 // gdb-check:type = f64
 // gdb-command:continue
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![allow(dead_code)]
 
 
diff --git a/src/test/debuginfo/basic-types-globals.rs b/src/test/debuginfo/basic-types-globals.rs
index 9755c8711ae6c..d08feadefdac0 100644
--- a/src/test/debuginfo/basic-types-globals.rs
+++ b/src/test/debuginfo/basic-types-globals.rs
@@ -52,7 +52,7 @@
 // gdb-check:$14 = 3.5
 // gdb-command:continue
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 static B: bool = false;
 static I: int = -1;
diff --git a/src/test/debuginfo/basic-types-metadata.rs b/src/test/debuginfo/basic-types-metadata.rs
index d67a6b1e20049..35d70dd2f1070 100644
--- a/src/test/debuginfo/basic-types-metadata.rs
+++ b/src/test/debuginfo/basic-types-metadata.rs
@@ -49,7 +49,7 @@
 // gdb-check:[...]![...]_yyy([...])([...]);
 // gdb-command:continue
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn main() {
     let unit: () = ();
diff --git a/src/test/debuginfo/basic-types-mut-globals.rs b/src/test/debuginfo/basic-types-mut-globals.rs
index 9fb3644d75d83..241bfcd7510c8 100644
--- a/src/test/debuginfo/basic-types-mut-globals.rs
+++ b/src/test/debuginfo/basic-types-mut-globals.rs
@@ -87,7 +87,7 @@
 // gdb-command:detach
 // gdb-command:quit
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 static mut B: bool = false;
 static mut I: int = -1;
diff --git a/src/test/debuginfo/basic-types.rs b/src/test/debuginfo/basic-types.rs
index b9e9b03c41b32..525d71b560fc4 100644
--- a/src/test/debuginfo/basic-types.rs
+++ b/src/test/debuginfo/basic-types.rs
@@ -89,7 +89,7 @@
 // lldb-command:print f64
 // lldb-check:[...]$12 = 3.5
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn main() {
     let b: bool = false;
diff --git a/src/test/debuginfo/borrowed-basic.rs b/src/test/debuginfo/borrowed-basic.rs
index aad9e40e040e9..eac3652f163c0 100644
--- a/src/test/debuginfo/borrowed-basic.rs
+++ b/src/test/debuginfo/borrowed-basic.rs
@@ -110,7 +110,7 @@
 // lldb-command:print *f64_ref
 // lldb-check:[...]$12 = 3.5
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn main() {
     let bool_val: bool = true;
diff --git a/src/test/debuginfo/borrowed-c-style-enum.rs b/src/test/debuginfo/borrowed-c-style-enum.rs
index e7a90780f5704..b2431d7221fe8 100644
--- a/src/test/debuginfo/borrowed-c-style-enum.rs
+++ b/src/test/debuginfo/borrowed-c-style-enum.rs
@@ -42,7 +42,7 @@
 // lldb-command:print *the_c_ref
 // lldb-check:[...]$2 = TheC
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 enum ABC { TheA, TheB, TheC }
 
diff --git a/src/test/debuginfo/borrowed-enum.rs b/src/test/debuginfo/borrowed-enum.rs
index fa3fff9fdbcfa..8b72f2538c556 100644
--- a/src/test/debuginfo/borrowed-enum.rs
+++ b/src/test/debuginfo/borrowed-enum.rs
@@ -41,7 +41,7 @@
 // lldb-command:print *univariant_ref
 // lldb-check:[...]$2 = TheOnlyCase(4820353753753434)
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![feature(struct_variant)]
 
 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
diff --git a/src/test/debuginfo/borrowed-struct.rs b/src/test/debuginfo/borrowed-struct.rs
index a784fef2cb920..a9c5a59488f18 100644
--- a/src/test/debuginfo/borrowed-struct.rs
+++ b/src/test/debuginfo/borrowed-struct.rs
@@ -65,7 +65,7 @@
 // lldb-command:print *unique_val_interior_ref_2
 // lldb-check:[...]$6 = 26.5
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct SomeStruct {
     x: int,
diff --git a/src/test/debuginfo/borrowed-tuple.rs b/src/test/debuginfo/borrowed-tuple.rs
index a41a24b53b591..f5afa008d2e80 100644
--- a/src/test/debuginfo/borrowed-tuple.rs
+++ b/src/test/debuginfo/borrowed-tuple.rs
@@ -43,7 +43,7 @@
 // lldb-check:[...]$2 = (-17, -22)
 
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn main() {
     let stack_val: (i16, f32) = (-14, -19f32);
diff --git a/src/test/debuginfo/borrowed-unique-basic.rs b/src/test/debuginfo/borrowed-unique-basic.rs
index 9fcb49927f662..2592b16625663 100644
--- a/src/test/debuginfo/borrowed-unique-basic.rs
+++ b/src/test/debuginfo/borrowed-unique-basic.rs
@@ -112,7 +112,7 @@
 // lldb-command:print *f64_ref
 // lldb-check:[...]$12 = 3.5
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 
 fn main() {
diff --git a/src/test/debuginfo/box.rs b/src/test/debuginfo/box.rs
index 6acd94743c2a9..8075d9ab69d9f 100644
--- a/src/test/debuginfo/box.rs
+++ b/src/test/debuginfo/box.rs
@@ -33,7 +33,7 @@
 // lldb-command:print *b
 // lldb-check:[...]$1 = (2, 3.5)
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn main() {
     let a = box 1i;
diff --git a/src/test/debuginfo/boxed-struct.rs b/src/test/debuginfo/boxed-struct.rs
index 348e03c04a625..87eea49dd0c4b 100644
--- a/src/test/debuginfo/boxed-struct.rs
+++ b/src/test/debuginfo/boxed-struct.rs
@@ -36,7 +36,7 @@
 // lldb-command:print *unique_dtor
 // lldb-check:[...]$1 = StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 }
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct StructWithSomePadding {
     x: i16,
diff --git a/src/test/debuginfo/c-style-enum-in-composite.rs b/src/test/debuginfo/c-style-enum-in-composite.rs
index cea1840e3a385..ec385840d1df7 100644
--- a/src/test/debuginfo/c-style-enum-in-composite.rs
+++ b/src/test/debuginfo/c-style-enum-in-composite.rs
@@ -66,7 +66,7 @@
 // lldb-command:print struct_with_drop
 // lldb-check:[...]$6 = (StructWithDrop { a: OneHundred, b: Vienna }, 9)
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 enum AnEnum {
     OneHundred = 100,
diff --git a/src/test/debuginfo/c-style-enum.rs b/src/test/debuginfo/c-style-enum.rs
index 5f4521b6504f7..9f80f6475e252 100644
--- a/src/test/debuginfo/c-style-enum.rs
+++ b/src/test/debuginfo/c-style-enum.rs
@@ -101,7 +101,7 @@
 // lldb-command:print single_variant
 // lldb-check:[...]$6 = TheOnlyVariant
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![allow(dead_code)]
 
 enum AutoDiscriminant {
diff --git a/src/test/debuginfo/destructured-fn-argument.rs b/src/test/debuginfo/destructured-fn-argument.rs
index 81ff0bb6d4fc3..993a1a55012df 100644
--- a/src/test/debuginfo/destructured-fn-argument.rs
+++ b/src/test/debuginfo/destructured-fn-argument.rs
@@ -333,7 +333,7 @@
 // lldb-check:[...]$48 = 62
 // lldb-command:continue
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 
 struct Struct {
diff --git a/src/test/debuginfo/destructured-local.rs b/src/test/debuginfo/destructured-local.rs
index 0bce797a36f9f..a16298349ed85 100644
--- a/src/test/debuginfo/destructured-local.rs
+++ b/src/test/debuginfo/destructured-local.rs
@@ -245,7 +245,7 @@
 // lldb-check:[...]$42 = 56
 
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct Struct {
     a: i64,
diff --git a/src/test/debuginfo/evec-in-struct.rs b/src/test/debuginfo/evec-in-struct.rs
index 48d4dd26b003e..66407d68aa6b4 100644
--- a/src/test/debuginfo/evec-in-struct.rs
+++ b/src/test/debuginfo/evec-in-struct.rs
@@ -53,7 +53,7 @@
 // lldb-command:print struct_padded_at_end
 // lldb-check:[...]$4 = StructPaddedAtEnd { x: [22, 23], y: [24, 25] }
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct NoPadding1 {
     x: [u32, ..3],
diff --git a/src/test/debuginfo/function-arg-initialization.rs b/src/test/debuginfo/function-arg-initialization.rs
index 602cca979f241..ea9802afe9446 100644
--- a/src/test/debuginfo/function-arg-initialization.rs
+++ b/src/test/debuginfo/function-arg-initialization.rs
@@ -236,7 +236,7 @@
 
 
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 
 
diff --git a/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs b/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs
index 1814eca0f7d64..359d14d2a5009 100644
--- a/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs
+++ b/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs
@@ -245,7 +245,7 @@
 // lldb-check:[...]$31 = 45
 // lldb-command:continue
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 #[no_stack_check]
 fn immediate_args(a: int, b: bool, c: f64) {
diff --git a/src/test/debuginfo/function-prologue-stepping-regular.rs b/src/test/debuginfo/function-prologue-stepping-regular.rs
index 060ba4a4932cd..dbeb87fd44afe 100644
--- a/src/test/debuginfo/function-prologue-stepping-regular.rs
+++ b/src/test/debuginfo/function-prologue-stepping-regular.rs
@@ -125,7 +125,7 @@
 // lldb-check:[...]$31 = 45
 // lldb-command:continue
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn immediate_args(a: int, b: bool, c: f64) {
     ()
diff --git a/src/test/debuginfo/include_string.rs b/src/test/debuginfo/include_string.rs
index 179bbf7dfe413..378b27b359743 100644
--- a/src/test/debuginfo/include_string.rs
+++ b/src/test/debuginfo/include_string.rs
@@ -37,7 +37,7 @@
 
 // lldb-command:continue
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 // This test case makes sure that debug info does not ICE when include_str is
 // used multiple times (see issue #11322).
diff --git a/src/test/debuginfo/lexical-scopes-in-block-expression.rs b/src/test/debuginfo/lexical-scopes-in-block-expression.rs
index 99032ca078cfa..191b1d2a09cbd 100644
--- a/src/test/debuginfo/lexical-scopes-in-block-expression.rs
+++ b/src/test/debuginfo/lexical-scopes-in-block-expression.rs
@@ -373,8 +373,8 @@
 // lldb-check:[...]$47 = 10
 // lldb-command:continue
 
-#![allow(unused_variable)]
-#![allow(dead_assignment)]
+#![allow(unused_variables)]
+#![allow(unused_assignments)]
 
 static mut MUT_INT: int = 0;
 
diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs
index 6c71971a0f824..292e42ba30bbb 100644
--- a/src/test/debuginfo/limited-debuginfo.rs
+++ b/src/test/debuginfo/limited-debuginfo.rs
@@ -31,7 +31,7 @@
 // gdb-command:continue
 
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct Struct {
     a: i64,
diff --git a/src/test/debuginfo/multiple-functions-equal-var-names.rs b/src/test/debuginfo/multiple-functions-equal-var-names.rs
index 3490b12d15a3c..6bb2313100f8a 100644
--- a/src/test/debuginfo/multiple-functions-equal-var-names.rs
+++ b/src/test/debuginfo/multiple-functions-equal-var-names.rs
@@ -48,7 +48,7 @@
 // lldb-command:print abc
 // lldb-check:[...]$2 = 30303
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn function_one() {
     let abc = 10101i;
diff --git a/src/test/debuginfo/multiple-functions.rs b/src/test/debuginfo/multiple-functions.rs
index 06a2d2e5d1183..58fe9d250c97d 100644
--- a/src/test/debuginfo/multiple-functions.rs
+++ b/src/test/debuginfo/multiple-functions.rs
@@ -48,7 +48,7 @@
 // lldb-command:print c
 // lldb-check:[...]$2 = 30303
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn function_one() {
     let a = 10101i;
diff --git a/src/test/debuginfo/nil-enum.rs b/src/test/debuginfo/nil-enum.rs
index 511786999abf3..a0c726157536a 100644
--- a/src/test/debuginfo/nil-enum.rs
+++ b/src/test/debuginfo/nil-enum.rs
@@ -24,7 +24,7 @@
 // gdb-command:print second
 // gdb-check:$2 = {<No data fields>}
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 enum ANilEnum {}
 enum AnotherNilEnum {}
diff --git a/src/test/debuginfo/no-debug-attribute.rs b/src/test/debuginfo/no-debug-attribute.rs
index e61ded4ee2659..a739c9ee5fae3 100644
--- a/src/test/debuginfo/no-debug-attribute.rs
+++ b/src/test/debuginfo/no-debug-attribute.rs
@@ -25,7 +25,7 @@
 // gdb-check:abc = 10
 // gdb-command:continue
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn function_with_debuginfo() {
     let abc = 10u;
diff --git a/src/test/debuginfo/packed-struct-with-destructor.rs b/src/test/debuginfo/packed-struct-with-destructor.rs
index 9af6130e5a9e3..438a771b7be9d 100644
--- a/src/test/debuginfo/packed-struct-with-destructor.rs
+++ b/src/test/debuginfo/packed-struct-with-destructor.rs
@@ -76,7 +76,7 @@
 // lldb-check:[...]$7 = DeeplyNested { a: PackedInPacked { a: 1, b: Packed { x: 2, y: 3, z: 4 }, c: 5, d: Packed { x: 6, y: 7, z: 8 } }, b: UnpackedInPackedWithDrop { a: 9, b: Unpacked { x: 10, y: 11, z: 12 }, c: Unpacked { x: 13, y: 14, z: 15 }, d: 16 }, c: PackedInUnpacked { a: 17, b: Packed { x: 18, y: 19, z: 20 }, c: 21, d: Packed { x: 22, y: 23, z: 24 } }, d: PackedInUnpackedWithDrop { a: 25, b: Packed { x: 26, y: 27, z: 28 }, c: 29, d: Packed { x: 30, y: 31, z: 32 } }, e: UnpackedInPacked { a: 33, b: Unpacked { x: 34, y: 35, z: 36 }, c: Unpacked { x: 37, y: 38, z: 39 }, d: 40 }, f: PackedInPackedWithDrop { a: 41, b: Packed { x: 42, y: 43, z: 44 }, c: 45, d: Packed { x: 46, y: 47, z: 48 } } }
 
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 #[repr(packed)]
 struct Packed {
diff --git a/src/test/debuginfo/packed-struct.rs b/src/test/debuginfo/packed-struct.rs
index 3e29efd7f8d90..906a1f4685b5e 100644
--- a/src/test/debuginfo/packed-struct.rs
+++ b/src/test/debuginfo/packed-struct.rs
@@ -62,7 +62,7 @@
 // lldb-command:print sizeof(packedInPacked)
 // lldb-check:[...]$5 = 40
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 #[repr(packed)]
 struct Packed {
diff --git a/src/test/debuginfo/recursive-enum.rs b/src/test/debuginfo/recursive-enum.rs
index 4eb251c60841a..6d26e2eff7a46 100644
--- a/src/test/debuginfo/recursive-enum.rs
+++ b/src/test/debuginfo/recursive-enum.rs
@@ -18,7 +18,7 @@
 // Test whether compiling a recursive enum definition crashes debug info generation. The test case
 // is taken from issue #11083.
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 pub struct Window<'a> {
     callbacks: WindowCallbacks<'a>
diff --git a/src/test/debuginfo/recursive-struct.rs b/src/test/debuginfo/recursive-struct.rs
index 40c056f5cd299..1e64dc3a03145 100644
--- a/src/test/debuginfo/recursive-struct.rs
+++ b/src/test/debuginfo/recursive-struct.rs
@@ -72,7 +72,7 @@
 
 // gdb-command:continue
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![feature(struct_variant)]
 
 enum Opt<T> {
diff --git a/src/test/debuginfo/simd.rs b/src/test/debuginfo/simd.rs
index e355327a5efa1..d8854eb908453 100644
--- a/src/test/debuginfo/simd.rs
+++ b/src/test/debuginfo/simd.rs
@@ -44,7 +44,7 @@
 // gdb-command:continue
 
 #![allow(experimental)]
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 use std::simd::{i8x16, i16x8,i32x4,i64x2,u8x16,u16x8,u32x4,u64x2,f32x4,f64x2};
 
diff --git a/src/test/debuginfo/simple-struct.rs b/src/test/debuginfo/simple-struct.rs
index 66e03f81aa627..83f77b08b6830 100644
--- a/src/test/debuginfo/simple-struct.rs
+++ b/src/test/debuginfo/simple-struct.rs
@@ -99,7 +99,7 @@
 // lldb-command:print padding_at_end
 // lldb-check:[...]$5 = PaddingAtEnd { x: -10014, y: 10015 }
 
-#![allow(unused_variable)];
+#![allow(unused_variables)];
 #![allow(dead_code)];
 
 struct NoPadding16 {
diff --git a/src/test/debuginfo/simple-tuple.rs b/src/test/debuginfo/simple-tuple.rs
index b0cdf5991e898..26239f7f62b0b 100644
--- a/src/test/debuginfo/simple-tuple.rs
+++ b/src/test/debuginfo/simple-tuple.rs
@@ -95,7 +95,7 @@
 // lldb-command:print paddingAtEnd
 // lldb-check:[...]$6 = (15, 16)
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![allow(dead_code)]
 
 static mut NO_PADDING_8: (i8, u8) = (-50, 50);
diff --git a/src/test/debuginfo/struct-in-enum.rs b/src/test/debuginfo/struct-in-enum.rs
index 52b44457dc01e..5e2ae478d7db5 100644
--- a/src/test/debuginfo/struct-in-enum.rs
+++ b/src/test/debuginfo/struct-in-enum.rs
@@ -43,7 +43,7 @@
 // lldb-command:print univariant
 // lldb-check:[...]$2 = TheOnlyCase(Struct { x: 123, y: 456, z: 789 })
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct Struct {
     x: u32,
diff --git a/src/test/debuginfo/struct-in-struct.rs b/src/test/debuginfo/struct-in-struct.rs
index eafeaeb529741..1e0b84f1ef1af 100644
--- a/src/test/debuginfo/struct-in-struct.rs
+++ b/src/test/debuginfo/struct-in-struct.rs
@@ -59,7 +59,7 @@
 // lldb-command:print tree
 // lldb-check:[...]$7 = Tree { x: Simple { x: 25 }, y: InternalPaddingParent { x: InternalPadding { x: 26, y: 27 }, y: InternalPadding { x: 28, y: 29 }, z: InternalPadding { x: 30, y: 31 } }, z: BagInBag { x: Bag { x: Simple { x: 32 } } } }
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct Simple {
     x: i32
diff --git a/src/test/debuginfo/struct-style-enum.rs b/src/test/debuginfo/struct-style-enum.rs
index 924b374398961..d23c65e71a0d0 100644
--- a/src/test/debuginfo/struct-style-enum.rs
+++ b/src/test/debuginfo/struct-style-enum.rs
@@ -50,7 +50,7 @@
 // lldb-command:print univariant
 // lldb-check:[...]$3 = TheOnlyCase { a: -1 }
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![feature(struct_variant)]
 
 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
diff --git a/src/test/debuginfo/struct-with-destructor.rs b/src/test/debuginfo/struct-with-destructor.rs
index 32ff9f3f148bb..c2372da35aaa4 100644
--- a/src/test/debuginfo/struct-with-destructor.rs
+++ b/src/test/debuginfo/struct-with-destructor.rs
@@ -46,7 +46,7 @@
 // lldb-command:print nested
 // lldb-check:[...]$3 = NestedOuter { a: NestedInner { a: WithDestructor { x: 7890, y: 9870 } } }
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct NoDestructor {
     x: i32,
diff --git a/src/test/debuginfo/trait-pointers.rs b/src/test/debuginfo/trait-pointers.rs
index ca407aef1a45e..de74a4d8f91a1 100644
--- a/src/test/debuginfo/trait-pointers.rs
+++ b/src/test/debuginfo/trait-pointers.rs
@@ -15,7 +15,7 @@
 // compile-flags:-g
 // gdb-command:run
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 
 trait Trait {
diff --git a/src/test/debuginfo/tuple-in-struct.rs b/src/test/debuginfo/tuple-in-struct.rs
index 9ac66f8300f2b..5a47b16464837 100644
--- a/src/test/debuginfo/tuple-in-struct.rs
+++ b/src/test/debuginfo/tuple-in-struct.rs
@@ -42,7 +42,7 @@
 // gdb-command:print mixed_padding
 // gdb-check:$10 = {x = {{40, 41, 42}, {43, 44}}, y = {45, 46, 47, 48}}
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct NoPadding1 {
     x: (i32, i32),
diff --git a/src/test/debuginfo/tuple-in-tuple.rs b/src/test/debuginfo/tuple-in-tuple.rs
index 70344bd3d5ef7..b7f4b0efe0ce1 100644
--- a/src/test/debuginfo/tuple-in-tuple.rs
+++ b/src/test/debuginfo/tuple-in-tuple.rs
@@ -59,7 +59,7 @@
 // lldb-command:print padding_at_end2
 // lldb-check:[...]$6 = ((21, 22), 23)
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn main() {
     let no_padding1: ((u32, u32), u32, u32) = ((0, 1), 2, 3);
diff --git a/src/test/debuginfo/tuple-style-enum.rs b/src/test/debuginfo/tuple-style-enum.rs
index 1527c6a8e3115..1c933637e3e77 100644
--- a/src/test/debuginfo/tuple-style-enum.rs
+++ b/src/test/debuginfo/tuple-style-enum.rs
@@ -50,7 +50,7 @@
 // lldb-command:print univariant
 // lldb-check:[...]$3 = TheOnlyCase(-1)
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
 // the size of the discriminant value is machine dependent, this has be taken into account when
diff --git a/src/test/debuginfo/unique-enum.rs b/src/test/debuginfo/unique-enum.rs
index 12a63614ba4a3..33382542ef298 100644
--- a/src/test/debuginfo/unique-enum.rs
+++ b/src/test/debuginfo/unique-enum.rs
@@ -43,7 +43,7 @@
 // lldb-command:print *univariant
 // lldb-check:[...]$2 = TheOnlyCase(123234)
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![feature(struct_variant)]
 
 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
diff --git a/src/test/debuginfo/var-captured-in-nested-closure.rs b/src/test/debuginfo/var-captured-in-nested-closure.rs
index c200b310a3631..8f128c428e789 100644
--- a/src/test/debuginfo/var-captured-in-nested-closure.rs
+++ b/src/test/debuginfo/var-captured-in-nested-closure.rs
@@ -81,7 +81,7 @@
 // lldb-check:[...]$11 = 8
 // lldb-command:continue
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct Struct {
     a: int,
diff --git a/src/test/debuginfo/var-captured-in-sendable-closure.rs b/src/test/debuginfo/var-captured-in-sendable-closure.rs
index 9b8718d085aea..da2726782e9a6 100644
--- a/src/test/debuginfo/var-captured-in-sendable-closure.rs
+++ b/src/test/debuginfo/var-captured-in-sendable-closure.rs
@@ -38,7 +38,7 @@
 // lldb-command:print *owned
 // lldb-check:[...]$2 = 5
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct Struct {
     a: int,
diff --git a/src/test/debuginfo/var-captured-in-stack-closure.rs b/src/test/debuginfo/var-captured-in-stack-closure.rs
index dc586c266b69f..5d484bbacc8b8 100644
--- a/src/test/debuginfo/var-captured-in-stack-closure.rs
+++ b/src/test/debuginfo/var-captured-in-stack-closure.rs
@@ -46,7 +46,7 @@
 // lldb-command:print *owned
 // lldb-check:[...]$4 = 6
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct Struct {
     a: int,
diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs
index 688d2a595dc2e..6d56ed32c31ea 100644
--- a/src/test/debuginfo/vec-slices.rs
+++ b/src/test/debuginfo/vec-slices.rs
@@ -80,7 +80,7 @@
 // lldb-command:print padded_struct
 // lldb-check:[...]$5 = &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }]
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 #![feature(slicing_syntax)]
 
 struct AStruct {
diff --git a/src/test/debuginfo/vec.rs b/src/test/debuginfo/vec.rs
index f3761e4b54a4f..872d66fdc88db 100644
--- a/src/test/debuginfo/vec.rs
+++ b/src/test/debuginfo/vec.rs
@@ -32,7 +32,7 @@
 // lldb-command:print a
 // lldb-check:[...]$0 = [1, 2, 3]
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 static mut VECT: [i32, ..3] = [1, 2, 3];
 
diff --git a/src/test/run-fail/explicit-fail-msg.rs b/src/test/run-fail/explicit-fail-msg.rs
index 4af9b82ec7e22..abc608a795777 100644
--- a/src/test/run-fail/explicit-fail-msg.rs
+++ b/src/test/run-fail/explicit-fail-msg.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(dead_assignment)]
-#![allow(unused_variable)]
+#![allow(unused_assignments)]
+#![allow(unused_variables)]
 
 // error-pattern:wooooo
 fn main() {
diff --git a/src/test/run-fail/issue-3029.rs b/src/test/run-fail/issue-3029.rs
index 539d2adc7d45c..adbb4d9ab03d3 100644
--- a/src/test/run-fail/issue-3029.rs
+++ b/src/test/run-fail/issue-3029.rs
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(unnecessary_allocation)]
+#![allow(unused_allocation)]
 #![allow(unreachable_code)]
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 
 // error-pattern:so long
diff --git a/src/test/run-fail/issue-948.rs b/src/test/run-fail/issue-948.rs
index 5669131aeee53..0e67cd1ebc89c 100644
--- a/src/test/run-fail/issue-948.rs
+++ b/src/test/run-fail/issue-948.rs
@@ -10,7 +10,7 @@
 
 // error-pattern:beep boop
 
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct Point { x: int, y: int }
 
diff --git a/src/test/run-fail/match-bot-fail.rs b/src/test/run-fail/match-bot-fail.rs
index 9d80f07de0af9..d87dbc65e50c6 100644
--- a/src/test/run-fail/match-bot-fail.rs
+++ b/src/test/run-fail/match-bot-fail.rs
@@ -11,7 +11,7 @@
 // error-pattern:explicit failure
 
 #![allow(unreachable_code)]
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 fn foo(s: String) { }
 
diff --git a/src/test/run-fail/rhs-type.rs b/src/test/run-fail/rhs-type.rs
index d607ec76c351d..d4485596aa764 100644
--- a/src/test/run-fail/rhs-type.rs
+++ b/src/test/run-fail/rhs-type.rs
@@ -13,7 +13,7 @@
 // error-pattern:bye
 
 #![allow(unreachable_code)]
-#![allow(unused_variable)]
+#![allow(unused_variables)]
 
 struct T { t: String }
 

From 1ad1e2e2992d37c27f264366487ee813e9440d7f Mon Sep 17 00:00:00 2001
From: Aaron Turon <aturon@mozilla.com>
Date: Mon, 27 Oct 2014 15:37:29 -0700
Subject: [PATCH 10/34] Turn on warning for use of deprecated lint names

---
 src/librustc/lint/context.rs | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs
index 4cdca9e536595..be8a6cec84294 100644
--- a/src/librustc/lint/context.rs
+++ b/src/librustc/lint/context.rs
@@ -261,14 +261,12 @@ impl LintStore {
         match self.by_name.find_equiv(&lint_name) {
             Some(&Id(lint_id)) => Some(lint_id),
             Some(&Renamed(ref new_name, lint_id)) => {
-                // NOTE(stage0): add the following code after the next snapshot
-
-                // let warning = format!("lint {} has been renamed to {}",
-                //                       lint_name, new_name);
-                // match span {
-                //     Some(span) => sess.span_warn(span, warning.as_slice()),
-                //     None => sess.warn(warning.as_slice()),
-                // };
+                let warning = format!("lint {} has been renamed to {}",
+                                      lint_name, new_name);
+                match span {
+                    Some(span) => sess.span_warn(span, warning.as_slice()),
+                    None => sess.warn(warning.as_slice()),
+                };
                 Some(lint_id)
             }
             None => None

From d9eb13b2c8397f6eccea0c37967c4010d9aedb0d Mon Sep 17 00:00:00 2001
From: Aaron Turon <aturon@mozilla.com>
Date: Tue, 28 Oct 2014 08:36:19 -0700
Subject: [PATCH 11/34] Add regression test for lint deprecation

---
 src/test/compile-fail/lint-renaming.rs | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 src/test/compile-fail/lint-renaming.rs

diff --git a/src/test/compile-fail/lint-renaming.rs b/src/test/compile-fail/lint-renaming.rs
new file mode 100644
index 0000000000000..7ffec37772fe8
--- /dev/null
+++ b/src/test/compile-fail/lint-renaming.rs
@@ -0,0 +1,16 @@
+// 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.
+
+// Check that lint deprecation works
+
+#[deny(unused_variable)] //~ warning: lint unused_variable has been renamed to unused_variables
+pub fn main() {
+    let x = 0u8; //~ error: unused variable:
+}

From 321de979d8734d87629933fa37e6db6416ff3132 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Tue, 28 Oct 2014 18:31:09 -0400
Subject: [PATCH 12/34] reference: note the existence of UnsafeCell

---
 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 11bf895341b90..1a3365a86b797 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -1152,7 +1152,7 @@ exposing an API making it possible for it to occur in safe code.
 
 * Data races
 * Dereferencing a null/dangling raw pointer
-* Mutating an immutable value/reference
+* Mutating an immutable value/reference without `UnsafeCell`
 * Reads of [undef](http://llvm.org/docs/LangRef.html#undefined-values)
   (uninitialized) memory
 * Breaking the [pointer aliasing

From 768a7e1a4a891191f3653cebc223dfad0e8b875c Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Tue, 28 Oct 2014 18:36:43 -0400
Subject: [PATCH 13/34] reference: slices are now regular types

---
 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 1a3365a86b797..cfa69cdfd4975 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -1165,7 +1165,7 @@ exposing an API making it possible for it to occur in safe code.
   * Using `std::ptr::copy_nonoverlapping_memory` (`memcpy32`/`memcpy64`
     instrinsics) on overlapping buffers
 * Invalid values in primitive types, even in private fields/locals:
-  * Dangling/null pointers in non-raw pointers, or slices
+  * Dangling/null references or boxes
   * A value other than `false` (0) or `true` (1) in a `bool`
   * A discriminant in an `enum` not included in the type definition
   * A value in a `char` which is a surrogate or above `char::MAX`

From 8a719255589bcbc82c961e051f09678b524f4149 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Tue, 28 Oct 2014 18:46:27 -0400
Subject: [PATCH 14/34] reference: document unwinding unsafety issues

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

diff --git a/src/doc/reference.md b/src/doc/reference.md
index cfa69cdfd4975..7f410b7fd934e 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -1170,6 +1170,9 @@ exposing an API making it possible for it to occur in safe code.
   * A discriminant in an `enum` not included in the type definition
   * A value in a `char` which is a surrogate or above `char::MAX`
   * non-UTF-8 byte sequences in a `str`
+* Unwinding into Rust from foreign code or unwinding from Rust into foreign
+  code. Rust's failure system is not compatible with exception handling in
+  other languages. Unwinding must be caught and handled at FFI boundaries.
 
 ##### Behaviour not considered unsafe
 

From cb5f9799421c7ae9289295acdf15546a1e68da91 Mon Sep 17 00:00:00 2001
From: gamazeps <gamaz3ps@gmail.com>
Date: Wed, 29 Oct 2014 00:59:36 +0100
Subject: [PATCH 15/34] Diagnostic: resolve bare fn in expected closure

Closes #15273 (I did not find how to get the identifier in the message
:/)

Also creates the span_help! macro associated with #18126
---
 src/librustc/middle/typeck/check/writeback.rs              | 6 ++++--
 src/libsyntax/diagnostics/macros.rs                        | 7 +++++++
 .../compile-fail/coerce-bare-fn-to-closure-and-proc.rs     | 6 ++++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs
index 56dec61d4102e..b53318861b891 100644
--- a/src/librustc/middle/typeck/check/writeback.rs
+++ b/src/librustc/middle/typeck/check/writeback.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -282,7 +282,9 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
                             }
                             _ => {
                                 span_err!(self.tcx().sess, reason.span(self.tcx()), E0100,
-                                    "cannot coerce non-statically resolved bare fn");
+                                    "cannot coerce non-statically resolved bare fn to closure");
+                                span_help!(self.tcx().sess, reason.span(self.tcx()),
+                                    "consider embedding the function in a closure");
                             }
                         }
 
diff --git a/src/libsyntax/diagnostics/macros.rs b/src/libsyntax/diagnostics/macros.rs
index c344168b62a28..b4bf793d4e197 100644
--- a/src/libsyntax/diagnostics/macros.rs
+++ b/src/libsyntax/diagnostics/macros.rs
@@ -39,6 +39,13 @@ macro_rules! span_note(
     })
 )
 
+#[macro_export]
+macro_rules! span_help(
+    ($session:expr, $span:expr, $($message:tt)*) => ({
+        ($session).span_help($span, format!($($message)*).as_slice())
+    })
+)
+
 #[macro_export]
 macro_rules! register_diagnostics(
     ($($code:tt),*) => (
diff --git a/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs b/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs
index c165802d61ffb..087ebf4e28c58 100644
--- a/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs
+++ b/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs
@@ -13,7 +13,9 @@ fn foo() {}
 fn main() {
     let f = foo;
     let f_closure: || = f;
-    //~^ ERROR: cannot coerce non-statically resolved bare fn
+    //~^ ERROR: cannot coerce non-statically resolved bare fn to closure
+    //~^ HELP: consider embedding the function in a closure
     let f_proc: proc() = f;
-    //~^ ERROR: cannot coerce non-statically resolved bare fn
+    //~^ ERROR: cannot coerce non-statically resolved bare fn to closure
+    //~^ HELP: consider embedding the function in a closure
 }

From c8b142afb9deed06ab1f054bfb0d37c33e7c2961 Mon Sep 17 00:00:00 2001
From: Brian Koropoff <bkoropoff@gmail.com>
Date: Tue, 28 Oct 2014 19:59:20 -0700
Subject: [PATCH 16/34] Fix ICE assigning methods to local variables

This just adds some missing match cases in ty and trans

Closes #18412
---
 src/librustc/middle/trans/expr.rs | 8 +++++---
 src/librustc/middle/ty.rs         | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs
index 7d64c42a00030..36635da3a9e1f 100644
--- a/src/librustc/middle/trans/expr.rs
+++ b/src/librustc/middle/trans/expr.rs
@@ -833,7 +833,7 @@ fn trans_def<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 
     let _icx = push_ctxt("trans_def_lvalue");
     match def {
-        def::DefFn(..) | def::DefStaticMethod(..) |
+        def::DefFn(..) | def::DefStaticMethod(..) | def::DefMethod(..) |
         def::DefStruct(_) | def::DefVariant(..) => {
             trans_def_fn_unadjusted(bcx, ref_expr, def)
         }
@@ -1191,10 +1191,12 @@ fn trans_def_fn_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let llfn = match def {
         def::DefFn(did, _, _) |
         def::DefStruct(did) | def::DefVariant(_, did, _) |
-        def::DefStaticMethod(did, def::FromImpl(_), _) => {
+        def::DefStaticMethod(did, def::FromImpl(_), _) |
+        def::DefMethod(did, _, def::FromImpl(_)) => {
             callee::trans_fn_ref(bcx, did, ExprId(ref_expr.id))
         }
-        def::DefStaticMethod(impl_did, def::FromTrait(trait_did), _) => {
+        def::DefStaticMethod(impl_did, def::FromTrait(trait_did), _) |
+        def::DefMethod(impl_did, _, def::FromTrait(trait_did)) => {
             meth::trans_static_method_callee(bcx, impl_did,
                                              trait_did, ref_expr.id)
         }
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 6666b85879a89..fda47dba7d4b6 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -3631,7 +3631,7 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
                 def::DefFn(_, _, true) => RvalueDpsExpr,
 
                 // Fn pointers are just scalar values.
-                def::DefFn(..) | def::DefStaticMethod(..) => RvalueDatumExpr,
+                def::DefFn(..) | def::DefStaticMethod(..) | def::DefMethod(..) => RvalueDatumExpr,
 
                 // Note: there is actually a good case to be made that
                 // DefArg's, particularly those of immediate type, ought to

From 12619bede2cb08d8d58375e2dd188bd27a03d896 Mon Sep 17 00:00:00 2001
From: Brian Koropoff <bkoropoff@gmail.com>
Date: Tue, 28 Oct 2014 20:09:49 -0700
Subject: [PATCH 17/34] Add regression test for issue #18412

---
 src/test/run-pass/issue-18412.rs | 36 ++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 src/test/run-pass/issue-18412.rs

diff --git a/src/test/run-pass/issue-18412.rs b/src/test/run-pass/issue-18412.rs
new file mode 100644
index 0000000000000..c03301f17f31f
--- /dev/null
+++ b/src/test/run-pass/issue-18412.rs
@@ -0,0 +1,36 @@
+// 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.
+
+#![feature(tuple_indexing)]
+
+// Test that non-static methods can be assigned to local variables as
+// function pointers.
+
+trait Foo {
+    fn foo(&self) -> uint;
+}
+
+struct A(uint);
+
+impl A {
+    fn bar(&self) -> uint { self.0 }
+}
+
+impl Foo for A {
+    fn foo(&self) -> uint { self.bar() }
+}
+
+fn main() {
+    let f = A::bar;
+    let g = Foo::foo;
+    let a = A(42);
+
+    assert_eq!(f(&a), g(&a));
+}

From 793a73315214a8932e4b07c08dcfb9dc5526b5a9 Mon Sep 17 00:00:00 2001
From: Tobias Bucher <tobiasbucher5991@gmail.com>
Date: Wed, 29 Oct 2014 10:08:36 +0100
Subject: [PATCH 18/34] Fix `core::num::CheckedDiv::checked_div` documentation

The "/" was probably generated by a `gq` in vim.
---
 src/libcore/num/mod.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 3dceb42e20653..1409677b951d3 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -1353,7 +1353,7 @@ checked_impl!(CheckedMul, checked_mul, i64, intrinsics::i64_mul_with_overflow)
 /// wrapping around on underflow and overflow.
 pub trait CheckedDiv: Div<Self, Self> {
     /// Divides two numbers, checking for underflow, overflow and division by zero. If any of that
-    /// happens, / `None` is returned.
+    /// happens, `None` is returned.
     ///
     /// # Example
     ///

From 89e8caadae53fb0429ee95a5f1e2c07b2adc2728 Mon Sep 17 00:00:00 2001
From: Richo Healey <richo@psych0tik.net>
Date: Tue, 28 Oct 2014 18:58:46 -0700
Subject: [PATCH 19/34] rustc: fail if LLVM is passed an invalid triple

This changes create_target_machine to correctly return a Result (Since
the underlying LLVM function can fail and return NULL)
---
 src/librustc/back/write.rs | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/librustc/back/write.rs b/src/librustc/back/write.rs
index f1cd8b52e5ed3..825e1a328bda3 100644
--- a/src/librustc/back/write.rs
+++ b/src/librustc/back/write.rs
@@ -226,12 +226,10 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef {
         }
     };
 
-    unsafe {
-        sess.targ_cfg
-             .target_strs
-             .target_triple
-             .as_slice()
-             .with_c_str(|t| {
+    let triple = sess.targ_cfg.target_strs.target_triple.as_slice();
+
+    let tm = unsafe {
+            triple.with_c_str(|t| {
             sess.opts.cg.target_cpu.as_slice().with_c_str(|cpu| {
                 target_feature(sess).with_c_str(|features| {
                     llvm::LLVMRustCreateTargetMachine(
@@ -249,7 +247,15 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef {
                 })
             })
         })
-    }
+    };
+
+    if tm.is_null() {
+        llvm_err(sess.diagnostic().handler(),
+                 format!("Could not create LLVM TargetMachine for triple: {}",
+                         triple).to_string());
+    } else {
+        return tm;
+    };
 }
 
 

From 710fd0ca955c6b1cf904dd7607eb558e7759fd46 Mon Sep 17 00:00:00 2001
From: Jakub Bukaj <jakub@jakub.cc>
Date: Wed, 29 Oct 2014 22:48:35 +0100
Subject: [PATCH 20/34] Remove an empty file from librustc

---
 src/librustc/middle/traexpr | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 src/librustc/middle/traexpr

diff --git a/src/librustc/middle/traexpr b/src/librustc/middle/traexpr
deleted file mode 100644
index e69de29bb2d1d..0000000000000

From 936d999b5270d186df28123a5dbd6d2bb848bb2c Mon Sep 17 00:00:00 2001
From: Brendan Zabarauskas <bjzaba@yahoo.com.au>
Date: Wed, 29 Oct 2014 21:37:54 +1100
Subject: [PATCH 21/34] Use common variants for open and close delimiters

This common representation for delimeters should make pattern matching easier. Having a separate `token::DelimToken` enum also allows us to enforce the invariant that the opening and closing delimiters must be the same in `ast::TtDelimited`, removing the need to ensure matched delimiters when working with token trees.
---
 src/grammar/verify.rs                         |  12 +-
 src/librustc/middle/save/span_utils.rs        |   6 +-
 src/librustdoc/html/highlight.rs              |   6 +-
 src/libsyntax/ast.rs                          |  51 ++-
 src/libsyntax/ext/asm.rs                      |   8 +-
 src/libsyntax/ext/quote.rs                    |  32 +-
 src/libsyntax/ext/tt/macro_parser.rs          |   6 +-
 src/libsyntax/ext/tt/macro_rules.rs           |   5 +-
 src/libsyntax/ext/tt/transcribe.rs            |  14 +-
 src/libsyntax/fold.rs                         |  20 +-
 src/libsyntax/parse/attr.rs                   |  12 +-
 src/libsyntax/parse/lexer/mod.rs              |  12 +-
 src/libsyntax/parse/mod.rs                    |  70 ++--
 src/libsyntax/parse/parser.rs                 | 323 +++++++++---------
 src/libsyntax/parse/token.rs                  |  45 +--
 src/libsyntax/print/pprust.rs                 |  19 +-
 .../compile-fail/removed-syntax-record.rs     |   2 +-
 17 files changed, 328 insertions(+), 315 deletions(-)

diff --git a/src/grammar/verify.rs b/src/grammar/verify.rs
index a4345e061640d..a4641c40165ac 100644
--- a/src/grammar/verify.rs
+++ b/src/grammar/verify.rs
@@ -59,7 +59,7 @@ fn parse_token_list(file: &str) -> HashMap<String, Token> {
             "FLOAT_SUFFIX"      => id(),
             "INT_SUFFIX"        => id(),
             "SHL"               => token::BinOp(token::Shl),
-            "LBRACE"            => token::LBrace,
+            "LBRACE"            => token::OpenDelim(token::Brace),
             "RARROW"            => token::Rarrow,
             "LIT_STR"           => token::LitStr(Name(0)),
             "DOTDOT"            => token::DotDot,
@@ -67,12 +67,12 @@ fn parse_token_list(file: &str) -> HashMap<String, Token> {
             "DOTDOTDOT"         => token::DotDotDot,
             "NOT"               => token::Not,
             "AND"               => token::BinOp(token::And),
-            "LPAREN"            => token::LParen,
+            "LPAREN"            => token::OpenDelim(token::Paren),
             "ANDAND"            => token::AndAnd,
             "AT"                => token::At,
-            "LBRACKET"          => token::LBracket,
+            "LBRACKET"          => token::OpenDelim(token::Bracket),
             "LIT_STR_RAW"       => token::LitStrRaw(Name(0), 0),
-            "RPAREN"            => token::RParen,
+            "RPAREN"            => token::CloseDelim(token::Paren),
             "SLASH"             => token::BinOp(token::Slash),
             "COMMA"             => token::Comma,
             "LIFETIME"          => token::Lifetime(ast::Ident { name: Name(0), ctxt: 0 }),
@@ -83,7 +83,7 @@ fn parse_token_list(file: &str) -> HashMap<String, Token> {
             "LIT_CHAR"          => token::LitChar(Name(0)),
             "LIT_BYTE"          => token::LitByte(Name(0)),
             "EQ"                => token::Eq,
-            "RBRACKET"          => token::RBracket,
+            "RBRACKET"          => token::CloseDelim(token::Bracket),
             "COMMENT"           => token::Comment,
             "DOC_COMMENT"       => token::DocComment(Name(0)),
             "DOT"               => token::Dot,
@@ -91,7 +91,7 @@ fn parse_token_list(file: &str) -> HashMap<String, Token> {
             "NE"                => token::Ne,
             "GE"                => token::Ge,
             "PERCENT"           => token::BinOp(token::Percent),
-            "RBRACE"            => token::RBrace,
+            "RBRACE"            => token::CloseDelim(token::Brace),
             "BINOP"             => token::BinOp(token::Plus),
             "POUND"             => token::Pound,
             "OROR"              => token::OrOr,
diff --git a/src/librustc/middle/save/span_utils.rs b/src/librustc/middle/save/span_utils.rs
index 511d8aa5bace6..93ad29cff906a 100644
--- a/src/librustc/middle/save/span_utils.rs
+++ b/src/librustc/middle/save/span_utils.rs
@@ -145,7 +145,7 @@ impl<'a> SpanUtils<'a> {
             last_span = None;
             let mut next = toks.next_token();
 
-            if (next.tok == token::LParen ||
+            if (next.tok == token::OpenDelim(token::Paren) ||
                 next.tok == token::Lt) &&
                bracket_count == 0 &&
                prev.tok.is_ident() {
@@ -164,8 +164,8 @@ impl<'a> SpanUtils<'a> {
             }
 
             bracket_count += match prev.tok {
-                token::LParen | token::Lt => 1,
-                token::RParen | token::Gt => -1,
+                token::OpenDelim(token::Paren) | token::Lt => 1,
+                token::CloseDelim(token::Paren) | token::Gt => -1,
                 token::BinOp(token::Shr) => -2,
                 _ => 0
             };
diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs
index 0441e6b791f57..4797ac7c66ac6 100644
--- a/src/librustdoc/html/highlight.rs
+++ b/src/librustdoc/html/highlight.rs
@@ -97,8 +97,8 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader,
 
             // miscellaneous, no highlighting
             token::Dot | token::DotDot | token::DotDotDot | token::Comma | token::Semi |
-                token::Colon | token::ModSep | token::LArrow | token::LParen |
-                token::RParen | token::LBracket | token::LBrace | token::RBrace |
+                token::Colon | token::ModSep | token::LArrow | token::OpenDelim(_) |
+                token::CloseDelim(token::Brace) | token::CloseDelim(token::Paren) |
                 token::Question => "",
             token::Dollar => {
                 if lexer.peek().tok.is_ident() {
@@ -118,7 +118,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader,
                 try!(write!(out, r"<span class='attribute'>#"));
                 continue
             }
-            token::RBracket => {
+            token::CloseDelim(token::Bracket) => {
                 if is_attribute {
                     is_attribute = false;
                     try!(write!(out, "]</span>"));
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 3bd25d245e175..a2c859cf9fd3c 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -595,17 +595,38 @@ pub enum CaptureClause {
     CaptureByRef,
 }
 
-/// A token that delimits a sequence of token trees
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
-pub struct Delimiter {
-    pub span: Span,
-    pub token: ::parse::token::Token,
-}
+/// A delimited sequence of token trees
+#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+pub struct Delimited {
+    /// The type of delimiter
+    pub delim: token::DelimToken,
+    /// The span covering the opening delimiter
+    pub open_span: Span,
+    /// The delimited sequence of token trees
+    pub tts: Vec<TokenTree>,
+    /// The span covering the closing delimiter
+    pub close_span: Span,
+}
+
+impl Delimited {
+    /// Returns the opening delimiter as a token.
+    pub fn open_token(&self) -> token::Token {
+        token::OpenDelim(self.delim)
+    }
+
+    /// Returns the closing delimiter as a token.
+    pub fn close_token(&self) -> token::Token {
+        token::CloseDelim(self.delim)
+    }
+
+    /// Returns the opening delimiter as a token tree.
+    pub fn open_tt(&self) -> TokenTree {
+        TtToken(self.open_span, self.open_token())
+    }
 
-impl Delimiter {
-    /// Convert the delimiter to a `TtToken`
-    pub fn to_tt(&self) -> TokenTree {
-        TtToken(self.span, self.token.clone())
+    /// Returns the closing delimiter as a token tree.
+    pub fn close_tt(&self) -> TokenTree {
+        TtToken(self.close_span, self.close_token())
     }
 }
 
@@ -635,15 +656,15 @@ pub enum KleeneOp {
 #[doc="For macro invocations; parsing is delegated to the macro"]
 pub enum TokenTree {
     /// A single token
-    TtToken(Span, ::parse::token::Token),
+    TtToken(Span, token::Token),
     /// A delimited sequence of token trees
-    TtDelimited(Span, Rc<(Delimiter, Vec<TokenTree>, Delimiter)>),
+    TtDelimited(Span, Rc<Delimited>),
 
     // These only make sense for right-hand-sides of MBE macros:
 
     /// A Kleene-style repetition sequence with an optional separator.
     // FIXME(eddyb) #6308 Use Rc<[TokenTree]> after DST.
-    TtSequence(Span, Rc<Vec<TokenTree>>, Option<::parse::token::Token>, KleeneOp),
+    TtSequence(Span, Rc<Vec<TokenTree>>, Option<token::Token>, KleeneOp),
     /// A syntactic variable that will be filled in by macro expansion.
     TtNonterminal(Span, Ident)
 }
@@ -715,10 +736,10 @@ pub type Matcher = Spanned<Matcher_>;
 #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum Matcher_ {
     /// Match one token
-    MatchTok(::parse::token::Token),
+    MatchTok(token::Token),
     /// Match repetitions of a sequence: body, separator, Kleene operator,
     /// lo, hi position-in-match-array used:
-    MatchSeq(Vec<Matcher> , Option<::parse::token::Token>, KleeneOp, uint, uint),
+    MatchSeq(Vec<Matcher>, Option<token::Token>, KleeneOp, uint, uint),
     /// Parse a Rust NT: name to bind, name of NT, position in match array:
     MatchNonterminal(Ident, Ident, uint)
 }
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs
index 2b52b7feaccd0..d57d6e52d7fd4 100644
--- a/src/libsyntax/ext/asm.rs
+++ b/src/libsyntax/ext/asm.rs
@@ -84,9 +84,9 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
 
                     let span = p.last_span;
 
-                    p.expect(&token::LParen);
+                    p.expect(&token::OpenDelim(token::Paren));
                     let out = p.parse_expr();
-                    p.expect(&token::RParen);
+                    p.expect(&token::CloseDelim(token::Paren));
 
                     // Expands a read+write operand into two operands.
                     //
@@ -129,9 +129,9 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
                         cx.span_err(p.last_span, "input operand constraint contains '+'");
                     }
 
-                    p.expect(&token::LParen);
+                    p.expect(&token::OpenDelim(token::Paren));
                     let input = p.parse_expr();
-                    p.expect(&token::RParen);
+                    p.expect(&token::CloseDelim(token::Paren));
 
                     inputs.push((constraint, input));
                 }
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index a95a737720a96..2151f79cd7b67 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -531,6 +531,15 @@ fn mk_binop(cx: &ExtCtxt, sp: Span, bop: token::BinOpToken) -> P<ast::Expr> {
     mk_token_path(cx, sp, name)
 }
 
+fn mk_delim(cx: &ExtCtxt, sp: Span, delim: token::DelimToken) -> P<ast::Expr> {
+    let name = match delim {
+        token::Paren     => "Paren",
+        token::Bracket   => "Bracket",
+        token::Brace     => "Brace",
+    };
+    mk_token_path(cx, sp, name)
+}
+
 #[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot
 fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P<ast::Expr> {
     match *tok {
@@ -542,6 +551,15 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P<ast::Expr> {
                                 vec!(mk_binop(cx, sp, binop)));
         }
 
+        token::OpenDelim(delim) => {
+            return cx.expr_call(sp, mk_token_path(cx, sp, "OpenDelim"),
+                                vec![mk_delim(cx, sp, delim)]);
+        }
+        token::CloseDelim(delim) => {
+            return cx.expr_call(sp, mk_token_path(cx, sp, "CloseDelim"),
+                                vec![mk_delim(cx, sp, delim)]);
+        }
+
         token::LitByte(i) => {
             let e_byte = mk_name(cx, sp, i.ident());
 
@@ -625,12 +643,6 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P<ast::Expr> {
         token::RArrow       => "RArrow",
         token::LArrow       => "LArrow",
         token::FatArrow     => "FatArrow",
-        token::LParen       => "LParen",
-        token::RParen       => "RParen",
-        token::LBracket     => "LBracket",
-        token::RBracket     => "RBracket",
-        token::LBrace       => "LBrace",
-        token::RBrace       => "RBrace",
         token::Pound        => "Pound",
         token::Dollar       => "Dollar",
         token::Underscore   => "Underscore",
@@ -640,7 +652,6 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P<ast::Expr> {
     mk_token_path(cx, sp, name)
 }
 
-
 fn mk_tt(cx: &ExtCtxt, _: Span, tt: &ast::TokenTree) -> Vec<P<ast::Stmt>> {
     match *tt {
         ast::TtToken(sp, ref tok) => {
@@ -656,10 +667,9 @@ fn mk_tt(cx: &ExtCtxt, _: Span, tt: &ast::TokenTree) -> Vec<P<ast::Stmt>> {
             vec!(cx.stmt_expr(e_push))
         },
         ast::TtDelimited(sp, ref delimed) => {
-            let (ref open, ref tts, ref close) = **delimed;
-            mk_tt(cx, sp, &open.to_tt()).into_iter()
-                .chain(tts.iter().flat_map(|tt| mk_tt(cx, sp, tt).into_iter()))
-                .chain(mk_tt(cx, sp, &close.to_tt()).into_iter())
+            mk_tt(cx, sp, &delimed.open_tt()).into_iter()
+                .chain(delimed.tts.iter().flat_map(|tt| mk_tt(cx, sp, tt).into_iter()))
+                .chain(mk_tt(cx, sp, &delimed.close_tt()).into_iter())
                 .collect()
         },
         ast::TtSequence(..) => panic!("TtSequence in quote!"),
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 9260a45adb954..bbc2cb86d006a 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -355,10 +355,8 @@ pub fn parse(sess: &ParseSess,
                     // Built-in nonterminals never start with these tokens,
                     // so we can eliminate them from consideration.
                     match tok {
-                        token::RParen |
-                        token::RBrace |
-                        token::RBracket => {},
-                        _ => bb_eis.push(ei)
+                        token::CloseDelim(_) => {},
+                        _ => bb_eis.push(ei),
                     }
                   }
                   MatchTok(ref t) => {
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 85bd5cde3044f..e50d4457af249 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -172,10 +172,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
                     MatchedNonterminal(NtTT(ref tt)) => {
                         match **tt {
                             // ignore delimiters
-                            TtDelimited(_, ref delimed) => {
-                                let (_, ref tts, _) = **delimed;
-                                tts.clone()
-                            },
+                            TtDelimited(_, ref delimed) => delimed.tts.clone(),
                             _ => cx.span_fatal(sp, "macro rhs must be delimited"),
                         }
                     },
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 2c7b583d46021..249a985a6488a 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -129,8 +129,7 @@ impl Add<LockstepIterSize, LockstepIterSize> for LockstepIterSize {
 fn lockstep_iter_size(t: &TokenTree, r: &TtReader) -> LockstepIterSize {
     match *t {
         TtDelimited(_, ref delimed) => {
-            let (_, ref tts, _) = **delimed;
-            tts.iter().fold(LisUnconstrained, |size, tt| {
+            delimed.tts.iter().fold(LisUnconstrained, |size, tt| {
                 size + lockstep_iter_size(tt, r)
             })
         },
@@ -207,14 +206,13 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
         };
         match t {
             TtDelimited(_, ref delimed) => {
-                let (ref open, ref tts, ref close) = **delimed;
-                let mut forest = Vec::with_capacity(1 + tts.len() + 1);
-                forest.push(open.to_tt());
-                forest.extend(tts.iter().map(|x| (*x).clone()));
-                forest.push(close.to_tt());
+                let mut tts = Vec::with_capacity(1 + delimed.tts.len() + 1);
+                tts.push(delimed.open_tt());
+                tts.extend(delimed.tts.iter().map(|tt| tt.clone()));
+                tts.push(delimed.close_tt());
 
                 r.stack.push(TtFrame {
-                    forest: Rc::new(forest),
+                    forest: Rc::new(tts),
                     idx: 0,
                     dotdotdoted: false,
                     sep: None
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 47ca66b0b4923..9a55f07e98d79 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -572,18 +572,14 @@ pub fn noop_fold_tt<T: Folder>(tt: &TokenTree, fld: &mut T) -> TokenTree {
         TtToken(span, ref tok) =>
             TtToken(span, fld.fold_token(tok.clone())),
         TtDelimited(span, ref delimed) => {
-            let (ref open, ref tts, ref close) = **delimed;
-            TtDelimited(span, Rc::new((
-                            Delimiter {
-                                span: open.span,
-                                token: fld.fold_token(open.token.clone())
-                            },
-                            fld.fold_tts(tts.as_slice()),
-                            Delimiter {
-                                span: close.span,
-                                token: fld.fold_token(close.token.clone())
-                            },
-                        )))
+            TtDelimited(span, Rc::new(
+                            Delimited {
+                                delim: delimed.delim,
+                                open_span: delimed.open_span,
+                                tts: fld.fold_tts(delimed.tts.as_slice()),
+                                close_span: delimed.close_span,
+                            }
+                        ))
         },
         TtSequence(span, ref pattern, ref sep, is_optional) =>
             TtSequence(span,
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index 458a5042a7e23..aefac804e4d88 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -81,10 +81,10 @@ impl<'a> ParserAttr for Parser<'a> {
                     ast::AttrOuter
                 };
 
-                self.expect(&token::LBracket);
+                self.expect(&token::OpenDelim(token::Bracket));
                 let meta_item = self.parse_meta_item();
                 let hi = self.span.hi;
-                self.expect(&token::RBracket);
+                self.expect(&token::CloseDelim(token::Bracket));
 
                 (mk_sp(lo, hi), meta_item, style)
             }
@@ -194,7 +194,7 @@ impl<'a> ParserAttr for Parser<'a> {
                 let hi = self.span.hi;
                 P(spanned(lo, hi, ast::MetaNameValue(name, lit)))
             }
-            token::LParen => {
+            token::OpenDelim(token::Paren) => {
                 let inner_items = self.parse_meta_seq();
                 let hi = self.span.hi;
                 P(spanned(lo, hi, ast::MetaList(name, inner_items)))
@@ -208,15 +208,15 @@ impl<'a> ParserAttr for Parser<'a> {
 
     /// matches meta_seq = ( COMMASEP(meta_item) )
     fn parse_meta_seq(&mut self) -> Vec<P<ast::MetaItem>> {
-        self.parse_seq(&token::LParen,
-                       &token::RParen,
+        self.parse_seq(&token::OpenDelim(token::Paren),
+                       &token::CloseDelim(token::Paren),
                        seq_sep_trailing_disallowed(token::Comma),
                        |p| p.parse_meta_item()).node
     }
 
     fn parse_optional_meta(&mut self) -> Vec<P<ast::MetaItem>> {
         match self.token {
-            token::LParen => self.parse_meta_seq(),
+            token::OpenDelim(token::Paren) => self.parse_meta_seq(),
             _ => Vec::new()
         }
     }
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 3a6cf610b4f8b..293b91111b5b2 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -967,12 +967,12 @@ impl<'a> StringReader<'a> {
                   token::Dot
               };
           }
-          '(' => { self.bump(); return token::LParen; }
-          ')' => { self.bump(); return token::RParen; }
-          '{' => { self.bump(); return token::LBrace; }
-          '}' => { self.bump(); return token::RBrace; }
-          '[' => { self.bump(); return token::LBracket; }
-          ']' => { self.bump(); return token::RBracket; }
+          '(' => { self.bump(); return token::OpenDelim(token::Paren); }
+          ')' => { self.bump(); return token::CloseDelim(token::Paren); }
+          '{' => { self.bump(); return token::OpenDelim(token::Brace); }
+          '}' => { self.bump(); return token::CloseDelim(token::Brace); }
+          '[' => { self.bump(); return token::OpenDelim(token::Bracket); }
+          ']' => { self.bump(); return token::CloseDelim(token::Bracket); }
           '@' => { self.bump(); return token::At; }
           '#' => { self.bump(); return token::Pound; }
           '~' => { self.bump(); return token::Tilde; }
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index c731f3965a0c9..83499ec54c676 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -799,29 +799,23 @@ mod test {
              ast::TtDelimited(_, ref macro_delimed)]
             if name_macro_rules.as_str() == "macro_rules"
             && name_zip.as_str() == "zip" => {
-                let (ref macro_open, ref macro_tts, ref macro_close) = **macro_delimed;
-                match (macro_open, macro_tts.as_slice(), macro_close) {
-                    (&ast::Delimiter { token: token::LParen, .. },
-                     [ast::TtDelimited(_, ref first_delimed),
-                      ast::TtToken(_, token::FatArrow),
-                      ast::TtDelimited(_, ref second_delimed)],
-                     &ast::Delimiter { token: token::RParen, .. }) => {
-                        let (ref first_open, ref first_tts, ref first_close) = **first_delimed;
-                        match (first_open, first_tts.as_slice(), first_close) {
-                            (&ast::Delimiter { token: token::LParen, .. },
-                             [ast::TtToken(_, token::Dollar),
-                              ast::TtToken(_, token::Ident(name, token::Plain))],
-                             &ast::Delimiter { token: token::RParen, .. })
-                            if name.as_str() == "a" => {},
+                match macro_delimed.tts.as_slice() {
+                    [ast::TtDelimited(_, ref first_delimed),
+                     ast::TtToken(_, token::FatArrow),
+                     ast::TtDelimited(_, ref second_delimed)]
+                    if macro_delimed.delim == token::Paren => {
+                        match first_delimed.tts.as_slice() {
+                            [ast::TtToken(_, token::Dollar),
+                             ast::TtToken(_, token::Ident(name, token::Plain))]
+                            if first_delimed.delim == token::Paren
+                            && name.as_str() == "a" => {},
                             _ => panic!("value 3: {}", **first_delimed),
                         }
-                        let (ref second_open, ref second_tts, ref second_close) = **second_delimed;
-                        match (second_open, second_tts.as_slice(), second_close) {
-                            (&ast::Delimiter { token: token::LParen, .. },
-                             [ast::TtToken(_, token::Dollar),
-                              ast::TtToken(_, token::Ident(name, token::Plain))],
-                             &ast::Delimiter { token: token::RParen, .. })
-                            if name.as_str() == "a" => {},
+                        match second_delimed.tts.as_slice() {
+                            [ast::TtToken(_, token::Dollar),
+                             ast::TtToken(_, token::Ident(name, token::Plain))]
+                            if second_delimed.delim == token::Paren
+                            && name.as_str() == "a" => {},
                             _ => panic!("value 4: {}", **second_delimed),
                         }
                     },
@@ -867,12 +861,10 @@ mod test {
         \"variant\":\"TtDelimited\",\
         \"fields\":[\
             null,\
-            [\
-                {\
-                    \"span\":null,\
-                    \"token\":\"LParen\"\
-                },\
-                [\
+            {\
+                \"delim\":\"Paren\",\
+                \"open_span\":null,\
+                \"tts\":[\
                     {\
                         \"variant\":\"TtToken\",\
                         \"fields\":[\
@@ -907,23 +899,18 @@ mod test {
                         ]\
                     }\
                 ],\
-                {\
-                    \"span\":null,\
-                    \"token\":\"RParen\"\
-                }\
-            ]\
+                \"close_span\":null\
+            }\
         ]\
     },\
     {\
         \"variant\":\"TtDelimited\",\
         \"fields\":[\
             null,\
-            [\
-                {\
-                    \"span\":null,\
-                    \"token\":\"LBrace\"\
-                },\
-                [\
+            {\
+                \"delim\":\"Brace\",\
+                \"open_span\":null,\
+                \"tts\":[\
                     {\
                         \"variant\":\"TtToken\",\
                         \"fields\":[\
@@ -945,11 +932,8 @@ mod test {
                         ]\
                     }\
                 ],\
-                {\
-                    \"span\":null,\
-                    \"token\":\"RBrace\"\
-                }\
-            ]\
+                \"close_span\":null\
+            }\
         ]\
     }\
 ]".to_string()
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 8ef3a559bf41a..3911c68fa18f8 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -48,7 +48,7 @@ use ast::{StmtExpr, StmtSemi, StmtMac, StructDef, StructField};
 use ast::{StructVariantKind, BiSub};
 use ast::StrStyle;
 use ast::{SelfExplicit, SelfRegion, SelfStatic, SelfValue};
-use ast::{Delimiter, TokenTree, TraitItem, TraitRef, TtDelimited, TtSequence, TtToken};
+use ast::{Delimited, TokenTree, TraitItem, TraitRef, TtDelimited, TtSequence, TtToken};
 use ast::{TtNonterminal, TupleVariantKind, Ty, Ty_, TyBot};
 use ast::{TypeField, TyFixedLengthVec, TyClosure, TyProc, TyBareFn};
 use ast::{TyTypeof, TyInfer, TypeMethod};
@@ -474,15 +474,15 @@ impl<'a> Parser<'a> {
     /// recover (without consuming any expected input token).  Returns
     /// true if and only if input was consumed for recovery.
     pub fn check_for_erroneous_unit_struct_expecting(&mut self, expected: &[token::Token]) -> bool {
-        if self.token == token::LBrace
-            && expected.iter().all(|t| *t != token::LBrace)
-            && self.look_ahead(1, |t| *t == token::RBrace) {
+        if self.token == token::OpenDelim(token::Brace)
+            && expected.iter().all(|t| *t != token::OpenDelim(token::Brace))
+            && self.look_ahead(1, |t| *t == token::CloseDelim(token::Brace)) {
             // matched; signal non-fatal error and recover.
             let span = self.span;
             self.span_err(span,
                           "unit-like struct construction is written with no trailing `{ }`");
-            self.eat(&token::LBrace);
-            self.eat(&token::RBrace);
+            self.eat(&token::OpenDelim(token::Brace));
+            self.eat(&token::CloseDelim(token::Brace));
             true
         } else {
             false
@@ -1265,8 +1265,8 @@ impl<'a> Parser<'a> {
     /// Parse the items in a trait declaration
     pub fn parse_trait_items(&mut self) -> Vec<TraitItem> {
         self.parse_unspanned_seq(
-            &token::LBrace,
-            &token::RBrace,
+            &token::OpenDelim(token::Brace),
+            &token::CloseDelim(token::Brace),
             seq_sep_none(),
             |p| {
             let attrs = p.parse_outer_attributes();
@@ -1319,7 +1319,7 @@ impl<'a> Parser<'a> {
                         vis: vis,
                     })
                   }
-                  token::LBrace => {
+                  token::OpenDelim(token::Brace) => {
                     debug!("parse_trait_methods(): parsing provided method");
                     let (inner_attrs, body) =
                         p.parse_inner_attrs_and_block();
@@ -1411,9 +1411,9 @@ impl<'a> Parser<'a> {
 
         let lo = self.span.lo;
 
-        let t = if self.token == token::LParen {
+        let t = if self.token == token::OpenDelim(token::Paren) {
             self.bump();
-            if self.token == token::RParen {
+            if self.token == token::CloseDelim(token::Paren) {
                 self.bump();
                 TyNil
             } else {
@@ -1424,7 +1424,7 @@ impl<'a> Parser<'a> {
                 let mut one_tuple = false;
                 while self.token == token::Comma {
                     self.bump();
-                    if self.token != token::RParen {
+                    if self.token != token::CloseDelim(token::Paren) {
                         ts.push(self.parse_ty(true));
                     }
                     else {
@@ -1433,11 +1433,11 @@ impl<'a> Parser<'a> {
                 }
 
                 if ts.len() == 1 && !one_tuple {
-                    self.expect(&token::RParen);
+                    self.expect(&token::CloseDelim(token::Paren));
                     TyParen(ts.into_iter().nth(0).unwrap())
                 } else {
                     let t = TyTup(ts);
-                    self.expect(&token::RParen);
+                    self.expect(&token::CloseDelim(token::Paren));
                     t
                 }
             }
@@ -1446,7 +1446,7 @@ impl<'a> Parser<'a> {
             self.bump();
             let last_span = self.last_span;
             match self.token {
-                token::LBracket => self.obsolete(last_span, ObsoleteOwnedVector),
+                token::OpenDelim(token::Bracket) => self.obsolete(last_span, ObsoleteOwnedVector),
                 _ => self.obsolete(last_span, ObsoleteOwnedType)
             }
             TyUniq(self.parse_ty(false))
@@ -1454,9 +1454,9 @@ impl<'a> Parser<'a> {
             // STAR POINTER (bare pointer?)
             self.bump();
             TyPtr(self.parse_ptr())
-        } else if self.token == token::LBracket {
+        } else if self.token == token::OpenDelim(token::Bracket) {
             // VECTOR
-            self.expect(&token::LBracket);
+            self.expect(&token::OpenDelim(token::Bracket));
             let t = self.parse_ty(true);
 
             // Parse the `, ..e` in `[ int, ..e ]`
@@ -1465,7 +1465,7 @@ impl<'a> Parser<'a> {
                 None => TyVec(t),
                 Some(suffix) => TyFixedLengthVec(t, suffix)
             };
-            self.expect(&token::RBracket);
+            self.expect(&token::CloseDelim(token::Bracket));
             t
         } else if self.token == token::BinOp(token::And) ||
                 self.token == token::AndAnd {
@@ -1490,9 +1490,9 @@ impl<'a> Parser<'a> {
         } else if self.eat_keyword(keywords::Typeof) {
             // TYPEOF
             // In order to not be ambiguous, the type must be surrounded by parens.
-            self.expect(&token::LParen);
+            self.expect(&token::OpenDelim(token::Paren));
             let e = self.parse_expr();
-            self.expect(&token::RParen);
+            self.expect(&token::CloseDelim(token::Paren));
             TyTypeof(e)
         } else if self.eat_keyword(keywords::Proc) {
             self.parse_proc_type()
@@ -1661,7 +1661,7 @@ impl<'a> Parser<'a> {
                 LitBinary(parse::binary_lit(i.as_str())),
             token::LitBinaryRaw(i, _) =>
                 LitBinary(Rc::new(i.as_str().as_bytes().iter().map(|&x| x).collect())),
-            token::LParen => { self.expect(&token::RParen); LitNil },
+            token::OpenDelim(token::Paren) => { self.expect(&token::CloseDelim(token::Paren)); LitNil },
             _ => { self.unexpected_last(tok); }
         }
     }
@@ -2025,31 +2025,31 @@ impl<'a> Parser<'a> {
         let ex: Expr_;
 
         match self.token {
-            token::LParen => {
+            token::OpenDelim(token::Paren) => {
                 self.bump();
                 // (e) is parenthesized e
                 // (e,) is a tuple with only one field, e
                 let mut trailing_comma = false;
-                if self.token == token::RParen {
+                if self.token == token::CloseDelim(token::Paren) {
                     hi = self.span.hi;
                     self.bump();
                     let lit = P(spanned(lo, hi, LitNil));
                     return self.mk_expr(lo, hi, ExprLit(lit));
                 }
                 let mut es = vec!(self.parse_expr());
-                self.commit_expr(&**es.last().unwrap(), &[], &[token::Comma, token::RParen]);
+                self.commit_expr(&**es.last().unwrap(), &[], &[token::Comma, token::CloseDelim(token::Paren)]);
                 while self.token == token::Comma {
                     self.bump();
-                    if self.token != token::RParen {
+                    if self.token != token::CloseDelim(token::Paren) {
                         es.push(self.parse_expr());
                         self.commit_expr(&**es.last().unwrap(), &[],
-                                         &[token::Comma, token::RParen]);
+                                         &[token::Comma, token::CloseDelim(token::Paren)]);
                     } else {
                         trailing_comma = true;
                     }
                 }
                 hi = self.span.hi;
-                self.commit_expr_expecting(&**es.last().unwrap(), token::RParen);
+                self.commit_expr_expecting(&**es.last().unwrap(), token::CloseDelim(token::Paren));
 
                 return if es.len() == 1 && !trailing_comma {
                    self.mk_expr(lo, hi, ExprParen(es.into_iter().nth(0).unwrap()))
@@ -2057,7 +2057,7 @@ impl<'a> Parser<'a> {
                     self.mk_expr(lo, hi, ExprTup(es))
                 }
             },
-            token::LBrace => {
+            token::OpenDelim(token::Brace) => {
                 self.bump();
                 let blk = self.parse_block_tail(lo, DefaultBlock);
                 return self.mk_expr(blk.span.lo, blk.span.hi,
@@ -2077,10 +2077,10 @@ impl<'a> Parser<'a> {
                 ex = ExprPath(path);
                 hi = self.last_span.hi;
             }
-            token::LBracket => {
+            token::OpenDelim(token::Bracket) => {
                 self.bump();
 
-                if self.token == token::RBracket {
+                if self.token == token::CloseDelim(token::Bracket) {
                     // Empty vector.
                     self.bump();
                     ex = ExprVec(Vec::new());
@@ -2093,13 +2093,13 @@ impl<'a> Parser<'a> {
                         self.bump();
                         self.bump();
                         let count = self.parse_expr();
-                        self.expect(&token::RBracket);
+                        self.expect(&token::CloseDelim(token::Bracket));
                         ex = ExprRepeat(first_expr, count);
                     } else if self.token == token::Comma {
                         // Vector with two or more elements.
                         self.bump();
                         let remaining_exprs = self.parse_seq_to_end(
-                            &token::RBracket,
+                            &token::CloseDelim(token::Bracket),
                             seq_sep_trailing_allowed(token::Comma),
                             |p| p.parse_expr()
                                 );
@@ -2108,7 +2108,7 @@ impl<'a> Parser<'a> {
                         ex = ExprVec(exprs);
                     } else {
                         // Vector with one element.
-                        self.expect(&token::RBracket);
+                        self.expect(&token::CloseDelim(token::Bracket));
                         ex = ExprVec(vec!(first_expr));
                     }
                 }
@@ -2227,7 +2227,7 @@ impl<'a> Parser<'a> {
                                                            tts,
                                                            EMPTY_CTXT));
                     }
-                    if self.token == token::LBrace {
+                    if self.token == token::OpenDelim(token::Brace) {
                         // This is a struct literal, unless we're prohibited
                         // from parsing struct literals here.
                         if !self.restrictions.contains(RESTRICTION_NO_STRUCT_LITERAL) {
@@ -2236,7 +2236,7 @@ impl<'a> Parser<'a> {
                             let mut fields = Vec::new();
                             let mut base = None;
 
-                            while self.token != token::RBrace {
+                            while self.token != token::CloseDelim(token::Brace) {
                                 if self.eat(&token::DotDot) {
                                     base = Some(self.parse_expr());
                                     break;
@@ -2245,7 +2245,7 @@ impl<'a> Parser<'a> {
                                 fields.push(self.parse_field());
                                 self.commit_expr(&*fields.last().unwrap().expr,
                                                  &[token::Comma],
-                                                 &[token::RBrace]);
+                                                 &[token::CloseDelim(token::Brace)]);
                             }
 
                             if fields.len() == 0 && base.is_none() {
@@ -2258,7 +2258,7 @@ impl<'a> Parser<'a> {
                             }
 
                             hi = self.span.hi;
-                            self.expect(&token::RBrace);
+                            self.expect(&token::CloseDelim(token::Brace));
                             ex = ExprStruct(pth, fields, base);
                             return self.mk_expr(lo, hi, ex);
                         }
@@ -2281,7 +2281,7 @@ impl<'a> Parser<'a> {
     /// Parse a block or unsafe block
     pub fn parse_block_expr(&mut self, lo: BytePos, blk_mode: BlockCheckMode)
                             -> P<Expr> {
-        self.expect(&token::LBrace);
+        self.expect(&token::OpenDelim(token::Brace));
         let blk = self.parse_block_tail(lo, blk_mode);
         return self.mk_expr(blk.span.lo, blk.span.hi, ExprBlock(blk));
     }
@@ -2313,10 +2313,10 @@ impl<'a> Parser<'a> {
 
                     // expr.f() method call
                     match self.token {
-                        token::LParen => {
+                        token::OpenDelim(token::Paren) => {
                             let mut es = self.parse_unspanned_seq(
-                                &token::LParen,
-                                &token::RParen,
+                                &token::OpenDelim(token::Paren),
+                                &token::CloseDelim(token::Paren),
                                 seq_sep_trailing_allowed(token::Comma),
                                 |p| p.parse_expr()
                             );
@@ -2376,10 +2376,10 @@ impl<'a> Parser<'a> {
             if self.expr_is_complete(&*e) { break; }
             match self.token {
               // expr(...)
-              token::LParen => {
+              token::OpenDelim(token::Paren) => {
                 let es = self.parse_unspanned_seq(
-                    &token::LParen,
-                    &token::RParen,
+                    &token::OpenDelim(token::Paren),
+                    &token::CloseDelim(token::Paren),
                     seq_sep_trailing_allowed(token::Comma),
                     |p| p.parse_expr()
                 );
@@ -2393,7 +2393,7 @@ impl<'a> Parser<'a> {
               // Could be either an index expression or a slicing expression.
               // Any slicing non-terminal can have a mutable version with `mut`
               // after the opening square bracket.
-              token::LBracket => {
+              token::OpenDelim(token::Bracket) => {
                 self.bump();
                 let mutbl = if self.eat_keyword(keywords::Mut) {
                     MutMutable
@@ -2402,7 +2402,7 @@ impl<'a> Parser<'a> {
                 };
                 match self.token {
                     // e[]
-                    token::RBracket => {
+                    token::CloseDelim(token::Bracket) => {
                         self.bump();
                         hi = self.span.hi;
                         let slice = self.mk_slice(e, None, None, mutbl);
@@ -2413,7 +2413,7 @@ impl<'a> Parser<'a> {
                         self.bump();
                         match self.token {
                             // e[..]
-                            token::RBracket => {
+                            token::CloseDelim(token::Bracket) => {
                                 self.bump();
                                 hi = self.span.hi;
                                 let slice = self.mk_slice(e, None, None, mutbl);
@@ -2427,7 +2427,7 @@ impl<'a> Parser<'a> {
                             _ => {
                                 hi = self.span.hi;
                                 let e2 = self.parse_expr();
-                                self.commit_expr_expecting(&*e2, token::RBracket);
+                                self.commit_expr_expecting(&*e2, token::CloseDelim(token::Bracket));
                                 let slice = self.mk_slice(e, None, Some(e2), mutbl);
                                 e = self.mk_expr(lo, hi, slice)
                             }
@@ -2442,14 +2442,14 @@ impl<'a> Parser<'a> {
                                 self.bump();
                                 let e2 = match self.token {
                                     // e[e..]
-                                    token::RBracket => {
+                                    token::CloseDelim(token::Bracket) => {
                                         self.bump();
                                         None
                                     }
                                     // e[e..e]
                                     _ => {
                                         let e2 = self.parse_expr();
-                                        self.commit_expr_expecting(&*e2, token::RBracket);
+                                        self.commit_expr_expecting(&*e2, token::CloseDelim(token::Bracket));
                                         Some(e2)
                                     }
                                 };
@@ -2464,7 +2464,7 @@ impl<'a> Parser<'a> {
                                                   "`mut` keyword is invalid in index expressions");
                                 }
                                 hi = self.span.hi;
-                                self.commit_expr_expecting(&*ix, token::RBracket);
+                                self.commit_expr_expecting(&*ix, token::CloseDelim(token::Bracket));
                                 let index = self.mk_index(e, ix);
                                 e = self.mk_expr(lo, hi, index)
                             }
@@ -2525,7 +2525,7 @@ impl<'a> Parser<'a> {
         fn parse_non_delim_tt_tok(p: &mut Parser) -> TokenTree {
             maybe_whole!(deref p, NtTT);
             match p.token {
-              token::RParen | token::RBrace | token::RBracket => {
+              token::CloseDelim(_) => {
                   // This is a conservative error: only report the last unclosed delimiter. The
                   // previous unclosed delimiters could actually be closed! The parser just hasn't
                   // gotten to them yet.
@@ -2542,10 +2542,10 @@ impl<'a> Parser<'a> {
                 p.bump();
                 let sp = p.span;
 
-                if p.token == token::LParen {
+                if p.token == token::OpenDelim(token::Paren) {
                     let seq = p.parse_seq(
-                        &token::LParen,
-                        &token::RParen,
+                        &token::OpenDelim(token::Paren),
+                        &token::CloseDelim(token::Paren),
                         seq_sep_none(),
                         |p| p.parse_token_tree()
                     );
@@ -2564,8 +2564,8 @@ impl<'a> Parser<'a> {
             }
         }
 
-        match (&self.token, self.token.get_close_delimiter()) {
-            (&token::Eof, _) => {
+        match self.token {
+            token::Eof => {
                 let open_braces = self.open_braces.clone();
                 for sp in open_braces.iter() {
                     self.span_note(*sp, "Did you mean to close this delimiter?");
@@ -2573,36 +2573,39 @@ impl<'a> Parser<'a> {
                 // There shouldn't really be a span, but it's easier for the test runner
                 // if we give it one
                 self.fatal("this file contains an un-closed delimiter ");
-            }
-            (_, Some(close_delim)) => {
+            },
+            token::OpenDelim(delim) => {
                 // The span for beginning of the delimited section
                 let pre_span = self.span;
 
                 // Parse the open delimiter.
                 self.open_braces.push(self.span);
-                let open = Delimiter {
-                    span: self.span,
-                    token: self.bump_and_get(),
-                };
+                let open_span = self.span;
+                self.bump();
 
                 // Parse the token trees within the delimeters
                 let tts = self.parse_seq_to_before_end(
-                    &close_delim, seq_sep_none(), |p| p.parse_token_tree()
+                    &token::CloseDelim(delim),
+                    seq_sep_none(),
+                    |p| p.parse_token_tree()
                 );
 
                 // Parse the close delimiter.
-                let close = Delimiter {
-                    span: self.span,
-                    token: self.bump_and_get(),
-                };
+                let close_span = self.span;
+                self.bump();
                 self.open_braces.pop().unwrap();
 
                 // Expand to cover the entire delimited token tree
                 let span = Span { hi: self.span.hi, ..pre_span };
 
-                TtDelimited(span, Rc::new((open, tts, close)))
-            }
-            _ => parse_non_delim_tt_tok(self)
+                TtDelimited(span, Rc::new(Delimited {
+                    delim: delim,
+                    open_span: open_span,
+                    tts: tts,
+                    close_span: close_span,
+                }))
+            },
+            _ => parse_non_delim_tt_tok(self),
         }
     }
 
@@ -2641,8 +2644,8 @@ impl<'a> Parser<'a> {
         let mut lparens = 0u;
 
         while self.token != *ket || lparens > 0u {
-            if self.token == token::LParen { lparens += 1u; }
-            if self.token == token::RParen { lparens -= 1u; }
+            if self.token == token::OpenDelim(token::Paren) { lparens += 1u; }
+            if self.token == token::CloseDelim(token::Paren) { lparens -= 1u; }
             ret_val.push(self.parse_matcher(name_idx));
         }
 
@@ -2656,11 +2659,11 @@ impl<'a> Parser<'a> {
 
         let m = if self.token == token::Dollar {
             self.bump();
-            if self.token == token::LParen {
+            if self.token == token::OpenDelim(token::Paren) {
                 let name_idx_lo = *name_idx;
                 self.bump();
                 let ms = self.parse_matcher_subseq_upto(name_idx,
-                                                        &token::RParen);
+                                                        &token::CloseDelim(token::Paren));
                 if ms.len() == 0u {
                     self.fatal("repetition body must be nonempty");
                 }
@@ -2717,7 +2720,7 @@ impl<'a> Parser<'a> {
             self.bump();
             let last_span = self.last_span;
             match self.token {
-                token::LBracket => self.obsolete(last_span, ObsoleteOwnedVector),
+                token::OpenDelim(token::Bracket) => self.obsolete(last_span, ObsoleteOwnedVector),
                 _ => self.obsolete(last_span, ObsoleteOwnedExpr)
             }
 
@@ -2733,11 +2736,11 @@ impl<'a> Parser<'a> {
             self.bump();
 
             // Check for a place: `box(PLACE) EXPR`.
-            if self.eat(&token::LParen) {
+            if self.eat(&token::OpenDelim(token::Paren)) {
                 // Support `box() EXPR` as the default.
-                if !self.eat(&token::RParen) {
+                if !self.eat(&token::CloseDelim(token::Paren)) {
                     let place = self.parse_expr();
-                    self.expect(&token::RParen);
+                    self.expect(&token::CloseDelim(token::Paren));
                     let subexpression = self.parse_prefix_expr();
                     hi = subexpression.span.hi;
                     ex = ExprBox(place, subexpression);
@@ -2966,9 +2969,9 @@ impl<'a> Parser<'a> {
     fn parse_match_expr(&mut self) -> P<Expr> {
         let lo = self.last_span.lo;
         let discriminant = self.parse_expr_res(RESTRICTION_NO_STRUCT_LITERAL);
-        self.commit_expr_expecting(&*discriminant, token::LBrace);
+        self.commit_expr_expecting(&*discriminant, token::OpenDelim(token::Brace));
         let mut arms: Vec<Arm> = Vec::new();
-        while self.token != token::RBrace {
+        while self.token != token::CloseDelim(token::Brace) {
             arms.push(self.parse_arm());
         }
         let hi = self.span.hi;
@@ -2988,10 +2991,10 @@ impl<'a> Parser<'a> {
 
         let require_comma =
             !classify::expr_is_simple_block(&*expr)
-            && self.token != token::RBrace;
+            && self.token != token::CloseDelim(token::Brace);
 
         if require_comma {
-            self.commit_expr(&*expr, &[token::Comma], &[token::RBrace]);
+            self.commit_expr(&*expr, &[token::Comma], &[token::CloseDelim(token::Brace)]);
         } else {
             self.eat(&token::Comma);
         }
@@ -3047,7 +3050,7 @@ impl<'a> Parser<'a> {
         let mut first = true;
         let mut before_slice = true;
 
-        while self.token != token::RBracket {
+        while self.token != token::CloseDelim(token::Bracket) {
             if first {
                 first = false;
             } else {
@@ -3059,7 +3062,7 @@ impl<'a> Parser<'a> {
                     self.bump();
 
                     if self.token == token::Comma ||
-                            self.token == token::RBracket {
+                            self.token == token::CloseDelim(token::Bracket) {
                         slice = Some(P(ast::Pat {
                             id: ast::DUMMY_NODE_ID,
                             node: PatWild(PatWildMulti),
@@ -3095,13 +3098,13 @@ impl<'a> Parser<'a> {
         let mut fields = Vec::new();
         let mut etc = false;
         let mut first = true;
-        while self.token != token::RBrace {
+        while self.token != token::CloseDelim(token::Brace) {
             if first {
                 first = false;
             } else {
                 self.expect(&token::Comma);
                 // accept trailing commas
-                if self.token == token::RBrace { break }
+                if self.token == token::CloseDelim(token::Brace) { break }
             }
 
             let lo = self.span.lo;
@@ -3109,7 +3112,7 @@ impl<'a> Parser<'a> {
 
             if self.token == token::DotDot {
                 self.bump();
-                if self.token != token::RBrace {
+                if self.token != token::CloseDelim(token::Brace) {
                     let token_str = self.this_token_to_string();
                     self.fatal(format!("expected `{}`, found `{}`", "}",
                                        token_str).as_slice())
@@ -3205,10 +3208,10 @@ impl<'a> Parser<'a> {
                 span: mk_sp(lo, hi)
             })
           }
-          token::LParen => {
+          token::OpenDelim(token::Paren) => {
             // parse (pat,pat,pat,...) as tuple
             self.bump();
-            if self.token == token::RParen {
+            if self.token == token::CloseDelim(token::Paren) {
                 hi = self.span.hi;
                 self.bump();
                 let lit = P(codemap::Spanned {
@@ -3218,15 +3221,15 @@ impl<'a> Parser<'a> {
                 pat = PatLit(expr);
             } else {
                 let mut fields = vec!(self.parse_pat());
-                if self.look_ahead(1, |t| *t != token::RParen) {
+                if self.look_ahead(1, |t| *t != token::CloseDelim(token::Paren)) {
                     while self.token == token::Comma {
                         self.bump();
-                        if self.token == token::RParen { break; }
+                        if self.token == token::CloseDelim(token::Paren) { break; }
                         fields.push(self.parse_pat());
                     }
                 }
                 if fields.len() == 1 { self.expect(&token::Comma); }
-                self.expect(&token::RParen);
+                self.expect(&token::CloseDelim(token::Paren));
                 pat = PatTup(fields);
             }
             hi = self.last_span.hi;
@@ -3236,13 +3239,13 @@ impl<'a> Parser<'a> {
                 span: mk_sp(lo, hi)
             })
           }
-          token::LBracket => {
+          token::OpenDelim(token::Bracket) => {
             // parse [pat,pat,...] as vector pattern
             self.bump();
             let (before, slice, after) =
                 self.parse_pat_vec_elements();
 
-            self.expect(&token::RBracket);
+            self.expect(&token::CloseDelim(token::Bracket));
             pat = ast::PatVec(before, slice, after);
             hi = self.last_span.hi;
             return P(ast::Pat {
@@ -3266,7 +3269,7 @@ impl<'a> Parser<'a> {
             let val = self.parse_literal_maybe_minus();
             if (self.token == token::DotDotDot) &&
                     self.look_ahead(1, |t| {
-                        *t != token::Comma && *t != token::RBracket
+                        *t != token::Comma && *t != token::CloseDelim(token::Bracket)
                     }) {
                 self.bump();
                 let end = if self.token.is_ident() || self.token.is_path() {
@@ -3303,15 +3306,14 @@ impl<'a> Parser<'a> {
         } else {
             let can_be_enum_or_struct = self.look_ahead(1, |t| {
                 match *t {
-                    token::LParen | token::LBracket | token::Lt |
-                    token::LBrace | token::ModSep => true,
+                    token::OpenDelim(_) | token::Lt | token::ModSep => true,
                     _ => false,
                 }
             });
 
             if self.look_ahead(1, |t| *t == token::DotDotDot) &&
                     self.look_ahead(2, |t| {
-                        *t != token::Comma && *t != token::RBracket
+                        *t != token::Comma && *t != token::CloseDelim(token::Bracket)
                     }) {
                 let start = self.parse_expr_res(RESTRICTION_NO_BAR_OP);
                 self.eat(&token::DotDotDot);
@@ -3348,7 +3350,7 @@ impl<'a> Parser<'a> {
                 let enum_path = self.parse_path(LifetimeAndTypesWithColons)
                                     .path;
                 match self.token {
-                    token::LBrace => {
+                    token::OpenDelim(token::Brace) => {
                         self.bump();
                         let (fields, etc) =
                             self.parse_pat_fields();
@@ -3358,7 +3360,7 @@ impl<'a> Parser<'a> {
                     _ => {
                         let mut args: Vec<P<Pat>> = Vec::new();
                         match self.token {
-                          token::LParen => {
+                          token::OpenDelim(token::Paren) => {
                             let is_dotdot = self.look_ahead(1, |t| {
                                 match *t {
                                     token::DotDot => true,
@@ -3369,12 +3371,12 @@ impl<'a> Parser<'a> {
                                 // This is a "top constructor only" pat
                                 self.bump();
                                 self.bump();
-                                self.expect(&token::RParen);
+                                self.expect(&token::CloseDelim(token::Paren));
                                 pat = PatEnum(enum_path, None);
                             } else {
                                 args = self.parse_enum_variant_seq(
-                                    &token::LParen,
-                                    &token::RParen,
+                                    &token::OpenDelim(token::Paren),
+                                    &token::CloseDelim(token::Paren),
                                     seq_sep_trailing_allowed(token::Comma),
                                     |p| p.parse_pat()
                                 );
@@ -3443,7 +3445,7 @@ impl<'a> Parser<'a> {
         // leads to a parse error.  Note that if there is no explicit
         // binding mode then we do not end up here, because the lookahead
         // will direct us over to parse_enum_variant()
-        if self.token == token::LParen {
+        if self.token == token::OpenDelim(token::Paren) {
             let last_span = self.last_span;
             self.span_fatal(
                 last_span,
@@ -3632,7 +3634,7 @@ impl<'a> Parser<'a> {
         maybe_whole!(no_clone self, NtBlock);
 
         let lo = self.span.lo;
-        self.expect(&token::LBrace);
+        self.expect(&token::OpenDelim(token::Brace));
 
         return self.parse_block_tail_(lo, DefaultBlock, Vec::new());
     }
@@ -3644,7 +3646,7 @@ impl<'a> Parser<'a> {
         maybe_whole!(pair_empty self, NtBlock);
 
         let lo = self.span.lo;
-        self.expect(&token::LBrace);
+        self.expect(&token::OpenDelim(token::Brace));
         let (inner, next) = self.parse_inner_attrs_and_next();
 
         (inner, self.parse_block_tail_(lo, DefaultBlock, next))
@@ -3681,7 +3683,7 @@ impl<'a> Parser<'a> {
 
         let mut attributes_box = attrs_remaining;
 
-        while self.token != token::RBrace {
+        while self.token != token::CloseDelim(token::Brace) {
             // parsing items even when they're not allowed lets us give
             // better error messages and recover more gracefully.
             attributes_box.push_all(self.parse_outer_attributes().as_slice());
@@ -3695,7 +3697,7 @@ impl<'a> Parser<'a> {
                     }
                     self.bump(); // empty
                 }
-                token::RBrace => {
+                token::CloseDelim(token::Brace) => {
                     // fall through and out.
                 }
                 _ => {
@@ -3706,7 +3708,7 @@ impl<'a> Parser<'a> {
                             // expression without semicolon
                             if classify::expr_requires_semi_to_be_stmt(&*e) {
                                 // Just check for errors and recover; do not eat semicolon yet.
-                                self.commit_stmt(&[], &[token::Semi, token::RBrace]);
+                                self.commit_stmt(&[], &[token::Semi, token::CloseDelim(token::Brace)]);
                             }
 
                             match self.token {
@@ -3722,7 +3724,7 @@ impl<'a> Parser<'a> {
                                         span: span_with_semi,
                                     }));
                                 }
-                                token::RBrace => {
+                                token::CloseDelim(token::Brace) => {
                                     expr = Some(e);
                                 }
                                 _ => {
@@ -3743,7 +3745,7 @@ impl<'a> Parser<'a> {
                                     }));
                                     self.bump();
                                 }
-                                token::RBrace => {
+                                token::CloseDelim(token::Brace) => {
                                     // if a block ends in `m!(arg)` without
                                     // a `;`, it must be an expr
                                     expr = Some(
@@ -3838,10 +3840,10 @@ impl<'a> Parser<'a> {
                 token::ModSep | token::Ident(..) => {
                     let path =
                         self.parse_path(LifetimeAndTypesWithoutColons).path;
-                    if self.token == token::LParen {
+                    if self.token == token::OpenDelim(token::Paren) {
                         self.bump();
                         let inputs = self.parse_seq_to_end(
-                            &token::RParen,
+                            &token::CloseDelim(token::Paren),
                             seq_sep_trailing_allowed(token::Comma),
                             |p| p.parse_arg_general(false));
                         let (return_style, output) = self.parse_ret_ty();
@@ -4035,14 +4037,14 @@ impl<'a> Parser<'a> {
         let sp = self.span;
         let mut args: Vec<Option<Arg>> =
             self.parse_unspanned_seq(
-                &token::LParen,
-                &token::RParen,
+                &token::OpenDelim(token::Paren),
+                &token::CloseDelim(token::Paren),
                 seq_sep_trailing_allowed(token::Comma),
                 |p| {
                     if p.token == token::DotDotDot {
                         p.bump();
                         if allow_variadic {
-                            if p.token != token::RParen {
+                            if p.token != token::CloseDelim(token::Paren) {
                                 let span = p.span;
                                 p.span_fatal(span,
                                     "`...` must be last in argument list for variadic function");
@@ -4154,7 +4156,7 @@ impl<'a> Parser<'a> {
             }
         }
 
-        self.expect(&token::LParen);
+        self.expect(&token::OpenDelim(token::Paren));
 
         // A bit of complexity and lookahead is needed here in order to be
         // backwards compatible.
@@ -4249,14 +4251,14 @@ impl<'a> Parser<'a> {
                     self.bump();
                     let sep = seq_sep_trailing_allowed(token::Comma);
                     let mut fn_inputs = self.parse_seq_to_before_end(
-                        &token::RParen,
+                        &token::CloseDelim(token::Paren),
                         sep,
                         parse_arg_fn
                     );
                     fn_inputs.insert(0, Arg::new_self(explicit_self_sp, mutbl_self, $self_id));
                     fn_inputs
                 }
-                token::RParen => {
+                token::CloseDelim(token::Paren) => {
                     vec!(Arg::new_self(explicit_self_sp, mutbl_self, $self_id))
                 }
                 _ => {
@@ -4271,7 +4273,7 @@ impl<'a> Parser<'a> {
         let fn_inputs = match explicit_self {
             SelfStatic =>  {
                 let sep = seq_sep_trailing_allowed(token::Comma);
-                self.parse_seq_to_before_end(&token::RParen, sep, parse_arg_fn)
+                self.parse_seq_to_before_end(&token::CloseDelim(token::Paren), sep, parse_arg_fn)
             }
             SelfValue(id) => parse_remaining_arguments!(id),
             SelfRegion(_,_,id) => parse_remaining_arguments!(id),
@@ -4279,7 +4281,7 @@ impl<'a> Parser<'a> {
         };
 
 
-        self.expect(&token::RParen);
+        self.expect(&token::CloseDelim(token::Paren));
 
         let hi = self.span.hi;
 
@@ -4335,8 +4337,8 @@ impl<'a> Parser<'a> {
     /// Parses the `(arg, arg) -> return_type` header on a procedure.
     fn parse_proc_decl(&mut self) -> P<FnDecl> {
         let inputs =
-            self.parse_unspanned_seq(&token::LParen,
-                                     &token::RParen,
+            self.parse_unspanned_seq(&token::OpenDelim(token::Paren),
+                                     &token::CloseDelim(token::Paren),
                                      seq_sep_trailing_allowed(token::Comma),
                                      |p| p.parse_fn_block_arg());
 
@@ -4405,8 +4407,8 @@ impl<'a> Parser<'a> {
         let (method_, hi, new_attrs) = {
             if !self.token.is_any_keyword()
                 && self.look_ahead(1, |t| *t == token::Not)
-                && (self.look_ahead(2, |t| *t == token::LParen)
-                    || self.look_ahead(2, |t| *t == token::LBrace)) {
+                && (self.look_ahead(2, |t| *t == token::OpenDelim(token::Paren))
+                    || self.look_ahead(2, |t| *t == token::OpenDelim(token::Brace))) {
                 // method macro.
                 let pth = self.parse_path(NoTypesAllowed).path;
                 self.expect(&token::Not);
@@ -4484,10 +4486,10 @@ impl<'a> Parser<'a> {
 
     fn parse_impl_items(&mut self) -> (Vec<ImplItem>, Vec<Attribute>) {
         let mut impl_items = Vec::new();
-        self.expect(&token::LBrace);
+        self.expect(&token::OpenDelim(token::Brace));
         let (inner_attrs, mut method_attrs) =
             self.parse_inner_attrs_and_next();
-        while !self.eat(&token::RBrace) {
+        while !self.eat(&token::CloseDelim(token::Brace)) {
             method_attrs.extend(self.parse_outer_attributes().into_iter());
             let vis = self.parse_visibility();
             if self.eat_keyword(keywords::Type) {
@@ -4513,7 +4515,7 @@ impl<'a> Parser<'a> {
 
         // Special case: if the next identifier that follows is '(', don't
         // allow this to be parsed as a trait.
-        let could_be_trait = self.token != token::LParen;
+        let could_be_trait = self.token != token::OpenDelim(token::Paren);
 
         // Parse the trait.
         let mut ty = self.parse_ty(true);
@@ -4571,11 +4573,11 @@ impl<'a> Parser<'a> {
         let mut fields: Vec<StructField>;
         let is_tuple_like;
 
-        if self.eat(&token::LBrace) {
+        if self.eat(&token::OpenDelim(token::Brace)) {
             // It's a record-like struct.
             is_tuple_like = false;
             fields = Vec::new();
-            while self.token != token::RBrace {
+            while self.token != token::CloseDelim(token::Brace) {
                 fields.push(self.parse_struct_decl_field());
             }
             if fields.len() == 0 {
@@ -4584,12 +4586,12 @@ impl<'a> Parser<'a> {
                                    token::get_ident(class_name)).as_slice());
             }
             self.bump();
-        } else if self.token == token::LParen {
+        } else if self.token == token::OpenDelim(token::Paren) {
             // It's a tuple-like struct.
             is_tuple_like = true;
             fields = self.parse_unspanned_seq(
-                &token::LParen,
-                &token::RParen,
+                &token::OpenDelim(token::Paren),
+                &token::CloseDelim(token::Paren),
                 seq_sep_trailing_allowed(token::Comma),
                 |p| {
                 let attrs = p.parse_outer_attributes();
@@ -4639,7 +4641,7 @@ impl<'a> Parser<'a> {
             token::Comma => {
                 self.bump();
             }
-            token::RBrace => {}
+            token::CloseDelim(token::Brace) => {}
             _ => {
                 let span = self.span;
                 let token_str = self.this_token_to_string();
@@ -4771,13 +4773,13 @@ impl<'a> Parser<'a> {
             (id, m, Some(attrs))
         } else {
             self.push_mod_path(id, outer_attrs);
-            self.expect(&token::LBrace);
+            self.expect(&token::OpenDelim(token::Brace));
             let mod_inner_lo = self.span.lo;
             let old_owns_directory = self.owns_directory;
             self.owns_directory = true;
             let (inner, next) = self.parse_inner_attrs_and_next();
-            let m = self.parse_mod_items(token::RBrace, next, mod_inner_lo);
-            self.expect(&token::RBrace);
+            let m = self.parse_mod_items(token::CloseDelim(token::Brace), next, mod_inner_lo);
+            self.expect(&token::CloseDelim(token::Brace));
             self.owns_directory = old_owns_directory;
             self.pop_mod_path();
             (id, ItemMod(m), Some(inner))
@@ -4978,7 +4980,7 @@ impl<'a> Parser<'a> {
             self.span_err(last_span,
                           Parser::expected_item_err(attrs_remaining.as_slice()));
         }
-        assert!(self.token == token::RBrace);
+        assert!(self.token == token::CloseDelim(token::Brace));
         ast::ForeignMod {
             abi: abi,
             view_items: view_items,
@@ -5065,13 +5067,13 @@ impl<'a> Parser<'a> {
                               attrs: Vec<Attribute> )
                               -> ItemOrViewItem {
 
-        self.expect(&token::LBrace);
+        self.expect(&token::OpenDelim(token::Brace));
 
         let abi = opt_abi.unwrap_or(abi::C);
 
         let (inner, next) = self.parse_inner_attrs_and_next();
         let m = self.parse_foreign_mod_items(abi, next);
-        self.expect(&token::RBrace);
+        self.expect(&token::CloseDelim(token::Brace));
 
         let last_span = self.last_span;
         let item = self.mk_item(lo,
@@ -5098,7 +5100,7 @@ impl<'a> Parser<'a> {
     /// this should probably be renamed or refactored...
     fn parse_struct_def(&mut self) -> P<StructDef> {
         let mut fields: Vec<StructField> = Vec::new();
-        while self.token != token::RBrace {
+        while self.token != token::CloseDelim(token::Brace) {
             fields.push(self.parse_struct_decl_field());
         }
         self.bump();
@@ -5114,7 +5116,7 @@ impl<'a> Parser<'a> {
         let mut variants = Vec::new();
         let mut all_nullary = true;
         let mut any_disr = None;
-        while self.token != token::RBrace {
+        while self.token != token::CloseDelim(token::Brace) {
             let variant_attrs = self.parse_outer_attributes();
             let vlo = self.span.lo;
 
@@ -5125,15 +5127,15 @@ impl<'a> Parser<'a> {
             let mut args = Vec::new();
             let mut disr_expr = None;
             ident = self.parse_ident();
-            if self.eat(&token::LBrace) {
+            if self.eat(&token::OpenDelim(token::Brace)) {
                 // Parse a struct variant.
                 all_nullary = false;
                 kind = StructVariantKind(self.parse_struct_def());
-            } else if self.token == token::LParen {
+            } else if self.token == token::OpenDelim(token::Paren) {
                 all_nullary = false;
                 let arg_tys = self.parse_enum_variant_seq(
-                    &token::LParen,
-                    &token::RParen,
+                    &token::OpenDelim(token::Paren),
+                    &token::CloseDelim(token::Paren),
                     seq_sep_trailing_allowed(token::Comma),
                     |p| p.parse_ty(true)
                 );
@@ -5164,7 +5166,7 @@ impl<'a> Parser<'a> {
 
             if !self.eat(&token::Comma) { break; }
         }
-        self.expect(&token::RBrace);
+        self.expect(&token::CloseDelim(token::Brace));
         match any_disr {
             Some(disr_span) if !all_nullary =>
                 self.span_err(disr_span,
@@ -5180,7 +5182,7 @@ impl<'a> Parser<'a> {
         let id = self.parse_ident();
         let mut generics = self.parse_generics();
         self.parse_where_clause(&mut generics);
-        self.expect(&token::LBrace);
+        self.expect(&token::OpenDelim(token::Brace));
 
         let enum_definition = self.parse_enum_def(&generics);
         (id, ItemEnum(enum_definition, generics), None)
@@ -5188,7 +5190,7 @@ impl<'a> Parser<'a> {
 
     fn fn_expr_lookahead(tok: &token::Token) -> bool {
         match *tok {
-          token::LParen | token::At | token::Tilde | token::BinOp(_) => true,
+          token::OpenDelim(token::Paren) | token::At | token::Tilde | token::BinOp(_) => true,
           _ => false
         }
     }
@@ -5291,7 +5293,7 @@ impl<'a> Parser<'a> {
                                         visibility,
                                         maybe_append(attrs, extra_attrs));
                 return IoviItem(item);
-            } else if self.token == token::LBrace {
+            } else if self.token == token::OpenDelim(token::Brace) {
                 return self.parse_item_foreign_mod(lo, opt_abi, visibility, attrs);
             }
 
@@ -5356,7 +5358,7 @@ impl<'a> Parser<'a> {
             return IoviItem(item);
         }
         if self.token.is_keyword(keywords::Unsafe)
-            && self.look_ahead(1u, |t| *t != token::LBrace) {
+            && self.look_ahead(1u, |t| *t != token::OpenDelim(token::Brace)) {
             // UNSAFE FUNCTION ITEM
             self.bump();
             let abi = if self.eat_keyword(keywords::Extern) {
@@ -5486,8 +5488,8 @@ impl<'a> Parser<'a> {
         if macros_allowed && !self.token.is_any_keyword()
                 && self.look_ahead(1, |t| *t == token::Not)
                 && (self.look_ahead(2, |t| t.is_plain_ident())
-                    || self.look_ahead(2, |t| *t == token::LParen)
-                    || self.look_ahead(2, |t| *t == token::LBrace)) {
+                    || self.look_ahead(2, |t| *t == token::OpenDelim(token::Paren))
+                    || self.look_ahead(2, |t| *t == token::OpenDelim(token::Brace))) {
             // MACRO INVOCATION ITEM
 
             // item macro.
@@ -5573,10 +5575,11 @@ impl<'a> Parser<'a> {
     fn parse_view_path(&mut self) -> P<ViewPath> {
         let lo = self.span.lo;
 
-        if self.token == token::LBrace {
+        if self.token == token::OpenDelim(token::Brace) {
             // use {foo,bar}
             let idents = self.parse_unspanned_seq(
-                &token::LBrace, &token::RBrace,
+                &token::OpenDelim(token::Brace),
+                &token::CloseDelim(token::Brace),
                 seq_sep_trailing_allowed(token::Comma),
                 |p| p.parse_path_list_item());
             let path = ast::Path {
@@ -5631,10 +5634,10 @@ impl<'a> Parser<'a> {
                   }
 
                   // foo::bar::{a,b,c}
-                  token::LBrace => {
+                  token::OpenDelim(token::Brace) => {
                     let idents = self.parse_unspanned_seq(
-                        &token::LBrace,
-                        &token::RBrace,
+                        &token::OpenDelim(token::Brace),
+                        &token::CloseDelim(token::Brace),
                         seq_sep_trailing_allowed(token::Comma),
                         |p| p.parse_path_list_item()
                     );
@@ -5793,7 +5796,7 @@ impl<'a> Parser<'a> {
         loop {
             match self.parse_foreign_item(attrs, macros_allowed) {
                 IoviNone(returned_attrs) => {
-                    if self.token == token::RBrace {
+                    if self.token == token::CloseDelim(token::Brace) {
                         attrs = returned_attrs;
                         break
                     }
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 9ed8e4bc3a707..cc4fdcf01b4f4 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -56,12 +56,6 @@ use std::rc::Rc;
 #[cfg(stage0)] pub use self::RArrow         as RARROW;
 #[cfg(stage0)] pub use self::LArrow         as LARROW;
 #[cfg(stage0)] pub use self::FatArrow       as FAT_ARROW;
-#[cfg(stage0)] pub use self::LParen         as LPAREN;
-#[cfg(stage0)] pub use self::RParen         as RPAREN;
-#[cfg(stage0)] pub use self::LBracket       as LBRACKET;
-#[cfg(stage0)] pub use self::RBracket       as RBRACKET;
-#[cfg(stage0)] pub use self::LBrace         as LBRACE;
-#[cfg(stage0)] pub use self::RBrace         as RBRACE;
 #[cfg(stage0)] pub use self::Pound          as POUND;
 #[cfg(stage0)] pub use self::Dollar         as DOLLAR;
 #[cfg(stage0)] pub use self::Question       as QUESTION;
@@ -82,6 +76,12 @@ use std::rc::Rc;
 #[cfg(stage0)] pub use self::Comment        as COMMENT;
 #[cfg(stage0)] pub use self::Shebang        as SHEBANG;
 #[cfg(stage0)] pub use self::Eof            as EOF;
+#[cfg(stage0)] pub const LPAREN:    Token = OpenDelim(Paren);
+#[cfg(stage0)] pub const RPAREN:    Token = CloseDelim(Paren);
+#[cfg(stage0)] pub const LBRACKET:  Token = OpenDelim(Bracket);
+#[cfg(stage0)] pub const RBRACKET:  Token = CloseDelim(Bracket);
+#[cfg(stage0)] pub const LBRACE:    Token = OpenDelim(Brace);
+#[cfg(stage0)] pub const RBRACE:    Token = CloseDelim(Brace);
 
 #[allow(non_camel_case_types)]
 #[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
@@ -98,6 +98,17 @@ pub enum BinOpToken {
     Shr,
 }
 
+/// A delimeter token
+#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
+pub enum DelimToken {
+    /// A round parenthesis: `(` or `)`
+    Paren,
+    /// A square bracket: `[` or `]`
+    Bracket,
+    /// A curly brace: `{` or `}`
+    Brace,
+}
+
 #[cfg(stage0)]
 #[allow(non_uppercase_statics)]
 pub const ModName: bool = true;
@@ -143,15 +154,13 @@ pub enum Token {
     RArrow,
     LArrow,
     FatArrow,
-    LParen,
-    RParen,
-    LBracket,
-    RBracket,
-    LBrace,
-    RBrace,
     Pound,
     Dollar,
     Question,
+    /// An opening delimeter, eg. `{`
+    OpenDelim(DelimToken),
+    /// A closing delimeter, eg. `}`
+    CloseDelim(DelimToken),
 
     /* Literals */
     LitByte(ast::Name),
@@ -192,9 +201,7 @@ impl Token {
     /// Returns `true` if the token can appear at the start of an expression.
     pub fn can_begin_expr(&self) -> bool {
         match *self {
-            LParen                      => true,
-            LBrace                      => true,
-            LBracket                    => true,
+            OpenDelim(_)                => true,
             Ident(_, _)                 => true,
             Underscore                  => true,
             Tilde                       => true,
@@ -227,10 +234,10 @@ impl Token {
     /// otherwise `None`.
     pub fn get_close_delimiter(&self) -> Option<Token> {
         match *self {
-            LParen   => Some(RParen),
-            LBrace   => Some(RBrace),
-            LBracket => Some(RBracket),
-            _        => None,
+            OpenDelim(Paren)   => Some(CloseDelim(Paren)),
+            OpenDelim(Brace)   => Some(CloseDelim(Brace)),
+            OpenDelim(Bracket) => Some(CloseDelim(Bracket)),
+            _                  => None,
         }
     }
 
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index d347d0199a724..6df9fff0e6bb9 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -225,12 +225,12 @@ pub fn token_to_string(tok: &Token) -> String {
         token::RArrow               => "->".into_string(),
         token::LArrow               => "<-".into_string(),
         token::FatArrow             => "=>".into_string(),
-        token::LParen               => "(".into_string(),
-        token::RParen               => ")".into_string(),
-        token::LBracket             => "[".into_string(),
-        token::RBracket             => "]".into_string(),
-        token::LBrace               => "{".into_string(),
-        token::RBrace               => "}".into_string(),
+        token::OpenDelim(token::Paren) => "(".into_string(),
+        token::CloseDelim(token::Paren) => ")".into_string(),
+        token::OpenDelim(token::Bracket) => "[".into_string(),
+        token::CloseDelim(token::Bracket) => "]".into_string(),
+        token::OpenDelim(token::Brace) => "{".into_string(),
+        token::CloseDelim(token::Brace) => "}".into_string(),
         token::Pound                => "#".into_string(),
         token::Dollar               => "$".into_string(),
         token::Question             => "?".into_string(),
@@ -1121,12 +1121,11 @@ impl<'a> State<'a> {
     pub fn print_tt(&mut self, tt: &ast::TokenTree) -> IoResult<()> {
         match *tt {
             ast::TtDelimited(_, ref delimed) => {
-                let (ref open, ref tts, ref close) = **delimed;
-                try!(word(&mut self.s, token_to_string(&open.token).as_slice()));
+                try!(word(&mut self.s, token_to_string(&delimed.open_token()).as_slice()));
                 try!(space(&mut self.s));
-                try!(self.print_tts(tts.as_slice()));
+                try!(self.print_tts(delimed.tts.as_slice()));
                 try!(space(&mut self.s));
-                word(&mut self.s, token_to_string(&close.token).as_slice())
+                word(&mut self.s, token_to_string(&delimed.close_token()).as_slice())
             },
             ast::TtToken(_, ref tk) => {
                 try!(word(&mut self.s, token_to_string(tk).as_slice()));
diff --git a/src/test/compile-fail/removed-syntax-record.rs b/src/test/compile-fail/removed-syntax-record.rs
index b3fa04d8025bd..b31e2538ab97b 100644
--- a/src/test/compile-fail/removed-syntax-record.rs
+++ b/src/test/compile-fail/removed-syntax-record.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type t = { f: () }; //~ ERROR expected type, found token LBrace
+type t = { f: () }; //~ ERROR expected type, found token OpenDelim(Brace)

From 1ab50f3600ff52dcf97f0cd2b32f632988540b97 Mon Sep 17 00:00:00 2001
From: Brendan Zabarauskas <bjzaba@yahoo.com.au>
Date: Thu, 30 Oct 2014 01:47:53 +1100
Subject: [PATCH 22/34] Remove Token::get_close_delimiter

We can simplify these usages due to the new delimiter representation. `Parser::expect_open_delim` has been added for convenience.
---
 src/libsyntax/parse/parser.rs | 80 +++++++++++++++--------------------
 src/libsyntax/parse/token.rs  | 11 -----
 2 files changed, 33 insertions(+), 58 deletions(-)

diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 3911c68fa18f8..8bd984b60ed8f 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2013,6 +2013,16 @@ impl<'a> Parser<'a> {
         })
     }
 
+    fn expect_open_delim(&mut self) -> token::DelimToken {
+        match self.token {
+            token::OpenDelim(delim) => {
+                self.bump();
+                delim
+            },
+            _ => self.fatal("expected open delimiter"),
+        }
+    }
+
     /// At the bottom (top?) of the precedence hierarchy,
     /// parse things like parenthesized exprs,
     /// macros, return, etc.
@@ -2209,14 +2219,9 @@ impl<'a> Parser<'a> {
                         // MACRO INVOCATION expression
                         self.bump();
 
-                        let ket = self.token.get_close_delimiter()
-                            .unwrap_or_else(|| {
-                                self.fatal("expected open delimiter")
-                            });
-                        self.bump();
-
+                        let delim = self.expect_open_delim();
                         let tts = self.parse_seq_to_end(
-                            &ket,
+                            &token::CloseDelim(delim),
                             seq_sep_none(),
                             |p| p.parse_token_tree());
                         let hi = self.span.hi;
@@ -2624,13 +2629,8 @@ impl<'a> Parser<'a> {
         // the interpolation of Matcher's
         maybe_whole!(self, NtMatchers);
         let mut name_idx = 0u;
-        match self.token.get_close_delimiter() {
-            Some(other_delimiter) => {
-                self.bump();
-                self.parse_matcher_subseq_upto(&mut name_idx, &other_delimiter)
-            }
-            None => self.fatal("expected open delimiter")
-        }
+        let delim = self.expect_open_delim();
+        self.parse_matcher_subseq_upto(&mut name_idx, &token::CloseDelim(delim))
     }
 
     /// This goofy function is necessary to correctly match parens in Matcher's.
@@ -3325,11 +3325,8 @@ impl<'a> Parser<'a> {
                 let pth1 = codemap::Spanned{span:id_span, node: id};
                 if self.eat(&token::Not) {
                     // macro invocation
-                    let ket = self.token.get_close_delimiter()
-                                    .unwrap_or_else(|| self.fatal("expected open delimiter"));
-                    self.bump();
-
-                    let tts = self.parse_seq_to_end(&ket,
+                    let delim = self.expect_open_delim();
+                    let tts = self.parse_seq_to_end(&token::CloseDelim(delim),
                                                     seq_sep_none(),
                                                     |p| p.parse_token_tree());
 
@@ -3545,18 +3542,17 @@ impl<'a> Parser<'a> {
             let pth = self.parse_path(NoTypesAllowed).path;
             self.bump();
 
-            let id = if self.token.get_close_delimiter().is_some() {
-                token::special_idents::invalid // no special identifier
-            } else {
-                self.parse_ident()
+            let id = match self.token {
+                token::OpenDelim(_) => token::special_idents::invalid, // no special identifier
+                _ => self.parse_ident(),
             };
 
             // check that we're pointing at delimiters (need to check
             // again after the `if`, because of `parse_ident`
             // consuming more tokens).
-            let (bra, ket) = match self.token.get_close_delimiter() {
-                Some(ket) => (self.token.clone(), ket),
-                None      => {
+            let delim = match self.token {
+                token::OpenDelim(delim) => delim,
+                _ => {
                     // we only expect an ident if we didn't parse one
                     // above.
                     let ident_str = if id.name == token::special_idents::invalid.name {
@@ -3568,12 +3564,12 @@ impl<'a> Parser<'a> {
                     self.fatal(format!("expected {}`(` or `{{`, found `{}`",
                                        ident_str,
                                        tok_str).as_slice())
-                }
+                },
             };
 
             let tts = self.parse_unspanned_seq(
-                &bra,
-                &ket,
+                &token::OpenDelim(delim),
+                &token::CloseDelim(delim),
                 seq_sep_none(),
                 |p| p.parse_token_tree()
             );
@@ -4414,15 +4410,10 @@ impl<'a> Parser<'a> {
                 self.expect(&token::Not);
 
                 // eat a matched-delimiter token tree:
-                let tts = match self.token.get_close_delimiter() {
-                    Some(ket) => {
-                        self.bump();
-                        self.parse_seq_to_end(&ket,
-                                              seq_sep_none(),
-                                              |p| p.parse_token_tree())
-                    }
-                    None => self.fatal("expected open delimiter")
-                };
+                let delim = self.expect_open_delim();
+                let tts = self.parse_seq_to_end(&token::CloseDelim(delim),
+                                                seq_sep_none(),
+                                                |p| p.parse_token_tree());
                 let m_ = ast::MacInvocTT(pth, tts, EMPTY_CTXT);
                 let m: ast::Mac = codemap::Spanned { node: m_,
                                                  span: mk_sp(self.span.lo,
@@ -5505,15 +5496,10 @@ impl<'a> Parser<'a> {
                 token::special_idents::invalid // no special identifier
             };
             // eat a matched-delimiter token tree:
-            let tts = match self.token.get_close_delimiter() {
-                Some(ket) => {
-                    self.bump();
-                    self.parse_seq_to_end(&ket,
-                                          seq_sep_none(),
-                                          |p| p.parse_token_tree())
-                }
-                None => self.fatal("expected open delimiter")
-            };
+            let delim = self.expect_open_delim();
+            let tts = self.parse_seq_to_end(&token::CloseDelim(delim),
+                                            seq_sep_none(),
+                                            |p| p.parse_token_tree());
             // single-variant-enum... :
             let m = ast::MacInvocTT(pth, tts, EMPTY_CTXT);
             let m: ast::Mac = codemap::Spanned { node: m,
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index cc4fdcf01b4f4..2025b65835eec 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -230,17 +230,6 @@ impl Token {
         }
     }
 
-    /// Returns the matching close delimiter if this is an open delimiter,
-    /// otherwise `None`.
-    pub fn get_close_delimiter(&self) -> Option<Token> {
-        match *self {
-            OpenDelim(Paren)   => Some(CloseDelim(Paren)),
-            OpenDelim(Brace)   => Some(CloseDelim(Brace)),
-            OpenDelim(Bracket) => Some(CloseDelim(Bracket)),
-            _                  => None,
-        }
-    }
-
     /// Returns `true` if the token is any literal
     pub fn is_lit(&self) -> bool {
         match *self {

From 98a4770a981b779c06a08c642ccefc6c6b5c16a9 Mon Sep 17 00:00:00 2001
From: Brendan Zabarauskas <bjzaba@yahoo.com.au>
Date: Thu, 30 Oct 2014 08:44:41 +1100
Subject: [PATCH 23/34] Formatting fixes

---
 src/libsyntax/parse/parser.rs | 18 +++++++++++++-----
 src/libsyntax/parse/token.rs  | 16 ++++++++--------
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 8bd984b60ed8f..54730391d5636 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1661,7 +1661,10 @@ impl<'a> Parser<'a> {
                 LitBinary(parse::binary_lit(i.as_str())),
             token::LitBinaryRaw(i, _) =>
                 LitBinary(Rc::new(i.as_str().as_bytes().iter().map(|&x| x).collect())),
-            token::OpenDelim(token::Paren) => { self.expect(&token::CloseDelim(token::Paren)); LitNil },
+            token::OpenDelim(token::Paren) => {
+                self.expect(&token::CloseDelim(token::Paren));
+                LitNil
+            },
             _ => { self.unexpected_last(tok); }
         }
     }
@@ -2047,7 +2050,8 @@ impl<'a> Parser<'a> {
                     return self.mk_expr(lo, hi, ExprLit(lit));
                 }
                 let mut es = vec!(self.parse_expr());
-                self.commit_expr(&**es.last().unwrap(), &[], &[token::Comma, token::CloseDelim(token::Paren)]);
+                self.commit_expr(&**es.last().unwrap(), &[],
+                                 &[token::Comma, token::CloseDelim(token::Paren)]);
                 while self.token == token::Comma {
                     self.bump();
                     if self.token != token::CloseDelim(token::Paren) {
@@ -2454,7 +2458,8 @@ impl<'a> Parser<'a> {
                                     // e[e..e]
                                     _ => {
                                         let e2 = self.parse_expr();
-                                        self.commit_expr_expecting(&*e2, token::CloseDelim(token::Bracket));
+                                        self.commit_expr_expecting(&*e2,
+                                            token::CloseDelim(token::Bracket));
                                         Some(e2)
                                     }
                                 };
@@ -2720,7 +2725,9 @@ impl<'a> Parser<'a> {
             self.bump();
             let last_span = self.last_span;
             match self.token {
-                token::OpenDelim(token::Bracket) => self.obsolete(last_span, ObsoleteOwnedVector),
+                token::OpenDelim(token::Bracket) => {
+                    self.obsolete(last_span, ObsoleteOwnedVector)
+                },
                 _ => self.obsolete(last_span, ObsoleteOwnedExpr)
             }
 
@@ -3704,7 +3711,8 @@ impl<'a> Parser<'a> {
                             // expression without semicolon
                             if classify::expr_requires_semi_to_be_stmt(&*e) {
                                 // Just check for errors and recover; do not eat semicolon yet.
-                                self.commit_stmt(&[], &[token::Semi, token::CloseDelim(token::Brace)]);
+                                self.commit_stmt(&[], &[token::Semi,
+                                    token::CloseDelim(token::Brace)]);
                             }
 
                             match self.token {
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 2025b65835eec..641e38179498d 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -267,7 +267,7 @@ impl Token {
     pub fn is_plain_ident(&self) -> bool {
         match *self {
             Ident(_, Plain) => true,
-            _                    => false,
+            _               => false,
         }
     }
 
@@ -392,20 +392,20 @@ impl Token {
 #[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash)]
 /// For interpolation during macro expansion.
 pub enum Nonterminal {
-    NtItem( P<ast::Item>),
+    NtItem(P<ast::Item>),
     NtBlock(P<ast::Block>),
-    NtStmt( P<ast::Stmt>),
-    NtPat(  P<ast::Pat>),
-    NtExpr( P<ast::Expr>),
-    NtTy(   P<ast::Ty>),
+    NtStmt(P<ast::Stmt>),
+    NtPat(P<ast::Pat>),
+    NtExpr(P<ast::Expr>),
+    NtTy(P<ast::Ty>),
     #[cfg(stage0)]
     NtIdent(Box<ast::Ident>, bool),
     #[cfg(not(stage0))]
     NtIdent(Box<ast::Ident>, IdentStyle),
     /// Stuff inside brackets for attributes
-    NtMeta( P<ast::MetaItem>),
+    NtMeta(P<ast::MetaItem>),
     NtPath(Box<ast::Path>),
-    NtTT(   P<ast::TokenTree>), // needs P'ed to break a circularity
+    NtTT(P<ast::TokenTree>), // needs P'ed to break a circularity
     NtMatchers(Vec<ast::Matcher>)
 }
 

From 13d19bbf10068e0c8c0f42079e9ce18ca86ba108 Mon Sep 17 00:00:00 2001
From: Manish Goregaokar <manishsmail@gmail.com>
Date: Thu, 30 Oct 2014 04:58:34 +0530
Subject: [PATCH 24/34] Rename rust_fail to rust_panic

---
 src/doc/complement-bugreport.md | 2 +-
 src/librustrt/unwind.rs         | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/doc/complement-bugreport.md b/src/doc/complement-bugreport.md
index 1afd17d77d554..940a4ca6db7b3 100644
--- a/src/doc/complement-bugreport.md
+++ b/src/doc/complement-bugreport.md
@@ -47,7 +47,7 @@ release: 0.12.0
 ```
 
 Finally, if you can run the offending command under gdb, pasting a stack trace can be
-useful; to do so, you will need to set a breakpoint on `rust_fail`.
+useful; to do so, you will need to set a breakpoint on `rust_panic`.
 
 # I submitted a bug, but nobody has commented on it!
 
diff --git a/src/librustrt/unwind.rs b/src/librustrt/unwind.rs
index 8279b7d9654e4..c5fc0084ed932 100644
--- a/src/librustrt/unwind.rs
+++ b/src/librustrt/unwind.rs
@@ -177,7 +177,7 @@ pub unsafe fn try(f: ||) -> ::core::result::Result<(), Box<Any + Send>> {
 // An uninlined, unmangled function upon which to slap yer breakpoints
 #[inline(never)]
 #[no_mangle]
-fn rust_fail(cause: Box<Any + Send>) -> ! {
+fn rust_panic(cause: Box<Any + Send>) -> ! {
     rtdebug!("begin_unwind()");
 
     unsafe {
@@ -588,7 +588,7 @@ fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) ->
     // (hopefully someone printed something about this).
     let mut task: Box<Task> = match Local::try_take() {
         Some(task) => task,
-        None => rust_fail(msg),
+        None => rust_panic(msg),
     };
 
     if task.unwinder.unwinding {
@@ -605,7 +605,7 @@ fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) ->
     // requires the task. We need a handle to its unwinder, however, so after
     // this we unsafely extract it and continue along.
     Local::put(task);
-    rust_fail(msg);
+    rust_panic(msg);
 }
 
 /// Register a callback to be invoked when a task unwinds.

From 8e9f8f924cda8193ce1416c45cdcfce35fa6b8d1 Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Wed, 29 Oct 2014 15:26:29 -0700
Subject: [PATCH 25/34] collections: impl Deref for Vec/String

This commit adds the following impls:

    impl<T> Deref<[T]> for Vec<T>
    impl<T> DerefMut<[T]> for Vec<T>
    impl Deref<str> for String

This commit also removes all duplicated inherent methods from vectors and
strings as implementations will now silently call through to the slice
implementation. Some breakage occurred at std and beneath due to inherent
methods removed in favor of those in the slice traits and std doesn't use its
own prelude,

cc #18424
---
 src/libcollections/str.rs               |  69 -----
 src/libcollections/string.rs            |   5 +
 src/libcollections/vec.rs               | 383 ++----------------------
 src/libcoretest/str.rs                  |  69 +++++
 src/libgraphviz/maybe_owned_vec.rs      |   2 +-
 src/libstd/io/comm_adapters.rs          |   2 +-
 src/libstd/io/net/addrinfo.rs           |   1 +
 src/test/compile-fail/unique-vec-res.rs |   8 +-
 8 files changed, 102 insertions(+), 437 deletions(-)

diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index 9cd8bde4a95b3..7e59111607e8d 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -1677,40 +1677,6 @@ mod tests {
         assert_eq!(pos, p.len());
     }
 
-    #[test]
-    fn test_split_char_iterator() {
-        let data = "\nMäry häd ä little lämb\nLittle lämb\n";
-
-        let split: Vec<&str> = data.split(' ').collect();
-        assert_eq!( split, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
-
-        let mut rsplit: Vec<&str> = data.split(' ').rev().collect();
-        rsplit.reverse();
-        assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
-
-        let split: Vec<&str> = data.split(|c: char| c == ' ').collect();
-        assert_eq!( split, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
-
-        let mut rsplit: Vec<&str> = data.split(|c: char| c == ' ').rev().collect();
-        rsplit.reverse();
-        assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
-
-        // Unicode
-        let split: Vec<&str> = data.split('ä').collect();
-        assert_eq!( split, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
-
-        let mut rsplit: Vec<&str> = data.split('ä').rev().collect();
-        rsplit.reverse();
-        assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
-
-        let split: Vec<&str> = data.split(|c: char| c == 'ä').collect();
-        assert_eq!( split, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
-
-        let mut rsplit: Vec<&str> = data.split(|c: char| c == 'ä').rev().collect();
-        rsplit.reverse();
-        assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
-    }
-
     #[test]
     fn test_splitn_char_iterator() {
         let data = "\nMäry häd ä little lämb\nLittle lämb\n";
@@ -1729,28 +1695,6 @@ mod tests {
         assert_eq!(split, vec!["\nM", "ry h", "d ", " little lämb\nLittle lämb\n"]);
     }
 
-    #[test]
-    fn test_rsplitn_char_iterator() {
-        let data = "\nMäry häd ä little lämb\nLittle lämb\n";
-
-        let mut split: Vec<&str> = data.rsplitn(3, ' ').collect();
-        split.reverse();
-        assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
-
-        let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == ' ').collect();
-        split.reverse();
-        assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
-
-        // Unicode
-        let mut split: Vec<&str> = data.rsplitn(3, 'ä').collect();
-        split.reverse();
-        assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
-
-        let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == 'ä').collect();
-        split.reverse();
-        assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
-    }
-
     #[test]
     fn test_split_char_iterator_no_trailing() {
         let data = "\nMäry häd ä little lämb\nLittle lämb\n";
@@ -1762,19 +1706,6 @@ mod tests {
         assert_eq!(split, vec!["", "Märy häd ä little lämb", "Little lämb"]);
     }
 
-    #[test]
-    fn test_rev_split_char_iterator_no_trailing() {
-        let data = "\nMäry häd ä little lämb\nLittle lämb\n";
-
-        let mut split: Vec<&str> = data.split('\n').rev().collect();
-        split.reverse();
-        assert_eq!(split, vec!["", "Märy häd ä little lämb", "Little lämb", ""]);
-
-        let mut split: Vec<&str> = data.split_terminator('\n').rev().collect();
-        split.reverse();
-        assert_eq!(split, vec!["", "Märy häd ä little lämb", "Little lämb"]);
-    }
-
     #[test]
     fn test_words() {
         let data = "\n \tMäry   häd\tä  little lämb\nLittle lämb\n";
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index c44a03b05cd35..efe00975f9e5f 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -744,6 +744,11 @@ impl ops::Slice<uint, str> for String {
     }
 }
 
+#[experimental = "waiting on Deref stabilization"]
+impl ops::Deref<str> for String {
+    fn deref<'a>(&'a self) -> &'a str { self.as_slice() }
+}
+
 /// Wrapper type providing a `&String` reference via `Deref`.
 #[experimental]
 pub struct DerefString<'a> {
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index dd9883ecaae84..173f39a3151b1 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -28,8 +28,7 @@ use core::raw::Slice as RawSlice;
 use core::uint;
 
 use {Mutable, MutableSeq};
-use slice::{MutableOrdSlice, MutableSliceAllocating, CloneableVector};
-use slice::{Items, MutItems};
+use slice::{CloneableVector};
 
 /// An owned, growable vector.
 ///
@@ -464,6 +463,16 @@ impl<T> ops::SliceMut<uint, [T]> for Vec<T> {
     }
 }
 
+#[experimental = "waiting on Deref stability"]
+impl<T> ops::Deref<[T]> for Vec<T> {
+    fn deref<'a>(&'a self) -> &'a [T] { self.as_slice() }
+}
+
+#[experimental = "waiting on DerefMut stability"]
+impl<T> ops::DerefMut<[T]> for Vec<T> {
+    fn deref_mut<'a>(&'a mut self) -> &'a mut [T] { self.as_mut_slice() }
+}
+
 #[experimental = "waiting on FromIterator stability"]
 impl<T> FromIterator<T> for Vec<T> {
     #[inline]
@@ -717,7 +726,7 @@ impl<T> Vec<T> {
     #[deprecated = "use .extend(other.into_iter())"]
     #[cfg(stage0)]
     pub fn push_all_move(&mut self, other: Vec<T>) {
-            self.extend(other.into_iter());
+        self.extend(other.into_iter());
     }
 
     /// Returns a mutable slice of the elements of `self`.
@@ -735,7 +744,7 @@ impl<T> Vec<T> {
     pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
         unsafe {
             mem::transmute(RawSlice {
-                data: self.as_mut_ptr() as *const T,
+                data: self.ptr as *const T,
                 len: self.len,
             })
         }
@@ -809,124 +818,6 @@ impl<T> Vec<T> {
         &mut self.as_mut_slice()[index]
     }
 
-    /// Returns an iterator over references to the elements of the vector in
-    /// order.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let vec = vec![1i, 2, 3];
-    /// for num in vec.iter() {
-    ///     println!("{}", *num);
-    /// }
-    /// ```
-    #[inline]
-    pub fn iter<'a>(&'a self) -> Items<'a,T> {
-        self.as_slice().iter()
-    }
-
-    /// Returns an iterator over mutable references to the elements of the
-    /// vector in order.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let mut vec = vec![1i, 2, 3];
-    /// for num in vec.iter_mut() {
-    ///     *num = 0;
-    /// }
-    /// assert_eq!(vec, vec![0i, 0, 0]);
-    /// ```
-    #[inline]
-    pub fn iter_mut<'a>(&'a mut self) -> MutItems<'a,T> {
-        self.as_mut_slice().iter_mut()
-    }
-
-    /// Sorts the vector, in place, using `compare` to compare elements.
-    ///
-    /// This sort is `O(n log n)` worst-case and stable, but allocates
-    /// approximately `2 * n`, where `n` is the length of `self`.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let mut v = vec![5i, 4, 1, 3, 2];
-    /// v.sort_by(|a, b| a.cmp(b));
-    /// assert_eq!(v, vec![1i, 2, 3, 4, 5]);
-    ///
-    /// // reverse sorting
-    /// v.sort_by(|a, b| b.cmp(a));
-    /// assert_eq!(v, vec![5i, 4, 3, 2, 1]);
-    /// ```
-    #[inline]
-    pub fn sort_by(&mut self, compare: |&T, &T| -> Ordering) {
-        self.as_mut_slice().sort_by(compare)
-    }
-
-    /// Returns a slice of self spanning the interval [`start`, `end`).
-    ///
-    /// # Failure
-    ///
-    /// Fails when the slice (or part of it) is outside the bounds of self, or when
-    /// `start` > `end`.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let vec = vec![1i, 2, 3, 4];
-    /// assert!(vec[0..2] == [1, 2]);
-    /// ```
-    #[inline]
-    pub fn slice<'a>(&'a self, start: uint, end: uint) -> &'a [T] {
-        self[start..end]
-    }
-
-    /// Returns a slice containing all but the first element of the vector.
-    ///
-    /// # Failure
-    ///
-    /// Fails when the vector is empty.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let vec = vec![1i, 2, 3];
-    /// assert!(vec.tail() == [2, 3]);
-    /// ```
-    #[inline]
-    pub fn tail<'a>(&'a self) -> &'a [T] {
-        self[].tail()
-    }
-
-    /// Returns a reference to the last element of a vector, or `None` if it is
-    /// empty.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let vec = vec![1i, 2, 3];
-    /// assert!(vec.last() == Some(&3));
-    /// ```
-    #[inline]
-    pub fn last<'a>(&'a self) -> Option<&'a T> {
-        self[].last()
-    }
-
-    /// Returns a mutable reference to the last element of a vector, or `None`
-    /// if it is empty.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let mut vec = vec![1i, 2, 3];
-    /// *vec.last_mut().unwrap() = 4;
-    /// assert_eq!(vec, vec![1i, 2, 4]);
-    /// ```
-    #[inline]
-    pub fn last_mut<'a>(&'a mut self) -> Option<&'a mut T> {
-        self.as_mut_slice().last_mut()
-    }
-
     /// Removes an element from anywhere in the vector and return it, replacing
     /// it with the last element. This does not preserve ordering, but is O(1).
     ///
@@ -1035,215 +926,6 @@ impl<T> Vec<T> {
         }
     }
 
-    /// Returns a mutable slice of `self` between `start` and `end`.
-    ///
-    /// # Failure
-    ///
-    /// Fails when `start` or `end` point outside the bounds of `self`, or when
-    /// `start` > `end`.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let mut vec = vec![1i, 2, 3, 4];
-    /// assert!(vec[mut 0..2] == [1, 2]);
-    /// ```
-    #[inline]
-    pub fn slice_mut<'a>(&'a mut self, start: uint, end: uint)
-                         -> &'a mut [T] {
-        self[mut start..end]
-    }
-
-    /// Returns a mutable slice of `self` from `start` to the end of the `Vec`.
-    ///
-    /// # Failure
-    ///
-    /// Fails when `start` points outside the bounds of self.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let mut vec = vec![1i, 2, 3, 4];
-    /// assert!(vec[mut 2..] == [3, 4]);
-    /// ```
-    #[inline]
-    pub fn slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] {
-        self[mut start..]
-    }
-
-    /// Returns a mutable slice of `self` from the start of the `Vec` to `end`.
-    ///
-    /// # Failure
-    ///
-    /// Fails when `end` points outside the bounds of self.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let mut vec = vec![1i, 2, 3, 4];
-    /// assert!(vec[mut ..2] == [1, 2]);
-    /// ```
-    #[inline]
-    pub fn slice_to_mut<'a>(&'a mut self, end: uint) -> &'a mut [T] {
-        self[mut ..end]
-    }
-
-    /// Returns a pair of mutable slices that divides the `Vec` at an index.
-    ///
-    /// The first will contain all indices from `[0, mid)` (excluding
-    /// the index `mid` itself) and the second will contain all
-    /// indices from `[mid, len)` (excluding the index `len` itself).
-    ///
-    /// # Failure
-    ///
-    /// Fails if `mid > len`.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let mut vec = vec![1i, 2, 3, 4, 5, 6];
-    ///
-    /// // scoped to restrict the lifetime of the borrows
-    /// {
-    ///    let (left, right) = vec.split_at_mut(0);
-    ///    assert!(left == &mut []);
-    ///    assert!(right == &mut [1, 2, 3, 4, 5, 6]);
-    /// }
-    ///
-    /// {
-    ///     let (left, right) = vec.split_at_mut(2);
-    ///     assert!(left == &mut [1, 2]);
-    ///     assert!(right == &mut [3, 4, 5, 6]);
-    /// }
-    ///
-    /// {
-    ///     let (left, right) = vec.split_at_mut(6);
-    ///     assert!(left == &mut [1, 2, 3, 4, 5, 6]);
-    ///     assert!(right == &mut []);
-    /// }
-    /// ```
-    #[inline]
-    pub fn split_at_mut<'a>(&'a mut self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
-        self[mut].split_at_mut(mid)
-    }
-
-    /// Reverses the order of elements in a vector, in place.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let mut v = vec![1i, 2, 3];
-    /// v.reverse();
-    /// assert_eq!(v, vec![3i, 2, 1]);
-    /// ```
-    #[inline]
-    pub fn reverse(&mut self) {
-        self[mut].reverse()
-    }
-
-    /// Returns a slice of `self` from `start` to the end of the vec.
-    ///
-    /// # Failure
-    ///
-    /// Fails when `start` points outside the bounds of self.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let vec = vec![1i, 2, 3];
-    /// assert!(vec[1..] == [2, 3]);
-    /// ```
-    #[inline]
-    pub fn slice_from<'a>(&'a self, start: uint) -> &'a [T] {
-        self[start..]
-    }
-
-    /// Returns a slice of self from the start of the vec to `end`.
-    ///
-    /// # Failure
-    ///
-    /// Fails when `end` points outside the bounds of self.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let vec = vec![1i, 2, 3, 4];
-    /// assert!(vec[..2] == [1, 2]);
-    /// ```
-    #[inline]
-    pub fn slice_to<'a>(&'a self, end: uint) -> &'a [T] {
-        self[..end]
-    }
-
-    /// Returns a slice containing all but the last element of the vector.
-    ///
-    /// # Failure
-    ///
-    /// Fails if the vector is empty
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let vec = vec![1i, 2, 3];
-    /// assert!(vec.init() == [1, 2]);
-    /// ```
-    #[inline]
-    pub fn init<'a>(&'a self) -> &'a [T] {
-        self[0..self.len() - 1]
-    }
-
-
-    /// Returns an unsafe pointer to the vector's buffer.
-    ///
-    /// The caller must ensure that the vector outlives the pointer this
-    /// function returns, or else it will end up pointing to garbage.
-    ///
-    /// Modifying the vector may cause its buffer to be reallocated, which
-    /// would also make any pointers to it invalid.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let v = vec![1i, 2, 3];
-    /// let p = v.as_ptr();
-    /// unsafe {
-    ///     // Examine each element manually
-    ///     assert_eq!(*p, 1i);
-    ///     assert_eq!(*p.offset(1), 2i);
-    ///     assert_eq!(*p.offset(2), 3i);
-    /// }
-    /// ```
-    #[inline]
-    pub fn as_ptr(&self) -> *const T {
-        self.ptr as *const T
-    }
-
-    /// Returns a mutable unsafe pointer to the vector's buffer.
-    ///
-    /// The caller must ensure that the vector outlives the pointer this
-    /// function returns, or else it will end up pointing to garbage.
-    ///
-    /// Modifying the vector may cause its buffer to be reallocated, which
-    /// would also make any pointers to it invalid.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// use std::ptr;
-    ///
-    /// let mut v = vec![1i, 2, 3];
-    /// let p = v.as_mut_ptr();
-    /// unsafe {
-    ///     ptr::write(p, 9i);
-    ///     ptr::write(p.offset(2), 5i);
-    /// }
-    /// assert_eq!(v, vec![9i, 2, 5]);
-    /// ```
-    #[inline]
-    pub fn as_mut_ptr(&mut self) -> *mut T {
-        self.ptr
-    }
-
     /// Retains only the elements specified by the predicate.
     ///
     /// In other words, remove all elements `e` such that `f(&e)` returns false.
@@ -1297,24 +979,6 @@ impl<T> Vec<T> {
     }
 }
 
-impl<T:Ord> Vec<T> {
-    /// Sorts the vector in place.
-    ///
-    /// This sort is `O(n log n)` worst-case and stable, but allocates
-    /// approximately `2 * n`, where `n` is the length of `self`.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let mut vec = vec![3i, 1, 2];
-    /// vec.sort();
-    /// assert_eq!(vec, vec![1, 2, 3]);
-    /// ```
-    pub fn sort(&mut self) {
-        self.as_mut_slice().sort()
-    }
-}
-
 #[experimental = "waiting on Mutable stability"]
 impl<T> Mutable for Vec<T> {
     #[inline]
@@ -1325,19 +989,6 @@ impl<T> Mutable for Vec<T> {
 }
 
 impl<T: PartialEq> Vec<T> {
-    /// Returns true if a vector contains an element equal to the given value.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// let vec = vec![1i, 2, 3];
-    /// assert!(vec.contains(&1));
-    /// ```
-    #[inline]
-    pub fn contains(&self, x: &T) -> bool {
-        self.as_slice().contains(x)
-    }
-
     /// Removes consecutive repeated elements in the vector.
     ///
     /// If the vector is sorted, this removes all duplicates.
@@ -1449,7 +1100,12 @@ impl<T> AsSlice<T> for Vec<T> {
     #[inline]
     #[stable]
     fn as_slice<'a>(&'a self) -> &'a [T] {
-        unsafe { mem::transmute(RawSlice { data: self.as_ptr(), len: self.len }) }
+        unsafe {
+            mem::transmute(RawSlice {
+                data: self.ptr as *const T,
+                len: self.len
+            })
+        }
     }
 }
 
@@ -1697,6 +1353,7 @@ pub fn as_vec<'a, T>(x: &'a [T]) -> DerefVec<'a, T> {
 pub mod raw {
     use super::Vec;
     use core::ptr;
+    use core::slice::MutableSlice;
 
     /// Constructs a vector from an unsafe pointer to a buffer.
     ///
diff --git a/src/libcoretest/str.rs b/src/libcoretest/str.rs
index 51bd72ec0148a..d3f77c47c44bc 100644
--- a/src/libcoretest/str.rs
+++ b/src/libcoretest/str.rs
@@ -38,3 +38,72 @@ fn test_strslice_contains() {
     let x = "There are moments, Jeeves, when one asks oneself, 'Do trousers matter?'";
     check_contains_all_substrings(x);
 }
+
+#[test]
+fn test_rsplitn_char_iterator() {
+    let data = "\nMäry häd ä little lämb\nLittle lämb\n";
+
+    let mut split: Vec<&str> = data.rsplitn(3, ' ').collect();
+    split.reverse();
+    assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
+
+    let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == ' ').collect();
+    split.reverse();
+    assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
+
+    // Unicode
+    let mut split: Vec<&str> = data.rsplitn(3, 'ä').collect();
+    split.reverse();
+    assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
+
+    let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == 'ä').collect();
+    split.reverse();
+    assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
+}
+
+#[test]
+fn test_split_char_iterator() {
+    let data = "\nMäry häd ä little lämb\nLittle lämb\n";
+
+    let split: Vec<&str> = data.split(' ').collect();
+    assert_eq!( split, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
+
+    let mut rsplit: Vec<&str> = data.split(' ').rev().collect();
+    rsplit.reverse();
+    assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
+
+    let split: Vec<&str> = data.split(|c: char| c == ' ').collect();
+    assert_eq!( split, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
+
+    let mut rsplit: Vec<&str> = data.split(|c: char| c == ' ').rev().collect();
+    rsplit.reverse();
+    assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]);
+
+    // Unicode
+    let split: Vec<&str> = data.split('ä').collect();
+    assert_eq!( split, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
+
+    let mut rsplit: Vec<&str> = data.split('ä').rev().collect();
+    rsplit.reverse();
+    assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
+
+    let split: Vec<&str> = data.split(|c: char| c == 'ä').collect();
+    assert_eq!( split, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
+
+    let mut rsplit: Vec<&str> = data.split(|c: char| c == 'ä').rev().collect();
+    rsplit.reverse();
+    assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]);
+}
+
+#[test]
+fn test_rev_split_char_iterator_no_trailing() {
+    let data = "\nMäry häd ä little lämb\nLittle lämb\n";
+
+    let mut split: Vec<&str> = data.split('\n').rev().collect();
+    split.reverse();
+    assert_eq!(split, vec!["", "Märy häd ä little lämb", "Little lämb", ""]);
+
+    let mut split: Vec<&str> = data.split_terminator('\n').rev().collect();
+    split.reverse();
+    assert_eq!(split, vec!["", "Märy häd ä little lämb", "Little lämb"]);
+}
diff --git a/src/libgraphviz/maybe_owned_vec.rs b/src/libgraphviz/maybe_owned_vec.rs
index c7659dc1b9fd7..a4d794d1f99fb 100644
--- a/src/libgraphviz/maybe_owned_vec.rs
+++ b/src/libgraphviz/maybe_owned_vec.rs
@@ -58,7 +58,7 @@ impl<'a,T> IntoMaybeOwnedVector<'a,T> for &'a [T] {
 impl<'a,T> MaybeOwnedVector<'a,T> {
     pub fn iter(&'a self) -> slice::Items<'a,T> {
         match self {
-            &Growable(ref v) => v.iter(),
+            &Growable(ref v) => v.as_slice().iter(),
             &Borrowed(ref v) => v.iter(),
         }
     }
diff --git a/src/libstd/io/comm_adapters.rs b/src/libstd/io/comm_adapters.rs
index bd9577c8cfc8c..338d293fa0a97 100644
--- a/src/libstd/io/comm_adapters.rs
+++ b/src/libstd/io/comm_adapters.rs
@@ -15,7 +15,7 @@ use comm::{Sender, Receiver};
 use io;
 use option::{None, Some};
 use result::{Ok, Err};
-use slice::{bytes, CloneableVector};
+use slice::{bytes, CloneableVector, ImmutableSlice};
 use super::{Buffer, Reader, Writer, IoResult};
 use vec::Vec;
 
diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs
index 9d85701eb2984..eaf47bb004cf6 100644
--- a/src/libstd/io/net/addrinfo.rs
+++ b/src/libstd/io/net/addrinfo.rs
@@ -125,6 +125,7 @@ fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>)
 // permission without help of apk
 #[cfg(all(test, not(target_os = "android")))]
 mod test {
+    use prelude::*;
     use super::*;
     use io::net::ip::*;
 
diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs
index 62fabc0b33f3d..ba39f3e0d176d 100644
--- a/src/test/compile-fail/unique-vec-res.rs
+++ b/src/test/compile-fail/unique-vec-res.rs
@@ -29,14 +29,16 @@ impl<'a> Drop for r<'a> {
 fn f<T>(_i: Vec<T> , _j: Vec<T> ) {
 }
 
+fn clone<T: Clone>(t: &T) -> T { t.clone() }
+
 fn main() {
     let i1 = &Cell::new(0);
     let i2 = &Cell::new(1);
     let r1 = vec!(box r { i: i1 });
     let r2 = vec!(box r { i: i2 });
-    f(r1.clone(), r2.clone());
-    //~^ ERROR does not implement any method in scope named `clone`
-    //~^^ ERROR does not implement any method in scope named `clone`
+    f(clone(&r1), clone(&r2));
+    //~^ ERROR the trait `core::clone::Clone` is not implemented for the type
+    //~^^ ERROR the trait `core::clone::Clone` is not implemented for the type
     println!("{}", (r2, i1.get()));
     println!("{}", (r1, i2.get()));
 }

From a0ee7c9f55b90a541db1f6f36d18562bdf5ef6bf Mon Sep 17 00:00:00 2001
From: P1start <rewi-github@whanau.org>
Date: Sat, 11 Oct 2014 14:27:37 +1300
Subject: [PATCH 26/34] Remove `unused_extern_crate` and `unused_result` from
 the `unused` lint group

These lints are allow by default because they are sometimes too sensitive.
---
 src/librustc/lint/context.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs
index 8e4095df45a8f..0c9e129ef72f0 100644
--- a/src/librustc/lint/context.rs
+++ b/src/librustc/lint/context.rs
@@ -221,8 +221,8 @@ impl LintStore {
 
         add_lint_group!(sess, "unused",
                         UNUSED_IMPORTS, UNUSED_VARIABLES, UNUSED_ASSIGNMENTS, DEAD_CODE,
-                        UNUSED_MUT, UNREACHABLE_CODE, UNUSED_EXTERN_CRATES, UNUSED_MUST_USE,
-                        UNUSED_UNSAFE, UNUSED_RESULTS, PATH_STATEMENTS)
+                        UNUSED_MUT, UNREACHABLE_CODE, UNUSED_MUST_USE,
+                        UNUSED_UNSAFE, PATH_STATEMENTS)
 
         // We have one lint pass defined in this module.
         self.register_pass(sess, false, box GatherNodeLevels as LintPassObject);

From 2a7be1b209a4ceea42418f55baf68774571ed9a2 Mon Sep 17 00:00:00 2001
From: P1start <rewi-github@whanau.org>
Date: Sat, 11 Oct 2014 14:34:45 +1300
Subject: [PATCH 27/34] Fix a minor issue with how lint groups are printed by
 rustc

---
 src/librustc/driver/mod.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/librustc/driver/mod.rs b/src/librustc/driver/mod.rs
index fbdc0db166524..028d0ec607ab6 100644
--- a/src/librustc/driver/mod.rs
+++ b/src/librustc/driver/mod.rs
@@ -255,7 +255,8 @@ Available lint options:
         for (name, to) in lints.into_iter() {
             let name = name.chars().map(|x| x.to_lowercase())
                            .collect::<String>().replace("_", "-");
-            let desc = to.into_iter().map(|x| x.as_str()).collect::<Vec<String>>().connect(", ");
+            let desc = to.into_iter().map(|x| x.as_str().replace("_", "-"))
+                         .collect::<Vec<String>>().connect(", ");
             println!("    {}  {}",
                      padded(name.as_slice()), desc);
         }

From fb00015246824313e8882935c9ba175ea6daf9d4 Mon Sep 17 00:00:00 2001
From: P1start <rewi-github@whanau.org>
Date: Sun, 26 Oct 2014 12:07:54 +1300
Subject: [PATCH 28/34] Improve the error message for parenthesised box
 expressions

Closes #15386.
---
 src/libsyntax/parse/parser.rs                      | 14 ++++++++++++++
 .../compile-fail/parenthesized-box-expr-message.rs | 14 ++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 src/test/compile-fail/parenthesized-box-expr-message.rs

diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 8ef3a559bf41a..d9dd37fcb4f4e 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2730,6 +2730,8 @@ impl<'a> Parser<'a> {
                 return self.parse_dot_or_call_expr();
             }
 
+            let lo = self.span.lo;
+
             self.bump();
 
             // Check for a place: `box(PLACE) EXPR`.
@@ -2738,6 +2740,18 @@ impl<'a> Parser<'a> {
                 if !self.eat(&token::RParen) {
                     let place = self.parse_expr();
                     self.expect(&token::RParen);
+                    // Give a suggestion to use `box()` when a parenthesised expression is used
+                    if !self.token.can_begin_expr() {
+                        let span = self.span;
+                        let this_token_to_string = self.this_token_to_string();
+                        self.span_err(span,
+                                      format!("expected expression, found `{}`",
+                                              this_token_to_string).as_slice());
+                        let box_span = mk_sp(lo, self.last_span.hi);
+                        self.span_help(box_span,
+                                       "perhaps you meant `box() (foo)` instead?");
+                        self.abort_if_errors();
+                    }
                     let subexpression = self.parse_prefix_expr();
                     hi = subexpression.span.hi;
                     ex = ExprBox(place, subexpression);
diff --git a/src/test/compile-fail/parenthesized-box-expr-message.rs b/src/test/compile-fail/parenthesized-box-expr-message.rs
new file mode 100644
index 0000000000000..05bbaec37af02
--- /dev/null
+++ b/src/test/compile-fail/parenthesized-box-expr-message.rs
@@ -0,0 +1,14 @@
+// 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 main() {
+    box(1 + 1) //~ HELP perhaps you meant `box() (foo)` instead?
+    ; //~ ERROR expected expression, found `;`
+}

From 8384dd93571181047f0461379e7ec49e5305b178 Mon Sep 17 00:00:00 2001
From: Brian Koropoff <bkoropoff@gmail.com>
Date: Wed, 29 Oct 2014 21:45:35 -0700
Subject: [PATCH 29/34] Fix ICE translating array repeat expr of non-Copy type

The type checker permits an array repeat expression of non-Copy
type if the count is 1, but trans asserts on it prior to this
change.

Closes #18425
---
 src/librustc/middle/trans/tvec.rs | 35 ++++++++++++++-----------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs
index 5c8287c0030d4..60c38af3e72ab 100644
--- a/src/librustc/middle/trans/tvec.rs
+++ b/src/librustc/middle/trans/tvec.rs
@@ -310,26 +310,23 @@ pub fn write_content<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                     return expr::trans_into(bcx, &**element, Ignore);
                 }
                 SaveIn(lldest) => {
-                    let count = ty::eval_repeat_count(bcx.tcx(), &**count_expr);
-                    if count == 0 {
-                        return bcx;
+                    match ty::eval_repeat_count(bcx.tcx(), &**count_expr) {
+                        0 => bcx,
+                        1 => expr::trans_into(bcx, &**element, SaveIn(lldest)),
+                        count => {
+                            let elem = unpack_datum!(bcx, expr::trans(bcx, &**element));
+                            assert!(!ty::type_moves_by_default(bcx.tcx(), elem.ty));
+
+                            let bcx = iter_vec_loop(bcx, lldest, vt,
+                                                    C_uint(bcx.ccx(), count),
+                                                    |set_bcx, lleltptr, _| {
+                                                        elem.shallow_copy(set_bcx, lleltptr)
+                                                    });
+
+                            elem.add_clean_if_rvalue(bcx, element.id);
+                            bcx
+                        }
                     }
-
-                    // Some cleanup would be required in the case in which panic happens
-                    // during a copy. But given that copy constructors are not overridable,
-                    // this can only happen as a result of OOM. So we just skip out on the
-                    // cleanup since things would *probably* be broken at that point anyways.
-
-                    let elem = unpack_datum!(bcx, expr::trans(bcx, &**element));
-                    assert!(!ty::type_moves_by_default(bcx.tcx(), elem.ty));
-
-                    let bcx = iter_vec_loop(bcx, lldest, vt,
-                                  C_uint(bcx.ccx(), count), |set_bcx, lleltptr, _| {
-                        elem.shallow_copy(set_bcx, lleltptr)
-                    });
-
-                    elem.add_clean_if_rvalue(bcx, element.id);
-                    bcx
                 }
             }
         }

From 88c8a547286e77b1a62609adcee5d65a4f91b09a Mon Sep 17 00:00:00 2001
From: Brian Koropoff <bkoropoff@gmail.com>
Date: Wed, 29 Oct 2014 21:48:15 -0700
Subject: [PATCH 30/34] Add regression test for #18425

---
 src/test/run-pass/issue-18425.rs | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 src/test/run-pass/issue-18425.rs

diff --git a/src/test/run-pass/issue-18425.rs b/src/test/run-pass/issue-18425.rs
new file mode 100644
index 0000000000000..6bb244bf88f42
--- /dev/null
+++ b/src/test/run-pass/issue-18425.rs
@@ -0,0 +1,16 @@
+// 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.
+
+// Check that trans doesn't ICE when translating an array repeat
+// expression with a count of 1 and a non-Copy element type.
+
+fn main() {
+    let _ = [box 1u, ..1];
+}

From 14398f29290b0d96dbe60f329b69062442eefb33 Mon Sep 17 00:00:00 2001
From: P1start <rewi-github@whanau.org>
Date: Mon, 27 Oct 2014 17:43:38 +1300
Subject: [PATCH 31/34] Add a message for when a `.` follows a macro invocation

---
 src/libsyntax/parse/parser.rs                      | 10 ++++++++++
 src/test/compile-fail/macro-invocation-dot-help.rs | 14 ++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 src/test/compile-fail/macro-invocation-dot-help.rs

diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index d9dd37fcb4f4e..f04f9efd7a761 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3592,6 +3592,16 @@ impl<'a> Parser<'a> {
             let hi = self.span.hi;
 
             if id.name == token::special_idents::invalid.name {
+                if self.token == token::Dot {
+                    let span = self.span;
+                    let token_string = self.this_token_to_string();
+                    self.span_err(span,
+                                  format!("expected statement, found `{}`",
+                                          token_string).as_slice());
+                    let mac_span = mk_sp(lo, hi);
+                    self.span_help(mac_span, "try parenthesizing this macro invocation");
+                    self.abort_if_errors();
+                }
                 P(spanned(lo, hi, StmtMac(
                     spanned(lo, hi, MacInvocTT(pth, tts, EMPTY_CTXT)), false)))
             } else {
diff --git a/src/test/compile-fail/macro-invocation-dot-help.rs b/src/test/compile-fail/macro-invocation-dot-help.rs
new file mode 100644
index 0000000000000..bd45b76dd5afc
--- /dev/null
+++ b/src/test/compile-fail/macro-invocation-dot-help.rs
@@ -0,0 +1,14 @@
+// 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 main() {
+    foo!() //~ HELP try parenthesizing this macro invocation
+    .bar //~ ERROR expected statement
+}

From 737e39696ba0964729f29410cf4e75a061ce120a Mon Sep 17 00:00:00 2001
From: P1start <rewi-github@whanau.org>
Date: Tue, 28 Oct 2014 21:04:08 +1300
Subject: [PATCH 32/34] Special-case some error messages about `Sized`
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The error messages still aren’t as good as they were before DST, but they better
describe the actual problem, not mentioning `Sized` at all (because that bound
is normally implied, not explicitly stated).

Closes #17567.
Closes #18040.
Closes #18159.
---
 src/librustc/middle/typeck/check/vtable.rs | 28 +++++++++++++++-------
 src/test/compile-fail/issue-16562.rs       |  3 +--
 src/test/compile-fail/issue-17551.rs       |  2 +-
 src/test/compile-fail/issue-18159.rs       | 13 ++++++++++
 4 files changed, 34 insertions(+), 12 deletions(-)
 create mode 100644 src/test/compile-fail/issue-18159.rs

diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs
index a5624dcc2fcd3..14bb92759d3ec 100644
--- a/src/librustc/middle/typeck/check/vtable.rs
+++ b/src/librustc/middle/typeck/check/vtable.rs
@@ -303,15 +303,25 @@ pub fn maybe_report_ambiguity(fcx: &FnCtxt, obligation: &Obligation) {
         // has_errors() to be sure that compilation isn't happening
         // anyway. In that case, why inundate the user.
         if !fcx.tcx().sess.has_errors() {
-            fcx.tcx().sess.span_err(
-                obligation.cause.span,
-                format!(
-                    "unable to infer enough type information to \
-                     locate the impl of the trait `{}` for \
-                     the type `{}`; type annotations required",
-                    trait_ref.user_string(fcx.tcx()),
-                    self_ty.user_string(fcx.tcx())).as_slice());
-            note_obligation_cause(fcx, obligation);
+            if fcx.ccx.tcx.lang_items.sized_trait()
+                  .map_or(false, |sized_id| sized_id == trait_ref.def_id) {
+                fcx.tcx().sess.span_err(
+                    obligation.cause.span,
+                    format!(
+                        "unable to infer enough type information about `{}`; type annotations \
+                         required",
+                        self_ty.user_string(fcx.tcx())).as_slice());
+            } else {
+                fcx.tcx().sess.span_err(
+                    obligation.cause.span,
+                    format!(
+                        "unable to infer enough type information to \
+                         locate the impl of the trait `{}` for \
+                         the type `{}`; type annotations required",
+                        trait_ref.user_string(fcx.tcx()),
+                        self_ty.user_string(fcx.tcx())).as_slice());
+                note_obligation_cause(fcx, obligation);
+            }
         }
     } else if !fcx.tcx().sess.has_errors() {
          // Ambiguity. Coherence should have reported an error.
diff --git a/src/test/compile-fail/issue-16562.rs b/src/test/compile-fail/issue-16562.rs
index 1e69fb7bfc943..2207e10add451 100644
--- a/src/test/compile-fail/issue-16562.rs
+++ b/src/test/compile-fail/issue-16562.rs
@@ -16,8 +16,7 @@ struct Col<D, C> {
 }
 
 impl<T, M: MatrixShape> Collection for Col<M, uint> {
-//~^ ERROR unable to infer enough type information to locate the impl of the trait
-//~^^ NOTE the trait `core::kinds::Sized` must be implemented because it is required by
+//~^ ERROR unable to infer enough type information
     fn len(&self) -> uint {
         unimplemented!()
     }
diff --git a/src/test/compile-fail/issue-17551.rs b/src/test/compile-fail/issue-17551.rs
index 197319b6d4340..e7f61a4f3ff5f 100644
--- a/src/test/compile-fail/issue-17551.rs
+++ b/src/test/compile-fail/issue-17551.rs
@@ -13,6 +13,6 @@
 struct B<T>;
 
 fn main() {
-    let foo = B; //~ ERROR unable to infer enough type information to locate the impl of the trait
+    let foo = B; //~ ERROR unable to infer enough type information
     let closure = |:| foo;
 }
diff --git a/src/test/compile-fail/issue-18159.rs b/src/test/compile-fail/issue-18159.rs
new file mode 100644
index 0000000000000..e46bcf46cc398
--- /dev/null
+++ b/src/test/compile-fail/issue-18159.rs
@@ -0,0 +1,13 @@
+// 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 main() {
+    let x; //~ ERROR unable to infer enough type information
+}

From 1d356624a1c03363be37886ffdad7dcf25ee81f6 Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Thu, 23 Oct 2014 08:42:21 -0700
Subject: [PATCH 33/34] collections: Enable IndexMut for some collections

This commit enables implementations of IndexMut for a number of collections,
including Vec, RingBuf, SmallIntMap, TrieMap, TreeMap, and HashMap. At the same
time this deprecates the `get_mut` methods on vectors in favor of using the
indexing notation.

cc #18424
---
 src/compiletest/runtest.rs                    |  2 +-
 src/libcollections/bitv.rs                    | 21 ++--
 src/libcollections/btree/map.rs               |  6 ++
 src/libcollections/priority_queue.rs          | 26 ++---
 src/libcollections/ringbuf.rs                 | 33 ++++---
 src/libcollections/smallintmap.rs             | 11 +--
 src/libcollections/str.rs                     |  8 +-
 src/libcollections/treemap.rs                 |  4 +-
 src/libcollections/trie.rs                    |  5 +-
 src/libcollections/vec.rs                     | 16 +--
 src/libcore/intrinsics.rs                     | 97 -------------------
 src/libgetopts/lib.rs                         | 12 +--
 src/libregex/compile.rs                       |  6 +-
 src/libregex/parse.rs                         |  2 +-
 src/libregex/vm.rs                            | 10 +-
 src/librustc/metadata/encoder.rs              |  2 +-
 src/librustc/middle/borrowck/move_data.rs     |  4 +-
 src/librustc/middle/dependency_format.rs      |  2 +-
 src/librustc/middle/graph.rs                  |  8 +-
 src/librustc/middle/liveness.rs               | 18 ++--
 src/librustc/middle/resolve.rs                |  4 +-
 src/librustc/middle/trans/_match.rs           |  2 +-
 src/librustc/middle/trans/cleanup.rs          |  2 +-
 src/librustc/middle/trans/expr.rs             |  2 +-
 src/librustc/middle/trans/type_.rs            |  2 +-
 src/librustc/middle/typeck/check/method.rs    |  2 +-
 src/librustc/middle/typeck/check/mod.rs       |  2 +-
 src/librustc/middle/typeck/check/regionck.rs  |  4 +-
 .../typeck/infer/region_inference/mod.rs      |  2 +-
 .../middle/typeck/infer/type_variable.rs      |  6 +-
 src/librustc/middle/typeck/variance.rs        |  2 +-
 src/librustc/util/snapshot_vec.rs             |  8 +-
 src/libserialize/json.rs                      |  2 +-
 src/libstd/collections/hashmap/map.rs         | 32 +++---
 src/libstd/io/fs.rs                           |  2 +-
 src/libstd/num/strconv.rs                     |  4 +-
 src/libstd/path/windows.rs                    |  6 +-
 src/libstd/rand/mod.rs                        |  2 +-
 src/libsync/comm/sync.rs                      |  4 +-
 src/libsync/raw.rs                            |  2 +-
 src/libsyntax/ast_map/mod.rs                  |  2 +-
 src/libsyntax/ext/base.rs                     |  2 +-
 src/libsyntax/ext/format.rs                   |  4 +-
 src/libsyntax/ext/tt/macro_parser.rs          | 10 +-
 src/libsyntax/print/pp.rs                     | 29 +++---
 src/libtest/stats.rs                          |  4 +-
 46 files changed, 165 insertions(+), 271 deletions(-)

diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index a9edad3add61e..a40913a5db2a2 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -1013,7 +1013,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
                 if prefix_matches(line, prefixes[i].as_slice()) &&
                     line.contains(ee.kind.as_slice()) &&
                     line.contains(ee.msg.as_slice()) {
-                    *found_flags.get_mut(i) = true;
+                    found_flags[i] = true;
                     was_expected = true;
                     break;
                 }
diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs
index 1e081ae8a4b7a..1b12fdcb8dc04 100644
--- a/src/libcollections/bitv.rs
+++ b/src/libcollections/bitv.rs
@@ -243,7 +243,7 @@ impl Bitv {
         let used_bits = bitv.nbits % u32::BITS;
         if init && used_bits != 0 {
             let largest_used_word = (bitv.nbits + u32::BITS - 1) / u32::BITS - 1;
-            *bitv.storage.get_mut(largest_used_word) &= (1 << used_bits) - 1;
+            bitv.storage[largest_used_word] &= (1 << used_bits) - 1;
         }
 
         bitv
@@ -297,8 +297,9 @@ impl Bitv {
         let w = i / u32::BITS;
         let b = i % u32::BITS;
         let flag = 1 << b;
-        *self.storage.get_mut(w) = if x { self.storage[w] | flag }
-                          else { self.storage[w] & !flag };
+        let val = if x { self.storage[w] | flag }
+                  else { self.storage[w] & !flag };
+        self.storage[w] = val;
     }
 
     /// Sets all bits to 1.
@@ -617,7 +618,7 @@ impl Bitv {
             self.storage.truncate(word_len);
             if len % u32::BITS > 0 {
                 let mask = (1 << len % u32::BITS) - 1;
-                *self.storage.get_mut(word_len - 1) &= mask;
+                self.storage[word_len - 1] &= mask;
             }
         }
     }
@@ -681,15 +682,15 @@ impl Bitv {
             let overhang = self.nbits % u32::BITS; // # of already-used bits
             let mask = !((1 << overhang) - 1);  // e.g. 5 unused bits => 111110....0
             if value {
-                *self.storage.get_mut(old_last_word) |= mask;
+                self.storage[old_last_word] |= mask;
             } else {
-                *self.storage.get_mut(old_last_word) &= !mask;
+                self.storage[old_last_word] &= !mask;
             }
         }
         // Fill in words after the old tail word
         let stop_idx = cmp::min(self.storage.len(), new_nwords);
         for idx in range(old_last_word + 1, stop_idx) {
-            *self.storage.get_mut(idx) = full_value;
+            self.storage[idx] = full_value;
         }
         // Allocate new words, if needed
         if new_nwords > self.storage.len() {
@@ -700,7 +701,7 @@ impl Bitv {
             if value {
                 let tail_word = new_nwords - 1;
                 let used_bits = new_nbits % u32::BITS;
-                *self.storage.get_mut(tail_word) &= (1 << used_bits) - 1;
+                self.storage[tail_word] &= (1 << used_bits) - 1;
             }
         }
         // Adjust internal bit count
@@ -728,7 +729,7 @@ impl Bitv {
         let ret = self.get(self.nbits - 1);
         // If we are unusing a whole word, make sure it is zeroed out
         if self.nbits % u32::BITS == 1 {
-            *self.storage.get_mut(self.nbits / u32::BITS) = 0;
+            self.storage[self.nbits / u32::BITS] = 0;
         }
         self.nbits -= 1;
         ret
@@ -1184,7 +1185,7 @@ impl BitvSet {
         for (i, w) in other_words {
             let old = self_bitv.storage[i];
             let new = f(old, w);
-            *self_bitv.storage.get_mut(i) = new;
+            self_bitv.storage[i] = new;
         }
     }
 
diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs
index 77fb6d4a1203b..dc7d935619f9e 100644
--- a/src/libcollections/btree/map.rs
+++ b/src/libcollections/btree/map.rs
@@ -690,6 +690,12 @@ impl<K: Ord, V> Index<K, V> for BTreeMap<K, V> {
     }
 }
 
+impl<K: Ord, V> IndexMut<K, V> for BTreeMap<K, V> {
+    fn index_mut(&mut self, key: &K) -> &mut V {
+        self.find_mut(key).expect("no entry found for key")
+    }
+}
+
 /// Genericises over how to get the correct type of iterator from the correct type
 /// of Node ownership.
 trait Traverse<N> {
diff --git a/src/libcollections/priority_queue.rs b/src/libcollections/priority_queue.rs
index 16e04b93777f2..fbadbb0ffc90b 100644
--- a/src/libcollections/priority_queue.rs
+++ b/src/libcollections/priority_queue.rs
@@ -71,7 +71,7 @@
 //!     let mut pq = PriorityQueue::new();
 //!
 //!     // We're at `start`, with a zero cost
-//!     *dist.get_mut(start) = 0u;
+//!     dist[start] = 0u;
 //!     pq.push(State { cost: 0u, position: start });
 //!
 //!     // Examine the frontier with lower cost nodes first (min-heap)
@@ -96,7 +96,7 @@
 //!             if next.cost < dist[next.position] {
 //!                 pq.push(next);
 //!                 // Relaxation, we have now found a better way
-//!                 *dist.get_mut(next.position) = next.cost;
+//!                 dist[next.position] = next.cost;
 //!             }
 //!         }
 //!     }
@@ -330,7 +330,7 @@ impl<T: Ord> PriorityQueue<T> {
             None           => { None }
             Some(mut item) => {
                 if !self.is_empty() {
-                    swap(&mut item, self.data.get_mut(0));
+                    swap(&mut item, &mut self.data[0]);
                     self.siftdown(0);
                 }
                 Some(item)
@@ -378,7 +378,7 @@ impl<T: Ord> PriorityQueue<T> {
     /// ```
     pub fn push_pop(&mut self, mut item: T) -> T {
         if !self.is_empty() && *self.top().unwrap() > item {
-            swap(&mut item, self.data.get_mut(0));
+            swap(&mut item, &mut self.data[0]);
             self.siftdown(0);
         }
         item
@@ -402,7 +402,7 @@ impl<T: Ord> PriorityQueue<T> {
     /// ```
     pub fn replace(&mut self, mut item: T) -> Option<T> {
         if !self.is_empty() {
-            swap(&mut item, self.data.get_mut(0));
+            swap(&mut item, &mut self.data[0]);
             self.siftdown(0);
             Some(item)
         } else {
@@ -462,26 +462,26 @@ impl<T: Ord> PriorityQueue<T> {
     // compared to using swaps, which involves twice as many moves.
     fn siftup(&mut self, start: uint, mut pos: uint) {
         unsafe {
-            let new = replace(self.data.get_mut(pos), zeroed());
+            let new = replace(&mut self.data[pos], zeroed());
 
             while pos > start {
                 let parent = (pos - 1) >> 1;
                 if new > self.data[parent] {
-                    let x = replace(self.data.get_mut(parent), zeroed());
-                    ptr::write(self.data.get_mut(pos), x);
+                    let x = replace(&mut self.data[parent], zeroed());
+                    ptr::write(&mut self.data[pos], x);
                     pos = parent;
                     continue
                 }
                 break
             }
-            ptr::write(self.data.get_mut(pos), new);
+            ptr::write(&mut self.data[pos], new);
         }
     }
 
     fn siftdown_range(&mut self, mut pos: uint, end: uint) {
         unsafe {
             let start = pos;
-            let new = replace(self.data.get_mut(pos), zeroed());
+            let new = replace(&mut self.data[pos], zeroed());
 
             let mut child = 2 * pos + 1;
             while child < end {
@@ -489,13 +489,13 @@ impl<T: Ord> PriorityQueue<T> {
                 if right < end && !(self.data[child] > self.data[right]) {
                     child = right;
                 }
-                let x = replace(self.data.get_mut(child), zeroed());
-                ptr::write(self.data.get_mut(pos), x);
+                let x = replace(&mut self.data[child], zeroed());
+                ptr::write(&mut self.data[pos], x);
                 pos = child;
                 child = 2 * pos + 1;
             }
 
-            ptr::write(self.data.get_mut(pos), new);
+            ptr::write(&mut self.data[pos], new);
             self.siftup(start, pos);
         }
     }
diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs
index 5f05ab7a90693..81e4361ec3949 100644
--- a/src/libcollections/ringbuf.rs
+++ b/src/libcollections/ringbuf.rs
@@ -58,7 +58,7 @@ impl<T> Deque<T> for RingBuf<T> {
 
     /// Returns a mutable reference to the first element in the `RingBuf`.
     fn front_mut<'a>(&'a mut self) -> Option<&'a mut T> {
-        if self.nelts > 0 { Some(self.get_mut(0)) } else { None }
+        if self.nelts > 0 { Some(&mut self[0]) } else { None }
     }
 
     /// Returns a reference to the last element in the `RingBuf`.
@@ -69,13 +69,13 @@ impl<T> Deque<T> for RingBuf<T> {
     /// Returns a mutable reference to the last element in the `RingBuf`.
     fn back_mut<'a>(&'a mut self) -> Option<&'a mut T> {
         let nelts = self.nelts;
-        if nelts > 0 { Some(self.get_mut(nelts - 1)) } else { None }
+        if nelts > 0 { Some(&mut self[nelts - 1]) } else { None }
     }
 
     /// Removes and returns the first element in the `RingBuf`, or `None` if it
     /// is empty.
     fn pop_front(&mut self) -> Option<T> {
-        let result = self.elts.get_mut(self.lo).take();
+        let result = self.elts[self.lo].take();
         if result.is_some() {
             self.lo = (self.lo + 1u) % self.elts.len();
             self.nelts -= 1u;
@@ -91,7 +91,7 @@ impl<T> Deque<T> for RingBuf<T> {
         if self.lo == 0u {
             self.lo = self.elts.len() - 1u;
         } else { self.lo -= 1u; }
-        *self.elts.get_mut(self.lo) = Some(t);
+        self.elts[self.lo] = Some(t);
         self.nelts += 1u;
     }
 }
@@ -102,14 +102,14 @@ impl<T> MutableSeq<T> for RingBuf<T> {
             grow(self.nelts, &mut self.lo, &mut self.elts);
         }
         let hi = self.raw_index(self.nelts);
-        *self.elts.get_mut(hi) = Some(t);
+        self.elts[hi] = Some(t);
         self.nelts += 1u;
     }
     fn pop(&mut self) -> Option<T> {
         if self.nelts > 0 {
             self.nelts -= 1;
             let hi = self.raw_index(self.nelts);
-            self.elts.get_mut(hi).take()
+            self.elts[hi].take()
         } else {
             None
         }
@@ -140,6 +140,7 @@ impl<T> RingBuf<T> {
     /// # Example
     ///
     /// ```rust
+    /// # #![allow(deprecated)]
     /// use std::collections::RingBuf;
     ///
     /// let mut buf = RingBuf::new();
@@ -149,12 +150,9 @@ impl<T> RingBuf<T> {
     /// *buf.get_mut(1) = 7;
     /// assert_eq!(buf[1], 7);
     /// ```
+    #[deprecated = "use indexing instead: `buf[index] = value`"]
     pub fn get_mut<'a>(&'a mut self, i: uint) -> &'a mut T {
-        let idx = self.raw_index(i);
-        match *self.elts.get_mut(idx) {
-            None => panic!(),
-            Some(ref mut v) => v
-        }
+        &mut self[i]
     }
 
     /// Swaps elements at indices `i` and `j`.
@@ -466,13 +464,16 @@ impl<A> Index<uint, A> for RingBuf<A> {
     }
 }
 
-// FIXME(#12825) Indexing will always try IndexMut first and that causes issues.
-/*impl<A> IndexMut<uint, A> for RingBuf<A> {
+impl<A> IndexMut<uint, A> for RingBuf<A> {
     #[inline]
-    fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut A {
-        self.get_mut(*index)
+    fn index_mut<'a>(&'a mut self, i: &uint) -> &'a mut A {
+        let idx = self.raw_index(*i);
+        match *(&mut self.elts[idx]) {
+            None => panic!(),
+            Some(ref mut v) => v
+        }
     }
-}*/
+}
 
 impl<A> FromIterator<A> for RingBuf<A> {
     fn from_iter<T: Iterator<A>>(iterator: T) -> RingBuf<A> {
diff --git a/src/libcollections/smallintmap.rs b/src/libcollections/smallintmap.rs
index 3b509f37c4705..22bb4574f9cc4 100644
--- a/src/libcollections/smallintmap.rs
+++ b/src/libcollections/smallintmap.rs
@@ -100,7 +100,7 @@ impl<V> MutableMap<uint, V> for SmallIntMap<V> {
     /// Returns a mutable reference to the value corresponding to the key.
     fn find_mut<'a>(&'a mut self, key: &uint) -> Option<&'a mut V> {
         if *key < self.v.len() {
-            match *self.v.get_mut(*key) {
+            match *self.v.index_mut(key) {
               Some(ref mut value) => Some(value),
               None => None
             }
@@ -118,7 +118,7 @@ impl<V> MutableMap<uint, V> for SmallIntMap<V> {
         if len <= key {
             self.v.grow_fn(key - len + 1, |_| None);
         }
-        *self.v.get_mut(key) = Some(value);
+        self.v[key] = Some(value);
         !exists
     }
 
@@ -145,7 +145,7 @@ impl<V> MutableMap<uint, V> for SmallIntMap<V> {
         if *key >= self.v.len() {
             return None;
         }
-        self.v.get_mut(*key).take()
+        self.v[*key].take()
     }
 }
 
@@ -405,13 +405,12 @@ impl<V> Index<uint, V> for SmallIntMap<V> {
     }
 }
 
-// FIXME(#12825) Indexing will always try IndexMut first and that causes issues.
-/*impl<V> IndexMut<uint, V> for SmallIntMap<V> {
+impl<V> IndexMut<uint, V> for SmallIntMap<V> {
     #[inline]
     fn index_mut<'a>(&'a mut self, i: &uint) -> &'a mut V {
         self.find_mut(i).expect("key not present")
     }
-}*/
+}
 
 macro_rules! iterator {
     (impl $name:ident -> $elem:ty, $($getter:ident),+) => {
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index 5dd3be4ec8fd4..7d882ae53839f 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -692,17 +692,17 @@ pub trait StrAllocating: Str {
         for (i, sc) in me.chars().enumerate() {
 
             let mut current = i;
-            *dcol.get_mut(0) = current + 1;
+            dcol[0] = current + 1;
 
             for (j, tc) in t.chars().enumerate() {
 
                 let next = dcol[j + 1];
 
                 if sc == tc {
-                    *dcol.get_mut(j + 1) = current;
+                    dcol[j + 1] = current;
                 } else {
-                    *dcol.get_mut(j + 1) = cmp::min(current, next);
-                    *dcol.get_mut(j + 1) = cmp::min(dcol[j + 1], dcol[j]) + 1;
+                    dcol[j + 1] = cmp::min(current, next);
+                    dcol[j + 1] = cmp::min(dcol[j + 1], dcol[j]) + 1;
                 }
 
                 current = next;
diff --git a/src/libcollections/treemap.rs b/src/libcollections/treemap.rs
index feb4c11a061a5..ea4d541aab94a 100644
--- a/src/libcollections/treemap.rs
+++ b/src/libcollections/treemap.rs
@@ -257,12 +257,12 @@ impl<K: Ord, V> Index<K, V> for TreeMap<K, V> {
     }
 }
 
-/*impl<K: Ord, V> IndexMut<K, V> for TreeMap<K, V> {
+impl<K: Ord, V> IndexMut<K, V> for TreeMap<K, V> {
     #[inline]
     fn index_mut<'a>(&'a mut self, i: &K) -> &'a mut V {
         self.find_mut(i).expect("no entry found for key")
     }
-}*/
+}
 
 impl<K: Ord, V> TreeMap<K, V> {
     /// Creates an empty `TreeMap`.
diff --git a/src/libcollections/trie.rs b/src/libcollections/trie.rs
index d02190e08247e..8c18a6488ba50 100644
--- a/src/libcollections/trie.rs
+++ b/src/libcollections/trie.rs
@@ -515,13 +515,12 @@ impl<T> Index<uint, T> for TrieMap<T> {
     }
 }
 
-// FIXME(#12825) Indexing will always try IndexMut first and that causes issues.
-/*impl<T> IndexMut<uint, T> for TrieMap<T> {
+impl<T> IndexMut<uint, T> for TrieMap<T> {
     #[inline]
     fn index_mut<'a>(&'a mut self, i: &uint) -> &'a mut T {
         self.find_mut(i).expect("key not present")
     }
-}*/
+}
 
 /// A set implemented as a radix trie.
 ///
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index 759f9ec7d3f03..ea03873ee8382 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -46,7 +46,7 @@ use slice::{Items, MutItems};
 /// assert_eq!(vec.pop(), Some(2));
 /// assert_eq!(vec.len(), 1);
 ///
-/// *vec.get_mut(0) = 7i;
+/// vec[0] = 7i;
 /// assert_eq!(vec[0], 7);
 ///
 /// vec.push_all([1, 2, 3]);
@@ -414,11 +414,10 @@ impl<T> Index<uint,T> for Vec<T> {
     }
 }
 
-#[cfg(not(stage0))]
 impl<T> IndexMut<uint,T> for Vec<T> {
     #[inline]
     fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut T {
-        self.get_mut(*index)
+        &mut self.as_mut_slice()[*index]
     }
 }
 
@@ -712,14 +711,6 @@ impl<T> Vec<T> {
         }
     }
 
-    /// Deprecated, use `.extend(other.into_iter())`
-    #[inline]
-    #[deprecated = "use .extend(other.into_iter())"]
-    #[cfg(stage0)]
-    pub fn push_all_move(&mut self, other: Vec<T>) {
-            self.extend(other.into_iter());
-    }
-
     /// Returns a mutable slice of the elements of `self`.
     ///
     /// # Example
@@ -799,12 +790,13 @@ impl<T> Vec<T> {
     /// # Example
     ///
     /// ```
+    /// # #![allow(deprecated)]
     /// let mut vec = vec![1i, 2, 3];
     /// *vec.get_mut(1) = 4;
     /// assert_eq!(vec, vec![1i, 4, 3]);
     /// ```
     #[inline]
-    #[unstable = "this is likely to be moved to actual indexing"]
+    #[deprecated = "use `foo[index] = bar` instead"]
     pub fn get_mut<'a>(&'a mut self, index: uint) -> &'a mut T {
         &mut self.as_mut_slice()[index]
     }
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index 68b3ca96de147..cd0b72d50c9fe 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -57,107 +57,10 @@ pub struct TyDesc {
     // Called when a value of type `T` is no longer needed
     pub drop_glue: GlueFn,
 
-    // Called by reflection visitor to visit a value of type `T`
-    #[cfg(stage0)]
-    pub visit_glue: GlueFn,
-
     // Name corresponding to the type
     pub name: &'static str,
 }
 
-#[cfg(stage0)]
-#[lang="opaque"]
-pub enum Opaque { }
-
-#[cfg(stage0)]
-pub type Disr = u64;
-
-#[cfg(stage0)]
-#[lang="ty_visitor"]
-pub trait TyVisitor {
-    fn visit_bot(&mut self) -> bool;
-    fn visit_nil(&mut self) -> bool;
-    fn visit_bool(&mut self) -> bool;
-
-    fn visit_int(&mut self) -> bool;
-    fn visit_i8(&mut self) -> bool;
-    fn visit_i16(&mut self) -> bool;
-    fn visit_i32(&mut self) -> bool;
-    fn visit_i64(&mut self) -> bool;
-
-    fn visit_uint(&mut self) -> bool;
-    fn visit_u8(&mut self) -> bool;
-    fn visit_u16(&mut self) -> bool;
-    fn visit_u32(&mut self) -> bool;
-    fn visit_u64(&mut self) -> bool;
-
-    fn visit_f32(&mut self) -> bool;
-    fn visit_f64(&mut self) -> bool;
-
-    fn visit_char(&mut self) -> bool;
-
-    fn visit_estr_slice(&mut self) -> bool;
-
-    fn visit_box(&mut self, mtbl: uint, inner: *const TyDesc) -> bool;
-    fn visit_uniq(&mut self, mtbl: uint, inner: *const TyDesc) -> bool;
-    fn visit_ptr(&mut self, mtbl: uint, inner: *const TyDesc) -> bool;
-    fn visit_rptr(&mut self, mtbl: uint, inner: *const TyDesc) -> bool;
-
-    fn visit_evec_slice(&mut self, mtbl: uint, inner: *const TyDesc) -> bool;
-    fn visit_evec_fixed(&mut self, n: uint, sz: uint, align: uint,
-                        inner: *const TyDesc) -> bool;
-
-    fn visit_enter_rec(&mut self, n_fields: uint,
-                       sz: uint, align: uint) -> bool;
-    fn visit_rec_field(&mut self, i: uint, name: &str,
-                       mtbl: uint, inner: *const TyDesc) -> bool;
-    fn visit_leave_rec(&mut self, n_fields: uint,
-                       sz: uint, align: uint) -> bool;
-
-    fn visit_enter_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
-                         sz: uint, align: uint) -> bool;
-    fn visit_class_field(&mut self, i: uint, name: &str, named: bool,
-                         mtbl: uint, inner: *const TyDesc) -> bool;
-    fn visit_leave_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
-                         sz: uint, align: uint) -> bool;
-
-    fn visit_enter_tup(&mut self, n_fields: uint,
-                       sz: uint, align: uint) -> bool;
-    fn visit_tup_field(&mut self, i: uint, inner: *const TyDesc) -> bool;
-    fn visit_leave_tup(&mut self, n_fields: uint,
-                       sz: uint, align: uint) -> bool;
-
-    fn visit_enter_enum(&mut self, n_variants: uint,
-                        get_disr: unsafe extern fn(ptr: *const Opaque) -> Disr,
-                        sz: uint, align: uint) -> bool;
-    fn visit_enter_enum_variant(&mut self, variant: uint,
-                                disr_val: Disr,
-                                n_fields: uint,
-                                name: &str) -> bool;
-    fn visit_enum_variant_field(&mut self, i: uint, offset: uint,
-                                inner: *const TyDesc) -> bool;
-    fn visit_leave_enum_variant(&mut self, variant: uint,
-                                disr_val: Disr,
-                                n_fields: uint,
-                                name: &str) -> bool;
-    fn visit_leave_enum(&mut self, n_variants: uint,
-                        get_disr: unsafe extern fn(ptr: *const Opaque) -> Disr,
-                        sz: uint, align: uint) -> bool;
-
-    fn visit_enter_fn(&mut self, purity: uint, proto: uint,
-                      n_inputs: uint, retstyle: uint) -> bool;
-    fn visit_fn_input(&mut self, i: uint, mode: uint,
-                      inner: *const TyDesc) -> bool;
-    fn visit_fn_output(&mut self, retstyle: uint, variadic: bool,
-                       converging: bool, inner: *const TyDesc) -> bool;
-    fn visit_leave_fn(&mut self, purity: uint, proto: uint,
-                      n_inputs: uint, retstyle: uint) -> bool;
-
-    fn visit_trait(&mut self, name: &str) -> bool;
-    fn visit_param(&mut self, i: uint) -> bool;
-    fn visit_self(&mut self) -> bool;
-}
-
 extern "rust-intrinsic" {
 
     // NB: These intrinsics take unsafe pointers because they mutate aliased
diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs
index 24b7802097409..12851713af254 100644
--- a/src/libgetopts/lib.rs
+++ b/src/libgetopts/lib.rs
@@ -614,29 +614,29 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
                     if name_pos == names.len() && !i_arg.is_none() {
                         return Err(UnexpectedArgument(nm.to_string()));
                     }
-                    vals.get_mut(optid).push(Given);
+                    vals[optid].push(Given);
                   }
                   Maybe => {
                     if !i_arg.is_none() {
-                        vals.get_mut(optid)
+                        vals[optid]
                             .push(Val((i_arg.clone())
                             .unwrap()));
                     } else if name_pos < names.len() || i + 1 == l ||
                             is_arg(args[i + 1].as_slice()) {
-                        vals.get_mut(optid).push(Given);
+                        vals[optid].push(Given);
                     } else {
                         i += 1;
-                        vals.get_mut(optid).push(Val(args[i].clone()));
+                        vals[optid].push(Val(args[i].clone()));
                     }
                   }
                   Yes => {
                     if !i_arg.is_none() {
-                        vals.get_mut(optid).push(Val(i_arg.clone().unwrap()));
+                        vals[optid].push(Val(i_arg.clone().unwrap()));
                     } else if i + 1 == l {
                         return Err(ArgumentMissing(nm.to_string()));
                     } else {
                         i += 1;
-                        vals.get_mut(optid).push(Val(args[i].clone()));
+                        vals[optid].push(Val(args[i].clone()));
                     }
                   }
                 }
diff --git a/src/libregex/compile.rs b/src/libregex/compile.rs
index 53d2ea62a2ad0..2b82b620e3968 100644
--- a/src/libregex/compile.rs
+++ b/src/libregex/compile.rs
@@ -157,7 +157,7 @@ impl<'r> Compiler<'r> {
                 if cap >= len {
                     self.names.grow(10 + cap - len, None)
                 }
-                *self.names.get_mut(cap) = name;
+                self.names[cap] = name;
 
                 self.push(Save(2 * cap));
                 self.compile(*x);
@@ -243,7 +243,7 @@ impl<'r> Compiler<'r> {
     /// `panic!` is called.
     #[inline]
     fn set_split(&mut self, i: InstIdx, pc1: InstIdx, pc2: InstIdx) {
-        let split = self.insts.get_mut(i);
+        let split = &mut self.insts[i];
         match *split {
             Split(_, _) => *split = Split(pc1, pc2),
             _ => panic!("BUG: Invalid split index."),
@@ -263,7 +263,7 @@ impl<'r> Compiler<'r> {
     /// `panic!` is called.
     #[inline]
     fn set_jump(&mut self, i: InstIdx, pc: InstIdx) {
-        let jmp = self.insts.get_mut(i);
+        let jmp = &mut self.insts[i];
         match *jmp {
             Jump(_) => *jmp = Jump(pc),
             _ => panic!("BUG: Invalid jump index."),
diff --git a/src/libregex/parse.rs b/src/libregex/parse.rs
index d71cc9cb511ff..3115161682f02 100644
--- a/src/libregex/parse.rs
+++ b/src/libregex/parse.rs
@@ -978,7 +978,7 @@ fn combine_ranges(unordered: Vec<(char, char)>) -> Vec<(char, char)> {
         }
         match which {
             None => ordered.push((us, ue)),
-            Some(i) => *ordered.get_mut(i) = (us, ue),
+            Some(i) => ordered[i] = (us, ue),
         }
     }
     ordered.sort();
diff --git a/src/libregex/vm.rs b/src/libregex/vm.rs
index 0a4dca9125aa6..ce06828e7643f 100644
--- a/src/libregex/vm.rs
+++ b/src/libregex/vm.rs
@@ -461,13 +461,13 @@ impl Threads {
     }
 
     fn add(&mut self, pc: uint, groups: &[Option<uint>], empty: bool) {
-        let t = self.queue.get_mut(self.size);
+        let t = &mut self.queue[self.size];
         t.pc = pc;
         match (empty, self.which) {
             (_, Exists) | (true, _) => {},
             (false, Location) => {
-                *t.groups.get_mut(0) = groups[0];
-                *t.groups.get_mut(1) = groups[1];
+                t.groups[0] = groups[0];
+                t.groups[1] = groups[1];
             }
             (false, Submatches) => {
                 for (slot, val) in t.groups.iter_mut().zip(groups.iter()) {
@@ -475,7 +475,7 @@ impl Threads {
                 }
             }
         }
-        *self.sparse.get_mut(pc) = self.size;
+        self.sparse[pc] = self.size;
         self.size += 1;
     }
 
@@ -497,7 +497,7 @@ impl Threads {
 
     #[inline]
     fn groups<'r>(&'r mut self, i: uint) -> &'r mut [Option<uint>] {
-        self.queue.get_mut(i).groups.as_mut_slice()
+        self.queue[i].groups.as_mut_slice()
     }
 }
 
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 6fe14a2d12ab5..6f5d5f6925cae 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1619,7 +1619,7 @@ fn encode_index<T: Hash>(rbml_w: &mut Encoder, index: Vec<entry<T>>,
     let mut buckets: Vec<Vec<entry<T>>> = Vec::from_fn(256, |_| Vec::new());
     for elt in index.into_iter() {
         let h = hash::hash(&elt.val) as uint;
-        buckets.get_mut(h % 256).push(elt);
+        buckets[h % 256].push(elt);
     }
 
     rbml_w.start_tag(tag_index);
diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs
index 5f3c46fcf4cd5..dbdac39a6aa2e 100644
--- a/src/librustc/middle/borrowck/move_data.rs
+++ b/src/librustc/middle/borrowck/move_data.rs
@@ -214,13 +214,13 @@ impl MoveData {
     fn set_path_first_move(&self,
                            index: MovePathIndex,
                            first_move: MoveIndex) {
-        self.paths.borrow_mut().get_mut(index.get()).first_move = first_move
+        (*self.paths.borrow_mut())[index.get()].first_move = first_move
     }
 
     fn set_path_first_child(&self,
                             index: MovePathIndex,
                             first_child: MovePathIndex) {
-        self.paths.borrow_mut().get_mut(index.get()).first_child = first_child
+        (*self.paths.borrow_mut())[index.get()].first_child = first_child
     }
 
     fn move_next_move(&self, index: MoveIndex) -> MoveIndex {
diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs
index 8e2d4d0dc5a94..3baa8eb0cc040 100644
--- a/src/librustc/middle/dependency_format.rs
+++ b/src/librustc/middle/dependency_format.rs
@@ -161,7 +161,7 @@ fn calculate_type(sess: &session::Session,
         if src.dylib.is_none() && !formats.contains_key(&cnum) {
             assert!(src.rlib.is_some());
             add_library(sess, cnum, cstore::RequireStatic, &mut formats);
-            *ret.get_mut(cnum as uint - 1) = Some(cstore::RequireStatic);
+            ret[cnum as uint - 1] = Some(cstore::RequireStatic);
             debug!("adding staticlib: {}", data.name);
         }
     });
diff --git a/src/librustc/middle/graph.rs b/src/librustc/middle/graph.rs
index 4775f945f5c1f..783b94238e251 100644
--- a/src/librustc/middle/graph.rs
+++ b/src/librustc/middle/graph.rs
@@ -142,7 +142,7 @@ impl<N,E> Graph<N,E> {
     }
 
     pub fn mut_node_data<'a>(&'a mut self, idx: NodeIndex) -> &'a mut N {
-        &mut self.nodes.get_mut(idx.get()).data
+        &mut self.nodes[idx.get()].data
     }
 
     pub fn node_data<'a>(&'a self, idx: NodeIndex) -> &'a N {
@@ -182,14 +182,14 @@ impl<N,E> Graph<N,E> {
         });
 
         // adjust the firsts for each node target be the next object.
-        self.nodes.get_mut(source.get()).first_edge[Outgoing.repr] = idx;
-        self.nodes.get_mut(target.get()).first_edge[Incoming.repr] = idx;
+        self.nodes[source.get()].first_edge[Outgoing.repr] = idx;
+        self.nodes[target.get()].first_edge[Incoming.repr] = idx;
 
         return idx;
     }
 
     pub fn mut_edge_data<'a>(&'a mut self, idx: EdgeIndex) -> &'a mut E {
-        &mut self.edges.get_mut(idx.get()).data
+        &mut self.edges[idx.get()].data
     }
 
     pub fn edge_data<'a>(&'a self, idx: EdgeIndex) -> &'a E {
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index f9810120d211b..80eba56ea6ce0 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -756,7 +756,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
     }
 
     fn init_empty(&mut self, ln: LiveNode, succ_ln: LiveNode) {
-        *self.successors.get_mut(ln.get()) = succ_ln;
+        self.successors[ln.get()] = succ_ln;
 
         // It is not necessary to initialize the
         // values to empty because this is the value
@@ -770,10 +770,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
 
     fn init_from_succ(&mut self, ln: LiveNode, succ_ln: LiveNode) {
         // more efficient version of init_empty() / merge_from_succ()
-        *self.successors.get_mut(ln.get()) = succ_ln;
+        self.successors[ln.get()] = succ_ln;
 
         self.indices2(ln, succ_ln, |this, idx, succ_idx| {
-            *this.users.get_mut(idx) = this.users[succ_idx]
+            this.users[idx] = this.users[succ_idx]
         });
         debug!("init_from_succ(ln={}, succ={})",
                self.ln_str(ln), self.ln_str(succ_ln));
@@ -789,11 +789,11 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
         let mut changed = false;
         self.indices2(ln, succ_ln, |this, idx, succ_idx| {
             changed |= copy_if_invalid(this.users[succ_idx].reader,
-                                       &mut this.users.get_mut(idx).reader);
+                                       &mut this.users[idx].reader);
             changed |= copy_if_invalid(this.users[succ_idx].writer,
-                                       &mut this.users.get_mut(idx).writer);
+                                       &mut this.users[idx].writer);
             if this.users[succ_idx].used && !this.users[idx].used {
-                this.users.get_mut(idx).used = true;
+                this.users[idx].used = true;
                 changed = true;
             }
         });
@@ -817,8 +817,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
     // this) so we just clear out all the data.
     fn define(&mut self, writer: LiveNode, var: Variable) {
         let idx = self.idx(writer, var);
-        self.users.get_mut(idx).reader = invalid_node();
-        self.users.get_mut(idx).writer = invalid_node();
+        self.users[idx].reader = invalid_node();
+        self.users[idx].writer = invalid_node();
 
         debug!("{} defines {} (idx={}): {}", writer.to_string(), var.to_string(),
                idx, self.ln_str(writer));
@@ -830,7 +830,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
                ln.to_string(), acc, var.to_string(), self.ln_str(ln));
 
         let idx = self.idx(ln, var);
-        let user = self.users.get_mut(idx);
+        let user = &mut self.users[idx];
 
         if (acc & ACC_WRITE) != 0 {
             user.reader = invalid_node();
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index 7af4739d40915..63b5e52f8b808 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -2596,7 +2596,7 @@ impl<'a> Resolver<'a> {
 
         // We've successfully resolved the import. Write the results in.
         let mut import_resolutions = module_.import_resolutions.borrow_mut();
-        let import_resolution = import_resolutions.get_mut(&target);
+        let import_resolution = &mut (*import_resolutions)[target];
 
         match value_result {
             BoundResult(ref target_module, ref name_bindings) => {
@@ -5697,7 +5697,7 @@ impl<'a> Resolver<'a> {
 
         let mut smallest = 0;
         for (i, other) in maybes.iter().enumerate() {
-            *values.get_mut(i) = name.lev_distance(other.get());
+            values[i] = name.lev_distance(other.get());
 
             if values[i] <= values[smallest] {
                 smallest = i;
diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs
index f53b5331eddeb..70aef4504f031 100644
--- a/src/librustc/middle/trans/_match.rs
+++ b/src/librustc/middle/trans/_match.rs
@@ -403,7 +403,7 @@ fn expand_nested_bindings<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         }
 
         let mut pats = br.pats.clone();
-        *pats.get_mut(col) = pat;
+        pats[col] = pat;
         Match {
             pats: pats,
             data: &*br.data,
diff --git a/src/librustc/middle/trans/cleanup.rs b/src/librustc/middle/trans/cleanup.rs
index e5825d7a38f15..5a4979d9dcd5e 100644
--- a/src/librustc/middle/trans/cleanup.rs
+++ b/src/librustc/middle/trans/cleanup.rs
@@ -469,7 +469,7 @@ impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> {
         assert!(self.is_valid_custom_scope(custom_scope));
 
         let mut scopes = self.scopes.borrow_mut();
-        let scope = scopes.get_mut(custom_scope.index);
+        let scope = &mut (*scopes)[custom_scope.index];
         scope.cleanups.push(cleanup);
         scope.clear_cached_exits();
     }
diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs
index 4d004c85f6e5f..24c03cb5d422c 100644
--- a/src/librustc/middle/trans/expr.rs
+++ b/src/librustc/middle/trans/expr.rs
@@ -1331,7 +1331,7 @@ fn trans_struct<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                           field_ty.name == field.ident.node.name);
             match opt_pos {
                 Some(i) => {
-                    *need_base.get_mut(i) = false;
+                    need_base[i] = false;
                     (i, &*field.expr)
                 }
                 None => {
diff --git a/src/librustc/middle/trans/type_.rs b/src/librustc/middle/trans/type_.rs
index f08fd20314a66..d53fb8dfcf1bc 100644
--- a/src/librustc/middle/trans/type_.rs
+++ b/src/librustc/middle/trans/type_.rs
@@ -284,7 +284,7 @@ impl Type {
                 return Vec::new();
             }
             let mut elts = Vec::from_elem(n_elts, 0 as TypeRef);
-            llvm::LLVMGetStructElementTypes(self.to_ref(), elts.get_mut(0));
+            llvm::LLVMGetStructElementTypes(self.to_ref(), &mut elts[0]);
             mem::transmute(elts)
         }
     }
diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs
index 7527160c825ae..6ae1bc82bb415 100644
--- a/src/librustc/middle/typeck/check/method.rs
+++ b/src/librustc/middle/typeck/check/method.rs
@@ -650,7 +650,7 @@ impl<'a, 'tcx> LookupContext<'a, 'tcx> {
                     ByValueExplicitSelfCategory => {
                         let mut n = (*m).clone();
                         let self_ty = n.fty.sig.inputs[0];
-                        *n.fty.sig.inputs.get_mut(0) = ty::mk_uniq(tcx, self_ty);
+                        n.fty.sig.inputs[0] = ty::mk_uniq(tcx, self_ty);
                         m = Rc::new(n);
                     }
                     _ => { }
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index 8843be3cf816f..4d4ac11493751 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -5455,7 +5455,7 @@ pub fn check_bounds_are_used(ccx: &CrateCtxt,
             match ty::get(t).sty {
                 ty::ty_param(ParamTy {idx, ..}) => {
                     debug!("Found use of ty param num {}", idx);
-                    *tps_used.get_mut(idx) = true;
+                    tps_used[idx] = true;
                 }
                 _ => ()
             }
diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs
index bcade1e74ca65..d0338333badee 100644
--- a/src/librustc/middle/typeck/check/regionck.rs
+++ b/src/librustc/middle/typeck/check/regionck.rs
@@ -1757,7 +1757,7 @@ fn adjust_upvar_borrow_kind_for_mut(rcx: &Rcx,
                         // is inferred to mutable if necessary
                         let mut upvar_borrow_map =
                             rcx.fcx.inh.upvar_borrow_map.borrow_mut();
-                        let ub = upvar_borrow_map.get_mut(upvar_id);
+                        let ub = &mut (*upvar_borrow_map)[*upvar_id];
                         return adjust_upvar_borrow_kind(rcx, *upvar_id, ub, ty::MutBorrow);
                     }
 
@@ -1807,7 +1807,7 @@ fn adjust_upvar_borrow_kind_for_unique(rcx: &Rcx, cmt: mc::cmt) {
                         // borrow_kind of the upvar to make sure it
                         // is inferred to unique if necessary
                         let mut ub = rcx.fcx.inh.upvar_borrow_map.borrow_mut();
-                        let ub = ub.get_mut(upvar_id);
+                        let ub = &mut (*ub)[*upvar_id];
                         return adjust_upvar_borrow_kind(rcx, *upvar_id, ub, ty::UniqueImmBorrow);
                     }
 
diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/typeck/infer/region_inference/mod.rs
index 80213d43ec437..ff1ded726c566 100644
--- a/src/librustc/middle/typeck/infer/region_inference/mod.rs
+++ b/src/librustc/middle/typeck/infer/region_inference/mod.rs
@@ -261,7 +261,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
         if snapshot.length == 0 {
             undo_log.truncate(0);
         } else {
-            *undo_log.get_mut(snapshot.length) = CommitedSnapshot;
+            (*undo_log)[snapshot.length] = CommitedSnapshot;
         }
     }
 
diff --git a/src/librustc/middle/typeck/infer/type_variable.rs b/src/librustc/middle/typeck/infer/type_variable.rs
index 63094ceaabdf9..1383f7aa4dc98 100644
--- a/src/librustc/middle/typeck/infer/type_variable.rs
+++ b/src/librustc/middle/typeck/infer/type_variable.rs
@@ -159,12 +159,12 @@ impl sv::SnapshotVecDelegate<TypeVariableData,UndoEntry> for Delegate {
                action: UndoEntry) {
         match action {
             SpecifyVar(vid, relations) => {
-                values.get_mut(vid.index).value = Bounded(relations);
+                values[vid.index].value = Bounded(relations);
             }
 
             Relate(a, b) => {
-                relations(values.get_mut(a.index)).pop();
-                relations(values.get_mut(b.index)).pop();
+                relations(&mut (*values)[a.index]).pop();
+                relations(&mut (*values)[b.index]).pop();
             }
         }
     }
diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs
index c8214a743de73..21bd876a5c976 100644
--- a/src/librustc/middle/typeck/variance.rs
+++ b/src/librustc/middle/typeck/variance.rs
@@ -994,7 +994,7 @@ impl<'a, 'tcx> SolveContext<'a, 'tcx> {
                             new_value,
                             term.to_string());
 
-                    *self.solutions.get_mut(inferred) = new_value;
+                    self.solutions[inferred] = new_value;
                     changed = true;
                 }
             }
diff --git a/src/librustc/util/snapshot_vec.rs b/src/librustc/util/snapshot_vec.rs
index 8885d86d4da36..6d99fc7156ca8 100644
--- a/src/librustc/util/snapshot_vec.rs
+++ b/src/librustc/util/snapshot_vec.rs
@@ -105,7 +105,7 @@ impl<T,U,D:SnapshotVecDelegate<T,U>> SnapshotVec<T,U,D> {
          * action.
          */
 
-        self.values.get_mut(index)
+        &mut self.values[index]
     }
 
     pub fn set(&mut self, index: uint, new_elem: T) {
@@ -114,7 +114,7 @@ impl<T,U,D:SnapshotVecDelegate<T,U>> SnapshotVec<T,U,D> {
          * saved (and perhaps restored) if a snapshot is active.
          */
 
-        let old_elem = mem::replace(self.values.get_mut(index), new_elem);
+        let old_elem = mem::replace(&mut self.values[index], new_elem);
         if self.in_snapshot() {
             self.undo_log.push(SetElem(index, old_elem));
         }
@@ -162,7 +162,7 @@ impl<T,U,D:SnapshotVecDelegate<T,U>> SnapshotVec<T,U,D> {
                 }
 
                 SetElem(i, v) => {
-                    *self.values.get_mut(i) = v;
+                    self.values[i] = v;
                 }
 
                 Other(u) => {
@@ -189,7 +189,7 @@ impl<T,U,D:SnapshotVecDelegate<T,U>> SnapshotVec<T,U,D> {
             // The root snapshot.
             self.undo_log.truncate(0);
         } else {
-            *self.undo_log.get_mut(snapshot.length) = CommittedSnapshot;
+            self.undo_log[snapshot.length] = CommittedSnapshot;
         }
     }
 }
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index 99c60dde0ac59..dc14a993016f9 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -1231,7 +1231,7 @@ impl Stack {
             InternalIndex(i) => { i + 1 }
             _ => { panic!(); }
         };
-        *self.stack.get_mut(len - 1) = InternalIndex(idx);
+        self.stack[len - 1] = InternalIndex(idx);
     }
 }
 
diff --git a/src/libstd/collections/hashmap/map.rs b/src/libstd/collections/hashmap/map.rs
index 6562a644988e6..cb47c28f8bef2 100644
--- a/src/libstd/collections/hashmap/map.rs
+++ b/src/libstd/collections/hashmap/map.rs
@@ -14,19 +14,14 @@ use clone::Clone;
 use cmp::{max, Eq, Equiv, PartialEq};
 use collections::{Collection, Mutable, MutableSet, Map, MutableMap};
 use default::Default;
-use fmt::Show;
-use fmt;
+use fmt::{mod, Show};
 use hash::{Hash, Hasher, RandomSipHasher};
-use iter::{Iterator, FromIterator, Extendable};
-use iter;
-use mem::replace;
-use mem;
+use iter::{mod, Iterator, FromIterator, Extendable};
+use mem::{mod, replace};
 use num;
-use ops::Deref;
+use ops::{Deref, Index, IndexMut};
 use option::{Some, None, Option};
-use result::{Ok, Err};
-use ops::Index;
-use core::result::Result;
+use result::{Result, Ok, Err};
 
 use super::table;
 use super::table::{
@@ -837,6 +832,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
     /// # Example
     ///
     /// ```
+    /// # #![allow(deprecated)]
     /// use std::collections::HashMap;
     ///
     /// let mut map = HashMap::new();
@@ -852,11 +848,9 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
     /// *map.get_mut(&"a") = -2;
     /// assert_eq!(map["a"], -2);
     /// ```
+    #[deprecated = "use indexing instead: `&mut map[key]`"]
     pub fn get_mut<'a>(&'a mut self, k: &K) -> &'a mut V {
-        match self.find_mut(k) {
-            Some(v) => v,
-            None => panic!("no entry found for key")
-        }
+        &mut self[*k]
     }
 
     /// Return true if the map contains a value for the specified key,
@@ -1194,13 +1188,15 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> Index<K, V> for HashMap<K, V, H> {
     }
 }
 
-// FIXME(#12825) Indexing will always try IndexMut first and that causes issues.
-/*impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> ops::IndexMut<K, V> for HashMap<K, V, H> {
+impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> IndexMut<K, V> for HashMap<K, V, H> {
     #[inline]
     fn index_mut<'a>(&'a mut self, index: &K) -> &'a mut V {
-        self.get_mut(index)
+        match self.find_mut(index) {
+            Some(v) => v,
+            None => panic!("no entry found for key")
+        }
     }
-}*/
+}
 
 /// HashMap iterator
 pub struct Entries<'a, K: 'a, V: 'a> {
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs
index f749d6c823ea3..f193ce8cffacb 100644
--- a/src/libstd/io/fs.rs
+++ b/src/libstd/io/fs.rs
@@ -963,7 +963,7 @@ mod test {
 
     macro_rules! error( ($e:expr, $s:expr) => (
         match $e {
-            Ok(val) => panic!("Unexpected success. Should've been: {}", $s),
+            Ok(_) => panic!("Unexpected success. Should've been: {}", $s),
             Err(ref err) => assert!(err.to_string().as_slice().contains($s.as_slice()),
                                     format!("`{}` did not contain `{}`", err, $s))
         }
diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs
index 6e0d81a63c951..f79cda0195e4d 100644
--- a/src/libstd/num/strconv.rs
+++ b/src/libstd/num/strconv.rs
@@ -424,10 +424,10 @@ pub fn float_to_str_bytes_common<T:NumCast+Zero+One+PartialEq+PartialOrd+Float+
                     // or set to 0 if max and carry the 1.
                     let current_digit = ascii2value(buf[i as uint]);
                     if current_digit < (radix - 1) {
-                        *buf.get_mut(i as uint) = value2ascii(current_digit+1);
+                        buf[i as uint] = value2ascii(current_digit+1);
                         break;
                     } else {
-                        *buf.get_mut(i as uint) = value2ascii(0);
+                        buf[i as uint] = value2ascii(0);
                         i -= 1;
                     }
                 }
diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs
index 1897c8638cc69..1ddc027a07eab 100644
--- a/src/libstd/path/windows.rs
+++ b/src/libstd/path/windows.rs
@@ -776,7 +776,7 @@ impl Path {
                                 let mut s = String::from_str(s.slice_to(len));
                                 unsafe {
                                     let v = s.as_mut_vec();
-                                    *v.get_mut(0) = (*v)[0]
+                                    v[0] = (*v)[0]
                                                      .to_ascii()
                                                      .to_uppercase()
                                                      .to_byte();
@@ -784,7 +784,7 @@ impl Path {
                                 if is_abs {
                                     // normalize C:/ to C:\
                                     unsafe {
-                                        *s.as_mut_vec().get_mut(2) = SEP_BYTE;
+                                        s.as_mut_vec()[2] = SEP_BYTE;
                                     }
                                 }
                                 Some(s)
@@ -794,7 +794,7 @@ impl Path {
                                 let mut s = String::from_str(s.slice_to(len));
                                 unsafe {
                                     let v = s.as_mut_vec();
-                                    *v.get_mut(4) = (*v)[4].to_ascii().to_uppercase().to_byte();
+                                    v[4] = (*v)[4].to_ascii().to_uppercase().to_byte();
                                 }
                                 Some(s)
                             }
diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs
index d1c655cb4d0bb..21e531d211a85 100644
--- a/src/libstd/rand/mod.rs
+++ b/src/libstd/rand/mod.rs
@@ -411,7 +411,7 @@ pub fn sample<T, I: Iterator<T>, R: Rng>(rng: &mut R,
     for (i, elem) in iter.enumerate() {
         let k = rng.gen_range(0, i + 1 + amount);
         if k < amount {
-            *reservoir.get_mut(k) = elem;
+            reservoir[k] = elem;
         }
     }
     return reservoir;
diff --git a/src/libsync/comm/sync.rs b/src/libsync/comm/sync.rs
index bbb4813f5f90f..42de6f66289a2 100644
--- a/src/libsync/comm/sync.rs
+++ b/src/libsync/comm/sync.rs
@@ -426,7 +426,7 @@ impl<T> Buffer<T> {
     fn enqueue(&mut self, t: T) {
         let pos = (self.start + self.size) % self.buf.len();
         self.size += 1;
-        let prev = mem::replace(self.buf.get_mut(pos), Some(t));
+        let prev = mem::replace(&mut self.buf[pos], Some(t));
         assert!(prev.is_none());
     }
 
@@ -434,7 +434,7 @@ impl<T> Buffer<T> {
         let start = self.start;
         self.size -= 1;
         self.start = (self.start + 1) % self.buf.len();
-        self.buf.get_mut(start).take().unwrap()
+        self.buf[start].take().unwrap()
     }
 
     fn size(&self) -> uint { self.size }
diff --git a/src/libsync/raw.rs b/src/libsync/raw.rs
index 4fd62ac3a1da0..1410091b924ba 100644
--- a/src/libsync/raw.rs
+++ b/src/libsync/raw.rs
@@ -308,7 +308,7 @@ impl<'a> Condvar<'a> {
                     // To avoid :broadcast_heavy, we make a new waitqueue,
                     // swap it out with the old one, and broadcast on the
                     // old one outside of the little-lock.
-                    queue = Some(mem::replace(state.blocked.get_mut(condvar_id),
+                    queue = Some(mem::replace(&mut state.blocked[condvar_id],
                                               WaitQueue::new()));
                 } else {
                     out_of_bounds = Some(state.blocked.len());
diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs
index 915c2d1b3188c..fa36577ebdb1f 100644
--- a/src/libsyntax/ast_map/mod.rs
+++ b/src/libsyntax/ast_map/mod.rs
@@ -712,7 +712,7 @@ impl<'ast> NodeCollector<'ast> {
         if id as uint >= len {
             self.map.grow(id as uint - len + 1, NotPresent);
         }
-        *self.map.get_mut(id as uint) = entry;
+        self.map[id as uint] = entry;
     }
 
     fn insert(&mut self, id: NodeId, node: Node<'ast>) {
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index a8326e79ef368..e641abbfeee64 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -785,6 +785,6 @@ impl SyntaxEnv {
 
     pub fn info<'a>(&'a mut self) -> &'a mut BlockInfo {
         let last_chain_index = self.chain.len() - 1;
-        &mut self.chain.get_mut(last_chain_index).info
+        &mut self.chain[last_chain_index].info
     }
 }
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs
index 1b12ae67ee5cb..fa9a844233a19 100644
--- a/src/libsyntax/ext/format.rs
+++ b/src/libsyntax/ext/format.rs
@@ -247,7 +247,7 @@ impl<'a, 'b> Context<'a, 'b> {
                     self.verify_same(self.args[arg].span, &ty, arg_type);
                 }
                 if self.arg_types[arg].is_none() {
-                    *self.arg_types.get_mut(arg) = Some(ty);
+                    self.arg_types[arg] = Some(ty);
                 }
             }
 
@@ -567,7 +567,7 @@ impl<'a, 'b> Context<'a, 'b> {
             let lname = self.ecx.ident_of(format!("__arg{}",
                                                   *name).as_slice());
             pats.push(self.ecx.pat_ident(e.span, lname));
-            *names.get_mut(self.name_positions[*name]) =
+            names[self.name_positions[*name]] =
                 Some(Context::format_arg(self.ecx, e.span, arg_ty,
                                          self.ecx.expr_ident(e.span, lname)));
             heads.push(self.ecx.expr_addr_of(e.span, e));
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 9260a45adb954..4de2042014843 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -288,8 +288,7 @@ pub fn parse(sess: &ParseSess,
                         // Only touch the binders we have actually bound
                         for idx in range(ei.match_lo, ei.match_hi) {
                             let sub = (ei.matches[idx]).clone();
-                            new_pos.matches
-                                   .get_mut(idx)
+                            new_pos.matches[idx]
                                    .push(Rc::new(MatchedSeq(sub, mk_sp(ei.sp_lo,
                                                                        sp.hi))));
                         }
@@ -331,8 +330,7 @@ pub fn parse(sess: &ParseSess,
                         new_ei.idx += 1u;
                         //we specifically matched zero repeats.
                         for idx in range(match_idx_lo, match_idx_hi) {
-                            new_ei.matches
-                                  .get_mut(idx)
+                            new_ei.matches[idx]
                                   .push(Rc::new(MatchedSeq(Vec::new(), sp)));
                         }
 
@@ -376,7 +374,7 @@ pub fn parse(sess: &ParseSess,
         if token_name_eq(&tok, &token::Eof) {
             if eof_eis.len() == 1u {
                 let mut v = Vec::new();
-                for dv in eof_eis.get_mut(0).matches.iter_mut() {
+                for dv in eof_eis[0].matches.iter_mut() {
                     v.push(dv.pop().unwrap());
                 }
                 return Success(nameize(sess, ms, v.as_slice()));
@@ -417,7 +415,7 @@ pub fn parse(sess: &ParseSess,
                 match ei.elts[ei.idx].node {
                   MatchNonterminal(_, name, idx) => {
                     let name_string = token::get_ident(name);
-                    ei.matches.get_mut(idx).push(Rc::new(MatchedNonterminal(
+                    ei.matches[idx].push(Rc::new(MatchedNonterminal(
                         parse_nt(&mut rust_parser, name_string.get()))));
                     ei.idx += 1u;
                   }
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index 57c72ca77c616..5523f85acebc8 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -303,7 +303,7 @@ impl Printer {
     }
     // be very careful with this!
     pub fn replace_last_token(&mut self, t: Token) {
-        *self.token.get_mut(self.right) = t;
+        self.token[self.right] = t;
     }
     pub fn pretty_print(&mut self, t: Token) -> io::IoResult<()> {
         debug!("pp ~[{},{}]", self.left, self.right);
@@ -327,8 +327,8 @@ impl Printer {
             } else { self.advance_right(); }
             debug!("pp Begin({})/buffer ~[{},{}]",
                    b.offset, self.left, self.right);
-            *self.token.get_mut(self.right) = t;
-            *self.size.get_mut(self.right) = -self.right_total;
+            self.token[self.right] = t;
+            self.size[self.right] = -self.right_total;
             let right = self.right;
             self.scan_push(right);
             Ok(())
@@ -340,8 +340,8 @@ impl Printer {
             } else {
                 debug!("pp End/buffer ~[{},{}]", self.left, self.right);
                 self.advance_right();
-                *self.token.get_mut(self.right) = t;
-                *self.size.get_mut(self.right) = -1;
+                self.token[self.right] = t;
+                self.size[self.right] = -1;
                 let right = self.right;
                 self.scan_push(right);
                 Ok(())
@@ -359,8 +359,8 @@ impl Printer {
             self.check_stack(0);
             let right = self.right;
             self.scan_push(right);
-            *self.token.get_mut(self.right) = t;
-            *self.size.get_mut(self.right) = -self.right_total;
+            self.token[self.right] = t;
+            self.size[self.right] = -self.right_total;
             self.right_total += b.blank_space;
             Ok(())
           }
@@ -373,8 +373,8 @@ impl Printer {
                 debug!("pp String('{}')/buffer ~[{},{}]",
                        *s, self.left, self.right);
                 self.advance_right();
-                *self.token.get_mut(self.right) = t.clone();
-                *self.size.get_mut(self.right) = len;
+                self.token[self.right] = t.clone();
+                self.size[self.right] = len;
                 self.right_total += len;
                 self.check_stream()
             }
@@ -391,7 +391,7 @@ impl Printer {
                 if self.left == self.scan_stack[self.bottom] {
                     debug!("setting {} to infinity and popping", self.left);
                     let scanned = self.scan_pop_bottom();
-                    *self.size.get_mut(scanned) = SIZE_INFINITY;
+                    self.size[scanned] = SIZE_INFINITY;
                 }
             }
             let left = self.token[self.left].clone();
@@ -412,7 +412,7 @@ impl Printer {
             self.top %= self.buf_len;
             assert!((self.top != self.bottom));
         }
-        *self.scan_stack.get_mut(self.top) = x;
+        self.scan_stack[self.top] = x;
     }
     pub fn scan_pop(&mut self) -> uint {
         assert!((!self.scan_stack_empty));
@@ -474,20 +474,19 @@ impl Printer {
                 Begin(_) => {
                     if k > 0 {
                         let popped = self.scan_pop();
-                        *self.size.get_mut(popped) = self.size[x] +
-                            self.right_total;
+                        self.size[popped] = self.size[x] + self.right_total;
                         self.check_stack(k - 1);
                     }
                 }
                 End => {
                     // paper says + not =, but that makes no sense.
                     let popped = self.scan_pop();
-                    *self.size.get_mut(popped) = 1;
+                    self.size[popped] = 1;
                     self.check_stack(k + 1);
                 }
                 _ => {
                     let popped = self.scan_pop();
-                    *self.size.get_mut(popped) = self.size[x] + self.right_total;
+                    self.size[popped] = self.size[x] + self.right_total;
                     if k > 0 {
                         self.check_stack(k);
                     }
diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs
index 72c61f3afc7cd..21cf1d11e8009 100644
--- a/src/libtest/stats.rs
+++ b/src/libtest/stats.rs
@@ -185,7 +185,7 @@ impl<'a, T: FloatMath + FromPrimitive> Stats<T> for &'a [T] {
                 let hi = x + y;
                 let lo = y - (hi - x);
                 if !lo.is_zero() {
-                    *partials.get_mut(j) = lo;
+                    partials[j] = lo;
                     j += 1;
                 }
                 x = hi;
@@ -193,7 +193,7 @@ impl<'a, T: FloatMath + FromPrimitive> Stats<T> for &'a [T] {
             if j >= partials.len() {
                 partials.push(x);
             } else {
-                *partials.get_mut(j) = x;
+                partials[j] = x;
                 partials.truncate(j+1);
             }
         }

From 6fcba8826fd26028341a35d88b07208378ac05ea Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Thu, 30 Oct 2014 09:13:02 -0700
Subject: [PATCH 34/34] Test fixes and rebase conflicts

---
 src/libcore/panicking.rs                           |  6 +++---
 src/libnative/io/timer_windows.rs                  |  2 +-
 src/librustc/lint/context.rs                       |  2 +-
 src/libstd/dynamic_lib.rs                          |  1 +
 src/libstd/os.rs                                   |  2 +-
 src/libsyntax/ext/quote.rs                         |  2 +-
 src/libsyntax/parse/token.rs                       | 14 +++++++-------
 .../coerce-bare-fn-to-closure-and-proc.rs          |  4 ++--
 8 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs
index 62c9d907cb227..39de04c27cecb 100644
--- a/src/libcore/panicking.rs
+++ b/src/libcore/panicking.rs
@@ -28,7 +28,7 @@
 //! one function. Currently, the actual symbol is declared in the standard
 //! library, but the location of this may change over time.
 
-#![allow(dead_code, missing_doc)]
+#![allow(dead_code, missing_docs)]
 
 use fmt;
 use intrinsics;
@@ -63,7 +63,7 @@ fn panic_bounds_check(file_line: &(&'static str, uint),
 #[cfg(stage0)]
 #[cold] #[inline(never)]
 pub fn panic_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
-    #[allow(ctypes)]
+    #[allow(improper_ctypes)]
     extern {
         #[lang = "fail_fmt"]
         fn panic_impl(fmt: &fmt::Arguments, file: &'static str,
@@ -104,7 +104,7 @@ fn panic_bounds_check(file_line: &(&'static str, uint),
 #[cfg(not(stage0))]
 #[cold] #[inline(never)]
 pub fn panic_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
-    #[allow(ctypes)]
+    #[allow(improper_ctypes)]
     extern {
         #[lang = "panic_fmt"]
         fn panic_impl(fmt: &fmt::Arguments, file: &'static str,
diff --git a/src/libnative/io/timer_windows.rs b/src/libnative/io/timer_windows.rs
index 421cc28e157b1..c17c541fc01e6 100644
--- a/src/libnative/io/timer_windows.rs
+++ b/src/libnative/io/timer_windows.rs
@@ -79,7 +79,7 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>, _: ()) {
             }
         } else {
             let remove = {
-                match chans.get_mut(idx as uint - 1) {
+                match &mut chans[idx as uint - 1] {
                     &(ref mut c, oneshot) => { c.call(); oneshot }
                 }
             };
diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs
index a75b98a54706e..aa8e1ed270368 100644
--- a/src/librustc/lint/context.rs
+++ b/src/librustc/lint/context.rs
@@ -254,7 +254,7 @@ impl LintStore {
 
     }
 
-    #[allow(unused_variable)]
+    #[allow(unused_variables)]
     fn find_lint(&self, lint_name: &str, sess: &Session, span: Option<Span>)
                  -> Option<LintId>
     {
diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs
index 23cae2443c3a2..ec6eef07c9541 100644
--- a/src/libstd/dynamic_lib.rs
+++ b/src/libstd/dynamic_lib.rs
@@ -286,6 +286,7 @@ pub mod dl {
     use os;
     use ptr;
     use result::{Ok, Err, Result};
+    use slice::ImmutableSlice;
     use str::StrSlice;
     use str;
     use string::String;
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 6e1eb82768cdb..d4e6251cebeb0 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -144,7 +144,7 @@ pub mod windows {
     use option::{None, Option};
     use option;
     use os::TMPBUF_SZ;
-    use slice::MutableSlice;
+    use slice::{MutableSlice, ImmutableSlice};
     use string::String;
     use str::StrSlice;
     use vec::Vec;
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 2151f79cd7b67..f751655c9ff62 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -540,7 +540,7 @@ fn mk_delim(cx: &ExtCtxt, sp: Span, delim: token::DelimToken) -> P<ast::Expr> {
     mk_token_path(cx, sp, name)
 }
 
-#[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot
+#[allow(non_upper_case_globals)]
 fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P<ast::Expr> {
     match *tok {
         token::BinOp(binop) => {
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index c1720766ff3ba..d56aa8da72a84 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -110,10 +110,10 @@ pub enum DelimToken {
 }
 
 #[cfg(stage0)]
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const ModName: bool = true;
 #[cfg(stage0)]
-#[allow(non_uppercase_statics)]
+#[allow(non_upper_case_globals)]
 pub const Plain: bool = false;
 
 #[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
@@ -263,7 +263,7 @@ impl Token {
 
     /// Returns `true` if the token is a path that is not followed by a `::`
     /// token.
-    #[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot
+    #[allow(non_upper_case_globals)]
     pub fn is_plain_ident(&self) -> bool {
         match *self {
             Ident(_, Plain) => true,
@@ -311,7 +311,7 @@ impl Token {
     }
 
     /// Returns `true` if the token is a given keyword, `kw`.
-    #[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot
+    #[allow(non_upper_case_globals)]
     pub fn is_keyword(&self, kw: keywords::Keyword) -> bool {
         match *self {
             Ident(sid, Plain) => kw.to_name() == sid.name,
@@ -321,7 +321,7 @@ impl Token {
 
     /// Returns `true` if the token is either a special identifier, or a strict
     /// or reserved keyword.
-    #[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot
+    #[allow(non_upper_case_globals)]
     pub fn is_any_keyword(&self) -> bool {
         match *self {
             Ident(sid, Plain) => {
@@ -338,7 +338,7 @@ impl Token {
     }
 
     /// Returns `true` if the token may not appear as an identifier.
-    #[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot
+    #[allow(non_upper_case_globals)]
     pub fn is_strict_keyword(&self) -> bool {
         match *self {
             Ident(sid, Plain) => {
@@ -364,7 +364,7 @@ impl Token {
 
     /// Returns `true` if the token is a keyword that has been reserved for
     /// possible future use.
-    #[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot
+    #[allow(non_upper_case_globals)]
     pub fn is_reserved_keyword(&self) -> bool {
         match *self {
             Ident(sid, Plain) => {
diff --git a/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs b/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs
index 087ebf4e28c58..9f258aee746f2 100644
--- a/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs
+++ b/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs
@@ -14,8 +14,8 @@ fn main() {
     let f = foo;
     let f_closure: || = f;
     //~^ ERROR: cannot coerce non-statically resolved bare fn to closure
-    //~^ HELP: consider embedding the function in a closure
+    //~^^ HELP: consider embedding the function in a closure
     let f_proc: proc() = f;
     //~^ ERROR: cannot coerce non-statically resolved bare fn to closure
-    //~^ HELP: consider embedding the function in a closure
+    //~^^ HELP: consider embedding the function in a closure
 }