about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/compiletest/common.rs7
-rw-r--r--src/doc/reference.md6
-rw-r--r--src/doc/trpl/more-strings.md4
-rw-r--r--src/doc/trpl/ownership.md1
-rwxr-xr-xsrc/etc/check-summary.py8
-rw-r--r--src/etc/errorck.py4
-rwxr-xr-xsrc/etc/extract_grammar.py136
-rwxr-xr-xsrc/etc/gdb_rust_pretty_printing.py364
-rwxr-xr-xsrc/etc/generate-keyword-tests.py2
-rwxr-xr-xsrc/etc/get-snapshot.py94
-rw-r--r--src/etc/htmldocck.py60
-rwxr-xr-xsrc/etc/latest-unix-snaps.py22
-rw-r--r--src/etc/lldb_batchmode.py218
-rw-r--r--src/etc/lldb_rust_formatters.py340
-rw-r--r--src/etc/make-win-dist.py9
-rw-r--r--src/etc/maketest.py38
-rw-r--r--src/etc/mirror-all-snapshots.py7
-rw-r--r--src/etc/mklldeps.py3
-rw-r--r--src/etc/snapshot.py285
-rwxr-xr-xsrc/etc/sugarise-doc-comments.py6
-rw-r--r--src/etc/tidy.py36
-rwxr-xr-xsrc/etc/unicode.py4
-rw-r--r--src/etc/vim/syntax_checkers/rust/rustc.vim2
-rw-r--r--src/libcollections/slice.rs109
-rw-r--r--src/libcollections/vec.rs49
-rw-r--r--src/libcore/nonzero.rs2
-rw-r--r--src/libcore/ops.rs8
-rw-r--r--src/librustc_llvm/diagnostic.rs4
-rw-r--r--src/librustdoc/html/static/main.css9
-rw-r--r--src/libstd/os.rs8
-rw-r--r--src/libstd/rand/mod.rs54
-rw-r--r--src/libstd/rand/os.rs8
-rw-r--r--src/libunicode/lib.rs1
-rw-r--r--src/libunicode/tables.rs5
-rw-r--r--src/libunicode/u_str.rs4
-rw-r--r--src/test/auxiliary/issue-14422.rs3
-rw-r--r--src/test/auxiliary/issue13213aux.rs5
-rw-r--r--src/test/auxiliary/method_self_arg1.rs3
-rw-r--r--src/test/auxiliary/method_self_arg2.rs3
-rw-r--r--src/test/auxiliary/xcrate_unit_struct.rs15
-rw-r--r--src/test/bench/noise.rs3
-rw-r--r--src/test/bench/shootout-chameneos-redux.rs6
-rw-r--r--src/test/bench/shootout-fannkuch-redux.rs6
-rw-r--r--src/test/bench/shootout-fasta-redux.rs3
-rw-r--r--src/test/bench/shootout-k-nucleotide.rs4
-rw-r--r--src/test/bench/shootout-nbody.rs3
-rw-r--r--src/test/bench/task-perf-one-million.rs70
-rw-r--r--src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs6
-rw-r--r--src/test/compile-fail/borrowck-borrow-from-stack-variable.rs6
-rw-r--r--src/test/compile-fail/borrowck-use-mut-borrow.rs3
-rw-r--r--src/test/compile-fail/dst-index.rs6
-rw-r--r--src/test/compile-fail/kindck-copy.rs3
-rw-r--r--src/test/debuginfo/generic-method-on-generic-struct.rs3
-rw-r--r--src/test/debuginfo/method-on-enum.rs3
-rw-r--r--src/test/debuginfo/method-on-generic-struct.rs3
-rw-r--r--src/test/debuginfo/method-on-struct.rs3
-rw-r--r--src/test/debuginfo/method-on-trait.rs3
-rw-r--r--src/test/debuginfo/method-on-tuple-struct.rs3
-rw-r--r--src/test/debuginfo/self-in-default-method.rs3
-rw-r--r--src/test/debuginfo/self-in-generic-default-method.rs3
-rw-r--r--src/test/pretty/block-disambig.rs3
-rw-r--r--src/test/run-make/extern-fn-with-packed-struct/test.rs4
-rw-r--r--src/test/run-pass/borrowck-univariant-enum.rs3
-rw-r--r--src/test/run-pass/builtin-superkinds-in-metadata.rs3
-rw-r--r--src/test/run-pass/cell-does-not-clone.rs3
-rw-r--r--src/test/run-pass/class-impl-very-parameterized-trait.rs4
-rw-r--r--src/test/run-pass/coherence-impl-in-fn.rs2
-rw-r--r--src/test/run-pass/coherence-where-clause.rs4
-rw-r--r--src/test/run-pass/const-nullary-univariant-enum.rs3
-rw-r--r--src/test/run-pass/dst-struct-sole.rs4
-rw-r--r--src/test/run-pass/dst-struct.rs4
-rw-r--r--src/test/run-pass/dst-trait.rs8
-rw-r--r--src/test/run-pass/empty-tag.rs4
-rw-r--r--src/test/run-pass/enum-discrim-width-stuff.rs3
-rw-r--r--src/test/run-pass/explicit-self-generic.rs3
-rw-r--r--src/test/run-pass/export-unexported-dep.rs3
-rw-r--r--src/test/run-pass/expr-copy.rs3
-rw-r--r--src/test/run-pass/expr-if-struct.rs7
-rw-r--r--src/test/run-pass/expr-match-struct.rs7
-rw-r--r--src/test/run-pass/exterior.rs3
-rw-r--r--src/test/run-pass/extern-pass-TwoU16s.rs4
-rw-r--r--src/test/run-pass/extern-pass-TwoU32s.rs4
-rw-r--r--src/test/run-pass/extern-pass-TwoU64s.rs4
-rw-r--r--src/test/run-pass/extern-pass-TwoU8s.rs4
-rw-r--r--src/test/run-pass/foreign-fn-with-byval.rs3
-rw-r--r--src/test/run-pass/generic-fn.rs3
-rw-r--r--src/test/run-pass/guards-not-exhaustive.rs3
-rw-r--r--src/test/run-pass/guards.rs3
-rw-r--r--src/test/run-pass/hrtb-opt-in-copy.rs3
-rw-r--r--src/test/run-pass/issue-12860.rs4
-rw-r--r--src/test/run-pass/issue-19100.rs3
-rw-r--r--src/test/run-pass/issue-2288.rs3
-rw-r--r--src/test/run-pass/issue-2633.rs6
-rw-r--r--src/test/run-pass/issue-3121.rs7
-rw-r--r--src/test/run-pass/issue-3563-3.rs9
-rw-r--r--src/test/run-pass/issue-3743.rs3
-rw-r--r--src/test/run-pass/issue-3753.rs6
-rw-r--r--src/test/run-pass/issue-5688.rs3
-rw-r--r--src/test/run-pass/match-arm-statics.rs3
-rw-r--r--src/test/run-pass/method-self-arg-trait.rs3
-rw-r--r--src/test/run-pass/method-self-arg.rs3
-rw-r--r--src/test/run-pass/monomorphize-abi-alignment.rs11
-rw-r--r--src/test/run-pass/multidispatch1.rs3
-rw-r--r--src/test/run-pass/multidispatch2.rs3
-rw-r--r--src/test/run-pass/newtype.rs6
-rw-r--r--src/test/run-pass/out-pointer-aliasing.rs3
-rw-r--r--src/test/run-pass/overloaded-autoderef-order.rs6
-rw-r--r--src/test/run-pass/packed-struct-vec.rs4
-rw-r--r--src/test/run-pass/rec-tup.rs3
-rw-r--r--src/test/run-pass/rec.rs6
-rw-r--r--src/test/run-pass/regions-dependent-addr-of.rs3
-rw-r--r--src/test/run-pass/regions-early-bound-used-in-bound-method.rs3
-rw-r--r--src/test/run-pass/regions-early-bound-used-in-type-param.rs3
-rw-r--r--src/test/run-pass/regions-mock-tcx.rs14
-rw-r--r--src/test/run-pass/self-in-mut-slot-immediate-value.rs3
-rw-r--r--src/test/run-pass/simd-generics.rs6
-rw-r--r--src/test/run-pass/small-enum-range-edge.rs6
-rw-r--r--src/test/run-pass/struct-return.rs6
-rw-r--r--src/test/run-pass/structured-compare.rs4
-rw-r--r--src/test/run-pass/tag-variant-disr-val.rs3
-rw-r--r--src/test/run-pass/trait-coercion-generic.rs3
-rw-r--r--src/test/run-pass/trait-coercion.rs3
-rw-r--r--src/test/run-pass/typeclasses-eq-example-static.rs4
-rw-r--r--src/test/run-pass/typeclasses-eq-example.rs4
-rw-r--r--src/test/run-pass/ufcs-explicit-self.rs6
-rw-r--r--src/test/run-pass/unboxed-closures-monomorphization.rs4
126 files changed, 1204 insertions, 1167 deletions
diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs
index b2e852a36f7..40e123e5323 100644
--- a/src/compiletest/common.rs
+++ b/src/compiletest/common.rs
@@ -13,7 +13,7 @@ use std::fmt;
 use std::str::FromStr;
 
 #[cfg(stage0)] // NOTE: remove impl after snapshot
-#[derive(Clone, PartialEq, Show)]
+#[derive(Clone, Copy, PartialEq, Show)]
 pub enum Mode {
     CompileFail,
     RunFail,
@@ -26,7 +26,7 @@ pub enum Mode {
 }
 
 #[cfg(not(stage0))] // NOTE: remove cfg after snapshot
-#[derive(Clone, PartialEq, Debug)]
+#[derive(Clone, Copy, PartialEq, Debug)]
 pub enum Mode {
     CompileFail,
     RunFail,
@@ -38,9 +38,6 @@ pub enum Mode {
     Codegen
 }
 
-
-impl Copy for Mode {}
-
 impl FromStr for Mode {
     fn from_str(s: &str) -> Option<Mode> {
         match s {
diff --git a/src/doc/reference.md b/src/doc/reference.md
index a52100c4cdd..59ac173f97a 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -1680,8 +1680,8 @@ specific type.
 Implementations are defined with the keyword `impl`.
 
 ```
+# #[derive(Copy)]
 # struct Point {x: f64, y: f64};
-# impl Copy for Point {}
 # type Surface = i32;
 # struct BoundingBox {x: f64, y: f64, width: f64, height: f64};
 # trait Shape { fn draw(&self, Surface); fn bounding_box(&self) -> BoundingBox; }
@@ -2219,7 +2219,7 @@ For any lint check `C`:
 
 The lint checks supported by the compiler can be found via `rustc -W help`,
 along with their default settings.  [Compiler
-plugins](book/plugin.html#lint-plugins) can provide additional lint checks.
+plugins](book/plugins.html#lint-plugins) can provide additional lint checks.
 
 ```{.ignore}
 mod m1 {
@@ -4163,4 +4163,4 @@ that have since been removed):
   pattern syntax
 
 [ffi]: book/ffi.html
-[plugin]: book/plugin.html
+[plugin]: book/plugins.html
diff --git a/src/doc/trpl/more-strings.md b/src/doc/trpl/more-strings.md
index 07b49751b10..b4669b0819f 100644
--- a/src/doc/trpl/more-strings.md
+++ b/src/doc/trpl/more-strings.md
@@ -279,5 +279,5 @@ Many more bytes than graphemes!
 
 # Other Documentation
 
-* [the `&str` API documentation](std/str/index.html)
-* [the `String` API documentation](std/string/index.html)
+* [the `&str` API documentation](../std/str/index.html)
+* [the `String` API documentation](../std/string/index.html)
diff --git a/src/doc/trpl/ownership.md b/src/doc/trpl/ownership.md
index 56cb5b1de69..9e3a3f12d1d 100644
--- a/src/doc/trpl/ownership.md
+++ b/src/doc/trpl/ownership.md
@@ -533,6 +533,7 @@ fn substr<'a>(s: &'a str, until: u32) -> &'a str; // expanded
 fn get_str() -> &str; // ILLEGAL, no inputs
 
 fn frob(s: &str, t: &str) -> &str; // ILLEGAL, two inputs
+fn frob<'a, 'b>(s: &'a str, t: &'b str) -> &str; // Expanded: Output lifetime is unclear
 
 fn get_mut(&mut self) -> &mut T; // elided
 fn get_mut<'a>(&'a mut self) -> &'a mut T; // expanded
diff --git a/src/etc/check-summary.py b/src/etc/check-summary.py
index 55428a6fcc4..917e1970a36 100755
--- a/src/etc/check-summary.py
+++ b/src/etc/check-summary.py
@@ -15,6 +15,7 @@ import sys
 
 if __name__ == '__main__':
     summaries = []
+
     def summarise(fname):
         summary = {}
         with open(fname) as fd:
@@ -27,12 +28,14 @@ if __name__ == '__main__':
                 # track bench runs
                 if splitline[1] == 'ns/iter':
                     status = 'bench'
-                if not summary.has_key(status):
+                if status not in summary:
                     summary[status] = []
                 summary[status].append(test)
             summaries.append((fname, summary))
+
     def count(t):
         return sum(map(lambda (f, s): len(s.get(t, [])), summaries))
+
     logfiles = sys.argv[1:]
     for files in map(glob.glob, logfiles):
         map(summarise, files)
@@ -41,8 +44,9 @@ if __name__ == '__main__':
     ignored = count('ignored')
     measured = count('bench')
     print "summary of %d test runs: %d passed; %d failed; %d ignored; %d measured" % \
-            (len(logfiles), ok, failed, ignored, measured)
+          (len(logfiles), ok, failed, ignored, measured)
     print ""
+
     if failed > 0:
         print "failed tests:"
         for f, s in summaries:
diff --git a/src/etc/errorck.py b/src/etc/errorck.py
index 952e299265d..c940359abc1 100644
--- a/src/etc/errorck.py
+++ b/src/etc/errorck.py
@@ -11,7 +11,9 @@
 # Digs error codes out of files named 'diagnostics.rs' across
 # the tree, and ensures thare are no duplicates.
 
-import sys, os, re
+import sys
+import os
+import re
 
 src_dir = sys.argv[1]
 errcode_map = {}
diff --git a/src/etc/extract_grammar.py b/src/etc/extract_grammar.py
index 53781652902..a12c3298cb3 100755
--- a/src/etc/extract_grammar.py
+++ b/src/etc/extract_grammar.py
@@ -14,11 +14,11 @@
 
 import fileinput
 
-collections = { "gram": [],
-                "keyword": [],
-                "reserved": [],
-                "binop": [],
-                "unop": [] }
+collections = {"gram": [],
+               "keyword": [],
+               "reserved": [],
+               "binop": [],
+               "unop": []}
 
 
 in_coll = False
@@ -47,66 +47,66 @@ for line in fileinput.input(openhook=fileinput.hook_encoded("utf-8")):
 # Define operator symbol-names here
 
 tokens = ["non_star", "non_slash", "non_eol",
-          "non_single_quote", "non_double_quote", "ident" ]
+          "non_single_quote", "non_double_quote", "ident"]
 
 symnames = {
-".": "dot",
-"+": "plus",
-"-": "minus",
-"/": "slash",
-"*": "star",
-"%": "percent",
-
-"~": "tilde",
-"@": "at",
-
-"!": "not",
-"&": "and",
-"|": "or",
-"^": "xor",
-
-"<<": "lsl",
-">>": "lsr",
-">>>": "asr",
-
-"&&": "andand",
-"||": "oror",
-
-"<" : "lt",
-"<=" : "le",
-"==" : "eqeq",
-">=" : "ge",
-">" : "gt",
-
-"=": "eq",
-
-"+=": "plusequal",
-"-=": "minusequal",
-"/=": "divequal",
-"*=": "starequal",
-"%=": "percentequal",
-
-"&=": "andequal",
-"|=": "orequal",
-"^=": "xorequal",
-
-">>=": "lsrequal",
-">>>=": "asrequal",
-"<<=": "lslequal",
-
-"::": "coloncolon",
-
-"->": "rightarrow",
-"<-": "leftarrow",
-"<->": "swaparrow",
-
-"//": "linecomment",
-"/*": "openblockcomment",
-"*/": "closeblockcomment",
-"macro_rules": "macro_rules",
-"=>" : "eg",
-".." : "dotdot",
-","  : "comma"
+    ".": "dot",
+    "+": "plus",
+    "-": "minus",
+    "/": "slash",
+    "*": "star",
+    "%": "percent",
+
+    "~": "tilde",
+    "@": "at",
+
+    "!": "not",
+    "&": "and",
+    "|": "or",
+    "^": "xor",
+
+    "<<": "lsl",
+    ">>": "lsr",
+    ">>>": "asr",
+
+    "&&": "andand",
+    "||": "oror",
+
+    "<": "lt",
+    "<=": "le",
+    "==": "eqeq",
+    ">=": "ge",
+    ">": "gt",
+
+    "=": "eq",
+
+    "+=": "plusequal",
+    "-=": "minusequal",
+    "/=": "divequal",
+    "*=": "starequal",
+    "%=": "percentequal",
+
+    "&=": "andequal",
+    "|=": "orequal",
+    "^=": "xorequal",
+
+    ">>=": "lsrequal",
+    ">>>=": "asrequal",
+    "<<=": "lslequal",
+
+    "::": "coloncolon",
+
+    "->": "rightarrow",
+    "<-": "leftarrow",
+    "<->": "swaparrow",
+
+    "//": "linecomment",
+    "/*": "openblockcomment",
+    "*/": "closeblockcomment",
+    "macro_rules": "macro_rules",
+    "=>": "eg",
+    "..": "dotdot",
+    ",": "comma"
 }
 
 lines = []
@@ -126,8 +126,8 @@ for line in collections["gram"]:
                                         + word)
                 if word not in tokens:
                     if (word in collections["keyword"] or
-                        word in collections["reserved"]):
-                       tokens.append(word)
+                            word in collections["reserved"]):
+                        tokens.append(word)
                     else:
                         raise Exception("unknown keyword/reserved word: "
                                         + word)
@@ -149,8 +149,8 @@ for sym in collections["unop"] + collections["binop"] + symnames.keys():
 print("%start parser, token;")
 print("%%token %s ;" % ("\n\t, ".join(tokens)))
 for coll in ["keyword", "reserved"]:
-    print("%s: %s ; " % (coll, "\n\t| ".join(collections[coll])));
+    print("%s: %s ; " % (coll, "\n\t| ".join(collections[coll])))
 for coll in ["binop", "unop"]:
     print("%s: %s ; " % (coll, "\n\t| ".join([symnames[x]
-                                              for x in collections[coll]])));
-print("\n".join(lines));
+                                              for x in collections[coll]])))
+print("\n".join(lines))
diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py
index b6770c99975..c5587bb10d1 100755
--- a/src/etc/gdb_rust_pretty_printing.py
+++ b/src/etc/gdb_rust_pretty_printing.py
@@ -14,181 +14,189 @@ import gdb
 # GDB Pretty Printing Module for Rust
 #===============================================================================
 
+
 def register_printers(objfile):
-  "Registers Rust pretty printers for the given objfile"
-  objfile.pretty_printers.append(rust_pretty_printer_lookup_function)
+    "Registers Rust pretty printers for the given objfile"
+    objfile.pretty_printers.append(rust_pretty_printer_lookup_function)
+
 
 def rust_pretty_printer_lookup_function(val):
-  "Returns the correct Rust pretty printer for the given value if there is one"
-  type_code = val.type.code
-
-  if type_code == gdb.TYPE_CODE_STRUCT:
-    struct_kind = classify_struct(val.type)
-
-    if struct_kind == STRUCT_KIND_STR_SLICE:
-      return RustStringSlicePrinter(val)
-
-    if struct_kind == STRUCT_KIND_TUPLE:
-      return RustTuplePrinter(val)
-
-    if struct_kind == STRUCT_KIND_TUPLE_STRUCT:
-      return RustTupleStructPrinter(val, False)
-
-    if struct_kind == STRUCT_KIND_CSTYLE_VARIANT:
-      return RustCStyleEnumPrinter(val[get_field_at_index(val, 0)])
-
-    if struct_kind == STRUCT_KIND_TUPLE_VARIANT:
-      return RustTupleStructPrinter(val, True)
-
-    if struct_kind == STRUCT_KIND_STRUCT_VARIANT:
-      return RustStructPrinter(val, True)
-
-    return RustStructPrinter(val, False)
-
-  # Enum handling
-  if type_code == gdb.TYPE_CODE_UNION:
-    enum_members = list(val.type.fields())
-    enum_member_count = len(enum_members)
-
-    if enum_member_count == 0:
-      return RustStructPrinter(val, False)
-
-    if enum_member_count == 1:
-      first_variant_name = enum_members[0].name
-      if first_variant_name == None:
-        # This is a singleton enum
-        return rust_pretty_printer_lookup_function(val[enum_members[0]])
-      else:
-        assert first_variant_name.startswith("RUST$ENCODED$ENUM$")
-        # This is a space-optimized enum.
-        # This means this enum has only two states, and Rust uses one of the
-        # fields somewhere in the struct to determine which of the two states
-        # it's in. The location of the field is encoded in the name as something
-        # like RUST$ENCODED$ENUM$(num$)*name_of_zero_state
-        last_separator_index = first_variant_name.rfind("$")
-        start_index = len("RUST$ENCODED$ENUM$")
-        disr_field_indices = first_variant_name[start_index :
-                                              last_separator_index].split("$")
-        disr_field_indices = [int(index) for index in disr_field_indices]
-
-        sole_variant_val = val[enum_members[0]]
-        discriminant = sole_variant_val
-        for disr_field_index in disr_field_indices:
-          disr_field = get_field_at_index(discriminant, disr_field_index)
-          discriminant = discriminant[disr_field]
-
-        # If the discriminant field is a fat pointer we have to consider the
-        # first word as the true discriminant
-        if discriminant.type.code == gdb.TYPE_CODE_STRUCT:
-          discriminant = discriminant[get_field_at_index(discriminant, 0)]
-
-        if discriminant == 0:
-          null_variant_name = first_variant_name[last_separator_index + 1:]
-          return IdentityPrinter(null_variant_name)
-
-        return rust_pretty_printer_lookup_function(sole_variant_val)
-
-    # This is a regular enum, extract the discriminant
-    discriminant_name, discriminant_val = extract_discriminant_value(val)
-    return rust_pretty_printer_lookup_function(val[enum_members[discriminant_val]])
-
-  # No pretty printer has been found
-  return None
+    "Returns the correct Rust pretty printer for the given value if there is one"
+    type_code = val.type.code
+
+    if type_code == gdb.TYPE_CODE_STRUCT:
+        struct_kind = classify_struct(val.type)
+
+        if struct_kind == STRUCT_KIND_STR_SLICE:
+            return RustStringSlicePrinter(val)
+
+        if struct_kind == STRUCT_KIND_TUPLE:
+            return RustTuplePrinter(val)
+
+        if struct_kind == STRUCT_KIND_TUPLE_STRUCT:
+            return RustTupleStructPrinter(val, False)
+
+        if struct_kind == STRUCT_KIND_CSTYLE_VARIANT:
+            return RustCStyleEnumPrinter(val[get_field_at_index(val, 0)])
+
+        if struct_kind == STRUCT_KIND_TUPLE_VARIANT:
+            return RustTupleStructPrinter(val, True)
+
+        if struct_kind == STRUCT_KIND_STRUCT_VARIANT:
+            return RustStructPrinter(val, True)
+
+        return RustStructPrinter(val, False)
+
+    # Enum handling
+    if type_code == gdb.TYPE_CODE_UNION:
+        enum_members = list(val.type.fields())
+        enum_member_count = len(enum_members)
+
+        if enum_member_count == 0:
+            return RustStructPrinter(val, False)
+
+        if enum_member_count == 1:
+            first_variant_name = enum_members[0].name
+            if first_variant_name is None:
+                # This is a singleton enum
+                return rust_pretty_printer_lookup_function(val[enum_members[0]])
+            else:
+                assert first_variant_name.startswith("RUST$ENCODED$ENUM$")
+                # This is a space-optimized enum.
+                # This means this enum has only two states, and Rust uses one
+                # of the fields somewhere in the struct to determine which of
+                # the two states it's in. The location of the field is encoded
+                # in the name as something like
+                # RUST$ENCODED$ENUM$(num$)*name_of_zero_state
+                last_separator_index = first_variant_name.rfind("$")
+                start_index = len("RUST$ENCODED$ENUM$")
+                disr_field_indices = first_variant_name[start_index:last_separator_index].split("$")
+                disr_field_indices = [int(index) for index in disr_field_indices]
+
+                sole_variant_val = val[enum_members[0]]
+                discriminant = sole_variant_val
+                for disr_field_index in disr_field_indices:
+                    disr_field = get_field_at_index(discriminant, disr_field_index)
+                    discriminant = discriminant[disr_field]
+
+                # If the discriminant field is a fat pointer we have to consider the
+                # first word as the true discriminant
+                if discriminant.type.code == gdb.TYPE_CODE_STRUCT:
+                    discriminant = discriminant[get_field_at_index(discriminant, 0)]
+
+                if discriminant == 0:
+                    null_variant_name = first_variant_name[last_separator_index + 1:]
+                    return IdentityPrinter(null_variant_name)
+
+                return rust_pretty_printer_lookup_function(sole_variant_val)
+
+        # This is a regular enum, extract the discriminant
+        discriminant_name, discriminant_val = extract_discriminant_value(val)
+        return rust_pretty_printer_lookup_function(val[enum_members[discriminant_val]])
+
+    # No pretty printer has been found
+    return None
 
 #=------------------------------------------------------------------------------
 # Pretty Printer Classes
 #=------------------------------------------------------------------------------
 
+
 class RustStructPrinter:
-  def __init__(self, val, hide_first_field):
-    self.val = val
-    self.hide_first_field = hide_first_field
-
-  def to_string(self):
-    return self.val.type.tag
-
-  def children(self):
-    cs = []
-    for field in self.val.type.fields():
-      field_name = field.name
-      # Normally the field name is used as a key to access the field value,
-      # because that's also supported in older versions of GDB...
-      field_key = field_name
-      if field_name == None:
-        field_name = ""
-        # ... but for fields without a name (as in tuples), we have to fall back
-        # to the newer method of using the field object directly as key. In
-        # older versions of GDB, this will just fail.
-        field_key = field
-      name_value_tuple = ( field_name, self.val[field_key] )
-      cs.append( name_value_tuple )
-
-    if self.hide_first_field:
-      cs = cs[1:]
-
-    return cs
+    def __init__(self, val, hide_first_field):
+        self.val = val
+        self.hide_first_field = hide_first_field
+
+    def to_string(self):
+        return self.val.type.tag
+
+    def children(self):
+        cs = []
+        for field in self.val.type.fields():
+            field_name = field.name
+            # Normally the field name is used as a key to access the field
+            # value, because that's also supported in older versions of GDB...
+            field_key = field_name
+            if field_name is None:
+                field_name = ""
+                # ... but for fields without a name (as in tuples), we have to
+                # fall back to the newer method of using the field object
+                # directly as key. In older versions of GDB, this will just
+                # fail.
+                field_key = field
+            name_value_tuple = (field_name, self.val[field_key])
+            cs.append(name_value_tuple)
+
+        if self.hide_first_field:
+            cs = cs[1:]
+
+        return cs
+
 
 class RustTuplePrinter:
-  def __init__(self, val):
-    self.val = val
+    def __init__(self, val):
+        self.val = val
 
-  def to_string(self):
-    return None
+    def to_string(self):
+        return None
+
+    def children(self):
+        cs = []
+        for field in self.val.type.fields():
+            cs.append(("", self.val[field]))
 
-  def children(self):
-    cs = []
-    for field in self.val.type.fields():
-      cs.append( ("", self.val[field]) )
+        return cs
 
-    return cs
+    def display_hint(self):
+        return "array"
 
-  def display_hint(self):
-    return "array"
 
 class RustTupleStructPrinter:
-  def __init__(self, val, hide_first_field):
-    self.val = val
-    self.hide_first_field = hide_first_field
+    def __init__(self, val, hide_first_field):
+        self.val = val
+        self.hide_first_field = hide_first_field
 
-  def to_string(self):
-    return self.val.type.tag
+    def to_string(self):
+        return self.val.type.tag
 
-  def children(self):
-    cs = []
-    for field in self.val.type.fields():
-      cs.append( ("", self.val[field]) )
+    def children(self):
+        cs = []
+        for field in self.val.type.fields():
+            cs.append(("", self.val[field]))
 
-    if self.hide_first_field:
-      cs = cs[1:]
+        if self.hide_first_field:
+            cs = cs[1:]
 
-    return cs
+        return cs
+
+    def display_hint(self):
+        return "array"
 
-  def display_hint(self):
-    return "array"
 
 class RustStringSlicePrinter:
-  def __init__(self, val):
-    self.val = val
+    def __init__(self, val):
+        self.val = val
+
+    def to_string(self):
+        slice_byte_len = self.val["length"]
+        return '"%s"' % self.val["data_ptr"].string(encoding="utf-8", length=slice_byte_len)
 
-  def to_string(self):
-    slice_byte_len = self.val["length"]
-    return '"%s"' % self.val["data_ptr"].string(encoding = "utf-8",
-                                                length = slice_byte_len)
 
 class RustCStyleEnumPrinter:
-  def __init__(self, val):
-    assert val.type.code == gdb.TYPE_CODE_ENUM
-    self.val = val
+    def __init__(self, val):
+        assert val.type.code == gdb.TYPE_CODE_ENUM
+        self.val = val
+
+    def to_string(self):
+        return str(self.val)
 
-  def to_string(self):
-    return str(self.val)
 
 class IdentityPrinter:
-  def __init__(self, string):
-    self.string = string
+    def __init__(self, string):
+        self.string = string
 
-  def to_string(self):
-    return self.string
+    def to_string(self):
+        return self.string
 
 STRUCT_KIND_REGULAR_STRUCT  = 0
 STRUCT_KIND_TUPLE_STRUCT    = 1
@@ -198,47 +206,51 @@ STRUCT_KIND_STRUCT_VARIANT  = 4
 STRUCT_KIND_CSTYLE_VARIANT  = 5
 STRUCT_KIND_STR_SLICE       = 6
 
+
 def classify_struct(type):
-  if type.tag == "&str":
-    return STRUCT_KIND_STR_SLICE
+    if type.tag == "&str":
+        return STRUCT_KIND_STR_SLICE
 
-  fields = list(type.fields())
-  field_count = len(fields)
+    fields = list(type.fields())
+    field_count = len(fields)
 
-  if field_count == 0:
-    return STRUCT_KIND_REGULAR_STRUCT
+    if field_count == 0:
+        return STRUCT_KIND_REGULAR_STRUCT
+
+    if fields[0].name == "RUST$ENUM$DISR":
+        if field_count == 1:
+            return STRUCT_KIND_CSTYLE_VARIANT
+        elif fields[1].name is None:
+            return STRUCT_KIND_TUPLE_VARIANT
+        else:
+            return STRUCT_KIND_STRUCT_VARIANT
 
-  if fields[0].name == "RUST$ENUM$DISR":
-    if field_count == 1:
-      return STRUCT_KIND_CSTYLE_VARIANT
-    elif fields[1].name == None:
-      return STRUCT_KIND_TUPLE_VARIANT
-    else:
-      return STRUCT_KIND_STRUCT_VARIANT
+    if fields[0].name is None:
+        if type.tag.startswith("("):
+            return STRUCT_KIND_TUPLE
+        else:
+            return STRUCT_KIND_TUPLE_STRUCT
 
-  if fields[0].name == None:
-    if type.tag.startswith("("):
-      return STRUCT_KIND_TUPLE
-    else:
-      return STRUCT_KIND_TUPLE_STRUCT
+    return STRUCT_KIND_REGULAR_STRUCT
 
-  return STRUCT_KIND_REGULAR_STRUCT
 
 def extract_discriminant_value(enum_val):
-  assert enum_val.type.code == gdb.TYPE_CODE_UNION
-  for variant_descriptor in enum_val.type.fields():
-    variant_val = enum_val[variant_descriptor]
-    for field in variant_val.type.fields():
-      return (field.name, int(variant_val[field]))
+    assert enum_val.type.code == gdb.TYPE_CODE_UNION
+    for variant_descriptor in enum_val.type.fields():
+        variant_val = enum_val[variant_descriptor]
+        for field in variant_val.type.fields():
+            return (field.name, int(variant_val[field]))
+
 
 def first_field(val):
-  for field in val.type.fields():
-    return field
+    for field in val.type.fields():
+        return field
+
 
 def get_field_at_index(val, index):
-  i = 0
-  for field in val.type.fields():
-    if i == index:
-      return field
-    i += 1
-  return None
+    i = 0
+    for field in val.type.fields():
+        if i == index:
+            return field
+        i += 1
+    return None
diff --git a/src/etc/generate-keyword-tests.py b/src/etc/generate-keyword-tests.py
index bf421513cba..937c231a473 100755
--- a/src/etc/generate-keyword-tests.py
+++ b/src/etc/generate-keyword-tests.py
@@ -56,4 +56,4 @@ for kw in sys.argv[1:]:
         f.write(template % (datetime.datetime.now().year, kw, kw))
 
     # mark file read-only
-    os.chmod(test_file, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)
+    os.chmod(test_file, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
diff --git a/src/etc/get-snapshot.py b/src/etc/get-snapshot.py
index 886a84bd819..26246bd2c32 100755
--- a/src/etc/get-snapshot.py
+++ b/src/etc/get-snapshot.py
@@ -10,36 +10,40 @@
 # option. This file may not be copied, modified, or distributed
 # except according to those terms.
 
-import os, tarfile, re, shutil, sys
+import os
+import tarfile
+import shutil
+import sys
 from snapshot import *
 
+
 def unpack_snapshot(triple, dl_path):
-  print("opening snapshot " + dl_path)
-  tar = tarfile.open(dl_path)
-  kernel = get_kernel(triple)
-
-  stagep = os.path.join(triple, "stage0")
-
-  # Remove files from prior unpackings, since snapshot rustc may not
-  # be able to disambiguate between multiple candidate libraries.
-  # (Leave dirs in place since extracting step still needs them.)
-  for root, _, files in os.walk(stagep):
-    for f in files:
-      print("removing " + os.path.join(root, f))
-      os.unlink(os.path.join(root, f))
-
-  for p in tar.getnames():
-    name = p.replace("rust-stage0/", "", 1);
-
-    fp = os.path.join(stagep, name)
-    print("extracting " + p)
-    tar.extract(p, download_unpack_base)
-    tp = os.path.join(download_unpack_base, p)
-    if os.path.isdir(tp) and os.path.exists(fp):
-        continue
-    shutil.move(tp, fp)
-  tar.close()
-  shutil.rmtree(download_unpack_base)
+    print("opening snapshot " + dl_path)
+    tar = tarfile.open(dl_path)
+    kernel = get_kernel(triple)
+
+    stagep = os.path.join(triple, "stage0")
+
+    # Remove files from prior unpackings, since snapshot rustc may not
+    # be able to disambiguate between multiple candidate libraries.
+    # (Leave dirs in place since extracting step still needs them.)
+    for root, _, files in os.walk(stagep):
+        for f in files:
+            print("removing " + os.path.join(root, f))
+            os.unlink(os.path.join(root, f))
+
+    for p in tar.getnames():
+        name = p.replace("rust-stage0/", "", 1)
+
+        fp = os.path.join(stagep, name)
+        print("extracting " + p)
+        tar.extract(p, download_unpack_base)
+        tp = os.path.join(download_unpack_base, p)
+        if os.path.isdir(tp) and os.path.exists(fp):
+            continue
+        shutil.move(tp, fp)
+    tar.close()
+    shutil.rmtree(download_unpack_base)
 
 
 # Main
@@ -48,23 +52,27 @@ def unpack_snapshot(triple, dl_path):
 # The first is the O/S triple.
 # The second is an optional path to the snapshot to use.
 
-triple = sys.argv[1]
-if len(sys.argv) == 3:
-  dl_path = sys.argv[2]
-else:
-  snap = determine_curr_snapshot(triple)
-  dl = os.path.join(download_dir_base, snap)
-  url = download_url_base + "/" + snap
-  print("determined most recent snapshot: " + snap)
+def main(argv):
+    triple = argv[1]
+    if len(argv) == 3:
+        dl_path = argv[2]
+    else:
+        snap = determine_curr_snapshot(triple)
+        dl = os.path.join(download_dir_base, snap)
+        url = download_url_base + "/" + snap
+        print("determined most recent snapshot: " + snap)
+
+        if (not os.path.exists(dl)):
+            get_url_to_file(url, dl)
 
-  if (not os.path.exists(dl)):
-    get_url_to_file(url, dl)
+        if (snap_filename_hash_part(snap) == hash_file(dl)):
+            print("got download with ok hash")
+        else:
+            raise Exception("bad hash on download")
 
-  if (snap_filename_hash_part(snap) == hash_file(dl)):
-    print("got download with ok hash")
-  else:
-    raise Exception("bad hash on download")
+        dl_path = os.path.join(download_dir_base, snap)
 
-  dl_path = os.path.join(download_dir_base, snap)
+    unpack_snapshot(triple, dl_path)
 
-unpack_snapshot(triple, dl_path)
+if __name__ == '__main__':
+    main(sys.argv)
diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py
index ad78e13ca25..22792ff7635 100644
--- a/src/etc/htmldocck.py
+++ b/src/etc/htmldocck.py
@@ -118,40 +118,54 @@ entitydefs['rarrb'] = u'\u21e5'
 VOID_ELEMENTS = set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen',
                      'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'])
 
-# simplified HTML parser.
-# this is possible because we are dealing with very regular HTML from rustdoc;
-# we only have to deal with i) void elements and ii) empty attributes.
+
 class CustomHTMLParser(HTMLParser):
+    """simplified HTML parser.
+
+    this is possible because we are dealing with very regular HTML from
+    rustdoc; we only have to deal with i) void elements and ii) empty
+    attributes."""
     def __init__(self, target=None):
         HTMLParser.__init__(self)
         self.__builder = target or ET.TreeBuilder()
+
     def handle_starttag(self, tag, attrs):
         attrs = dict((k, v or '') for k, v in attrs)
         self.__builder.start(tag, attrs)
-        if tag in VOID_ELEMENTS: self.__builder.end(tag)
+        if tag in VOID_ELEMENTS:
+            self.__builder.end(tag)
+
     def handle_endtag(self, tag):
         self.__builder.end(tag)
+
     def handle_startendtag(self, tag, attrs):
         attrs = dict((k, v or '') for k, v in attrs)
         self.__builder.start(tag, attrs)
         self.__builder.end(tag)
+
     def handle_data(self, data):
         self.__builder.data(data)
+
     def handle_entityref(self, name):
         self.__builder.data(entitydefs[name])
+
     def handle_charref(self, name):
         code = int(name[1:], 16) if name.startswith(('x', 'X')) else int(name, 10)
         self.__builder.data(unichr(code).encode('utf-8'))
+
     def close(self):
         HTMLParser.close(self)
         return self.__builder.close()
 
 Command = namedtuple('Command', 'negated cmd args lineno')
 
-# returns a generator out of the file object, which
-# - removes `\\` then `\n` then a shared prefix with the previous line then optional whitespace;
-# - keeps a line number (starting from 0) of the first line being concatenated.
+
 def concat_multi_lines(f):
+    """returns a generator out of the file object, which
+    - removes `\\` then `\n` then a shared prefix with the previous line then
+      optional whitespace;
+    - keeps a line number (starting from 0) of the first line being
+      concatenated."""
     lastline = None # set to the last line when the last line has a backslash
     firstlineno = None
     catenated = ''
@@ -162,7 +176,8 @@ def concat_multi_lines(f):
         if lastline is not None:
             maxprefix = 0
             for i in xrange(min(len(line), len(lastline))):
-                if line[i] != lastline[i]: break
+                if line[i] != lastline[i]:
+                    break
                 maxprefix += 1
             line = line[maxprefix:].lstrip()
 
@@ -184,11 +199,14 @@ LINE_PATTERN = re.compile(r'''
     (?P<cmd>[A-Za-z]+(?:-[A-Za-z]+)*)
     (?P<args>.*)$
 ''', re.X)
+
+
 def get_commands(template):
     with open(template, 'rUb') as f:
         for lineno, line in concat_multi_lines(f):
             m = LINE_PATTERN.search(line)
-            if not m: continue
+            if not m:
+                continue
 
             negated = (m.group('negated') == '!')
             cmd = m.group('cmd')
@@ -198,17 +216,22 @@ def get_commands(template):
             args = shlex.split(args)
             yield Command(negated=negated, cmd=cmd, args=args, lineno=lineno+1)
 
+
 def _flatten(node, acc):
-    if node.text: acc.append(node.text)
+    if node.text:
+        acc.append(node.text)
     for e in node:
         _flatten(e, acc)
-        if e.tail: acc.append(e.tail)
+        if e.tail:
+            acc.append(e.tail)
+
 
 def flatten(node):
     acc = []
     _flatten(node, acc)
     return ''.join(acc)
 
+
 def normalize_xpath(path):
     if path.startswith('//'):
         return '.' + path # avoid warnings
@@ -218,6 +241,7 @@ def normalize_xpath(path):
         raise RuntimeError('Non-absolute XPath is not supported due to \
                             the implementation issue.')
 
+
 class CachedFiles(object):
     def __init__(self, root):
         self.root = root
@@ -267,6 +291,7 @@ class CachedFiles(object):
                 self.trees[path] = tree
                 return self.trees[path]
 
+
 def check_string(data, pat, regexp):
     if not pat:
         return True # special case a presence testing
@@ -277,6 +302,7 @@ def check_string(data, pat, regexp):
         pat = ' '.join(pat.split())
         return pat in data
 
+
 def check_tree_attr(tree, path, attr, pat, regexp):
     path = normalize_xpath(path)
     ret = False
@@ -287,9 +313,11 @@ def check_tree_attr(tree, path, attr, pat, regexp):
             continue
         else:
             ret = check_string(value, pat, regexp)
-            if ret: break
+            if ret:
+                break
     return ret
 
+
 def check_tree_text(tree, path, pat, regexp):
     path = normalize_xpath(path)
     ret = False
@@ -300,9 +328,11 @@ def check_tree_text(tree, path, pat, regexp):
             continue
         else:
             ret = check_string(value, pat, regexp)
-            if ret: break
+            if ret:
+                break
     return ret
 
+
 def check(target, commands):
     cache = CachedFiles(target)
     for c in commands:
@@ -323,7 +353,8 @@ def check(target, commands):
                     ret = check_tree_attr(cache.get_tree(c.args[0]), pat, attr, c.args[2], regexp)
                 else: # normalized text
                     pat = c.args[1]
-                    if pat.endswith('/text()'): pat = pat[:-7]
+                    if pat.endswith('/text()'):
+                        pat = pat[:-7]
                     ret = check_tree_text(cache.get_tree(c.args[0]), pat, c.args[2], regexp)
             else:
                 raise RuntimeError('Invalid number of @{} arguments \
@@ -348,4 +379,3 @@ if __name__ == '__main__':
         raise SystemExit(1)
     else:
         check(sys.argv[1], get_commands(sys.argv[2]))
-
diff --git a/src/etc/latest-unix-snaps.py b/src/etc/latest-unix-snaps.py
index 32e9691f815..6c93bf23f90 100755
--- a/src/etc/latest-unix-snaps.py
+++ b/src/etc/latest-unix-snaps.py
@@ -10,7 +10,8 @@
 # option. This file may not be copied, modified, or distributed
 # except according to those terms.
 
-import os, tarfile, hashlib, re, shutil, sys
+import os
+import re
 from snapshot import *
 
 f = open(snapshotfile)
@@ -26,7 +27,8 @@ newestSet = {}
 for line in f.readlines():
     i += 1
     parsed = parse_line(i, line)
-    if (not parsed): continue
+    if not parsed:
+        continue
 
     if parsed["type"] == "snapshot":
         if (len(newestSet) == 0 or parsed["date"] > newestSet["date"]):
@@ -37,16 +39,16 @@ for line in f.readlines():
         else:
             addingMode = False
 
-    elif addingMode == True and parsed["type"] == "file":
+    elif addingMode is True and parsed["type"] == "file":
         tux = re.compile("linux", re.IGNORECASE)
-        if (tux.match(parsed["platform"]) != None):
-           ff = {}
-           ff["platform"] = parsed["platform"]
-           ff["hash"] = parsed["hash"]
-           newestSet["files"] += [ff]
+        if (tux.match(parsed["platform"]) is not None):
+            ff = {}
+            ff["platform"] = parsed["platform"]
+            ff["hash"] = parsed["hash"]
+            newestSet["files"] += [ff]
 
 
-def download_new_file (date, rev, platform, hsh):
+def download_new_file(date, rev, platform, hsh):
         snap = full_snapshot_name(date, rev, platform, hsh)
         dl = os.path.join(download_dir_base, snap)
         url = download_url_base + "/" + snap
@@ -59,5 +61,5 @@ def download_new_file (date, rev, platform, hsh):
             raise Exception("bad hash on download")
 
 for ff in newestSet["files"]:
-   download_new_file (newestSet["date"], newestSet["rev"],
+    download_new_file(newestSet["date"], newestSet["rev"],
                       ff["platform"], ff["hash"])
diff --git a/src/etc/lldb_batchmode.py b/src/etc/lldb_batchmode.py
index 25e5661ca49..b1506285b3a 100644
--- a/src/etc/lldb_batchmode.py
+++ b/src/etc/lldb_batchmode.py
@@ -30,36 +30,35 @@ import sys
 import threading
 import thread
 import re
-import atexit
 import time
 
 # Set this to True for additional output
 DEBUG_OUTPUT = False
 
+
 def print_debug(s):
-  "Print something if DEBUG_OUTPUT is True"
-  global DEBUG_OUTPUT
-  if DEBUG_OUTPUT:
-    print("DEBUG: " + str(s))
+    "Print something if DEBUG_OUTPUT is True"
+    global DEBUG_OUTPUT
+    if DEBUG_OUTPUT:
+        print("DEBUG: " + str(s))
 
 
 def normalize_whitespace(s):
-  "Replace newlines, tabs, multiple spaces, etc with exactly one space"
-  return re.sub("\s+", " ", s)
+    "Replace newlines, tabs, multiple spaces, etc with exactly one space"
+    return re.sub("\s+", " ", s)
 
 
-# This callback is registered with every breakpoint and makes sure that the frame containing the
-# breakpoint location is selected
 def breakpoint_callback(frame, bp_loc, dict):
-  "Called whenever a breakpoint is hit"
-  print("Hit breakpoint " + str(bp_loc))
+    """This callback is registered with every breakpoint and makes sure that the
+    frame containing the breakpoint location is selected"""
+    print("Hit breakpoint " + str(bp_loc))
 
-  # Select the frame and the thread containing it
-  frame.thread.process.SetSelectedThread(frame.thread)
-  frame.thread.SetSelectedFrame(frame.idx)
+    # Select the frame and the thread containing it
+    frame.thread.process.SetSelectedThread(frame.thread)
+    frame.thread.SetSelectedFrame(frame.idx)
 
-  # Returning True means that we actually want to stop at this breakpoint
-  return True
+    # Returning True means that we actually want to stop at this breakpoint
+    return True
 
 
 # This is a list of breakpoints that are not registered with the breakpoint callback. The list is
@@ -70,91 +69,99 @@ new_breakpoints = []
 # used to avoid hooking callbacks into breakpoints more than once
 registered_breakpoints = set()
 
+
 def execute_command(command_interpreter, command):
-  "Executes a single CLI command"
-  global new_breakpoints
-  global registered_breakpoints
-
-  res = lldb.SBCommandReturnObject()
-  print(command)
-  command_interpreter.HandleCommand(command, res)
-
-  if res.Succeeded():
-      if res.HasResult():
-          print(normalize_whitespace(res.GetOutput()), end = '\n')
-
-      # If the command introduced any breakpoints, make sure to register them with the breakpoint
-      # callback
-      while len(new_breakpoints) > 0:
-        res.Clear()
-        breakpoint_id = new_breakpoints.pop()
-
-        if breakpoint_id in registered_breakpoints:
-          print_debug("breakpoint with id %s is already registered. Ignoring." % str(breakpoint_id))
-        else:
-          print_debug("registering breakpoint callback, id = " + str(breakpoint_id))
-          callback_command = "breakpoint command add -F breakpoint_callback " + str(breakpoint_id)
-          command_interpreter.HandleCommand(callback_command, res)
-          if res.Succeeded():
-            print_debug("successfully registered breakpoint callback, id = " + str(breakpoint_id))
-            registered_breakpoints.add(breakpoint_id)
-          else:
-            print("Error while trying to register breakpoint callback, id = " + str(breakpoint_id))
-  else:
-      print(res.GetError())
+    "Executes a single CLI command"
+    global new_breakpoints
+    global registered_breakpoints
+
+    res = lldb.SBCommandReturnObject()
+    print(command)
+    command_interpreter.HandleCommand(command, res)
+
+    if res.Succeeded():
+        if res.HasResult():
+            print(normalize_whitespace(res.GetOutput()), end='\n')
+
+        # If the command introduced any breakpoints, make sure to register
+        # them with the breakpoint
+        # callback
+        while len(new_breakpoints) > 0:
+            res.Clear()
+            breakpoint_id = new_breakpoints.pop()
+
+            if breakpoint_id in registered_breakpoints:
+                print_debug("breakpoint with id %s is already registered. Ignoring." %
+                            str(breakpoint_id))
+            else:
+                print_debug("registering breakpoint callback, id = " + str(breakpoint_id))
+                callback_command = ("breakpoint command add -F breakpoint_callback " +
+                                    str(breakpoint_id))
+                command_interpreter.HandleCommand(callback_command, res)
+                if res.Succeeded():
+                    print_debug("successfully registered breakpoint callback, id = " +
+                                str(breakpoint_id))
+                    registered_breakpoints.add(breakpoint_id)
+                else:
+                    print("Error while trying to register breakpoint callback, id = " +
+                          str(breakpoint_id))
+    else:
+        print(res.GetError())
 
 
 def start_breakpoint_listener(target):
-  "Listens for breakpoints being added and adds new ones to the callback registration list"
-  listener = lldb.SBListener("breakpoint listener")
-
-  def listen():
-    event = lldb.SBEvent()
-    try:
-      while True:
-        if listener.WaitForEvent(120, event):
-          if lldb.SBBreakpoint.EventIsBreakpointEvent(event) and \
-             lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(event) == \
-             lldb.eBreakpointEventTypeAdded:
-            global new_breakpoints
-            breakpoint = lldb.SBBreakpoint.GetBreakpointFromEvent(event)
-            print_debug("breakpoint added, id = " + str(breakpoint.id))
-            new_breakpoints.append(breakpoint.id)
-    except:
-      print_debug("breakpoint listener shutting down")
-
-  # Start the listener and let it run as a daemon
-  listener_thread = threading.Thread(target = listen)
-  listener_thread.daemon = True
-  listener_thread.start()
-
-  # Register the listener with the target
-  target.GetBroadcaster().AddListener(listener, lldb.SBTarget.eBroadcastBitBreakpointChanged)
+    """Listens for breakpoints being added and adds new ones to the callback
+    registration list"""
+    listener = lldb.SBListener("breakpoint listener")
+
+    def listen():
+        event = lldb.SBEvent()
+        try:
+            while True:
+                if listener.WaitForEvent(120, event):
+                    if lldb.SBBreakpoint.EventIsBreakpointEvent(event) and \
+                            lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(event) == \
+                            lldb.eBreakpointEventTypeAdded:
+                        global new_breakpoints
+                        breakpoint = lldb.SBBreakpoint.GetBreakpointFromEvent(event)
+                        print_debug("breakpoint added, id = " + str(breakpoint.id))
+                        new_breakpoints.append(breakpoint.id)
+        except:
+            print_debug("breakpoint listener shutting down")
+
+    # Start the listener and let it run as a daemon
+    listener_thread = threading.Thread(target=listen)
+    listener_thread.daemon = True
+    listener_thread.start()
+
+    # Register the listener with the target
+    target.GetBroadcaster().AddListener(listener, lldb.SBTarget.eBroadcastBitBreakpointChanged)
 
 
 def start_watchdog():
-  "Starts a watchdog thread that will terminate the process after a certain period of time"
-  watchdog_start_time = time.clock()
-  watchdog_max_time = watchdog_start_time + 30
-
-  def watchdog():
-    while time.clock() < watchdog_max_time:
-      time.sleep(1)
-    print("TIMEOUT: lldb_batchmode.py has been running for too long. Aborting!")
-    thread.interrupt_main()
-
-  # Start the listener and let it run as a daemon
-  watchdog_thread = threading.Thread(target = watchdog)
-  watchdog_thread.daemon = True
-  watchdog_thread.start()
+    """Starts a watchdog thread that will terminate the process after a certain
+    period of time"""
+    watchdog_start_time = time.clock()
+    watchdog_max_time = watchdog_start_time + 30
+
+    def watchdog():
+        while time.clock() < watchdog_max_time:
+            time.sleep(1)
+        print("TIMEOUT: lldb_batchmode.py has been running for too long. Aborting!")
+        thread.interrupt_main()
+
+    # Start the listener and let it run as a daemon
+    watchdog_thread = threading.Thread(target=watchdog)
+    watchdog_thread.daemon = True
+    watchdog_thread.start()
 
 ####################################################################################################
 # ~main
 ####################################################################################################
 
 if len(sys.argv) != 3:
-  print("usage: python lldb_batchmode.py target-path script-path")
-  sys.exit(1)
+    print("usage: python lldb_batchmode.py target-path script-path")
+    sys.exit(1)
 
 target_path = sys.argv[1]
 script_path = sys.argv[2]
@@ -181,9 +188,9 @@ target_error = lldb.SBError()
 target = debugger.CreateTarget(target_path, None, None, True, target_error)
 
 if not target:
-  print("Could not create debugging target '" + target_path + "': " + str(target_error) +
-        ". Aborting.", file=sys.stderr)
-  sys.exit(1)
+    print("Could not create debugging target '" + target_path + "': " +
+          str(target_error) + ". Aborting.", file=sys.stderr)
+    sys.exit(1)
 
 
 # Register the breakpoint callback for every breakpoint
@@ -192,22 +199,21 @@ start_breakpoint_listener(target)
 command_interpreter = debugger.GetCommandInterpreter()
 
 try:
-  script_file = open(script_path, 'r')
+    script_file = open(script_path, 'r')
 
-  for line in script_file:
-    command = line.strip()
-    if command == "run" or command == "r" or re.match("^process\s+launch.*", command):
-      # Before starting to run the program, let the thread sleep a bit, so all
-      # breakpoint added events can be processed
-      time.sleep(0.5)
-    if command != '':
-      execute_command(command_interpreter, command)
+    for line in script_file:
+        command = line.strip()
+        if command == "run" or command == "r" or re.match("^process\s+launch.*", command):
+            # Before starting to run the program, let the thread sleep a bit, so all
+            # breakpoint added events can be processed
+            time.sleep(0.5)
+        if command != '':
+            execute_command(command_interpreter, command)
 
 except IOError as e:
-  print("Could not read debugging script '%s'." % script_path, file = sys.stderr)
-  print(e, file = sys.stderr)
-  print("Aborting.", file = sys.stderr)
-  sys.exit(1)
+    print("Could not read debugging script '%s'." % script_path, file=sys.stderr)
+    print(e, file=sys.stderr)
+    print("Aborting.", file=sys.stderr)
+    sys.exit(1)
 finally:
-  script_file.close()
-
+    script_file.close()
diff --git a/src/etc/lldb_rust_formatters.py b/src/etc/lldb_rust_formatters.py
index 05d71902904..42c83b6a42e 100644
--- a/src/etc/lldb_rust_formatters.py
+++ b/src/etc/lldb_rust_formatters.py
@@ -10,23 +10,24 @@
 
 import lldb
 
+
 def print_val(val, internal_dict):
-  '''Prints the given value with Rust syntax'''
-  type_class = val.GetType().GetTypeClass()
+    '''Prints the given value with Rust syntax'''
+    type_class = val.GetType().GetTypeClass()
 
-  if type_class == lldb.eTypeClassStruct:
-    return print_struct_val(val, internal_dict)
+    if type_class == lldb.eTypeClassStruct:
+        return print_struct_val(val, internal_dict)
 
-  if type_class == lldb.eTypeClassUnion:
-    return print_enum_val(val, internal_dict)
+    if type_class == lldb.eTypeClassUnion:
+        return print_enum_val(val, internal_dict)
 
-  if type_class == lldb.eTypeClassPointer:
-    return print_pointer_val(val, internal_dict)
+    if type_class == lldb.eTypeClassPointer:
+        return print_pointer_val(val, internal_dict)
 
-  if type_class == lldb.eTypeClassArray:
-    return print_fixed_size_vec_val(val, internal_dict)
+    if type_class == lldb.eTypeClassArray:
+        return print_fixed_size_vec_val(val, internal_dict)
 
-  return val.GetValue()
+    return val.GetValue()
 
 
 #=--------------------------------------------------------------------------------------------------
@@ -34,162 +35,164 @@ def print_val(val, internal_dict):
 #=--------------------------------------------------------------------------------------------------
 
 def print_struct_val(val, internal_dict):
-  '''Prints a struct, tuple, or tuple struct value with Rust syntax'''
-  assert val.GetType().GetTypeClass() == lldb.eTypeClassStruct
+    '''Prints a struct, tuple, or tuple struct value with Rust syntax'''
+    assert val.GetType().GetTypeClass() == lldb.eTypeClassStruct
+
+    if is_vec_slice(val):
+        return print_vec_slice_val(val, internal_dict)
+    else:
+        return print_struct_val_starting_from(0, val, internal_dict)
 
-  if is_vec_slice(val):
-    return print_vec_slice_val(val, internal_dict)
-  else:
-    return print_struct_val_starting_from(0, val, internal_dict)
 
 def print_vec_slice_val(val, internal_dict):
-  length = val.GetChildAtIndex(1).GetValueAsUnsigned()
+    length = val.GetChildAtIndex(1).GetValueAsUnsigned()
 
-  data_ptr_val = val.GetChildAtIndex(0)
-  data_ptr_type = data_ptr_val.GetType()
-  assert data_ptr_type.IsPointerType()
+    data_ptr_val = val.GetChildAtIndex(0)
+    data_ptr_type = data_ptr_val.GetType()
+    assert data_ptr_type.IsPointerType()
 
-  element_type = data_ptr_type.GetPointeeType()
-  element_type_size = element_type.GetByteSize()
+    element_type = data_ptr_type.GetPointeeType()
+    element_type_size = element_type.GetByteSize()
 
-  start_address = data_ptr_val.GetValueAsUnsigned()
+    start_address = data_ptr_val.GetValueAsUnsigned()
 
-  def render_element(i):
-    address = start_address + i * element_type_size
-    element_val = val.CreateValueFromAddress( val.GetName() + ("[%s]" % i), address, element_type)
-    return print_val(element_val, internal_dict)
+    def render_element(i):
+        address = start_address + i * element_type_size
+        element_val = val.CreateValueFromAddress(val.GetName() +
+                                                 ("[%s]" % i), address, element_type)
+        return print_val(element_val, internal_dict)
 
-  return "&[%s]" % (', '.join([render_element(i) for i in range(length)]))
+    return "&[%s]" % (', '.join([render_element(i) for i in range(length)]))
 
-def print_struct_val_starting_from(field_start_index, val, internal_dict):
-  '''
-  Prints a struct, tuple, or tuple struct value with Rust syntax.
-  Ignores any fields before field_start_index.
-  '''
-  assert val.GetType().GetTypeClass() == lldb.eTypeClassStruct
-
-  t = val.GetType()
-  type_name = extract_type_name(t.GetName())
-  num_children = val.num_children
-
-  if (num_children - field_start_index) == 0:
-    # The only field of this struct is the enum discriminant
-    return type_name
-
-  has_field_names = type_has_field_names(t)
-
-  if has_field_names:
-    template = "%(type_name)s {\n%(body)s\n}"
-    separator = ", \n"
-  else:
-    template = "%(type_name)s(%(body)s)"
-    separator = ", "
-
-  if type_name.startswith("("):
-    # this is a tuple, so don't print the type name
-    type_name = ""
-
-  def render_child(child_index):
-    this = ""
-    if has_field_names:
-      field_name = t.GetFieldAtIndex(child_index).GetName()
-      this += field_name + ": "
 
-    field_val = val.GetChildAtIndex(child_index)
-    return this + print_val(field_val, internal_dict)
+def print_struct_val_starting_from(field_start_index, val, internal_dict):
+    '''
+    Prints a struct, tuple, or tuple struct value with Rust syntax.
+    Ignores any fields before field_start_index.
+    '''
+    assert val.GetType().GetTypeClass() == lldb.eTypeClassStruct
 
-  body = separator.join([render_child(idx) for idx in range(field_start_index, num_children)])
+    t = val.GetType()
+    type_name = extract_type_name(t.GetName())
+    num_children = val.num_children
 
-  return template % {"type_name": type_name,
-                     "body": body}
+    if (num_children - field_start_index) == 0:
+        # The only field of this struct is the enum discriminant
+        return type_name
 
+    has_field_names = type_has_field_names(t)
 
-def print_enum_val(val, internal_dict):
-  '''Prints an enum value with Rust syntax'''
-
-  assert val.GetType().GetTypeClass() == lldb.eTypeClassUnion
-
-  if val.num_children == 1:
-    # This is either an enum with just one variant, or it is an Option-like enum
-    # where the discriminant is encoded in a non-nullable pointer field. We find
-    # out which one it is by looking at the member name of the sole union
-    # variant. If it starts with "RUST$ENCODED$ENUM$" then we have an
-    # Option-like enum.
-    first_variant_name = val.GetChildAtIndex(0).GetName()
-    if first_variant_name and first_variant_name.startswith("RUST$ENCODED$ENUM$"):
-
-      # This is an Option-like enum. The position of the discriminator field is
-      # encoded in the name which has the format:
-      #  RUST$ENCODED$ENUM$<index of discriminator field>$<name of null variant>
-      last_separator_index = first_variant_name.rfind("$")
-      if last_separator_index == -1:
-        return "<invalid enum encoding: %s>" % first_variant_name
-
-      start_index = len("RUST$ENCODED$ENUM$")
-
-      # Extract indices of the discriminator field
-      try:
-        disr_field_indices = first_variant_name[start_index :
-                                              last_separator_index].split("$")
-        disr_field_indices = [int(index) for index in disr_field_indices]
-      except:
-        return "<invalid enum encoding: %s>" % first_variant_name
-
-      # Read the discriminant
-      disr_val = val.GetChildAtIndex(0)
-      for index in disr_field_indices:
-        disr_val = disr_val.GetChildAtIndex(index)
-
-      # If the discriminant field is a fat pointer we have to consider the
-      # first word as the true discriminant
-      if disr_val.GetType().GetTypeClass() == lldb.eTypeClassStruct:
-        disr_val = disr_val.GetChildAtIndex(0)
-
-      if disr_val.GetValueAsUnsigned() == 0:
-        # Null case: Print the name of the null-variant
-        null_variant_name = first_variant_name[last_separator_index + 1:]
-        return null_variant_name
-      else:
-        # Non-null case: Interpret the data as a value of the non-null variant type
-        return print_struct_val_starting_from(0, val.GetChildAtIndex(0), internal_dict)
+    if has_field_names:
+        template = "%(type_name)s {\n%(body)s\n}"
+        separator = ", \n"
     else:
-      # This is just a regular uni-variant enum without discriminator field
-      return print_struct_val_starting_from(0, val.GetChildAtIndex(0), internal_dict)
+        template = "%(type_name)s(%(body)s)"
+        separator = ", "
+
+    if type_name.startswith("("):
+        # this is a tuple, so don't print the type name
+        type_name = ""
 
-  # If we are here, this is a regular enum with more than one variant
-  disr_val = val.GetChildAtIndex(0).GetChildMemberWithName("RUST$ENUM$DISR")
-  disr_type = disr_val.GetType()
+    def render_child(child_index):
+        this = ""
+        if has_field_names:
+            field_name = t.GetFieldAtIndex(child_index).GetName()
+            this += field_name + ": "
 
-  if disr_type.GetTypeClass() != lldb.eTypeClassEnumeration:
-    return "<Invalid enum value encountered: Discriminator is not an enum>"
+        field_val = val.GetChildAtIndex(child_index)
+        return this + print_val(field_val, internal_dict)
 
-  variant_index = disr_val.GetValueAsUnsigned()
-  return print_struct_val_starting_from(1, val.GetChildAtIndex(variant_index), internal_dict)
+    body = separator.join([render_child(idx) for idx in range(field_start_index, num_children)])
+
+    return template % {"type_name": type_name,
+                       "body": body}
+
+
+def print_enum_val(val, internal_dict):
+    '''Prints an enum value with Rust syntax'''
+
+    assert val.GetType().GetTypeClass() == lldb.eTypeClassUnion
+
+    if val.num_children == 1:
+        # This is either an enum with just one variant, or it is an Option-like
+        # enum where the discriminant is encoded in a non-nullable pointer
+        # field. We find out which one it is by looking at the member name of
+        # the sole union variant. If it starts with "RUST$ENCODED$ENUM$" then
+        # we have an Option-like enum.
+        first_variant_name = val.GetChildAtIndex(0).GetName()
+        if first_variant_name and first_variant_name.startswith("RUST$ENCODED$ENUM$"):
+
+            # This is an Option-like enum. The position of the discriminator field is
+            # encoded in the name which has the format:
+            #  RUST$ENCODED$ENUM$<index of discriminator field>$<name of null variant>
+            last_separator_index = first_variant_name.rfind("$")
+            if last_separator_index == -1:
+                return "<invalid enum encoding: %s>" % first_variant_name
+
+            start_index = len("RUST$ENCODED$ENUM$")
+
+            # Extract indices of the discriminator field
+            try:
+                disr_field_indices = first_variant_name[start_index:last_separator_index].split("$")
+                disr_field_indices = [int(index) for index in disr_field_indices]
+            except:
+                return "<invalid enum encoding: %s>" % first_variant_name
+
+            # Read the discriminant
+            disr_val = val.GetChildAtIndex(0)
+            for index in disr_field_indices:
+                disr_val = disr_val.GetChildAtIndex(index)
+
+            # If the discriminant field is a fat pointer we have to consider the
+            # first word as the true discriminant
+            if disr_val.GetType().GetTypeClass() == lldb.eTypeClassStruct:
+                disr_val = disr_val.GetChildAtIndex(0)
+
+            if disr_val.GetValueAsUnsigned() == 0:
+                # Null case: Print the name of the null-variant
+                null_variant_name = first_variant_name[last_separator_index + 1:]
+                return null_variant_name
+            else:
+                # Non-null case: Interpret the data as a value of the non-null variant type
+                return print_struct_val_starting_from(0, val.GetChildAtIndex(0), internal_dict)
+        else:
+            # This is just a regular uni-variant enum without discriminator field
+            return print_struct_val_starting_from(0, val.GetChildAtIndex(0), internal_dict)
+
+    # If we are here, this is a regular enum with more than one variant
+    disr_val = val.GetChildAtIndex(0).GetChildMemberWithName("RUST$ENUM$DISR")
+    disr_type = disr_val.GetType()
+
+    if disr_type.GetTypeClass() != lldb.eTypeClassEnumeration:
+        return "<Invalid enum value encountered: Discriminator is not an enum>"
+
+    variant_index = disr_val.GetValueAsUnsigned()
+    return print_struct_val_starting_from(1, val.GetChildAtIndex(variant_index), internal_dict)
 
 
 def print_pointer_val(val, internal_dict):
-  '''Prints a pointer value with Rust syntax'''
-  assert val.GetType().IsPointerType()
-  sigil = "&"
-  type_name = extract_type_name(val.GetType().GetName())
-  if type_name and type_name[0:1] in ["&", "~", "*"]:
-    sigil = type_name[0:1]
+    '''Prints a pointer value with Rust syntax'''
+    assert val.GetType().IsPointerType()
+    sigil = "&"
+    type_name = extract_type_name(val.GetType().GetName())
+    if type_name and type_name[0:1] in ["&", "~", "*"]:
+        sigil = type_name[0:1]
 
-  return sigil + hex(val.GetValueAsUnsigned()) #print_val(val.Dereference(), internal_dict)
+    return sigil + hex(val.GetValueAsUnsigned()) #print_val(val.Dereference(), internal_dict)
 
 
 def print_fixed_size_vec_val(val, internal_dict):
-  assert val.GetType().GetTypeClass() == lldb.eTypeClassArray
+    assert val.GetType().GetTypeClass() == lldb.eTypeClassArray
 
-  output = "["
+    output = "["
 
-  for i in range(val.num_children):
-    output += print_val(val.GetChildAtIndex(i), internal_dict)
-    if i != val.num_children - 1:
-      output += ", "
+    for i in range(val.num_children):
+        output += print_val(val.GetChildAtIndex(i), internal_dict)
+        if i != val.num_children - 1:
+            output += ", "
 
-  output += "]"
-  return output
+    output += "]"
+    return output
 
 
 #=--------------------------------------------------------------------------------------------------
@@ -198,46 +201,45 @@ def print_fixed_size_vec_val(val, internal_dict):
 
 unqualified_type_markers = frozenset(["(", "[", "&", "*"])
 
+
 def extract_type_name(qualified_type_name):
-  '''Extracts the type name from a fully qualified path'''
-  if qualified_type_name[0] in unqualified_type_markers:
-    return qualified_type_name
+    '''Extracts the type name from a fully qualified path'''
+    if qualified_type_name[0] in unqualified_type_markers:
+        return qualified_type_name
 
-  end_of_search = qualified_type_name.find("<")
-  if end_of_search < 0:
-    end_of_search = len(qualified_type_name)
+    end_of_search = qualified_type_name.find("<")
+    if end_of_search < 0:
+        end_of_search = len(qualified_type_name)
 
-  index = qualified_type_name.rfind("::", 0, end_of_search)
-  if index < 0:
-    return qualified_type_name
-  else:
-    return qualified_type_name[index + 2:]
+    index = qualified_type_name.rfind("::", 0, end_of_search)
+    if index < 0:
+        return qualified_type_name
+    else:
+        return qualified_type_name[index + 2:]
 
 
 def type_has_field_names(ty):
-  '''Returns true of this is a type with field names (struct, struct-like enum variant)'''
-  # This may also be an enum variant where the first field doesn't have a name but the rest has
-  if ty.GetNumberOfFields() > 1:
-    return ty.GetFieldAtIndex(1).GetName() != None
-  else:
-    return ty.GetFieldAtIndex(0).GetName() != None
+    '''Returns true of this is a type with field names (struct, struct-like enum variant)'''
+    # This may also be an enum variant where the first field doesn't have a name but the rest has
+    if ty.GetNumberOfFields() > 1:
+        return ty.GetFieldAtIndex(1).GetName() is not None
+    else:
+        return ty.GetFieldAtIndex(0).GetName() is not None
 
 
 def is_vec_slice(val):
-  ty = val.GetType()
-  if ty.GetTypeClass() != lldb.eTypeClassStruct:
-    return False
-
-  if ty.GetNumberOfFields() != 2:
-    return False
+    ty = val.GetType()
+    if ty.GetTypeClass() != lldb.eTypeClassStruct:
+        return False
 
-  if ty.GetFieldAtIndex(0).GetName() != "data_ptr":
-    return False
+    if ty.GetNumberOfFields() != 2:
+        return False
 
-  if ty.GetFieldAtIndex(1).GetName() != "length":
-    return False
+    if ty.GetFieldAtIndex(0).GetName() != "data_ptr":
+        return False
 
-  type_name = extract_type_name(ty.GetName()).replace("&'static", "&").replace(" ", "")
-  return type_name.startswith("&[") and type_name.endswith("]")
+    if ty.GetFieldAtIndex(1).GetName() != "length":
+        return False
 
-# vi: sw=2:ts=2
+    type_name = extract_type_name(ty.GetName()).replace("&'static", "&").replace(" ", "")
+    return type_name.startswith("&[") and type_name.endswith("]")
diff --git a/src/etc/make-win-dist.py b/src/etc/make-win-dist.py
index ea2a98db2dc..13d05135024 100644
--- a/src/etc/make-win-dist.py
+++ b/src/etc/make-win-dist.py
@@ -14,7 +14,11 @@
 #     argv[3] = target triple
 # The first two correspond to the two installable components defined in the setup script.
 
-import sys, os, shutil, subprocess
+import sys
+import os
+import shutil
+import subprocess
+
 
 def find_files(files, path):
     found = []
@@ -28,6 +32,7 @@ def find_files(files, path):
             raise Exception("Could not find '%s' in %s" % (fname, path))
     return found
 
+
 def make_win_dist(rust_root, gcc_root, target_triple):
     # Ask gcc where it keeps its stuff
     gcc_out = subprocess.check_output(["gcc.exe", "-print-search-dirs"])
@@ -114,5 +119,5 @@ def make_win_dist(rust_root, gcc_root, target_triple):
     for src in target_libs:
         shutil.copy(src, target_lib_dir)
 
-if __name__=="__main__":
+if __name__ == "__main__":
     make_win_dist(sys.argv[1], sys.argv[2], sys.argv[3])
diff --git a/src/etc/maketest.py b/src/etc/maketest.py
index 3f29c0b2f12..f500de5e15d 100644
--- a/src/etc/maketest.py
+++ b/src/etc/maketest.py
@@ -12,13 +12,14 @@ import subprocess
 import os
 import sys
 
-# msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
-# `c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
-# the value is list of paths.
-# (if there is only one path, it becomes `c:/real/abs/path`.)
-# this causes great confusion and error: shell and Makefile doesn't like
-# windows paths so it is really error-prone. revert it for peace.
+
 def normalize_path(v):
+    """msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
+    `c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
+    the value is list of paths.
+    (if there is only one path, it becomes `c:/real/abs/path`.)
+    this causes great confusion and error: shell and Makefile doesn't like
+    windows paths so it is really error-prone. revert it for peace."""
     v = v.replace('\\', '/')
     # c:/path -> /c/path
     if ':/' in v:
@@ -31,6 +32,7 @@ def putenv(name, value):
         value = normalize_path(value)
     os.putenv(name, value)
 
+
 def convert_path_spec(name, value):
     if os.name == 'nt' and name != 'PATH':
         value = ":".join(normalize_path(v) for v in value.split(";"))
@@ -42,14 +44,14 @@ putenv('TMPDIR', os.path.abspath(sys.argv[4]))
 putenv('CC', sys.argv[5])
 putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
 filt = sys.argv[7]
-putenv('LD_LIB_PATH_ENVVAR', sys.argv[8]);
-putenv('HOST_RPATH_DIR', os.path.abspath(sys.argv[9]));
-putenv('TARGET_RPATH_DIR', os.path.abspath(sys.argv[10]));
+putenv('LD_LIB_PATH_ENVVAR', sys.argv[8])
+putenv('HOST_RPATH_DIR', os.path.abspath(sys.argv[9]))
+putenv('TARGET_RPATH_DIR', os.path.abspath(sys.argv[10]))
 putenv('RUST_BUILD_STAGE', sys.argv[11])
 putenv('S', os.path.abspath(sys.argv[12]))
 putenv('PYTHON', sys.executable)
 
-if not filt in sys.argv[1]:
+if filt not in sys.argv[1]:
     sys.exit(0)
 print('maketest: ' + os.path.basename(os.path.dirname(sys.argv[1])))
 
@@ -63,19 +65,19 @@ if path[-1] == '/':
     path = path[:-1]
 
 proc = subprocess.Popen([make, '-C', path],
-                        stdout = subprocess.PIPE,
-                        stderr = subprocess.PIPE)
+                        stdout=subprocess.PIPE,
+                        stderr=subprocess.PIPE)
 out, err = proc.communicate()
 i = proc.wait()
 
 if i != 0:
-
-    print '----- ' + sys.argv[1] + """ --------------------
+    print """\
+----- %s --------------------
 ------ stdout ---------------------------------------------
-""" + out + """
+%s
 ------ stderr ---------------------------------------------
-""" + err + """
+%s
 ------        ---------------------------------------------
-"""
-    sys.exit(i)
+""" % (sys.argv[1], out, err)
 
+    sys.exit(i)
diff --git a/src/etc/mirror-all-snapshots.py b/src/etc/mirror-all-snapshots.py
index 3934c235e8c..cd77f882140 100644
--- a/src/etc/mirror-all-snapshots.py
+++ b/src/etc/mirror-all-snapshots.py
@@ -10,7 +10,7 @@
 # option. This file may not be copied, modified, or distributed
 # except according to those terms.
 
-import os, tarfile, hashlib, re, shutil
+import os
 from snapshot import *
 
 f = open(snapshotfile)
@@ -23,13 +23,14 @@ i = 0
 for line in f.readlines():
     i += 1
     parsed = parse_line(i, line)
-    if (not parsed): continue
+    if not parsed:
+        continue
 
     if parsed["type"] == "snapshot":
         date = parsed["date"]
         rev = parsed["rev"]
 
-    elif rev != None and parsed["type"] == "file":
+    elif rev is not None and parsed["type"] == "file":
         platform = parsed["platform"]
         hsh = parsed["hash"]
         snap = full_snapshot_name(date, rev, platform, hsh)
diff --git a/src/etc/mklldeps.py b/src/etc/mklldeps.py
index 834ba074c62..a4234159cb8 100644
--- a/src/etc/mklldeps.py
+++ b/src/etc/mklldeps.py
@@ -11,8 +11,6 @@
 import os
 import sys
 import subprocess
-import itertools
-from os import path
 
 f = open(sys.argv[1], 'wb')
 
@@ -35,6 +33,7 @@ f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
 //          take a look at src/etc/mklldeps.py if you're interested
 """)
 
+
 def run(args):
     proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     out, err = proc.communicate()
diff --git a/src/etc/snapshot.py b/src/etc/snapshot.py
index 8f45f7f1af2..698c3a551e2 100644
--- a/src/etc/snapshot.py
+++ b/src/etc/snapshot.py
@@ -8,24 +8,32 @@
 # option. This file may not be copied, modified, or distributed
 # except according to those terms.
 
-import re, os, sys, glob, tarfile, shutil, subprocess, tempfile, distutils.spawn
+import re
+import os
+import sys
+import glob
+import tarfile
+import shutil
+import subprocess
+import distutils.spawn
 
 try:
-  import hashlib
-  sha_func = hashlib.sha1
+    import hashlib
+    sha_func = hashlib.sha1
 except ImportError:
-  import sha
-  sha_func = sha.new
+    import sha
+    sha_func = sha.new
+
 
 def scrub(b):
-  if sys.version_info >= (3,) and type(b) == bytes:
-    return b.decode('ascii')
-  else:
-    return b
+    if sys.version_info >= (3,) and type(b) == bytes:
+        return b.decode('ascii')
+    else:
+        return b
 
 src_dir = scrub(os.getenv("CFG_SRC_DIR"))
 if not src_dir:
-  raise Exception("missing env var CFG_SRC_DIR")
+    raise Exception("missing env var CFG_SRC_DIR")
 
 snapshotfile = os.path.join(src_dir, "src", "snapshots.txt")
 download_url_base = "https://static.rust-lang.org/stage0-snapshots"
@@ -33,54 +41,57 @@ download_dir_base = "dl"
 download_unpack_base = os.path.join(download_dir_base, "unpack")
 
 snapshot_files = {
-    "linux": ["bin/rustc"],
-    "macos": ["bin/rustc"],
-    "winnt": ["bin/rustc.exe"],
-    "freebsd": ["bin/rustc"],
-    "dragonfly": ["bin/rustc"],
-    }
-
-winnt_runtime_deps_32 = ["libgcc_s_dw2-1.dll",
-                         "libstdc++-6.dll"]
-winnt_runtime_deps_64 = ["libgcc_s_seh-1.dll",
-                         "libstdc++-6.dll"]
+        "linux": ["bin/rustc"],
+        "macos": ["bin/rustc"],
+        "winnt": ["bin/rustc.exe"],
+        "freebsd": ["bin/rustc"],
+        "dragonfly": ["bin/rustc"],
+        }
+
+winnt_runtime_deps_32 = ["libgcc_s_dw2-1.dll", "libstdc++-6.dll"]
+winnt_runtime_deps_64 = ["libgcc_s_seh-1.dll", "libstdc++-6.dll"]
+
 
 def parse_line(n, line):
-  global snapshotfile
+    global snapshotfile
 
-  if re.match(r"\s*$", line): return None
+    if re.match(r"\s*$", line):
+        return None
 
-  if re.match(r"^T\s*$", line): return None
+    if re.match(r"^T\s*$", line):
+        return None
 
-  match = re.match(r"\s+([\w_-]+) ([a-fA-F\d]{40})\s*$", line)
-  if match:
-    return { "type": "file",
-             "platform": match.group(1),
-             "hash": match.group(2).lower() }
+    match = re.match(r"\s+([\w_-]+) ([a-fA-F\d]{40})\s*$", line)
+    if match:
+        return {"type": "file",
+                "platform": match.group(1),
+                "hash": match.group(2).lower()}
 
-  match = re.match(r"([ST]) (\d{4}-\d{2}-\d{2}) ([a-fA-F\d]+)\s*$", line);
-  if (not match):
-    raise Exception("%s:%d:E syntax error: " % (snapshotfile, n))
-  return {"type": "snapshot",
-          "date": match.group(2),
-          "rev": match.group(3)}
+    match = re.match(r"([ST]) (\d{4}-\d{2}-\d{2}) ([a-fA-F\d]+)\s*$", line)
+    if not match:
+        raise Exception("%s:%d:E syntax error: " % (snapshotfile, n))
+    return {"type": "snapshot",
+            "date": match.group(2),
+            "rev": match.group(3)}
 
 
 def partial_snapshot_name(date, rev, platform):
-  return ("rust-stage0-%s-%s-%s.tar.bz2"
-          % (date, rev, platform))
+    return ("rust-stage0-%s-%s-%s.tar.bz2" %
+            (date, rev, platform))
+
 
 def full_snapshot_name(date, rev, platform, hsh):
-  return ("rust-stage0-%s-%s-%s-%s.tar.bz2"
-          % (date, rev, platform, hsh))
+    return ("rust-stage0-%s-%s-%s-%s.tar.bz2" %
+            (date, rev, platform, hsh))
 
 
 def get_kernel(triple):
     t = triple.split('-')
     if len(t) == 2:
-      os_name = t[1]
+        os_name = t[1]
     else:
-      os_name = t[2]
+        os_name = t[2]
+
     if os_name == "windows":
         return "winnt"
     if os_name == "darwin":
@@ -91,19 +102,20 @@ def get_kernel(triple):
         return "dragonfly"
     return "linux"
 
+
 def get_cpu(triple):
     arch = triple.split('-')[0]
     if arch == "i686":
-      return "i386"
+        return "i386"
     return arch
 
+
 def get_platform(triple):
-  return "%s-%s" % (get_kernel(triple), get_cpu(triple))
+    return "%s-%s" % (get_kernel(triple), get_cpu(triple))
 
 
 def cmd_out(cmdline):
-    p = subprocess.Popen(cmdline,
-                         stdout=subprocess.PIPE)
+    p = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
     return scrub(p.communicate()[0].strip())
 
 
@@ -124,7 +136,8 @@ def local_rev_short_sha():
 def local_rev_committer_date():
     return local_rev_info("ci")
 
-def get_url_to_file(u,f):
+
+def get_url_to_file(u, f):
     # no security issue, just to stop partial download leaving a stale file
     tmpf = f + '.tmp'
 
@@ -137,40 +150,44 @@ def get_url_to_file(u,f):
     if returncode != 0:
         try:
             os.unlink(tmpf)
-        except OSError as e:
+        except OSError:
             pass
         raise Exception("failed to fetch url")
     os.rename(tmpf, f)
 
+
 def snap_filename_hash_part(snap):
-  match = re.match(r".*([a-fA-F\d]{40}).tar.bz2$", snap)
-  if not match:
-    raise Exception("unable to find hash in filename: " + snap)
-  return match.group(1)
+    match = re.match(r".*([a-fA-F\d]{40}).tar.bz2$", snap)
+    if not match:
+        raise Exception("unable to find hash in filename: " + snap)
+    return match.group(1)
+
 
 def hash_file(x):
     h = sha_func()
     h.update(open(x, "rb").read())
     return scrub(h.hexdigest())
 
-# Returns a list of paths of Rust's system runtime dependencies
+
 def get_winnt_runtime_deps(platform):
+    """Returns a list of paths of Rust's system runtime dependencies"""
     if platform == "winnt-x86_64":
-      deps = winnt_runtime_deps_64
+        deps = winnt_runtime_deps_64
     else:
-      deps = winnt_runtime_deps_32
+        deps = winnt_runtime_deps_32
     runtime_deps = []
     path_dirs = os.environ["PATH"].split(os.pathsep)
     for name in deps:
-      for dir in path_dirs:
-        filepath = os.path.join(dir, name)
-        if os.path.isfile(filepath):
-          runtime_deps.append(filepath)
-          break
-      else:
-        raise Exception("Could not find runtime dependency: %s" % name)
+        for dir in path_dirs:
+            filepath = os.path.join(dir, name)
+            if os.path.isfile(filepath):
+                runtime_deps.append(filepath)
+                break
+        else:
+            raise Exception("Could not find runtime dependency: %s" % name)
     return runtime_deps
 
+
 def make_snapshot(stage, triple):
     kernel = get_kernel(triple)
     platform = get_platform(triple)
@@ -180,31 +197,31 @@ def make_snapshot(stage, triple):
     file0 = partial_snapshot_name(date, rev, platform)
 
     def in_tar_name(fn):
-      cs = re.split(r"[\\/]", fn)
-      if len(cs) >= 2:
-        return os.sep.join(cs[-2:])
+        cs = re.split(r"[\\/]", fn)
+        if len(cs) >= 2:
+            return os.sep.join(cs[-2:])
 
     tar = tarfile.open(file0, "w:bz2")
 
     for name in snapshot_files[kernel]:
-      dir = stage
-      if stage == "stage1" and re.match(r"^lib/(lib)?std.*", name):
-        dir = "stage0"
-      fn_glob = os.path.join(triple, dir, name)
-      matches = glob.glob(fn_glob)
-      if not matches:
-        raise Exception("Not found file with name like " + fn_glob)
-      if len(matches) == 1:
-        tar.add(matches[0], "rust-stage0/" + in_tar_name(matches[0]))
-      else:
-        raise Exception("Found stale files: \n  %s\n"
-                        "Please make a clean build." % "\n  ".join(matches))
-
-    if kernel=="winnt":
-      for path in get_winnt_runtime_deps(platform):
-        tar.add(path, "rust-stage0/bin/" + os.path.basename(path))
-      tar.add(os.path.join(os.path.dirname(__file__), "third-party"),
-              "rust-stage0/bin/third-party")
+        dir = stage
+        if stage == "stage1" and re.match(r"^lib/(lib)?std.*", name):
+            dir = "stage0"
+        fn_glob = os.path.join(triple, dir, name)
+        matches = glob.glob(fn_glob)
+        if not matches:
+            raise Exception("Not found file with name like " + fn_glob)
+        if len(matches) == 1:
+            tar.add(matches[0], "rust-stage0/" + in_tar_name(matches[0]))
+        else:
+            raise Exception("Found stale files: \n  %s\n"
+                            "Please make a clean build." % "\n  ".join(matches))
+
+    if kernel == "winnt":
+        for path in get_winnt_runtime_deps(platform):
+            tar.add(path, "rust-stage0/bin/" + os.path.basename(path))
+        tar.add(os.path.join(os.path.dirname(__file__), "third-party"),
+                "rust-stage0/bin/third-party")
 
     tar.close()
 
@@ -215,60 +232,64 @@ def make_snapshot(stage, triple):
 
     return file1
 
+
 def curr_snapshot_rev():
-  i = 0
-  found_snap = False
-  date = None
-  rev = None
+    i = 0
+    found_snap = False
+    date = None
+    rev = None
+
+    f = open(snapshotfile)
+    for line in f.readlines():
+        i += 1
+        parsed = parse_line(i, line)
+        if not parsed:
+            continue
 
-  f = open(snapshotfile)
-  for line in f.readlines():
-    i += 1
-    parsed = parse_line(i, line)
-    if (not parsed): continue
+        if parsed["type"] == "snapshot":
+            date = parsed["date"]
+            rev = parsed["rev"]
+            found_snap = True
+            break
 
-    if parsed["type"] == "snapshot":
-      date = parsed["date"]
-      rev = parsed["rev"]
-      found_snap = True
-      break
+    if not found_snap:
+        raise Exception("no snapshot entries in file")
 
-  if not found_snap:
-    raise Exception("no snapshot entries in file")
+    return (date, rev)
 
-  return (date, rev)
 
 def determine_curr_snapshot(triple):
-  i = 0
-  platform = get_platform(triple)
-
-  found_file = False
-  found_snap = False
-  hsh = None
-  date = None
-  rev = None
-
-  f = open(snapshotfile)
-  for line in f.readlines():
-    i += 1
-    parsed = parse_line(i, line)
-    if (not parsed): continue
-
-    if found_snap and parsed["type"] == "file":
-      if parsed["platform"] == platform:
-        hsh = parsed["hash"]
-        found_file = True
-        break;
-    elif parsed["type"] == "snapshot":
-      date = parsed["date"]
-      rev = parsed["rev"]
-      found_snap = True
-
-  if not found_snap:
-    raise Exception("no snapshot entries in file")
-
-  if not found_file:
-    raise Exception("no snapshot file found for platform %s, rev %s" %
-                    (platform, rev))
-
-  return full_snapshot_name(date, rev, platform, hsh)
+    i = 0
+    platform = get_platform(triple)
+
+    found_file = False
+    found_snap = False
+    hsh = None
+    date = None
+    rev = None
+
+    f = open(snapshotfile)
+    for line in f.readlines():
+        i += 1
+        parsed = parse_line(i, line)
+        if not parsed:
+            continue
+
+        if found_snap and parsed["type"] == "file":
+            if parsed["platform"] == platform:
+                hsh = parsed["hash"]
+                found_file = True
+                break
+        elif parsed["type"] == "snapshot":
+            date = parsed["date"]
+            rev = parsed["rev"]
+            found_snap = True
+
+    if not found_snap:
+        raise Exception("no snapshot entries in file")
+
+    if not found_file:
+        raise Exception("no snapshot file found for platform %s, rev %s" %
+                        (platform, rev))
+
+    return full_snapshot_name(date, rev, platform, hsh)
diff --git a/src/etc/sugarise-doc-comments.py b/src/etc/sugarise-doc-comments.py
index 7d4ad749fe3..62870f3ed47 100755
--- a/src/etc/sugarise-doc-comments.py
+++ b/src/etc/sugarise-doc-comments.py
@@ -17,7 +17,10 @@
 # it sugarises all .rs/.rc files underneath the working directory
 #
 
-import sys, os, fnmatch, re
+import sys
+import os
+import fnmatch
+import re
 
 
 DOC_PATTERN = '^(?P<indent>[\\t ]*)#\\[(\\s*)doc(\\s*)=' + \
@@ -85,7 +88,6 @@ def sugarise_file(path):
     if s != ns:
         open(path, 'w').write(ns)
 
-
 for (dirpath, dirnames, filenames) in os.walk('.'):
     for name in fnmatch.filter(filenames, '*.r[sc]'):
         sugarise_file(os.path.join(dirpath, name))
diff --git a/src/etc/tidy.py b/src/etc/tidy.py
index c65b762e517..f5172feb5b6 100644
--- a/src/etc/tidy.py
+++ b/src/etc/tidy.py
@@ -8,37 +8,45 @@
 # option. This file may not be copied, modified, or distributed
 # except according to those terms.
 
-import sys, fileinput, subprocess, re, os
+import sys
+import fileinput
+import subprocess
+import re
+import os
 from licenseck import *
 import snapshot
 
-err=0
-cols=100
-cr_flag="ignore-tidy-cr"
-tab_flag="ignore-tidy-tab"
-linelength_flag="ignore-tidy-linelength"
+err = 0
+cols = 100
+cr_flag = "ignore-tidy-cr"
+tab_flag = "ignore-tidy-tab"
+linelength_flag = "ignore-tidy-linelength"
 
 # Be careful to support Python 2.4, 2.6, and 3.x here!
-config_proc=subprocess.Popen([ "git", "config", "core.autocrlf" ],
-                             stdout=subprocess.PIPE)
-result=config_proc.communicate()[0]
+config_proc = subprocess.Popen(["git", "config", "core.autocrlf"],
+                               stdout=subprocess.PIPE)
+result = config_proc.communicate()[0]
+
+true = "true".encode('utf8')
+autocrlf = result.strip() == true if result is not None else False
 
-true="true".encode('utf8')
-autocrlf=result.strip() == true if result is not None else False
 
 def report_error_name_no(name, no, s):
     global err
     print("%s:%d: %s" % (name, no, s))
-    err=1
+    err = 1
+
 
 def report_err(s):
     report_error_name_no(fileinput.filename(), fileinput.filelineno(), s)
 
+
 def report_warn(s):
     print("%s:%d: %s" % (fileinput.filename(),
                          fileinput.filelineno(),
                          s))
 
+
 def do_license_check(name, contents):
     if not check_license(name, contents):
         report_error_name_no(name, 1, "incorrect license")
@@ -81,13 +89,13 @@ try:
                 date, rev = snapshot.curr_snapshot_rev()
                 if not hsh.startswith(rev):
                     report_err("snapshot out of date (" + date
-                      + "): " + line)
+                               + "): " + line)
             else:
                 if "SNAP" in line:
                     report_warn("unmatched SNAP line: " + line)
 
         if check_tab and ('\t' in line and
-            "Makefile" not in fileinput.filename()):
+                          "Makefile" not in fileinput.filename()):
             report_err("tab character")
         if check_cr and not autocrlf and '\r' in line:
             report_err("CR character")
diff --git a/src/etc/unicode.py b/src/etc/unicode.py
index 4a0bb992fd9..4952b99ab46 100755
--- a/src/etc/unicode.py
+++ b/src/etc/unicode.py
@@ -392,15 +392,13 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
     use core::slice;
 
     #[allow(non_camel_case_types)]
-    #[derive(Clone)]
+    #[derive(Clone, Copy)]
     pub enum GraphemeCat {
 """)
     for cat in grapheme_cats + ["Any"]:
         f.write("        GC_" + cat + ",\n")
     f.write("""    }
 
-    impl Copy for GraphemeCat {}
-
     fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
         use core::cmp::Ordering::{Equal, Less, Greater};
         match r.binary_search(|&(lo, hi, _)| {
diff --git a/src/etc/vim/syntax_checkers/rust/rustc.vim b/src/etc/vim/syntax_checkers/rust/rustc.vim
index 5cd419ca732..5d196086168 100644
--- a/src/etc/vim/syntax_checkers/rust/rustc.vim
+++ b/src/etc/vim/syntax_checkers/rust/rustc.vim
@@ -14,7 +14,7 @@ let s:save_cpo = &cpo
 set cpo&vim
 
 function! SyntaxCheckers_rust_rustc_GetLocList() dict
-    let makeprg = self.makeprgBuild({ 'args': '--parse-only' })
+    let makeprg = self.makeprgBuild({ 'args': '-Zparse-only' })
 
     let errorformat  =
         \ '%E%f:%l:%c: %\d%#:%\d%# %.%\{-}error:%.%\{-} %m,'   .
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index dff95711d49..b3bf55be46b 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -1,4 +1,4 @@
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -179,7 +179,7 @@ pub trait SliceExt {
     /// Deprecated: use `&s[start..]` notation instead.
     #[unstable(feature = "collections",
                reason = "will be replaced by slice syntax")]
-    #[deprecated(since = "1.0.0", reason = "use &s[start..] isntead")]
+    #[deprecated(since = "1.0.0", reason = "use &s[start..] instead")]
     fn slice_from(&self, start: uint) -> &[Self::Item];
 
     /// Deprecated: use `&s[..end]` notation instead.
@@ -195,15 +195,36 @@ pub trait SliceExt {
     /// indices from `[mid, len)` (excluding the index `len` itself).
     ///
     /// Panics if `mid > len`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let v = [10, 40, 30, 20, 50];
+    /// let (v1, v2) = v.split_at(2);
+    /// assert_eq!([10, 40], v1);
+    /// assert_eq!([30, 20, 50], v2);
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn split_at(&self, mid: uint) -> (&[Self::Item], &[Self::Item]);
 
-    /// Returns an iterator over the slice
+    /// Returns an iterator over the slice.
     #[stable(feature = "rust1", since = "1.0.0")]
     fn iter(&self) -> Iter<Self::Item>;
 
     /// Returns an iterator over subslices separated by elements that match
     /// `pred`.  The matched element is not contained in the subslices.
+    ///
+    /// # Examples
+    ///
+    /// Print the slice split by numbers divisible by 3 (i.e. `[10, 40]`,
+    /// `[20]`, `[50]`):
+    ///
+    /// ```
+    /// let v = [10, 40, 30, 20, 60, 50];
+    /// for group in v.split(|num| *num % 3 == 0) {
+    ///     println!("{:?}", group);
+    /// }
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn split<F>(&self, pred: F) -> Split<Self::Item, F>
                 where F: FnMut(&Self::Item) -> bool;
@@ -211,6 +232,18 @@ pub trait SliceExt {
     /// Returns an iterator over subslices separated by elements that match
     /// `pred`, limited to splitting at most `n` times.  The matched element is
     /// not contained in the subslices.
+    ///
+    /// # Examples
+    ///
+    /// Print the slice split once by numbers divisible by 3 (i.e. `[10, 40]`,
+    /// `[20, 60, 50]`):
+    ///
+    /// ```
+    /// let v = [10, 40, 30, 20, 60, 50];
+    /// for group in v.splitn(1, |num| *num % 3 == 0) {
+    ///     println!("{:?}", group);
+    /// }
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn splitn<F>(&self, n: uint, pred: F) -> SplitN<Self::Item, F>
                  where F: FnMut(&Self::Item) -> bool;
@@ -219,6 +252,18 @@ pub trait SliceExt {
     /// `pred` limited to splitting at most `n` times. This starts at the end of
     /// the slice and works backwards.  The matched element is not contained in
     /// the subslices.
+    ///
+    /// # Examples
+    ///
+    /// Print the slice split once, starting from the end, by numbers divisible
+    /// by 3 (i.e. `[50]`, `[10, 40, 30, 20]`):
+    ///
+    /// ```
+    /// let v = [10, 40, 30, 20, 60, 50];
+    /// for group in v.rsplitn(1, |num| *num % 3 == 0) {
+    ///     println!("{:?}", group);
+    /// }
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<Self::Item, F>
                   where F: FnMut(&Self::Item) -> bool;
@@ -270,10 +315,28 @@ pub trait SliceExt {
 
     /// Returns the element of a slice at the given index, or `None` if the
     /// index is out of bounds.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let v = [10, 40, 30];
+    /// assert_eq!(Some(&40), v.get(1));
+    /// assert_eq!(None, v.get(3));
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn get(&self, index: uint) -> Option<&Self::Item>;
 
     /// Returns the first element of a slice, or `None` if it is empty.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let v = [10, 40, 30];
+    /// assert_eq!(Some(&10), v.first());
+    ///
+    /// let w: &[i32] = &[];
+    /// assert_eq!(None, w.first());
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn first(&self) -> Option<&Self::Item>;
 
@@ -286,6 +349,16 @@ pub trait SliceExt {
     fn init(&self) -> &[Self::Item];
 
     /// Returns the last element of a slice, or `None` if it is empty.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let v = [10, 40, 30];
+    /// assert_eq!(Some(&30), v.last());
+    ///
+    /// let w: &[i32] = &[];
+    /// assert_eq!(None, w.last());
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn last(&self) -> Option<&Self::Item>;
 
@@ -676,15 +749,43 @@ pub trait SliceExt {
     #[unstable(feature = "collections")]
     fn rposition_elem(&self, t: &Self::Item) -> Option<uint> where Self::Item: PartialEq;
 
-    /// Return true if the slice contains an element with the given value.
+    /// Returns true if the slice contains an element with the given value.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let v = [10, 40, 30];
+    /// assert!(v.contains(&30));
+    /// assert!(!v.contains(&50));
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn contains(&self, x: &Self::Item) -> bool where Self::Item: PartialEq;
 
     /// Returns true if `needle` is a prefix of the slice.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let v = [10, 40, 30];
+    /// assert!(v.starts_with(&[10]));
+    /// assert!(v.starts_with(&[10, 40]));
+    /// assert!(!v.starts_with(&[50]));
+    /// assert!(!v.starts_with(&[10, 50]));
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn starts_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq;
 
     /// Returns true if `needle` is a suffix of the slice.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let v = [10, 40, 30];
+    /// assert!(v.ends_with(&[30]));
+    /// assert!(v.ends_with(&[40, 30]));
+    /// assert!(!v.ends_with(&[50]));
+    /// assert!(!v.ends_with(&[50, 30]));
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn ends_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq;
 
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index c44dfff9117..367ab28e47b 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -993,6 +993,43 @@ impl<T> Vec<T> {
             result
         }
     }
+
+    /// Splits the collection into two at the given index.
+    ///
+    /// Returns a newly allocated `Self`. `self` contains elements `[0, at)`,
+    /// and the returned `Self` contains elements `[at, len)`.
+    ///
+    /// Note that the capacity of `self` does not change.
+    ///
+    /// # Examples
+    /// ```rust
+    /// let mut vec = vec![1,2,3];
+    /// let vec2 = vec.split_off(1);
+    /// assert_eq!(vec, vec![1]);
+    /// assert_eq!(vec2, vec![2, 3]);
+    /// ```
+    #[inline]
+    #[unstable(feature = "collections",
+               reason = "new API, waiting for dust to settle")]
+    pub fn split_off(&mut self, at: usize) -> Self {
+        assert!(at < self.len(), "`at` out of bounds");
+
+        let other_len = self.len - at;
+        let mut other = Vec::with_capacity(other_len);
+
+        // Unsafely `set_len` and copy items to `other`.
+        unsafe {
+            self.set_len(at);
+            other.set_len(other_len);
+
+            ptr::copy_nonoverlapping_memory(
+                other.as_mut_ptr(),
+                self.as_ptr().offset(at as isize),
+                other.len());
+        }
+        other
+    }
+
 }
 
 impl<T: Clone> Vec<T> {
@@ -1966,7 +2003,7 @@ mod tests {
     fn test_slice_from_mut() {
         let mut values = vec![1u8,2,3,4,5];
         {
-            let slice = values.slice_from_mut(2);
+            let slice = &mut values[2 ..];
             assert!(slice == [3, 4, 5]);
             for p in slice.iter_mut() {
                 *p += 2;
@@ -1980,7 +2017,7 @@ mod tests {
     fn test_slice_to_mut() {
         let mut values = vec![1u8,2,3,4,5];
         {
-            let slice = values.slice_to_mut(2);
+            let slice = &mut values[.. 2];
             assert!(slice == [1, 2]);
             for p in slice.iter_mut() {
                 *p += 1;
@@ -2354,6 +2391,14 @@ mod tests {
         assert_eq!(vec2, vec![]);
     }
 
+    #[test]
+    fn test_split_off() {
+        let mut vec = vec![1, 2, 3, 4, 5, 6];
+        let vec2 = vec.split_off(4);
+        assert_eq!(vec, vec![1, 2, 3, 4]);
+        assert_eq!(vec2, vec![5, 6]);
+    }
+
     #[bench]
     fn bench_new(b: &mut Bencher) {
         b.iter(|| {
diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs
index 7c8be79d075..495c7c2bc2e 100644
--- a/src/libcore/nonzero.rs
+++ b/src/libcore/nonzero.rs
@@ -31,7 +31,7 @@ unsafe impl Zeroable for u64 {}
 /// A wrapper type for raw pointers and integers that will never be
 /// NULL or 0 that might allow certain optimizations.
 #[lang="non_zero"]
-#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Show)]
+#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Show, Hash)]
 #[unstable(feature = "core")]
 pub struct NonZero<T: Zeroable>(T);
 
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs
index 0e99a2c9c3e..bbb964508b4 100644
--- a/src/libcore/ops.rs
+++ b/src/libcore/ops.rs
@@ -449,10 +449,9 @@ rem_float_impl! { f64, fmod }
 /// ```
 /// use std::ops::Neg;
 ///
+/// #[derive(Copy)]
 /// struct Foo;
 ///
-/// impl Copy for Foo {}
-///
 /// impl Neg for Foo {
 ///     type Output = Foo;
 ///
@@ -526,10 +525,9 @@ neg_uint_impl! { u64, i64 }
 /// ```
 /// use std::ops::Not;
 ///
+/// #[derive(Copy)]
 /// struct Foo;
 ///
-/// impl Copy for Foo {}
-///
 /// impl Not for Foo {
 ///     type Output = Foo;
 ///
@@ -899,6 +897,7 @@ shr_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
 /// }
 /// ```
 #[lang="index"]
+#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Index}`"]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait Index<Index: ?Sized> {
     type Output: ?Sized;
@@ -937,6 +936,7 @@ pub trait Index<Index: ?Sized> {
 /// }
 /// ```
 #[lang="index_mut"]
+#[rustc_on_unimplemented = "the type `{Self}` cannot be mutably indexed by `{Index}`"]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait IndexMut<Index: ?Sized> {
     type Output: ?Sized;
diff --git a/src/librustc_llvm/diagnostic.rs b/src/librustc_llvm/diagnostic.rs
index 5d0ae9d1f92..aca4d265bc9 100644
--- a/src/librustc_llvm/diagnostic.rs
+++ b/src/librustc_llvm/diagnostic.rs
@@ -37,6 +37,8 @@ impl OptimizationDiagnosticKind {
     }
 }
 
+#[allow(raw_pointer_derive)]
+#[derive(Copy)]
 pub struct OptimizationDiagnostic {
     pub kind: OptimizationDiagnosticKind,
     pub pass_name: *const c_char,
@@ -45,8 +47,6 @@ pub struct OptimizationDiagnostic {
     pub message: TwineRef,
 }
 
-impl Copy for OptimizationDiagnostic {}
-
 impl OptimizationDiagnostic {
     unsafe fn unpack(kind: OptimizationDiagnosticKind, di: DiagnosticInfoRef)
             -> OptimizationDiagnostic {
diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/main.css
index 0914f93efd8..46faa3efc34 100644
--- a/src/librustdoc/html/static/main.css
+++ b/src/librustdoc/html/static/main.css
@@ -64,7 +64,6 @@
 
 body {
     color: #333;
-    min-width: 500px;
     font: 16px/1.4 "Source Serif Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
     margin: 0;
     position: relative;
@@ -592,6 +591,14 @@ pre.rust { position: relative; }
         margin-left: 0px;
     }
 
+    .content .in-band {
+        width: 100%;
+    }
+
+    .content .out-of-band {
+        display: none;
+    }
+
     .toggle-wrapper > .collapse-toggle {
         left: 0px;
     }
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index cd37a355e1d..979a61d20d5 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -815,6 +815,8 @@ pub struct MemoryMap {
 }
 
 /// Type of memory map
+#[allow(raw_pointer_derive)]
+#[derive(Copy)]
 pub enum MemoryMapKind {
     /// Virtual memory map. Usually used to change the permissions of a given
     /// chunk of memory.  Corresponds to `VirtualAlloc` on Windows.
@@ -825,9 +827,9 @@ pub enum MemoryMapKind {
     MapVirtual
 }
 
-impl Copy for MemoryMapKind {}
-
 /// Options the memory map is created with
+#[allow(raw_pointer_derive)]
+#[derive(Copy)]
 pub enum MapOption {
     /// The memory should be readable
     MapReadable,
@@ -854,8 +856,6 @@ pub enum MapOption {
     MapNonStandardFlags(c_int),
 }
 
-impl Copy for MapOption {}
-
 /// Possible errors when creating a map.
 #[derive(Copy, Show)]
 pub enum MapError {
diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs
index 8f5d0e22c88..0a6dc386edf 100644
--- a/src/libstd/rand/mod.rs
+++ b/src/libstd/rand/mod.rs
@@ -99,10 +99,10 @@
 //!    let between = Range::new(-1f64, 1.);
 //!    let mut rng = rand::thread_rng();
 //!
-//!    let total = 1_000_000u;
-//!    let mut in_circle = 0u;
+//!    let total = 1_000_000;
+//!    let mut in_circle = 0;
 //!
-//!    for _ in range(0u, total) {
+//!    for _ in range(0, total) {
 //!        let a = between.ind_sample(&mut rng);
 //!        let b = between.ind_sample(&mut rng);
 //!        if a*a + b*b <= 1. {
@@ -176,18 +176,18 @@
 //! }
 //!
 //! fn free_doors(blocked: &[uint]) -> Vec<uint> {
-//!     range(0u, 3).filter(|x| !blocked.contains(x)).collect()
+//!     range(0, 3).filter(|x| !blocked.contains(x)).collect()
 //! }
 //!
 //! fn main() {
 //!     // The estimation will be more accurate with more simulations
-//!     let num_simulations = 10000u;
+//!     let num_simulations = 10000;
 //!
 //!     let mut rng = rand::thread_rng();
-//!     let random_door = Range::new(0u, 3);
+//!     let random_door = Range::new(0, 3);
 //!
-//!     let (mut switch_wins, mut switch_losses) = (0u, 0u);
-//!     let (mut keep_wins, mut keep_losses) = (0u, 0u);
+//!     let (mut switch_wins, mut switch_losses) = (0, 0);
+//!     let (mut keep_wins, mut keep_losses) = (0, 0);
 //!
 //!     println!("Running {} simulations...", num_simulations);
 //!     for _ in range(0, num_simulations) {
@@ -279,14 +279,14 @@ impl Rng for StdRng {
     }
 }
 
-impl<'a> SeedableRng<&'a [uint]> for StdRng {
-    fn reseed(&mut self, seed: &'a [uint]) {
+impl<'a> SeedableRng<&'a [usize]> for StdRng {
+    fn reseed(&mut self, seed: &'a [usize]) {
         // the internal RNG can just be seeded from the above
         // randomness.
         self.rng.reseed(unsafe {mem::transmute(seed)})
     }
 
-    fn from_seed(seed: &'a [uint]) -> StdRng {
+    fn from_seed(seed: &'a [usize]) -> StdRng {
         StdRng { rng: SeedableRng::from_seed(unsafe {mem::transmute(seed)}) }
     }
 }
@@ -318,7 +318,7 @@ impl reseeding::Reseeder<StdRng> for ThreadRngReseeder {
         }
     }
 }
-static THREAD_RNG_RESEED_THRESHOLD: uint = 32_768;
+static THREAD_RNG_RESEED_THRESHOLD: usize = 32_768;
 type ThreadRngInner = reseeding::ReseedingRng<StdRng, ThreadRngReseeder>;
 
 /// The thread-local RNG.
@@ -384,7 +384,7 @@ impl Rng for ThreadRng {
 /// use std::rand;
 ///
 /// let x = rand::random();
-/// println!("{}", 2u * x);
+/// println!("{}", 2u8 * x);
 ///
 /// let y = rand::random::<f64>();
 /// println!("{}", y);
@@ -432,7 +432,7 @@ pub fn random<T: Rand>() -> T {
 /// ```
 pub fn sample<T, I: Iterator<Item=T>, R: Rng>(rng: &mut R,
                                          mut iter: I,
-                                         amount: uint) -> Vec<T> {
+                                         amount: usize) -> Vec<T> {
     let mut reservoir: Vec<T> = iter.by_ref().take(amount).collect();
     for (i, elem) in iter.enumerate() {
         let k = rng.gen_range(0, i + 1 + amount);
@@ -480,18 +480,18 @@ mod test {
     #[test]
     fn test_gen_range() {
         let mut r = thread_rng();
-        for _ in range(0u, 1000) {
+        for _ in range(0, 1000) {
             let a = r.gen_range(-3i, 42);
             assert!(a >= -3 && a < 42);
             assert_eq!(r.gen_range(0i, 1), 0);
             assert_eq!(r.gen_range(-12i, -11), -12);
         }
 
-        for _ in range(0u, 1000) {
+        for _ in range(0, 1000) {
             let a = r.gen_range(10i, 42);
             assert!(a >= 10 && a < 42);
             assert_eq!(r.gen_range(0i, 1), 0);
-            assert_eq!(r.gen_range(3_000_000u, 3_000_001), 3_000_000);
+            assert_eq!(r.gen_range(3_000_000, 3_000_001), 3_000_000);
         }
 
     }
@@ -507,7 +507,7 @@ mod test {
     #[should_fail]
     fn test_gen_range_panic_uint() {
         let mut r = thread_rng();
-        r.gen_range(5u, 2u);
+        r.gen_range(5us, 2us);
     }
 
     #[test]
@@ -521,24 +521,24 @@ mod test {
     #[test]
     fn test_gen_weighted_bool() {
         let mut r = thread_rng();
-        assert_eq!(r.gen_weighted_bool(0u), true);
-        assert_eq!(r.gen_weighted_bool(1u), true);
+        assert_eq!(r.gen_weighted_bool(0), true);
+        assert_eq!(r.gen_weighted_bool(1), true);
     }
 
     #[test]
     fn test_gen_ascii_str() {
         let mut r = thread_rng();
-        assert_eq!(r.gen_ascii_chars().take(0).count(), 0u);
-        assert_eq!(r.gen_ascii_chars().take(10).count(), 10u);
-        assert_eq!(r.gen_ascii_chars().take(16).count(), 16u);
+        assert_eq!(r.gen_ascii_chars().take(0).count(), 0);
+        assert_eq!(r.gen_ascii_chars().take(10).count(), 10);
+        assert_eq!(r.gen_ascii_chars().take(16).count(), 16);
     }
 
     #[test]
     fn test_gen_vec() {
         let mut r = thread_rng();
-        assert_eq!(r.gen_iter::<u8>().take(0).count(), 0u);
-        assert_eq!(r.gen_iter::<u8>().take(10).count(), 10u);
-        assert_eq!(r.gen_iter::<f64>().take(16).count(), 16u);
+        assert_eq!(r.gen_iter::<u8>().take(0).count(), 0);
+        assert_eq!(r.gen_iter::<u8>().take(10).count(), 10);
+        assert_eq!(r.gen_iter::<f64>().take(16).count(), 16);
     }
 
     #[test]
@@ -578,7 +578,7 @@ mod test {
         r.shuffle(&mut v);
         let b: &[_] = &[1, 1, 1];
         assert_eq!(v, b);
-        assert_eq!(r.gen_range(0u, 1u), 0u);
+        assert_eq!(r.gen_range(0, 1), 0);
     }
 
     #[test]
diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs
index 547c8131486..fb8fd0b5078 100644
--- a/src/libstd/rand/os.rs
+++ b/src/libstd/rand/os.rs
@@ -49,7 +49,7 @@ mod imp {
         const NR_GETRANDOM: libc::c_long = 384;
 
         unsafe {
-            syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), 0u)
+            syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), 0)
         }
     }
 
@@ -74,7 +74,7 @@ mod imp {
                     panic!("unexpected getrandom error: {}", err);
                 }
             } else {
-                read += result as uint;
+                read += result as usize;
             }
         }
     }
@@ -378,7 +378,7 @@ mod test {
     fn test_os_rng_tasks() {
 
         let mut txs = vec!();
-        for _ in range(0u, 20) {
+        for _ in range(0, 20) {
             let (tx, rx) = channel();
             txs.push(tx);
 
@@ -392,7 +392,7 @@ mod test {
                 Thread::yield_now();
                 let mut v = [0u8; 1000];
 
-                for _ in range(0u, 100) {
+                for _ in range(0, 100) {
                     r.next_u32();
                     Thread::yield_now();
                     r.next_u64();
diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs
index e19c1dc7ed6..02f738c9d29 100644
--- a/src/libunicode/lib.rs
+++ b/src/libunicode/lib.rs
@@ -83,4 +83,5 @@ mod std {
     pub use core::clone;
     pub use core::cmp;
     pub use core::fmt;
+    pub use core::marker;
 }
diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs
index 3f089d62e4e..a38f911688d 100644
--- a/src/libunicode/tables.rs
+++ b/src/libunicode/tables.rs
@@ -7801,13 +7801,12 @@ pub mod charwidth {
 }
 
 pub mod grapheme {
-    use core::marker::Copy;
     use core::slice::SliceExt;
     pub use self::GraphemeCat::*;
     use core::result::Result::{Ok, Err};
 
     #[allow(non_camel_case_types)]
-    #[derive(Clone)]
+    #[derive(Clone, Copy)]
     pub enum GraphemeCat {
         GC_LV,
         GC_LVT,
@@ -7821,8 +7820,6 @@ pub mod grapheme {
         GC_Any,
     }
 
-    impl Copy for GraphemeCat {}
-
     fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
         use core::cmp::Ordering::{Equal, Less, Greater};
         match r.binary_search_by(|&(lo, hi, _)| {
diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs
index adcb5253709..b4bafe31ff2 100644
--- a/src/libunicode/u_str.rs
+++ b/src/libunicode/u_str.rs
@@ -410,7 +410,7 @@ pub struct Utf16Items<'a> {
     iter: slice::Iter<'a, u16>
 }
 /// The possibilities for values decoded from a `u16` stream.
-#[derive(PartialEq, Eq, Clone, Show)]
+#[derive(Copy, PartialEq, Eq, Clone, Show)]
 pub enum Utf16Item {
     /// A valid codepoint.
     ScalarValue(char),
@@ -418,8 +418,6 @@ pub enum Utf16Item {
     LoneSurrogate(u16)
 }
 
-impl Copy for Utf16Item {}
-
 impl Utf16Item {
     /// Convert `self` to a `char`, taking `LoneSurrogate`s to the
     /// replacement character (U+FFFD).
diff --git a/src/test/auxiliary/issue-14422.rs b/src/test/auxiliary/issue-14422.rs
index 9ecb1195de0..3e23698397b 100644
--- a/src/test/auxiliary/issue-14422.rs
+++ b/src/test/auxiliary/issue-14422.rs
@@ -23,10 +23,9 @@ mod src {
     pub mod hidden_core {
         use super::aliases::B;
 
+        #[derive(Copy)]
         pub struct A;
 
-        impl Copy for A {}
-
         pub fn make() -> B { A }
 
         impl A {
diff --git a/src/test/auxiliary/issue13213aux.rs b/src/test/auxiliary/issue13213aux.rs
index cf8d0c167a1..227fab73048 100644
--- a/src/test/auxiliary/issue13213aux.rs
+++ b/src/test/auxiliary/issue13213aux.rs
@@ -13,19 +13,18 @@
 
 pub use private::P;
 
+#[derive(Copy)]
 pub struct S {
     p: P,
 }
 
 mod private {
+    #[derive(Copy)]
     pub struct P {
         p: i32,
     }
     pub const THREE: P = P { p: 3 };
-    impl Copy for P {}
 }
 
 pub static A: S = S { p: private::THREE };
 
-impl Copy for S {}
-
diff --git a/src/test/auxiliary/method_self_arg1.rs b/src/test/auxiliary/method_self_arg1.rs
index 5865a8f467b..643442363a4 100644
--- a/src/test/auxiliary/method_self_arg1.rs
+++ b/src/test/auxiliary/method_self_arg1.rs
@@ -17,10 +17,9 @@ static mut COUNT: u64 = 1;
 
 pub fn get_count() -> u64 { unsafe { COUNT } }
 
+#[derive(Copy)]
 pub struct Foo;
 
-impl Copy for Foo {}
-
 impl Foo {
     pub fn foo(self, x: &Foo) {
         unsafe { COUNT *= 2; }
diff --git a/src/test/auxiliary/method_self_arg2.rs b/src/test/auxiliary/method_self_arg2.rs
index a28a877a374..fd99da87e6b 100644
--- a/src/test/auxiliary/method_self_arg2.rs
+++ b/src/test/auxiliary/method_self_arg2.rs
@@ -17,10 +17,9 @@ static mut COUNT: u64 = 1;
 
 pub fn get_count() -> u64 { unsafe { COUNT } }
 
+#[derive(Copy)]
 pub struct Foo;
 
-impl Copy for Foo {}
-
 impl Foo {
     pub fn run_trait(self) {
         unsafe { COUNT *= 17; }
diff --git a/src/test/auxiliary/xcrate_unit_struct.rs b/src/test/auxiliary/xcrate_unit_struct.rs
index 5a918db1cfa..7ae36554079 100644
--- a/src/test/auxiliary/xcrate_unit_struct.rs
+++ b/src/test/auxiliary/xcrate_unit_struct.rs
@@ -12,33 +12,28 @@
 
 // used by the rpass test
 
+#[derive(Copy)]
 pub struct Struct;
 
-impl Copy for Struct {}
-
+#[derive(Copy)]
 pub enum Unit {
     UnitVariant,
     Argument(Struct)
 }
 
-impl Copy for Unit {}
-
+#[derive(Copy)]
 pub struct TupleStruct(pub uint, pub &'static str);
 
-impl Copy for TupleStruct {}
-
 // used by the cfail test
 
+#[derive(Copy)]
 pub struct StructWithFields {
     foo: int,
 }
 
-impl Copy for StructWithFields {}
-
+#[derive(Copy)]
 pub enum EnumWithVariants {
     EnumVariant,
     EnumVariantArg(int)
 }
 
-impl Copy for EnumWithVariants {}
-
diff --git a/src/test/bench/noise.rs b/src/test/bench/noise.rs
index 3c7efb0336a..75edd64fb2e 100644
--- a/src/test/bench/noise.rs
+++ b/src/test/bench/noise.rs
@@ -16,13 +16,12 @@ use std::f32::consts::PI;
 use std::num::Float;
 use std::rand::{Rng, StdRng};
 
+#[derive(Copy)]
 struct Vec2 {
     x: f32,
     y: f32,
 }
 
-impl Copy for Vec2 {}
-
 fn lerp(a: f32, b: f32, v: f32) -> f32 { a * (1.0 - v) + b * v }
 
 fn smooth(v: f32) -> f32 { v * v * (3.0 - 2.0 * v) }
diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs
index 33995a9be74..12dc224a82f 100644
--- a/src/test/bench/shootout-chameneos-redux.rs
+++ b/src/test/bench/shootout-chameneos-redux.rs
@@ -54,14 +54,13 @@ fn print_complements() {
     }
 }
 
+#[derive(Copy)]
 enum Color {
     Red,
     Yellow,
     Blue,
 }
 
-impl Copy for Color {}
-
 impl fmt::Show for Color {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let str = match *self {
@@ -73,13 +72,12 @@ impl fmt::Show for Color {
     }
 }
 
+#[derive(Copy)]
 struct CreatureInfo {
     name: uint,
     color: Color
 }
 
-impl Copy for CreatureInfo {}
-
 fn show_color_list(set: Vec<Color>) -> String {
     let mut out = String::new();
     for col in set.iter() {
diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs
index daabae88bdf..42b41d955fb 100644
--- a/src/test/bench/shootout-fannkuch-redux.rs
+++ b/src/test/bench/shootout-fannkuch-redux.rs
@@ -61,12 +61,12 @@ fn next_permutation(perm: &mut [i32], count: &mut [i32]) {
     }
 }
 
+#[derive(Copy)]
 struct P {
     p: [i32; 16],
 }
 
-impl Copy for P {}
-
+#[derive(Copy)]
 struct Perm {
     cnt: [i32; 16],
     fact: [u32; 16],
@@ -75,8 +75,6 @@ struct Perm {
     perm: P,
 }
 
-impl Copy for Perm {}
-
 impl Perm {
     fn new(n: u32) -> Perm {
         let mut fact = [1; 16];
diff --git a/src/test/bench/shootout-fasta-redux.rs b/src/test/bench/shootout-fasta-redux.rs
index 32242bee801..37e64aca324 100644
--- a/src/test/bench/shootout-fasta-redux.rs
+++ b/src/test/bench/shootout-fasta-redux.rs
@@ -103,13 +103,12 @@ fn sum_and_scale(a: &'static [AminoAcid]) -> Vec<AminoAcid> {
     result
 }
 
+#[derive(Copy)]
 struct AminoAcid {
     c: u8,
     p: f32,
 }
 
-impl Copy for AminoAcid {}
-
 struct RepeatFasta<'a, W:'a> {
     alu: &'static str,
     out: &'a mut W
diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs
index 657ae537f21..1bfd6a6301a 100644
--- a/src/test/bench/shootout-k-nucleotide.rs
+++ b/src/test/bench/shootout-k-nucleotide.rs
@@ -60,11 +60,9 @@ static OCCURRENCES: [&'static str;5] = [
 
 // Code implementation
 
-#[derive(PartialEq, PartialOrd, Ord, Eq)]
+#[derive(Copy, PartialEq, PartialOrd, Ord, Eq)]
 struct Code(u64);
 
-impl Copy for Code {}
-
 impl Code {
     fn hash(&self) -> u64 {
         let Code(ret) = *self;
diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs
index c65f98e545b..1b3d66ca7d2 100644
--- a/src/test/bench/shootout-nbody.rs
+++ b/src/test/bench/shootout-nbody.rs
@@ -94,14 +94,13 @@ static BODIES: [Planet;N_BODIES] = [
     },
 ];
 
+#[derive(Copy)]
 struct Planet {
     x: f64, y: f64, z: f64,
     vx: f64, vy: f64, vz: f64,
     mass: f64,
 }
 
-impl Copy for Planet {}
-
 fn advance(bodies: &mut [Planet;N_BODIES], dt: f64, steps: int) {
     for _ in range(0, steps) {
         let mut b_slice = bodies.as_mut_slice();
diff --git a/src/test/bench/task-perf-one-million.rs b/src/test/bench/task-perf-one-million.rs
deleted file mode 100644
index e3b51cb6b5b..00000000000
--- a/src/test/bench/task-perf-one-million.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2012-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 for concurrent tasks
-
-// ignore-test OOM on linux-32 without opts
-
-use std::os;
-use std::task;
-use std::uint;
-use std::slice;
-
-fn calc(children: uint, parent_wait_chan: &Sender<Sender<Sender<int>>>) {
-
-    let wait_ports: Vec<Reciever<Sender<Sender<int>>>> = vec::from_fn(children, |_| {
-        let (wait_port, wait_chan) = stream::<Sender<Sender<int>>>();
-        task::spawn(move|| {
-            calc(children / 2, &wait_chan);
-        });
-        wait_port
-    });
-
-    let child_start_chans: Vec<Sender<Sender<int>>> =
-        wait_ports.into_iter().map(|port| port.recv()).collect();
-
-    let (start_port, start_chan) = stream::<Sender<int>>();
-    parent_wait_chan.send(start_chan);
-    let parent_result_chan: Sender<int> = start_port.recv();
-
-    let child_sum_ports: Vec<Reciever<int>> =
-        child_start_chans.into_iter().map(|child_start_chan| {
-            let (child_sum_port, child_sum_chan) = stream::<int>();
-            child_start_chan.send(child_sum_chan);
-            child_sum_port
-    }).collect();
-
-    let sum = child_sum_ports.into_iter().fold(0, |sum, sum_port| sum + sum_port.recv() );
-
-    parent_result_chan.send(sum + 1);
-}
-
-fn main() {
-    let args = os::args();
-    let args = if os::getenv("RUST_BENCH").is_some() {
-        vec!("".to_string(), "30".to_string())
-    } else if args.len() <= 1u {
-        vec!("".to_string(), "10".to_string())
-    } else {
-        args
-    };
-
-    let children = from_str::<uint>(args[1]).unwrap();
-    let (wait_port, wait_chan) = stream();
-    task::spawn(move|| {
-        calc(children, &wait_chan);
-    });
-
-    let start_chan = wait_port.recv();
-    let (sum_port, sum_chan) = stream::<int>();
-    start_chan.send(sum_chan);
-    let sum = sum_port.recv();
-    println!("How many tasks? {} tasks.", sum);
-}
diff --git a/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs b/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs
index 397c55a502a..99618c6bf56 100644
--- a/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs
+++ b/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs
@@ -9,20 +9,18 @@
 // except according to those terms.
 
 
+#[derive(Copy)]
 struct Foo {
   bar1: Bar,
   bar2: Bar
 }
 
-impl Copy for Foo {}
-
+#[derive(Copy)]
 struct Bar {
   int1: isize,
   int2: isize,
 }
 
-impl Copy for Bar {}
-
 fn make_foo() -> Box<Foo> { panic!() }
 
 fn borrow_same_field_twice_mut_mut() {
diff --git a/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs b/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs
index ae4c09c59d7..849c98e122e 100644
--- a/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs
+++ b/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs
@@ -8,20 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[derive(Copy)]
 struct Foo {
   bar1: Bar,
   bar2: Bar
 }
 
-impl Copy for Foo {}
-
+#[derive(Copy)]
 struct Bar {
   int1: isize,
   int2: isize,
 }
 
-impl Copy for Bar {}
-
 fn make_foo() -> Foo { panic!() }
 
 fn borrow_same_field_twice_mut_mut() {
diff --git a/src/test/compile-fail/borrowck-use-mut-borrow.rs b/src/test/compile-fail/borrowck-use-mut-borrow.rs
index 42e12622b69..52f89da10b9 100644
--- a/src/test/compile-fail/borrowck-use-mut-borrow.rs
+++ b/src/test/compile-fail/borrowck-use-mut-borrow.rs
@@ -10,10 +10,9 @@
 
 #![feature(box_syntax)]
 
+#[derive(Copy)]
 struct A { a: isize, b: isize }
 
-impl Copy for A {}
-
 struct B { a: isize, b: Box<isize> }
 
 fn var_copy_after_var_borrow() {
diff --git a/src/test/compile-fail/dst-index.rs b/src/test/compile-fail/dst-index.rs
index 876c98298dc..91f34320482 100644
--- a/src/test/compile-fail/dst-index.rs
+++ b/src/test/compile-fail/dst-index.rs
@@ -14,10 +14,9 @@
 use std::ops::Index;
 use std::fmt::Debug;
 
+#[derive(Copy)]
 struct S;
 
-impl Copy for S {}
-
 impl Index<usize> for S {
     type Output = str;
 
@@ -26,10 +25,9 @@ impl Index<usize> for S {
     }
 }
 
+#[derive(Copy)]
 struct T;
 
-impl Copy for T {}
-
 impl Index<usize> for T {
     type Output = Debug + 'static;
 
diff --git a/src/test/compile-fail/kindck-copy.rs b/src/test/compile-fail/kindck-copy.rs
index 4398be4b212..56f83d93008 100644
--- a/src/test/compile-fail/kindck-copy.rs
+++ b/src/test/compile-fail/kindck-copy.rs
@@ -17,13 +17,12 @@ fn assert_copy<T:Copy>() { }
 
 trait Dummy { }
 
+#[derive(Copy)]
 struct MyStruct {
     x: isize,
     y: isize,
 }
 
-impl Copy for MyStruct {}
-
 struct MyNoncopyStruct {
     x: Box<char>,
 }
diff --git a/src/test/debuginfo/generic-method-on-generic-struct.rs b/src/test/debuginfo/generic-method-on-generic-struct.rs
index 66cd73622ff..d94baa637c2 100644
--- a/src/test/debuginfo/generic-method-on-generic-struct.rs
+++ b/src/test/debuginfo/generic-method-on-generic-struct.rs
@@ -115,6 +115,7 @@
 #![feature(box_syntax)]
 #![omit_gdb_pretty_printer_section]
 
+#[derive(Copy)]
 struct Struct<T> {
     x: T
 }
@@ -150,5 +151,3 @@ fn main() {
 
 fn zzz() {()}
 
-impl<T:Copy> Copy for Struct<T> {}
-
diff --git a/src/test/debuginfo/method-on-enum.rs b/src/test/debuginfo/method-on-enum.rs
index 732e1d5c500..f8912636971 100644
--- a/src/test/debuginfo/method-on-enum.rs
+++ b/src/test/debuginfo/method-on-enum.rs
@@ -116,6 +116,7 @@
 #![feature(box_syntax)]
 #![omit_gdb_pretty_printer_section]
 
+#[derive(Copy)]
 enum Enum {
     Variant1 { x: u16, y: u16 },
     Variant2 (u32)
@@ -152,5 +153,3 @@ fn main() {
 
 fn zzz() {()}
 
-impl Copy for Enum {}
-
diff --git a/src/test/debuginfo/method-on-generic-struct.rs b/src/test/debuginfo/method-on-generic-struct.rs
index c1785951e23..fa93eaba279 100644
--- a/src/test/debuginfo/method-on-generic-struct.rs
+++ b/src/test/debuginfo/method-on-generic-struct.rs
@@ -116,6 +116,7 @@
 #![feature(box_syntax)]
 #![omit_gdb_pretty_printer_section]
 
+#[derive(Copy)]
 struct Struct<T> {
     x: T
 }
@@ -151,5 +152,3 @@ fn main() {
 
 fn zzz() {()}
 
-impl<T:Copy> Copy for Struct<T> {}
-
diff --git a/src/test/debuginfo/method-on-struct.rs b/src/test/debuginfo/method-on-struct.rs
index d88a32b8475..56f79da709e 100644
--- a/src/test/debuginfo/method-on-struct.rs
+++ b/src/test/debuginfo/method-on-struct.rs
@@ -116,6 +116,7 @@
 #![feature(box_syntax)]
 #![omit_gdb_pretty_printer_section]
 
+#[derive(Copy)]
 struct Struct {
     x: int
 }
@@ -151,5 +152,3 @@ fn main() {
 
 fn zzz() {()}
 
-impl Copy for Struct {}
-
diff --git a/src/test/debuginfo/method-on-trait.rs b/src/test/debuginfo/method-on-trait.rs
index 5622d17225b..4fff301eb5f 100644
--- a/src/test/debuginfo/method-on-trait.rs
+++ b/src/test/debuginfo/method-on-trait.rs
@@ -116,6 +116,7 @@
 #![feature(box_syntax)]
 #![omit_gdb_pretty_printer_section]
 
+#[derive(Copy)]
 struct Struct {
     x: int
 }
@@ -157,5 +158,3 @@ fn main() {
 
 fn zzz() {()}
 
-impl Copy for Struct {}
-
diff --git a/src/test/debuginfo/method-on-tuple-struct.rs b/src/test/debuginfo/method-on-tuple-struct.rs
index 02f7808221a..7c4ce211f2f 100644
--- a/src/test/debuginfo/method-on-tuple-struct.rs
+++ b/src/test/debuginfo/method-on-tuple-struct.rs
@@ -116,6 +116,7 @@
 #![feature(box_syntax)]
 #![omit_gdb_pretty_printer_section]
 
+#[derive(Copy)]
 struct TupleStruct(int, f64);
 
 impl TupleStruct {
@@ -149,5 +150,3 @@ fn main() {
 
 fn zzz() {()}
 
-impl Copy for TupleStruct {}
-
diff --git a/src/test/debuginfo/self-in-default-method.rs b/src/test/debuginfo/self-in-default-method.rs
index a1074e490f7..e494973b975 100644
--- a/src/test/debuginfo/self-in-default-method.rs
+++ b/src/test/debuginfo/self-in-default-method.rs
@@ -115,6 +115,7 @@
 #![feature(box_syntax)]
 #![omit_gdb_pretty_printer_section]
 
+#[derive(Copy)]
 struct Struct {
     x: int
 }
@@ -151,5 +152,3 @@ fn main() {
 
 fn zzz() {()}
 
-impl Copy for Struct {}
-
diff --git a/src/test/debuginfo/self-in-generic-default-method.rs b/src/test/debuginfo/self-in-generic-default-method.rs
index f0da6e26870..0fe74015611 100644
--- a/src/test/debuginfo/self-in-generic-default-method.rs
+++ b/src/test/debuginfo/self-in-generic-default-method.rs
@@ -115,6 +115,7 @@
 #![feature(box_syntax)]
 #![omit_gdb_pretty_printer_section]
 
+#[derive(Copy)]
 struct Struct {
     x: int
 }
@@ -152,5 +153,3 @@ fn main() {
 
 fn zzz() {()}
 
-impl Copy for Struct {}
-
diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs
index db01bc94e32..1e286c236a5 100644
--- a/src/test/pretty/block-disambig.rs
+++ b/src/test/pretty/block-disambig.rs
@@ -19,10 +19,9 @@ fn test1() { let val = &0i; { } *val; }
 
 fn test2() -> int { let val = &0i; { } *val }
 
+#[derive(Copy)]
 struct S { eax: int }
 
-impl Copy for S {}
-
 fn test3() {
     let regs = &Cell::new(S {eax: 0});
     match true { true => { } _ => { } }
diff --git a/src/test/run-make/extern-fn-with-packed-struct/test.rs b/src/test/run-make/extern-fn-with-packed-struct/test.rs
index b38db4c9eb2..3e3f4c5948e 100644
--- a/src/test/run-make/extern-fn-with-packed-struct/test.rs
+++ b/src/test/run-make/extern-fn-with-packed-struct/test.rs
@@ -9,15 +9,13 @@
 // except according to those terms.
 
 #[repr(packed)]
-#[derive(PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
 struct Foo {
     a: i8,
     b: i16,
     c: i8
 }
 
-impl Copy for Foo {}
-
 #[link(name = "test", kind = "static")]
 extern {
     fn foo(f: Foo) -> Foo;
diff --git a/src/test/run-pass/borrowck-univariant-enum.rs b/src/test/run-pass/borrowck-univariant-enum.rs
index df4106c9844..d95594119b6 100644
--- a/src/test/run-pass/borrowck-univariant-enum.rs
+++ b/src/test/run-pass/borrowck-univariant-enum.rs
@@ -11,12 +11,11 @@
 
 use std::cell::Cell;
 
+#[derive(Copy)]
 enum newtype {
     newvar(int)
 }
 
-impl Copy for newtype {}
-
 pub fn main() {
 
     // Test that borrowck treats enums with a single variant
diff --git a/src/test/run-pass/builtin-superkinds-in-metadata.rs b/src/test/run-pass/builtin-superkinds-in-metadata.rs
index 382caa83c61..c115415bb9b 100644
--- a/src/test/run-pass/builtin-superkinds-in-metadata.rs
+++ b/src/test/run-pass/builtin-superkinds-in-metadata.rs
@@ -17,10 +17,9 @@ extern crate trait_superkinds_in_metadata;
 use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare};
 use trait_superkinds_in_metadata::{RequiresCopy};
 
+#[derive(Copy)]
 struct X<T>(T);
 
-impl<T:Copy> Copy for X<T> {}
-
 impl<T:Sync> RequiresShare for X<T> { }
 
 impl<T:Sync+Send> RequiresRequiresShareAndSend for X<T> { }
diff --git a/src/test/run-pass/cell-does-not-clone.rs b/src/test/run-pass/cell-does-not-clone.rs
index 6455f1e4bb2..ea1d0b625fc 100644
--- a/src/test/run-pass/cell-does-not-clone.rs
+++ b/src/test/run-pass/cell-does-not-clone.rs
@@ -10,6 +10,7 @@
 
 use std::cell::Cell;
 
+#[derive(Copy)]
 struct Foo {
     x: int
 }
@@ -24,8 +25,6 @@ impl Clone for Foo {
     }
 }
 
-impl Copy for Foo {}
-
 pub fn main() {
     let x = Cell::new(Foo { x: 22 });
     let _y = x.get();
diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs
index 629cf7c4ef7..993f27d061d 100644
--- a/src/test/run-pass/class-impl-very-parameterized-trait.rs
+++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs
@@ -11,11 +11,9 @@
 
 use std::cmp;
 
-#[derive(Show)]
+#[derive(Copy, Show)]
 enum cat_type { tuxedo, tabby, tortoiseshell }
 
-impl Copy for cat_type {}
-
 impl cmp::PartialEq for cat_type {
     fn eq(&self, other: &cat_type) -> bool {
         ((*self) as uint) == ((*other) as uint)
diff --git a/src/test/run-pass/coherence-impl-in-fn.rs b/src/test/run-pass/coherence-impl-in-fn.rs
index df0012e07ec..6edd7390f0f 100644
--- a/src/test/run-pass/coherence-impl-in-fn.rs
+++ b/src/test/run-pass/coherence-impl-in-fn.rs
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 pub fn main() {
+    #[derive(Copy)]
     enum x { foo }
-    impl Copy for x {}
     impl ::std::cmp::PartialEq for x {
         fn eq(&self, other: &x) -> bool {
             (*self) as int == (*other) as int
diff --git a/src/test/run-pass/coherence-where-clause.rs b/src/test/run-pass/coherence-where-clause.rs
index 78b603690fd..d9c292a3e0b 100644
--- a/src/test/run-pass/coherence-where-clause.rs
+++ b/src/test/run-pass/coherence-where-clause.rs
@@ -23,13 +23,11 @@ impl<T> MyTrait for T
     }
 }
 
-#[derive(Clone,Debug,PartialEq)]
+#[derive(Clone, Copy, Debug, PartialEq)]
 struct MyType {
     dummy: uint
 }
 
-impl Copy for MyType {}
-
 impl MyTrait for MyType {
     fn get(&self) -> MyType { (*self).clone() }
 }
diff --git a/src/test/run-pass/const-nullary-univariant-enum.rs b/src/test/run-pass/const-nullary-univariant-enum.rs
index 9a1a5de9360..86b194f2eb3 100644
--- a/src/test/run-pass/const-nullary-univariant-enum.rs
+++ b/src/test/run-pass/const-nullary-univariant-enum.rs
@@ -8,12 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[derive(Copy)]
 enum Foo {
     Bar = 0xDEADBEE
 }
 
-impl Copy for Foo {}
-
 static X: Foo = Foo::Bar;
 
 pub fn main() {
diff --git a/src/test/run-pass/dst-struct-sole.rs b/src/test/run-pass/dst-struct-sole.rs
index c7f37da157f..74f4b9e9233 100644
--- a/src/test/run-pass/dst-struct-sole.rs
+++ b/src/test/run-pass/dst-struct-sole.rs
@@ -30,11 +30,9 @@ fn foo2<T:ToBar>(x: &Fat<[T]>) {
     assert!(x.ptr[1].to_bar() == bar);
 }
 
-#[derive(PartialEq,Eq)]
+#[derive(Copy, PartialEq, Eq)]
 struct Bar;
 
-impl Copy for Bar {}
-
 trait ToBar {
     fn to_bar(&self) -> Bar;
 }
diff --git a/src/test/run-pass/dst-struct.rs b/src/test/run-pass/dst-struct.rs
index b2092e745a1..fa2af29431c 100644
--- a/src/test/run-pass/dst-struct.rs
+++ b/src/test/run-pass/dst-struct.rs
@@ -49,11 +49,9 @@ fn foo3(x: &Fat<Fat<[int]>>) {
 }
 
 
-#[derive(PartialEq,Eq)]
+#[derive(Copy, PartialEq, Eq)]
 struct Bar;
 
-impl Copy for Bar {}
-
 trait ToBar {
     fn to_bar(&self) -> Bar;
 }
diff --git a/src/test/run-pass/dst-trait.rs b/src/test/run-pass/dst-trait.rs
index 627d197879d..fd1c7247e37 100644
--- a/src/test/run-pass/dst-trait.rs
+++ b/src/test/run-pass/dst-trait.rs
@@ -17,18 +17,14 @@ struct Fat<T: ?Sized> {
     ptr: T
 }
 
-#[derive(PartialEq,Eq)]
+#[derive(Copy, PartialEq, Eq)]
 struct Bar;
 
-impl Copy for Bar {}
-
-#[derive(PartialEq,Eq)]
+#[derive(Copy, PartialEq, Eq)]
 struct Bar1 {
     f: int
 }
 
-impl Copy for Bar1 {}
-
 trait ToBar {
     fn to_bar(&self) -> Bar;
     fn to_val(&self) -> int;
diff --git a/src/test/run-pass/empty-tag.rs b/src/test/run-pass/empty-tag.rs
index d9201746440..35c394cf535 100644
--- a/src/test/run-pass/empty-tag.rs
+++ b/src/test/run-pass/empty-tag.rs
@@ -8,11 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[derive(Show)]
+#[derive(Copy, Show)]
 enum chan { chan_t, }
 
-impl Copy for chan {}
-
 impl PartialEq for chan {
     fn eq(&self, other: &chan) -> bool {
         ((*self) as uint) == ((*other) as uint)
diff --git a/src/test/run-pass/enum-discrim-width-stuff.rs b/src/test/run-pass/enum-discrim-width-stuff.rs
index 73559af79de..c323bff254d 100644
--- a/src/test/run-pass/enum-discrim-width-stuff.rs
+++ b/src/test/run-pass/enum-discrim-width-stuff.rs
@@ -12,13 +12,12 @@ macro_rules! check {
     ($m:ident, $t:ty, $v:expr) => {{
         mod $m {
             use std::mem::size_of;
-            #[derive(Show)]
+            #[derive(Copy, Show)]
             enum E {
                 V = $v,
                 A = 0
             }
             static C: E = E::V;
-            impl Copy for E {}
             pub fn check() {
                 assert_eq!(size_of::<E>(), size_of::<$t>());
                 assert_eq!(E::V as $t, $v as $t);
diff --git a/src/test/run-pass/explicit-self-generic.rs b/src/test/run-pass/explicit-self-generic.rs
index a2aaaa235e4..066a5f9580a 100644
--- a/src/test/run-pass/explicit-self-generic.rs
+++ b/src/test/run-pass/explicit-self-generic.rs
@@ -11,10 +11,9 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
+#[derive(Copy)]
 struct LM { resize_at: uint, size: uint }
 
-impl Copy for LM {}
-
 enum HashMap<K,V> {
     HashMap_(LM)
 }
diff --git a/src/test/run-pass/export-unexported-dep.rs b/src/test/run-pass/export-unexported-dep.rs
index 48e9d9dea22..807d28feb6e 100644
--- a/src/test/run-pass/export-unexported-dep.rs
+++ b/src/test/run-pass/export-unexported-dep.rs
@@ -13,10 +13,9 @@
 
 mod foo {
     // not exported
+    #[derive(Copy)]
     enum t { t1, t2, }
 
-    impl Copy for t {}
-
     impl PartialEq for t {
         fn eq(&self, other: &t) -> bool {
             ((*self) as uint) == ((*other) as uint)
diff --git a/src/test/run-pass/expr-copy.rs b/src/test/run-pass/expr-copy.rs
index 6e9ba4f8f41..6c6c5085749 100644
--- a/src/test/run-pass/expr-copy.rs
+++ b/src/test/run-pass/expr-copy.rs
@@ -13,10 +13,9 @@ fn f(arg: &mut A) {
     arg.a = 100;
 }
 
+#[derive(Copy)]
 struct A { a: int }
 
-impl Copy for A {}
-
 pub fn main() {
     let mut x = A {a: 10};
     f(&mut x);
diff --git a/src/test/run-pass/expr-if-struct.rs b/src/test/run-pass/expr-if-struct.rs
index 62994068a9e..f1457829d03 100644
--- a/src/test/run-pass/expr-if-struct.rs
+++ b/src/test/run-pass/expr-if-struct.rs
@@ -14,20 +14,17 @@
 
 // Tests for if as expressions returning nominal types
 
+#[derive(Copy)]
 struct I { i: int }
 
-impl Copy for I {}
-
 fn test_rec() {
     let rs = if true { I {i: 100} } else { I {i: 101} };
     assert_eq!(rs.i, 100);
 }
 
-#[derive(Show)]
+#[derive(Copy, Show)]
 enum mood { happy, sad, }
 
-impl Copy for mood {}
-
 impl PartialEq for mood {
     fn eq(&self, other: &mood) -> bool {
         ((*self) as uint) == ((*other) as uint)
diff --git a/src/test/run-pass/expr-match-struct.rs b/src/test/run-pass/expr-match-struct.rs
index 8512cf63cdd..1b5a33dff3d 100644
--- a/src/test/run-pass/expr-match-struct.rs
+++ b/src/test/run-pass/expr-match-struct.rs
@@ -13,20 +13,17 @@
 
 
 // Tests for match as expressions resulting in struct types
+#[derive(Copy)]
 struct R { i: int }
 
-impl Copy for R {}
-
 fn test_rec() {
     let rs = match true { true => R {i: 100}, _ => panic!() };
     assert_eq!(rs.i, 100);
 }
 
-#[derive(Show)]
+#[derive(Copy, Show)]
 enum mood { happy, sad, }
 
-impl Copy for mood {}
-
 impl PartialEq for mood {
     fn eq(&self, other: &mood) -> bool {
         ((*self) as uint) == ((*other) as uint)
diff --git a/src/test/run-pass/exterior.rs b/src/test/run-pass/exterior.rs
index 2ca5f430a2a..bba8cbdb83d 100644
--- a/src/test/run-pass/exterior.rs
+++ b/src/test/run-pass/exterior.rs
@@ -11,10 +11,9 @@
 
 use std::cell::Cell;
 
+#[derive(Copy)]
 struct Point {x: int, y: int, z: int}
 
-impl Copy for Point {}
-
 fn f(p: &Cell<Point>) {
     assert!((p.get().z == 12));
     p.set(Point {x: 10, y: 11, z: 13});
diff --git a/src/test/run-pass/extern-pass-TwoU16s.rs b/src/test/run-pass/extern-pass-TwoU16s.rs
index a38fe6d6d50..f7aef2e59c9 100644
--- a/src/test/run-pass/extern-pass-TwoU16s.rs
+++ b/src/test/run-pass/extern-pass-TwoU16s.rs
@@ -11,13 +11,11 @@
 // Test a foreign function that accepts and returns a struct
 // by value.
 
-#[derive(PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
 pub struct TwoU16s {
     one: u16, two: u16
 }
 
-impl Copy for TwoU16s {}
-
 #[link(name = "rust_test_helpers")]
 extern {
     pub fn rust_dbg_extern_identity_TwoU16s(v: TwoU16s) -> TwoU16s;
diff --git a/src/test/run-pass/extern-pass-TwoU32s.rs b/src/test/run-pass/extern-pass-TwoU32s.rs
index 30b035d56b6..8e13017fdbf 100644
--- a/src/test/run-pass/extern-pass-TwoU32s.rs
+++ b/src/test/run-pass/extern-pass-TwoU32s.rs
@@ -11,13 +11,11 @@
 // Test a foreign function that accepts and returns a struct
 // by value.
 
-#[derive(PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
 pub struct TwoU32s {
     one: u32, two: u32
 }
 
-impl Copy for TwoU32s {}
-
 #[link(name = "rust_test_helpers")]
 extern {
     pub fn rust_dbg_extern_identity_TwoU32s(v: TwoU32s) -> TwoU32s;
diff --git a/src/test/run-pass/extern-pass-TwoU64s.rs b/src/test/run-pass/extern-pass-TwoU64s.rs
index 8ca05f09a9c..b95eb7974b6 100644
--- a/src/test/run-pass/extern-pass-TwoU64s.rs
+++ b/src/test/run-pass/extern-pass-TwoU64s.rs
@@ -11,13 +11,11 @@
 // Test a foreign function that accepts and returns a struct
 // by value.
 
-#[derive(PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
 pub struct TwoU64s {
     one: u64, two: u64
 }
 
-impl Copy for TwoU64s {}
-
 #[link(name = "rust_test_helpers")]
 extern {
     pub fn rust_dbg_extern_identity_TwoU64s(v: TwoU64s) -> TwoU64s;
diff --git a/src/test/run-pass/extern-pass-TwoU8s.rs b/src/test/run-pass/extern-pass-TwoU8s.rs
index 42a1ce78870..d5c727be4bc 100644
--- a/src/test/run-pass/extern-pass-TwoU8s.rs
+++ b/src/test/run-pass/extern-pass-TwoU8s.rs
@@ -11,13 +11,11 @@
 // Test a foreign function that accepts and returns a struct
 // by value.
 
-#[derive(PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
 pub struct TwoU8s {
     one: u8, two: u8
 }
 
-impl Copy for TwoU8s {}
-
 #[link(name = "rust_test_helpers")]
 extern {
     pub fn rust_dbg_extern_identity_TwoU8s(v: TwoU8s) -> TwoU8s;
diff --git a/src/test/run-pass/foreign-fn-with-byval.rs b/src/test/run-pass/foreign-fn-with-byval.rs
index 5d6815fc3c7..09317abce92 100644
--- a/src/test/run-pass/foreign-fn-with-byval.rs
+++ b/src/test/run-pass/foreign-fn-with-byval.rs
@@ -8,14 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[derive(Copy)]
 pub struct S {
     x: u64,
     y: u64,
     z: u64,
 }
 
-impl Copy for S {}
-
 #[link(name = "rust_test_helpers")]
 extern {
     pub fn get_x(x: S) -> u64;
diff --git a/src/test/run-pass/generic-fn.rs b/src/test/run-pass/generic-fn.rs
index a341bfe22eb..8da8c680847 100644
--- a/src/test/run-pass/generic-fn.rs
+++ b/src/test/run-pass/generic-fn.rs
@@ -12,10 +12,9 @@
 
 fn id<T>(x: T) -> T { return x; }
 
+#[derive(Copy)]
 struct Triple {x: int, y: int, z: int}
 
-impl Copy for Triple {}
-
 pub fn main() {
     let mut x = 62;
     let mut y = 63;
diff --git a/src/test/run-pass/guards-not-exhaustive.rs b/src/test/run-pass/guards-not-exhaustive.rs
index b1bc40b662d..addd6a63836 100644
--- a/src/test/run-pass/guards-not-exhaustive.rs
+++ b/src/test/run-pass/guards-not-exhaustive.rs
@@ -8,10 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[derive(Copy)]
 enum Q { R(Option<uint>) }
 
-impl Copy for Q {}
-
 fn xyzzy(q: Q) -> uint {
     match q {
         Q::R(S) if S.is_some() => { 0 }
diff --git a/src/test/run-pass/guards.rs b/src/test/run-pass/guards.rs
index 0157423863c..e7031ae147e 100644
--- a/src/test/run-pass/guards.rs
+++ b/src/test/run-pass/guards.rs
@@ -8,10 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[derive(Copy)]
 struct Pair { x: int, y: int }
 
-impl Copy for Pair {}
-
 pub fn main() {
     let a: int =
         match 10i { x if x < 7 => { 1i } x if x < 11 => { 2i } 10 => { 3i } _ => { 4i } };
diff --git a/src/test/run-pass/hrtb-opt-in-copy.rs b/src/test/run-pass/hrtb-opt-in-copy.rs
index 8eaf8427bfd..9c9f95f61e9 100644
--- a/src/test/run-pass/hrtb-opt-in-copy.rs
+++ b/src/test/run-pass/hrtb-opt-in-copy.rs
@@ -29,10 +29,9 @@ enum TyS<'tcx> {
     Boop(marker::InvariantLifetime<'tcx>)
 }
 
+#[derive(Copy)]
 enum Bar<'tcx> {
     Baz(Foo<Ty<'tcx>>)
 }
 
-impl<'tcx> Copy for Bar<'tcx> { }
-
 fn main() { }
diff --git a/src/test/run-pass/issue-12860.rs b/src/test/run-pass/issue-12860.rs
index 8a95723c735..a05cc9c0f74 100644
--- a/src/test/run-pass/issue-12860.rs
+++ b/src/test/run-pass/issue-12860.rs
@@ -13,15 +13,13 @@ extern crate collections;
 
 use std::collections::HashSet;
 
-#[derive(PartialEq, Eq, Hash)]
+#[derive(Copy, PartialEq, Eq, Hash)]
 struct XYZ {
     x: int,
     y: int,
     z: int
 }
 
-impl Copy for XYZ {}
-
 fn main() {
     let mut connected = HashSet::new();
     let mut border = HashSet::new();
diff --git a/src/test/run-pass/issue-19100.rs b/src/test/run-pass/issue-19100.rs
index 0ebd3ae8d97..26eacd682ef 100644
--- a/src/test/run-pass/issue-19100.rs
+++ b/src/test/run-pass/issue-19100.rs
@@ -8,13 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[derive(Copy)]
 enum Foo {
     Bar,
     Baz
 }
 
-impl Copy for Foo {}
-
 impl Foo {
     fn foo(&self) {
         match self {
diff --git a/src/test/run-pass/issue-2288.rs b/src/test/run-pass/issue-2288.rs
index 7baead6929b..18bb6fe5529 100644
--- a/src/test/run-pass/issue-2288.rs
+++ b/src/test/run-pass/issue-2288.rs
@@ -15,12 +15,11 @@ trait clam<A> {
   fn chowder(&self, y: A);
 }
 
+#[derive(Copy)]
 struct foo<A> {
   x: A,
 }
 
-impl<A:Copy> Copy for foo<A> {}
-
 impl<A> clam<A> for foo<A> {
   fn chowder(&self, _y: A) {
   }
diff --git a/src/test/run-pass/issue-2633.rs b/src/test/run-pass/issue-2633.rs
index bc014f699c7..de99141c803 100644
--- a/src/test/run-pass/issue-2633.rs
+++ b/src/test/run-pass/issue-2633.rs
@@ -8,12 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[derive(Copy)]
 struct cat {
     meow: extern "Rust" fn(),
 }
 
-impl Copy for cat {}
-
 fn meow() {
     println!("meow")
 }
@@ -24,10 +23,9 @@ fn cat() -> cat {
     }
 }
 
+#[derive(Copy)]
 struct KittyInfo {kitty: cat}
 
-impl Copy for KittyInfo {}
-
 // Code compiles and runs successfully if we add a + before the first arg
 fn nyan(kitty: cat, _kitty_info: KittyInfo) {
     (kitty.meow)();
diff --git a/src/test/run-pass/issue-3121.rs b/src/test/run-pass/issue-3121.rs
index c789921f622..b6ed85e9e4a 100644
--- a/src/test/run-pass/issue-3121.rs
+++ b/src/test/run-pass/issue-3121.rs
@@ -11,14 +11,13 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
+#[derive(Copy)]
 enum side { mayo, catsup, vinegar }
+#[derive(Copy)]
 enum order { hamburger, fries(side), shake }
+#[derive(Copy)]
 enum meal { to_go(order), for_here(order) }
 
-impl Copy for side {}
-impl Copy for order {}
-impl Copy for meal {}
-
 fn foo(m: Box<meal>, cond: bool) {
     match *m {
       meal::to_go(_) => { }
diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs
index 3fe6e02dcef..004bcf6dcd0 100644
--- a/src/test/run-pass/issue-3563-3.rs
+++ b/src/test/run-pass/issue-3563-3.rs
@@ -27,29 +27,26 @@ use std::iter::repeat;
 use std::slice;
 
 // Represents a position on a canvas.
+#[derive(Copy)]
 struct Point {
     x: int,
     y: int,
 }
 
-impl Copy for Point {}
-
 // Represents an offset on a canvas. (This has the same structure as a Point.
 // but different semantics).
+#[derive(Copy)]
 struct Size {
     width: int,
     height: int,
 }
 
-impl Copy for Size {}
-
+#[derive(Copy)]
 struct Rect {
     top_left: Point,
     size: Size,
 }
 
-impl Copy for Rect {}
-
 // Contains the information needed to do shape rendering via ASCII art.
 struct AsciiArt {
     width: uint,
diff --git a/src/test/run-pass/issue-3743.rs b/src/test/run-pass/issue-3743.rs
index 382ea0c5758..03699ff8d60 100644
--- a/src/test/run-pass/issue-3743.rs
+++ b/src/test/run-pass/issue-3743.rs
@@ -14,13 +14,12 @@
 
 use std::ops::Mul;
 
+#[derive(Copy)]
 struct Vec2 {
     x: f64,
     y: f64
 }
 
-impl Copy for Vec2 {}
-
 // methods we want to export as methods as well as operators
 impl Vec2 {
 #[inline(always)]
diff --git a/src/test/run-pass/issue-3753.rs b/src/test/run-pass/issue-3753.rs
index 00a8a0893a2..58d7aa276f1 100644
--- a/src/test/run-pass/issue-3753.rs
+++ b/src/test/run-pass/issue-3753.rs
@@ -14,20 +14,18 @@
 
 use std::f64;
 
+#[derive(Copy)]
 pub struct Point {
     x: f64,
     y: f64
 }
 
-impl Copy for Point {}
-
+#[derive(Copy)]
 pub enum Shape {
     Circle(Point, f64),
     Rectangle(Point, Point)
 }
 
-impl Copy for Shape {}
-
 impl Shape {
     pub fn area(&self, sh: Shape) -> f64 {
         match sh {
diff --git a/src/test/run-pass/issue-5688.rs b/src/test/run-pass/issue-5688.rs
index cfe9c8f994c..a4f39884846 100644
--- a/src/test/run-pass/issue-5688.rs
+++ b/src/test/run-pass/issue-5688.rs
@@ -17,10 +17,9 @@ with the representation of [int; n] and [int] somehow, or at least
 failed to typecheck correctly.
 */
 
+#[derive(Copy)]
 struct X { vec: &'static [int] }
 
-impl Copy for X {}
-
 static V: &'static [X] = &[X { vec: &[1, 2, 3] }];
 
 pub fn main() {
diff --git a/src/test/run-pass/match-arm-statics.rs b/src/test/run-pass/match-arm-statics.rs
index db512adc011..1964bf4bd7d 100644
--- a/src/test/run-pass/match-arm-statics.rs
+++ b/src/test/run-pass/match-arm-statics.rs
@@ -36,10 +36,9 @@ const VARIANT2_NORTH: EnumWithStructVariants = EnumWithStructVariants::Variant2
     dir: Direction::North };
 
 pub mod glfw {
+    #[derive(Copy)]
     pub struct InputState(uint);
 
-    impl Copy for InputState {}
-
     pub const RELEASE  : InputState = InputState(0);
     pub const PRESS    : InputState = InputState(1);
     pub const REPEAT   : InputState = InputState(2);
diff --git a/src/test/run-pass/method-self-arg-trait.rs b/src/test/run-pass/method-self-arg-trait.rs
index 39018a87394..c79141d9795 100644
--- a/src/test/run-pass/method-self-arg-trait.rs
+++ b/src/test/run-pass/method-self-arg-trait.rs
@@ -15,10 +15,9 @@
 
 static mut COUNT: u64 = 1;
 
+#[derive(Copy)]
 struct Foo;
 
-impl Copy for Foo {}
-
 trait Bar : Sized {
     fn foo1(&self);
     fn foo2(self);
diff --git a/src/test/run-pass/method-self-arg.rs b/src/test/run-pass/method-self-arg.rs
index ae15bc60746..2225ccdc516 100644
--- a/src/test/run-pass/method-self-arg.rs
+++ b/src/test/run-pass/method-self-arg.rs
@@ -15,10 +15,9 @@
 
 static mut COUNT: uint = 1;
 
+#[derive(Copy)]
 struct Foo;
 
-impl Copy for Foo {}
-
 impl Foo {
     fn foo(self, x: &Foo) {
         unsafe { COUNT *= 2; }
diff --git a/src/test/run-pass/monomorphize-abi-alignment.rs b/src/test/run-pass/monomorphize-abi-alignment.rs
index 84bffed59a4..8ec16419a22 100644
--- a/src/test/run-pass/monomorphize-abi-alignment.rs
+++ b/src/test/run-pass/monomorphize-abi-alignment.rs
@@ -18,26 +18,21 @@
  * and apply the wrong instance of the method `unwrap`.
  */
 
+#[derive(Copy)]
 struct S<T> { i:u8, t:T }
 
-impl<T:Copy> Copy for S<T> {}
-
 impl<T> S<T> {
     fn unwrap(self) -> T {
         self.t
     }
 }
 
-#[derive(PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
 struct A((u32, u32));
 
-impl Copy for A {}
-
-#[derive(PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
 struct B(u64);
 
-impl Copy for B {}
-
 pub fn main() {
     static Ca: S<A> = S { i: 0, t: A((13, 104)) };
     static Cb: S<B> = S { i: 0, t: B(31337) };
diff --git a/src/test/run-pass/multidispatch1.rs b/src/test/run-pass/multidispatch1.rs
index 15df67e1488..b9435afdc7a 100644
--- a/src/test/run-pass/multidispatch1.rs
+++ b/src/test/run-pass/multidispatch1.rs
@@ -14,12 +14,11 @@ trait MyTrait<T> {
     fn get(&self) -> T;
 }
 
+#[derive(Copy)]
 struct MyType {
     dummy: uint
 }
 
-impl Copy for MyType {}
-
 impl MyTrait<uint> for MyType {
     fn get(&self) -> uint { self.dummy }
 }
diff --git a/src/test/run-pass/multidispatch2.rs b/src/test/run-pass/multidispatch2.rs
index 0c2652e6a7c..ecacc7f1df9 100644
--- a/src/test/run-pass/multidispatch2.rs
+++ b/src/test/run-pass/multidispatch2.rs
@@ -23,12 +23,11 @@ impl<T> MyTrait<T> for T
     }
 }
 
+#[derive(Copy)]
 struct MyType {
     dummy: uint
 }
 
-impl Copy for MyType {}
-
 impl MyTrait<uint> for MyType {
     fn get(&self) -> uint { self.dummy }
 }
diff --git a/src/test/run-pass/newtype.rs b/src/test/run-pass/newtype.rs
index 093fd6c81cc..869ae4a37d2 100644
--- a/src/test/run-pass/newtype.rs
+++ b/src/test/run-pass/newtype.rs
@@ -8,17 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[derive(Copy)]
 struct mytype(Mytype);
 
-impl Copy for mytype {}
-
+#[derive(Copy)]
 struct Mytype {
     compute: fn(mytype) -> int,
     val: int,
 }
 
-impl Copy for Mytype {}
-
 fn compute(i: mytype) -> int {
     let mytype(m) = i;
     return m.val + 20;
diff --git a/src/test/run-pass/out-pointer-aliasing.rs b/src/test/run-pass/out-pointer-aliasing.rs
index 5f399deb885..eee9838da21 100644
--- a/src/test/run-pass/out-pointer-aliasing.rs
+++ b/src/test/run-pass/out-pointer-aliasing.rs
@@ -8,13 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[derive(Copy)]
 pub struct Foo {
     f1: int,
     _f2: int,
 }
 
-impl Copy for Foo {}
-
 #[inline(never)]
 pub fn foo(f: &mut Foo) -> Foo {
     let ret = *f;
diff --git a/src/test/run-pass/overloaded-autoderef-order.rs b/src/test/run-pass/overloaded-autoderef-order.rs
index c34aed42c97..4c48b0ba710 100644
--- a/src/test/run-pass/overloaded-autoderef-order.rs
+++ b/src/test/run-pass/overloaded-autoderef-order.rs
@@ -11,13 +11,12 @@
 use std::rc::Rc;
 use std::ops::Deref;
 
+#[derive(Copy)]
 struct DerefWrapper<X, Y> {
     x: X,
     y: Y
 }
 
-impl<X:Copy,Y:Copy> Copy for DerefWrapper<X,Y> {}
-
 impl<X, Y> DerefWrapper<X, Y> {
     fn get_x(self) -> X {
         self.x
@@ -35,13 +34,12 @@ impl<X, Y> Deref for DerefWrapper<X, Y> {
 mod priv_test {
     use std::ops::Deref;
 
+    #[derive(Copy)]
     pub struct DerefWrapperHideX<X, Y> {
         x: X,
         pub y: Y
     }
 
-    impl<X:Copy,Y:Copy> Copy for DerefWrapperHideX<X,Y> {}
-
     impl<X, Y> DerefWrapperHideX<X, Y> {
         pub fn new(x: X, y: Y) -> DerefWrapperHideX<X, Y> {
             DerefWrapperHideX {
diff --git a/src/test/run-pass/packed-struct-vec.rs b/src/test/run-pass/packed-struct-vec.rs
index 8e5decf5e62..c2e7a56d270 100644
--- a/src/test/run-pass/packed-struct-vec.rs
+++ b/src/test/run-pass/packed-struct-vec.rs
@@ -13,14 +13,12 @@
 use std::mem;
 
 #[repr(packed)]
-#[derive(PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
 struct Foo {
     bar: u8,
     baz: u64
 }
 
-impl Copy for Foo {}
-
 pub fn main() {
     let foos = [Foo { bar: 1, baz: 2 }; 10];
 
diff --git a/src/test/run-pass/rec-tup.rs b/src/test/run-pass/rec-tup.rs
index 8adad012ec6..dab7d26cc82 100644
--- a/src/test/run-pass/rec-tup.rs
+++ b/src/test/run-pass/rec-tup.rs
@@ -8,10 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[derive(Copy)]
 struct Point {x: int, y: int}
 
-impl Copy for Point {}
-
 type rect = (Point, Point);
 
 fn fst(r: rect) -> Point { let (fst, _) = r; return fst; }
diff --git a/src/test/run-pass/rec.rs b/src/test/run-pass/rec.rs
index 02fcf1ad068..f59538c51a0 100644
--- a/src/test/run-pass/rec.rs
+++ b/src/test/run-pass/rec.rs
@@ -8,13 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-
-
+#[derive(Copy)]
 struct Rect {x: int, y: int, w: int, h: int}
 
-impl Copy for Rect {}
-
 fn f(r: Rect, x: int, y: int, w: int, h: int) {
     assert_eq!(r.x, x);
     assert_eq!(r.y, y);
diff --git a/src/test/run-pass/regions-dependent-addr-of.rs b/src/test/run-pass/regions-dependent-addr-of.rs
index e38a472fa4c..85402080f11 100644
--- a/src/test/run-pass/regions-dependent-addr-of.rs
+++ b/src/test/run-pass/regions-dependent-addr-of.rs
@@ -27,12 +27,11 @@ struct B {
     v6: Option<C>
 }
 
+#[derive(Copy)]
 struct C {
     f: int
 }
 
-impl Copy for C {}
-
 fn get_v1(a: &A) -> &int {
     // Region inferencer must deduce that &v < L2 < L1
     let foo = &a.value; // L1
diff --git a/src/test/run-pass/regions-early-bound-used-in-bound-method.rs b/src/test/run-pass/regions-early-bound-used-in-bound-method.rs
index 5b4169a4e84..410415e57a0 100644
--- a/src/test/run-pass/regions-early-bound-used-in-bound-method.rs
+++ b/src/test/run-pass/regions-early-bound-used-in-bound-method.rs
@@ -15,12 +15,11 @@ trait GetRef<'a> {
     fn get(&self) -> &'a int;
 }
 
+#[derive(Copy)]
 struct Box<'a> {
     t: &'a int
 }
 
-impl<'a> Copy for Box<'a> {}
-
 impl<'a> GetRef<'a> for Box<'a> {
     fn get(&self) -> &'a int {
         self.t
diff --git a/src/test/run-pass/regions-early-bound-used-in-type-param.rs b/src/test/run-pass/regions-early-bound-used-in-type-param.rs
index 622f820971f..e0d5e0a1c78 100644
--- a/src/test/run-pass/regions-early-bound-used-in-type-param.rs
+++ b/src/test/run-pass/regions-early-bound-used-in-type-param.rs
@@ -15,12 +15,11 @@ trait Get<T> {
     fn get(&self) -> T;
 }
 
+#[derive(Copy)]
 struct Box<T> {
     t: T
 }
 
-impl<T:Copy> Copy for Box<T> {}
-
 impl<T:Clone> Get<T> for Box<T> {
     fn get(&self) -> T {
         self.t.clone()
diff --git a/src/test/run-pass/regions-mock-tcx.rs b/src/test/run-pass/regions-mock-tcx.rs
index 6e85011b143..eec4ee1be94 100644
--- a/src/test/run-pass/regions-mock-tcx.rs
+++ b/src/test/run-pass/regions-mock-tcx.rs
@@ -27,14 +27,12 @@ use std::mem;
 
 type Type<'tcx> = &'tcx TypeStructure<'tcx>;
 
-#[derive(Show)]
+#[derive(Copy, Show)]
 enum TypeStructure<'tcx> {
     TypeInt,
     TypeFunction(Type<'tcx>, Type<'tcx>),
 }
 
-impl<'tcx> Copy for TypeStructure<'tcx> {}
-
 impl<'tcx> PartialEq for TypeStructure<'tcx> {
     fn eq(&self, other: &TypeStructure<'tcx>) -> bool {
         match (*self, *other) {
@@ -91,30 +89,26 @@ impl<'tcx,'ast> TypeContext<'tcx, 'ast> {
     }
 }
 
-#[derive(PartialEq, Eq, Hash)]
+#[derive(Copy, PartialEq, Eq, Hash)]
 struct NodeId {
     id: uint
 }
 
-impl Copy for NodeId {}
-
 type Ast<'ast> = &'ast AstStructure<'ast>;
 
+#[derive(Copy)]
 struct AstStructure<'ast> {
     id: NodeId,
     kind: AstKind<'ast>
 }
 
-impl<'ast> Copy for AstStructure<'ast> {}
-
+#[derive(Copy)]
 enum AstKind<'ast> {
     ExprInt,
     ExprVar(uint),
     ExprLambda(Ast<'ast>),
 }
 
-impl<'ast> Copy for AstKind<'ast> {}
-
 fn compute_types<'tcx,'ast>(tcx: &mut TypeContext<'tcx,'ast>,
                             ast: Ast<'ast>) -> Type<'tcx>
 {
diff --git a/src/test/run-pass/self-in-mut-slot-immediate-value.rs b/src/test/run-pass/self-in-mut-slot-immediate-value.rs
index 1603f7f9763..a4b5ea1d682 100644
--- a/src/test/run-pass/self-in-mut-slot-immediate-value.rs
+++ b/src/test/run-pass/self-in-mut-slot-immediate-value.rs
@@ -11,12 +11,11 @@
 // Assert that `mut self` on an immediate value doesn't
 // allow mutating the original - issue #10615.
 
+#[derive(Copy)]
 struct Value {
     n: int
 }
 
-impl Copy for Value {}
-
 impl Value {
     fn squared(mut self) -> Value {
         self.n *= self.n;
diff --git a/src/test/run-pass/simd-generics.rs b/src/test/run-pass/simd-generics.rs
index e89d5c9922d..1371c4cc5f4 100644
--- a/src/test/run-pass/simd-generics.rs
+++ b/src/test/run-pass/simd-generics.rs
@@ -13,9 +13,9 @@
 
 use std::ops;
 
-#[simd] struct f32x4(f32, f32, f32, f32);
-
-impl Copy for f32x4 {}
+#[simd]
+#[derive(Copy)]
+struct f32x4(f32, f32, f32, f32);
 
 fn add<T: ops::Add<Output=T>>(lhs: T, rhs: T) -> T {
     lhs + rhs
diff --git a/src/test/run-pass/small-enum-range-edge.rs b/src/test/run-pass/small-enum-range-edge.rs
index de38a553e12..35283e466c1 100644
--- a/src/test/run-pass/small-enum-range-edge.rs
+++ b/src/test/run-pass/small-enum-range-edge.rs
@@ -13,18 +13,16 @@
  */
 
 #[repr(u8)]
+#[derive(Copy)]
 enum Eu { Lu = 0, Hu = 255 }
 
-impl Copy for Eu {}
-
 static CLu: Eu = Eu::Lu;
 static CHu: Eu = Eu::Hu;
 
 #[repr(i8)]
+#[derive(Copy)]
 enum Es { Ls = -128, Hs = 127 }
 
-impl Copy for Es {}
-
 static CLs: Es = Es::Ls;
 static CHs: Es = Es::Hs;
 
diff --git a/src/test/run-pass/struct-return.rs b/src/test/run-pass/struct-return.rs
index bd945327d10..c8768731e2b 100644
--- a/src/test/run-pass/struct-return.rs
+++ b/src/test/run-pass/struct-return.rs
@@ -10,14 +10,12 @@
 //
 // ignore-lexer-test FIXME #15883
 
+#[derive(Copy)]
 pub struct Quad { a: u64, b: u64, c: u64, d: u64 }
 
-impl Copy for Quad {}
-
+#[derive(Copy)]
 pub struct Floats { a: f64, b: u8, c: f64 }
 
-impl Copy for Floats {}
-
 mod rustrt {
     use super::{Floats, Quad};
 
diff --git a/src/test/run-pass/structured-compare.rs b/src/test/run-pass/structured-compare.rs
index 4f6ed55f425..9278ebebc53 100644
--- a/src/test/run-pass/structured-compare.rs
+++ b/src/test/run-pass/structured-compare.rs
@@ -10,11 +10,9 @@
 
 
 
-#[derive(Show)]
+#[derive(Copy, Show)]
 enum foo { large, small, }
 
-impl Copy for foo {}
-
 impl PartialEq for foo {
     fn eq(&self, other: &foo) -> bool {
         ((*self) as uint) == ((*other) as uint)
diff --git a/src/test/run-pass/tag-variant-disr-val.rs b/src/test/run-pass/tag-variant-disr-val.rs
index cf53c1a912a..915a0b5b7e3 100644
--- a/src/test/run-pass/tag-variant-disr-val.rs
+++ b/src/test/run-pass/tag-variant-disr-val.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 use color::{red, green, blue, black, white, imaginary, purple, orange};
 
+#[derive(Copy)]
 enum color {
     red = 0xff0000,
     green = 0x00ff00,
@@ -20,8 +21,6 @@ enum color {
     orange = 8 >> 1
 }
 
-impl Copy for color {}
-
 impl PartialEq for color {
     fn eq(&self, other: &color) -> bool {
         ((*self) as uint) == ((*other) as uint)
diff --git a/src/test/run-pass/trait-coercion-generic.rs b/src/test/run-pass/trait-coercion-generic.rs
index 22db6c64770..fa02dabb373 100644
--- a/src/test/run-pass/trait-coercion-generic.rs
+++ b/src/test/run-pass/trait-coercion-generic.rs
@@ -15,13 +15,12 @@ trait Trait<T> {
     fn f(&self, x: T);
 }
 
+#[derive(Copy)]
 struct Struct {
     x: int,
     y: int,
 }
 
-impl Copy for Struct {}
-
 impl Trait<&'static str> for Struct {
     fn f(&self, x: &'static str) {
         println!("Hi, {}!", x);
diff --git a/src/test/run-pass/trait-coercion.rs b/src/test/run-pass/trait-coercion.rs
index 11eaa4c9962..1ae9b3f0e95 100644
--- a/src/test/run-pass/trait-coercion.rs
+++ b/src/test/run-pass/trait-coercion.rs
@@ -17,13 +17,12 @@ trait Trait {
     fn f(&self);
 }
 
+#[derive(Copy)]
 struct Struct {
     x: int,
     y: int,
 }
 
-impl Copy for Struct {}
-
 impl Trait for Struct {
     fn f(&self) {
         println!("Hi!");
diff --git a/src/test/run-pass/typeclasses-eq-example-static.rs b/src/test/run-pass/typeclasses-eq-example-static.rs
index 20a28c5a9ea..0ea7a1be432 100644
--- a/src/test/run-pass/typeclasses-eq-example-static.rs
+++ b/src/test/run-pass/typeclasses-eq-example-static.rs
@@ -21,11 +21,9 @@ trait Equal {
     fn isEq(a: &Self, b: &Self) -> bool;
 }
 
-#[derive(Clone)]
+#[derive(Clone, Copy)]
 enum Color { cyan, magenta, yellow, black }
 
-impl Copy for Color {}
-
 impl Equal for Color {
     fn isEq(a: &Color, b: &Color) -> bool {
         match (*a, *b) {
diff --git a/src/test/run-pass/typeclasses-eq-example.rs b/src/test/run-pass/typeclasses-eq-example.rs
index aa290edd863..69d22cf34f1 100644
--- a/src/test/run-pass/typeclasses-eq-example.rs
+++ b/src/test/run-pass/typeclasses-eq-example.rs
@@ -19,11 +19,9 @@ trait Equal {
     fn isEq(&self, a: &Self) -> bool;
 }
 
-#[derive(Clone)]
+#[derive(Clone, Copy)]
 enum Color { cyan, magenta, yellow, black }
 
-impl Copy for Color {}
-
 impl Equal for Color {
     fn isEq(&self, a: &Color) -> bool {
         match (*self, *a) {
diff --git a/src/test/run-pass/ufcs-explicit-self.rs b/src/test/run-pass/ufcs-explicit-self.rs
index 968f3511247..2be9f75dae1 100644
--- a/src/test/run-pass/ufcs-explicit-self.rs
+++ b/src/test/run-pass/ufcs-explicit-self.rs
@@ -11,12 +11,11 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
+#[derive(Copy)]
 struct Foo {
     f: int,
 }
 
-impl Copy for Foo {}
-
 impl Foo {
     fn foo(self: Foo, x: int) -> int {
         self.f + x
@@ -29,12 +28,11 @@ impl Foo {
     }
 }
 
+#[derive(Copy)]
 struct Bar<T> {
     f: T,
 }
 
-impl<T:Copy> Copy for Bar<T> {}
-
 impl<T> Bar<T> {
     fn foo(self: Bar<T>, x: int) -> int {
         x
diff --git a/src/test/run-pass/unboxed-closures-monomorphization.rs b/src/test/run-pass/unboxed-closures-monomorphization.rs
index 6dfa4c124e2..6d192daca2f 100644
--- a/src/test/run-pass/unboxed-closures-monomorphization.rs
+++ b/src/test/run-pass/unboxed-closures-monomorphization.rs
@@ -30,11 +30,9 @@ fn main(){
     let mut f = bar(&x);
     assert_eq!(f.call_mut(()), &x);
 
-    #[derive(Clone, Show, PartialEq)]
+    #[derive(Clone, Copy, Show, PartialEq)]
     struct Foo(uint, &'static str);
 
-    impl Copy for Foo {}
-
     let x = Foo(42, "forty-two");
     let mut f = bar(x);
     assert_eq!(f.call_mut(()), x);