about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/doc/grammar.md98
-rw-r--r--src/doc/intro.md2
-rw-r--r--src/doc/not_found.md1
-rw-r--r--src/doc/reference.md8
-rw-r--r--src/doc/trpl/arrays-vectors-and-slices.md2
-rw-r--r--src/doc/trpl/crates-and-modules.md4
-rw-r--r--src/doc/trpl/documentation.md11
-rw-r--r--src/doc/trpl/ffi.md1
-rw-r--r--src/doc/trpl/method-syntax.md6
-rw-r--r--src/doc/trpl/static-and-dynamic-dispatch.md2
-rw-r--r--src/doc/trpl/testing.md4
-rw-r--r--src/etc/featureck.py1
-rwxr-xr-xsrc/etc/gdb_rust_pretty_printing.py2
-rw-r--r--src/etc/mingw-fix-include/README.txt2
-rw-r--r--src/etc/third-party/COPYING.RUNTIME1
-rwxr-xr-xsrc/grammar/check.sh1
-rw-r--r--src/liballoc/arc.rs2
-rw-r--r--src/liballoc/boxed.rs13
-rw-r--r--src/libarena/lib.rs24
-rw-r--r--src/libbacktrace/Makefile.am4
-rw-r--r--src/libbacktrace/Makefile.in18
-rw-r--r--src/libbacktrace/alloc.c6
-rw-r--r--src/libbacktrace/atomic.c6
-rw-r--r--src/libbacktrace/backtrace-supported.h.in6
-rw-r--r--src/libbacktrace/backtrace.c6
-rw-r--r--src/libbacktrace/backtrace.h6
-rw-r--r--src/libbacktrace/btest.c8
-rwxr-xr-xsrc/libbacktrace/configure1
-rw-r--r--src/libbacktrace/configure.ac6
-rw-r--r--src/libbacktrace/dwarf.c12
-rw-r--r--src/libbacktrace/elf.c6
-rw-r--r--src/libbacktrace/fileline.c6
-rw-r--r--src/libbacktrace/hashtab.h4
-rw-r--r--src/libbacktrace/internal.h6
-rw-r--r--src/libbacktrace/ltmain.sh1
-rw-r--r--src/libbacktrace/mmap.c6
-rw-r--r--src/libbacktrace/mmapio.c6
-rw-r--r--src/libbacktrace/nounwind.c6
-rw-r--r--src/libbacktrace/posix.c6
-rw-r--r--src/libbacktrace/print.c6
-rw-r--r--src/libbacktrace/read.c6
-rw-r--r--src/libbacktrace/simple.c6
-rw-r--r--src/libbacktrace/state.c6
-rw-r--r--src/libbacktrace/unknown.c6
-rw-r--r--src/libcollections/bit.rs2
-rw-r--r--src/libcollections/borrow.rs2
-rw-r--r--src/libcollections/fmt.rs2
-rw-r--r--src/libcollections/slice.rs30
-rw-r--r--src/libcollections/str.rs2
-rw-r--r--src/libcollections/string.rs8
-rw-r--r--src/libcollections/vec.rs4
-rw-r--r--src/libcollections/vec_deque.rs18
-rw-r--r--src/libcore/any.rs26
-rw-r--r--src/libcore/default.rs1
-rw-r--r--src/libcore/finally.rs1
-rw-r--r--src/libcore/intrinsics.rs7
-rw-r--r--src/libcore/macros.rs4
-rw-r--r--src/libcore/marker.rs4
-rw-r--r--src/libcore/mem.rs2
-rw-r--r--src/libcore/num/f32.rs2
-rw-r--r--src/libcore/num/f64.rs2
-rw-r--r--src/libcore/num/float_macros.rs1
-rw-r--r--src/libcore/num/mod.rs32
-rw-r--r--src/libcore/ops.rs8
-rw-r--r--src/libcore/option.rs2
-rw-r--r--src/libcore/result.rs2
-rw-r--r--src/libcore/slice.rs4
-rw-r--r--src/libcore/str/mod.rs6
-rw-r--r--src/libcoretest/intrinsics.rs1
-rw-r--r--src/libflate/lib.rs68
-rw-r--r--src/liblibc/lib.rs4
-rw-r--r--src/liblog/lib.rs1
-rw-r--r--src/liblog/macros.rs1
-rw-r--r--src/librand/distributions/exponential.rs2
-rw-r--r--src/librand/distributions/gamma.rs8
-rw-r--r--src/librand/distributions/mod.rs2
-rw-r--r--src/librand/distributions/normal.rs4
-rw-r--r--src/librand/distributions/range.rs2
-rw-r--r--src/librand/lib.rs21
-rw-r--r--src/librand/reseeding.rs2
-rw-r--r--src/librustc/README.txt2
-rw-r--r--src/librustc/diagnostics.rs1
-rw-r--r--src/librustc/metadata/loader.rs4
-rw-r--r--src/librustc/metadata/tydecode.rs1
-rw-r--r--src/librustc/middle/astencode.rs12
-rw-r--r--src/librustc/middle/cfg/graphviz.rs1
-rw-r--r--src/librustc/middle/expr_use_visitor.rs36
-rw-r--r--src/librustc/middle/fast_reject.rs1
-rw-r--r--src/librustc/middle/infer/combine.rs15
-rw-r--r--src/librustc/middle/infer/equate.rs18
-rw-r--r--src/librustc/middle/infer/glb.rs10
-rw-r--r--src/librustc/middle/infer/lub.rs10
-rw-r--r--src/librustc/middle/infer/resolve.rs1
-rw-r--r--src/librustc/middle/infer/sub.rs16
-rw-r--r--src/librustc/middle/lang_items.rs3
-rw-r--r--src/librustc/middle/mem_categorization.rs1
-rw-r--r--src/librustc/middle/traits/project.rs2
-rw-r--r--src/librustc/middle/traits/util.rs2
-rw-r--r--src/librustc/middle/ty.rs19
-rw-r--r--src/librustc/middle/ty_fold.rs1
-rw-r--r--src/librustc/middle/ty_walk.rs2
-rw-r--r--src/librustc/util/ppaux.rs6
-rw-r--r--src/librustc_back/archive.rs1
-rw-r--r--src/librustc_back/target/dragonfly_base.rs1
-rw-r--r--src/librustc_back/target/freebsd_base.rs1
-rw-r--r--src/librustc_back/target/openbsd_base.rs1
-rw-r--r--src/librustc_resolve/build_reduced_graph.rs41
-rw-r--r--src/librustc_resolve/diagnostics.rs4
-rw-r--r--src/librustc_resolve/lib.rs1141
-rw-r--r--src/librustc_resolve/record_exports.rs13
-rw-r--r--src/librustc_resolve/resolve_imports.rs1021
-rw-r--r--src/librustc_trans/back/link.rs7
-rw-r--r--src/librustc_trans/back/lto.rs8
-rw-r--r--src/librustc_trans/trans/_match.rs4
-rw-r--r--src/librustc_trans/trans/base.rs31
-rw-r--r--src/librustc_trans/trans/callee.rs2
-rw-r--r--src/librustc_trans/trans/closure.rs1
-rw-r--r--src/librustc_trans/trans/common.rs9
-rw-r--r--src/librustc_trans/trans/consts.rs7
-rw-r--r--src/librustc_trans/trans/context.rs29
-rw-r--r--src/librustc_trans/trans/expr.rs104
-rw-r--r--src/librustc_trans/trans/glue.rs284
-rw-r--r--src/librustc_trans/trans/intrinsic.rs11
-rw-r--r--src/librustc_trans/trans/llrepr.rs2
-rw-r--r--src/librustc_trans/trans/machine.rs14
-rw-r--r--src/librustc_trans/trans/meth.rs23
-rw-r--r--src/librustc_trans/trans/tvec.rs123
-rw-r--r--src/librustc_trans/trans/type_.rs31
-rw-r--r--src/librustc_typeck/check/closure.rs2
-rw-r--r--src/librustc_typeck/check/coercion.rs34
-rw-r--r--src/librustc_typeck/check/method/confirm.rs4
-rw-r--r--src/librustc_typeck/check/method/probe.rs5
-rw-r--r--src/librustc_typeck/check/mod.rs14
-rw-r--r--src/librustc_typeck/check/upvar.rs2
-rw-r--r--src/librustc_typeck/check/vtable.rs1
-rw-r--r--src/librustc_typeck/collect.rs18
-rw-r--r--src/librustc_typeck/diagnostics.rs1
-rw-r--r--src/librustc_typeck/variance.rs1
-rw-r--r--src/librustdoc/html/item_type.rs1
-rw-r--r--src/librustdoc/html/static/Heuristica-LICENSE.txt4
-rw-r--r--src/librustdoc/html/static/SourceCodePro-LICENSE.txt2
-rw-r--r--src/librustdoc/html/static/SourceSerifPro-LICENSE.txt2
-rw-r--r--src/librustdoc/html/static/playpen.js1
-rw-r--r--src/libserialize/hex.rs4
-rw-r--r--src/libstd/bool.rs1
-rw-r--r--src/libstd/env.rs26
-rw-r--r--src/libstd/fs/mod.rs8
-rw-r--r--src/libstd/io/buffered.rs29
-rw-r--r--src/libstd/io/mod.rs2
-rw-r--r--src/libstd/macros.rs10
-rw-r--r--src/libstd/old_io/buffered.rs6
-rw-r--r--src/libstd/old_io/fs.rs20
-rw-r--r--src/libstd/old_io/mem.rs8
-rw-r--r--src/libstd/old_io/mod.rs2
-rw-r--r--src/libstd/old_io/net/pipe.rs2
-rw-r--r--src/libstd/old_io/stdio.rs2
-rw-r--r--src/libstd/old_io/timer.rs8
-rw-r--r--src/libstd/os.rs30
-rw-r--r--src/libstd/path.rs8
-rw-r--r--src/libstd/rand/mod.rs2
-rw-r--r--src/libstd/rand/reader.rs2
-rw-r--r--src/libstd/sync/barrier.rs2
-rw-r--r--src/libstd/sync/mutex.rs6
-rw-r--r--src/libstd/sync/once.rs2
-rw-r--r--src/libstd/sync/task_pool.rs2
-rw-r--r--src/libstd/sys/common/thread.rs15
-rw-r--r--src/libstd/sys/unix/thread.rs318
-rw-r--r--src/libstd/sys/windows/thread.rs66
-rw-r--r--src/libstd/thread.rs31
-rw-r--r--src/libsyntax/lib.rs1
-rw-r--r--src/libsyntax/test.rs18
-rw-r--r--src/libterm/lib.rs1
-rw-r--r--src/libtest/lib.rs1
-rw-r--r--src/libunicode/u_str.rs2
-rw-r--r--src/rt/msvc/typeof.h1
-rw-r--r--src/rt/valgrind/memcheck.h2
-rw-r--r--src/test/auxiliary/changing-crates-a2.rs1
-rw-r--r--src/test/auxiliary/coherence-orphan-lib.rs1
-rw-r--r--src/test/auxiliary/default_type_params_xc.rs1
-rw-r--r--src/test/auxiliary/iss.rs1
-rw-r--r--src/test/auxiliary/issue-12133-dylib2.rs1
-rw-r--r--src/test/auxiliary/issue-13560-3.rs1
-rw-r--r--src/test/auxiliary/issue-16725.rs1
-rw-r--r--src/test/auxiliary/issue-5521.rs1
-rw-r--r--src/test/auxiliary/issue13213aux.rs1
-rw-r--r--src/test/auxiliary/issue_3907.rs1
-rw-r--r--src/test/auxiliary/issue_5844_aux.rs1
-rw-r--r--src/test/auxiliary/issue_8401.rs1
-rw-r--r--src/test/auxiliary/issue_9123.rs1
-rw-r--r--src/test/auxiliary/issue_9188.rs1
-rw-r--r--src/test/auxiliary/kinds_in_metadata.rs1
-rw-r--r--src/test/auxiliary/lang-item-public.rs2
-rw-r--r--src/test/auxiliary/namespaced_enums.rs1
-rw-r--r--src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs1
-rw-r--r--src/test/auxiliary/privacy_reexport.rs2
-rw-r--r--src/test/auxiliary/pub_static_array.rs11
-rw-r--r--src/test/auxiliary/struct_variant_privacy.rs1
-rw-r--r--src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs1
-rw-r--r--src/test/auxiliary/weak-lang-items.rs1
-rw-r--r--src/test/auxiliary/where_clauses_xc.rs1
-rw-r--r--src/test/auxiliary/xcrate_struct_aliases.rs1
-rw-r--r--src/test/auxiliary/xcrate_unit_struct.rs1
-rw-r--r--src/test/compile-fail/associated-types-coherence-failure.rs1
-rw-r--r--src/test/compile-fail/associated-types-eq-expr-path.rs2
-rw-r--r--src/test/compile-fail/associated-types-issue-17359.rs1
-rw-r--r--src/test/compile-fail/bad-crate-id2.rs1
-rw-r--r--src/test/compile-fail/borrowck-box-insensitivity.rs1
-rw-r--r--src/test/compile-fail/borrowck-closures-unique-imm.rs1
-rw-r--r--src/test/compile-fail/borrowck-consume-unsize-vec.rs22
-rw-r--r--src/test/compile-fail/borrowck-consume-upcast-box.rs24
-rw-r--r--src/test/compile-fail/borrowck-field-sensitivity.rs1
-rw-r--r--src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs1
-rw-r--r--src/test/compile-fail/borrowck-for-loop-head-linkage.rs1
-rw-r--r--src/test/compile-fail/borrowck-issue-14498.rs1
-rw-r--r--src/test/compile-fail/borrowck-let-suggestion.rs1
-rw-r--r--src/test/compile-fail/borrowck-multiple-captures.rs1
-rw-r--r--src/test/compile-fail/borrowck-mutate-in-guard.rs1
-rw-r--r--src/test/compile-fail/borrowck-object-lifetime.rs1
-rw-r--r--src/test/compile-fail/borrowck-object-mutability.rs1
-rw-r--r--src/test/compile-fail/borrowck-overloaded-call.rs1
-rw-r--r--src/test/compile-fail/borrowck-overloaded-index-and-overloaded-deref.rs1
-rw-r--r--src/test/compile-fail/borrowck-partial-reinit-2.rs1
-rw-r--r--src/test/compile-fail/borrowck-unboxed-closures.rs1
-rw-r--r--src/test/compile-fail/borrowck-use-mut-borrow.rs1
-rw-r--r--src/test/compile-fail/closure-reform-bad.rs1
-rw-r--r--src/test/compile-fail/cross-borrow-trait.rs1
-rw-r--r--src/test/compile-fail/drop-with-active-borrows-1.rs1
-rw-r--r--src/test/compile-fail/duplicate-parameter.rs1
-rw-r--r--src/test/compile-fail/duplicate-type-parameter.rs1
-rw-r--r--src/test/compile-fail/explicit-self-lifetime-mismatch.rs1
-rw-r--r--src/test/compile-fail/extern-with-type-bounds.rs1
-rw-r--r--src/test/compile-fail/feature-gate-advanced-slice-features.rs1
-rw-r--r--src/test/compile-fail/feature-gate-box-expr.rs1
-rw-r--r--src/test/compile-fail/feature-gate-start.rs1
-rw-r--r--src/test/compile-fail/generic-no-mangle.rs1
-rw-r--r--src/test/compile-fail/indexing-requires-a-uint.rs1
-rw-r--r--src/test/compile-fail/infinite-macro-expansion.rs1
-rw-r--r--src/test/compile-fail/integral-indexing.rs8
-rw-r--r--src/test/compile-fail/intrinsic-return-address.rs2
-rw-r--r--src/test/compile-fail/issue-10536.rs1
-rw-r--r--src/test/compile-fail/issue-11192.rs1
-rw-r--r--src/test/compile-fail/issue-11593.rs1
-rw-r--r--src/test/compile-fail/issue-11844.rs1
-rw-r--r--src/test/compile-fail/issue-12041.rs1
-rw-r--r--src/test/compile-fail/issue-12612.rs1
-rw-r--r--src/test/compile-fail/issue-13407.rs19
-rw-r--r--src/test/compile-fail/issue-13446.rs1
-rw-r--r--src/test/compile-fail/issue-14092.rs1
-rw-r--r--src/test/compile-fail/issue-16149.rs1
-rw-r--r--src/test/compile-fail/issue-16338.rs1
-rw-r--r--src/test/compile-fail/issue-16725.rs1
-rw-r--r--src/test/compile-fail/issue-16922.rs20
-rw-r--r--src/test/compile-fail/issue-17718-const-bad-values.rs1
-rw-r--r--src/test/compile-fail/issue-18919.rs17
-rw-r--r--src/test/compile-fail/issue-19982.rs17
-rw-r--r--src/test/compile-fail/issue-20225.rs22
-rw-r--r--src/test/compile-fail/issue-20261.rs17
-rw-r--r--src/test/compile-fail/issue-20714.rs15
-rw-r--r--src/test/compile-fail/issue-3008-2.rs1
-rw-r--r--src/test/compile-fail/issue-3907.rs1
-rw-r--r--src/test/compile-fail/issue-5844.rs1
-rw-r--r--src/test/compile-fail/issue-7607-1.rs1
-rw-r--r--src/test/compile-fail/issue-8767.rs1
-rw-r--r--src/test/compile-fail/kindck-copy.rs1
-rw-r--r--src/test/compile-fail/kindck-nonsendable-1.rs1
-rw-r--r--src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs1
-rw-r--r--src/test/compile-fail/linkage3.rs1
-rw-r--r--src/test/compile-fail/lint-dead-code-3.rs2
-rw-r--r--src/test/compile-fail/lint-exceeding-bitshifts.rs1
-rw-r--r--src/test/compile-fail/lint-stability3.rs1
-rw-r--r--src/test/compile-fail/lint-uppercase-variables.rs1
-rw-r--r--src/test/compile-fail/macro-inner-attributes.rs1
-rw-r--r--src/test/compile-fail/macro-outer-attributes.rs1
-rw-r--r--src/test/compile-fail/manual-link-bad-form.rs2
-rw-r--r--src/test/compile-fail/manual-link-bad-kind.rs1
-rw-r--r--src/test/compile-fail/method-ambig-two-traits-cross-crate.rs1
-rw-r--r--src/test/compile-fail/method-missing-call.rs1
-rw-r--r--src/test/compile-fail/mut-cross-borrowing.rs1
-rw-r--r--src/test/compile-fail/object-safety-by-value-self-use.rs1
-rw-r--r--src/test/compile-fail/opt-in-copy.rs1
-rw-r--r--src/test/compile-fail/overloaded-calls-nontuple.rs1
-rw-r--r--src/test/compile-fail/pattern-bindings-after-at.rs1
-rw-r--r--src/test/compile-fail/pattern-ident-path-generics.rs1
-rw-r--r--src/test/compile-fail/privacy1.rs16
-rw-r--r--src/test/compile-fail/region-bound-on-closure-outlives-call.rs1
-rw-r--r--src/test/compile-fail/region-object-lifetime-1.rs1
-rw-r--r--src/test/compile-fail/region-object-lifetime-2.rs1
-rw-r--r--src/test/compile-fail/region-object-lifetime-3.rs1
-rw-r--r--src/test/compile-fail/region-object-lifetime-4.rs1
-rw-r--r--src/test/compile-fail/region-object-lifetime-5.rs1
-rw-r--r--src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs1
-rw-r--r--src/test/compile-fail/regions-close-associated-type-into-object.rs1
-rw-r--r--src/test/compile-fail/regions-close-object-into-object-1.rs1
-rw-r--r--src/test/compile-fail/regions-close-object-into-object-3.rs1
-rw-r--r--src/test/compile-fail/regions-close-object-into-object-4.rs1
-rw-r--r--src/test/compile-fail/regions-close-object-into-object-5.rs1
-rw-r--r--src/test/compile-fail/regions-close-param-into-object.rs1
-rw-r--r--src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs1
-rw-r--r--src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs1
-rw-r--r--src/test/compile-fail/resolve-conflict-import-vs-import.rs1
-rw-r--r--src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs1
-rw-r--r--src/test/compile-fail/resolve-conflict-item-vs-import.rs1
-rw-r--r--src/test/compile-fail/resolve-unknown-trait.rs1
-rw-r--r--src/test/compile-fail/retslot-cast.rs14
-rw-r--r--src/test/compile-fail/shadowing-in-the-same-pattern.rs1
-rw-r--r--src/test/compile-fail/static-array-across-crate.rs20
-rw-r--r--src/test/compile-fail/struct-variant-privacy-xc.rs1
-rw-r--r--src/test/compile-fail/structure-constructor-type-mismatch.rs1
-rw-r--r--src/test/compile-fail/trait-as-struct-constructor.rs1
-rw-r--r--src/test/compile-fail/trait-bounds-impl-comparison-2.rs1
-rw-r--r--src/test/compile-fail/trait-bounds-not-on-bare-trait.rs2
-rw-r--r--src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs1
-rw-r--r--src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs1
-rw-r--r--src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs1
-rw-r--r--src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs1
-rw-r--r--src/test/compile-fail/trait-bounds-on-structs-and-enums.rs1
-rw-r--r--src/test/compile-fail/trait-coercion-generic-regions.rs1
-rw-r--r--src/test/compile-fail/transmute-different-sizes.rs2
-rw-r--r--src/test/compile-fail/type-params-in-different-spaces-2.rs1
-rw-r--r--src/test/compile-fail/type-params-in-different-spaces-3.rs1
-rw-r--r--src/test/compile-fail/ufcs-explicit-self-bad.rs1
-rw-r--r--src/test/compile-fail/ufcs-qpath-self-mismatch.rs1
-rw-r--r--src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs1
-rw-r--r--src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs1
-rw-r--r--src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs1
-rw-r--r--src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs1
-rw-r--r--src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs1
-rw-r--r--src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs1
-rw-r--r--src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs1
-rw-r--r--src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs1
-rw-r--r--src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs1
-rw-r--r--src/test/compile-fail/unboxed-closures-vtable-mismatch.rs1
-rw-r--r--src/test/compile-fail/unboxed-closures-wrong-abi.rs1
-rw-r--r--src/test/compile-fail/variance-issue-20533.rs1
-rw-r--r--src/test/compile-fail/variance-trait-matching.rs1
-rw-r--r--src/test/compile-fail/vector-cast-weirdness.rs1
-rw-r--r--src/test/compile-fail/walk-struct-literal-with.rs1
-rw-r--r--src/test/compile-fail/where-clauses-unsatisfied.rs1
-rw-r--r--src/test/debuginfo/function-arg-initialization.rs3
-rw-r--r--src/test/debuginfo/generic-method-on-generic-struct.rs1
-rw-r--r--src/test/debuginfo/lexical-scope-in-parameterless-closure.rs1
-rw-r--r--src/test/debuginfo/limited-debuginfo.rs1
-rw-r--r--src/test/debuginfo/method-on-enum.rs1
-rw-r--r--src/test/debuginfo/method-on-generic-struct.rs1
-rw-r--r--src/test/debuginfo/method-on-struct.rs1
-rw-r--r--src/test/debuginfo/method-on-trait.rs1
-rw-r--r--src/test/debuginfo/method-on-tuple-struct.rs1
-rw-r--r--src/test/debuginfo/no-debug-attribute.rs1
-rw-r--r--src/test/debuginfo/recursive-struct.rs1
-rw-r--r--src/test/debuginfo/self-in-default-method.rs1
-rw-r--r--src/test/debuginfo/self-in-generic-default-method.rs1
-rw-r--r--src/test/parse-fail/ascii-only-character-escape.rs1
-rw-r--r--src/test/parse-fail/byte-literals.rs2
-rw-r--r--src/test/parse-fail/byte-string-literals.rs2
-rw-r--r--src/test/parse-fail/issue-10392-2.rs1
-rw-r--r--src/test/parse-fail/issue-17718-const-mut.rs1
-rw-r--r--src/test/parse-fail/issue-20711-2.rs1
-rw-r--r--src/test/parse-fail/issue-2354-1.rs1
-rw-r--r--src/test/parse-fail/keywords-followed-by-double-colon.rs1
-rw-r--r--src/test/parse-fail/macro-attribute.rs1
-rw-r--r--src/test/parse-fail/macros-no-semicolon.rs1
-rw-r--r--src/test/parse-fail/obsolete-proc.rs2
-rw-r--r--src/test/parse-fail/raw-byte-string-eof.rs2
-rw-r--r--src/test/parse-fail/raw-byte-string-literals.rs2
-rw-r--r--src/test/parse-fail/struct-literal-in-for.rs1
-rw-r--r--src/test/parse-fail/struct-literal-in-if.rs1
-rw-r--r--src/test/parse-fail/struct-literal-in-match-discriminant.rs1
-rw-r--r--src/test/parse-fail/struct-literal-in-while.rs1
-rw-r--r--src/test/parse-fail/type-parameters-in-field-exprs.rs1
-rw-r--r--src/test/parse-fail/unboxed-closure-sugar-used-on-struct-3.rs1
-rw-r--r--src/test/parse-fail/use-mod-4.rs1
-rw-r--r--src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs1
-rw-r--r--src/test/pretty/asm-clobbers.rs1
-rw-r--r--src/test/pretty/closure-reform-pretty.rs1
-rw-r--r--src/test/pretty/path-type-bounds.rs1
-rw-r--r--src/test/pretty/where-clauses.rs1
-rw-r--r--src/test/run-make/allow-non-lint-warnings-cmdline/Makefile1
-rw-r--r--src/test/run-make/allow-warnings-cmdline-stability/Makefile4
-rw-r--r--src/test/run-make/compiler-lookup-paths/c.rs1
-rw-r--r--src/test/run-make/crate-name-priority/foo1.rs1
-rw-r--r--src/test/run-make/extern-flag-disambiguates/Makefile1
-rw-r--r--src/test/run-make/extern-flag-fun/bar.rs1
-rw-r--r--src/test/run-make/extern-overrides-distribution/main.rs1
-rw-r--r--src/test/run-make/interdependent-c-libraries/Makefile1
-rw-r--r--src/test/run-make/interdependent-c-libraries/bar.rs1
-rw-r--r--src/test/run-make/issue-14500/Makefile1
-rw-r--r--src/test/run-make/libs-and-bins/Makefile1
-rw-r--r--src/test/run-make/link-path-order/Makefile1
-rw-r--r--src/test/run-make/linkage-attr-on-static/Makefile1
-rw-r--r--src/test/run-make/manual-link/Makefile1
-rw-r--r--src/test/run-make/many-crates-but-no-match/Makefile2
-rw-r--r--src/test/run-make/missing-crate-dependency/Makefile2
-rw-r--r--src/test/run-make/mixing-formats/baz2.rs1
-rw-r--r--src/test/run-make/obey-crate-type-flag/test.rs1
-rw-r--r--src/test/run-make/rustdoc-default-impl/bar.rs1
-rw-r--r--src/test/run-make/rustdoc-extern-method/Makefile1
-rw-r--r--src/test/run-make/rustdoc-negative-impl/Makefile1
-rw-r--r--src/test/run-make/rustdoc-recursion/Makefile1
-rw-r--r--src/test/run-make/rustdoc-recursion/foo.rs1
-rw-r--r--src/test/run-make/rustdoc-viewpath-self/Makefile1
-rw-r--r--src/test/run-make/rustdoc-where/Makefile1
-rw-r--r--src/test/run-make/tools.mk1
-rw-r--r--src/test/run-pass-fulldeps/compiler-calls.rs1
-rw-r--r--src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs1
-rw-r--r--src/test/run-pass/as-precedence.rs1
-rw-r--r--src/test/run-pass/backtrace-debuginfo-aux.rs1
-rw-r--r--src/test/run-pass/backtrace-debuginfo.rs1
-rw-r--r--src/test/run-pass/bare-fn-implements-fn-mut.rs1
-rw-r--r--src/test/run-pass/bitv-perf-test.rs1
-rw-r--r--src/test/run-pass/borrowck-field-sensitivity.rs1
-rw-r--r--src/test/run-pass/borrowck-move-by-capture-ok.rs1
-rw-r--r--src/test/run-pass/borrowck-use-mut-borrow.rs1
-rw-r--r--src/test/run-pass/can-copy-pod.rs2
-rw-r--r--src/test/run-pass/capture-clauses-boxed-closures.rs1
-rw-r--r--src/test/run-pass/class-exports.rs1
-rw-r--r--src/test/run-pass/cleanup-arm-conditional.rs1
-rw-r--r--src/test/run-pass/cleanup-shortcircuit.rs1
-rw-r--r--src/test/run-pass/closure-reform.rs1
-rw-r--r--src/test/run-pass/conditional-compile.rs1
-rw-r--r--src/test/run-pass/deriving-meta-multiple.rs1
-rw-r--r--src/test/run-pass/deriving-meta.rs1
-rw-r--r--src/test/run-pass/deriving-via-extension-hash-enum.rs1
-rw-r--r--src/test/run-pass/deriving-via-extension-hash-struct.rs1
-rw-r--r--src/test/run-pass/deriving-via-extension-type-params.rs1
-rw-r--r--src/test/run-pass/drop-with-type-ascription-1.rs1
-rw-r--r--src/test/run-pass/drop-with-type-ascription-2.rs1
-rw-r--r--src/test/run-pass/duplicated-external-mods.rs1
-rw-r--r--src/test/run-pass/export-multi.rs1
-rw-r--r--src/test/run-pass/export-non-interference3.rs1
-rw-r--r--src/test/run-pass/extern-compare-with-return-type.rs1
-rw-r--r--src/test/run-pass/extern-mod-syntax.rs1
-rw-r--r--src/test/run-pass/for-loop-goofiness.rs1
-rw-r--r--src/test/run-pass/format-nan.rs1
-rw-r--r--src/test/run-pass/import-from.rs1
-rw-r--r--src/test/run-pass/import-trailing-comma.rs1
-rw-r--r--src/test/run-pass/import2.rs1
-rw-r--r--src/test/run-pass/import3.rs1
-rw-r--r--src/test/run-pass/import4.rs1
-rw-r--r--src/test/run-pass/import5.rs1
-rw-r--r--src/test/run-pass/import6.rs1
-rw-r--r--src/test/run-pass/import7.rs1
-rw-r--r--src/test/run-pass/import8.rs1
-rw-r--r--src/test/run-pass/inherent-trait-method-order.rs1
-rw-r--r--src/test/run-pass/integer-literal-suffix-inference-2.rs1
-rw-r--r--src/test/run-pass/integer-literal-suffix-inference-3.rs1
-rw-r--r--src/test/run-pass/intrinsic-assume.rs1
-rw-r--r--src/test/run-pass/intrinsic-return-address.rs1
-rw-r--r--src/test/run-pass/intrinsics-math.rs1
-rw-r--r--src/test/run-pass/issue-11736.rs1
-rw-r--r--src/test/run-pass/issue-11820.rs19
-rw-r--r--src/test/run-pass/issue-12729.rs1
-rw-r--r--src/test/run-pass/issue-14421.rs1
-rw-r--r--src/test/run-pass/issue-15155.rs2
-rw-r--r--src/test/run-pass/issue-15221.rs1
-rw-r--r--src/test/run-pass/issue-16151.rs1
-rw-r--r--src/test/run-pass/issue-16278.rs1
-rw-r--r--src/test/run-pass/issue-16452.rs1
-rw-r--r--src/test/run-pass/issue-16597.rs2
-rw-r--r--src/test/run-pass/issue-16922.rs18
-rw-r--r--src/test/run-pass/issue-19982.rs22
-rw-r--r--src/test/run-pass/issue-20396.rs23
-rw-r--r--src/test/run-pass/issue-20823.rs2
-rw-r--r--src/test/run-pass/issue-21058.rs12
-rw-r--r--src/test/run-pass/issue-21520.rs1
-rw-r--r--src/test/run-pass/issue-2214.rs1
-rw-r--r--src/test/run-pass/issue-2383.rs1
-rw-r--r--src/test/run-pass/issue-2718.rs1
-rw-r--r--src/test/run-pass/issue-2804-2.rs1
-rw-r--r--src/test/run-pass/issue-2804.rs1
-rw-r--r--src/test/run-pass/issue-2904.rs1
-rw-r--r--src/test/run-pass/issue-3026.rs1
-rw-r--r--src/test/run-pass/issue-3979.rs1
-rw-r--r--src/test/run-pass/issue-4759.rs1
-rw-r--r--src/test/run-pass/issue-5060.rs1
-rw-r--r--src/test/run-pass/issue-5666.rs1
-rw-r--r--src/test/run-pass/issue-5950.rs2
-rw-r--r--src/test/run-pass/issue-6318.rs1
-rw-r--r--src/test/run-pass/issue-6919.rs1
-rw-r--r--src/test/run-pass/issue-7222.rs1
-rw-r--r--src/test/run-pass/issue-7607-2.rs2
-rw-r--r--src/test/run-pass/issue-8248.rs1
-rw-r--r--src/test/run-pass/issue-8249.rs1
-rw-r--r--src/test/run-pass/issue-8398.rs1
-rw-r--r--src/test/run-pass/issue-9188.rs1
-rw-r--r--src/test/run-pass/issue-9951.rs28
-rw-r--r--src/test/run-pass/kindck-implicit-close-over-mut-var.rs1
-rw-r--r--src/test/run-pass/kinds-in-metadata.rs1
-rw-r--r--src/test/run-pass/loop-label-shadowing.rs1
-rw-r--r--src/test/run-pass/macro-delimiter-significance.rs1
-rw-r--r--src/test/run-pass/macro-meta-items.rs1
-rw-r--r--src/test/run-pass/macro-method-issue-4621.rs3
-rw-r--r--src/test/run-pass/macro-with-attrs2.rs1
-rw-r--r--src/test/run-pass/method-normalize-bounds-issue-20604.rs1
-rw-r--r--src/test/run-pass/mid-path-type-params.rs1
-rw-r--r--src/test/run-pass/mod-view-items.rs1
-rw-r--r--src/test/run-pass/namespaced-enum-emulate-flat-xc.rs1
-rw-r--r--src/test/run-pass/namespaced-enums-xcrate.rs1
-rw-r--r--src/test/run-pass/new-box.rs1
-rw-r--r--src/test/run-pass/overloaded-calls-simple.rs1
-rw-r--r--src/test/run-pass/overloaded-calls-zero-args.rs2
-rw-r--r--src/test/run-pass/placement-new-arena.rs1
-rw-r--r--src/test/run-pass/ranges-precedence.rs1
-rw-r--r--src/test/run-pass/self-shadowing-import.rs1
-rw-r--r--src/test/run-pass/sepcomp-fns-backwards.rs1
-rw-r--r--src/test/run-pass/sepcomp-statics.rs1
-rw-r--r--src/test/run-pass/struct-aliases-xcrate.rs1
-rw-r--r--src/test/run-pass/struct-aliases.rs1
-rw-r--r--src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs5
-rw-r--r--src/test/run-pass/test-should-fail-good-message.rs6
-rw-r--r--src/test/run-pass/trait-bounds-impl-comparison-duplicates.rs2
-rw-r--r--src/test/run-pass/trait-coercion-generic.rs1
-rw-r--r--src/test/run-pass/trait-coercion.rs1
-rw-r--r--src/test/run-pass/trait-contravariant-self.rs2
-rw-r--r--src/test/run-pass/trait-inheritance-num.rs1
-rw-r--r--src/test/run-pass/trait-inheritance-num0.rs1
-rw-r--r--src/test/run-pass/trait-inheritance-num2.rs1
-rw-r--r--src/test/run-pass/trait-static-method-overwriting.rs1
-rw-r--r--src/test/run-pass/tydesc-name.rs6
-rw-r--r--src/test/run-pass/ufcs-explicit-self.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-all-traits.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-boxed.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-call-sugar-object.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-direct-sugary-call.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-drop.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-extern-fn-hr.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-extern-fn.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-generic.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-manual-impl.rs2
-rw-r--r--src/test/run-pass/unboxed-closures-prelude.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-single-word-env.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-static-call-fn-once.rs1
-rw-r--r--src/test/run-pass/unboxed-closures-zero-args.rs1
-rw-r--r--src/test/run-pass/use.rs1
-rw-r--r--src/test/run-pass/variance-trait-matching.rs2
-rw-r--r--src/test/run-pass/visible-private-types-feature-gate.rs1
-rw-r--r--src/test/run-pass/where-clause-method-substituion.rs1
-rw-r--r--src/test/run-pass/where-clauses-cross-crate.rs1
-rw-r--r--src/test/run-pass/where-clauses-unboxed-closures.rs1
-rw-r--r--src/test/run-pass/where-clauses.rs1
-rw-r--r--src/test/run-pass/where-for-self.rs1
544 files changed, 2450 insertions, 2746 deletions
diff --git a/src/doc/grammar.md b/src/doc/grammar.md
index 68ca1cb7217..1ea3c7d7bd9 100644
--- a/src/doc/grammar.md
+++ b/src/doc/grammar.md
@@ -290,7 +290,7 @@ transcriber : '(' transcriber * ')' | '[' transcriber * ']'
 
 # Items and attributes
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ## Items
 
@@ -301,7 +301,7 @@ item : mod_item | fn_item | type_item | struct_item | enum_item
 
 ### Type Parameters
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Modules
 
@@ -338,35 +338,35 @@ path_item : ident | "mod" ;
 
 ### Functions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Generic functions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Unsafety
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ##### Unsafe functions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ##### Unsafe blocks
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Diverging functions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Type definitions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Structures
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Constant items
 
@@ -382,15 +382,15 @@ static_item : "static" ident ':' type '=' expr ';' ;
 
 #### Mutable statics
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Traits
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Implementations
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### External blocks
 
@@ -401,11 +401,11 @@ extern_block : [ foreign_fn ] * ;
 
 ## Visibility and Privacy
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Re-exporting and Visibility
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ## Attributes
 
@@ -420,11 +420,11 @@ meta_seq : meta_item [ ',' meta_seq ] ? ;
 
 ## Statements
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Declaration statements
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 A _declaration statement_ is one that introduces one or more *names* into the
 enclosing statement block. The declared names may denote new slots or new
@@ -432,7 +432,7 @@ items.
 
 #### Item declarations
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 An _item declaration statement_ has a syntactic form identical to an
 [item](#items) declaration within a module. Declaring an item — a
@@ -450,35 +450,35 @@ init : [ '=' ] expr ;
 
 ### Expression statements
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ## Expressions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Lvalues, rvalues and temporaries
 
-**FIXME:** grammar?  
+**FIXME:** grammar?
 
 #### Moved and copied types
 
-**FIXME:** Do we want to capture this in the grammar as different productions? 
+**FIXME:** Do we want to capture this in the grammar as different productions?
 
 ### Literal expressions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Path expressions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Tuple expressions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Unit expressions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Structure expressions
 
@@ -527,7 +527,7 @@ idx_expr : expr '[' expr ']' ;
 
 ### Unary operator expressions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Binary operator expressions
 
@@ -537,31 +537,31 @@ binop_expr : expr binop expr ;
 
 #### Arithmetic operators
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Bitwise operators
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Lazy boolean operators
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Comparison operators
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Type cast expressions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Assignment expressions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Compound assignment expressions
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Operator precedence
 
@@ -680,49 +680,49 @@ return_expr : "return" expr ? ;
 
 # Type system
 
-**FIXME:** is this entire chapter relevant here? Or should it all have been covered by some production already? 
+**FIXME:** is this entire chapter relevant here? Or should it all have been covered by some production already?
 
 ## Types
 
 ### Primitive types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Machine types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 #### Machine-dependent integer types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Textual types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Tuple types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Array, and Slice types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Structure types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Enumerated types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Pointer types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Function types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Closure types
 
@@ -739,15 +739,15 @@ bound := path | lifetime
 
 ### Object types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Type parameters
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ### Self types
 
-**FIXME:** grammar? 
+**FIXME:** grammar?
 
 ## Type kinds
 
@@ -755,7 +755,7 @@ bound := path | lifetime
 
 # Memory and concurrency models
 
-**FIXME:** is this entire chapter relevant here? Or should it all have been covered by some production already? 
+**FIXME:** is this entire chapter relevant here? Or should it all have been covered by some production already?
 
 ## Memory model
 
diff --git a/src/doc/intro.md b/src/doc/intro.md
index 9e575abeee2..51280e58854 100644
--- a/src/doc/intro.md
+++ b/src/doc/intro.md
@@ -140,7 +140,7 @@ right at home if you've used tools like [Bundler](http://bundler.io/),
 [npm](https://www.npmjs.org/), or [pip](https://pip.pypa.io/en/latest/).
 There's no `Makefile`s or endless `autotools` output here. (Rust's tooling does
 [play nice with external libraries written in those
-tools](http://crates.io/native-build.html), if you need to.)
+tools](http://doc.crates.io/build-script.html), if you need to.)
 
 Enough about tools, let's talk code!
 
diff --git a/src/doc/not_found.md b/src/doc/not_found.md
index c746c5773dd..eae2bf1925a 100644
--- a/src/doc/not_found.md
+++ b/src/doc/not_found.md
@@ -63,4 +63,3 @@ function populate_rust_search() {
 populate_site_search();
 populate_rust_search();
 </script>
-
diff --git a/src/doc/reference.md b/src/doc/reference.md
index c4c122463a7..3fae49bfc6d 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -1961,16 +1961,18 @@ module through the rules above. It essentially allows public access into the
 re-exported item. For example, this program is valid:
 
 ```
-pub use self::implementation as api;
+pub use self::implementation::api;
 
 mod implementation {
-    pub fn f() {}
+    pub mod api {
+        pub fn f() {}
+    }
 }
 
 # fn main() {}
 ```
 
-This means that any external crate referencing `implementation::f` would
+This means that any external crate referencing `implementation::api::f` would
 receive a privacy violation, while the path `api::f` would be allowed.
 
 When re-exporting a private item, it can be thought of as allowing the "privacy
diff --git a/src/doc/trpl/arrays-vectors-and-slices.md b/src/doc/trpl/arrays-vectors-and-slices.md
index f1b5ecf4ff0..5d0f314e8c6 100644
--- a/src/doc/trpl/arrays-vectors-and-slices.md
+++ b/src/doc/trpl/arrays-vectors-and-slices.md
@@ -49,7 +49,7 @@ languages.
 
 A *vector* is a dynamic or "growable" array, implemented as the standard
 library type [`Vec<T>`](../std/vec/) (we'll talk about what the `<T>` means
-later). Vectors always allocate their data on the heap. Vectors are to slices 
+later). Vectors always allocate their data on the heap. Vectors are to slices
 what `String` is to `&str`. You can create them with the `vec!` macro:
 
 ```{rust}
diff --git a/src/doc/trpl/crates-and-modules.md b/src/doc/trpl/crates-and-modules.md
index 8eaad5067f0..f6f6046b9b4 100644
--- a/src/doc/trpl/crates-and-modules.md
+++ b/src/doc/trpl/crates-and-modules.md
@@ -551,9 +551,9 @@ module, we now have a `phrases::japanese::hello()` function and a
 `phrases::japanese::farewells::goodbye()`. Our internal organization doesn't
 define our external interface.
 
-Here we have a `pub use` for each function we want to bring into the 
+Here we have a `pub use` for each function we want to bring into the
 `japanese` scope. We could alternatively use the wildcard syntax to include
-everything from `greetings` into the current scope: `pub use self::greetings::*`. 
+everything from `greetings` into the current scope: `pub use self::greetings::*`.
 
 What about the `self`? Well, by default, `use` declarations are absolute paths,
 starting from your crate root. `self` makes that path relative to your current
diff --git a/src/doc/trpl/documentation.md b/src/doc/trpl/documentation.md
index 0553fe3280c..8e5b3b6a7f0 100644
--- a/src/doc/trpl/documentation.md
+++ b/src/doc/trpl/documentation.md
@@ -306,23 +306,23 @@ println!("{}", x + y);
 Here's the same explanation, in raw text:
 
 > First, we set `x` to five:
-> 
+>
 > ```text
 > let x = 5;
 > # let y = 6;
 > # println!("{}", x + y);
 > ```
-> 
+>
 > Next, we set `y` to six:
-> 
+>
 > ```text
 > # let x = 5;
 > let y = 6;
 > # println!("{}", x + y);
 > ```
-> 
+>
 > Finally, we print the sum of `x` and `y`:
-> 
+>
 > ```text
 > # let x = 5;
 > # let y = 6;
@@ -521,4 +521,3 @@ This sets a few different options, with a logo, favicon, and a root URL.
 - `--html-before-content FILE`: includes the contents of FILE directly after
   `<body>`, before the rendered content (including the search bar).
 - `--html-after-content FILE`: includes the contents of FILE after all the rendered content.
-
diff --git a/src/doc/trpl/ffi.md b/src/doc/trpl/ffi.md
index 97e826579fd..20b0ffc1b28 100644
--- a/src/doc/trpl/ffi.md
+++ b/src/doc/trpl/ffi.md
@@ -543,4 +543,3 @@ The `extern` makes this function adhere to the C calling convention, as
 discussed above in "[Foreign Calling
 Conventions](ffi.html#foreign-calling-conventions)". The `no_mangle`
 attribute turns off Rust's name mangling, so that it is easier to link to.
-
diff --git a/src/doc/trpl/method-syntax.md b/src/doc/trpl/method-syntax.md
index 59be8c6704f..0ca42c3b12d 100644
--- a/src/doc/trpl/method-syntax.md
+++ b/src/doc/trpl/method-syntax.md
@@ -61,15 +61,15 @@ struct Circle {
 
 impl Circle {
     fn reference(&self) {
-       println!("taking self by reference!"); 
+       println!("taking self by reference!");
     }
 
     fn mutable_reference(&mut self) {
-       println!("taking self by mutable reference!"); 
+       println!("taking self by mutable reference!");
     }
 
     fn takes_ownership(self) {
-       println!("taking ownership of self!"); 
+       println!("taking ownership of self!");
     }
 }
 ```
diff --git a/src/doc/trpl/static-and-dynamic-dispatch.md b/src/doc/trpl/static-and-dynamic-dispatch.md
index 504ed63934c..a7794814156 100644
--- a/src/doc/trpl/static-and-dynamic-dispatch.md
+++ b/src/doc/trpl/static-and-dynamic-dispatch.md
@@ -95,7 +95,7 @@ However, the common case is that it is more efficient to use static dispatch,
 and one can always have a thin statically-dispatched wrapper function that does
 a dynamic dispatch, but not vice versa, meaning static calls are more flexible.
 The standard library tries to be statically dispatched where possible for this
-reason. 
+reason.
 
 ## Dynamic dispatch
 
diff --git a/src/doc/trpl/testing.md b/src/doc/trpl/testing.md
index 54c74fdd3e2..537e100d7d8 100644
--- a/src/doc/trpl/testing.md
+++ b/src/doc/trpl/testing.md
@@ -1,7 +1,7 @@
 % Testing
 
 > Program testing can be a very effective way to show the presence of bugs, but
-> it is hopelessly inadequate for showing their absence. 
+> it is hopelessly inadequate for showing their absence.
 >
 > Edsger W. Dijkstra, "The Humble Programmer" (1972)
 
@@ -308,7 +308,7 @@ extern crate adder;
 #[test]
 fn it_works() {
     assert_eq!(4, adder::add_two(2));
-}   
+}
 ```
 
 This looks similar to our previous tests, but slightly different. We now have
diff --git a/src/etc/featureck.py b/src/etc/featureck.py
index ce972c91c81..86fa779cced 100644
--- a/src/etc/featureck.py
+++ b/src/etc/featureck.py
@@ -242,4 +242,3 @@ print
 for line in lines:
     print "* " + line
 print
-
diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py
index dbf27e88c14..4e489df7dd7 100755
--- a/src/etc/gdb_rust_pretty_printing.py
+++ b/src/etc/gdb_rust_pretty_printing.py
@@ -340,4 +340,4 @@ def extract_length_and_data_ptr_from_std_vec(vec_val):
     unique_ptr_val = vec_ptr_val[first_field(vec_ptr_val)]
     data_ptr = unique_ptr_val[first_field(unique_ptr_val)]
     assert data_ptr.type.code == gdb.TYPE_CODE_PTR
-    return (length, data_ptr)
\ No newline at end of file
+    return (length, data_ptr)
diff --git a/src/etc/mingw-fix-include/README.txt b/src/etc/mingw-fix-include/README.txt
index 876db17a248..e36e6abde91 100644
--- a/src/etc/mingw-fix-include/README.txt
+++ b/src/etc/mingw-fix-include/README.txt
@@ -1,6 +1,6 @@
 The purpose of these headers is to fix issues with mingw v4.0, as described in #9246.
 
-This works by adding this directory to GCC include search path before mingw system headers directories, 
+This works by adding this directory to GCC include search path before mingw system headers directories,
 so we can intercept their inclusions and add missing definitions without having to modify files in mingw/include.
 
 Once mingw fixes all 3 issues mentioned in #9246, this directory and all references to it from rust/mk/* may be removed.
diff --git a/src/etc/third-party/COPYING.RUNTIME b/src/etc/third-party/COPYING.RUNTIME
index e1b3c69c179..e86f7fb58a4 100644
--- a/src/etc/third-party/COPYING.RUNTIME
+++ b/src/etc/third-party/COPYING.RUNTIME
@@ -70,4 +70,3 @@ consistent with the licensing of the Independent Modules.
 The availability of this Exception does not imply any general
 presumption that third-party software is unaffected by the copyleft
 requirements of the license of GCC.
-
diff --git a/src/grammar/check.sh b/src/grammar/check.sh
index b5be3daa13e..b0628303b66 100755
--- a/src/grammar/check.sh
+++ b/src/grammar/check.sh
@@ -50,4 +50,3 @@ else
     printf "failed. $passed passed; $failed failed; $skipped skipped\n\n"
     exit 1
 fi
-
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs
index 748eb9dcb2f..8befb0579c3 100644
--- a/src/liballoc/arc.rs
+++ b/src/liballoc/arc.rs
@@ -94,7 +94,7 @@ use heap::deallocate;
 /// With simple pipes, without `Arc`, a copy would have to be made for each
 /// task.
 ///
-/// ```rust
+/// ```
 /// use std::sync::Arc;
 /// use std::thread;
 ///
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index 6d865d2bffa..50935e6404d 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -64,7 +64,7 @@ use core::raw::TraitObject;
 ///
 /// The following two examples are equivalent:
 ///
-/// ```rust
+/// ```
 /// #![feature(box_syntax)]
 /// use std::boxed::HEAP;
 ///
@@ -241,7 +241,7 @@ pub trait BoxAny {
     /// Returns the boxed value if it is of type `T`, or
     /// `Err(Self)` if it isn't.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn downcast<T: 'static>(self) -> Result<Box<T>, Self>;
+    fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>>;
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -264,6 +264,15 @@ impl BoxAny for Box<Any> {
     }
 }
 
+#[cfg(not(stage0))]
+#[stable(feature = "rust1", since = "1.0.0")]
+impl BoxAny for Box<Any+Send> {
+    #[inline]
+    fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> {
+        <Box<Any>>::downcast(self)
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: fmt::Display + ?Sized> fmt::Display for Box<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs
index 029d9d03835..fb858344b85 100644
--- a/src/libarena/lib.rs
+++ b/src/libarena/lib.rs
@@ -42,8 +42,9 @@ extern crate alloc;
 
 use std::cell::{Cell, RefCell};
 use std::cmp;
-use std::intrinsics::{TyDesc, get_tydesc};
 use std::intrinsics;
+#[cfg(stage0)] // SNAP 270a677
+use std::intrinsics::{get_tydesc, TyDesc};
 use std::marker;
 use std::mem;
 #[cfg(stage0)]
@@ -186,6 +187,27 @@ fn un_bitpack_tydesc_ptr(p: usize) -> (*const TyDesc, bool) {
     ((p & !1) as *const TyDesc, p & 1 == 1)
 }
 
+// HACK(eddyb) TyDesc replacement using a trait object vtable.
+// This could be replaced in the future with a custom DST layout,
+// or `&'static (drop_glue, size, align)` created by a `const fn`.
+#[cfg(not(stage0))] // SNAP 270a677
+struct TyDesc {
+    drop_glue: fn(*const i8),
+    size: usize,
+    align: usize
+}
+
+#[cfg(not(stage0))] // SNAP 270a677
+unsafe fn get_tydesc<T>() -> *const TyDesc {
+    use std::raw::TraitObject;
+
+    let ptr = &*(1 as *const T);
+
+    // Can use any trait that is implemented for all types.
+    let obj = mem::transmute::<&marker::MarkerTrait, TraitObject>(ptr);
+    obj.vtable as *const TyDesc
+}
+
 impl<'longer_than_self> Arena<'longer_than_self> {
     fn chunk_size(&self) -> usize {
         self.copy_head.borrow().capacity()
diff --git a/src/libbacktrace/Makefile.am b/src/libbacktrace/Makefile.am
index 6add85d7341..43728998292 100644
--- a/src/libbacktrace/Makefile.am
+++ b/src/libbacktrace/Makefile.am
@@ -6,12 +6,12 @@
 # met:
 
 #     (1) Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer. 
+#     notice, this list of conditions and the following disclaimer.
 
 #     (2) Redistributions in binary form must reproduce the above copyright
 #     notice, this list of conditions and the following disclaimer in
 #     the documentation and/or other materials provided with the
-#     distribution.  
+#     distribution.
 
 #     (3) The name of the author may not be used to
 #     endorse or promote products derived from this software without
diff --git a/src/libbacktrace/Makefile.in b/src/libbacktrace/Makefile.in
index 18c1ecaca54..93ccec2dbf9 100644
--- a/src/libbacktrace/Makefile.in
+++ b/src/libbacktrace/Makefile.in
@@ -23,12 +23,12 @@
 # met:
 
 #     (1) Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer. 
+#     notice, this list of conditions and the following disclaimer.
 
 #     (2) Redistributions in binary form must reproduce the above copyright
 #     notice, this list of conditions and the following disclaimer in
 #     the documentation and/or other materials provided with the
-#     distribution.  
+#     distribution.
 
 #     (3) The name of the author may not be used to
 #     endorse or promote products derived from this software without
@@ -117,10 +117,10 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libbacktrace_la_SOURCES) $(EXTRA_libbacktrace_la_SOURCES) \
 	$(btest_SOURCES)
-MULTISRCTOP = 
-MULTIBUILDTOP = 
-MULTIDIRS = 
-MULTISUBDIR = 
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
 MULTIDO = true
 MULTICLEAN = true
 ETAGS = etags
@@ -362,7 +362,7 @@ config.h: stamp-h1
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
 	@rm -f stamp-h1
 	cd $(top_builddir) && $(SHELL) ./config.status config.h
-$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
 	rm -f stamp-h1
 	touch $@
@@ -380,7 +380,7 @@ clean-noinstLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES) 
+libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES)
 	$(LINK)  $(libbacktrace_la_OBJECTS) $(libbacktrace_la_LIBADD) $(LIBS)
 
 clean-checkPROGRAMS:
@@ -391,7 +391,7 @@ clean-checkPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES) 
+btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES)
 	@rm -f btest$(EXEEXT)
 	$(btest_LINK) $(btest_OBJECTS) $(btest_LDADD) $(LIBS)
 
diff --git a/src/libbacktrace/alloc.c b/src/libbacktrace/alloc.c
index 37eca65349e..4aa85d050fd 100644
--- a/src/libbacktrace/alloc.c
+++ b/src/libbacktrace/alloc.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/atomic.c b/src/libbacktrace/atomic.c
index f139d74aa5f..b31fa64c798 100644
--- a/src/libbacktrace/atomic.c
+++ b/src/libbacktrace/atomic.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/backtrace-supported.h.in b/src/libbacktrace/backtrace-supported.h.in
index 901e3f72a43..28488167c4e 100644
--- a/src/libbacktrace/backtrace-supported.h.in
+++ b/src/libbacktrace/backtrace-supported.h.in
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/backtrace.c b/src/libbacktrace/backtrace.c
index cc3105c06cb..4b90357df5f 100644
--- a/src/libbacktrace/backtrace.c
+++ b/src/libbacktrace/backtrace.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/backtrace.h b/src/libbacktrace/backtrace.h
index 03b5479081d..3f77093f767 100644
--- a/src/libbacktrace/backtrace.h
+++ b/src/libbacktrace/backtrace.h
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/btest.c b/src/libbacktrace/btest.c
index 4b67c3d8bd0..a1818f1ef83 100644
--- a/src/libbacktrace/btest.c
+++ b/src/libbacktrace/btest.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
@@ -460,7 +460,7 @@ f23 (int f1line, int f2line)
 		       (unsigned int) bdata.index, j + 1);
 	      bdata.failed = 1;
 	    }
-	}      
+	}
 
       check ("test3", 0, all, f3line, "f23", &bdata.failed);
       check ("test3", 1, all, f2line, "f22", &bdata.failed);
diff --git a/src/libbacktrace/configure b/src/libbacktrace/configure
index 694b5d23c49..d5e08d93f6c 100755
--- a/src/libbacktrace/configure
+++ b/src/libbacktrace/configure
@@ -15153,4 +15153,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
-
diff --git a/src/libbacktrace/configure.ac b/src/libbacktrace/configure.ac
index 878bd2c1580..d661c7b2560 100644
--- a/src/libbacktrace/configure.ac
+++ b/src/libbacktrace/configure.ac
@@ -6,13 +6,13 @@
 # met:
 
 #     (1) Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer. 
+#     notice, this list of conditions and the following disclaimer.
 
 #     (2) Redistributions in binary form must reproduce the above copyright
 #     notice, this list of conditions and the following disclaimer in
 #     the documentation and/or other materials provided with the
-#     distribution.  
-    
+#     distribution.
+
 #     (3) The name of the author may not be used to
 #     endorse or promote products derived from this software without
 #     specific prior written permission.
diff --git a/src/libbacktrace/dwarf.c b/src/libbacktrace/dwarf.c
index ad52d73b752..5ecae711792 100644
--- a/src/libbacktrace/dwarf.c
+++ b/src/libbacktrace/dwarf.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
@@ -1241,7 +1241,7 @@ add_unit_ranges (struct backtrace_state *state, uintptr_t base_address,
 
 static int
 find_address_ranges (struct backtrace_state *state, uintptr_t base_address,
-		     struct dwarf_buf *unit_buf, 
+		     struct dwarf_buf *unit_buf,
 		     const unsigned char *dwarf_str, size_t dwarf_str_size,
 		     const unsigned char *dwarf_ranges,
 		     size_t dwarf_ranges_size,
@@ -1599,7 +1599,7 @@ read_line_header (struct backtrace_state *state, struct unit *u,
 
   if (!advance (line_buf, hdrlen))
     return 0;
-  
+
   hdr->min_insn_len = read_byte (&hdr_buf);
   if (hdr->version < 4)
     hdr->max_ops_per_insn = 1;
@@ -1608,7 +1608,7 @@ read_line_header (struct backtrace_state *state, struct unit *u,
 
   /* We don't care about default_is_stmt.  */
   read_byte (&hdr_buf);
-  
+
   hdr->line_base = read_sbyte (&hdr_buf);
   hdr->line_range = read_byte (&hdr_buf);
 
diff --git a/src/libbacktrace/elf.c b/src/libbacktrace/elf.c
index 6c5b179e90d..5fc74add05c 100644
--- a/src/libbacktrace/elf.c
+++ b/src/libbacktrace/elf.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/fileline.c b/src/libbacktrace/fileline.c
index bab5351cab3..f45cccff713 100644
--- a/src/libbacktrace/fileline.c
+++ b/src/libbacktrace/fileline.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/hashtab.h b/src/libbacktrace/hashtab.h
index 4bb65d6c7a2..3736622e677 100644
--- a/src/libbacktrace/hashtab.h
+++ b/src/libbacktrace/hashtab.h
@@ -1,4 +1,4 @@
-/* An expandable hash tables datatype.  
+/* An expandable hash tables datatype.
    Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2009, 2010
    Free Software Foundation, Inc.
    Contributed by Vladimir Makarov (vmakarov@cygnus.com).
@@ -61,7 +61,7 @@ typedef int (*htab_eq) (const void *, const void *);
 /* Cleanup function called whenever a live element is removed from
    the hash table.  */
 typedef void (*htab_del) (void *);
-  
+
 /* Function called by htab_traverse for each live element.  The first
    arg is the slot of the element (which can be passed to htab_clear_slot
    if desired), the second arg is the auxiliary pointer handed to
diff --git a/src/libbacktrace/internal.h b/src/libbacktrace/internal.h
index dd109db24ae..a13c775b628 100644
--- a/src/libbacktrace/internal.h
+++ b/src/libbacktrace/internal.h
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/ltmain.sh b/src/libbacktrace/ltmain.sh
index eaef55a5933..84f5be9249e 100644
--- a/src/libbacktrace/ltmain.sh
+++ b/src/libbacktrace/ltmain.sh
@@ -8633,4 +8633,3 @@ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
 # sh-indentation:2
 # End:
 # vi:sw=2
-
diff --git a/src/libbacktrace/mmap.c b/src/libbacktrace/mmap.c
index b530e382388..1c691b02e7c 100644
--- a/src/libbacktrace/mmap.c
+++ b/src/libbacktrace/mmap.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/mmapio.c b/src/libbacktrace/mmapio.c
index 72940b403a3..8b8f124da9a 100644
--- a/src/libbacktrace/mmapio.c
+++ b/src/libbacktrace/mmapio.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/nounwind.c b/src/libbacktrace/nounwind.c
index 0097966b422..f8fdbdc85ac 100644
--- a/src/libbacktrace/nounwind.c
+++ b/src/libbacktrace/nounwind.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/posix.c b/src/libbacktrace/posix.c
index dba9e525e08..7f1c35ab970 100644
--- a/src/libbacktrace/posix.c
+++ b/src/libbacktrace/posix.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/print.c b/src/libbacktrace/print.c
index bd224e6bf4d..70e347f62c2 100644
--- a/src/libbacktrace/print.c
+++ b/src/libbacktrace/print.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/read.c b/src/libbacktrace/read.c
index c618a50b36d..e373b61de2e 100644
--- a/src/libbacktrace/read.c
+++ b/src/libbacktrace/read.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/simple.c b/src/libbacktrace/simple.c
index efa8b6fc639..dd70f831de7 100644
--- a/src/libbacktrace/simple.c
+++ b/src/libbacktrace/simple.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/state.c b/src/libbacktrace/state.c
index a7d4e07d1a5..bef47bd1a0f 100644
--- a/src/libbacktrace/state.c
+++ b/src/libbacktrace/state.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libbacktrace/unknown.c b/src/libbacktrace/unknown.c
index c1fe8811d47..e5e8421b3a9 100644
--- a/src/libbacktrace/unknown.c
+++ b/src/libbacktrace/unknown.c
@@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are
 met:
 
     (1) Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer. 
+    notice, this list of conditions and the following disclaimer.
 
     (2) Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
-    distribution.  
-    
+    distribution.
+
     (3) The name of the author may not be used to
     endorse or promote products derived from this software without
     specific prior written permission.
diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs
index 1dd463e0405..90fbe04d348 100644
--- a/src/libcollections/bit.rs
+++ b/src/libcollections/bit.rs
@@ -133,7 +133,7 @@ static FALSE: bool = false;
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::collections::BitVec;
 ///
 /// let mut bv = BitVec::from_elem(10, false);
diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs
index 5b799d3e5c0..4bedbdeb368 100644
--- a/src/libcollections/borrow.rs
+++ b/src/libcollections/borrow.rs
@@ -129,7 +129,7 @@ impl<T> ToOwned for T where T: Clone {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::borrow::Cow;
 ///
 /// fn abs_all(input: &mut Cow<[i32]>) {
diff --git a/src/libcollections/fmt.rs b/src/libcollections/fmt.rs
index bb7db1151e8..1deb08ad0d1 100644
--- a/src/libcollections/fmt.rs
+++ b/src/libcollections/fmt.rs
@@ -422,7 +422,7 @@ use string;
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::fmt;
 ///
 /// let s = fmt::format(format_args!("Hello, {}!", "world"));
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index dd9c2658744..4993994d46b 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -136,7 +136,7 @@ pub trait SliceExt {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut v = [5, 4, 1, 3, 2];
     /// v.sort_by(|a, b| a.cmp(b));
     /// assert!(v == [1, 2, 3, 4, 5]);
@@ -162,7 +162,7 @@ pub trait SliceExt {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut a = [1, 2, 3, 4, 5];
     /// let b = vec![6, 7, 8];
     /// let num_moved = a.move_from(b, 0, 3);
@@ -284,7 +284,7 @@ pub trait SliceExt {
     /// Print the adjacent pairs of a slice (i.e. `[1,2]`, `[2,3]`,
     /// `[3,4]`):
     ///
-    /// ```rust
+    /// ```
     /// let v = &[1, 2, 3, 4];
     /// for win in v.windows(2) {
     ///     println!("{:?}", win);
@@ -307,7 +307,7 @@ pub trait SliceExt {
     /// Print the slice two elements at a time (i.e. `[1,2]`,
     /// `[3,4]`, `[5]`):
     ///
-    /// ```rust
+    /// ```
     /// let v = &[1, 2, 3, 4, 5];
     /// for win in v.chunks(2) {
     ///     println!("{:?}", win);
@@ -398,7 +398,7 @@ pub trait SliceExt {
     /// uniquely determined position; the second and third are not
     /// found; the fourth could match any position in `[1,4]`.
     ///
-    /// ```rust
+    /// ```
     /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
     /// let s = s.as_slice();
     ///
@@ -533,7 +533,7 @@ pub trait SliceExt {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut v = ["a", "b", "c", "d"];
     /// v.swap(1, 3);
     /// assert!(v == ["a", "d", "c", "b"]);
@@ -553,7 +553,7 @@ pub trait SliceExt {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut v = [1, 2, 3, 4, 5, 6];
     ///
     /// // scoped to restrict the lifetime of the borrows
@@ -582,7 +582,7 @@ pub trait SliceExt {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut v = [1, 2, 3];
     /// v.reverse();
     /// assert!(v == [3, 2, 1]);
@@ -614,7 +614,7 @@ pub trait SliceExt {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let v = [1, 2, 3];
     /// let mut perms = v.permutations();
     ///
@@ -625,7 +625,7 @@ pub trait SliceExt {
     ///
     /// Iterating through permutations one by one.
     ///
-    /// ```rust
+    /// ```
     /// let v = [1, 2, 3];
     /// let mut perms = v.permutations();
     ///
@@ -642,7 +642,7 @@ pub trait SliceExt {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut dst = [0, 0, 0];
     /// let src = [1, 2];
     ///
@@ -662,7 +662,7 @@ pub trait SliceExt {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut v = [-5, 4, 1, -3, 2];
     ///
     /// v.sort();
@@ -684,7 +684,7 @@ pub trait SliceExt {
     /// uniquely determined position; the second and third are not
     /// found; the fourth could match any position in `[1,4]`.
     ///
-    /// ```rust
+    /// ```
     /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
     /// let s = s.as_slice();
     ///
@@ -711,7 +711,7 @@ pub trait SliceExt {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let v: &mut [_] = &mut [0, 1, 2];
     /// v.next_permutation();
     /// let b: &mut [_] = &mut [0, 2, 1];
@@ -731,7 +731,7 @@ pub trait SliceExt {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let v: &mut [_] = &mut [1, 0, 2];
     /// v.prev_permutation();
     /// let b: &mut [_] = &mut [0, 2, 1];
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index e92e340b86c..b2273646b95 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -911,7 +911,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// assert!("banana".ends_with("nana"));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index 9d178eb5413..d2bc98096f6 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -138,7 +138,7 @@ impl String {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::str::Utf8Error;
     ///
     /// let hello_vec = vec![104, 101, 108, 108, 111];
@@ -164,7 +164,7 @@ impl String {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let input = b"Hello \xF0\x90\x80World";
     /// let output = String::from_utf8_lossy(input);
     /// assert_eq!(output, "Hello \u{FFFD}World");
@@ -296,7 +296,7 @@ impl String {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// // 𝄞music
     /// let mut v = &mut [0xD834, 0xDD1E, 0x006d, 0x0075,
     ///                   0x0073, 0x0069, 0x0063];
@@ -324,7 +324,7 @@ impl String {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// // 𝄞mus<invalid>ic<invalid>
     /// let v = &[0xD834, 0xDD1E, 0x006d, 0x0075,
     ///           0x0073, 0xDD1E, 0x0069, 0x0063,
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index 3bd57cc3624..404179bd484 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -633,7 +633,7 @@ impl<T> Vec<T> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut vec = vec!(1, 2);
     /// vec.push(3);
     /// assert_eq!(vec, [1, 2, 3]);
@@ -671,7 +671,7 @@ impl<T> Vec<T> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let mut vec = vec![1, 2, 3];
     /// assert_eq!(vec.pop(), Some(3));
     /// assert_eq!(vec, [1, 2]);
diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs
index 95d43fa8fc0..aefcad49a58 100644
--- a/src/libcollections/vec_deque.rs
+++ b/src/libcollections/vec_deque.rs
@@ -201,7 +201,7 @@ impl<T> VecDeque<T> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::collections::VecDeque;
     ///
     /// let mut buf = VecDeque::new();
@@ -224,7 +224,7 @@ impl<T> VecDeque<T> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::collections::VecDeque;
     ///
     /// let mut buf = VecDeque::new();
@@ -258,7 +258,7 @@ impl<T> VecDeque<T> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::collections::VecDeque;
     ///
     /// let mut buf = VecDeque::new();
@@ -513,7 +513,7 @@ impl<T> VecDeque<T> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::collections::VecDeque;
     ///
     /// let mut buf = VecDeque::new();
@@ -536,7 +536,7 @@ impl<T> VecDeque<T> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::collections::VecDeque;
     ///
     /// let mut buf = VecDeque::new();
@@ -824,7 +824,7 @@ impl<T> VecDeque<T> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::collections::VecDeque;
     ///
     /// let mut buf = VecDeque::new();
@@ -849,7 +849,7 @@ impl<T> VecDeque<T> {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::collections::VecDeque;
     ///
     /// let mut buf = VecDeque::new();
@@ -949,7 +949,7 @@ impl<T> VecDeque<T> {
     /// Panics if `i` is greater than ringbuf's length
     ///
     /// # Examples
-    /// ```rust
+    /// ```
     /// use std::collections::VecDeque;
     ///
     /// let mut buf = VecDeque::new();
@@ -1151,7 +1151,7 @@ impl<T> VecDeque<T> {
     /// Returns `None` if `i` is out of bounds.
     ///
     /// # Examples
-    /// ```rust
+    /// ```
     /// use std::collections::VecDeque;
     ///
     /// let mut buf = VecDeque::new();
diff --git a/src/libcore/any.rs b/src/libcore/any.rs
index 462b6771b4a..6d3fac4c68d 100644
--- a/src/libcore/any.rs
+++ b/src/libcore/any.rs
@@ -71,6 +71,7 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
+use marker::Send;
 use mem::transmute;
 use option::Option::{self, Some, None};
 use raw::TraitObject;
@@ -154,6 +155,31 @@ impl Any {
     }
 }
 
+#[cfg(not(stage0))]
+impl Any+Send {
+    /// Forwards to the method defined on the type `Any`.
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[inline]
+    pub fn is<T: 'static>(&self) -> bool {
+        Any::is::<T>(self)
+    }
+
+    /// Forwards to the method defined on the type `Any`.
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[inline]
+    pub fn downcast_ref<T: 'static>(&self) -> Option<&T> {
+        Any::downcast_ref::<T>(self)
+    }
+
+    /// Forwards to the method defined on the type `Any`.
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[inline]
+    pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> {
+        Any::downcast_mut::<T>(self)
+    }
+}
+
+
 ///////////////////////////////////////////////////////////////////////////////
 // TypeID and its methods
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/libcore/default.rs b/src/libcore/default.rs
index 7f46d9cbe50..910cf805f39 100644
--- a/src/libcore/default.rs
+++ b/src/libcore/default.rs
@@ -164,4 +164,3 @@ default_impl! { i64, 0 }
 
 default_impl! { f32, 0.0f32 }
 default_impl! { f64, 0.0f64 }
-
diff --git a/src/libcore/finally.rs b/src/libcore/finally.rs
index 74806e52d26..19cd34cdb09 100644
--- a/src/libcore/finally.rs
+++ b/src/libcore/finally.rs
@@ -107,4 +107,3 @@ impl<'a, A, F> Drop for Finallyalizer<'a, A, F> where F: FnMut(&mut A) {
         (self.dtor)(self.mutate);
     }
 }
-
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index 7fccb93f2a0..ead5da92bd9 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -44,10 +44,12 @@
 
 use marker::Sized;
 
+#[cfg(stage0)] // SNAP 270a677
 pub type GlueFn = extern "Rust" fn(*const i8);
 
 #[lang="ty_desc"]
 #[derive(Copy)]
+#[cfg(stage0)] // SNAP 270a677
 pub struct TyDesc {
     // sizeof(T)
     pub size: usize,
@@ -197,8 +199,13 @@ extern "rust-intrinsic" {
     pub fn pref_align_of<T>() -> usize;
 
     /// Get a static pointer to a type descriptor.
+    #[cfg(stage0)] // SNAP 270a677
     pub fn get_tydesc<T: ?Sized>() -> *const TyDesc;
 
+    /// Gets a static string slice containing the name of a type.
+    #[cfg(not(stage0))] // SNAP 270a677
+    pub fn type_name<T: ?Sized>() -> &'static str;
+
     /// Gets an identifier which is globally unique to the specified type. This
     /// function will return the same value for a type regardless of whichever
     /// crate it is invoked in.
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index 6575bac501f..6dcae9879a0 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -216,7 +216,7 @@ macro_rules! writeln {
 ///
 /// Match arms:
 ///
-/// ```rust
+/// ```
 /// fn foo(x: Option<int>) {
 ///     match x {
 ///         Some(n) if n >= 0 => println!("Some(Non-negative)"),
@@ -229,7 +229,7 @@ macro_rules! writeln {
 ///
 /// Iterators:
 ///
-/// ```rust
+/// ```
 /// fn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3
 ///     for i in std::iter::count(0, 1) {
 ///         if 3*i < i { panic!("u32 overflow"); }
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index d596a06709c..1b866501b8e 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -310,7 +310,7 @@ impl<T:?Sized> MarkerTrait for T { }
 ///
 /// Therefore, we can model a method like this as follows:
 ///
-/// ```rust
+/// ```
 /// use std::marker::PhantomFn;
 /// trait Even : PhantomFn<Self> { }
 /// ```
@@ -318,7 +318,7 @@ impl<T:?Sized> MarkerTrait for T { }
 /// Another equivalent, but clearer, option would be to use
 /// `MarkerTrait`:
 ///
-/// ```rust
+/// ```
 /// use std::marker::MarkerTrait;
 /// trait Even : MarkerTrait { }
 /// ```
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index 2aa8ec0c548..551f97ead12 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -251,7 +251,7 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
 /// `self.buf`. But `replace` can be used to disassociate the original value of `self.buf` from
 /// `self`, allowing it to be returned:
 ///
-/// ```rust
+/// ```
 /// use std::mem;
 /// # struct Buffer<T> { buf: Vec<T> }
 /// impl<T> Buffer<T> {
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index 0d8e3044ecc..ae1b5f65eeb 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -281,7 +281,7 @@ impl Float for f32 {
 
     /// The fractional part of the number, satisfying:
     ///
-    /// ```rust
+    /// ```
     /// use core::num::Float;
     ///
     /// let x = 1.65f32;
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index d7e91058a46..4a73c1e8fcf 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -288,7 +288,7 @@ impl Float for f64 {
 
     /// The fractional part of the number, satisfying:
     ///
-    /// ```rust
+    /// ```
     /// use core::num::Float;
     ///
     /// let x = 1.65f64;
diff --git a/src/libcore/num/float_macros.rs b/src/libcore/num/float_macros.rs
index 20300d29fa0..b3adef53dab 100644
--- a/src/libcore/num/float_macros.rs
+++ b/src/libcore/num/float_macros.rs
@@ -18,4 +18,3 @@ macro_rules! assert_approx_eq {
                 "{} is not approximately equal to {}", *a, *b);
     })
 }
-
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 4381b1fb3c9..a77f9709600 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -84,7 +84,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// let n = 0b01001100u8;
@@ -99,7 +99,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// let n = 0b01001100u8;
@@ -118,7 +118,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// let n = 0b0101000u16;
@@ -134,7 +134,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// let n = 0b0101000u16;
@@ -150,7 +150,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// let n = 0x0123456789ABCDEFu64;
@@ -167,7 +167,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// let n = 0x0123456789ABCDEFu64;
@@ -183,7 +183,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// let n = 0x0123456789ABCDEFu64;
@@ -200,7 +200,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// let n = 0x0123456789ABCDEFu64;
@@ -223,7 +223,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// let n = 0x0123456789ABCDEFu64;
@@ -246,7 +246,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// let n = 0x0123456789ABCDEFu64;
@@ -269,7 +269,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// let n = 0x0123456789ABCDEFu64;
@@ -291,7 +291,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// assert_eq!(5u16.checked_add(65530), Some(65535));
@@ -305,7 +305,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// assert_eq!((-127i8).checked_sub(1), Some(-128));
@@ -319,7 +319,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// assert_eq!(5u8.checked_mul(51), Some(255));
@@ -333,7 +333,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// assert_eq!((-127i8).checked_div(-1), Some(127));
@@ -371,7 +371,7 @@ pub trait Int
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::num::Int;
     ///
     /// assert_eq!(2.pow(4), 16);
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs
index 077b44f2dd2..6324e8fa874 100644
--- a/src/libcore/ops.rs
+++ b/src/libcore/ops.rs
@@ -78,7 +78,7 @@ use fmt;
 /// A trivial implementation of `Drop`. The `drop` method is called when `_x` goes
 /// out of scope, and therefore `main` prints `Dropping!`.
 ///
-/// ```rust
+/// ```
 /// struct HasDrop;
 ///
 /// impl Drop for HasDrop {
@@ -162,7 +162,7 @@ macro_rules! forward_ref_binop {
 /// A trivial implementation of `Add`. When `Foo + Foo` happens, it ends up
 /// calling `add`, and therefore, `main` prints `Adding!`.
 ///
-/// ```rust
+/// ```
 /// use std::ops::Add;
 ///
 /// #[derive(Copy)]
@@ -216,7 +216,7 @@ add_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
 /// A trivial implementation of `Sub`. When `Foo - Foo` happens, it ends up
 /// calling `sub`, and therefore, `main` prints `Subtracting!`.
 ///
-/// ```rust
+/// ```
 /// use std::ops::Sub;
 ///
 /// #[derive(Copy)]
@@ -270,7 +270,7 @@ sub_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
 /// A trivial implementation of `Mul`. When `Foo * Foo` happens, it ends up
 /// calling `mul`, and therefore, `main` prints `Multiplying!`.
 ///
-/// ```rust
+/// ```
 /// use std::ops::Mul;
 ///
 /// #[derive(Copy)]
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 2dd8bf67220..455c68d4319 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -897,7 +897,7 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
     /// Here is an example which increments every integer in a vector,
     /// checking for overflow:
     ///
-    /// ```rust
+    /// ```
     /// use std::u16;
     ///
     /// let v = vec!(1, 2);
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index 9fba9a4d8ec..fee8caa04c4 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -896,7 +896,7 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
     /// Here is an example which increments every integer in a vector,
     /// checking for overflow:
     ///
-    /// ```rust
+    /// ```
     /// use std::u32;
     ///
     /// let v = vec!(1, 2);
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index c8a8dd88501..b1576c0d377 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -1449,7 +1449,7 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::slice;
 ///
 /// // manifest a slice out of thin air!
@@ -1492,7 +1492,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: usize) -> &'a mut [T] {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::slice;
 ///
 /// // manifest a slice out of thin air!
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 3873f305b42..bd46b093b76 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -140,7 +140,7 @@ impl FromStr for bool {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::str::FromStr;
     ///
     /// assert_eq!(FromStr::from_str("true"), Ok(true));
@@ -151,7 +151,7 @@ impl FromStr for bool {
     /// Note, in many cases, the StrExt::parse() which is based on
     /// this FromStr::from_str() is more proper.
     ///
-    /// ```rust
+    /// ```
     /// assert_eq!("true".parse(), Ok(true));
     /// assert_eq!("false".parse(), Ok(false));
     /// assert!("not even a boolean".parse::<bool>().is_err());
@@ -1186,7 +1186,7 @@ mod traits {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let s = "Löwe 老虎 Léopard";
     /// assert_eq!(&s[0 .. 1], "L");
     ///
diff --git a/src/libcoretest/intrinsics.rs b/src/libcoretest/intrinsics.rs
index b836f5f3f69..c99fb8c197d 100644
--- a/src/libcoretest/intrinsics.rs
+++ b/src/libcoretest/intrinsics.rs
@@ -28,4 +28,3 @@ fn test_typeid_unsized_types() {
     assert_eq!(TypeId::of::<Y>(), TypeId::of::<Y>());
     assert!(TypeId::of::<X>() != TypeId::of::<Y>());
 }
-
diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs
index 100a9e36e86..695c71c73ed 100644
--- a/src/libflate/lib.rs
+++ b/src/libflate/lib.rs
@@ -25,7 +25,6 @@
        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
        html_root_url = "http://doc.rust-lang.org/nightly/")]
 
-#![feature(int_uint)]
 #![feature(libc)]
 #![feature(staged_api)]
 #![feature(unique)]
@@ -35,13 +34,33 @@
 extern crate libc;
 
 use libc::{c_void, size_t, c_int};
+use std::fmt;
 use std::ops::Deref;
 use std::ptr::Unique;
 use std::slice;
 
+#[derive(Clone, Eq, Hash, Ord, PartialEq, PartialOrd)]
+pub struct Error {
+    _unused: (),
+}
+
+impl Error {
+    fn new() -> Error {
+        Error {
+            _unused: (),
+        }
+    }
+}
+
+impl fmt::Debug for Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        "decompression error".fmt(f)
+    }
+}
+
 pub struct Bytes {
     ptr: Unique<u8>,
-    len: uint,
+    len: usize,
 }
 
 impl Deref for Bytes {
@@ -78,55 +97,56 @@ const LZ_NORM: c_int = 0x80;  // LZ with 128 probes, "normal"
 const TINFL_FLAG_PARSE_ZLIB_HEADER: c_int = 0x1; // parse zlib header and adler32 checksum
 const TDEFL_WRITE_ZLIB_HEADER: c_int = 0x01000; // write zlib header and adler32 checksum
 
-fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option<Bytes> {
+fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> Bytes {
     unsafe {
-        let mut outsz : size_t = 0;
+        let mut outsz: size_t = 0;
         let res = tdefl_compress_mem_to_heap(bytes.as_ptr() as *const _,
                                              bytes.len() as size_t,
                                              &mut outsz,
                                              flags);
-        if !res.is_null() {
-            let res = Unique::new(res as *mut u8);
-            Some(Bytes { ptr: res, len: outsz as uint })
-        } else {
-            None
+        assert!(!res.is_null());
+        Bytes {
+            ptr: Unique::new(res as *mut u8),
+            len: outsz as usize,
         }
     }
 }
 
 /// Compress a buffer, without writing any sort of header on the output.
-pub fn deflate_bytes(bytes: &[u8]) -> Option<Bytes> {
+pub fn deflate_bytes(bytes: &[u8]) -> Bytes {
     deflate_bytes_internal(bytes, LZ_NORM)
 }
 
 /// Compress a buffer, using a header that zlib can understand.
-pub fn deflate_bytes_zlib(bytes: &[u8]) -> Option<Bytes> {
+pub fn deflate_bytes_zlib(bytes: &[u8]) -> Bytes {
     deflate_bytes_internal(bytes, LZ_NORM | TDEFL_WRITE_ZLIB_HEADER)
 }
 
-fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option<Bytes> {
+fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Result<Bytes,Error> {
     unsafe {
-        let mut outsz : size_t = 0;
+        let mut outsz: size_t = 0;
         let res = tinfl_decompress_mem_to_heap(bytes.as_ptr() as *const _,
                                                bytes.len() as size_t,
                                                &mut outsz,
                                                flags);
         if !res.is_null() {
-            let res = Unique::new(res as *mut u8);
-            Some(Bytes { ptr: res, len: outsz as uint })
+            Ok(Bytes {
+                ptr: Unique::new(res as *mut u8),
+                len: outsz as usize,
+            })
         } else {
-            None
+            Err(Error::new())
         }
     }
 }
 
 /// Decompress a buffer, without parsing any sort of header on the input.
-pub fn inflate_bytes(bytes: &[u8]) -> Option<Bytes> {
+pub fn inflate_bytes(bytes: &[u8]) -> Result<Bytes,Error> {
     inflate_bytes_internal(bytes, 0)
 }
 
 /// Decompress a buffer that starts with a zlib header.
-pub fn inflate_bytes_zlib(bytes: &[u8]) -> Option<Bytes> {
+pub fn inflate_bytes_zlib(bytes: &[u8]) -> Result<Bytes,Error> {
     inflate_bytes_internal(bytes, TINFL_FLAG_PARSE_ZLIB_HEADER)
 }
 
@@ -140,7 +160,7 @@ mod tests {
     #[test]
     fn test_flate_round_trip() {
         let mut r = rand::thread_rng();
-        let mut words = vec!();
+        let mut words = vec![];
         for _ in 0..20 {
             let range = r.gen_range(1, 10);
             let v = r.gen_iter::<u8>().take(range).collect::<Vec<u8>>();
@@ -153,8 +173,8 @@ mod tests {
             }
             debug!("de/inflate of {} bytes of random word-sequences",
                    input.len());
-            let cmp = deflate_bytes(&input).expect("deflation failed");
-            let out = inflate_bytes(&cmp).expect("inflation failed");
+            let cmp = deflate_bytes(&input);
+            let out = inflate_bytes(&cmp).unwrap();
             debug!("{} bytes deflated to {} ({:.1}% size)",
                    input.len(), cmp.len(),
                    100.0 * ((cmp.len() as f64) / (input.len() as f64)));
@@ -164,9 +184,9 @@ mod tests {
 
     #[test]
     fn test_zlib_flate() {
-        let bytes = vec!(1, 2, 3, 4, 5);
-        let deflated = deflate_bytes(&bytes).expect("deflation failed");
-        let inflated = inflate_bytes(&deflated).expect("inflation failed");
+        let bytes = vec![1, 2, 3, 4, 5];
+        let deflated = deflate_bytes(&bytes);
+        let inflated = inflate_bytes(&deflated).unwrap();
         assert_eq!(&*inflated, &*bytes);
     }
 }
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs
index 11aba40afad..82c54004e99 100644
--- a/src/liblibc/lib.rs
+++ b/src/liblibc/lib.rs
@@ -3298,7 +3298,7 @@ pub mod consts {
             pub const MAP_DENYWRITE : c_int = 0x0800;
             pub const MAP_EXECUTABLE : c_int = 0x01000;
             pub const MAP_LOCKED : c_int = 0x02000;
-            pub const MAP_NONRESERVE : c_int = 0x04000;
+            pub const MAP_NORESERVE : c_int = 0x04000;
             pub const MAP_POPULATE : c_int = 0x08000;
             pub const MAP_NONBLOCK : c_int = 0x010000;
             pub const MAP_STACK : c_int = 0x020000;
@@ -3325,7 +3325,7 @@ pub mod consts {
             pub const MAP_DENYWRITE : c_int = 0x02000;
             pub const MAP_EXECUTABLE : c_int = 0x04000;
             pub const MAP_LOCKED : c_int = 0x08000;
-            pub const MAP_NONRESERVE : c_int = 0x0400;
+            pub const MAP_NORESERVE : c_int = 0x0400;
             pub const MAP_POPULATE : c_int = 0x010000;
             pub const MAP_NONBLOCK : c_int = 0x020000;
             pub const MAP_STACK : c_int = 0x040000;
diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs
index b03d77db4ec..c634a46888e 100644
--- a/src/liblog/lib.rs
+++ b/src/liblog/lib.rs
@@ -175,7 +175,6 @@
 #![feature(int_uint)]
 #![feature(core)]
 #![feature(std_misc)]
-#![feature(io)]
 
 use std::boxed;
 use std::cell::RefCell;
diff --git a/src/liblog/macros.rs b/src/liblog/macros.rs
index 1aee6e0be2e..80eb1601035 100644
--- a/src/liblog/macros.rs
+++ b/src/liblog/macros.rs
@@ -197,4 +197,3 @@ macro_rules! log_enabled {
         ::log::mod_enabled(lvl, module_path!())
     })
 }
-
diff --git a/src/librand/distributions/exponential.rs b/src/librand/distributions/exponential.rs
index 6820d9c5c48..3180f03cfd3 100644
--- a/src/librand/distributions/exponential.rs
+++ b/src/librand/distributions/exponential.rs
@@ -59,7 +59,7 @@ impl Rand for Exp1 {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand;
 /// use std::rand::distributions::{Exp, IndependentSample};
 ///
diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs
index 6659bf0f3ee..8eaac203fb4 100644
--- a/src/librand/distributions/gamma.rs
+++ b/src/librand/distributions/gamma.rs
@@ -39,7 +39,7 @@ use super::{IndependentSample, Sample, Exp};
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand;
 /// use std::rand::distributions::{IndependentSample, Gamma};
 ///
@@ -186,7 +186,7 @@ impl IndependentSample<f64> for GammaLargeShape {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand;
 /// use std::rand::distributions::{ChiSquared, IndependentSample};
 ///
@@ -243,7 +243,7 @@ impl IndependentSample<f64> for ChiSquared {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand;
 /// use std::rand::distributions::{FisherF, IndependentSample};
 ///
@@ -287,7 +287,7 @@ impl IndependentSample<f64> for FisherF {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand;
 /// use std::rand::distributions::{StudentT, IndependentSample};
 ///
diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs
index 47bc2f5a113..a46709932e2 100644
--- a/src/librand/distributions/mod.rs
+++ b/src/librand/distributions/mod.rs
@@ -93,7 +93,7 @@ pub struct Weighted<T> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand;
 /// use std::rand::distributions::{Weighted, WeightedChoice, IndependentSample};
 ///
diff --git a/src/librand/distributions/normal.rs b/src/librand/distributions/normal.rs
index aeca477fb94..d07964624bf 100644
--- a/src/librand/distributions/normal.rs
+++ b/src/librand/distributions/normal.rs
@@ -75,7 +75,7 @@ impl Rand for StandardNormal {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand;
 /// use std::rand::distributions::{Normal, IndependentSample};
 ///
@@ -123,7 +123,7 @@ impl IndependentSample<f64> for Normal {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand;
 /// use std::rand::distributions::{LogNormal, IndependentSample};
 ///
diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs
index 9a2576a87fc..4086e149e78 100644
--- a/src/librand/distributions/range.rs
+++ b/src/librand/distributions/range.rs
@@ -35,7 +35,7 @@ use distributions::{Sample, IndependentSample};
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand::distributions::{IndependentSample, Range};
 ///
 /// fn main() {
diff --git a/src/librand/lib.rs b/src/librand/lib.rs
index c5ff8ffe457..5e52a176c9e 100644
--- a/src/librand/lib.rs
+++ b/src/librand/lib.rs
@@ -148,7 +148,7 @@ pub trait Rng : Sized {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::rand::{thread_rng, Rng};
     ///
     /// let mut v = [0; 13579];
@@ -183,7 +183,7 @@ pub trait Rng : Sized {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::rand::{thread_rng, Rng};
     ///
     /// let mut rng = thread_rng();
@@ -228,7 +228,7 @@ pub trait Rng : Sized {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::rand::{thread_rng, Rng};
     ///
     /// let mut rng = thread_rng();
@@ -246,7 +246,7 @@ pub trait Rng : Sized {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::rand::{thread_rng, Rng};
     ///
     /// let mut rng = thread_rng();
@@ -260,7 +260,7 @@ pub trait Rng : Sized {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::rand::{thread_rng, Rng};
     ///
     /// let s: String = thread_rng().gen_ascii_chars().take(10).collect();
@@ -296,7 +296,7 @@ pub trait Rng : Sized {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::rand::{thread_rng, Rng};
     ///
     /// let mut rng = thread_rng();
@@ -359,7 +359,7 @@ pub trait SeedableRng<Seed>: Rng {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::rand::{Rng, SeedableRng, StdRng};
     ///
     /// let seed: &[_] = &[1, 2, 3, 4];
@@ -374,7 +374,7 @@ pub trait SeedableRng<Seed>: Rng {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::rand::{Rng, SeedableRng, StdRng};
     ///
     /// let seed: &[_] = &[1, 2, 3, 4];
@@ -478,7 +478,8 @@ impl Rand for XorShiftRng {
 /// `[0,1)`.
 ///
 /// # Examples
-/// ```rust
+///
+/// ```
 /// use std::rand::{random, Open01};
 ///
 /// let Open01(val) = random::<Open01<f32>>();
@@ -495,7 +496,7 @@ pub struct Open01<F>(pub F);
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand::{random, Closed01};
 ///
 /// let Closed01(val) = random::<Closed01<f32>>();
diff --git a/src/librand/reseeding.rs b/src/librand/reseeding.rs
index f39021d4a5f..81e65da37fc 100644
--- a/src/librand/reseeding.rs
+++ b/src/librand/reseeding.rs
@@ -102,7 +102,7 @@ impl<S, R: SeedableRng<S>, Rsdr: Reseeder<R> + Default>
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand::{Rng, SeedableRng, StdRng};
 /// use std::rand::reseeding::{Reseeder, ReseedingRng};
 ///
diff --git a/src/librustc/README.txt b/src/librustc/README.txt
index 37097764f71..9b364768208 100644
--- a/src/librustc/README.txt
+++ b/src/librustc/README.txt
@@ -40,7 +40,7 @@ crates is preferable):
   driver that orchestrates all the other passes and various other bits
   of miscellany. In general it contains code that runs towards the
   end of the compilation process.
-  
+
 Roughly speaking the "order" of the three crates is as follows:
 
     libsyntax -> librustc -> librustc_trans
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs
index 133bef30e40..70303bb3410 100644
--- a/src/librustc/diagnostics.rs
+++ b/src/librustc/diagnostics.rs
@@ -132,4 +132,3 @@ register_diagnostics! {
 }
 
 __build_diagnostic_array! { DIAGNOSTICS }
-
diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs
index 8486bf782b0..e466dc8a3a0 100644
--- a/src/librustc/metadata/loader.rs
+++ b/src/librustc/metadata/loader.rs
@@ -784,8 +784,8 @@ fn get_metadata_section_imp(is_osx: bool, filename: &Path) -> Result<MetadataBlo
                        csz - vlen);
                 let bytes = slice::from_raw_parts(cvbuf1, csz - vlen);
                 match flate::inflate_bytes(bytes) {
-                    Some(inflated) => return Ok(MetadataVec(inflated)),
-                    None => {}
+                    Ok(inflated) => return Ok(MetadataVec(inflated)),
+                    Err(_) => {}
                 }
             }
             llvm::LLVMMoveToNextSection(si.llsi);
diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs
index b33839f33e8..d1a946d933f 100644
--- a/src/librustc/metadata/tydecode.rs
+++ b/src/librustc/metadata/tydecode.rs
@@ -963,4 +963,3 @@ fn parse_region_bounds_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F)
         }
     }
 }
-
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index ed1d876d836..f705cc8ed99 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -1102,6 +1102,11 @@ impl<'a, 'tcx> rbml_writer_helpers<'tcx> for Encoder<'a> {
                         this.emit_enum_variant_arg(1, |this| Ok(this.emit_ty(ecx, self_ty)))
                     })
                 }
+                ty::UnsizeUpcast(target_ty) => {
+                    this.emit_enum_variant("UnsizeUpcast", 3, 1, |this| {
+                        this.emit_enum_variant_arg(0, |this| Ok(this.emit_ty(ecx, target_ty)))
+                    })
+                }
             }
         });
     }
@@ -1707,7 +1712,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
     fn read_unsize_kind<'b, 'c>(&mut self, dcx: &DecodeContext<'b, 'c, 'tcx>)
                                 -> ty::UnsizeKind<'tcx> {
         self.read_enum("UnsizeKind", |this| {
-            let variants = &["UnsizeLength", "UnsizeStruct", "UnsizeVtable"];
+            let variants = &["UnsizeLength", "UnsizeStruct", "UnsizeVtable", "UnsizeUpcast"];
             this.read_enum_variant(variants, |this, i| {
                 Ok(match i {
                     0 => {
@@ -1741,6 +1746,11 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
                             this.read_enum_variant_arg(1, |this| Ok(this.read_ty(dcx))).unwrap();
                         ty::UnsizeVtable(ty_trait, self_ty)
                     }
+                    3 => {
+                        let target_ty =
+                            this.read_enum_variant_arg(0, |this| Ok(this.read_ty(dcx))).unwrap();
+                        ty::UnsizeUpcast(target_ty)
+                    }
                     _ => panic!("bad enum variant for ty::UnsizeKind")
                 })
             })
diff --git a/src/librustc/middle/cfg/graphviz.rs b/src/librustc/middle/cfg/graphviz.rs
index 0c5eca3c129..ac6524dad80 100644
--- a/src/librustc/middle/cfg/graphviz.rs
+++ b/src/librustc/middle/cfg/graphviz.rs
@@ -124,4 +124,3 @@ impl<'a, 'ast> dot::GraphWalk<'a, Node<'a>, Edge<'a>> for LabelledCFG<'a, 'ast>
     fn source(&'a self, edge: &Edge<'a>) -> Node<'a> { self.cfg.source(edge) }
     fn target(&'a self, edge: &Edge<'a>) -> Node<'a> { self.cfg.target(edge) }
 }
-
diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs
index a1e38a1c8bd..c0d51f5675c 100644
--- a/src/librustc/middle/expr_use_visitor.rs
+++ b/src/librustc/middle/expr_use_visitor.rs
@@ -857,28 +857,13 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
                     n: uint) {
         debug!("walk_autoref expr={}", expr.repr(self.tcx()));
 
-        // Match for unique trait coercions first, since we don't need the
-        // call to cat_expr_autoderefd.
-        match *autoref {
-            ty::AutoUnsizeUniq(ty::UnsizeVtable(..)) |
-            ty::AutoUnsize(ty::UnsizeVtable(..)) => {
-                assert!(n == 1, format!("Expected exactly 1 deref with Uniq \
-                                         AutoRefs, found: {}", n));
-                let cmt_unadjusted =
-                    return_if_err!(self.mc.cat_expr_unadjusted(expr));
-                self.delegate_consume(expr.id, expr.span, cmt_unadjusted);
-                return;
-            }
-            _ => {}
-        }
-
-        let cmt_derefd = return_if_err!(
-            self.mc.cat_expr_autoderefd(expr, n));
-        debug!("walk_adjustment: cmt_derefd={}",
-               cmt_derefd.repr(self.tcx()));
-
         match *autoref {
             ty::AutoPtr(r, m, _) => {
+                let cmt_derefd = return_if_err!(
+                    self.mc.cat_expr_autoderefd(expr, n));
+                debug!("walk_adjustment: cmt_derefd={}",
+                       cmt_derefd.repr(self.tcx()));
+
                 self.delegate.borrow(expr.id,
                                      expr.span,
                                      cmt_derefd,
@@ -886,7 +871,16 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
                                      ty::BorrowKind::from_mutbl(m),
                                      AutoRef);
             }
-            ty::AutoUnsizeUniq(_) | ty::AutoUnsize(_) | ty::AutoUnsafe(..) => {}
+            ty::AutoUnsize(_) |
+            ty::AutoUnsizeUniq(_) => {
+                assert!(n == 1, format!("Expected exactly 1 deref with Uniq \
+                                         AutoRefs, found: {}", n));
+                let cmt_unadjusted =
+                    return_if_err!(self.mc.cat_expr_unadjusted(expr));
+                self.delegate_consume(expr.id, expr.span, cmt_unadjusted);
+            }
+            ty::AutoUnsafe(..) => {
+            }
         }
     }
 
diff --git a/src/librustc/middle/fast_reject.rs b/src/librustc/middle/fast_reject.rs
index 063845c6c34..f9bdc5dc313 100644
--- a/src/librustc/middle/fast_reject.rs
+++ b/src/librustc/middle/fast_reject.rs
@@ -96,4 +96,3 @@ pub fn simplify_type(tcx: &ty::ctxt,
         ty::ty_infer(_) | ty::ty_err => None,
     }
 }
-
diff --git a/src/librustc/middle/infer/combine.rs b/src/librustc/middle/infer/combine.rs
index 9add236d54b..438b61f918a 100644
--- a/src/librustc/middle/infer/combine.rs
+++ b/src/librustc/middle/infer/combine.rs
@@ -314,9 +314,18 @@ pub trait Combine<'tcx> : Sized {
     }
 
     fn builtin_bounds(&self,
-                      a: ty::BuiltinBounds,
-                      b: ty::BuiltinBounds)
-                      -> cres<'tcx, ty::BuiltinBounds>;
+                      a: BuiltinBounds,
+                      b: BuiltinBounds)
+                      -> cres<'tcx, BuiltinBounds>
+    {
+        // Two sets of builtin bounds are only relatable if they are
+        // precisely the same (but see the coercion code).
+        if a != b {
+            Err(ty::terr_builtin_bounds(expected_found(self, a, b)))
+        } else {
+            Ok(a)
+        }
+    }
 
     fn trait_refs(&self,
                   a: &ty::TraitRef<'tcx>,
diff --git a/src/librustc/middle/infer/equate.rs b/src/librustc/middle/infer/equate.rs
index 7194e20b0cf..2f9f8532b6c 100644
--- a/src/librustc/middle/infer/equate.rs
+++ b/src/librustc/middle/infer/equate.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::ty::{BuiltinBounds};
 use middle::ty::{self, Ty};
 use middle::ty::TyVar;
 use middle::infer::combine::*;
@@ -73,23 +72,6 @@ impl<'f, 'tcx> Combine<'tcx> for Equate<'f, 'tcx> {
         }
     }
 
-    fn builtin_bounds(&self,
-                      a: BuiltinBounds,
-                      b: BuiltinBounds)
-                      -> cres<'tcx, BuiltinBounds>
-    {
-        // More bounds is a subtype of fewer bounds.
-        //
-        // e.g., fn:Copy() <: fn(), because the former is a function
-        // that only closes over copyable things, but the latter is
-        // any function at all.
-        if a != b {
-            Err(ty::terr_builtin_bounds(expected_found(self, a, b)))
-        } else {
-            Ok(a)
-        }
-    }
-
     fn tys(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> cres<'tcx, Ty<'tcx>> {
         debug!("{}.tys({}, {})", self.tag(),
                a.repr(self.fields.infcx.tcx), b.repr(self.fields.infcx.tcx));
diff --git a/src/librustc/middle/infer/glb.rs b/src/librustc/middle/infer/glb.rs
index 33303808e84..ba073999ed1 100644
--- a/src/librustc/middle/infer/glb.rs
+++ b/src/librustc/middle/infer/glb.rs
@@ -14,7 +14,6 @@ use super::higher_ranked::HigherRankedRelations;
 use super::{cres};
 use super::Subtype;
 
-use middle::ty::{BuiltinBounds};
 use middle::ty::{self, Ty};
 use syntax::ast::{MutImmutable, MutMutable, Unsafety};
 use util::ppaux::mt_to_string;
@@ -94,15 +93,6 @@ impl<'f, 'tcx> Combine<'tcx> for Glb<'f, 'tcx> {
         }
     }
 
-    fn builtin_bounds(&self,
-                      a: ty::BuiltinBounds,
-                      b: ty::BuiltinBounds)
-                      -> cres<'tcx, ty::BuiltinBounds> {
-        // More bounds is a subtype of fewer bounds, so
-        // the GLB (mutual subtype) is the union.
-        Ok(a.union(b))
-    }
-
     fn regions(&self, a: ty::Region, b: ty::Region) -> cres<'tcx, ty::Region> {
         debug!("{}.regions({}, {})",
                self.tag(),
diff --git a/src/librustc/middle/infer/lub.rs b/src/librustc/middle/infer/lub.rs
index 3570effa9fa..37eace0b15b 100644
--- a/src/librustc/middle/infer/lub.rs
+++ b/src/librustc/middle/infer/lub.rs
@@ -14,7 +14,6 @@ use super::lattice::*;
 use super::{cres};
 use super::{Subtype};
 
-use middle::ty::{BuiltinBounds};
 use middle::ty::{self, Ty};
 use syntax::ast::{MutMutable, MutImmutable, Unsafety};
 use util::ppaux::mt_to_string;
@@ -89,15 +88,6 @@ impl<'f, 'tcx> Combine<'tcx> for Lub<'f, 'tcx> {
         }
     }
 
-    fn builtin_bounds(&self,
-                      a: ty::BuiltinBounds,
-                      b: ty::BuiltinBounds)
-                      -> cres<'tcx, ty::BuiltinBounds> {
-        // More bounds is a subtype of fewer bounds, so
-        // the LUB (mutual supertype) is the intersection.
-        Ok(a.intersection(b))
-    }
-
     fn regions(&self, a: ty::Region, b: ty::Region) -> cres<'tcx, ty::Region> {
         debug!("{}.regions({}, {})",
                self.tag(),
diff --git a/src/librustc/middle/infer/resolve.rs b/src/librustc/middle/infer/resolve.rs
index 547696c0c4c..b9025d01068 100644
--- a/src/librustc/middle/infer/resolve.rs
+++ b/src/librustc/middle/infer/resolve.rs
@@ -112,4 +112,3 @@ impl<'a, 'tcx> ty_fold::TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
         }
     }
 }
-
diff --git a/src/librustc/middle/infer/sub.rs b/src/librustc/middle/infer/sub.rs
index 33da3092b2a..8ab063686d4 100644
--- a/src/librustc/middle/infer/sub.rs
+++ b/src/librustc/middle/infer/sub.rs
@@ -14,7 +14,6 @@ use super::higher_ranked::HigherRankedRelations;
 use super::{Subtype};
 use super::type_variable::{SubtypeOf, SupertypeOf};
 
-use middle::ty::{BuiltinBounds};
 use middle::ty::{self, Ty};
 use middle::ty::TyVar;
 use util::ppaux::{Repr};
@@ -97,20 +96,6 @@ impl<'f, 'tcx> Combine<'tcx> for Sub<'f, 'tcx> {
         })
     }
 
-    fn builtin_bounds(&self, a: BuiltinBounds, b: BuiltinBounds)
-                      -> cres<'tcx, BuiltinBounds> {
-        // More bounds is a subtype of fewer bounds.
-        //
-        // e.g., fn:Copy() <: fn(), because the former is a function
-        // that only closes over copyable things, but the latter is
-        // any function at all.
-        if a.is_superset(&b) {
-            Ok(a)
-        } else {
-            Err(ty::terr_builtin_bounds(expected_found(self, a, b)))
-        }
-    }
-
     fn tys(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> cres<'tcx, Ty<'tcx>> {
         debug!("{}.tys({}, {})", self.tag(),
                a.repr(self.tcx()), b.repr(self.tcx()));
@@ -153,4 +138,3 @@ impl<'f, 'tcx> Combine<'tcx> for Sub<'f, 'tcx> {
         self.higher_ranked_sub(a, b)
     }
 }
-
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index 1ad4611dc9e..73d31a1f620 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -316,9 +316,6 @@ lets_do_this! {
 
     StartFnLangItem,                 "start",                   start_fn;
 
-    TyDescStructLangItem,            "ty_desc",                 ty_desc;
-    OpaqueStructLangItem,            "opaque",                  opaque;
-
     EhPersonalityLangItem,           "eh_personality",          eh_personality;
 
     ExchangeHeapLangItem,            "exchange_heap",           exchange_heap;
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index 1f02f13a4a1..a57ea3759de 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -1635,4 +1635,3 @@ impl<'tcx> UserString<'tcx> for Upvar {
         format!("captured outer variable in an `{}` closure", kind)
     }
 }
-
diff --git a/src/librustc/middle/traits/project.rs b/src/librustc/middle/traits/project.rs
index b9a863f4fe4..6b66d7227d3 100644
--- a/src/librustc/middle/traits/project.rs
+++ b/src/librustc/middle/traits/project.rs
@@ -535,7 +535,7 @@ fn assemble_candidates_from_param_env<'cx,'tcx>(
 /// In the case of a nested projection like <<A as Foo>::FooT as Bar>::BarT, we may find
 /// that the definition of `Foo` has some clues:
 ///
-/// ```rust
+/// ```
 /// trait Foo {
 ///     type FooT : Bar<BarT=i32>
 /// }
diff --git a/src/librustc/middle/traits/util.rs b/src/librustc/middle/traits/util.rs
index 4527985302a..88b721ce958 100644
--- a/src/librustc/middle/traits/util.rs
+++ b/src/librustc/middle/traits/util.rs
@@ -568,5 +568,3 @@ impl<'tcx> fmt::Debug for super::MismatchedProjectionTypes<'tcx> {
         write!(f, "MismatchedProjectionTypes(..)")
     }
 }
-
-
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index c3e1879fca8..3d70d95ef14 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -47,8 +47,7 @@ use middle::check_const;
 use middle::const_eval;
 use middle::def::{self, DefMap, ExportMap};
 use middle::dependency_format;
-use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem};
-use middle::lang_items::{FnOnceTraitLangItem, TyDescStructLangItem};
+use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem, FnOnceTraitLangItem};
 use middle::mem_categorization as mc;
 use middle::region;
 use middle::resolve_lifetime;
@@ -292,7 +291,8 @@ pub enum UnsizeKind<'tcx> {
     // An unsize coercion applied to the tail field of a struct.
     // The uint is the index of the type parameter which is unsized.
     UnsizeStruct(Box<UnsizeKind<'tcx>>, uint),
-    UnsizeVtable(TyTrait<'tcx>, /* the self type of the trait */ Ty<'tcx>)
+    UnsizeVtable(TyTrait<'tcx>, /* the self type of the trait */ Ty<'tcx>),
+    UnsizeUpcast(Ty<'tcx>),
 }
 
 #[derive(Clone, Debug)]
@@ -722,7 +722,6 @@ pub struct ctxt<'tcx> {
     pub object_cast_map: ObjectCastMap<'tcx>,
 
     pub map: ast_map::Map<'tcx>,
-    pub intrinsic_defs: RefCell<DefIdMap<Ty<'tcx>>>,
     pub freevars: RefCell<FreevarMap>,
     pub tcache: RefCell<DefIdMap<TypeScheme<'tcx>>>,
     pub rcache: RefCell<FnvHashMap<creader_cache_key, Ty<'tcx>>>,
@@ -2574,7 +2573,6 @@ pub fn mk_ctxt<'tcx>(s: Session,
         super_predicates: RefCell::new(DefIdMap()),
         object_cast_map: RefCell::new(NodeMap()),
         map: map,
-        intrinsic_defs: RefCell::new(DefIdMap()),
         freevars: freevars,
         tcache: RefCell::new(DefIdMap()),
         rcache: RefCell::new(FnvHashMap()),
@@ -4631,6 +4629,9 @@ pub fn unsize_ty<'tcx>(cx: &ctxt<'tcx>,
         &UnsizeVtable(TyTrait { ref principal, ref bounds }, _) => {
             mk_trait(cx, principal.clone(), bounds.clone())
         }
+        &UnsizeUpcast(target_ty) => {
+            target_ty
+        }
     }
 }
 
@@ -5947,13 +5948,6 @@ pub fn required_region_bounds<'tcx>(tcx: &ctxt<'tcx>,
         .collect()
 }
 
-pub fn get_tydesc_ty<'tcx>(tcx: &ctxt<'tcx>) -> Result<Ty<'tcx>, String> {
-    tcx.lang_items.require(TyDescStructLangItem).map(|tydesc_lang_item| {
-        tcx.intrinsic_defs.borrow().get(&tydesc_lang_item).cloned()
-            .expect("Failed to resolve TyDesc")
-    })
-}
-
 pub fn item_variances(tcx: &ctxt, item_id: ast::DefId) -> Rc<ItemVariances> {
     lookup_locally_or_in_crate_store(
         "item_variance_map", item_id, &mut *tcx.item_variance_map.borrow_mut(),
@@ -6853,6 +6847,7 @@ impl<'tcx> Repr<'tcx> for UnsizeKind<'tcx> {
             UnsizeLength(n) => format!("UnsizeLength({})", n),
             UnsizeStruct(ref k, n) => format!("UnsizeStruct({},{})", k.repr(tcx), n),
             UnsizeVtable(ref a, ref b) => format!("UnsizeVtable({},{})", a.repr(tcx), b.repr(tcx)),
+            UnsizeUpcast(ref a) => format!("UnsizeUpcast({})", a.repr(tcx)),
         }
     }
 }
diff --git a/src/librustc/middle/ty_fold.rs b/src/librustc/middle/ty_fold.rs
index f3a7c1ee6a0..f17ba78007b 100644
--- a/src/librustc/middle/ty_fold.rs
+++ b/src/librustc/middle/ty_fold.rs
@@ -480,6 +480,7 @@ impl<'tcx> TypeFoldable<'tcx> for ty::UnsizeKind<'tcx> {
                     },
                     self_ty.fold_with(folder))
             }
+            ty::UnsizeUpcast(t) => ty::UnsizeUpcast(t.fold_with(folder)),
         }
     }
 }
diff --git a/src/librustc/middle/ty_walk.rs b/src/librustc/middle/ty_walk.rs
index 5b5eac45178..1069d1282ea 100644
--- a/src/librustc/middle/ty_walk.rs
+++ b/src/librustc/middle/ty_walk.rs
@@ -82,7 +82,7 @@ impl<'tcx> TypeWalker<'tcx> {
     ///
     /// Example: Imagine you are walking `Foo<Bar<int>, uint>`.
     ///
-    /// ```rust
+    /// ```
     /// let mut iter: TypeWalker = ...;
     /// iter.next(); // yields Foo
     /// iter.next(); // yields Bar<int>
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index f4d40e26542..60540a9cfa6 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -1215,17 +1215,17 @@ impl<'tcx> Repr<'tcx> for ty::ExistentialBounds<'tcx> {
     fn repr(&self, tcx: &ctxt<'tcx>) -> String {
         let mut res = Vec::new();
 
-        let region_str = self.region_bound.user_string(tcx);
+        let region_str = self.region_bound.repr(tcx);
         if !region_str.is_empty() {
             res.push(region_str);
         }
 
         for bound in &self.builtin_bounds {
-            res.push(bound.user_string(tcx));
+            res.push(bound.repr(tcx));
         }
 
         for projection_bound in &self.projection_bounds {
-            res.push(projection_bound.user_string(tcx));
+            res.push(projection_bound.repr(tcx));
         }
 
         res.connect("+")
diff --git a/src/librustc_back/archive.rs b/src/librustc_back/archive.rs
index ed44bf89529..aec8ac38a5a 100644
--- a/src/librustc_back/archive.rs
+++ b/src/librustc_back/archive.rs
@@ -324,4 +324,3 @@ impl<'a> ArchiveBuilder<'a> {
         Ok(())
     }
 }
-
diff --git a/src/librustc_back/target/dragonfly_base.rs b/src/librustc_back/target/dragonfly_base.rs
index 79d79b7e736..a56621ff97e 100644
--- a/src/librustc_back/target/dragonfly_base.rs
+++ b/src/librustc_back/target/dragonfly_base.rs
@@ -32,4 +32,3 @@ pub fn opts() -> TargetOptions {
         .. Default::default()
     }
 }
-
diff --git a/src/librustc_back/target/freebsd_base.rs b/src/librustc_back/target/freebsd_base.rs
index ab8398fc605..dcf1a12f2c9 100644
--- a/src/librustc_back/target/freebsd_base.rs
+++ b/src/librustc_back/target/freebsd_base.rs
@@ -27,4 +27,3 @@ pub fn opts() -> TargetOptions {
         .. Default::default()
     }
 }
-
diff --git a/src/librustc_back/target/openbsd_base.rs b/src/librustc_back/target/openbsd_base.rs
index 759147b939c..0f2ab32be24 100644
--- a/src/librustc_back/target/openbsd_base.rs
+++ b/src/librustc_back/target/openbsd_base.rs
@@ -30,4 +30,3 @@ pub fn opts() -> TargetOptions {
         .. Default::default()
     }
 }
-
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs
index 1cbbcad9550..e62300098f6 100644
--- a/src/librustc_resolve/build_reduced_graph.rs
+++ b/src/librustc_resolve/build_reduced_graph.rs
@@ -14,16 +14,17 @@
 //! any imports resolved.
 
 use {DefModifiers, PUBLIC, IMPORTABLE};
-use ImportDirective;
-use ImportDirectiveSubclass::{self, SingleImport, GlobImport};
-use ImportResolution;
+use resolve_imports::ImportDirective;
+use resolve_imports::ImportDirectiveSubclass::{self, SingleImport, GlobImport};
+use resolve_imports::ImportResolution;
 use Module;
 use ModuleKind::*;
 use Namespace::{TypeNS, ValueNS};
 use NameBindings;
+use {names_to_string, module_to_string};
 use ParentLink::{self, ModuleParentLink, BlockParentLink};
 use Resolver;
-use Shadowable;
+use resolve_imports::Shadowable;
 use TypeNsDef;
 
 use self::DuplicateCheckingMode::*;
@@ -371,8 +372,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
 
             ItemExternCrate(_) => {
                 // n.b. we don't need to look at the path option here, because cstore already did
-                for &crate_id in self.session.cstore
-                                     .find_extern_mod_stmt_cnum(item.id).iter() {
+                if let Some(crate_id) = self.session.cstore.find_extern_mod_stmt_cnum(item.id) {
                     let def_id = DefId { krate: crate_id, node: 0 };
                     self.external_exports.insert(def_id);
                     let parent_link = ModuleParentLink(parent.downgrade(), name);
@@ -382,7 +382,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
                                                               false,
                                                               true));
                     debug!("(build reduced graph for item) found extern `{}`",
-                            self.module_to_string(&*external_module));
+                            module_to_string(&*external_module));
                     self.check_for_conflicts_between_external_crates(&**parent, name, sp);
                     parent.external_module_children.borrow_mut()
                           .insert(name, external_module.clone());
@@ -400,7 +400,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
                                             Some(def_id),
                                             NormalModuleKind,
                                             false,
-                                            item.vis == ast::Public,
+                                            is_public,
                                             sp);
 
                 name_bindings.get_module()
@@ -432,8 +432,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
             // These items live in the type namespace.
             ItemTy(..) => {
                 let name_bindings =
-                    self.add_child(name, parent, ForbidDuplicateTypesAndModules,
-                                   sp);
+                    self.add_child(name, parent, ForbidDuplicateTypesAndModules, sp);
 
                 name_bindings.define_type(DefTy(local_def(item.id), false), sp,
                                           modifiers);
@@ -517,7 +516,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
                                             Some(local_def(item.id)),
                                             TraitModuleKind,
                                             false,
-                                            item.vis == ast::Public,
+                                            is_public,
                                             sp);
                 let module_parent = name_bindings.get_module();
 
@@ -636,8 +635,8 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
                            name: Name,
                            new_parent: &Rc<Module>) {
         debug!("(building reduced graph for \
-                external crate) building external def, priv {:?}",
-               vis);
+                external crate) building external def {}, priv {:?}",
+               final_ident, vis);
         let is_public = vis == ast::Public;
         let modifiers = if is_public { PUBLIC } else { DefModifiers::empty() } | IMPORTABLE;
         let is_exported = is_public && match new_parent.def_id.get() {
@@ -667,7 +666,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
               Some(_) | None => {
                 debug!("(building reduced graph for \
                         external crate) building module \
-                        {}", final_ident);
+                        {} {}", final_ident, is_public);
                 let parent_link = self.get_parent_link(new_parent, name);
 
                 child_name_bindings.define_module(parent_link,
@@ -838,7 +837,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
     /// Builds the reduced graph rooted at the given external module.
     fn populate_external_module(&mut self, module: &Rc<Module>) {
         debug!("(populating external module) attempting to populate {}",
-               self.module_to_string(&**module));
+               module_to_string(&**module));
 
         let def_id = match module.def_id.get() {
             None => {
@@ -904,18 +903,14 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
 
         match subclass {
             SingleImport(target, _) => {
-                debug!("(building import directive) building import \
-                        directive: {}::{}",
-                       self.names_to_string(&module_.imports.borrow().last().unwrap().
-                                                             module_path),
+                debug!("(building import directive) building import directive: {}::{}",
+                       names_to_string(&module_.imports.borrow().last().unwrap().module_path),
                        token::get_name(target));
 
-                let mut import_resolutions = module_.import_resolutions
-                                                    .borrow_mut();
+                let mut import_resolutions = module_.import_resolutions.borrow_mut();
                 match import_resolutions.get_mut(&target) {
                     Some(resolution) => {
-                        debug!("(building import directive) bumping \
-                                reference");
+                        debug!("(building import directive) bumping reference");
                         resolution.outstanding_references += 1;
 
                         // the source of this name is different now
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs
index 124aa392435..c586faae6e8 100644
--- a/src/librustc_resolve/diagnostics.rs
+++ b/src/librustc_resolve/diagnostics.rs
@@ -24,7 +24,9 @@ register_diagnostics! {
     E0258, // import conflicts with existing submodule
     E0259, // an extern crate has already been imported into this module
     E0260, // name conflicts with an external crate that has been imported into this module
-    E0317 // user-defined types or type parameters cannot shadow the primitive types
+    E0317, // user-defined types or type parameters cannot shadow the primitive types
+    E0364, // item is private
+    E0365  // item is private
 }
 
 __build_diagnostic_array! { DIAGNOSTICS }
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index e49fdc9c5d3..67e9f71551a 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.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.
 //
@@ -38,7 +38,6 @@ use self::PatternBindingMode::*;
 use self::Namespace::*;
 use self::NamespaceResult::*;
 use self::NameDefinition::*;
-use self::ImportDirectiveSubclass::*;
 use self::ResolveResult::*;
 use self::FallbackSuggestion::*;
 use self::TypeParameters::*;
@@ -98,6 +97,10 @@ use std::mem::replace;
 use std::rc::{Rc, Weak};
 use std::usize;
 
+use resolve_imports::{Target, ImportDirective, ImportResolution};
+use resolve_imports::Shadowable;
+
+
 // NB: This module needs to be declared first so diagnostics are
 // registered before they are used.
 pub mod diagnostics;
@@ -105,6 +108,7 @@ pub mod diagnostics;
 mod check_unused;
 mod record_exports;
 mod build_reduced_graph;
+mod resolve_imports;
 
 #[derive(Copy)]
 struct BindingInfo {
@@ -253,13 +257,6 @@ impl<'a, 'v, 'tcx> Visitor<'v> for Resolver<'a, 'tcx> {
     }
 }
 
-/// Contains data for specific types of import directives.
-#[derive(Copy,Debug)]
-enum ImportDirectiveSubclass {
-    SingleImport(Name /* target */, Name /* source */),
-    GlobImport
-}
-
 type ErrorMessage = Option<(Span, String)>;
 
 enum ResolveResult<T> {
@@ -366,144 +363,6 @@ impl Rib {
     }
 }
 
-/// Whether an import can be shadowed by another import.
-#[derive(Debug,PartialEq,Clone,Copy)]
-enum Shadowable {
-    Always,
-    Never
-}
-
-/// One import directive.
-#[derive(Debug)]
-struct ImportDirective {
-    module_path: Vec<Name>,
-    subclass: ImportDirectiveSubclass,
-    span: Span,
-    id: NodeId,
-    is_public: bool, // see note in ImportResolution about how to use this
-    shadowable: Shadowable,
-}
-
-impl ImportDirective {
-    fn new(module_path: Vec<Name> ,
-           subclass: ImportDirectiveSubclass,
-           span: Span,
-           id: NodeId,
-           is_public: bool,
-           shadowable: Shadowable)
-           -> ImportDirective {
-        ImportDirective {
-            module_path: module_path,
-            subclass: subclass,
-            span: span,
-            id: id,
-            is_public: is_public,
-            shadowable: shadowable,
-        }
-    }
-}
-
-/// The item that an import resolves to.
-#[derive(Clone,Debug)]
-struct Target {
-    target_module: Rc<Module>,
-    bindings: Rc<NameBindings>,
-    shadowable: Shadowable,
-}
-
-impl Target {
-    fn new(target_module: Rc<Module>,
-           bindings: Rc<NameBindings>,
-           shadowable: Shadowable)
-           -> Target {
-        Target {
-            target_module: target_module,
-            bindings: bindings,
-            shadowable: shadowable,
-        }
-    }
-}
-
-/// An ImportResolution represents a particular `use` directive.
-#[derive(Debug)]
-struct ImportResolution {
-    /// Whether this resolution came from a `use` or a `pub use`. Note that this
-    /// should *not* be used whenever resolution is being performed, this is
-    /// only looked at for glob imports statements currently. Privacy testing
-    /// occurs during a later phase of compilation.
-    is_public: bool,
-
-    // The number of outstanding references to this name. When this reaches
-    // zero, outside modules can count on the targets being correct. Before
-    // then, all bets are off; future imports could override this name.
-    outstanding_references: uint,
-
-    /// The value that this `use` directive names, if there is one.
-    value_target: Option<Target>,
-    /// The source node of the `use` directive leading to the value target
-    /// being non-none
-    value_id: NodeId,
-
-    /// The type that this `use` directive names, if there is one.
-    type_target: Option<Target>,
-    /// The source node of the `use` directive leading to the type target
-    /// being non-none
-    type_id: NodeId,
-}
-
-impl ImportResolution {
-    fn new(id: NodeId, is_public: bool) -> ImportResolution {
-        ImportResolution {
-            type_id: id,
-            value_id: id,
-            outstanding_references: 0,
-            value_target: None,
-            type_target: None,
-            is_public: is_public,
-        }
-    }
-
-    fn target_for_namespace(&self, namespace: Namespace)
-                                -> Option<Target> {
-        match namespace {
-            TypeNS  => self.type_target.clone(),
-            ValueNS => self.value_target.clone(),
-        }
-    }
-
-    fn id(&self, namespace: Namespace) -> NodeId {
-        match namespace {
-            TypeNS  => self.type_id,
-            ValueNS => self.value_id,
-        }
-    }
-
-    fn shadowable(&self, namespace: Namespace) -> Shadowable {
-        let target = self.target_for_namespace(namespace);
-        if target.is_none() {
-            return Shadowable::Always;
-        }
-
-        target.unwrap().shadowable
-    }
-
-    fn set_target_and_id(&mut self,
-                         namespace: Namespace,
-                         target: Option<Target>,
-                         id: NodeId) {
-        match namespace {
-            TypeNS  => {
-                self.type_target = target;
-                self.type_id = id;
-            }
-            ValueNS => {
-                self.value_target = target;
-                self.value_id = id;
-            }
-        }
-    }
-}
-
 /// The link from a module up to its nearest parent node.
 #[derive(Clone,Debug)]
 enum ParentLink {
@@ -855,6 +714,19 @@ impl NameBindings {
             None
         }
     }
+
+    fn is_public(&self, namespace: Namespace) -> bool {
+        match namespace {
+            TypeNS  => {
+                let type_def = self.type_def.borrow();
+                type_def.as_ref().unwrap().modifiers.contains(PUBLIC)
+            }
+            ValueNS => {
+                let value_def = self.value_def.borrow();
+                value_def.as_ref().unwrap().modifiers.contains(PUBLIC)
+            }
+        }
+    }
 }
 
 /// Interns the names of the primitive types.
@@ -963,7 +835,6 @@ enum FallbackChecks {
     OnlyTraitAndStatics
 }
 
-
 impl<'a, 'tcx> Resolver<'a, 'tcx> {
     fn new(session: &'a Session,
            ast_map: &'a ast_map::Map<'tcx>,
@@ -1023,151 +894,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         }
     }
 
-    // Import resolution
-    //
-    // This is a fixed-point algorithm. We resolve imports until our efforts
-    // are stymied by an unresolved import; then we bail out of the current
-    // module and continue. We terminate successfully once no more imports
-    // remain or unsuccessfully when no forward progress in resolving imports
-    // is made.
-
-    /// Resolves all imports for the crate. This method performs the fixed-
-    /// point iteration.
-    fn resolve_imports(&mut self) {
-        let mut i = 0;
-        let mut prev_unresolved_imports = 0;
-        loop {
-            debug!("(resolving imports) iteration {}, {} imports left",
-                   i, self.unresolved_imports);
-
-            let module_root = self.graph_root.get_module();
-            self.resolve_imports_for_module_subtree(module_root.clone());
-
-            if self.unresolved_imports == 0 {
-                debug!("(resolving imports) success");
-                break;
-            }
-
-            if self.unresolved_imports == prev_unresolved_imports {
-                self.report_unresolved_imports(module_root);
-                break;
-            }
-
-            i += 1;
-            prev_unresolved_imports = self.unresolved_imports;
-        }
-    }
-
-    /// Attempts to resolve imports for the given module and all of its
-    /// submodules.
-    fn resolve_imports_for_module_subtree(&mut self, module_: Rc<Module>) {
-        debug!("(resolving imports for module subtree) resolving {}",
-               self.module_to_string(&*module_));
-        let orig_module = replace(&mut self.current_module, module_.clone());
-        self.resolve_imports_for_module(module_.clone());
-        self.current_module = orig_module;
-
-        build_reduced_graph::populate_module_if_necessary(self, &module_);
-        for (_, child_node) in &*module_.children.borrow() {
-            match child_node.get_module_if_available() {
-                None => {
-                    // Nothing to do.
-                }
-                Some(child_module) => {
-                    self.resolve_imports_for_module_subtree(child_module);
-                }
-            }
-        }
-
-        for (_, child_module) in &*module_.anonymous_children.borrow() {
-            self.resolve_imports_for_module_subtree(child_module.clone());
-        }
-    }
-
-    /// Attempts to resolve imports for the given module only.
-    fn resolve_imports_for_module(&mut self, module: Rc<Module>) {
-        if module.all_imports_resolved() {
-            debug!("(resolving imports for module) all imports resolved for \
-                   {}",
-                   self.module_to_string(&*module));
-            return;
-        }
-
-        let imports = module.imports.borrow();
-        let import_count = imports.len();
-        while module.resolved_import_count.get() < import_count {
-            let import_index = module.resolved_import_count.get();
-            let import_directive = &(*imports)[import_index];
-            match self.resolve_import_for_module(module.clone(),
-                                                 import_directive) {
-                Failed(err) => {
-                    let (span, help) = match err {
-                        Some((span, msg)) => (span, format!(". {}", msg)),
-                        None => (import_directive.span, String::new())
-                    };
-                    let msg = format!("unresolved import `{}`{}",
-                                      self.import_path_to_string(
-                                          &import_directive.module_path,
-                                          import_directive.subclass),
-                                      help);
-                    self.resolve_error(span, &msg[..]);
-                }
-                Indeterminate => break, // Bail out. We'll come around next time.
-                Success(()) => () // Good. Continue.
-            }
-
-            module.resolved_import_count
-                  .set(module.resolved_import_count.get() + 1);
-        }
-    }
-
-    fn names_to_string(&self, names: &[Name]) -> String {
-        let mut first = true;
-        let mut result = String::new();
-        for name in names {
-            if first {
-                first = false
-            } else {
-                result.push_str("::")
-            }
-            result.push_str(&token::get_name(*name));
-        };
-        result
-    }
-
-    fn path_names_to_string(&self, path: &Path, depth: usize) -> String {
-        let names: Vec<ast::Name> = path.segments[..path.segments.len()-depth]
-                                        .iter()
-                                        .map(|seg| seg.identifier.name)
-                                        .collect();
-        self.names_to_string(&names[..])
-    }
-
-    fn import_directive_subclass_to_string(&mut self,
-                                        subclass: ImportDirectiveSubclass)
-                                        -> String {
-        match subclass {
-            SingleImport(_, source) => {
-                token::get_name(source).to_string()
-            }
-            GlobImport => "*".to_string()
-        }
-    }
-
-    fn import_path_to_string(&mut self,
-                          names: &[Name],
-                          subclass: ImportDirectiveSubclass)
-                          -> String {
-        if names.is_empty() {
-            self.import_directive_subclass_to_string(subclass)
-        } else {
-            (format!("{}::{}",
-                     self.names_to_string(names),
-                     self.import_directive_subclass_to_string(
-                         subclass))).to_string()
-        }
-    }
-
     #[inline]
     fn record_import_use(&mut self, import_id: NodeId, name: Name) {
         if !self.make_glob_map {
@@ -1191,102 +917,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         }
     }
 
-    /// Attempts to resolve the given import. The return value indicates
-    /// failure if we're certain the name does not exist, indeterminate if we
-    /// don't know whether the name exists at the moment due to other
-    /// currently-unresolved imports, or success if we know the name exists.
-    /// If successful, the resolved bindings are written into the module.
-    fn resolve_import_for_module(&mut self,
-                                 module_: Rc<Module>,
-                                 import_directive: &ImportDirective)
-                                 -> ResolveResult<()> {
-        let mut resolution_result = Failed(None);
-        let module_path = &import_directive.module_path;
-
-        debug!("(resolving import for module) resolving import `{}::...` in `{}`",
-               self.names_to_string(&module_path[..]),
-               self.module_to_string(&*module_));
-
-        // First, resolve the module path for the directive, if necessary.
-        let container = if module_path.len() == 0 {
-            // Use the crate root.
-            Some((self.graph_root.get_module(), LastMod(AllPublic)))
-        } else {
-            match self.resolve_module_path(module_.clone(),
-                                           &module_path[..],
-                                           DontUseLexicalScope,
-                                           import_directive.span,
-                                           ImportSearch) {
-                Failed(err) => {
-                    resolution_result = Failed(err);
-                    None
-                },
-                Indeterminate => {
-                    resolution_result = Indeterminate;
-                    None
-                }
-                Success(container) => Some(container),
-            }
-        };
-
-        match container {
-            None => {}
-            Some((containing_module, lp)) => {
-                // We found the module that the target is contained
-                // within. Attempt to resolve the import within it.
-
-                match import_directive.subclass {
-                    SingleImport(target, source) => {
-                        resolution_result =
-                            self.resolve_single_import(&*module_,
-                                                       containing_module,
-                                                       target,
-                                                       source,
-                                                       import_directive,
-                                                       lp);
-                    }
-                    GlobImport => {
-                        resolution_result =
-                            self.resolve_glob_import(&*module_,
-                                                     containing_module,
-                                                     import_directive,
-                                                     lp);
-                    }
-                }
-            }
-        }
-
-        // Decrement the count of unresolved imports.
-        match resolution_result {
-            Success(()) => {
-                assert!(self.unresolved_imports >= 1);
-                self.unresolved_imports -= 1;
-            }
-            _ => {
-                // Nothing to do here; just return the error.
-            }
-        }
-
-        // Decrement the count of unresolved globs if necessary. But only if
-        // the resolution result is indeterminate -- otherwise we'll stop
-        // processing imports here. (See the loop in
-        // resolve_imports_for_module.)
-
-        if !resolution_result.indeterminate() {
-            match import_directive.subclass {
-                GlobImport => {
-                    assert!(module_.glob_count.get() >= 1);
-                    module_.glob_count.set(module_.glob_count.get() - 1);
-                }
-                SingleImport(..) => {
-                    // Ignore.
-                }
-            }
-        }
-
-        return resolution_result;
-    }
-
     fn create_name_bindings_from_module(module: Rc<Module>) -> NameBindings {
         NameBindings {
             type_def: RefCell::new(Some(TypeNsDef {
@@ -1299,604 +929,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         }
     }
 
-    fn resolve_single_import(&mut self,
-                             module_: &Module,
-                             containing_module: Rc<Module>,
-                             target: Name,
-                             source: Name,
-                             directive: &ImportDirective,
-                             lp: LastPrivate)
-                                 -> ResolveResult<()> {
-        debug!("(resolving single import) resolving `{}` = `{}::{}` from \
-                `{}` id {}, last private {:?}",
-               token::get_name(target),
-               self.module_to_string(&*containing_module),
-               token::get_name(source),
-               self.module_to_string(module_),
-               directive.id,
-               lp);
-
-        let lp = match lp {
-            LastMod(lp) => lp,
-            LastImport {..} => {
-                self.session
-                    .span_bug(directive.span,
-                              "not expecting Import here, must be LastMod")
-            }
-        };
-
-        // We need to resolve both namespaces for this to succeed.
-        //
-
-        let mut value_result = UnknownResult;
-        let mut type_result = UnknownResult;
-
-        // Search for direct children of the containing module.
-        build_reduced_graph::populate_module_if_necessary(self, &containing_module);
-
-        match containing_module.children.borrow().get(&source) {
-            None => {
-                // Continue.
-            }
-            Some(ref child_name_bindings) => {
-                if child_name_bindings.defined_in_namespace(ValueNS) {
-                    debug!("(resolving single import) found value binding");
-                    value_result = BoundResult(containing_module.clone(),
-                                               (*child_name_bindings).clone());
-                }
-                if child_name_bindings.defined_in_namespace(TypeNS) {
-                    debug!("(resolving single import) found type binding");
-                    type_result = BoundResult(containing_module.clone(),
-                                              (*child_name_bindings).clone());
-                }
-            }
-        }
-
-        // Unless we managed to find a result in both namespaces (unlikely),
-        // search imports as well.
-        let mut value_used_reexport = false;
-        let mut type_used_reexport = false;
-        match (value_result.clone(), type_result.clone()) {
-            (BoundResult(..), BoundResult(..)) => {} // Continue.
-            _ => {
-                // If there is an unresolved glob at this point in the
-                // containing module, bail out. We don't know enough to be
-                // able to resolve this import.
-
-                if containing_module.glob_count.get() > 0 {
-                    debug!("(resolving single import) unresolved glob; \
-                            bailing out");
-                    return Indeterminate;
-                }
-
-                // Now search the exported imports within the containing module.
-                match containing_module.import_resolutions.borrow().get(&source) {
-                    None => {
-                        debug!("(resolving single import) no import");
-                        // The containing module definitely doesn't have an
-                        // exported import with the name in question. We can
-                        // therefore accurately report that the names are
-                        // unbound.
-
-                        if value_result.is_unknown() {
-                            value_result = UnboundResult;
-                        }
-                        if type_result.is_unknown() {
-                            type_result = UnboundResult;
-                        }
-                    }
-                    Some(import_resolution)
-                            if import_resolution.outstanding_references == 0 => {
-
-                        fn get_binding(this: &mut Resolver,
-                                       import_resolution: &ImportResolution,
-                                       namespace: Namespace,
-                                       source: &Name)
-                                    -> NamespaceResult {
-
-                            // Import resolutions must be declared with "pub"
-                            // in order to be exported.
-                            if !import_resolution.is_public {
-                                return UnboundResult;
-                            }
-
-                            match import_resolution.
-                                    target_for_namespace(namespace) {
-                                None => {
-                                    return UnboundResult;
-                                }
-                                Some(Target {
-                                    target_module,
-                                    bindings,
-                                    shadowable: _
-                                }) => {
-                                    debug!("(resolving single import) found \
-                                            import in ns {:?}", namespace);
-                                    let id = import_resolution.id(namespace);
-                                    // track used imports and extern crates as well
-                                    this.used_imports.insert((id, namespace));
-                                    this.record_import_use(id, *source);
-                                    match target_module.def_id.get() {
-                                        Some(DefId{krate: kid, ..}) => {
-                                            this.used_crates.insert(kid);
-                                        },
-                                        _ => {}
-                                    }
-                                    return BoundResult(target_module, bindings);
-                                }
-                            }
-                        }
-
-                        // The name is an import which has been fully
-                        // resolved. We can, therefore, just follow it.
-                        if value_result.is_unknown() {
-                            value_result = get_binding(self,
-                                                       import_resolution,
-                                                       ValueNS,
-                                                       &source);
-                            value_used_reexport = import_resolution.is_public;
-                        }
-                        if type_result.is_unknown() {
-                            type_result = get_binding(self,
-                                                      import_resolution,
-                                                      TypeNS,
-                                                      &source);
-                            type_used_reexport = import_resolution.is_public;
-                        }
-
-                    }
-                    Some(_) => {
-                        // If containing_module is the same module whose import we are resolving
-                        // and there it has an unresolved import with the same name as `source`,
-                        // then the user is actually trying to import an item that is declared
-                        // in the same scope
-                        //
-                        // e.g
-                        // use self::submodule;
-                        // pub mod submodule;
-                        //
-                        // In this case we continue as if we resolved the import and let the
-                        // check_for_conflicts_between_imports_and_items call below handle
-                        // the conflict
-                        match (module_.def_id.get(),  containing_module.def_id.get()) {
-                            (Some(id1), Some(id2)) if id1 == id2  => {
-                                if value_result.is_unknown() {
-                                    value_result = UnboundResult;
-                                }
-                                if type_result.is_unknown() {
-                                    type_result = UnboundResult;
-                                }
-                            }
-                            _ =>  {
-                                // The import is unresolved. Bail out.
-                                debug!("(resolving single import) unresolved import; \
-                                        bailing out");
-                                return Indeterminate;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        // If we didn't find a result in the type namespace, search the
-        // external modules.
-        let mut value_used_public = false;
-        let mut type_used_public = false;
-        match type_result {
-            BoundResult(..) => {}
-            _ => {
-                match containing_module.external_module_children.borrow_mut()
-                                       .get(&source).cloned() {
-                    None => {} // Continue.
-                    Some(module) => {
-                        debug!("(resolving single import) found external \
-                                module");
-                        // track the module as used.
-                        match module.def_id.get() {
-                            Some(DefId{krate: kid, ..}) => { self.used_crates.insert(kid); },
-                            _ => {}
-                        }
-                        let name_bindings =
-                            Rc::new(Resolver::create_name_bindings_from_module(
-                                module));
-                        type_result = BoundResult(containing_module.clone(),
-                                                  name_bindings);
-                        type_used_public = true;
-                    }
-                }
-            }
-        }
-
-        // We've successfully resolved the import. Write the results in.
-        let mut import_resolutions = module_.import_resolutions.borrow_mut();
-        let import_resolution = &mut (*import_resolutions)[target];
-        {
-            let mut check_and_write_import = |namespace, result: &_, used_public: &mut bool| {
-                let namespace_name = match namespace {
-                    TypeNS => "type",
-                    ValueNS => "value",
-                };
-
-                match *result {
-                    BoundResult(ref target_module, ref name_bindings) => {
-                        debug!("(resolving single import) found {:?} target: {:?}",
-                               namespace_name,
-                               name_bindings.def_for_namespace(namespace));
-                        self.check_for_conflicting_import(
-                            &import_resolution.target_for_namespace(namespace),
-                            directive.span,
-                            target,
-                            namespace);
-
-                        self.check_that_import_is_importable(
-                            &**name_bindings,
-                            directive.span,
-                            target,
-                            namespace);
-
-                        let target = Some(Target::new(target_module.clone(),
-                                                      name_bindings.clone(),
-                                                      directive.shadowable));
-                        import_resolution.set_target_and_id(namespace, target, directive.id);
-                        import_resolution.is_public = directive.is_public;
-                        *used_public = name_bindings.defined_in_public_namespace(namespace);
-                    }
-                    UnboundResult => { /* Continue. */ }
-                    UnknownResult => {
-                        panic!("{:?} result should be known at this point", namespace_name);
-                    }
-                }
-            };
-            check_and_write_import(ValueNS, &value_result, &mut value_used_public);
-            check_and_write_import(TypeNS, &type_result, &mut type_used_public);
-        }
-
-        self.check_for_conflicts_between_imports_and_items(
-            module_,
-            import_resolution,
-            directive.span,
-            target);
-
-        if value_result.is_unbound() && type_result.is_unbound() {
-            let msg = format!("There is no `{}` in `{}`",
-                              token::get_name(source),
-                              self.module_to_string(&*containing_module));
-            return Failed(Some((directive.span, msg)));
-        }
-        let value_used_public = value_used_reexport || value_used_public;
-        let type_used_public = type_used_reexport || type_used_public;
-
-        assert!(import_resolution.outstanding_references >= 1);
-        import_resolution.outstanding_references -= 1;
-
-        // record what this import resolves to for later uses in documentation,
-        // this may resolve to either a value or a type, but for documentation
-        // purposes it's good enough to just favor one over the other.
-        let value_def_and_priv = import_resolution.value_target.as_ref().map(|target| {
-            let def = target.bindings.def_for_namespace(ValueNS).unwrap();
-            (def, if value_used_public { lp } else { DependsOn(def.def_id()) })
-        });
-        let type_def_and_priv = import_resolution.type_target.as_ref().map(|target| {
-            let def = target.bindings.def_for_namespace(TypeNS).unwrap();
-            (def, if type_used_public { lp } else { DependsOn(def.def_id()) })
-        });
-
-        let import_lp = LastImport {
-            value_priv: value_def_and_priv.map(|(_, p)| p),
-            value_used: Used,
-            type_priv: type_def_and_priv.map(|(_, p)| p),
-            type_used: Used
-        };
-
-        if let Some((def, _)) = value_def_and_priv {
-            self.def_map.borrow_mut().insert(directive.id, PathResolution {
-                base_def: def,
-                last_private: import_lp,
-                depth: 0
-            });
-        }
-        if let Some((def, _)) = type_def_and_priv {
-            self.def_map.borrow_mut().insert(directive.id, PathResolution {
-                base_def: def,
-                last_private: import_lp,
-                depth: 0
-            });
-        }
-
-        debug!("(resolving single import) successfully resolved import");
-        return Success(());
-    }
-
-    // Resolves a glob import. Note that this function cannot fail; it either
-    // succeeds or bails out (as importing * from an empty module or a module
-    // that exports nothing is valid). containing_module is the module we are
-    // actually importing, i.e., `foo` in `use foo::*`.
-    fn resolve_glob_import(&mut self,
-                           module_: &Module,
-                           containing_module: Rc<Module>,
-                           import_directive: &ImportDirective,
-                           lp: LastPrivate)
-                           -> ResolveResult<()> {
-        let id = import_directive.id;
-        let is_public = import_directive.is_public;
-
-        // This function works in a highly imperative manner; it eagerly adds
-        // everything it can to the list of import resolutions of the module
-        // node.
-        debug!("(resolving glob import) resolving glob import {}", id);
-
-        // We must bail out if the node has unresolved imports of any kind
-        // (including globs).
-        if !(*containing_module).all_imports_resolved() {
-            debug!("(resolving glob import) target module has unresolved \
-                    imports; bailing out");
-            return Indeterminate;
-        }
-
-        assert_eq!(containing_module.glob_count.get(), 0);
-
-        // Add all resolved imports from the containing module.
-        let import_resolutions = containing_module.import_resolutions.borrow();
-        for (ident, target_import_resolution) in &*import_resolutions {
-            debug!("(resolving glob import) writing module resolution \
-                    {} into `{}`",
-                   token::get_name(*ident),
-                   self.module_to_string(module_));
-
-            if !target_import_resolution.is_public {
-                debug!("(resolving glob import) nevermind, just kidding");
-                continue
-            }
-
-            // Here we merge two import resolutions.
-            let mut import_resolutions = module_.import_resolutions.borrow_mut();
-            match import_resolutions.get_mut(ident) {
-                Some(dest_import_resolution) => {
-                    // Merge the two import resolutions at a finer-grained
-                    // level.
-
-                    match target_import_resolution.value_target {
-                        None => {
-                            // Continue.
-                        }
-                        Some(ref value_target) => {
-                            self.check_for_conflicting_import(&dest_import_resolution.value_target,
-                                                              import_directive.span,
-                                                              *ident,
-                                                              ValueNS);
-                            dest_import_resolution.value_target = Some(value_target.clone());
-                        }
-                    }
-                    match target_import_resolution.type_target {
-                        None => {
-                            // Continue.
-                        }
-                        Some(ref type_target) => {
-                            self.check_for_conflicting_import(&dest_import_resolution.type_target,
-                                                              import_directive.span,
-                                                              *ident,
-                                                              TypeNS);
-                            dest_import_resolution.type_target = Some(type_target.clone());
-                        }
-                    }
-                    dest_import_resolution.is_public = is_public;
-                    continue;
-                }
-                None => {}
-            }
-
-            // Simple: just copy the old import resolution.
-            let mut new_import_resolution = ImportResolution::new(id, is_public);
-            new_import_resolution.value_target =
-                target_import_resolution.value_target.clone();
-            new_import_resolution.type_target =
-                target_import_resolution.type_target.clone();
-
-            import_resolutions.insert(*ident, new_import_resolution);
-        }
-
-        // Add all children from the containing module.
-        build_reduced_graph::populate_module_if_necessary(self, &containing_module);
-
-        for (&name, name_bindings) in &*containing_module.children.borrow() {
-            self.merge_import_resolution(module_,
-                                         containing_module.clone(),
-                                         import_directive,
-                                         name,
-                                         name_bindings.clone());
-
-        }
-
-        // Add external module children from the containing module.
-        for (&name, module) in &*containing_module.external_module_children.borrow() {
-            let name_bindings =
-                Rc::new(Resolver::create_name_bindings_from_module(module.clone()));
-            self.merge_import_resolution(module_,
-                                         containing_module.clone(),
-                                         import_directive,
-                                         name,
-                                         name_bindings);
-        }
-
-        // Record the destination of this import
-        if let Some(did) = containing_module.def_id.get() {
-            self.def_map.borrow_mut().insert(id, PathResolution {
-                base_def: DefMod(did),
-                last_private: lp,
-                depth: 0
-            });
-        }
-
-        debug!("(resolving glob import) successfully resolved import");
-        return Success(());
-    }
-
-    fn merge_import_resolution(&mut self,
-                               module_: &Module,
-                               containing_module: Rc<Module>,
-                               import_directive: &ImportDirective,
-                               name: Name,
-                               name_bindings: Rc<NameBindings>) {
-        let id = import_directive.id;
-        let is_public = import_directive.is_public;
-
-        let mut import_resolutions = module_.import_resolutions.borrow_mut();
-        let dest_import_resolution = import_resolutions.entry(name).get().unwrap_or_else(
-            |vacant_entry| {
-                // Create a new import resolution from this child.
-                vacant_entry.insert(ImportResolution::new(id, is_public))
-            });
-
-        debug!("(resolving glob import) writing resolution `{}` in `{}` \
-               to `{}`",
-               &token::get_name(name),
-               self.module_to_string(&*containing_module),
-               self.module_to_string(module_));
-
-        // Merge the child item into the import resolution.
-        {
-            let mut merge_child_item = |namespace| {
-                if name_bindings.defined_in_namespace_with(namespace, IMPORTABLE | PUBLIC) {
-                    let namespace_name = match namespace {
-                        TypeNS => "type",
-                        ValueNS => "value",
-                    };
-                    debug!("(resolving glob import) ... for {} target", namespace_name);
-                    if dest_import_resolution.shadowable(namespace) == Shadowable::Never {
-                        let msg = format!("a {} named `{}` has already been imported \
-                                           in this module",
-                                          namespace_name,
-                                          &token::get_name(name));
-                        span_err!(self.session, import_directive.span, E0251, "{}", msg);
-                    } else {
-                        let target = Target::new(containing_module.clone(),
-                                                 name_bindings.clone(),
-                                                 import_directive.shadowable);
-                        dest_import_resolution.set_target_and_id(namespace,
-                                                                 Some(target),
-                                                                 id);
-                    }
-                }
-            };
-            merge_child_item(ValueNS);
-            merge_child_item(TypeNS);
-        }
-
-        dest_import_resolution.is_public = is_public;
-
-        self.check_for_conflicts_between_imports_and_items(
-            module_,
-            dest_import_resolution,
-            import_directive.span,
-            name);
-    }
-
-    /// Checks that imported names and items don't have the same name.
-    fn check_for_conflicting_import(&mut self,
-                                    target: &Option<Target>,
-                                    import_span: Span,
-                                    name: Name,
-                                    namespace: Namespace) {
-        debug!("check_for_conflicting_import: {}; target exists: {}",
-               &token::get_name(name),
-               target.is_some());
-
-        match *target {
-            Some(ref target) if target.shadowable != Shadowable::Always => {
-                let msg = format!("a {} named `{}` has already been imported \
-                                   in this module",
-                                  match namespace {
-                                    TypeNS => "type",
-                                    ValueNS => "value",
-                                  },
-                                  &token::get_name(name));
-                span_err!(self.session, import_span, E0252, "{}", &msg[..]);
-            }
-            Some(_) | None => {}
-        }
-    }
-
-    /// Checks that an import is actually importable
-    fn check_that_import_is_importable(&mut self,
-                                       name_bindings: &NameBindings,
-                                       import_span: Span,
-                                       name: Name,
-                                       namespace: Namespace) {
-        if !name_bindings.defined_in_namespace_with(namespace, IMPORTABLE) {
-            let msg = format!("`{}` is not directly importable",
-                              token::get_name(name));
-            span_err!(self.session, import_span, E0253, "{}", &msg[..]);
-        }
-    }
-
-    /// Checks that imported names and items don't have the same name.
-    fn check_for_conflicts_between_imports_and_items(&mut self,
-                                                     module: &Module,
-                                                     import_resolution:
-                                                     &ImportResolution,
-                                                     import_span: Span,
-                                                     name: Name) {
-        // First, check for conflicts between imports and `extern crate`s.
-        if module.external_module_children
-                 .borrow()
-                 .contains_key(&name) {
-            match import_resolution.type_target {
-                Some(ref target) if target.shadowable != Shadowable::Always => {
-                    let msg = format!("import `{0}` conflicts with imported \
-                                       crate in this module \
-                                       (maybe you meant `use {0}::*`?)",
-                                      &token::get_name(name));
-                    span_err!(self.session, import_span, E0254, "{}", &msg[..]);
-                }
-                Some(_) | None => {}
-            }
-        }
-
-        // Check for item conflicts.
-        let children = module.children.borrow();
-        let name_bindings = match children.get(&name) {
-            None => {
-                // There can't be any conflicts.
-                return
-            }
-            Some(ref name_bindings) => (*name_bindings).clone(),
-        };
-
-        match import_resolution.value_target {
-            Some(ref target) if target.shadowable != Shadowable::Always => {
-                if let Some(ref value) = *name_bindings.value_def.borrow() {
-                    span_err!(self.session, import_span, E0255,
-                              "import `{}` conflicts with value in this module",
-                              &token::get_name(name));
-                    if let Some(span) = value.value_span {
-                        self.session.span_note(span, "conflicting value here");
-                    }
-                }
-            }
-            Some(_) | None => {}
-        }
-
-        match import_resolution.type_target {
-            Some(ref target) if target.shadowable != Shadowable::Always => {
-                if let Some(ref ty) = *name_bindings.type_def.borrow() {
-                    let (what, note) = if ty.module_def.is_some() {
-                        ("existing submodule", "note conflicting module here")
-                    } else {
-                        ("type in this module", "note conflicting type here")
-                    };
-                    span_err!(self.session, import_span, E0256,
-                              "import `{}` conflicts with {}",
-                              &token::get_name(name), what);
-                    if let Some(span) = ty.type_span {
-                        self.session.span_note(span, note);
-                    }
-                }
-            }
-            Some(_) | None => {}
-        }
-    }
-
     /// Checks that the names of external crates don't collide with other
     /// external crates.
     fn check_for_conflicts_between_external_crates(&self,
@@ -1964,7 +996,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                                               false) {
                 Failed(None) => {
                     let segment_name = token::get_name(name);
-                    let module_name = self.module_to_string(&*search_module);
+                    let module_name = module_to_string(&*search_module);
                     let mut span = span;
                     let msg = if "???" == &module_name[..] {
                         span.hi = span.lo + Pos::from_usize(segment_name.len());
@@ -1972,10 +1004,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                         match search_parent_externals(name,
                                                      &self.current_module) {
                             Some(module) => {
-                                let path_str = self.names_to_string(module_path);
-                                let target_mod_str = self.module_to_string(&*module);
+                                let path_str = names_to_string(module_path);
+                                let target_mod_str = module_to_string(&*module);
                                 let current_mod_str =
-                                    self.module_to_string(&*self.current_module);
+                                    module_to_string(&*self.current_module);
 
                                 let prefix = if target_mod_str == current_mod_str {
                                     "self::".to_string()
@@ -2066,8 +1098,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         assert!(module_path_len > 0);
 
         debug!("(resolving module path for import) processing `{}` rooted at `{}`",
-               self.names_to_string(module_path),
-               self.module_to_string(&*module_));
+               names_to_string(module_path),
+               module_to_string(&*module_));
 
         // Resolve the module prefix, if any.
         let module_prefix_result = self.resolve_module_prefix(module_.clone(),
@@ -2078,7 +1110,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         let last_private;
         match module_prefix_result {
             Failed(None) => {
-                let mpath = self.names_to_string(module_path);
+                let mpath = names_to_string(module_path);
                 let mpath = &mpath[..];
                 match mpath.rfind(':') {
                     Some(idx) => {
@@ -2161,7 +1193,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                 namespace {:?} in `{}`",
                token::get_name(name),
                namespace,
-               self.module_to_string(&*module_));
+               module_to_string(&*module_));
 
         // The current module node is handled specially. First, check for
         // its immediate children.
@@ -2398,7 +1430,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                 break
             }
             debug!("(resolving module prefix) resolving `super` at {}",
-                   self.module_to_string(&*containing_module));
+                   module_to_string(&*containing_module));
             match self.get_nearest_normal_module_parent(containing_module) {
                 None => return Failed(None),
                 Some(new_module) => {
@@ -2409,7 +1441,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         }
 
         debug!("(resolving module prefix) finished resolving prefix at {}",
-               self.module_to_string(&*containing_module));
+               module_to_string(&*containing_module));
 
         return Success(PrefixFound(containing_module, i));
     }
@@ -2429,7 +1461,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                               -> ResolveResult<(Target, bool)> {
         debug!("(resolving name in module) resolving `{}` in `{}`",
                &token::get_name(name),
-               self.module_to_string(&*module_));
+               module_to_string(&*module_));
 
         // First, check the direct children of the module.
         build_reduced_graph::populate_module_if_necessary(self, &module_);
@@ -2583,7 +1615,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                     None => {
                         debug!("!!! (with scope) didn't find `{}` in `{}`",
                                token::get_name(name),
-                               self.module_to_string(&*orig_module));
+                               module_to_string(&*orig_module));
                     }
                     Some(name_bindings) => {
                         match (*name_bindings).get_module_if_available() {
@@ -2591,7 +1623,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                                 debug!("!!! (with scope) didn't find module \
                                         for `{}` in `{}`",
                                        token::get_name(name),
-                                       self.module_to_string(&*orig_module));
+                                       module_to_string(&*orig_module));
                             }
                             Some(module_) => {
                                 self.current_module = module_;
@@ -2970,7 +2002,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
             } else {
                 self.resolve_error(trait_path.span,
                     &format!("`{}` is not a trait",
-                             self.path_names_to_string(trait_path, path_depth)));
+                             path_names_to_string(trait_path, path_depth)));
 
                 // If it's a typedef, give a note
                 if let DefTy(..) = path_res.base_def {
@@ -2981,7 +2013,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
             }
         } else {
             let msg = format!("use of undeclared trait name `{}`",
-                              self.path_names_to_string(trait_path, path_depth));
+                              path_names_to_string(trait_path, path_depth));
             self.resolve_error(trait_path.span, &msg);
             Err(())
         }
@@ -3097,7 +2129,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         // If there is a TraitRef in scope for an impl, then the method must be in the trait.
         if let Some((did, ref trait_ref)) = self.current_trait_ref {
             if !self.trait_item_map.contains_key(&(name, did)) {
-                let path_str = self.path_names_to_string(&trait_ref.path, 0);
+                let path_str = path_names_to_string(&trait_ref.path, 0);
                 self.resolve_error(span,
                                     &format!("method `{}` is not a member of trait `{}`",
                                             token::get_name(name),
@@ -3279,7 +2311,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                         // Write the result into the def map.
                         debug!("(resolving type) writing resolution for `{}` \
                                 (id {}) = {:?}",
-                               self.path_names_to_string(path, 0),
+                               path_names_to_string(path, 0),
                                ty.id, def);
                         self.record_def(ty.id, def);
                     }
@@ -3294,7 +2326,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                         };
 
                         let msg = format!("use of undeclared {} `{}`", kind,
-                                          self.path_names_to_string(path, 0));
+                                          path_names_to_string(path, 0));
                         self.resolve_error(ty.span, &msg[..]);
                     }
                 }
@@ -3465,7 +2497,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                             debug!("(resolving pattern) didn't find struct \
                                     def: {:?}", result);
                             let msg = format!("`{}` does not name a structure",
-                                              self.path_names_to_string(path, 0));
+                                              path_names_to_string(path, 0));
                             self.resolve_error(path.span, &msg[..]);
                         }
                     }
@@ -3718,7 +2750,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                     Some((span, msg)) => (span, msg),
                     None => {
                         let msg = format!("Use of undeclared type or module `{}`",
-                                          self.names_to_string(&module_path));
+                                          names_to_string(&module_path));
                         (span, msg)
                     }
                 };
@@ -3778,7 +2810,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                     Some((span, msg)) => (span, msg),
                     None => {
                         let msg = format!("Use of undeclared module `::{}`",
-                                          self.names_to_string(&module_path[..]));
+                                          names_to_string(&module_path[..]));
                         (span, msg)
                     }
                 };
@@ -3998,7 +3030,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
             if let Some(binding) = module.children.borrow().get(&name) {
                 if let Some(DefMethod(did, _)) = binding.def_for_namespace(ValueNS) {
                     if is_static_method(self, did) {
-                        return StaticMethod(self.path_names_to_string(&path, 0))
+                        return StaticMethod(path_names_to_string(&path, 0))
                     }
                     if self.current_trait_ref.is_some() {
                         return TraitItem;
@@ -4013,7 +3045,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         if let Some((trait_did, ref trait_ref)) = self.current_trait_ref {
             if let Some(&did) = self.trait_item_map.get(&(name, trait_did)) {
                 if is_static_method(self, did) {
-                    return TraitMethod(self.path_names_to_string(&trait_ref.path, 0));
+                    return TraitMethod(path_names_to_string(&trait_ref.path, 0));
                 } else {
                     return TraitItem;
                 }
@@ -4105,7 +3137,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                 if let Some(path_res) = resolution {
                     // Check if struct variant
                     if let DefVariant(_, _, true) = path_res.base_def {
-                        let path_name = self.path_names_to_string(path, 0);
+                        let path_name = path_names_to_string(path, 0);
                         self.resolve_error(expr.span,
                                 &format!("`{}` is a struct variant name, but \
                                           this expression \
@@ -4123,7 +3155,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                     } else {
                         // Write the result into the def map.
                         debug!("(resolving expr) resolved `{}`",
-                               self.path_names_to_string(path, 0));
+                               path_names_to_string(path, 0));
 
                         // Partial resolutions will need the set of traits in scope,
                         // so they can be completed during typeck.
@@ -4140,7 +3172,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                     // (The pattern matching def_tys where the id is in self.structs
                     // matches on regular structs while excluding tuple- and enum-like
                     // structs, which wouldn't result in this error.)
-                    let path_name = self.path_names_to_string(path, 0);
+                    let path_name = path_names_to_string(path, 0);
                     let type_res = self.with_no_errors(|this| {
                         this.resolve_path(expr.id, path, 0, TypeNS, false)
                     });
@@ -4227,7 +3259,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                     None => {
                         debug!("(resolving expression) didn't find struct def",);
                         let msg = format!("`{}` does not name a structure",
-                                          self.path_names_to_string(path, 0));
+                                          path_names_to_string(path, 0));
                         self.resolve_error(path.span, &msg[..]);
                     }
                 }
@@ -4417,36 +3449,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
     // hit.
     //
 
-    /// A somewhat inefficient routine to obtain the name of a module.
-    fn module_to_string(&self, module: &Module) -> String {
-        let mut names = Vec::new();
-
-        fn collect_mod(names: &mut Vec<ast::Name>, module: &Module) {
-            match module.parent_link {
-                NoParentLink => {}
-                ModuleParentLink(ref module, name) => {
-                    names.push(name);
-                    collect_mod(names, &*module.upgrade().unwrap());
-                }
-                BlockParentLink(ref module, _) => {
-                    // danger, shouldn't be ident?
-                    names.push(special_idents::opaque.name);
-                    collect_mod(names, &*module.upgrade().unwrap());
-                }
-            }
-        }
-        collect_mod(&mut names, module);
-
-        if names.len() == 0 {
-            return "???".to_string();
-        }
-        self.names_to_string(&names.into_iter().rev()
-                                  .collect::<Vec<ast::Name>>())
-    }
-
     #[allow(dead_code)]   // useful for debugging
     fn dump_module(&mut self, module_: Rc<Module>) {
-        debug!("Dump of module `{}`:", self.module_to_string(&*module_));
+        debug!("Dump of module `{}`:", module_to_string(&*module_));
 
         debug!("Children:");
         build_reduced_graph::populate_module_if_necessary(self, &module_);
@@ -4480,6 +3485,56 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
     }
 }
 
+
+fn names_to_string(names: &[Name]) -> String {
+    let mut first = true;
+    let mut result = String::new();
+    for name in names {
+        if first {
+            first = false
+        } else {
+            result.push_str("::")
+        }
+        result.push_str(&token::get_name(*name));
+    };
+    result
+}
+
+fn path_names_to_string(path: &Path, depth: usize) -> String {
+    let names: Vec<ast::Name> = path.segments[..path.segments.len()-depth]
+                                    .iter()
+                                    .map(|seg| seg.identifier.name)
+                                    .collect();
+    names_to_string(&names[..])
+}
+
+/// A somewhat inefficient routine to obtain the name of a module.
+fn module_to_string(module: &Module) -> String {
+    let mut names = Vec::new();
+
+    fn collect_mod(names: &mut Vec<ast::Name>, module: &Module) {
+        match module.parent_link {
+            NoParentLink => {}
+            ModuleParentLink(ref module, name) => {
+                names.push(name);
+                collect_mod(names, &*module.upgrade().unwrap());
+            }
+            BlockParentLink(ref module, _) => {
+                // danger, shouldn't be ident?
+                names.push(special_idents::opaque.name);
+                collect_mod(names, &*module.upgrade().unwrap());
+            }
+        }
+    }
+    collect_mod(&mut names, module);
+
+    if names.len() == 0 {
+        return "???".to_string();
+    }
+    names_to_string(&names.into_iter().rev().collect::<Vec<ast::Name>>())
+}
+
+
 pub struct CrateMap {
     pub def_map: DefMap,
     pub freevars: RefCell<FreevarMap>,
@@ -4507,7 +3562,7 @@ pub fn resolve_crate<'a, 'tcx>(session: &'a Session,
     build_reduced_graph::build_reduced_graph(&mut resolver, krate);
     session.abort_if_errors();
 
-    resolver.resolve_imports();
+    resolve_imports::resolve_imports(&mut resolver);
     session.abort_if_errors();
 
     record_exports::record(&mut resolver);
diff --git a/src/librustc_resolve/record_exports.rs b/src/librustc_resolve/record_exports.rs
index 5d025f40d32..e953b6398f9 100644
--- a/src/librustc_resolve/record_exports.rs
+++ b/src/librustc_resolve/record_exports.rs
@@ -22,6 +22,7 @@ use {Module, NameBindings, Resolver};
 use Namespace::{self, TypeNS, ValueNS};
 
 use build_reduced_graph;
+use module_to_string;
 
 use rustc::middle::def::Export;
 use syntax::ast;
@@ -60,19 +61,19 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> {
                 // OK. Continue.
                 debug!("(recording exports for module subtree) recording \
                         exports for local module `{}`",
-                       self.module_to_string(&*module_));
+                       module_to_string(&*module_));
             }
             None => {
                 // Record exports for the root module.
                 debug!("(recording exports for module subtree) recording \
                         exports for root module `{}`",
-                       self.module_to_string(&*module_));
+                       module_to_string(&*module_));
             }
             Some(_) => {
                 // Bail out.
                 debug!("(recording exports for module subtree) not recording \
                         exports for `{}`",
-                       self.module_to_string(&*module_));
+                       module_to_string(&*module_));
                 return;
             }
         }
@@ -133,13 +134,13 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> {
     fn add_exports_for_module(&mut self,
                               exports: &mut Vec<Export>,
                               module_: &Module) {
-        for (name, importresolution) in &*module_.import_resolutions.borrow() {
-            if !importresolution.is_public {
+        for (name, import_resolution) in &*module_.import_resolutions.borrow() {
+            if !import_resolution.is_public {
                 continue
             }
             let xs = [TypeNS, ValueNS];
             for &ns in &xs {
-                match importresolution.target_for_namespace(ns) {
+                match import_resolution.target_for_namespace(ns) {
                     Some(target) => {
                         debug!("(computing exports) maybe export '{}'",
                                token::get_name(*name));
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs
new file mode 100644
index 00000000000..737ec71cab3
--- /dev/null
+++ b/src/librustc_resolve/resolve_imports.rs
@@ -0,0 +1,1021 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use self::ImportDirectiveSubclass::*;
+
+use {PUBLIC, IMPORTABLE};
+use Module;
+use Namespace::{self, TypeNS, ValueNS};
+use NameBindings;
+use NamespaceResult::{BoundResult, UnboundResult, UnknownResult};
+use NamespaceResult;
+use NameSearchType;
+use ResolveResult;
+use Resolver;
+use UseLexicalScopeFlag;
+use {names_to_string, module_to_string};
+
+use build_reduced_graph;
+
+use rustc::middle::def::*;
+use rustc::middle::privacy::*;
+
+use syntax::ast::{DefId, NodeId, Name};
+use syntax::attr::AttrMetaMethods;
+use syntax::parse::token;
+use syntax::codemap::Span;
+
+use std::mem::replace;
+use std::rc::Rc;
+
+
+/// Contains data for specific types of import directives.
+#[derive(Copy,Debug)]
+pub enum ImportDirectiveSubclass {
+    SingleImport(Name /* target */, Name /* source */),
+    GlobImport
+}
+
+/// Whether an import can be shadowed by another import.
+#[derive(Debug,PartialEq,Clone,Copy)]
+pub enum Shadowable {
+    Always,
+    Never
+}
+
+/// One import directive.
+#[derive(Debug)]
+pub struct ImportDirective {
+    pub module_path: Vec<Name>,
+    pub subclass: ImportDirectiveSubclass,
+    pub span: Span,
+    pub id: NodeId,
+    pub is_public: bool, // see note in ImportResolution about how to use this
+    pub shadowable: Shadowable,
+}
+
+impl ImportDirective {
+    pub fn new(module_path: Vec<Name> ,
+           subclass: ImportDirectiveSubclass,
+           span: Span,
+           id: NodeId,
+           is_public: bool,
+           shadowable: Shadowable)
+           -> ImportDirective {
+        ImportDirective {
+            module_path: module_path,
+            subclass: subclass,
+            span: span,
+            id: id,
+            is_public: is_public,
+            shadowable: shadowable,
+        }
+    }
+}
+
+/// The item that an import resolves to.
+#[derive(Clone,Debug)]
+pub struct Target {
+    pub target_module: Rc<Module>,
+    pub bindings: Rc<NameBindings>,
+    pub shadowable: Shadowable,
+}
+
+impl Target {
+    pub fn new(target_module: Rc<Module>,
+           bindings: Rc<NameBindings>,
+           shadowable: Shadowable)
+           -> Target {
+        Target {
+            target_module: target_module,
+            bindings: bindings,
+            shadowable: shadowable,
+        }
+    }
+}
+
+/// An ImportResolution represents a particular `use` directive.
+#[derive(Debug)]
+pub struct ImportResolution {
+    /// Whether this resolution came from a `use` or a `pub use`. Note that this
+    /// should *not* be used whenever resolution is being performed. Privacy
+    /// testing occurs during a later phase of compilation.
+    pub is_public: bool,
+
+    // The number of outstanding references to this name. When this reaches
+    // zero, outside modules can count on the targets being correct. Before
+    // then, all bets are off; future imports could override this name.
+    // Note that this is usually either 0 or 1 - shadowing is forbidden the only
+    // way outstanding_references is > 1 in a legal program is if the name is
+    // used in both namespaces.
+    pub outstanding_references: uint,
+
+    /// The value that this `use` directive names, if there is one.
+    pub value_target: Option<Target>,
+    /// The source node of the `use` directive leading to the value target
+    /// being non-none
+    pub value_id: NodeId,
+
+    /// The type that this `use` directive names, if there is one.
+    pub type_target: Option<Target>,
+    /// The source node of the `use` directive leading to the type target
+    /// being non-none
+    pub type_id: NodeId,
+}
+
+impl ImportResolution {
+    pub fn new(id: NodeId, is_public: bool) -> ImportResolution {
+        ImportResolution {
+            type_id: id,
+            value_id: id,
+            outstanding_references: 0,
+            value_target: None,
+            type_target: None,
+            is_public: is_public,
+        }
+    }
+
+    pub fn target_for_namespace(&self, namespace: Namespace)
+                                -> Option<Target> {
+        match namespace {
+            TypeNS  => self.type_target.clone(),
+            ValueNS => self.value_target.clone(),
+        }
+    }
+
+    pub fn id(&self, namespace: Namespace) -> NodeId {
+        match namespace {
+            TypeNS  => self.type_id,
+            ValueNS => self.value_id,
+        }
+    }
+
+    pub fn shadowable(&self, namespace: Namespace) -> Shadowable {
+        let target = self.target_for_namespace(namespace);
+        if target.is_none() {
+            return Shadowable::Always;
+        }
+
+        target.unwrap().shadowable
+    }
+
+    pub fn set_target_and_id(&mut self,
+                         namespace: Namespace,
+                         target: Option<Target>,
+                         id: NodeId) {
+        match namespace {
+            TypeNS  => {
+                self.type_target = target;
+                self.type_id = id;
+            }
+            ValueNS => {
+                self.value_target = target;
+                self.value_id = id;
+            }
+        }
+    }
+}
+
+
+struct ImportResolver<'a, 'b:'a, 'tcx:'b> {
+    resolver: &'a mut Resolver<'b, 'tcx>
+}
+
+impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
+    // Import resolution
+    //
+    // This is a fixed-point algorithm. We resolve imports until our efforts
+    // are stymied by an unresolved import; then we bail out of the current
+    // module and continue. We terminate successfully once no more imports
+    // remain or unsuccessfully when no forward progress in resolving imports
+    // is made.
+
+    /// Resolves all imports for the crate. This method performs the fixed-
+    /// point iteration.
+    fn resolve_imports(&mut self) {
+        let mut i = 0;
+        let mut prev_unresolved_imports = 0;
+        loop {
+            debug!("(resolving imports) iteration {}, {} imports left",
+                   i, self.resolver.unresolved_imports);
+
+            let module_root = self.resolver.graph_root.get_module();
+            self.resolve_imports_for_module_subtree(module_root.clone());
+
+            if self.resolver.unresolved_imports == 0 {
+                debug!("(resolving imports) success");
+                break;
+            }
+
+            if self.resolver.unresolved_imports == prev_unresolved_imports {
+                self.resolver.report_unresolved_imports(module_root);
+                break;
+            }
+
+            i += 1;
+            prev_unresolved_imports = self.resolver.unresolved_imports;
+        }
+    }
+
+    /// Attempts to resolve imports for the given module and all of its
+    /// submodules.
+    fn resolve_imports_for_module_subtree(&mut self, module_: Rc<Module>) {
+        debug!("(resolving imports for module subtree) resolving {}",
+               module_to_string(&*module_));
+        let orig_module = replace(&mut self.resolver.current_module, module_.clone());
+        self.resolve_imports_for_module(module_.clone());
+        self.resolver.current_module = orig_module;
+
+        build_reduced_graph::populate_module_if_necessary(self.resolver, &module_);
+        for (_, child_node) in &*module_.children.borrow() {
+            match child_node.get_module_if_available() {
+                None => {
+                    // Nothing to do.
+                }
+                Some(child_module) => {
+                    self.resolve_imports_for_module_subtree(child_module);
+                }
+            }
+        }
+
+        for (_, child_module) in &*module_.anonymous_children.borrow() {
+            self.resolve_imports_for_module_subtree(child_module.clone());
+        }
+    }
+
+    /// Attempts to resolve imports for the given module only.
+    fn resolve_imports_for_module(&mut self, module: Rc<Module>) {
+        if module.all_imports_resolved() {
+            debug!("(resolving imports for module) all imports resolved for \
+                   {}",
+                   module_to_string(&*module));
+            return;
+        }
+
+        let imports = module.imports.borrow();
+        let import_count = imports.len();
+        while module.resolved_import_count.get() < import_count {
+            let import_index = module.resolved_import_count.get();
+            let import_directive = &(*imports)[import_index];
+            match self.resolve_import_for_module(module.clone(),
+                                                 import_directive) {
+                ResolveResult::Failed(err) => {
+                    let (span, help) = match err {
+                        Some((span, msg)) => (span, format!(". {}", msg)),
+                        None => (import_directive.span, String::new())
+                    };
+                    let msg = format!("unresolved import `{}`{}",
+                                      import_path_to_string(
+                                          &import_directive.module_path,
+                                          import_directive.subclass),
+                                      help);
+                    self.resolver.resolve_error(span, &msg[..]);
+                }
+                ResolveResult::Indeterminate => break, // Bail out. We'll come around next time.
+                ResolveResult::Success(()) => () // Good. Continue.
+            }
+
+            module.resolved_import_count
+                  .set(module.resolved_import_count.get() + 1);
+        }
+    }
+
+    /// Attempts to resolve the given import. The return value indicates
+    /// failure if we're certain the name does not exist, indeterminate if we
+    /// don't know whether the name exists at the moment due to other
+    /// currently-unresolved imports, or success if we know the name exists.
+    /// If successful, the resolved bindings are written into the module.
+    fn resolve_import_for_module(&mut self,
+                                 module_: Rc<Module>,
+                                 import_directive: &ImportDirective)
+                                 -> ResolveResult<()> {
+        let mut resolution_result = ResolveResult::Failed(None);
+        let module_path = &import_directive.module_path;
+
+        debug!("(resolving import for module) resolving import `{}::...` in `{}`",
+               names_to_string(&module_path[..]),
+               module_to_string(&*module_));
+
+        // First, resolve the module path for the directive, if necessary.
+        let container = if module_path.len() == 0 {
+            // Use the crate root.
+            Some((self.resolver.graph_root.get_module(), LastMod(AllPublic)))
+        } else {
+            match self.resolver.resolve_module_path(module_.clone(),
+                                                    &module_path[..],
+                                                    UseLexicalScopeFlag::DontUseLexicalScope,
+                                                    import_directive.span,
+                                                    NameSearchType::ImportSearch) {
+                ResolveResult::Failed(err) => {
+                    resolution_result = ResolveResult::Failed(err);
+                    None
+                },
+                ResolveResult::Indeterminate => {
+                    resolution_result = ResolveResult::Indeterminate;
+                    None
+                }
+                ResolveResult::Success(container) => Some(container),
+            }
+        };
+
+        match container {
+            None => {}
+            Some((containing_module, lp)) => {
+                // We found the module that the target is contained
+                // within. Attempt to resolve the import within it.
+
+                match import_directive.subclass {
+                    SingleImport(target, source) => {
+                        resolution_result =
+                            self.resolve_single_import(&module_,
+                                                       containing_module,
+                                                       target,
+                                                       source,
+                                                       import_directive,
+                                                       lp);
+                    }
+                    GlobImport => {
+                        resolution_result =
+                            self.resolve_glob_import(&module_,
+                                                     containing_module,
+                                                     import_directive,
+                                                     lp);
+                    }
+                }
+            }
+        }
+
+        // Decrement the count of unresolved imports.
+        match resolution_result {
+            ResolveResult::Success(()) => {
+                assert!(self.resolver.unresolved_imports >= 1);
+                self.resolver.unresolved_imports -= 1;
+            }
+            _ => {
+                // Nothing to do here; just return the error.
+            }
+        }
+
+        // Decrement the count of unresolved globs if necessary. But only if
+        // the resolution result is indeterminate -- otherwise we'll stop
+        // processing imports here. (See the loop in
+        // resolve_imports_for_module).
+
+        if !resolution_result.indeterminate() {
+            match import_directive.subclass {
+                GlobImport => {
+                    assert!(module_.glob_count.get() >= 1);
+                    module_.glob_count.set(module_.glob_count.get() - 1);
+                }
+                SingleImport(..) => {
+                    // Ignore.
+                }
+            }
+        }
+
+        return resolution_result;
+    }
+
+    fn resolve_single_import(&mut self,
+                             module_: &Module,
+                             target_module: Rc<Module>,
+                             target: Name,
+                             source: Name,
+                             directive: &ImportDirective,
+                             lp: LastPrivate)
+                             -> ResolveResult<()> {
+        debug!("(resolving single import) resolving `{}` = `{}::{}` from \
+                `{}` id {}, last private {:?}",
+               token::get_name(target),
+               module_to_string(&*target_module),
+               token::get_name(source),
+               module_to_string(module_),
+               directive.id,
+               lp);
+
+        let lp = match lp {
+            LastMod(lp) => lp,
+            LastImport {..} => {
+                self.resolver.session
+                    .span_bug(directive.span,
+                              "not expecting Import here, must be LastMod")
+            }
+        };
+
+        // We need to resolve both namespaces for this to succeed.
+        //
+
+        let mut value_result = UnknownResult;
+        let mut type_result = UnknownResult;
+
+        // Search for direct children of the containing module.
+        build_reduced_graph::populate_module_if_necessary(self.resolver, &target_module);
+
+        match target_module.children.borrow().get(&source) {
+            None => {
+                // Continue.
+            }
+            Some(ref child_name_bindings) => {
+                // pub_err makes sure we don't give the same error twice.
+                let mut pub_err = false;
+                if child_name_bindings.defined_in_namespace(ValueNS) {
+                    debug!("(resolving single import) found value binding");
+                    value_result = BoundResult(target_module.clone(),
+                                               (*child_name_bindings).clone());
+                    if directive.is_public && !child_name_bindings.is_public(ValueNS) {
+                        let msg = format!("`{}` is private", token::get_name(source));
+                        span_err!(self.resolver.session, directive.span, E0364, "{}", &msg);
+                        pub_err = true;
+                    }
+                }
+                if child_name_bindings.defined_in_namespace(TypeNS) {
+                    debug!("(resolving single import) found type binding");
+                    type_result = BoundResult(target_module.clone(),
+                                              (*child_name_bindings).clone());
+                    if !pub_err && directive.is_public && !child_name_bindings.is_public(TypeNS) {
+                        let msg = format!("`{}` is private", token::get_name(source));
+                        span_err!(self.resolver.session, directive.span, E0365, "{}", &msg);
+                    }
+                }
+            }
+        }
+
+        // Unless we managed to find a result in both namespaces (unlikely),
+        // search imports as well.
+        let mut value_used_reexport = false;
+        let mut type_used_reexport = false;
+        match (value_result.clone(), type_result.clone()) {
+            (BoundResult(..), BoundResult(..)) => {} // Continue.
+            _ => {
+                // If there is an unresolved glob at this point in the
+                // containing module, bail out. We don't know enough to be
+                // able to resolve this import.
+
+                if target_module.glob_count.get() > 0 {
+                    debug!("(resolving single import) unresolved glob; \
+                            bailing out");
+                    return ResolveResult::Indeterminate;
+                }
+
+                // Now search the exported imports within the containing module.
+                match target_module.import_resolutions.borrow().get(&source) {
+                    None => {
+                        debug!("(resolving single import) no import");
+                        // The containing module definitely doesn't have an
+                        // exported import with the name in question. We can
+                        // therefore accurately report that the names are
+                        // unbound.
+
+                        if value_result.is_unknown() {
+                            value_result = UnboundResult;
+                        }
+                        if type_result.is_unknown() {
+                            type_result = UnboundResult;
+                        }
+                    }
+                    Some(import_resolution)
+                            if import_resolution.outstanding_references == 0 => {
+
+                        fn get_binding(this: &mut Resolver,
+                                       import_resolution: &ImportResolution,
+                                       namespace: Namespace,
+                                       source: &Name)
+                                    -> NamespaceResult {
+
+                            // Import resolutions must be declared with "pub"
+                            // in order to be exported.
+                            if !import_resolution.is_public {
+                                return UnboundResult;
+                            }
+
+                            match import_resolution.target_for_namespace(namespace) {
+                                None => {
+                                    return UnboundResult;
+                                }
+                                Some(Target {
+                                    target_module,
+                                    bindings,
+                                    shadowable: _
+                                }) => {
+                                    debug!("(resolving single import) found \
+                                            import in ns {:?}", namespace);
+                                    let id = import_resolution.id(namespace);
+                                    // track used imports and extern crates as well
+                                    this.used_imports.insert((id, namespace));
+                                    this.record_import_use(id, *source);
+                                    match target_module.def_id.get() {
+                                        Some(DefId{krate: kid, ..}) => {
+                                            this.used_crates.insert(kid);
+                                        },
+                                        _ => {}
+                                    }
+                                    return BoundResult(target_module, bindings);
+                                }
+                            }
+                        }
+
+                        // The name is an import which has been fully
+                        // resolved. We can, therefore, just follow it.
+                        if value_result.is_unknown() {
+                            value_result = get_binding(self.resolver,
+                                                       import_resolution,
+                                                       ValueNS,
+                                                       &source);
+                            value_used_reexport = import_resolution.is_public;
+                        }
+                        if type_result.is_unknown() {
+                            type_result = get_binding(self.resolver,
+                                                      import_resolution,
+                                                      TypeNS,
+                                                      &source);
+                            type_used_reexport = import_resolution.is_public;
+                        }
+
+                    }
+                    Some(_) => {
+                        // If target_module is the same module whose import we are resolving
+                        // and there it has an unresolved import with the same name as `source`,
+                        // then the user is actually trying to import an item that is declared
+                        // in the same scope
+                        //
+                        // e.g
+                        // use self::submodule;
+                        // pub mod submodule;
+                        //
+                        // In this case we continue as if we resolved the import and let the
+                        // check_for_conflicts_between_imports_and_items call below handle
+                        // the conflict
+                        match (module_.def_id.get(),  target_module.def_id.get()) {
+                            (Some(id1), Some(id2)) if id1 == id2  => {
+                                if value_result.is_unknown() {
+                                    value_result = UnboundResult;
+                                }
+                                if type_result.is_unknown() {
+                                    type_result = UnboundResult;
+                                }
+                            }
+                            _ =>  {
+                                // The import is unresolved. Bail out.
+                                debug!("(resolving single import) unresolved import; \
+                                        bailing out");
+                                return ResolveResult::Indeterminate;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        let mut value_used_public = false;
+        let mut type_used_public = false;
+
+        // If we didn't find a result in the type namespace, search the
+        // external modules.
+        match type_result {
+            BoundResult(..) => {}
+            _ => {
+                match target_module.external_module_children.borrow_mut().get(&source).cloned() {
+                    None => {} // Continue.
+                    Some(module) => {
+                        debug!("(resolving single import) found external module");
+                        // track the module as used.
+                        match module.def_id.get() {
+                            Some(DefId{krate: kid, ..}) => {
+                                self.resolver.used_crates.insert(kid);
+                            }
+                            _ => {}
+                        }
+                        let name_bindings =
+                            Rc::new(Resolver::create_name_bindings_from_module(module));
+                        type_result = BoundResult(target_module.clone(), name_bindings);
+                        type_used_public = true;
+                    }
+                }
+            }
+        }
+
+        // We've successfully resolved the import. Write the results in.
+        let mut import_resolutions = module_.import_resolutions.borrow_mut();
+        let import_resolution = &mut (*import_resolutions)[target];
+
+        {
+            let mut check_and_write_import = |namespace, result: &_, used_public: &mut bool| {
+                let namespace_name = match namespace {
+                    TypeNS => "type",
+                    ValueNS => "value",
+                };
+
+                match *result {
+                    BoundResult(ref target_module, ref name_bindings) => {
+                        debug!("(resolving single import) found {:?} target: {:?}",
+                               namespace_name,
+                               name_bindings.def_for_namespace(namespace));
+                        self.check_for_conflicting_import(
+                            &import_resolution.target_for_namespace(namespace),
+                            directive.span,
+                            target,
+                            namespace);
+
+                        self.check_that_import_is_importable(
+                            &**name_bindings,
+                            directive.span,
+                            target,
+                            namespace);
+
+                        let target = Some(Target::new(target_module.clone(),
+                                                      name_bindings.clone(),
+                                                      directive.shadowable));
+                        import_resolution.set_target_and_id(namespace, target, directive.id);
+                        import_resolution.is_public = directive.is_public;
+                        *used_public = name_bindings.defined_in_public_namespace(namespace);
+                    }
+                    UnboundResult => { /* Continue. */ }
+                    UnknownResult => {
+                        panic!("{:?} result should be known at this point", namespace_name);
+                    }
+                }
+            };
+            check_and_write_import(ValueNS, &value_result, &mut value_used_public);
+            check_and_write_import(TypeNS, &type_result, &mut type_used_public);
+        }
+
+        self.check_for_conflicts_between_imports_and_items(
+            module_,
+            import_resolution,
+            directive.span,
+            target);
+
+        if value_result.is_unbound() && type_result.is_unbound() {
+            let msg = format!("There is no `{}` in `{}`",
+                              token::get_name(source),
+                              module_to_string(&target_module));
+            return ResolveResult::Failed(Some((directive.span, msg)));
+        }
+        let value_used_public = value_used_reexport || value_used_public;
+        let type_used_public = type_used_reexport || type_used_public;
+
+        assert!(import_resolution.outstanding_references >= 1);
+        import_resolution.outstanding_references -= 1;
+
+        // Record what this import resolves to for later uses in documentation,
+        // this may resolve to either a value or a type, but for documentation
+        // purposes it's good enough to just favor one over the other.
+        let value_def_and_priv = import_resolution.value_target.as_ref().map(|target| {
+            let def = target.bindings.def_for_namespace(ValueNS).unwrap();
+            (def, if value_used_public { lp } else { DependsOn(def.def_id()) })
+        });
+        let type_def_and_priv = import_resolution.type_target.as_ref().map(|target| {
+            let def = target.bindings.def_for_namespace(TypeNS).unwrap();
+            (def, if type_used_public { lp } else { DependsOn(def.def_id()) })
+        });
+
+        let import_lp = LastImport {
+            value_priv: value_def_and_priv.map(|(_, p)| p),
+            value_used: Used,
+            type_priv: type_def_and_priv.map(|(_, p)| p),
+            type_used: Used
+        };
+
+        if let Some((def, _)) = value_def_and_priv {
+            self.resolver.def_map.borrow_mut().insert(directive.id, PathResolution {
+                base_def: def,
+                last_private: import_lp,
+                depth: 0
+            });
+        }
+        if let Some((def, _)) = type_def_and_priv {
+            self.resolver.def_map.borrow_mut().insert(directive.id, PathResolution {
+                base_def: def,
+                last_private: import_lp,
+                depth: 0
+            });
+        }
+
+        debug!("(resolving single import) successfully resolved import");
+        return ResolveResult::Success(());
+    }
+
+    // Resolves a glob import. Note that this function cannot fail; it either
+    // succeeds or bails out (as importing * from an empty module or a module
+    // that exports nothing is valid). target_module is the module we are
+    // actually importing, i.e., `foo` in `use foo::*`.
+    fn resolve_glob_import(&mut self,
+                           module_: &Module,
+                           target_module: Rc<Module>,
+                           import_directive: &ImportDirective,
+                           lp: LastPrivate)
+                           -> ResolveResult<()> {
+        let id = import_directive.id;
+        let is_public = import_directive.is_public;
+
+        // This function works in a highly imperative manner; it eagerly adds
+        // everything it can to the list of import resolutions of the module
+        // node.
+        debug!("(resolving glob import) resolving glob import {}", id);
+
+        // We must bail out if the node has unresolved imports of any kind
+        // (including globs).
+        if !(*target_module).all_imports_resolved() {
+            debug!("(resolving glob import) target module has unresolved \
+                    imports; bailing out");
+            return ResolveResult::Indeterminate;
+        }
+
+        assert_eq!(target_module.glob_count.get(), 0);
+
+        // Add all resolved imports from the containing module.
+        let import_resolutions = target_module.import_resolutions.borrow();
+        for (ident, target_import_resolution) in &*import_resolutions {
+            debug!("(resolving glob import) writing module resolution \
+                    {} into `{}`",
+                   token::get_name(*ident),
+                   module_to_string(module_));
+
+            if !target_import_resolution.is_public {
+                debug!("(resolving glob import) nevermind, just kidding");
+                continue
+            }
+
+            // Here we merge two import resolutions.
+            let mut import_resolutions = module_.import_resolutions.borrow_mut();
+            match import_resolutions.get_mut(ident) {
+                Some(dest_import_resolution) => {
+                    // Merge the two import resolutions at a finer-grained
+                    // level.
+
+                    match target_import_resolution.value_target {
+                        None => {
+                            // Continue.
+                        }
+                        Some(ref value_target) => {
+                            self.check_for_conflicting_import(&dest_import_resolution.value_target,
+                                                              import_directive.span,
+                                                              *ident,
+                                                              ValueNS);
+                            dest_import_resolution.value_target = Some(value_target.clone());
+                        }
+                    }
+                    match target_import_resolution.type_target {
+                        None => {
+                            // Continue.
+                        }
+                        Some(ref type_target) => {
+                            self.check_for_conflicting_import(&dest_import_resolution.type_target,
+                                                              import_directive.span,
+                                                              *ident,
+                                                              TypeNS);
+                            dest_import_resolution.type_target = Some(type_target.clone());
+                        }
+                    }
+                    dest_import_resolution.is_public = is_public;
+                    continue;
+                }
+                None => {}
+            }
+
+            // Simple: just copy the old import resolution.
+            let mut new_import_resolution = ImportResolution::new(id, is_public);
+            new_import_resolution.value_target =
+                target_import_resolution.value_target.clone();
+            new_import_resolution.type_target =
+                target_import_resolution.type_target.clone();
+
+            import_resolutions.insert(*ident, new_import_resolution);
+        }
+
+        // Add all children from the containing module.
+        build_reduced_graph::populate_module_if_necessary(self.resolver, &target_module);
+
+        for (&name, name_bindings) in &*target_module.children.borrow() {
+            self.merge_import_resolution(module_,
+                                         target_module.clone(),
+                                         import_directive,
+                                         name,
+                                         name_bindings.clone());
+
+        }
+
+        // Add external module children from the containing module.
+        for (&name, module) in &*target_module.external_module_children.borrow() {
+            let name_bindings =
+                Rc::new(Resolver::create_name_bindings_from_module(module.clone()));
+            self.merge_import_resolution(module_,
+                                         target_module.clone(),
+                                         import_directive,
+                                         name,
+                                         name_bindings);
+        }
+
+        // Record the destination of this import
+        if let Some(did) = target_module.def_id.get() {
+            self.resolver.def_map.borrow_mut().insert(id, PathResolution {
+                base_def: DefMod(did),
+                last_private: lp,
+                depth: 0
+            });
+        }
+
+        debug!("(resolving glob import) successfully resolved import");
+        return ResolveResult::Success(());
+    }
+
+    fn merge_import_resolution(&mut self,
+                               module_: &Module,
+                               containing_module: Rc<Module>,
+                               import_directive: &ImportDirective,
+                               name: Name,
+                               name_bindings: Rc<NameBindings>) {
+        let id = import_directive.id;
+        let is_public = import_directive.is_public;
+
+        let mut import_resolutions = module_.import_resolutions.borrow_mut();
+        let dest_import_resolution = import_resolutions.entry(name).get().unwrap_or_else(
+            |vacant_entry| {
+                // Create a new import resolution from this child.
+                vacant_entry.insert(ImportResolution::new(id, is_public))
+            });
+
+        debug!("(resolving glob import) writing resolution `{}` in `{}` \
+               to `{}`",
+               &token::get_name(name),
+               module_to_string(&*containing_module),
+               module_to_string(module_));
+
+        // Merge the child item into the import resolution.
+        {
+            let mut merge_child_item = |namespace| {
+                if name_bindings.defined_in_namespace_with(namespace, IMPORTABLE | PUBLIC) {
+                    let namespace_name = match namespace {
+                        TypeNS => "type",
+                        ValueNS => "value",
+                    };
+                    debug!("(resolving glob import) ... for {} target", namespace_name);
+                    if dest_import_resolution.shadowable(namespace) == Shadowable::Never {
+                        let msg = format!("a {} named `{}` has already been imported \
+                                           in this module",
+                                          namespace_name,
+                                          &token::get_name(name));
+                        span_err!(self.resolver.session, import_directive.span, E0251, "{}", msg);
+                    } else {
+                        let target = Target::new(containing_module.clone(),
+                                                 name_bindings.clone(),
+                                                 import_directive.shadowable);
+                        dest_import_resolution.set_target_and_id(namespace,
+                                                                 Some(target),
+                                                                 id);
+                    }
+                }
+            };
+            merge_child_item(ValueNS);
+            merge_child_item(TypeNS);
+        }
+
+        dest_import_resolution.is_public = is_public;
+
+        self.check_for_conflicts_between_imports_and_items(
+            module_,
+            dest_import_resolution,
+            import_directive.span,
+            name);
+    }
+
+    /// Checks that imported names and items don't have the same name.
+    fn check_for_conflicting_import(&mut self,
+                                    target: &Option<Target>,
+                                    import_span: Span,
+                                    name: Name,
+                                    namespace: Namespace) {
+        debug!("check_for_conflicting_import: {}; target exists: {}",
+               &token::get_name(name),
+               target.is_some());
+
+        match *target {
+            Some(ref target) if target.shadowable != Shadowable::Always => {
+                let msg = format!("a {} named `{}` has already been imported \
+                                   in this module",
+                                  match namespace {
+                                    TypeNS => "type",
+                                    ValueNS => "value",
+                                  },
+                                  &token::get_name(name));
+                span_err!(self.resolver.session, import_span, E0252, "{}", &msg[..]);
+            }
+            Some(_) | None => {}
+        }
+    }
+
+    /// Checks that an import is actually importable
+    fn check_that_import_is_importable(&mut self,
+                                       name_bindings: &NameBindings,
+                                       import_span: Span,
+                                       name: Name,
+                                       namespace: Namespace) {
+        if !name_bindings.defined_in_namespace_with(namespace, IMPORTABLE) {
+            let msg = format!("`{}` is not directly importable",
+                              token::get_name(name));
+            span_err!(self.resolver.session, import_span, E0253, "{}", &msg[..]);
+        }
+    }
+
+    /// Checks that imported names and items don't have the same name.
+    fn check_for_conflicts_between_imports_and_items(&mut self,
+                                                     module: &Module,
+                                                     import_resolution:
+                                                     &ImportResolution,
+                                                     import_span: Span,
+                                                     name: Name) {
+        // First, check for conflicts between imports and `extern crate`s.
+        if module.external_module_children
+                 .borrow()
+                 .contains_key(&name) {
+            match import_resolution.type_target {
+                Some(ref target) if target.shadowable != Shadowable::Always => {
+                    let msg = format!("import `{0}` conflicts with imported \
+                                       crate in this module \
+                                       (maybe you meant `use {0}::*`?)",
+                                      &token::get_name(name));
+                    span_err!(self.resolver.session, import_span, E0254, "{}", &msg[..]);
+                }
+                Some(_) | None => {}
+            }
+        }
+
+        // Check for item conflicts.
+        let children = module.children.borrow();
+        let name_bindings = match children.get(&name) {
+            None => {
+                // There can't be any conflicts.
+                return
+            }
+            Some(ref name_bindings) => (*name_bindings).clone(),
+        };
+
+        match import_resolution.value_target {
+            Some(ref target) if target.shadowable != Shadowable::Always => {
+                if let Some(ref value) = *name_bindings.value_def.borrow() {
+                    span_err!(self.resolver.session, import_span, E0255,
+                              "import `{}` conflicts with value in this module",
+                              &token::get_name(name));
+                    if let Some(span) = value.value_span {
+                        self.resolver.session.span_note(span, "conflicting value here");
+                    }
+                }
+            }
+            Some(_) | None => {}
+        }
+
+        match import_resolution.type_target {
+            Some(ref target) if target.shadowable != Shadowable::Always => {
+                if let Some(ref ty) = *name_bindings.type_def.borrow() {
+                    let (what, note) = if ty.module_def.is_some() {
+                        ("existing submodule", "note conflicting module here")
+                    } else {
+                        ("type in this module", "note conflicting type here")
+                    };
+                    span_err!(self.resolver.session, import_span, E0256,
+                              "import `{}` conflicts with {}",
+                              &token::get_name(name), what);
+                    if let Some(span) = ty.type_span {
+                        self.resolver.session.span_note(span, note);
+                    }
+                }
+            }
+            Some(_) | None => {}
+        }
+    }
+}
+
+fn import_path_to_string(names: &[Name],
+                         subclass: ImportDirectiveSubclass)
+                         -> String {
+    if names.is_empty() {
+        import_directive_subclass_to_string(subclass)
+    } else {
+        (format!("{}::{}",
+                 names_to_string(names),
+                 import_directive_subclass_to_string(subclass))).to_string()
+    }
+}
+
+fn import_directive_subclass_to_string(subclass: ImportDirectiveSubclass) -> String {
+    match subclass {
+        SingleImport(_, source) => {
+            token::get_name(source).to_string()
+        }
+        GlobImport => "*".to_string()
+    }
+}
+
+pub fn resolve_imports(resolver: &mut Resolver) {
+    let mut import_resolver = ImportResolver {
+        resolver: resolver,
+    };
+    import_resolver.resolve_imports();
+}
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 3087a8ea45d..34a23f3efac 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -626,12 +626,7 @@ fn link_rlib<'a>(sess: &'a Session,
                                                  e))
                 }
 
-                let bc_data_deflated = match flate::deflate_bytes(&bc_data[..]) {
-                    Some(compressed) => compressed,
-                    None => sess.fatal(&format!("failed to compress bytecode \
-                                                 from {}",
-                                                 bc_filename.display()))
-                };
+                let bc_data_deflated = flate::deflate_bytes(&bc_data[..]);
 
                 let mut bc_file_deflated = match fs::File::create(&bc_deflated_filename) {
                     Ok(file) => file,
diff --git a/src/librustc_trans/back/lto.rs b/src/librustc_trans/back/lto.rs
index 219f48f78dc..a3ab863c4ec 100644
--- a/src/librustc_trans/back/lto.rs
+++ b/src/librustc_trans/back/lto.rs
@@ -95,8 +95,8 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
                             (link::RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET + data_size as uint)];
 
                         match flate::inflate_bytes(compressed_data) {
-                            Some(inflated) => inflated,
-                            None => {
+                            Ok(inflated) => inflated,
+                            Err(_) => {
                                 sess.fatal(&format!("failed to decompress bc of `{}`",
                                                    name))
                             }
@@ -111,8 +111,8 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
                 // the object must be in the old, pre-versioning format, so simply
                 // inflate everything and let LLVM decide if it can make sense of it
                     match flate::inflate_bytes(bc_encoded) {
-                        Some(bc) => bc,
-                        None => {
+                        Ok(bc) => bc,
+                        Err(_) => {
                             sess.fatal(&format!("failed to decompress bc of `{}`",
                                                name))
                         }
diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs
index 2ab6f5b0f95..bd9313ee9b0 100644
--- a/src/librustc_trans/trans/_match.rs
+++ b/src/librustc_trans/trans/_match.rs
@@ -660,7 +660,7 @@ fn bind_subslice_pat(bcx: Block,
                      offset_right: uint) -> ValueRef {
     let _icx = push_ctxt("match::bind_subslice_pat");
     let vec_ty = node_id_type(bcx, pat_id);
-    let vt = tvec::vec_types(bcx, ty::sequence_element_type(bcx.tcx(), ty::type_content(vec_ty)));
+    let unit_ty = ty::sequence_element_type(bcx.tcx(), ty::type_content(vec_ty));
     let vec_datum = match_datum(val, vec_ty);
     let (base, len) = vec_datum.get_vec_base_and_len(bcx);
 
@@ -669,7 +669,7 @@ fn bind_subslice_pat(bcx: Block,
     let slice_len = Sub(bcx, len, slice_len_offset, DebugLoc::None);
     let slice_ty = ty::mk_slice(bcx.tcx(),
                                 bcx.tcx().mk_region(ty::ReStatic),
-                                ty::mt {ty: vt.unit_ty, mutbl: ast::MutImmutable});
+                                ty::mt {ty: unit_ty, mutbl: ast::MutImmutable});
     let scratch = rvalue_scratch_datum(bcx, slice_ty, "");
     Store(bcx, slice_begin,
           GEPi(bcx, scratch.val, &[0, abi::FAT_PTR_ADDR]));
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
index ccf24f7e859..5f2803835d5 100644
--- a/src/librustc_trans/trans/base.rs
+++ b/src/librustc_trans/trans/base.rs
@@ -57,8 +57,7 @@ use trans::common::{C_null, C_struct_in_context, C_u64, C_u8, C_undef};
 use trans::common::{CrateContext, ExternMap, FunctionContext};
 use trans::common::{Result, NodeIdAndSpan};
 use trans::common::{node_id_type, return_type_is_void};
-use trans::common::{tydesc_info, type_is_immediate};
-use trans::common::{type_is_zero_size, val_ty};
+use trans::common::{type_is_immediate, type_is_zero_size, val_ty};
 use trans::common;
 use trans::consts;
 use trans::context::SharedCrateContext;
@@ -90,7 +89,6 @@ use std::ffi::{CStr, CString};
 use std::cell::{Cell, RefCell};
 use std::collections::HashSet;
 use std::mem;
-use std::rc::Rc;
 use std::str;
 use std::{i8, i16, i32, i64};
 use syntax::abi::{Rust, RustCall, RustIntrinsic, Abi};
@@ -392,22 +390,6 @@ pub fn malloc_raw_dyn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     Result::new(r.bcx, PointerCast(r.bcx, r.val, llty_ptr))
 }
 
-// Type descriptor and type glue stuff
-
-pub fn get_tydesc<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
-                            t: Ty<'tcx>) -> Rc<tydesc_info<'tcx>> {
-    match ccx.tydescs().borrow().get(&t) {
-        Some(inf) => return inf.clone(),
-        _ => { }
-    }
-
-    ccx.stats().n_static_tydescs.set(ccx.stats().n_static_tydescs.get() + 1);
-    let inf = Rc::new(glue::declare_tydesc(ccx, t));
-
-    ccx.tydescs().borrow_mut().insert(t, inf.clone());
-    inf
-}
-
 #[allow(dead_code)] // useful
 pub fn set_optimize_for_size(f: ValueRef) {
     llvm::SetFunctionAttribute(f, llvm::OptimizeForSizeAttribute)
@@ -702,6 +684,10 @@ pub fn iter_structural_ty<'blk, 'tcx, F>(cx: Block<'blk, 'tcx>,
         let unit_ty = ty::sequence_element_type(cx.tcx(), t);
         cx = tvec::iter_vec_raw(cx, base, unit_ty, len, f);
       }
+      ty::ty_vec(_, None) | ty::ty_str => {
+        let unit_ty = ty::sequence_element_type(cx.tcx(), t);
+        cx = tvec::iter_vec_raw(cx, data_ptr, unit_ty, info.unwrap(), f);
+      }
       ty::ty_tup(ref args) => {
           let repr = adt::represent_type(cx.ccx(), t);
           for (i, arg) in args.iter().enumerate() {
@@ -2974,10 +2960,7 @@ pub fn write_metadata(cx: &SharedCrateContext, krate: &ast::Crate) -> Vec<u8> {
     let encode_parms = crate_ctxt_to_encode_parms(cx, encode_inlined_item);
     let metadata = encoder::encode_metadata(encode_parms, krate);
     let mut compressed = encoder::metadata_encoding_version.to_vec();
-    compressed.push_all(&match flate::deflate_bytes(&metadata) {
-        Some(compressed) => compressed,
-        None => cx.sess().fatal("failed to compress metadata"),
-    });
+    compressed.push_all(&flate::deflate_bytes(&metadata));
     let llmeta = C_bytes_in_context(cx.metadata_llcx(), &compressed[..]);
     let llconst = C_struct_in_context(cx.metadata_llcx(), &[llmeta], false);
     let name = format!("rust_metadata_{}_{}",
@@ -3136,7 +3119,6 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
     }
 
     for ccx in shared_ccx.iter() {
-        glue::emit_tydescs(&ccx);
         if ccx.sess().opts.debuginfo != NoDebugInfo {
             debuginfo::finalize(&ccx);
         }
@@ -3148,7 +3130,6 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
     if shared_ccx.sess().trans_stats() {
         let stats = shared_ccx.stats();
         println!("--- trans stats ---");
-        println!("n_static_tydescs: {}", stats.n_static_tydescs.get());
         println!("n_glues_created: {}", stats.n_glues_created.get());
         println!("n_null_glues: {}", stats.n_null_glues.get());
         println!("n_real_glues: {}", stats.n_real_glues.get());
diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs
index 861233bafdf..cf36ec1f3ed 100644
--- a/src/librustc_trans/trans/callee.rs
+++ b/src/librustc_trans/trans/callee.rs
@@ -253,7 +253,7 @@ fn trans_fn_ref_with_substs_to_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 /// Translates an adapter that implements the `Fn` trait for a fn
 /// pointer. This is basically the equivalent of something like:
 ///
-/// ```rust
+/// ```
 /// impl<'a> Fn(&'a int) -> &'a int for fn(&int) -> &int {
 ///     extern "rust-abi" fn call(&self, args: (&'a int,)) -> &'a int {
 ///         (*self)(args.0)
diff --git a/src/librustc_trans/trans/closure.rs b/src/librustc_trans/trans/closure.rs
index 7fa26a7c128..c1bc7219ad8 100644
--- a/src/librustc_trans/trans/closure.rs
+++ b/src/librustc_trans/trans/closure.rs
@@ -259,4 +259,3 @@ pub fn trans_closure_expr<'a, 'tcx>(dest: Dest<'a, 'tcx>,
 
     Some(bcx)
 }
-
diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/trans/common.rs
index 9be1d3eb901..816605e379a 100644
--- a/src/librustc_trans/trans/common.rs
+++ b/src/librustc_trans/trans/common.rs
@@ -317,15 +317,6 @@ pub fn gensym_name(name: &str) -> PathElem {
     PathName(token::gensym(&format!("{}:{}", name, num)))
 }
 
-#[derive(Copy)]
-pub struct tydesc_info<'tcx> {
-    pub ty: Ty<'tcx>,
-    pub tydesc: ValueRef,
-    pub size: ValueRef,
-    pub align: ValueRef,
-    pub name: ValueRef,
-}
-
 /*
 * A note on nomenclature of linking: "extern", "foreign", and "upcall".
 *
diff --git a/src/librustc_trans/trans/consts.rs b/src/librustc_trans/trans/consts.rs
index 8dcabe0a94b..9d2b20f288a 100644
--- a/src/librustc_trans/trans/consts.rs
+++ b/src/librustc_trans/trans/consts.rs
@@ -311,12 +311,15 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                     llconst = addr_of(cx, llconst, "autoref", e.id);
                 }
                 Some(box ty::AutoUnsize(ref k)) => {
-                    let info = expr::unsized_info(cx, k, e.id, ty, param_substs,
-                        |t| ty::mk_imm_rptr(cx.tcx(), cx.tcx().mk_region(ty::ReStatic), t));
+                    let info =
+                        expr::unsized_info(
+                            cx, k, e.id, ty, param_substs,
+                            || const_get_elt(cx, llconst, &[abi::FAT_PTR_EXTRA as u32]));
 
                     let unsized_ty = ty::unsize_ty(cx.tcx(), ty, k, e.span);
                     let ptr_ty = type_of::in_memory_type_of(cx, unsized_ty).ptr_to();
                     let base = ptrcast(llconst, ptr_ty);
+
                     let prev_const = cx.const_unsized().borrow_mut()
                                        .insert(base, llconst);
                     assert!(prev_const.is_none() || prev_const == Some(llconst));
diff --git a/src/librustc_trans/trans/context.rs b/src/librustc_trans/trans/context.rs
index 9777398bddc..6614d538971 100644
--- a/src/librustc_trans/trans/context.rs
+++ b/src/librustc_trans/trans/context.rs
@@ -18,7 +18,7 @@ use middle::traits;
 use trans::adt;
 use trans::base;
 use trans::builder::Builder;
-use trans::common::{ExternMap,tydesc_info,BuilderRef_res};
+use trans::common::{ExternMap,BuilderRef_res};
 use trans::debuginfo;
 use trans::monomorphize::MonoId;
 use trans::type_::{Type, TypeNames};
@@ -38,7 +38,6 @@ use syntax::ast;
 use syntax::parse::token::InternedString;
 
 pub struct Stats {
-    pub n_static_tydescs: Cell<uint>,
     pub n_glues_created: Cell<uint>,
     pub n_null_glues: Cell<uint>,
     pub n_real_glues: Cell<uint>,
@@ -89,10 +88,6 @@ pub struct LocalCrateContext<'tcx> {
     needs_unwind_cleanup_cache: RefCell<FnvHashMap<Ty<'tcx>, bool>>,
     fn_pointer_shims: RefCell<FnvHashMap<Ty<'tcx>, ValueRef>>,
     drop_glues: RefCell<FnvHashMap<Ty<'tcx>, ValueRef>>,
-    tydescs: RefCell<FnvHashMap<Ty<'tcx>, Rc<tydesc_info<'tcx>>>>,
-    /// Set when running emit_tydescs to enforce that no more tydescs are
-    /// created.
-    finished_tydescs: Cell<bool>,
     /// Track mapping of external ids to local items imported for inlining
     external: RefCell<DefIdMap<Option<ast::NodeId>>>,
     /// Backwards version of the `external` map (inlined items to where they
@@ -102,7 +97,7 @@ pub struct LocalCrateContext<'tcx> {
     monomorphized: RefCell<FnvHashMap<MonoId<'tcx>, ValueRef>>,
     monomorphizing: RefCell<DefIdMap<uint>>,
     /// Cache generated vtables
-    vtables: RefCell<FnvHashMap<(Ty<'tcx>, ty::PolyTraitRef<'tcx>), ValueRef>>,
+    vtables: RefCell<FnvHashMap<ty::PolyTraitRef<'tcx>, ValueRef>>,
     /// Cache of constant strings,
     const_cstr_cache: RefCell<FnvHashMap<InternedString, ValueRef>>,
 
@@ -264,7 +259,6 @@ impl<'tcx> SharedCrateContext<'tcx> {
             symbol_hasher: RefCell::new(symbol_hasher),
             tcx: tcx,
             stats: Stats {
-                n_static_tydescs: Cell::new(0),
                 n_glues_created: Cell::new(0),
                 n_null_glues: Cell::new(0),
                 n_real_glues: Cell::new(0),
@@ -399,8 +393,6 @@ impl<'tcx> LocalCrateContext<'tcx> {
                 needs_unwind_cleanup_cache: RefCell::new(FnvHashMap()),
                 fn_pointer_shims: RefCell::new(FnvHashMap()),
                 drop_glues: RefCell::new(FnvHashMap()),
-                tydescs: RefCell::new(FnvHashMap()),
-                finished_tydescs: Cell::new(false),
                 external: RefCell::new(DefIdMap()),
                 external_srcs: RefCell::new(NodeMap()),
                 monomorphized: RefCell::new(FnvHashMap()),
@@ -442,8 +434,6 @@ impl<'tcx> LocalCrateContext<'tcx> {
                 str_slice_ty.set_struct_body(&[Type::i8p(&ccx), ccx.int_type()], false);
                 ccx.tn().associate_type("str_slice", &str_slice_ty);
 
-                ccx.tn().associate_type("tydesc", &Type::tydesc(&ccx, str_slice_ty));
-
                 if ccx.sess().count_llvm_insns() {
                     base::init_insn_ctxt()
                 }
@@ -519,10 +509,6 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
         self.local.builder.b
     }
 
-    pub fn tydesc_type(&self) -> Type {
-        self.local.tn.find_type("tydesc").unwrap()
-    }
-
     pub fn get_intrinsic(&self, key: & &'static str) -> ValueRef {
         if let Some(v) = self.intrinsics().borrow().get(key).cloned() {
             return v;
@@ -590,14 +576,6 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
         &self.local.drop_glues
     }
 
-    pub fn tydescs<'a>(&'a self) -> &'a RefCell<FnvHashMap<Ty<'tcx>, Rc<tydesc_info<'tcx>>>> {
-        &self.local.tydescs
-    }
-
-    pub fn finished_tydescs<'a>(&'a self) -> &'a Cell<bool> {
-        &self.local.finished_tydescs
-    }
-
     pub fn external<'a>(&'a self) -> &'a RefCell<DefIdMap<Option<ast::NodeId>>> {
         &self.local.external
     }
@@ -614,8 +592,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
         &self.local.monomorphizing
     }
 
-    pub fn vtables<'a>(&'a self) -> &'a RefCell<FnvHashMap<(Ty<'tcx>, ty::PolyTraitRef<'tcx>),
-                                                            ValueRef>> {
+    pub fn vtables<'a>(&'a self) -> &'a RefCell<FnvHashMap<ty::PolyTraitRef<'tcx>, ValueRef>> {
         &self.local.vtables
     }
 
diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs
index ecdc7c06bb1..6de67754f11 100644
--- a/src/librustc_trans/trans/expr.rs
+++ b/src/librustc_trans/trans/expr.rs
@@ -287,22 +287,39 @@ pub fn get_dataptr(bcx: Block, fat_ptr: ValueRef) -> ValueRef {
 
 // Retrieve the information we are losing (making dynamic) in an unsizing
 // adjustment.
-// When making a dtor, we need to do different things depending on the
-// ownership of the object.. mk_ty is a function for turning `unadjusted_ty`
-// into a type to be destructed. If we want to end up with a Box pointer,
-// then mk_ty should make a Box pointer (T -> Box<T>), if we want a
-// borrowed reference then it should be T -> &T.
-pub fn unsized_info<'a, 'tcx, F>(ccx: &CrateContext<'a, 'tcx>,
-                                 kind: &ty::UnsizeKind<'tcx>,
-                                 id: ast::NodeId,
-                                 unadjusted_ty: Ty<'tcx>,
-                                 param_substs: &'tcx subst::Substs<'tcx>,
-                                 mk_ty: F) -> ValueRef where
-    F: FnOnce(Ty<'tcx>) -> Ty<'tcx>,
-{
-    // FIXME(#19596) workaround: `|t| t` causes monomorphization recursion
-    fn identity<T>(t: T) -> T { t }
+//
+// The `unadjusted_val` argument is a bit funny. It is intended
+// for use in an upcast, where the new vtable for an object will
+// be drived from the old one. Hence it is a pointer to the fat
+// pointer.
+pub fn unsized_info_bcx<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
+                                    kind: &ty::UnsizeKind<'tcx>,
+                                    id: ast::NodeId,
+                                    unadjusted_ty: Ty<'tcx>,
+                                    unadjusted_val: ValueRef, // see above (*)
+                                    param_substs: &'tcx subst::Substs<'tcx>)
+                                    -> ValueRef {
+    unsized_info(
+        bcx.ccx(),
+        kind,
+        id,
+        unadjusted_ty,
+        param_substs,
+        || Load(bcx, GEPi(bcx, unadjusted_val, &[0, abi::FAT_PTR_EXTRA])))
+}
 
+// Same as `unsize_info_bcx`, but does not require a bcx -- instead it
+// takes an extra closure to compute the upcast vtable.
+pub fn unsized_info<'ccx, 'tcx, MK_UPCAST_VTABLE>(
+    ccx: &CrateContext<'ccx, 'tcx>,
+    kind: &ty::UnsizeKind<'tcx>,
+    id: ast::NodeId,
+    unadjusted_ty: Ty<'tcx>,
+    param_substs: &'tcx subst::Substs<'tcx>,
+    mk_upcast_vtable: MK_UPCAST_VTABLE) // see notes above
+    -> ValueRef
+    where MK_UPCAST_VTABLE: FnOnce() -> ValueRef
+{
     debug!("unsized_info(kind={:?}, id={}, unadjusted_ty={})",
            kind, id, unadjusted_ty.repr(ccx.tcx()));
     match kind {
@@ -310,9 +327,8 @@ pub fn unsized_info<'a, 'tcx, F>(ccx: &CrateContext<'a, 'tcx>,
         &ty::UnsizeStruct(box ref k, tp_index) => match unadjusted_ty.sty {
             ty::ty_struct(_, ref substs) => {
                 let ty_substs = substs.types.get_slice(subst::TypeSpace);
-                // The dtor for a field treats it like a value, so mk_ty
-                // should just be the identity function.
-                unsized_info(ccx, k, id, ty_substs[tp_index], param_substs, identity)
+                unsized_info(ccx, k, id, ty_substs[tp_index], param_substs,
+                             mk_upcast_vtable)
             }
             _ => ccx.sess().bug(&format!("UnsizeStruct with bad sty: {}",
                                          unadjusted_ty.repr(ccx.tcx())))
@@ -326,10 +342,15 @@ pub fn unsized_info<'a, 'tcx, F>(ccx: &CrateContext<'a, 'tcx>,
             let trait_ref = monomorphize::apply_param_substs(ccx.tcx(),
                                                              param_substs,
                                                              &trait_ref);
-            let box_ty = mk_ty(unadjusted_ty);
-            consts::ptrcast(meth::get_vtable(ccx, box_ty, trait_ref, param_substs),
+            consts::ptrcast(meth::get_vtable(ccx, trait_ref, param_substs),
                             Type::vtable_ptr(ccx))
         }
+        &ty::UnsizeUpcast(_) => {
+            // For now, upcasts are limited to changes in marker
+            // traits, and hence never actually require an actual
+            // change to the vtable.
+            mk_upcast_vtable()
+        }
     }
 }
 
@@ -338,7 +359,8 @@ pub fn unsized_info<'a, 'tcx, F>(ccx: &CrateContext<'a, 'tcx>,
 fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                  expr: &ast::Expr,
                                  datum: Datum<'tcx, Expr>)
-                                 -> DatumBlock<'blk, 'tcx, Expr> {
+                                 -> DatumBlock<'blk, 'tcx, Expr>
+{
     let mut bcx = bcx;
     let mut datum = datum;
     let adjustment = match bcx.tcx().adjustments.borrow().get(&expr.id).cloned() {
@@ -347,10 +369,10 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         }
         Some(adj) => { adj }
     };
-    debug!("unadjusted datum for expr {}: {}, adjustment={}",
+    debug!("unadjusted datum for expr {}: {} adjustment={:?}",
            expr.repr(bcx.tcx()),
            datum.to_string(bcx.ccx()),
-           adjustment.repr(bcx.tcx()));
+           adjustment);
     match adjustment {
         AdjustReifyFnPointer(_def_id) => {
             // FIXME(#19925) once fn item types are
@@ -434,7 +456,6 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                 debug!("  AutoUnsize");
                 unpack_datum!(bcx, unsize_expr(bcx, expr, datum, k))
             }
-
             &ty::AutoUnsizeUniq(ty::UnsizeLength(len)) => {
                 debug!("  AutoUnsizeUniq(UnsizeLength)");
                 unpack_datum!(bcx, unsize_unique_vec(bcx, expr, datum, len))
@@ -459,16 +480,26 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         let unsized_ty = ty::unsize_ty(tcx, datum_ty, k, expr.span);
         debug!("unsized_ty={}", unsized_ty.repr(bcx.tcx()));
 
-        let info = unsized_info(bcx.ccx(), k, expr.id, datum_ty, bcx.fcx.param_substs,
-                                |t| ty::mk_imm_rptr(tcx, tcx.mk_region(ty::ReStatic), t));
+        let info = unsized_info_bcx(bcx, k, expr.id, datum_ty, datum.val, bcx.fcx.param_substs);
 
         // Arrange cleanup
-        let lval = unpack_datum!(bcx,
-                                 datum.to_lvalue_datum(bcx, "into_fat_ptr", expr.id));
+        let lval = unpack_datum!(bcx, datum.to_lvalue_datum(bcx, "into_fat_ptr", expr.id));
+
         // Compute the base pointer. This doesn't change the pointer value,
         // but merely its type.
         let ptr_ty = type_of::in_memory_type_of(bcx.ccx(), unsized_ty).ptr_to();
-        let base = PointerCast(bcx, lval.val, ptr_ty);
+        let base = if !type_is_sized(bcx.tcx(), lval.ty) {
+            // Normally, the source is a thin pointer and we are
+            // adding extra info to make a fat pointer. The exception
+            // is when we are upcasting an existing object fat pointer
+            // to use a different vtable. In that case, we want to
+            // load out the original data pointer so we can repackage
+            // it.
+            Load(bcx, get_dataptr(bcx, lval.val))
+        } else {
+            lval.val
+        };
+        let base = PointerCast(bcx, base, ptr_ty);
 
         let llty = type_of::type_of(bcx.ccx(), unsized_ty);
         // HACK(eddyb) get around issues with lifetime intrinsics.
@@ -540,8 +571,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         let base = PointerCast(bcx, get_dataptr(bcx, scratch.val), llbox_ty.ptr_to());
         bcx = datum.store_to(bcx, base);
 
-        let info = unsized_info(bcx.ccx(), k, expr.id, unboxed_ty, bcx.fcx.param_substs,
-                                |t| ty::mk_uniq(tcx, t));
+        let info = unsized_info_bcx(bcx, k, expr.id, unboxed_ty, base, bcx.fcx.param_substs);
         Store(bcx, info, get_len(bcx, scratch.val));
 
         DatumBlock::new(bcx, scratch.to_expr_datum())
@@ -838,10 +868,7 @@ fn trans_index<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                 }
             };
 
-            let vt =
-                tvec::vec_types(bcx,
-                                ty::sequence_element_type(bcx.tcx(),
-                                                          base_datum.ty));
+            let unit_ty = ty::sequence_element_type(bcx.tcx(), base_datum.ty);
 
             let (base, len) = base_datum.get_vec_base_and_len(bcx);
 
@@ -866,8 +893,8 @@ fn trans_index<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                                      len)
             });
             let elt = InBoundsGEP(bcx, base, &[ix_val]);
-            let elt = PointerCast(bcx, elt, vt.llunit_ty.ptr_to());
-            Datum::new(elt, vt.unit_ty, LvalueExpr)
+            let elt = PointerCast(bcx, elt, type_of::type_of(ccx, unit_ty).ptr_to());
+            Datum::new(elt, unit_ty, LvalueExpr)
         }
     };
 
@@ -1373,8 +1400,7 @@ pub fn with_field_tys<'tcx, R, F>(tcx: &ty::ctxt<'tcx>,
                     let def = tcx.def_map.borrow()[node_id].full_def();
                     match def {
                         def::DefVariant(enum_id, variant_id, _) => {
-                            let variant_info = ty::enum_variant_with_id(
-                                tcx, enum_id, variant_id);
+                            let variant_info = ty::enum_variant_with_id(tcx, enum_id, variant_id);
                             let fields = struct_fields(tcx, variant_id, substs);
                             let fields = monomorphize::normalize_associated_type(tcx, &fields);
                             op(variant_info.disr_val, &fields[..])
diff --git a/src/librustc_trans/trans/glue.rs b/src/librustc_trans/trans/glue.rs
index 1151b11d21f..b2de8435f64 100644
--- a/src/librustc_trans/trans/glue.rs
+++ b/src/librustc_trans/trans/glue.rs
@@ -10,12 +10,12 @@
 
 //!
 //
-// Code relating to taking, dropping, etc as well as type descriptors.
+// Code relating to drop glue.
 
 
 use back::abi;
 use back::link::*;
-use llvm::{ValueRef, True, get_param};
+use llvm::{ValueRef, get_param};
 use llvm;
 use middle::lang_items::ExchangeFreeFnLangItem;
 use middle::subst;
@@ -26,24 +26,20 @@ use trans::build::*;
 use trans::callee;
 use trans::cleanup;
 use trans::cleanup::CleanupMethods;
-use trans::consts;
 use trans::common::*;
 use trans::datum;
 use trans::debuginfo::DebugLoc;
 use trans::expr;
 use trans::machine::*;
-use trans::tvec;
 use trans::type_::Type;
-use trans::type_of::{self, type_of, sizing_type_of, align_of};
+use trans::type_of::{type_of, sizing_type_of, align_of};
 use middle::ty::{self, Ty};
 use util::ppaux::{ty_to_short_str, Repr};
 use util::ppaux;
 
 use arena::TypedArena;
 use libc::c_uint;
-use std::ffi::CString;
 use syntax::ast;
-use syntax::parse::token;
 
 pub fn trans_exchange_free_dyn<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
                                            v: ValueRef,
@@ -178,31 +174,46 @@ pub fn get_drop_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Val
 
     let llfnty = Type::glue_fn(ccx, llty);
 
-    let (glue, new_sym) = match ccx.available_drop_glues().borrow().get(&t) {
-        Some(old_sym) => {
-            let glue = decl_cdecl_fn(ccx, &old_sym[..], llfnty, ty::mk_nil(ccx.tcx()));
-            (glue, None)
-        },
-        None => {
-            let (sym, glue) = declare_generic_glue(ccx, t, llfnty, "drop");
-            (glue, Some(sym))
-        },
+    // To avoid infinite recursion, don't `make_drop_glue` until after we've
+    // added the entry to the `drop_glues` cache.
+    if let Some(old_sym) = ccx.available_drop_glues().borrow().get(&t) {
+        let llfn = decl_cdecl_fn(ccx, &old_sym, llfnty, ty::mk_nil(ccx.tcx()));
+        ccx.drop_glues().borrow_mut().insert(t, llfn);
+        return llfn;
     };
 
-    ccx.drop_glues().borrow_mut().insert(t, glue);
+    let fn_nm = mangle_internal_name_by_type_and_seq(ccx, t, "drop");
+    let llfn = decl_cdecl_fn(ccx, &fn_nm, llfnty, ty::mk_nil(ccx.tcx()));
+    note_unique_llvm_symbol(ccx, fn_nm.clone());
+    ccx.available_drop_glues().borrow_mut().insert(t, fn_nm);
 
-    // To avoid infinite recursion, don't `make_drop_glue` until after we've
-    // added the entry to the `drop_glues` cache.
-    match new_sym {
-        Some(sym) => {
-            ccx.available_drop_glues().borrow_mut().insert(t, sym);
-            // We're creating a new drop glue, so also generate a body.
-            make_generic_glue(ccx, t, glue, make_drop_glue, "drop");
-        },
-        None => {},
-    }
+    let _s = StatRecorder::new(ccx, format!("drop {}", ty_to_short_str(ccx.tcx(), t)));
+
+    let empty_substs = ccx.tcx().mk_substs(Substs::trans_empty());
+    let (arena, fcx): (TypedArena<_>, FunctionContext);
+    arena = TypedArena::new();
+    fcx = new_fn_ctxt(ccx, llfn, ast::DUMMY_NODE_ID, false,
+                      ty::FnConverging(ty::mk_nil(ccx.tcx())),
+                      empty_substs, None, &arena);
+
+    let bcx = init_function(&fcx, false, ty::FnConverging(ty::mk_nil(ccx.tcx())));
+
+    update_linkage(ccx, llfn, None, OriginalTranslation);
+
+    ccx.stats().n_glues_created.set(ccx.stats().n_glues_created.get() + 1);
+    // All glue functions take values passed *by alias*; this is a
+    // requirement since in many contexts glue is invoked indirectly and
+    // the caller has no idea if it's dealing with something that can be
+    // passed by value.
+    //
+    // llfn is expected be declared to take a parameter of the appropriate
+    // type, so we don't need to explicitly cast the function parameter.
 
-    glue
+    let llrawptr0 = get_param(llfn, fcx.arg_pos(0) as c_uint);
+    let bcx = make_drop_glue(bcx, llrawptr0, t);
+    finish_fn(&fcx, bcx, ty::FnConverging(ty::mk_nil(ccx.tcx())), DebugLoc::None);
+
+    llfn
 }
 
 fn trans_struct_drop_flag<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
@@ -386,51 +397,34 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty<'tcx>)
     let _icx = push_ctxt("make_drop_glue");
     match t.sty {
         ty::ty_uniq(content_ty) => {
-            match content_ty.sty {
-                ty::ty_vec(ty, None) => {
-                    tvec::make_drop_glue_unboxed(bcx, v0, ty, true)
-                }
-                ty::ty_str => {
-                    let unit_ty = ty::sequence_element_type(bcx.tcx(), content_ty);
-                    tvec::make_drop_glue_unboxed(bcx, v0, unit_ty, true)
-                }
-                ty::ty_trait(..) => {
-                    let lluniquevalue = GEPi(bcx, v0, &[0, abi::FAT_PTR_ADDR]);
-                    // Only drop the value when it is non-null
-                    let concrete_ptr = Load(bcx, lluniquevalue);
-                    with_cond(bcx, IsNotNull(bcx, concrete_ptr), |bcx| {
-                        let dtor_ptr = Load(bcx, GEPi(bcx, v0, &[0, abi::FAT_PTR_EXTRA]));
-                        let dtor = Load(bcx, dtor_ptr);
-                        Call(bcx,
-                             dtor,
-                             &[PointerCast(bcx, lluniquevalue, Type::i8p(bcx.ccx()))],
-                             None,
-                             DebugLoc::None);
-                        bcx
-                    })
-                }
-                ty::ty_struct(..) if !type_is_sized(bcx.tcx(), content_ty) => {
-                    let llval = GEPi(bcx, v0, &[0, abi::FAT_PTR_ADDR]);
-                    let llbox = Load(bcx, llval);
-                    let not_null = IsNotNull(bcx, llbox);
-                    with_cond(bcx, not_null, |bcx| {
-                        let bcx = drop_ty(bcx, v0, content_ty, DebugLoc::None);
-                        let info = GEPi(bcx, v0, &[0, abi::FAT_PTR_EXTRA]);
-                        let info = Load(bcx, info);
-                        let (llsize, llalign) = size_and_align_of_dst(bcx, content_ty, info);
+            if !type_is_sized(bcx.tcx(), content_ty) {
+                let llval = GEPi(bcx, v0, &[0, abi::FAT_PTR_ADDR]);
+                let llbox = Load(bcx, llval);
+                let not_null = IsNotNull(bcx, llbox);
+                with_cond(bcx, not_null, |bcx| {
+                    let bcx = drop_ty(bcx, v0, content_ty, DebugLoc::None);
+                    let info = GEPi(bcx, v0, &[0, abi::FAT_PTR_EXTRA]);
+                    let info = Load(bcx, info);
+                    let (llsize, llalign) = size_and_align_of_dst(bcx, content_ty, info);
+
+                    // `Box<ZeroSizeType>` does not allocate.
+                    let needs_free = ICmp(bcx,
+                                          llvm::IntNE,
+                                          llsize,
+                                          C_uint(bcx.ccx(), 0u64),
+                                          DebugLoc::None);
+                    with_cond(bcx, needs_free, |bcx| {
                         trans_exchange_free_dyn(bcx, llbox, llsize, llalign, DebugLoc::None)
                     })
-                }
-                _ => {
-                    assert!(type_is_sized(bcx.tcx(), content_ty));
-                    let llval = v0;
-                    let llbox = Load(bcx, llval);
-                    let not_null = IsNotNull(bcx, llbox);
-                    with_cond(bcx, not_null, |bcx| {
-                        let bcx = drop_ty(bcx, llbox, content_ty, DebugLoc::None);
-                        trans_exchange_free_ty(bcx, llbox, content_ty, DebugLoc::None)
-                    })
-                }
+                })
+            } else {
+                let llval = v0;
+                let llbox = Load(bcx, llval);
+                let not_null = IsNotNull(bcx, llbox);
+                with_cond(bcx, not_null, |bcx| {
+                    let bcx = drop_ty(bcx, llbox, content_ty, DebugLoc::None);
+                    trans_exchange_free_ty(bcx, llbox, content_ty, DebugLoc::None)
+                })
             }
         }
         ty::ty_struct(did, substs) | ty::ty_enum(did, substs) => {
@@ -462,34 +456,19 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty<'tcx>)
                 }
             }
         }
-        ty::ty_closure(..) => {
-            iter_structural_ty(bcx,
-                               v0,
-                               t,
-                               |bb, vv, tt| drop_ty(bb, vv, tt, DebugLoc::None))
-        }
         ty::ty_trait(..) => {
-            // No need to do a null check here (as opposed to the Box<trait case
-            // above), because this happens for a trait field in an unsized
-            // struct. If anything is null, it is the whole struct and we won't
-            // get here.
-            let lluniquevalue = GEPi(bcx, v0, &[0, abi::FAT_PTR_ADDR]);
-            let dtor_ptr = Load(bcx, GEPi(bcx, v0, &[0, abi::FAT_PTR_EXTRA]));
-            let dtor = Load(bcx, dtor_ptr);
+            let data_ptr = GEPi(bcx, v0, &[0, abi::FAT_PTR_ADDR]);
+            let vtable_ptr = Load(bcx, GEPi(bcx, v0, &[0, abi::FAT_PTR_EXTRA]));
+            let dtor = Load(bcx, vtable_ptr);
             Call(bcx,
                  dtor,
-                 &[PointerCast(bcx, Load(bcx, lluniquevalue), Type::i8p(bcx.ccx()))],
+                 &[PointerCast(bcx, Load(bcx, data_ptr), Type::i8p(bcx.ccx()))],
                  None,
                  DebugLoc::None);
             bcx
-        },
-        ty::ty_vec(_, None) | ty::ty_str => {
-            let unit_ty = ty::sequence_element_type(bcx.tcx(), t);
-            tvec::make_drop_glue_unboxed(bcx, v0, unit_ty, false)
-        },
+        }
         _ => {
-            assert!(type_is_sized(bcx.tcx(), t));
-            if bcx.fcx.type_needs_drop(t) && ty::type_is_structural(t) {
+            if bcx.fcx.type_needs_drop(t) {
                 iter_structural_ty(bcx,
                                    v0,
                                    t,
@@ -500,124 +479,3 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty<'tcx>)
         }
     }
 }
-
-// Generates the declaration for (but doesn't emit) a type descriptor.
-pub fn declare_tydesc<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>)
-                                -> tydesc_info<'tcx> {
-    // If emit_tydescs already ran, then we shouldn't be creating any new
-    // tydescs.
-    assert!(!ccx.finished_tydescs().get());
-
-    // This really shouldn't be like this, size/align will be wrong for
-    // unsized types (i.e. [T] will have the size/align of T).
-    // But we need it until we split this out into a "type name" intrinsic.
-    let llty = type_of::in_memory_type_of(ccx, t);
-
-    if ccx.sess().count_type_sizes() {
-        println!("{}\t{}", llsize_of_real(ccx, llty),
-                 ppaux::ty_to_string(ccx.tcx(), t));
-    }
-
-    let llsize = llsize_of(ccx, llty);
-    let llalign = llalign_of(ccx, llty);
-    let name = mangle_internal_name_by_type_and_seq(ccx, t, "tydesc");
-    debug!("+++ declare_tydesc {} {}", ppaux::ty_to_string(ccx.tcx(), t), name);
-    let buf = CString::new(name.clone()).unwrap();
-    let gvar = unsafe {
-        llvm::LLVMAddGlobal(ccx.llmod(), ccx.tydesc_type().to_ref(),
-                            buf.as_ptr())
-    };
-    note_unique_llvm_symbol(ccx, name);
-
-    let ty_name = token::intern_and_get_ident(
-        &ppaux::ty_to_string(ccx.tcx(), t));
-    let ty_name = C_str_slice(ccx, ty_name);
-
-    debug!("--- declare_tydesc {}", ppaux::ty_to_string(ccx.tcx(), t));
-    tydesc_info {
-        ty: t,
-        tydesc: gvar,
-        size: llsize,
-        align: llalign,
-        name: ty_name,
-    }
-}
-
-fn declare_generic_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>,
-                                  llfnty: Type, name: &str) -> (String, ValueRef) {
-    let _icx = push_ctxt("declare_generic_glue");
-    let fn_nm = mangle_internal_name_by_type_and_seq(
-        ccx,
-        t,
-        &format!("glue_{}", name));
-    let llfn = decl_cdecl_fn(ccx, &fn_nm[..], llfnty, ty::mk_nil(ccx.tcx()));
-    note_unique_llvm_symbol(ccx, fn_nm.clone());
-    return (fn_nm, llfn);
-}
-
-fn make_generic_glue<'a, 'tcx, F>(ccx: &CrateContext<'a, 'tcx>,
-                                  t: Ty<'tcx>,
-                                  llfn: ValueRef,
-                                  helper: F,
-                                  name: &str)
-                                  -> ValueRef where
-    F: for<'blk> FnOnce(Block<'blk, 'tcx>, ValueRef, Ty<'tcx>) -> Block<'blk, 'tcx>,
-{
-    let _icx = push_ctxt("make_generic_glue");
-    let glue_name = format!("glue {} {}", name, ty_to_short_str(ccx.tcx(), t));
-    let _s = StatRecorder::new(ccx, glue_name);
-
-    let empty_substs = ccx.tcx().mk_substs(Substs::trans_empty());
-    let (arena, fcx): (TypedArena<_>, FunctionContext);
-    arena = TypedArena::new();
-    fcx = new_fn_ctxt(ccx, llfn, ast::DUMMY_NODE_ID, false,
-                      ty::FnConverging(ty::mk_nil(ccx.tcx())),
-                      empty_substs, None, &arena);
-
-    let bcx = init_function(&fcx, false, ty::FnConverging(ty::mk_nil(ccx.tcx())));
-
-    update_linkage(ccx, llfn, None, OriginalTranslation);
-
-    ccx.stats().n_glues_created.set(ccx.stats().n_glues_created.get() + 1);
-    // All glue functions take values passed *by alias*; this is a
-    // requirement since in many contexts glue is invoked indirectly and
-    // the caller has no idea if it's dealing with something that can be
-    // passed by value.
-    //
-    // llfn is expected be declared to take a parameter of the appropriate
-    // type, so we don't need to explicitly cast the function parameter.
-
-    let llrawptr0 = get_param(llfn, fcx.arg_pos(0) as c_uint);
-    let bcx = helper(bcx, llrawptr0, t);
-    finish_fn(&fcx, bcx, ty::FnConverging(ty::mk_nil(ccx.tcx())), DebugLoc::None);
-
-    llfn
-}
-
-pub fn emit_tydescs(ccx: &CrateContext) {
-    let _icx = push_ctxt("emit_tydescs");
-    // As of this point, allow no more tydescs to be created.
-    ccx.finished_tydescs().set(true);
-    let glue_fn_ty = Type::generic_glue_fn(ccx).ptr_to();
-    for (_, ti) in &*ccx.tydescs().borrow() {
-        // Each of the glue functions needs to be cast to a generic type
-        // before being put into the tydesc because we only have a singleton
-        // tydesc type. Then we'll recast each function to its real type when
-        // calling it.
-        let drop_glue = consts::ptrcast(get_drop_glue(ccx, ti.ty), glue_fn_ty);
-        ccx.stats().n_real_glues.set(ccx.stats().n_real_glues.get() + 1);
-
-        let tydesc = C_named_struct(ccx.tydesc_type(),
-                                    &[ti.size, // size
-                                      ti.align, // align
-                                      drop_glue, // drop_glue
-                                      ti.name]); // name
-
-        unsafe {
-            let gvar = ti.tydesc;
-            llvm::LLVMSetInitializer(gvar, tydesc);
-            llvm::LLVMSetGlobalConstant(gvar, True);
-            llvm::SetLinkage(gvar, llvm::InternalLinkage);
-        }
-    };
-}
diff --git a/src/librustc_trans/trans/intrinsic.rs b/src/librustc_trans/trans/intrinsic.rs
index 916492195c2..69ca9a5e81c 100644
--- a/src/librustc_trans/trans/intrinsic.rs
+++ b/src/librustc_trans/trans/intrinsic.rs
@@ -347,15 +347,10 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
             bcx = src.store_to(bcx, llargs[0]);
             C_nil(ccx)
         }
-        (_, "get_tydesc") => {
+        (_, "type_name") => {
             let tp_ty = *substs.types.get(FnSpace, 0);
-            let static_ti = get_tydesc(ccx, tp_ty);
-
-            // FIXME (#3730): ideally this shouldn't need a cast,
-            // but there's a circularity between translating rust types to llvm
-            // types and having a tydesc type available. So I can't directly access
-            // the llvm type of intrinsic::TyDesc struct.
-            PointerCast(bcx, static_ti.tydesc, llret_ty)
+            let ty_name = token::intern_and_get_ident(&ty_to_string(ccx.tcx(), tp_ty));
+            C_str_slice(ccx, ty_name)
         }
         (_, "type_id") => {
             let hash = ty::hash_crate_independent(
diff --git a/src/librustc_trans/trans/llrepr.rs b/src/librustc_trans/trans/llrepr.rs
index de0f714276d..6dd56679797 100644
--- a/src/librustc_trans/trans/llrepr.rs
+++ b/src/librustc_trans/trans/llrepr.rs
@@ -34,5 +34,3 @@ impl LlvmRepr for ValueRef {
         ccx.tn().val_to_string(*self)
     }
 }
-
-
diff --git a/src/librustc_trans/trans/machine.rs b/src/librustc_trans/trans/machine.rs
index 1552ac0bea0..9b17c4f8baa 100644
--- a/src/librustc_trans/trans/machine.rs
+++ b/src/librustc_trans/trans/machine.rs
@@ -12,9 +12,7 @@
 
 #![allow(non_camel_case_types)]
 
-use llvm;
-use llvm::{ValueRef};
-use llvm::False;
+use llvm::{self, ValueRef};
 use trans::common::*;
 
 use trans::type_::Type;
@@ -101,16 +99,6 @@ pub fn llalign_of_min(cx: &CrateContext, ty: Type) -> llalign {
     }
 }
 
-// Returns the "default" alignment of t, which is calculated by casting
-// null to a record containing a single-bit followed by a t value, then
-// doing gep(0,1) to get at the trailing (and presumably padded) t cell.
-pub fn llalign_of(cx: &CrateContext, ty: Type) -> ValueRef {
-    unsafe {
-        return llvm::LLVMConstIntCast(
-            llvm::LLVMAlignOf(ty.to_ref()), cx.int_type().to_ref(), False);
-    }
-}
-
 pub fn llelement_offset(cx: &CrateContext, struct_ty: Type, element: uint) -> u64 {
     unsafe {
         return llvm::LLVMOffsetOfElement(cx.td().lltd, struct_ty.to_ref(),
diff --git a/src/librustc_trans/trans/meth.rs b/src/librustc_trans/trans/meth.rs
index b1d705e8683..4da17972c55 100644
--- a/src/librustc_trans/trans/meth.rs
+++ b/src/librustc_trans/trans/meth.rs
@@ -680,11 +680,8 @@ pub fn trans_object_shim<'a, 'tcx>(
 ///
 /// The `trait_ref` encodes the erased self type. Hence if we are
 /// making an object `Foo<Trait>` from a value of type `Foo<T>`, then
-/// `trait_ref` would map `T:Trait`, but `box_ty` would be
-/// `Foo<T>`. This `box_ty` is primarily used to encode the destructor.
-/// This will hopefully change now that DST is underway.
+/// `trait_ref` would map `T:Trait`.
 pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
-                            box_ty: Ty<'tcx>,
                             trait_ref: ty::PolyTraitRef<'tcx>,
                             param_substs: &'tcx subst::Substs<'tcx>)
                             -> ValueRef
@@ -692,13 +689,10 @@ pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     let tcx = ccx.tcx();
     let _icx = push_ctxt("meth::get_vtable");
 
-    debug!("get_vtable(box_ty={}, trait_ref={})",
-           box_ty.repr(tcx),
-           trait_ref.repr(tcx));
+    debug!("get_vtable(trait_ref={})", trait_ref.repr(tcx));
 
     // Check the cache.
-    let cache_key = (box_ty, trait_ref.clone());
-    match ccx.vtables().borrow().get(&cache_key) {
+    match ccx.vtables().borrow().get(&trait_ref) {
         Some(&val) => { return val }
         None => { }
     }
@@ -755,7 +749,7 @@ pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
 
     let components: Vec<_> = vec![
         // Generate a destructor for the vtable.
-        glue::get_drop_glue(ccx, box_ty),
+        glue::get_drop_glue(ccx, trait_ref.self_ty()),
         C_uint(ccx, size),
         C_uint(ccx, align)
     ].into_iter().chain(methods).collect();
@@ -763,7 +757,7 @@ pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     let vtable = consts::addr_of(ccx, C_struct(ccx, &components, false),
                                  "vtable", trait_ref.def_id().node);
 
-    ccx.vtables().borrow_mut().insert(cache_key, vtable);
+    ccx.vtables().borrow_mut().insert(trait_ref, vtable);
     vtable
 }
 
@@ -889,16 +883,15 @@ pub fn trans_trait_cast<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     debug!("trans_trait_cast: trait_ref={}",
            trait_ref.repr(bcx.tcx()));
 
-    let datum_ty = datum.ty;
-    let llbox_ty = type_of(bcx.ccx(), datum_ty);
+    let llty = type_of(bcx.ccx(), datum.ty);
 
     // Store the pointer into the first half of pair.
     let llboxdest = GEPi(bcx, lldest, &[0, abi::FAT_PTR_ADDR]);
-    let llboxdest = PointerCast(bcx, llboxdest, llbox_ty.ptr_to());
+    let llboxdest = PointerCast(bcx, llboxdest, llty.ptr_to());
     bcx = datum.store_to(bcx, llboxdest);
 
     // Store the vtable into the second half of pair.
-    let vtable = get_vtable(bcx.ccx(), datum_ty, trait_ref, bcx.fcx.param_substs);
+    let vtable = get_vtable(bcx.ccx(), trait_ref, bcx.fcx.param_substs);
     let llvtabledest = GEPi(bcx, lldest, &[0, abi::FAT_PTR_EXTRA]);
     let llvtabledest = PointerCast(bcx, llvtabledest, val_ty(vtable).ptr_to());
     Store(bcx, vtable, llvtabledest);
diff --git a/src/librustc_trans/trans/tvec.rs b/src/librustc_trans/trans/tvec.rs
index 2fd79c1ddb4..6a35a1a55b6 100644
--- a/src/librustc_trans/trans/tvec.rs
+++ b/src/librustc_trans/trans/tvec.rs
@@ -24,8 +24,6 @@ use trans::datum::*;
 use trans::debuginfo::DebugLoc;
 use trans::expr::{Dest, Ignore, SaveIn};
 use trans::expr;
-use trans::glue;
-use trans::machine;
 use trans::machine::llsize_of_alloc;
 use trans::type_::Type;
 use trans::type_of;
@@ -35,79 +33,17 @@ use util::ppaux::ty_to_string;
 use syntax::ast;
 use syntax::parse::token::InternedString;
 
-fn get_len(bcx: Block, vptr: ValueRef) -> ValueRef {
-    let _icx = push_ctxt("tvec::get_lenl");
-    Load(bcx, expr::get_len(bcx, vptr))
-}
-
-fn get_dataptr(bcx: Block, vptr: ValueRef) -> ValueRef {
-    let _icx = push_ctxt("tvec::get_dataptr");
-    Load(bcx, expr::get_dataptr(bcx, vptr))
-}
-
-pub fn make_drop_glue_unboxed<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-                                          vptr: ValueRef,
-                                          unit_ty: Ty<'tcx>,
-                                          should_deallocate: bool)
-                                          -> Block<'blk, 'tcx> {
-    let not_null = IsNotNull(bcx, vptr);
-    with_cond(bcx, not_null, |bcx| {
-        let ccx = bcx.ccx();
-        let _icx = push_ctxt("tvec::make_drop_glue_unboxed");
-
-        let dataptr = get_dataptr(bcx, vptr);
-        let bcx = if bcx.fcx.type_needs_drop(unit_ty) {
-            let len = get_len(bcx, vptr);
-            iter_vec_raw(bcx,
-                         dataptr,
-                         unit_ty,
-                         len,
-                         |bb, vv, tt| glue::drop_ty(bb, vv, tt, DebugLoc::None))
-        } else {
-            bcx
-        };
-
-        if should_deallocate {
-            let llty = type_of::type_of(ccx, unit_ty);
-            let unit_size = llsize_of_alloc(ccx, llty);
-            if unit_size != 0 {
-                let len = get_len(bcx, vptr);
-                let not_empty = ICmp(bcx,
-                                     llvm::IntNE,
-                                     len,
-                                     C_uint(ccx, 0_u32),
-                                     DebugLoc::None);
-                with_cond(bcx, not_empty, |bcx| {
-                    let llalign = C_uint(ccx, machine::llalign_of_min(ccx, llty));
-                    let size = Mul(bcx, C_uint(ccx, unit_size), len, DebugLoc::None);
-                    glue::trans_exchange_free_dyn(bcx,
-                                                  dataptr,
-                                                  size,
-                                                  llalign,
-                                                  DebugLoc::None)
-                })
-            } else {
-                bcx
-            }
-        } else {
-            bcx
-        }
-    })
-}
-
 #[derive(Copy)]
-pub struct VecTypes<'tcx> {
-    pub unit_ty: Ty<'tcx>,
-    pub llunit_ty: Type,
-    pub llunit_alloc_size: u64
+struct VecTypes<'tcx> {
+    unit_ty: Ty<'tcx>,
+    llunit_ty: Type
 }
 
 impl<'tcx> VecTypes<'tcx> {
     pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
-        format!("VecTypes {{unit_ty={}, llunit_ty={}, llunit_alloc_size={}}}",
+        format!("VecTypes {{unit_ty={}, llunit_ty={}}}",
                 ty_to_string(ccx.tcx(), self.unit_ty),
-                ccx.tn().type_to_string(self.llunit_ty),
-                self.llunit_alloc_size)
+                ccx.tn().type_to_string(self.llunit_ty))
     }
 }
 
@@ -221,12 +157,12 @@ pub fn trans_lit_str<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     }
 }
 
-pub fn write_content<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-                                 vt: &VecTypes<'tcx>,
-                                 vstore_expr: &ast::Expr,
-                                 content_expr: &ast::Expr,
-                                 dest: Dest)
-                                 -> Block<'blk, 'tcx> {
+fn write_content<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
+                             vt: &VecTypes<'tcx>,
+                             vstore_expr: &ast::Expr,
+                             content_expr: &ast::Expr,
+                             dest: Dest)
+                             -> Block<'blk, 'tcx> {
     let _icx = push_ctxt("tvec::write_content");
     let fcx = bcx.fcx;
     let mut bcx = bcx;
@@ -315,28 +251,21 @@ pub fn write_content<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     }
 }
 
-pub fn vec_types_from_expr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-                                       vec_expr: &ast::Expr)
-                                       -> VecTypes<'tcx> {
+fn vec_types_from_expr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, vec_expr: &ast::Expr)
+                                   -> VecTypes<'tcx> {
     let vec_ty = node_id_type(bcx, vec_expr.id);
     vec_types(bcx, ty::sequence_element_type(bcx.tcx(), vec_ty))
 }
 
-pub fn vec_types<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-                             unit_ty: Ty<'tcx>)
-                             -> VecTypes<'tcx> {
-    let ccx = bcx.ccx();
-    let llunit_ty = type_of::type_of(ccx, unit_ty);
-    let llunit_alloc_size = llsize_of_alloc(ccx, llunit_ty);
-
+fn vec_types<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, unit_ty: Ty<'tcx>)
+                         -> VecTypes<'tcx> {
     VecTypes {
         unit_ty: unit_ty,
-        llunit_ty: llunit_ty,
-        llunit_alloc_size: llunit_alloc_size
+        llunit_ty: type_of::type_of(bcx.ccx(), unit_ty)
     }
 }
 
-pub fn elements_required(bcx: Block, content_expr: &ast::Expr) -> uint {
+fn elements_required(bcx: Block, content_expr: &ast::Expr) -> uint {
     //! Figure out the number of elements we need to store this content
 
     match content_expr.node {
@@ -401,12 +330,12 @@ pub fn get_base_and_len<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     }
 }
 
-pub fn iter_vec_loop<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
-                                     data_ptr: ValueRef,
-                                     vt: &VecTypes<'tcx>,
-                                     count: ValueRef,
-                                     f: F)
-                                     -> Block<'blk, 'tcx> where
+fn iter_vec_loop<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
+                                data_ptr: ValueRef,
+                                vt: &VecTypes<'tcx>,
+                                count: ValueRef,
+                                f: F)
+                                -> Block<'blk, 'tcx> where
     F: FnOnce(Block<'blk, 'tcx>, ValueRef, Ty<'tcx>) -> Block<'blk, 'tcx>,
 {
     let _icx = push_ctxt("tvec::iter_vec_loop");
@@ -426,7 +355,7 @@ pub fn iter_vec_loop<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
 
     let bcx = loop_bcx;
 
-    let lleltptr = if vt.llunit_alloc_size == 0 {
+    let lleltptr = if llsize_of_alloc(bcx.ccx(), vt.llunit_ty) == 0 {
         data_ptr
     } else {
         InBoundsGEP(bcx, data_ptr, &[loop_counter])
@@ -454,7 +383,7 @@ pub fn iter_vec_raw<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
 
     let vt = vec_types(bcx, unit_ty);
 
-    if vt.llunit_alloc_size == 0 {
+    if llsize_of_alloc(bcx.ccx(), vt.llunit_ty) == 0 {
         // Special-case vectors with elements of size 0  so they don't go out of bounds (#9890)
         iter_vec_loop(bcx, data_ptr, &vt, len, f)
     } else {
@@ -471,7 +400,7 @@ pub fn iter_vec_raw<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
         let body_bcx = fcx.new_temp_block("iter_vec_loop_body");
         let next_bcx = fcx.new_temp_block("iter_vec_next");
         CondBr(header_bcx, not_yet_at_end, body_bcx.llbb, next_bcx.llbb, DebugLoc::None);
-        let body_bcx = f(body_bcx, data_ptr, vt.unit_ty);
+        let body_bcx = f(body_bcx, data_ptr, unit_ty);
         AddIncomingToPhi(data_ptr, InBoundsGEP(body_bcx, data_ptr,
                                                &[C_int(bcx.ccx(), 1)]),
                          body_bcx.llbb);
diff --git a/src/librustc_trans/trans/type_.rs b/src/librustc_trans/trans/type_.rs
index d5ec18e641b..dcb57fd9cde 100644
--- a/src/librustc_trans/trans/type_.rs
+++ b/src/librustc_trans/trans/type_.rs
@@ -175,41 +175,10 @@ impl Type {
         Type::array(&Type::i8p(ccx).ptr_to(), 1)
     }
 
-    pub fn generic_glue_fn(cx: &CrateContext) -> Type {
-        match cx.tn().find_type("glue_fn") {
-            Some(ty) => return ty,
-            None => ()
-        }
-
-        let ty = Type::glue_fn(cx, Type::i8p(cx));
-        cx.tn().associate_type("glue_fn", &ty);
-
-        ty
-    }
-
     pub fn glue_fn(ccx: &CrateContext, t: Type) -> Type {
         Type::func(&[t], &Type::void(ccx))
     }
 
-    pub fn tydesc(ccx: &CrateContext, str_slice_ty: Type) -> Type {
-        let mut tydesc = Type::named_struct(ccx, "tydesc");
-        let glue_fn_ty = Type::glue_fn(ccx, Type::i8p(ccx)).ptr_to();
-
-        let int_ty = Type::int(ccx);
-
-        // Must mirror:
-        //
-        // std::unstable::intrinsics::TyDesc
-
-        let elems = [int_ty,     // size
-                     int_ty,     // align
-                     glue_fn_ty, // drop
-                     str_slice_ty]; // name
-        tydesc.set_struct_body(&elems, false);
-
-        tydesc
-    }
-
     pub fn array(ty: &Type, len: u64) -> Type {
         ty!(llvm::LLVMRustArrayType(ty.to_ref(), len))
     }
diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs
index 0d4edc01a4c..32f91a175f3 100644
--- a/src/librustc_typeck/check/closure.rs
+++ b/src/librustc_typeck/check/closure.rs
@@ -248,5 +248,3 @@ fn self_type_matches_expected_vid<'a,'tcx>(
         _ => None,
     }
 }
-
-
diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs
index 04a3f423dce..4e42ec61011 100644
--- a/src/librustc_typeck/check/coercion.rs
+++ b/src/librustc_typeck/check/coercion.rs
@@ -334,15 +334,33 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
                     let ty = ty::mk_vec(tcx, t_a, None);
                     Some((ty, ty::UnsizeLength(len)))
                 }
-                (&ty::ty_trait(..), &ty::ty_trait(..)) => {
-                    None
+                (&ty::ty_trait(ref data_a), &ty::ty_trait(ref data_b)) => {
+                    // For now, we only support upcasts from
+                    // `Foo+Send` to `Foo` (really, any time there are
+                    // fewer builtin bounds then before). These are
+                    // convenient because they don't require any sort
+                    // of change to the vtable at runtime.
+                    if data_a.bounds.builtin_bounds != data_b.bounds.builtin_bounds &&
+                        data_a.bounds.builtin_bounds.is_superset(&data_b.bounds.builtin_bounds)
+                    {
+                        let bounds_a1 = ty::ExistentialBounds {
+                            region_bound: data_a.bounds.region_bound,
+                            builtin_bounds: data_b.bounds.builtin_bounds,
+                            projection_bounds: data_a.bounds.projection_bounds.clone(),
+                        };
+                        let ty_a1 = ty::mk_trait(tcx, data_a.principal.clone(), bounds_a1);
+                        match self.fcx.infcx().try(|_| self.subtype(ty_a1, ty_b)) {
+                            Ok(_) => Some((ty_b, ty::UnsizeUpcast(ty_b))),
+                            Err(_) => None,
+                        }
+                    } else {
+                        None
+                    }
                 }
-                (_, &ty::ty_trait(box ty::TyTrait { ref principal, ref bounds })) => {
-                    // FIXME what is the purpose of `ty`?
-                    let ty = ty::mk_trait(tcx, principal.clone(), bounds.clone());
-                    Some((ty, ty::UnsizeVtable(ty::TyTrait { principal: principal.clone(),
-                                                             bounds: bounds.clone() },
-                                               ty_a)))
+                (_, &ty::ty_trait(ref data)) => {
+                    Some((ty_b, ty::UnsizeVtable(ty::TyTrait { principal: data.principal.clone(),
+                                                               bounds: data.bounds.clone() },
+                                                 ty_a)))
                 }
                 (&ty::ty_struct(did_a, substs_a), &ty::ty_struct(did_b, substs_b))
                   if did_a == did_b => {
diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs
index 6ef6953f707..6aefcf5a47c 100644
--- a/src/librustc_typeck/check/method/confirm.rs
+++ b/src/librustc_typeck/check/method/confirm.rs
@@ -176,13 +176,13 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> {
             probe::AutoDeref(num) => {
                 ty::AutoDerefRef {
                     autoderefs: num,
-                    autoref: None
+                    autoref: None,
                 }
             }
             probe::AutoUnsizeLength(autoderefs, len) => {
                 ty::AutoDerefRef {
                     autoderefs: autoderefs,
-                    autoref: Some(ty::AutoUnsize(ty::UnsizeLength(len)))
+                    autoref: Some(ty::AutoUnsize(ty::UnsizeLength(len))),
                 }
             }
             probe::AutoRef(mutability, ref sub_adjustment) => {
diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs
index 1f7cc3bb647..bc581a6af41 100644
--- a/src/librustc_typeck/check/method/probe.rs
+++ b/src/librustc_typeck/check/method/probe.rs
@@ -933,7 +933,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
 
         return self.pick_method(step.self_ty).map(|r| self.adjust(r, adjustment.clone()));
 
-        fn consider_reborrow(ty: Ty, d: uint) -> PickAdjustment {
+        fn consider_reborrow<'tcx>(ty: Ty<'tcx>, d: uint) -> PickAdjustment {
             // Insert a `&*` or `&mut *` if this is a reference type:
             match ty.sty {
                 ty::ty_rptr(_, ref mt) => AutoRef(mt.mutbl, box AutoDeref(d+1)),
@@ -978,7 +978,8 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
     fn adjust(&mut self,
               result: PickResult<'tcx>,
               adjustment: PickAdjustment)
-              -> PickResult<'tcx> {
+              -> PickResult<'tcx>
+    {
         match result {
             Err(e) => Err(e),
             Ok(mut pick) => {
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 41951ab2b62..de0978bc409 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -1592,6 +1592,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                                                       code: traits::ObjectCastObligation(self_ty) };
                 self.register_region_obligation(self_ty, ty_trait.bounds.region_bound, cause);
             }
+            ty::UnsizeUpcast(_) => { }
         }
     }
 
@@ -5346,17 +5347,8 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &ast::ForeignItem) {
             "needs_drop" => (1, Vec::new(), ccx.tcx.types.bool),
             "owns_managed" => (1, Vec::new(), ccx.tcx.types.bool),
 
-            "get_tydesc" => {
-              let tydesc_ty = match ty::get_tydesc_ty(ccx.tcx) {
-                  Ok(t) => t,
-                  Err(s) => { span_fatal!(tcx.sess, it.span, E0240, "{}", &s[..]); }
-              };
-              let td_ptr = ty::mk_ptr(ccx.tcx, ty::mt {
-                  ty: tydesc_ty,
-                  mutbl: ast::MutImmutable
-              });
-              (1, Vec::new(), td_ptr)
-            }
+            "type_name" => (1, Vec::new(), ty::mk_str_slice(tcx, tcx.mk_region(ty::ReStatic),
+                                                             ast::MutImmutable)),
             "type_id" => (1, Vec::new(), ccx.tcx.types.u64),
             "offset" => {
               (1,
diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs
index f452c8488ce..17fc2aad286 100644
--- a/src/librustc_typeck/check/upvar.rs
+++ b/src/librustc_typeck/check/upvar.rs
@@ -556,5 +556,3 @@ impl<'a,'tcx> euv::Delegate<'tcx> for AdjustBorrowKind<'a,'tcx> {
         self.adjust_upvar_borrow_kind_for_mut(assignee_cmt);
     }
 }
-
-
diff --git a/src/librustc_typeck/check/vtable.rs b/src/librustc_typeck/check/vtable.rs
index 630530cf11f..963be9aa2e2 100644
--- a/src/librustc_typeck/check/vtable.rs
+++ b/src/librustc_typeck/check/vtable.rs
@@ -302,4 +302,3 @@ pub fn select_new_fcx_obligations(fcx: &FnCtxt) {
         Err(errors) => { report_fulfillment_errors(fcx.infcx(), &errors); }
     }
 }
-
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 23726805767..97cc3ac7c48 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -102,15 +102,6 @@ use syntax::visit;
 pub fn collect_item_types(tcx: &ty::ctxt) {
     let ccx = &CrateCtxt { tcx: tcx, stack: RefCell::new(Vec::new()) };
 
-    match ccx.tcx.lang_items.ty_desc() {
-        Some(id) => { collect_intrinsic_type(ccx, id); }
-        None => {}
-    }
-    match ccx.tcx.lang_items.opaque() {
-        Some(id) => { collect_intrinsic_type(ccx, id); }
-        None => {}
-    }
-
     let mut visitor = CollectTraitDefVisitor{ ccx: ccx };
     visit::walk_crate(&mut visitor, ccx.tcx.map.krate());
 
@@ -153,15 +144,6 @@ enum AstConvRequest {
 }
 
 ///////////////////////////////////////////////////////////////////////////
-// Zeroth phase: collect types of intrinsics
-
-fn collect_intrinsic_type(ccx: &CrateCtxt,
-                          lang_item: ast::DefId) {
-    let ty::TypeScheme { ty, .. } = type_scheme_of_def_id(ccx, lang_item);
-    ccx.tcx.intrinsic_defs.borrow_mut().insert(lang_item, ty);
-}
-
-///////////////////////////////////////////////////////////////////////////
 // First phase: just collect *trait definitions* -- basically, the set
 // of type parameters and supertraits. This is information we need to
 // know later when parsing field defs.
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs
index 03fa269ccf8..396d060de9e 100644
--- a/src/librustc_typeck/diagnostics.rs
+++ b/src/librustc_typeck/diagnostics.rs
@@ -181,4 +181,3 @@ register_diagnostics! {
 }
 
 __build_diagnostic_array! { DIAGNOSTICS }
-
diff --git a/src/librustc_typeck/variance.rs b/src/librustc_typeck/variance.rs
index 9b27128ce2f..ac1ff29e7f5 100644
--- a/src/librustc_typeck/variance.rs
+++ b/src/librustc_typeck/variance.rs
@@ -1350,4 +1350,3 @@ fn glb(v1: ty::Variance, v2: ty::Variance) -> ty::Variance {
         (x, ty::Bivariant) | (ty::Bivariant, x) => x,
     }
 }
-
diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs
index 1d63f01be52..d2385702a73 100644
--- a/src/librustdoc/html/item_type.rs
+++ b/src/librustdoc/html/item_type.rs
@@ -111,4 +111,3 @@ impl fmt::Display for ItemType {
         self.to_static_str().fmt(f)
     }
 }
-
diff --git a/src/librustdoc/html/static/Heuristica-LICENSE.txt b/src/librustdoc/html/static/Heuristica-LICENSE.txt
index 9693dc1db2d..dd85e40e645 100644
--- a/src/librustdoc/html/static/Heuristica-LICENSE.txt
+++ b/src/librustdoc/html/static/Heuristica-LICENSE.txt
@@ -1,7 +1,7 @@
 Copyright 1989, 1991 Adobe Systems Incorporated. All rights reserved.
 Utopia is either a registered trademark or trademark of Adobe Systems
 Incorporated in the United States and/or other countries. Used under
-license. 
+license.
 
 Copyright 2006 Han The Thanh, Vntopia font family, http://vntex.sf.net
 
@@ -26,7 +26,7 @@ with others.
 
 The OFL allows the licensed fonts to be used, studied, modified and
 redistributed freely as long as they are not sold by themselves. The
-fonts, including any derivative works, can be bundled, embedded, 
+fonts, including any derivative works, can be bundled, embedded,
 redistributed and/or sold with any software provided that any reserved
 names are not used by derivative works. The fonts and derivatives,
 however, cannot be released under any other type of license. The
diff --git a/src/librustdoc/html/static/SourceCodePro-LICENSE.txt b/src/librustdoc/html/static/SourceCodePro-LICENSE.txt
index 1177330426d..07542572e33 100644
--- a/src/librustdoc/html/static/SourceCodePro-LICENSE.txt
+++ b/src/librustdoc/html/static/SourceCodePro-LICENSE.txt
@@ -18,7 +18,7 @@ with others.
 
 The OFL allows the licensed fonts to be used, studied, modified and
 redistributed freely as long as they are not sold by themselves. The
-fonts, including any derivative works, can be bundled, embedded, 
+fonts, including any derivative works, can be bundled, embedded,
 redistributed and/or sold with any software provided that any reserved
 names are not used by derivative works. The fonts and derivatives,
 however, cannot be released under any other type of license. The
diff --git a/src/librustdoc/html/static/SourceSerifPro-LICENSE.txt b/src/librustdoc/html/static/SourceSerifPro-LICENSE.txt
index 14b54813758..b77d653ad4f 100644
--- a/src/librustdoc/html/static/SourceSerifPro-LICENSE.txt
+++ b/src/librustdoc/html/static/SourceSerifPro-LICENSE.txt
@@ -18,7 +18,7 @@ with others.
 
 The OFL allows the licensed fonts to be used, studied, modified and
 redistributed freely as long as they are not sold by themselves. The
-fonts, including any derivative works, can be bundled, embedded, 
+fonts, including any derivative works, can be bundled, embedded,
 redistributed and/or sold with any software provided that any reserved
 names are not used by derivative works. The fonts and derivatives,
 however, cannot be released under any other type of license. The
diff --git a/src/librustdoc/html/static/playpen.js b/src/librustdoc/html/static/playpen.js
index 8fb979875cd..06b3c4e42d6 100644
--- a/src/librustdoc/html/static/playpen.js
+++ b/src/librustdoc/html/static/playpen.js
@@ -25,4 +25,3 @@
         });
     }
 }());
-
diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs
index 26994a6d79d..1f8d45a007d 100644
--- a/src/libserialize/hex.rs
+++ b/src/libserialize/hex.rs
@@ -31,7 +31,7 @@ impl ToHex for [u8] {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// extern crate serialize;
     /// use serialize::hex::ToHex;
     ///
@@ -100,7 +100,7 @@ impl FromHex for str {
     ///
     /// This converts a string literal to hexadecimal and back.
     ///
-    /// ```rust
+    /// ```
     /// extern crate serialize;
     /// use serialize::hex::{FromHex, ToHex};
     ///
diff --git a/src/libstd/bool.rs b/src/libstd/bool.rs
index 0d8b233a169..df703b3e43e 100644
--- a/src/libstd/bool.rs
+++ b/src/libstd/bool.rs
@@ -12,4 +12,3 @@
 
 #![doc(primitive = "bool")]
 #![stable(feature = "rust1", since = "1.0.0")]
-
diff --git a/src/libstd/env.rs b/src/libstd/env.rs
index 27f78906ec2..4b6fbe01f76 100644
--- a/src/libstd/env.rs
+++ b/src/libstd/env.rs
@@ -41,7 +41,7 @@ use sys::os as os_imp;
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 ///
 /// // We assume that we are in a valid directory.
@@ -58,7 +58,7 @@ pub fn current_dir() -> io::Result<PathBuf> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 /// use std::path::Path;
 ///
@@ -102,7 +102,7 @@ pub struct VarsOs { inner: os_imp::Env }
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 ///
 /// // We will iterate through the references to the element returned by
@@ -125,7 +125,7 @@ pub fn vars() -> Vars {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 ///
 /// // We will iterate through the references to the element returned by
@@ -166,7 +166,7 @@ impl Iterator for VarsOs {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 ///
 /// let key = "HOME";
@@ -188,7 +188,7 @@ pub fn var<K: ?Sized>(key: &K) -> Result<String, VarError> where K: AsOsStr {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 ///
 /// let key = "HOME";
@@ -246,7 +246,7 @@ impl Error for VarError {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 ///
 /// let key = "KEY";
@@ -282,7 +282,7 @@ pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 ///
 /// let key = "PATH";
@@ -326,7 +326,7 @@ pub struct JoinPathsError {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 /// use std::path::PathBuf;
 ///
@@ -374,7 +374,7 @@ impl Error for JoinPathsError {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 ///
 /// match env::home_dir() {
@@ -416,7 +416,7 @@ pub fn temp_dir() -> PathBuf {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 ///
 /// match env::current_exe() {
@@ -481,7 +481,7 @@ pub struct ArgsOs { inner: os_imp::Args }
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 ///
 /// // Prints each argument on a separate line
@@ -503,7 +503,7 @@ pub fn args() -> Args {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::env;
 ///
 /// // Prints each argument on a separate line
diff --git a/src/libstd/fs/mod.rs b/src/libstd/fs/mod.rs
index d072d1f102b..ba89b3a0ea6 100644
--- a/src/libstd/fs/mod.rs
+++ b/src/libstd/fs/mod.rs
@@ -473,7 +473,7 @@ pub fn rename<P: AsPath, Q: AsPath>(from: P, to: Q) -> io::Result<()> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::fs;
 ///
 /// fs::copy("foo.txt", "bar.txt");
@@ -540,7 +540,7 @@ pub fn read_link<P: AsPath>(path: P) -> io::Result<PathBuf> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::fs;
 ///
 /// fs::create_dir("/some/dir");
@@ -576,7 +576,7 @@ pub fn create_dir_all<P: AsPath>(path: P) -> io::Result<()> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::fs;
 ///
 /// fs::remove_dir("/some/dir");
@@ -627,7 +627,7 @@ pub fn remove_dir_all<P: AsPath>(path: P) -> io::Result<()> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::io;
 /// use std::fs::{self, PathExt, DirEntry};
 /// use std::path::Path;
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 03416eb86a0..73dcf058e45 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -118,15 +118,16 @@ impl<R> fmt::Debug for BufReader<R> where R: fmt::Debug {
 /// `BufWriter` keeps an in memory buffer of data and writes it to the
 /// underlying `Write` in large, infrequent batches.
 ///
-/// This writer will be flushed when it is dropped.
+/// The buffer will be written out when the writer is dropped.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct BufWriter<W> {
     inner: Option<W>,
     buf: Vec<u8>,
 }
 
-/// An error returned by `into_inner` which indicates whether a flush error
-/// happened or not.
+/// An error returned by `into_inner` which combines an error that
+/// happened while writing out the buffer, and the buffered writer object
+/// which may be used to recover from the condition.
 #[derive(Debug)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct IntoInnerError<W>(W, Error);
@@ -155,7 +156,7 @@ impl<W: Write> BufWriter<W> {
             match self.inner.as_mut().unwrap().write(&self.buf[written..]) {
                 Ok(0) => {
                     ret = Err(Error::new(ErrorKind::WriteZero,
-                                         "failed to flush", None));
+                                         "failed to write the buffered data", None));
                     break;
                 }
                 Ok(n) => written += n,
@@ -190,7 +191,7 @@ impl<W: Write> BufWriter<W> {
 
     /// Unwraps this `BufWriter`, returning the underlying writer.
     ///
-    /// The buffer is flushed before returning the writer.
+    /// The buffer is written out before returning the writer.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn into_inner(mut self) -> Result<W, IntoInnerError<BufWriter<W>>> {
         match self.flush_buf() {
@@ -239,14 +240,14 @@ impl<W: Write> Drop for BufWriter<W> {
 impl<W> IntoInnerError<W> {
     /// Returns the error which caused the call to `into_inner` to fail.
     ///
-    /// This error was returned when attempting to flush the internal buffer.
+    /// This error was returned when attempting to write the internal buffer.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn error(&self) -> &Error { &self.1 }
 
-    /// Returns the underlying `BufWriter` instance which generated the error.
+    /// Returns the buffered writer instance which generated the error.
     ///
-    /// The returned object can be used to retry a flush or re-inspect the
-    /// buffer.
+    /// The returned object can be used for error recovery, such as
+    /// re-inspecting the buffer.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn into_inner(self) -> W { self.0 }
 }
@@ -273,7 +274,7 @@ impl<W> fmt::Display for IntoInnerError<W> {
 /// Wraps a Writer and buffers output to it, flushing whenever a newline
 /// (`0x0a`, `'\n'`) is detected.
 ///
-/// This writer will be flushed when it is dropped.
+/// The buffer will be written out when the writer is dropped.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct LineWriter<W> {
     inner: BufWriter<W>,
@@ -307,7 +308,7 @@ impl<W: Write> LineWriter<W> {
 
     /// Unwraps this `LineWriter`, returning the underlying writer.
     ///
-    /// The internal buffer is flushed before returning the writer.
+    /// The internal buffer is written out before returning the writer.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn into_inner(self) -> Result<W, IntoInnerError<LineWriter<W>>> {
         self.inner.into_inner().map_err(|IntoInnerError(buf, e)| {
@@ -364,7 +365,7 @@ impl<W: Read> Read for InternalBufWriter<W> {
 /// call. A `BufStream` keeps in memory buffers of data, making large,
 /// infrequent calls to `read` and `write` on the underlying `Read+Write`.
 ///
-/// The output half will be flushed when this stream is dropped.
+/// The output buffer will be written out when this stream is dropped.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct BufStream<S> {
     inner: BufReader<InternalBufWriter<S>>
@@ -410,8 +411,8 @@ impl<S: Read + Write> BufStream<S> {
 
     /// Unwraps this `BufStream`, returning the underlying stream.
     ///
-    /// The internal buffer is flushed before returning the stream. Any leftover
-    /// data in the read buffer is lost.
+    /// The internal write buffer is written out before returning the stream.
+    /// Any leftover data in the read buffer is lost.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn into_inner(self) -> Result<S, IntoInnerError<BufStream<S>>> {
         let BufReader { inner: InternalBufWriter(w), buf } = self.inner;
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 72d014e77a7..d1231f549bb 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -363,7 +363,7 @@ pub trait Write {
     ///
     /// It is considered an error if not all bytes could be written due to
     /// I/O errors or EOF being reached.
-    #[unstable(feature = "io", reason = "waiting for RFC 950")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     fn flush(&mut self) -> Result<()>;
 
     /// Attempts to write an entire buffer into this write.
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index 7378f43f757..e1ef3062794 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -182,7 +182,7 @@ pub mod builtin {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::fmt;
     ///
     /// let s = fmt::format(format_args!("hello {}", "world"));
@@ -205,7 +205,7 @@ pub mod builtin {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let path: &'static str = env!("PATH");
     /// println!("the $PATH variable at the time of compiling was: {}", path);
     /// ```
@@ -224,7 +224,7 @@ pub mod builtin {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let key: Option<&'static str> = option_env!("SECRET_KEY");
     /// println!("the secret key might be: {:?}", key);
     /// ```
@@ -372,7 +372,7 @@ pub mod builtin {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// mod test {
     ///     pub fn foo() {
     ///         assert!(module_path!().ends_with("test"));
@@ -395,7 +395,7 @@ pub mod builtin {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// let my_directory = if cfg!(windows) {
     ///     "windows-specific-directory"
     /// } else {
diff --git a/src/libstd/old_io/buffered.rs b/src/libstd/old_io/buffered.rs
index 2f4e1e87099..82a48a72499 100644
--- a/src/libstd/old_io/buffered.rs
+++ b/src/libstd/old_io/buffered.rs
@@ -34,7 +34,7 @@ use vec::Vec;
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::old_io::{BufferedReader, File};
 ///
 /// let file = File::open(&Path::new("message.txt"));
@@ -137,7 +137,7 @@ impl<R: Reader> Reader for BufferedReader<R> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::old_io::{BufferedWriter, File};
 ///
 /// let file = File::create(&Path::new("message.txt")).unwrap();
@@ -323,7 +323,7 @@ impl<W: Reader> Reader for InternalBufferedWriter<W> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// # #![allow(unused_must_use)]
 /// use std::old_io::{BufferedStream, File};
 ///
diff --git a/src/libstd/old_io/fs.rs b/src/libstd/old_io/fs.rs
index a6ed76688ca..ff3af380b7d 100644
--- a/src/libstd/old_io/fs.rs
+++ b/src/libstd/old_io/fs.rs
@@ -176,7 +176,7 @@ impl File {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::old_io::File;
     ///
     /// let contents = File::open(&Path::new("foo.txt")).read_to_end();
@@ -195,7 +195,7 @@ impl File {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// # #![allow(unused_must_use)]
     /// use std::old_io::File;
     ///
@@ -286,7 +286,7 @@ impl File {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// # #![allow(unused_must_use)]
 /// use std::old_io::fs;
 ///
@@ -317,7 +317,7 @@ pub fn unlink(path: &Path) -> IoResult<()> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::old_io::fs;
 ///
 /// let p = Path::new("/some/file/path.txt");
@@ -359,7 +359,7 @@ pub fn lstat(path: &Path) -> IoResult<FileStat> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// # #![allow(unused_must_use)]
 /// use std::old_io::fs;
 ///
@@ -387,7 +387,7 @@ pub fn rename(from: &Path, to: &Path) -> IoResult<()> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// # #![allow(unused_must_use)]
 /// use std::old_io::fs;
 ///
@@ -437,7 +437,7 @@ pub fn copy(from: &Path, to: &Path) -> IoResult<()> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// # #![allow(unused_must_use)]
 /// use std::old_io;
 /// use std::old_io::fs;
@@ -508,7 +508,7 @@ pub fn readlink(path: &Path) -> IoResult<Path> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// # #![allow(unused_must_use)]
 /// use std::old_io;
 /// use std::old_io::fs;
@@ -532,7 +532,7 @@ pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// # #![allow(unused_must_use)]
 /// use std::old_io::fs;
 ///
@@ -556,7 +556,7 @@ pub fn rmdir(path: &Path) -> IoResult<()> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::old_io::fs::PathExtensions;
 /// use std::old_io::fs;
 /// use std::old_io;
diff --git a/src/libstd/old_io/mem.rs b/src/libstd/old_io/mem.rs
index 43182e4fcd6..72774334c13 100644
--- a/src/libstd/old_io/mem.rs
+++ b/src/libstd/old_io/mem.rs
@@ -56,7 +56,7 @@ impl Writer for Vec<u8> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// # #![allow(unused_must_use)]
 /// use std::old_io::MemWriter;
 ///
@@ -116,7 +116,7 @@ impl Writer for MemWriter {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// # #![allow(unused_must_use)]
 /// use std::old_io::MemReader;
 ///
@@ -246,7 +246,7 @@ impl<'a> Buffer for &'a [u8] {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// # #![allow(unused_must_use)]
 /// use std::old_io::BufWriter;
 ///
@@ -318,7 +318,7 @@ impl<'a> Seek for BufWriter<'a> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// # #![allow(unused_must_use)]
 /// use std::old_io::BufReader;
 ///
diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs
index e1341e0e5cf..15a80e34451 100644
--- a/src/libstd/old_io/mod.rs
+++ b/src/libstd/old_io/mod.rs
@@ -1410,7 +1410,7 @@ pub trait Buffer: Reader {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::old_io::BufReader;
     ///
     /// let mut reader = BufReader::new(b"hello\nworld");
diff --git a/src/libstd/old_io/net/pipe.rs b/src/libstd/old_io/net/pipe.rs
index 59352532902..ad0e7a7284d 100644
--- a/src/libstd/old_io/net/pipe.rs
+++ b/src/libstd/old_io/net/pipe.rs
@@ -52,7 +52,7 @@ impl UnixStream {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// # #![allow(unused_must_use)]
     /// use std::old_io::net::pipe::UnixStream;
     ///
diff --git a/src/libstd/old_io/stdio.rs b/src/libstd/old_io/stdio.rs
index 92fad231671..b699b93f2b8 100644
--- a/src/libstd/old_io/stdio.rs
+++ b/src/libstd/old_io/stdio.rs
@@ -142,7 +142,7 @@ impl StdinReader {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::old_io;
     ///
     /// let mut stdin = old_io::stdin();
diff --git a/src/libstd/old_io/timer.rs b/src/libstd/old_io/timer.rs
index de7883c715a..65c62a99335 100644
--- a/src/libstd/old_io/timer.rs
+++ b/src/libstd/old_io/timer.rs
@@ -115,7 +115,7 @@ impl Timer {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::old_io::Timer;
     /// use std::time::Duration;
     ///
@@ -128,7 +128,7 @@ impl Timer {
     /// ten_milliseconds.recv().unwrap();
     /// ```
     ///
-    /// ```rust
+    /// ```
     /// use std::old_io::Timer;
     /// use std::time::Duration;
     ///
@@ -167,7 +167,7 @@ impl Timer {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::old_io::Timer;
     /// use std::time::Duration;
     ///
@@ -186,7 +186,7 @@ impl Timer {
     /// ten_milliseconds.recv().unwrap();
     /// ```
     ///
-    /// ```rust
+    /// ```
     /// use std::old_io::Timer;
     /// use std::time::Duration;
     ///
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index fc05eb1d627..46233a46ee5 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -132,7 +132,7 @@ pub const TMPBUF_SZ : uint = 1000;
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::os;
 ///
 /// // We assume that we are in a valid directory.
@@ -152,7 +152,7 @@ pub fn getcwd() -> IoResult<Path> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::os;
 ///
 /// // We will iterate through the references to the element returned by os::env();
@@ -188,7 +188,7 @@ pub fn env_as_bytes() -> Vec<(Vec<u8>, Vec<u8>)> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::os;
 ///
 /// let key = "HOME";
@@ -230,7 +230,7 @@ fn byteify(s: OsString) -> Vec<u8> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::os;
 ///
 /// let key = "KEY";
@@ -270,7 +270,8 @@ pub fn unsetenv(n: &str) {
 /// environment variable.
 ///
 /// # Examples
-/// ```rust
+///
+/// ```
 /// use std::os;
 ///
 /// let key = "PATH";
@@ -302,7 +303,7 @@ pub fn split_paths<T: BytesContainer>(unparsed: T) -> Vec<Path> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::os;
 /// use std::old_path::Path;
 ///
@@ -363,7 +364,7 @@ pub fn dll_filename(base: &str) -> String {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::os;
 ///
 /// match os::self_exe_name() {
@@ -383,7 +384,7 @@ pub fn self_exe_name() -> Option<Path> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::os;
 ///
 /// match os::self_exe_path() {
@@ -412,7 +413,7 @@ pub fn self_exe_path() -> Option<Path> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::os;
 ///
 /// match os::homedir() {
@@ -501,7 +502,8 @@ pub fn tmpdir() -> Path {
 /// as is.
 ///
 /// # Examples
-/// ```rust
+///
+/// ```
 /// use std::os;
 /// use std::old_path::Path;
 ///
@@ -532,7 +534,8 @@ pub fn make_absolute(p: &Path) -> IoResult<Path> {
 /// whether the change was completed successfully or not.
 ///
 /// # Examples
-/// ```rust
+///
+/// ```
 /// use std::os;
 /// use std::old_path::Path;
 ///
@@ -553,7 +556,8 @@ pub fn errno() -> i32 {
 /// Return the string corresponding to an `errno()` value of `errnum`.
 ///
 /// # Examples
-/// ```rust
+///
+/// ```
 /// use std::os;
 ///
 /// // Same as println!("{}", last_os_error());
@@ -749,7 +753,7 @@ extern "system" {
 /// See `String::from_utf8_lossy` for details.
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::os;
 ///
 /// // Prints each argument on a separate line
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 29c779df4d2..2d97d651366 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -856,7 +856,7 @@ impl<'a> cmp::Ord for Components<'a> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::path::PathBuf;
 ///
 /// let mut path = PathBuf::new("c:\\");
@@ -948,7 +948,7 @@ impl PathBuf {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::path::PathBuf;
     ///
     /// let mut buf = PathBuf::new("/");
@@ -1105,7 +1105,7 @@ impl AsOsStr for PathBuf {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::path::Path;
 ///
 /// let path = Path::new("/tmp/foo/bar.txt");
@@ -1210,7 +1210,7 @@ impl Path {
     ///
     /// # Examples
     ///
-    /// ```rust
+    /// ```
     /// use std::path::Path;
     ///
     /// let path = Path::new("/foo/bar");
diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs
index e8407ab1115..69053252ed1 100644
--- a/src/libstd/rand/mod.rs
+++ b/src/libstd/rand/mod.rs
@@ -426,7 +426,7 @@ pub fn random<T: Rand>() -> T {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand::{thread_rng, sample};
 ///
 /// let mut rng = thread_rng();
diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs
index eac5aa4256c..42c153af036 100644
--- a/src/libstd/rand/reader.rs
+++ b/src/libstd/rand/reader.rs
@@ -25,7 +25,7 @@ use slice::SliceExt;
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::rand::{reader, Rng};
 /// use std::old_io::MemReader;
 ///
diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs
index f697d10d5df..ebf4d337749 100644
--- a/src/libstd/sync/barrier.rs
+++ b/src/libstd/sync/barrier.rs
@@ -13,7 +13,7 @@ use sync::{Mutex, Condvar};
 /// A barrier enables multiple tasks to synchronize the beginning
 /// of some computation.
 ///
-/// ```rust
+/// ```
 /// use std::sync::{Arc, Barrier};
 /// use std::thread;
 ///
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs
index 41378a6b312..1cbfbbf2927 100644
--- a/src/libstd/sync/mutex.rs
+++ b/src/libstd/sync/mutex.rs
@@ -46,7 +46,7 @@ use fmt;
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::sync::{Arc, Mutex};
 /// use std::thread;
 /// use std::sync::mpsc::channel;
@@ -84,7 +84,7 @@ use fmt;
 ///
 /// To recover from a poisoned mutex:
 ///
-/// ```rust
+/// ```
 /// use std::sync::{Arc, Mutex};
 /// use std::thread;
 ///
@@ -135,7 +135,7 @@ unsafe impl<T: Send> Sync for Mutex<T> { }
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::sync::{StaticMutex, MUTEX_INIT};
 ///
 /// static LOCK: StaticMutex = MUTEX_INIT;
diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs
index 5cad2916624..258cf1d38a8 100644
--- a/src/libstd/sync/once.rs
+++ b/src/libstd/sync/once.rs
@@ -26,7 +26,7 @@ use sync::{StaticMutex, MUTEX_INIT};
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::sync::{Once, ONCE_INIT};
 ///
 /// static START: Once = ONCE_INIT;
diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs
index 3d31790550b..8a1946b86ab 100644
--- a/src/libstd/sync/task_pool.rs
+++ b/src/libstd/sync/task_pool.rs
@@ -60,7 +60,7 @@ impl<'a> Drop for Sentinel<'a> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use std::sync::TaskPool;
 /// use std::iter::AdditiveIterator;
 /// use std::sync::mpsc::channel;
diff --git a/src/libstd/sys/common/thread.rs b/src/libstd/sys/common/thread.rs
index 731617858e9..f45daea18a2 100644
--- a/src/libstd/sys/common/thread.rs
+++ b/src/libstd/sys/common/thread.rs
@@ -8,28 +8,23 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use core::prelude::*;
+use prelude::v1::*;
 
-use boxed::Box;
-use mem;
 use usize;
 use libc;
 use thunk::Thunk;
 use sys_common::stack;
-use sys::{thread, stack_overflow};
+use sys::stack_overflow;
 
 // This is the starting point of rust os threads. The first thing we do
 // is make sure that we don't trigger __morestack (also why this has a
 // no_stack_check annotation), and then we extract the main function
 // and invoke it.
 #[no_stack_check]
-pub fn start_thread(main: *mut libc::c_void) -> thread::rust_thread_return {
+pub fn start_thread(main: *mut libc::c_void) {
     unsafe {
         stack::record_os_managed_stack_bounds(0, usize::MAX);
-        let handler = stack_overflow::Handler::new();
-        let f: Box<Thunk> = Box::from_raw(main as *mut Thunk);
-        f.invoke(());
-        drop(handler);
-        mem::transmute(0 as thread::rust_thread_return)
+        let _handler = stack_overflow::Handler::new();
+        Box::from_raw(main as *mut Thunk).invoke(());
     }
 }
diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs
index b4002f266a1..04508294981 100644
--- a/src/libstd/sys/unix/thread.rs
+++ b/src/libstd/sys/unix/thread.rs
@@ -12,44 +12,30 @@
 
 use core::prelude::*;
 
-use io;
-use boxed;
-use boxed::Box;
 use cmp;
+use ffi::CString;
+use io;
+use libc::consts::os::posix01::PTHREAD_STACK_MIN;
+use libc;
 use mem;
 use ptr;
-use libc::consts::os::posix01::{PTHREAD_CREATE_JOINABLE, PTHREAD_STACK_MIN};
-use libc;
+use sys::os;
 use thunk::Thunk;
-use ffi::CString;
+use time::Duration;
 
 use sys_common::stack::RED_ZONE;
 use sys_common::thread::*;
 
 pub type rust_thread = libc::pthread_t;
-pub type rust_thread_return = *mut u8;
-pub type StartFn = extern "C" fn(*mut libc::c_void) -> rust_thread_return;
-
-#[no_stack_check]
-pub extern fn thread_start(main: *mut libc::c_void) -> rust_thread_return {
-    return start_thread(main);
-}
 
 #[cfg(all(not(target_os = "linux"),
           not(target_os = "macos"),
           not(target_os = "bitrig"),
           not(target_os = "openbsd")))]
 pub mod guard {
-    pub unsafe fn current() -> uint {
-        0
-    }
-
-    pub unsafe fn main() -> uint {
-        0
-    }
-
-    pub unsafe fn init() {
-    }
+    pub unsafe fn current() -> usize { 0 }
+    pub unsafe fn main() -> usize { 0 }
+    pub unsafe fn init() {}
 }
 
 
@@ -57,26 +43,22 @@ pub mod guard {
           target_os = "macos",
           target_os = "bitrig",
           target_os = "openbsd"))]
+#[allow(unused_imports)]
 pub mod guard {
-    use super::*;
-    #[cfg(any(target_os = "linux",
-              target_os = "android",
-              target_os = "bitrig",
-              target_os = "openbsd"))]
-    use mem;
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    use ptr;
-    use libc;
-    use libc::funcs::posix88::mman::{mmap};
+    use libc::{self, pthread_t};
+    use libc::funcs::posix88::mman::mmap;
     use libc::consts::os::posix88::{PROT_NONE,
                                     MAP_PRIVATE,
                                     MAP_ANON,
                                     MAP_FAILED,
                                     MAP_FIXED};
+    use mem;
+    use ptr;
+    use super::{pthread_self, pthread_attr_destroy};
+    use sys::os;
 
     // These are initialized in init() and only read from after
-    static mut PAGE_SIZE: uint = 0;
-    static mut GUARD_PAGE: uint = 0;
+    static mut GUARD_PAGE: usize = 0;
 
     #[cfg(any(target_os = "macos",
               target_os = "bitrig",
@@ -88,28 +70,16 @@ pub mod guard {
     #[cfg(any(target_os = "linux", target_os = "android"))]
     unsafe fn get_stack_start() -> *mut libc::c_void {
         let mut attr: libc::pthread_attr_t = mem::zeroed();
-        if pthread_getattr_np(pthread_self(), &mut attr) != 0 {
-            panic!("failed to get thread attributes");
-        }
+        assert_eq!(pthread_getattr_np(pthread_self(), &mut attr), 0);
         let mut stackaddr = ptr::null_mut();
         let mut stacksize = 0;
-        if pthread_attr_getstack(&attr, &mut stackaddr, &mut stacksize) != 0 {
-            panic!("failed to get stack information");
-        }
-        if pthread_attr_destroy(&mut attr) != 0 {
-            panic!("failed to destroy thread attributes");
-        }
+        assert_eq!(pthread_attr_getstack(&attr, &mut stackaddr, &mut stacksize), 0);
+        assert_eq!(pthread_attr_destroy(&mut attr), 0);
         stackaddr
     }
 
     pub unsafe fn init() {
-        let psize = libc::sysconf(libc::consts::os::sysconf::_SC_PAGESIZE);
-        if psize == -1 {
-            panic!("failed to get page size");
-        }
-
-        PAGE_SIZE = psize as uint;
-
+        let psize = os::page_size();
         let mut stackaddr = get_stack_start();
 
         // Ensure stackaddr is page aligned! A parent process might
@@ -118,9 +88,9 @@ pub mod guard {
         // stackaddr < stackaddr + stacksize, so if stackaddr is not
         // page-aligned, calculate the fix such that stackaddr <
         // new_page_aligned_stackaddr < stackaddr + stacksize
-        let remainder = (stackaddr as usize) % (PAGE_SIZE as usize);
+        let remainder = (stackaddr as usize) % psize;
         if remainder != 0 {
-            stackaddr = ((stackaddr as usize) + (PAGE_SIZE as usize) - remainder)
+            stackaddr = ((stackaddr as usize) + psize - remainder)
                 as *mut libc::c_void;
         }
 
@@ -128,7 +98,7 @@ pub mod guard {
         // This ensures SIGBUS will be raised on
         // stack overflow.
         let result = mmap(stackaddr,
-                          PAGE_SIZE as libc::size_t,
+                          psize as libc::size_t,
                           PROT_NONE,
                           MAP_PRIVATE | MAP_ANON | MAP_FIXED,
                           -1,
@@ -138,124 +108,119 @@ pub mod guard {
             panic!("failed to allocate a guard page");
         }
 
-        let offset = if cfg!(target_os = "linux") {
-            2
-        } else {
-            1
-        };
+        let offset = if cfg!(target_os = "linux") {2} else {1};
 
-        GUARD_PAGE = stackaddr as uint + offset * PAGE_SIZE;
+        GUARD_PAGE = stackaddr as usize + offset * psize;
     }
 
-    pub unsafe fn main() -> uint {
+    pub unsafe fn main() -> usize {
         GUARD_PAGE
     }
 
     #[cfg(target_os = "macos")]
-    pub unsafe fn current() -> uint {
+    pub unsafe fn current() -> usize {
+        extern {
+            fn pthread_get_stackaddr_np(thread: pthread_t) -> *mut libc::c_void;
+            fn pthread_get_stacksize_np(thread: pthread_t) -> libc::size_t;
+        }
         (pthread_get_stackaddr_np(pthread_self()) as libc::size_t -
-         pthread_get_stacksize_np(pthread_self())) as uint
+         pthread_get_stacksize_np(pthread_self())) as usize
     }
 
-    #[cfg(target_os = "openbsd")]
-    pub unsafe fn current() -> uint {
-        let mut current_stack: stack_t = mem::zeroed();
-        if pthread_stackseg_np(pthread_self(), &mut current_stack) != 0 {
-            panic!("failed to get current stack: pthread_stackseg_np")
+    #[cfg(any(target_os = "openbsd", target_os = "bitrig"))]
+    pub unsafe fn current() -> usize {
+        #[repr(C)]
+        pub struct stack_t {
+            ss_sp: *mut libc::c_void,
+            ss_size: libc::size_t,
+            ss_flags: libc::c_int,
+        }
+        extern {
+            fn pthread_stackseg_np(thread: pthread_t,
+                                   sinfo: *mut stack_t) -> libc::c_uint;
         }
 
+        let mut current_stack: stack_t = mem::zeroed();
+        assert_eq!(pthread_stackseg_np(pthread_self(), &mut current_stack), 0);
+
+        let extra = if cfg!(target_os = "bitrig") {3} else {1} * os::page_size();
         if pthread_main_np() == 1 {
             // main thread
-            current_stack.ss_sp as uint - current_stack.ss_size as uint + PAGE_SIZE as uint
-
+            current_stack.ss_sp as usize - current_stack.ss_size as usize + extra
         } else {
             // new thread
-            current_stack.ss_sp as uint - current_stack.ss_size as uint
+            current_stack.ss_sp as usize - current_stack.ss_size as usize
         }
     }
 
     #[cfg(any(target_os = "linux", target_os = "android"))]
-    pub unsafe fn current() -> uint {
+    pub unsafe fn current() -> usize {
         let mut attr: libc::pthread_attr_t = mem::zeroed();
-        if pthread_getattr_np(pthread_self(), &mut attr) != 0 {
-            panic!("failed to get thread attributes");
-        }
+        assert_eq!(pthread_getattr_np(pthread_self(), &mut attr), 0);
         let mut guardsize = 0;
-        if pthread_attr_getguardsize(&attr, &mut guardsize) != 0 {
-            panic!("failed to get stack guard page");
-        }
+        assert_eq!(pthread_attr_getguardsize(&attr, &mut guardsize), 0);
         if guardsize == 0 {
             panic!("there is no guard page");
         }
         let mut stackaddr = ptr::null_mut();
-        let mut stacksize = 0;
-        if pthread_attr_getstack(&attr, &mut stackaddr, &mut stacksize) != 0 {
-            panic!("failed to get stack information");
-        }
-        if pthread_attr_destroy(&mut attr) != 0 {
-            panic!("failed to destroy thread attributes");
-        }
+        let mut size = 0;
+        assert_eq!(pthread_attr_getstack(&attr, &mut stackaddr, &mut size), 0);
+        assert_eq!(pthread_attr_destroy(&mut attr), 0);
 
-        stackaddr as uint + guardsize as uint
+        stackaddr as usize + guardsize as usize
     }
 
-    #[cfg(target_os = "bitrig")]
-    pub unsafe fn current() -> uint {
-      let mut current_stack: stack_t = mem::zeroed();
-      if pthread_stackseg_np(pthread_self(), &mut current_stack) != 0 {
-        panic!("failed to get current stack: pthread_stackseg_np")
-      }
-
-      if pthread_main_np() == 1 {
-        // main thread
-        current_stack.ss_sp as uint - current_stack.ss_size as uint + 3 * PAGE_SIZE as uint
-      } else {
-        // new thread
-        current_stack.ss_sp as uint - current_stack.ss_size as uint
-      }
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    extern {
+        fn pthread_getattr_np(native: libc::pthread_t,
+                              attr: *mut libc::pthread_attr_t) -> libc::c_int;
+        fn pthread_attr_getguardsize(attr: *const libc::pthread_attr_t,
+                                     guardsize: *mut libc::size_t) -> libc::c_int;
+        fn pthread_attr_getstack(attr: *const libc::pthread_attr_t,
+                                 stackaddr: *mut *mut libc::c_void,
+                                 stacksize: *mut libc::size_t) -> libc::c_int;
     }
 }
 
-pub unsafe fn create(stack: uint, p: Thunk) -> io::Result<rust_thread> {
+pub unsafe fn create(stack: usize, p: Thunk) -> io::Result<rust_thread> {
+    let p = box p;
     let mut native: libc::pthread_t = mem::zeroed();
     let mut attr: libc::pthread_attr_t = mem::zeroed();
     assert_eq!(pthread_attr_init(&mut attr), 0);
-    assert_eq!(pthread_attr_setdetachstate(&mut attr,
-                                           PTHREAD_CREATE_JOINABLE), 0);
 
     // Reserve room for the red zone, the runtime's stack of last resort.
-    let stack_size = cmp::max(stack, RED_ZONE + min_stack_size(&attr) as uint);
+    let stack_size = cmp::max(stack, RED_ZONE + min_stack_size(&attr) as usize);
     match pthread_attr_setstacksize(&mut attr, stack_size as libc::size_t) {
-        0 => {
-        },
-        libc::EINVAL => {
+        0 => {}
+        n => {
+            assert_eq!(n, libc::EINVAL);
             // EINVAL means |stack_size| is either too small or not a
             // multiple of the system page size.  Because it's definitely
             // >= PTHREAD_STACK_MIN, it must be an alignment issue.
             // Round up to the nearest page and try again.
-            let page_size = libc::sysconf(libc::_SC_PAGESIZE) as uint;
+            let page_size = os::page_size();
             let stack_size = (stack_size + page_size - 1) &
-                             (-(page_size as int - 1) as uint - 1);
-            assert_eq!(pthread_attr_setstacksize(&mut attr, stack_size as libc::size_t), 0);
-        },
-        errno => {
-            // This cannot really happen.
-            panic!("pthread_attr_setstacksize() error: {}", errno);
-        },
+                             (-(page_size as isize - 1) as usize - 1);
+            assert_eq!(pthread_attr_setstacksize(&mut attr,
+                                                 stack_size as libc::size_t), 0);
+        }
     };
 
-    // must box since sizeof(p)=2*uint
-    let raw_p = boxed::into_raw(box p);
-    let arg = raw_p as *mut libc::c_void;
-    let ret = pthread_create(&mut native, &attr, thread_start, arg);
+    let ret = pthread_create(&mut native, &attr, thread_start,
+                             &*p as *const _ as *mut _);
     assert_eq!(pthread_attr_destroy(&mut attr), 0);
 
-    if ret != 0 {
-        // be sure to not leak the closure
-        let _p: Box<Thunk> = Box::from_raw(raw_p);
+    return if ret != 0 {
         Err(io::Error::from_os_error(ret))
     } else {
+        mem::forget(p); // ownership passed to pthread_create
         Ok(native)
+    };
+
+    #[no_stack_check]
+    extern fn thread_start(main: *mut libc::c_void) -> *mut libc::c_void {
+        start_thread(main);
+        0 as *mut _
     }
 }
 
@@ -263,14 +228,14 @@ pub unsafe fn create(stack: uint, p: Thunk) -> io::Result<rust_thread> {
 pub unsafe fn set_name(name: &str) {
     // pthread_setname_np() since glibc 2.12
     // availability autodetected via weak linkage
-    let cname = CString::new(name).unwrap();
-    type F = unsafe extern "C" fn(libc::pthread_t, *const libc::c_char)
-                                  -> libc::c_int;
+    type F = unsafe extern fn(libc::pthread_t, *const libc::c_char)
+                              -> libc::c_int;
     extern {
         #[linkage = "extern_weak"]
         static pthread_setname_np: *const ();
     }
     if !pthread_setname_np.is_null() {
+        let cname = CString::new(name).unwrap();
         mem::transmute::<*const (), F>(pthread_setname_np)(pthread_self(),
                                                            cname.as_ptr());
     }
@@ -281,14 +246,18 @@ pub unsafe fn set_name(name: &str) {
           target_os = "bitrig",
           target_os = "openbsd"))]
 pub unsafe fn set_name(name: &str) {
-    // pthread_set_name_np() since almost forever on all BSDs
+    extern {
+        fn pthread_set_name_np(tid: libc::pthread_t, name: *const libc::c_char);
+    }
     let cname = CString::new(name).unwrap();
     pthread_set_name_np(pthread_self(), cname.as_ptr());
 }
 
 #[cfg(any(target_os = "macos", target_os = "ios"))]
 pub unsafe fn set_name(name: &str) {
-    // pthread_setname_np() since OS X 10.6 and iOS 3.2
+    extern {
+        fn pthread_setname_np(name: *const libc::c_char) -> libc::c_int;
+    }
     let cname = CString::new(name).unwrap();
     pthread_setname_np(cname.as_ptr());
 }
@@ -301,7 +270,42 @@ pub unsafe fn detach(native: rust_thread) {
     assert_eq!(pthread_detach(native), 0);
 }
 
-pub unsafe fn yield_now() { assert_eq!(sched_yield(), 0); }
+pub unsafe fn yield_now() {
+    assert_eq!(sched_yield(), 0);
+}
+
+pub fn sleep(dur: Duration) {
+    unsafe {
+        if dur < Duration::zero() {
+            return yield_now()
+        }
+        let seconds = dur.num_seconds();
+        let ns = dur - Duration::seconds(seconds);
+        let mut ts = libc::timespec {
+            tv_sec: seconds as libc::time_t,
+            tv_nsec: ns.num_nanoseconds().unwrap() as libc::c_long,
+        };
+        // If we're awoken with a signal then the return value will be -1 and
+        // nanosleep will fill in `ts` with the remaining time.
+        while dosleep(&mut ts) == -1 {
+            assert_eq!(os::errno(), libc::EINTR);
+        }
+    }
+
+    #[cfg(target_os = "linux")]
+    unsafe fn dosleep(ts: *mut libc::timespec) -> libc::c_int {
+        extern {
+            fn clock_nanosleep(clock_id: libc::c_int, flags: libc::c_int,
+                               request: *const libc::timespec,
+                               remain: *mut libc::timespec) -> libc::c_int;
+        }
+        clock_nanosleep(libc::CLOCK_MONOTONIC, 0, ts, ts)
+    }
+    #[cfg(not(target_os = "linux"))]
+    unsafe fn dosleep(ts: *mut libc::timespec) -> libc::c_int {
+        libc::nanosleep(ts, ts)
+    }
+}
 
 // glibc >= 2.15 has a __pthread_get_minstack() function that returns
 // PTHREAD_STACK_MIN plus however many bytes are needed for thread-local
@@ -334,67 +338,19 @@ fn min_stack_size(_: *const libc::pthread_attr_t) -> libc::size_t {
     PTHREAD_STACK_MIN
 }
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-extern {
-    pub fn pthread_self() -> libc::pthread_t;
-    pub fn pthread_getattr_np(native: libc::pthread_t,
-                              attr: *mut libc::pthread_attr_t) -> libc::c_int;
-    pub fn pthread_attr_getguardsize(attr: *const libc::pthread_attr_t,
-                                     guardsize: *mut libc::size_t) -> libc::c_int;
-    pub fn pthread_attr_getstack(attr: *const libc::pthread_attr_t,
-                                 stackaddr: *mut *mut libc::c_void,
-                                 stacksize: *mut libc::size_t) -> libc::c_int;
-}
-
-#[cfg(any(target_os = "freebsd",
-          target_os = "dragonfly",
-          target_os = "openbsd"))]
 extern {
-    pub fn pthread_self() -> libc::pthread_t;
-    fn pthread_set_name_np(tid: libc::pthread_t, name: *const libc::c_char);
-}
+    #[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
+    fn pthread_main_np() -> libc::c_uint;
 
-#[cfg(any(target_os = "macos", target_os = "ios"))]
-extern {
-    pub fn pthread_self() -> libc::pthread_t;
-    pub fn pthread_get_stackaddr_np(thread: libc::pthread_t) -> *mut libc::c_void;
-    pub fn pthread_get_stacksize_np(thread: libc::pthread_t) -> libc::size_t;
-    fn pthread_setname_np(name: *const libc::c_char) -> libc::c_int;
-}
-
-#[cfg(target_os = "bitrig")]
-extern {
-    pub fn pthread_self() -> libc::pthread_t;
-    pub fn pthread_stackseg_np(thread: libc::pthread_t,
-                              sinfo: *mut stack_t) -> libc::c_uint;
-    pub fn pthread_main_np() -> libc::c_uint;
-    fn pthread_set_name_np(tid: libc::pthread_t, name: *const libc::c_char);
-}
-
-#[cfg(target_os = "openbsd")]
-extern {
-        pub fn pthread_stackseg_np(thread: libc::pthread_t,
-                                   sinfo: *mut stack_t) -> libc::c_uint;
-        pub fn pthread_main_np() -> libc::c_uint;
-}
-
-#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
-#[repr(C)]
-pub struct stack_t {
-    pub ss_sp: *mut libc::c_void,
-    pub ss_size: libc::size_t,
-    pub ss_flags: libc::c_int,
-}
-
-extern {
+    fn pthread_self() -> libc::pthread_t;
     fn pthread_create(native: *mut libc::pthread_t,
                       attr: *const libc::pthread_attr_t,
-                      f: StartFn,
+                      f: extern fn(*mut libc::c_void) -> *mut libc::c_void,
                       value: *mut libc::c_void) -> libc::c_int;
     fn pthread_join(native: libc::pthread_t,
                     value: *mut *mut libc::c_void) -> libc::c_int;
     fn pthread_attr_init(attr: *mut libc::pthread_attr_t) -> libc::c_int;
-    pub fn pthread_attr_destroy(attr: *mut libc::pthread_attr_t) -> libc::c_int;
+    fn pthread_attr_destroy(attr: *mut libc::pthread_attr_t) -> libc::c_int;
     fn pthread_attr_setstacksize(attr: *mut libc::pthread_attr_t,
                                  stack_size: libc::size_t) -> libc::c_int;
     fn pthread_attr_setdetachstate(attr: *mut libc::pthread_attr_t,
diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs
index aa22b6b1307..d1d4ad90081 100644
--- a/src/libstd/sys/windows/thread.rs
+++ b/src/libstd/sys/windows/thread.rs
@@ -10,43 +10,28 @@
 
 use prelude::v1::*;
 
-use boxed;
 use cmp;
 use io;
-use ptr;
-use libc;
+use libc::{self, c_void};
 use libc::types::os::arch::extra::{LPSECURITY_ATTRIBUTES, SIZE_T, BOOL,
                                    LPVOID, DWORD, LPDWORD, HANDLE};
-use thunk::Thunk;
+use mem;
+use ptr;
 use sys_common::stack::RED_ZONE;
 use sys_common::thread::*;
+use thunk::Thunk;
+use time::Duration;
 
 pub type rust_thread = HANDLE;
-pub type rust_thread_return = DWORD;
-
-pub type StartFn = extern "system" fn(*mut libc::c_void) -> rust_thread_return;
-
-#[no_stack_check]
-pub extern "system" fn thread_start(main: *mut libc::c_void) -> rust_thread_return {
-    return start_thread(main);
-}
 
 pub mod guard {
-    pub unsafe fn main() -> uint {
-        0
-    }
-
-    pub unsafe fn current() -> uint {
-        0
-    }
-
-    pub unsafe fn init() {
-    }
+    pub unsafe fn main() -> uint { 0 }
+    pub unsafe fn current() -> uint { 0 }
+    pub unsafe fn init() {}
 }
 
-pub unsafe fn create(stack: uint, p: Thunk) -> io::Result<rust_thread> {
-    let raw_p = boxed::into_raw(box p);
-    let arg = raw_p as *mut libc::c_void;
+pub unsafe fn create(stack: usize, p: Thunk) -> io::Result<rust_thread> {
+    let p = box p;
     // FIXME On UNIX, we guard against stack sizes that are too small but
     // that's because pthreads enforces that stacks are at least
     // PTHREAD_STACK_MIN bytes big.  Windows has no such lower limit, it's
@@ -58,14 +43,20 @@ pub unsafe fn create(stack: uint, p: Thunk) -> io::Result<rust_thread> {
     // 20 kB red zone, that makes for a 64 kB minimum stack.
     let stack_size = (cmp::max(stack, RED_ZONE) + 0xfffe) & (-0xfffe - 1);
     let ret = CreateThread(ptr::null_mut(), stack_size as libc::size_t,
-                           thread_start, arg, 0, ptr::null_mut());
+                           thread_start, &*p as *const _ as *mut _,
+                           0, ptr::null_mut());
 
-    if ret as uint == 0 {
-        // be sure to not leak the closure
-        let _p: Box<Thunk> = Box::from_raw(raw_p);
+    return if ret as usize == 0 {
         Err(io::Error::last_os_error())
     } else {
+        mem::forget(p); // ownership passed to CreateThread
         Ok(ret)
+    };
+
+    #[no_stack_check]
+    extern "system" fn thread_start(main: *mut libc::c_void) -> DWORD {
+        start_thread(main);
+        0
     }
 }
 
@@ -92,14 +83,29 @@ pub unsafe fn yield_now() {
     SwitchToThread();
 }
 
+pub fn sleep(dur: Duration) {
+    unsafe {
+        if dur < Duration::zero() {
+            return yield_now()
+        }
+        let ms = dur.num_milliseconds();
+        // if we have a fractional number of milliseconds then add an extra
+        // millisecond to sleep for
+        let extra = dur - Duration::milliseconds(ms);
+        let ms = ms + if extra.is_zero() {0} else {1};
+        Sleep(ms as DWORD);
+    }
+}
+
 #[allow(non_snake_case)]
 extern "system" {
     fn CreateThread(lpThreadAttributes: LPSECURITY_ATTRIBUTES,
                     dwStackSize: SIZE_T,
-                    lpStartAddress: StartFn,
+                    lpStartAddress: extern "system" fn(*mut c_void) -> DWORD,
                     lpParameter: LPVOID,
                     dwCreationFlags: DWORD,
                     lpThreadId: LPDWORD) -> HANDLE;
     fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) -> DWORD;
     fn SwitchToThread() -> BOOL;
+    fn Sleep(dwMilliseconds: DWORD);
 }
diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs
index adc3b77407a..d2742d4b45a 100644
--- a/src/libstd/thread.rs
+++ b/src/libstd/thread.rs
@@ -379,6 +379,19 @@ pub fn panicking() -> bool {
     unwind::panicking()
 }
 
+/// Put the current thread to sleep for the specified amount of time.
+///
+/// The thread may sleep longer than the duration specified due to scheduling
+/// specifics or platform-dependent functionality. Note that on unix platforms
+/// this function will not return early due to a signal being received or a
+/// spurious wakeup.
+#[unstable(feature = "thread_sleep",
+           reason = "recently added, needs an RFC, and `Duration` itself is \
+                     unstable")]
+pub fn sleep(dur: Duration) {
+    imp::sleep(dur)
+}
+
 /// Block unless or until the current thread's token is made available (may wake spuriously).
 ///
 /// See the module doc for more detail.
@@ -402,18 +415,18 @@ pub fn park() {
 /// the specified duration has been reached (may wake spuriously).
 ///
 /// The semantics of this function are equivalent to `park()` except that the
-/// thread will be blocked for roughly no longer than dur. This method
+/// thread will be blocked for roughly no longer than *duration*. This method
 /// should not be used for precise timing due to anomalies such as
 /// preemption or platform differences that may not cause the maximum
-/// amount of time waited to be precisely dur
+/// amount of time waited to be precisely *duration* long.
 ///
 /// See the module doc for more detail.
 #[unstable(feature = "std_misc", reason = "recently introduced, depends on Duration")]
-pub fn park_timeout(dur: Duration) {
+pub fn park_timeout(duration: Duration) {
     let thread = current();
     let mut guard = thread.inner.lock.lock().unwrap();
     if !*guard {
-        let (g, _) = thread.inner.cvar.wait_timeout(guard, dur).unwrap();
+        let (g, _) = thread.inner.cvar.wait_timeout(guard, duration).unwrap();
         guard = g;
     }
     *guard = false;
@@ -502,11 +515,11 @@ impl Thread {
     /// Deprecated: use module-level free function.
     #[deprecated(since = "1.0.0", reason = "use module-level free function")]
     #[unstable(feature = "std_misc", reason = "recently introduced")]
-    pub fn park_timeout(dur: Duration) {
+    pub fn park_timeout(duration: Duration) {
         let thread = current();
         let mut guard = thread.inner.lock.lock().unwrap();
         if !*guard {
-            let (g, _) = thread.inner.cvar.wait_timeout(guard, dur).unwrap();
+            let (g, _) = thread.inner.cvar.wait_timeout(guard, duration).unwrap();
             guard = g;
         }
         *guard = false;
@@ -935,6 +948,12 @@ mod test {
         }
     }
 
+    #[test]
+    fn sleep_smoke() {
+        thread::sleep(Duration::milliseconds(2));
+        thread::sleep(Duration::milliseconds(-2));
+    }
+
     // NOTE: the corresponding test for stderr is in run-pass/task-stderr, due
     // to the test harness apparently interfering with stderr configuration.
 }
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index f60ac8f3f33..b53bb4bc75e 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -37,7 +37,6 @@
 #![feature(staged_api)]
 #![feature(std_misc)]
 #![feature(unicode)]
-#![feature(io)]
 #![feature(path_ext)]
 
 extern crate arena;
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs
index 5e858d8a79f..2a47a696b1c 100644
--- a/src/libsyntax/test.rs
+++ b/src/libsyntax/test.rs
@@ -121,13 +121,11 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
         debug!("current path: {}",
                ast_util::path_name_i(&self.cx.path));
 
-        if is_test_fn(&self.cx, &*i) || is_bench_fn(&self.cx, &*i) {
+        let i = if is_test_fn(&self.cx, &*i) || is_bench_fn(&self.cx, &*i) {
             match i.node {
                 ast::ItemFn(_, ast::Unsafety::Unsafe, _, _, _) => {
                     let diag = self.cx.span_diagnostic;
-                    diag.span_fatal(i.span,
-                                    "unsafe functions cannot be used for \
-                                     tests");
+                    diag.span_fatal(i.span, "unsafe functions cannot be used for tests");
                 }
                 _ => {
                     debug!("this is a test function");
@@ -142,9 +140,19 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
                     self.tests.push(i.ident);
                     // debug!("have {} test/bench functions",
                     //        cx.testfns.len());
+
+                    // Make all tests public so we can call them from outside
+                    // the module (note that the tests are re-exported and must
+                    // be made public themselves to avoid privacy errors).
+                    i.map(|mut i| {
+                        i.vis = ast::Public;
+                        i
+                    })
                 }
             }
-        }
+        } else {
+            i
+        };
 
         // We don't want to recurse into anything other than mods, since
         // mods or tests inside of functions will break things
diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs
index 36225fad221..89960d5d62f 100644
--- a/src/libterm/lib.rs
+++ b/src/libterm/lib.rs
@@ -57,7 +57,6 @@
 #![feature(box_syntax)]
 #![feature(collections)]
 #![feature(int_uint)]
-#![feature(io)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
 #![feature(std_misc)]
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 8fe0cd6ebd4..02ddeea46bf 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -42,7 +42,6 @@
 #![feature(rustc_private)]
 #![feature(staged_api)]
 #![feature(std_misc)]
-#![feature(io)]
 #![feature(libc)]
 #![feature(set_stdio)]
 
diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs
index 6a80f3bc2c1..917c2d2dfbe 100644
--- a/src/libunicode/u_str.rs
+++ b/src/libunicode/u_str.rs
@@ -482,7 +482,7 @@ impl<'a> Iterator for Utf16Items<'a> {
 ///
 /// # Examples
 ///
-/// ```rust
+/// ```
 /// use unicode::str::Utf16Item::{ScalarValue, LoneSurrogate};
 ///
 /// // 𝄞mus<invalid>ic<invalid>
diff --git a/src/rt/msvc/typeof.h b/src/rt/msvc/typeof.h
index b83f530b0e9..7de08af314a 100644
--- a/src/rt/msvc/typeof.h
+++ b/src/rt/msvc/typeof.h
@@ -94,4 +94,3 @@ namespace msvc_typeof_impl {
 #endif
 
 #endif
-
diff --git a/src/rt/valgrind/memcheck.h b/src/rt/valgrind/memcheck.h
index 3af0728f017..ee72707d319 100644
--- a/src/rt/valgrind/memcheck.h
+++ b/src/rt/valgrind/memcheck.h
@@ -1,4 +1,3 @@
-
 /*
    ----------------------------------------------------------------
 
@@ -284,4 +283,3 @@ typedef
                                     (zznbytes), 0, 0 )
 
 #endif
-
diff --git a/src/test/auxiliary/changing-crates-a2.rs b/src/test/auxiliary/changing-crates-a2.rs
index a54dcbbbfc2..28eae023d68 100644
--- a/src/test/auxiliary/changing-crates-a2.rs
+++ b/src/test/auxiliary/changing-crates-a2.rs
@@ -11,4 +11,3 @@
 #![crate_name = "a"]
 
 pub fn foo<T>() { println!("hello!"); }
-
diff --git a/src/test/auxiliary/coherence-orphan-lib.rs b/src/test/auxiliary/coherence-orphan-lib.rs
index cc42b288e66..93d8fd3da88 100644
--- a/src/test/auxiliary/coherence-orphan-lib.rs
+++ b/src/test/auxiliary/coherence-orphan-lib.rs
@@ -11,4 +11,3 @@
 pub trait TheTrait<T> : ::std::marker::PhantomFn<T> {
     fn the_fn(&self);
 }
-
diff --git a/src/test/auxiliary/default_type_params_xc.rs b/src/test/auxiliary/default_type_params_xc.rs
index 0a65174911e..fe852e5d8ea 100644
--- a/src/test/auxiliary/default_type_params_xc.rs
+++ b/src/test/auxiliary/default_type_params_xc.rs
@@ -13,4 +13,3 @@ pub struct Heap;
 pub struct FakeHeap;
 
 pub struct FakeVec<T, A = FakeHeap> { pub f: Option<(T,A)> }
-
diff --git a/src/test/auxiliary/iss.rs b/src/test/auxiliary/iss.rs
index 690d5783c4b..b231efa0fec 100644
--- a/src/test/auxiliary/iss.rs
+++ b/src/test/auxiliary/iss.rs
@@ -20,4 +20,3 @@ fn no_op() { }
 pub const D : C<fn()> = C {
     k: no_op as fn()
 };
-
diff --git a/src/test/auxiliary/issue-12133-dylib2.rs b/src/test/auxiliary/issue-12133-dylib2.rs
index ee2b11da8f0..cf1953005ba 100644
--- a/src/test/auxiliary/issue-12133-dylib2.rs
+++ b/src/test/auxiliary/issue-12133-dylib2.rs
@@ -14,4 +14,3 @@
 
 extern crate "issue-12133-rlib" as a;
 extern crate "issue-12133-dylib" as b;
-
diff --git a/src/test/auxiliary/issue-13560-3.rs b/src/test/auxiliary/issue-13560-3.rs
index 5510d3e2e0d..f1f16af6f0e 100644
--- a/src/test/auxiliary/issue-13560-3.rs
+++ b/src/test/auxiliary/issue-13560-3.rs
@@ -14,4 +14,3 @@
 
 #[macro_use] #[no_link] extern crate "issue-13560-1" as t1;
 #[macro_use] extern crate "issue-13560-2" as t2;
-
diff --git a/src/test/auxiliary/issue-16725.rs b/src/test/auxiliary/issue-16725.rs
index 7f388c13e15..b3b04b4a5ac 100644
--- a/src/test/auxiliary/issue-16725.rs
+++ b/src/test/auxiliary/issue-16725.rs
@@ -11,4 +11,3 @@
 extern {
     fn bar();
 }
-
diff --git a/src/test/auxiliary/issue-5521.rs b/src/test/auxiliary/issue-5521.rs
index d9d393cc749..2ffdddcc798 100644
--- a/src/test/auxiliary/issue-5521.rs
+++ b/src/test/auxiliary/issue-5521.rs
@@ -12,4 +12,3 @@
 use std::collections::HashMap;
 
 pub type map = Box<HashMap<uint, uint>>;
-
diff --git a/src/test/auxiliary/issue13213aux.rs b/src/test/auxiliary/issue13213aux.rs
index 227fab73048..c2acc514346 100644
--- a/src/test/auxiliary/issue13213aux.rs
+++ b/src/test/auxiliary/issue13213aux.rs
@@ -27,4 +27,3 @@ mod private {
 }
 
 pub static A: S = S { p: private::THREE };
-
diff --git a/src/test/auxiliary/issue_3907.rs b/src/test/auxiliary/issue_3907.rs
index 545e15fe166..c118f7e4854 100644
--- a/src/test/auxiliary/issue_3907.rs
+++ b/src/test/auxiliary/issue_3907.rs
@@ -13,4 +13,3 @@ use std::marker::MarkerTrait;
 pub trait Foo : MarkerTrait {
     fn bar();
 }
-
diff --git a/src/test/auxiliary/issue_5844_aux.rs b/src/test/auxiliary/issue_5844_aux.rs
index 0f898ae8385..e12af579c57 100644
--- a/src/test/auxiliary/issue_5844_aux.rs
+++ b/src/test/auxiliary/issue_5844_aux.rs
@@ -13,4 +13,3 @@ extern crate libc;
 extern "C" {
     pub fn rand() -> libc::c_int;
 }
-
diff --git a/src/test/auxiliary/issue_8401.rs b/src/test/auxiliary/issue_8401.rs
index 9006a5d1775..04b56442d0b 100644
--- a/src/test/auxiliary/issue_8401.rs
+++ b/src/test/auxiliary/issue_8401.rs
@@ -24,4 +24,3 @@ fn foo<T>(t: &T) {
     let b = B;
     bar(unsafe { mem::transmute(&b as &A) }, t)
 }
-
diff --git a/src/test/auxiliary/issue_9123.rs b/src/test/auxiliary/issue_9123.rs
index 4f2792aebcd..8c2546e76cf 100644
--- a/src/test/auxiliary/issue_9123.rs
+++ b/src/test/auxiliary/issue_9123.rs
@@ -17,4 +17,3 @@ pub trait X {
     }
     fn dummy(&self) { }
 }
-
diff --git a/src/test/auxiliary/issue_9188.rs b/src/test/auxiliary/issue_9188.rs
index 5f5a8f02fd9..d17e4afb5e8 100644
--- a/src/test/auxiliary/issue_9188.rs
+++ b/src/test/auxiliary/issue_9188.rs
@@ -21,4 +21,3 @@ pub fn foo<T>() -> &'static int {
 pub fn bar() -> &'static int {
     foo::<int>()
 }
-
diff --git a/src/test/auxiliary/kinds_in_metadata.rs b/src/test/auxiliary/kinds_in_metadata.rs
index 7e090523984..82f182c04bd 100644
--- a/src/test/auxiliary/kinds_in_metadata.rs
+++ b/src/test/auxiliary/kinds_in_metadata.rs
@@ -16,4 +16,3 @@
 #![crate_type="lib"]
 
 pub fn f<T:Copy>() {}
-
diff --git a/src/test/auxiliary/lang-item-public.rs b/src/test/auxiliary/lang-item-public.rs
index b9cc20b63cc..c5d4182eae6 100644
--- a/src/test/auxiliary/lang-item-public.rs
+++ b/src/test/auxiliary/lang-item-public.rs
@@ -32,5 +32,3 @@ extern fn eh_personality() {}
 pub trait Copy : PhantomFn<Self> {
     // Empty.
 }
-
-
diff --git a/src/test/auxiliary/namespaced_enums.rs b/src/test/auxiliary/namespaced_enums.rs
index 5b21d130d17..3c0138a7077 100644
--- a/src/test/auxiliary/namespaced_enums.rs
+++ b/src/test/auxiliary/namespaced_enums.rs
@@ -18,4 +18,3 @@ impl Foo {
     pub fn foo() {}
     pub fn bar(&self) {}
 }
-
diff --git a/src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs b/src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs
index c460c60b02b..420151c471e 100644
--- a/src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs
+++ b/src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs
@@ -32,4 +32,3 @@ pub fn registrar(_: &mut Registry) {
     thread_local!(static FOO: RefCell<Option<Box<Any+Send>>> = RefCell::new(None));
     FOO.with(|s| *s.borrow_mut() = Some(box Foo { foo: 10 } as Box<Any+Send>));
 }
-
diff --git a/src/test/auxiliary/privacy_reexport.rs b/src/test/auxiliary/privacy_reexport.rs
index 266903169c7..e60dbb290b0 100644
--- a/src/test/auxiliary/privacy_reexport.rs
+++ b/src/test/auxiliary/privacy_reexport.rs
@@ -10,6 +10,6 @@
 
 pub use foo as bar;
 
-mod foo {
+pub mod foo {
     pub fn frob() {}
 }
diff --git a/src/test/auxiliary/pub_static_array.rs b/src/test/auxiliary/pub_static_array.rs
new file mode 100644
index 00000000000..4419a5ae83c
--- /dev/null
+++ b/src/test/auxiliary/pub_static_array.rs
@@ -0,0 +1,11 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub static ARRAY: &'static [u8] = &[1];
diff --git a/src/test/auxiliary/struct_variant_privacy.rs b/src/test/auxiliary/struct_variant_privacy.rs
index 0bdda235080..8d9b304aa51 100644
--- a/src/test/auxiliary/struct_variant_privacy.rs
+++ b/src/test/auxiliary/struct_variant_privacy.rs
@@ -11,4 +11,3 @@
 enum Bar {
     Baz { a: int }
 }
-
diff --git a/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs b/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs
index a7c469fccaa..beee83f9f7c 100644
--- a/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs
+++ b/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs
@@ -21,4 +21,3 @@ pub enum Bar<T:Trait> {
     BBar(T),
     CBar(uint),
 }
-
diff --git a/src/test/auxiliary/weak-lang-items.rs b/src/test/auxiliary/weak-lang-items.rs
index fa254cb91ad..85f49b4bb7f 100644
--- a/src/test/auxiliary/weak-lang-items.rs
+++ b/src/test/auxiliary/weak-lang-items.rs
@@ -34,4 +34,3 @@ pub fn foo() {
 mod std {
     pub use core::{option, fmt};
 }
-
diff --git a/src/test/auxiliary/where_clauses_xc.rs b/src/test/auxiliary/where_clauses_xc.rs
index 002b31f099f..4549bd719c6 100644
--- a/src/test/auxiliary/where_clauses_xc.rs
+++ b/src/test/auxiliary/where_clauses_xc.rs
@@ -27,4 +27,3 @@ impl<T> Equal for T where T: Eq {
 pub fn equal<T>(x: &T, y: &T) -> bool where T: Eq {
     x == y
 }
-
diff --git a/src/test/auxiliary/xcrate_struct_aliases.rs b/src/test/auxiliary/xcrate_struct_aliases.rs
index a0ec7272720..5556ee6971c 100644
--- a/src/test/auxiliary/xcrate_struct_aliases.rs
+++ b/src/test/auxiliary/xcrate_struct_aliases.rs
@@ -14,4 +14,3 @@ pub struct S {
 }
 
 pub type S2 = S;
-
diff --git a/src/test/auxiliary/xcrate_unit_struct.rs b/src/test/auxiliary/xcrate_unit_struct.rs
index 7ae36554079..538abf00a67 100644
--- a/src/test/auxiliary/xcrate_unit_struct.rs
+++ b/src/test/auxiliary/xcrate_unit_struct.rs
@@ -36,4 +36,3 @@ pub enum EnumWithVariants {
     EnumVariant,
     EnumVariantArg(int)
 }
-
diff --git a/src/test/compile-fail/associated-types-coherence-failure.rs b/src/test/compile-fail/associated-types-coherence-failure.rs
index b7a16c68a34..915cb077787 100644
--- a/src/test/compile-fail/associated-types-coherence-failure.rs
+++ b/src/test/compile-fail/associated-types-coherence-failure.rs
@@ -57,4 +57,3 @@ pub trait ToOwned {
 
 
 fn main() {}
-
diff --git a/src/test/compile-fail/associated-types-eq-expr-path.rs b/src/test/compile-fail/associated-types-eq-expr-path.rs
index c48f9972ebc..0d68b960f31 100644
--- a/src/test/compile-fail/associated-types-eq-expr-path.rs
+++ b/src/test/compile-fail/associated-types-eq-expr-path.rs
@@ -22,5 +22,5 @@ impl Foo for isize {
 
 pub fn main() {
     let x: isize = Foo::<A=usize>::bar();
-    //~^ERROR unexpected binding of associated item in expression path
+    //~^ ERROR unexpected binding of associated item in expression path
 }
diff --git a/src/test/compile-fail/associated-types-issue-17359.rs b/src/test/compile-fail/associated-types-issue-17359.rs
index 625f4cdb8ef..5c36e3356a5 100644
--- a/src/test/compile-fail/associated-types-issue-17359.rs
+++ b/src/test/compile-fail/associated-types-issue-17359.rs
@@ -18,4 +18,3 @@ trait Trait : ::std::marker::MarkerTrait {
 impl Trait for isize {}  //~ ERROR missing: `Type`
 
 fn main() {}
-
diff --git a/src/test/compile-fail/bad-crate-id2.rs b/src/test/compile-fail/bad-crate-id2.rs
index 4899252a1a4..6425908672d 100644
--- a/src/test/compile-fail/bad-crate-id2.rs
+++ b/src/test/compile-fail/bad-crate-id2.rs
@@ -11,4 +11,3 @@
 extern crate "#a" as bar; //~ ERROR: invalid character `#` in crate name: `#a`
 
 fn main() {}
-
diff --git a/src/test/compile-fail/borrowck-box-insensitivity.rs b/src/test/compile-fail/borrowck-box-insensitivity.rs
index 59514f75a77..c980e77df6f 100644
--- a/src/test/compile-fail/borrowck-box-insensitivity.rs
+++ b/src/test/compile-fail/borrowck-box-insensitivity.rs
@@ -152,4 +152,3 @@ fn main() {
     borrow_after_mut_borrow_nested();
     mut_borrow_after_borrow_nested();
 }
-
diff --git a/src/test/compile-fail/borrowck-closures-unique-imm.rs b/src/test/compile-fail/borrowck-closures-unique-imm.rs
index dcf43c01e17..247a4fe89a5 100644
--- a/src/test/compile-fail/borrowck-closures-unique-imm.rs
+++ b/src/test/compile-fail/borrowck-closures-unique-imm.rs
@@ -22,4 +22,3 @@ pub fn main() {
     };
     r()
 }
-
diff --git a/src/test/compile-fail/borrowck-consume-unsize-vec.rs b/src/test/compile-fail/borrowck-consume-unsize-vec.rs
new file mode 100644
index 00000000000..32490e0dc7d
--- /dev/null
+++ b/src/test/compile-fail/borrowck-consume-unsize-vec.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Check that we report an error if an upcast box is moved twice.
+
+fn consume(_: Box<[i32]>) {
+}
+
+fn foo(b: Box<[i32;5]>) {
+    consume(b);
+    consume(b); //~ ERROR use of moved value
+}
+
+fn main() {
+}
diff --git a/src/test/compile-fail/borrowck-consume-upcast-box.rs b/src/test/compile-fail/borrowck-consume-upcast-box.rs
new file mode 100644
index 00000000000..5bcafa675c7
--- /dev/null
+++ b/src/test/compile-fail/borrowck-consume-upcast-box.rs
@@ -0,0 +1,24 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Check that we report an error if an upcast box is moved twice.
+
+trait Foo { fn dummy(&self); }
+
+fn consume(_: Box<Foo>) {
+}
+
+fn foo(b: Box<Foo+Send>) {
+    consume(b);
+    consume(b); //~ ERROR use of moved value
+}
+
+fn main() {
+}
diff --git a/src/test/compile-fail/borrowck-field-sensitivity.rs b/src/test/compile-fail/borrowck-field-sensitivity.rs
index fe5142a7734..13fd5fce955 100644
--- a/src/test/compile-fail/borrowck-field-sensitivity.rs
+++ b/src/test/compile-fail/borrowck-field-sensitivity.rs
@@ -124,4 +124,3 @@ fn main() {
     borrow_after_field_assign_after_uninit();
     move_after_field_assign_after_uninit();
 }
-
diff --git a/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs b/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs
index b6b26006555..31ec5aea7f3 100644
--- a/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs
+++ b/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs
@@ -32,4 +32,3 @@ fn main() {
     for &a in x.iter() {    //~ ERROR cannot move out
     }
 }
-
diff --git a/src/test/compile-fail/borrowck-for-loop-head-linkage.rs b/src/test/compile-fail/borrowck-for-loop-head-linkage.rs
index 01a649ae247..b79fc5b2bf6 100644
--- a/src/test/compile-fail/borrowck-for-loop-head-linkage.rs
+++ b/src/test/compile-fail/borrowck-for-loop-head-linkage.rs
@@ -18,4 +18,3 @@ fn main() {
         vector[1] = 5;   //~ ERROR cannot borrow
     }
 }
-
diff --git a/src/test/compile-fail/borrowck-issue-14498.rs b/src/test/compile-fail/borrowck-issue-14498.rs
index deae1fbad20..8278b4fb971 100644
--- a/src/test/compile-fail/borrowck-issue-14498.rs
+++ b/src/test/compile-fail/borrowck-issue-14498.rs
@@ -62,4 +62,3 @@ fn main() {
     borrow_in_field_from_var();
     borrow_in_field_from_field();
 }
-
diff --git a/src/test/compile-fail/borrowck-let-suggestion.rs b/src/test/compile-fail/borrowck-let-suggestion.rs
index 5729f8c5617..d760f3db0c2 100644
--- a/src/test/compile-fail/borrowck-let-suggestion.rs
+++ b/src/test/compile-fail/borrowck-let-suggestion.rs
@@ -17,4 +17,3 @@ fn f() {
 fn main() {
     f();
 }
-
diff --git a/src/test/compile-fail/borrowck-multiple-captures.rs b/src/test/compile-fail/borrowck-multiple-captures.rs
index f417416e7b5..042b914ce41 100644
--- a/src/test/compile-fail/borrowck-multiple-captures.rs
+++ b/src/test/compile-fail/borrowck-multiple-captures.rs
@@ -63,4 +63,3 @@ fn main() {
     same_var_after_borrow();
     same_var_after_move();
 }
-
diff --git a/src/test/compile-fail/borrowck-mutate-in-guard.rs b/src/test/compile-fail/borrowck-mutate-in-guard.rs
index 44353ab5d96..e35edca639e 100644
--- a/src/test/compile-fail/borrowck-mutate-in-guard.rs
+++ b/src/test/compile-fail/borrowck-mutate-in-guard.rs
@@ -30,4 +30,3 @@ fn foo() -> isize {
 fn main() {
     foo();
 }
-
diff --git a/src/test/compile-fail/borrowck-object-lifetime.rs b/src/test/compile-fail/borrowck-object-lifetime.rs
index bbb58e21198..021b3f38e00 100644
--- a/src/test/compile-fail/borrowck-object-lifetime.rs
+++ b/src/test/compile-fail/borrowck-object-lifetime.rs
@@ -37,4 +37,3 @@ fn imm_owned_receiver(mut x: Box<Foo>) {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/borrowck-object-mutability.rs b/src/test/compile-fail/borrowck-object-mutability.rs
index 9b5087bd7e0..1bdc32b0975 100644
--- a/src/test/compile-fail/borrowck-object-mutability.rs
+++ b/src/test/compile-fail/borrowck-object-mutability.rs
@@ -35,4 +35,3 @@ fn mut_owned_receiver(mut x: Box<Foo>) {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/borrowck-overloaded-call.rs b/src/test/compile-fail/borrowck-overloaded-call.rs
index 04d73cc36f0..673c025e863 100644
--- a/src/test/compile-fail/borrowck-overloaded-call.rs
+++ b/src/test/compile-fail/borrowck-overloaded-call.rs
@@ -77,4 +77,3 @@ fn h() {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/borrowck-overloaded-index-and-overloaded-deref.rs b/src/test/compile-fail/borrowck-overloaded-index-and-overloaded-deref.rs
index 4188cf00142..430f2fcc13a 100644
--- a/src/test/compile-fail/borrowck-overloaded-index-and-overloaded-deref.rs
+++ b/src/test/compile-fail/borrowck-overloaded-index-and-overloaded-deref.rs
@@ -44,4 +44,3 @@ fn main() {
 }
 
 fn read(_: usize) { }
-
diff --git a/src/test/compile-fail/borrowck-partial-reinit-2.rs b/src/test/compile-fail/borrowck-partial-reinit-2.rs
index 0926ba6e432..c9cdeff9c7a 100644
--- a/src/test/compile-fail/borrowck-partial-reinit-2.rs
+++ b/src/test/compile-fail/borrowck-partial-reinit-2.rs
@@ -31,4 +31,3 @@ fn main() {
     stuff();
     println!("Hello, world!")
 }
-
diff --git a/src/test/compile-fail/borrowck-unboxed-closures.rs b/src/test/compile-fail/borrowck-unboxed-closures.rs
index 8e7e2e3e777..3eca850e493 100644
--- a/src/test/compile-fail/borrowck-unboxed-closures.rs
+++ b/src/test/compile-fail/borrowck-unboxed-closures.rs
@@ -26,4 +26,3 @@ fn c<F:FnOnce(isize, isize) -> isize>(f: F) {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/borrowck-use-mut-borrow.rs b/src/test/compile-fail/borrowck-use-mut-borrow.rs
index 52f89da10b9..e14df7329ea 100644
--- a/src/test/compile-fail/borrowck-use-mut-borrow.rs
+++ b/src/test/compile-fail/borrowck-use-mut-borrow.rs
@@ -94,4 +94,3 @@ fn main() {
     field_deref_after_var_borrow();
     field_deref_after_field_borrow();
 }
-
diff --git a/src/test/compile-fail/closure-reform-bad.rs b/src/test/compile-fail/closure-reform-bad.rs
index d2295eba6d7..490734d463d 100644
--- a/src/test/compile-fail/closure-reform-bad.rs
+++ b/src/test/compile-fail/closure-reform-bad.rs
@@ -20,4 +20,3 @@ fn main() {
     let f = |s: &str| println!("{}{}", s, string);
     call_bare(f)    //~ ERROR mismatched types
 }
-
diff --git a/src/test/compile-fail/cross-borrow-trait.rs b/src/test/compile-fail/cross-borrow-trait.rs
index 871f52cbebd..d60fb1d5d19 100644
--- a/src/test/compile-fail/cross-borrow-trait.rs
+++ b/src/test/compile-fail/cross-borrow-trait.rs
@@ -24,4 +24,3 @@ pub fn main() {
                         //~| expected &-ptr
                         //~| found box
 }
-
diff --git a/src/test/compile-fail/drop-with-active-borrows-1.rs b/src/test/compile-fail/drop-with-active-borrows-1.rs
index dc8deb04833..903365fb909 100644
--- a/src/test/compile-fail/drop-with-active-borrows-1.rs
+++ b/src/test/compile-fail/drop-with-active-borrows-1.rs
@@ -16,4 +16,3 @@ fn main() {
         println!("{}", *s);
     }
 }
-
diff --git a/src/test/compile-fail/duplicate-parameter.rs b/src/test/compile-fail/duplicate-parameter.rs
index 18ec55e10bb..7586bc61cd6 100644
--- a/src/test/compile-fail/duplicate-parameter.rs
+++ b/src/test/compile-fail/duplicate-parameter.rs
@@ -13,4 +13,3 @@ fn f(a: isize, a: isize) {}
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/duplicate-type-parameter.rs b/src/test/compile-fail/duplicate-type-parameter.rs
index d535ce4a69a..42b67337c64 100644
--- a/src/test/compile-fail/duplicate-type-parameter.rs
+++ b/src/test/compile-fail/duplicate-type-parameter.rs
@@ -36,4 +36,3 @@ impl<T,T> Qux<T,T> for Option<T> {}
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/explicit-self-lifetime-mismatch.rs b/src/test/compile-fail/explicit-self-lifetime-mismatch.rs
index 92542ab3bcb..922e58698dd 100644
--- a/src/test/compile-fail/explicit-self-lifetime-mismatch.rs
+++ b/src/test/compile-fail/explicit-self-lifetime-mismatch.rs
@@ -26,4 +26,3 @@ impl<'a,'b> Foo<'a,'b> {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/extern-with-type-bounds.rs b/src/test/compile-fail/extern-with-type-bounds.rs
index 21334e1d513..2553bdcbb27 100644
--- a/src/test/compile-fail/extern-with-type-bounds.rs
+++ b/src/test/compile-fail/extern-with-type-bounds.rs
@@ -28,4 +28,3 @@ extern "rust-intrinsic" {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/feature-gate-advanced-slice-features.rs b/src/test/compile-fail/feature-gate-advanced-slice-features.rs
index d5841e1e77e..a4524ccd9db 100644
--- a/src/test/compile-fail/feature-gate-advanced-slice-features.rs
+++ b/src/test/compile-fail/feature-gate-advanced-slice-features.rs
@@ -16,4 +16,3 @@ fn main() {
         [ 1, 2, xs.. ] => {}    // OK without feature gate
     }
 }
-
diff --git a/src/test/compile-fail/feature-gate-box-expr.rs b/src/test/compile-fail/feature-gate-box-expr.rs
index 39f54be4561..8f8b035f4a9 100644
--- a/src/test/compile-fail/feature-gate-box-expr.rs
+++ b/src/test/compile-fail/feature-gate-box-expr.rs
@@ -20,4 +20,3 @@ fn main() {
     let x = box (HEAP) 'c'; //~ ERROR box expression syntax is experimental
     println!("x: {}", x);
 }
-
diff --git a/src/test/compile-fail/feature-gate-start.rs b/src/test/compile-fail/feature-gate-start.rs
index 6a9acf04290..7a0924d8adf 100644
--- a/src/test/compile-fail/feature-gate-start.rs
+++ b/src/test/compile-fail/feature-gate-start.rs
@@ -10,4 +10,3 @@
 
 #[start]
 fn foo() {} //~ ERROR: a #[start] function is an experimental feature
-
diff --git a/src/test/compile-fail/generic-no-mangle.rs b/src/test/compile-fail/generic-no-mangle.rs
index f4ead18ee16..4163d531e87 100644
--- a/src/test/compile-fail/generic-no-mangle.rs
+++ b/src/test/compile-fail/generic-no-mangle.rs
@@ -15,4 +15,3 @@ fn foo<T>() {} //~ ERROR generic functions must be mangled
 
 #[no_mangle]
 extern fn foo<T>() {} //~ ERROR generic functions must be mangled
-
diff --git a/src/test/compile-fail/indexing-requires-a-uint.rs b/src/test/compile-fail/indexing-requires-a-uint.rs
index 901d8783d02..3ca00fcb66a 100644
--- a/src/test/compile-fail/indexing-requires-a-uint.rs
+++ b/src/test/compile-fail/indexing-requires-a-uint.rs
@@ -23,4 +23,3 @@ fn main() {
     bar::<isize>(i);  // i should not be re-coerced back to an isize
     //~^ ERROR: mismatched types
 }
-
diff --git a/src/test/compile-fail/infinite-macro-expansion.rs b/src/test/compile-fail/infinite-macro-expansion.rs
index 74835f4bf22..14d22702db7 100644
--- a/src/test/compile-fail/infinite-macro-expansion.rs
+++ b/src/test/compile-fail/infinite-macro-expansion.rs
@@ -15,4 +15,3 @@ macro_rules! recursive {
 fn main() {
     recursive!()
 }
-
diff --git a/src/test/compile-fail/integral-indexing.rs b/src/test/compile-fail/integral-indexing.rs
index e8998dd7a9d..e2fb0fa4f2f 100644
--- a/src/test/compile-fail/integral-indexing.rs
+++ b/src/test/compile-fail/integral-indexing.rs
@@ -24,11 +24,11 @@ pub fn main() {
     s.as_bytes()[3_usize];
     s.as_bytes()[3];
     s.as_bytes()[3u8];  //~ERROR the trait `core::ops::Index<u8>` is not implemented
-    //~^ERROR the trait `core::ops::Index<u8>` is not implemented
+    //~^ ERROR the trait `core::ops::Index<u8>` is not implemented
     s.as_bytes()[3i8];  //~ERROR the trait `core::ops::Index<i8>` is not implemented
-    //~^ERROR the trait `core::ops::Index<i8>` is not implemented
+    //~^ ERROR the trait `core::ops::Index<i8>` is not implemented
     s.as_bytes()[3u32]; //~ERROR the trait `core::ops::Index<u32>` is not implemented
-    //~^ERROR the trait `core::ops::Index<u32>` is not implemented
+    //~^ ERROR the trait `core::ops::Index<u32>` is not implemented
     s.as_bytes()[3i32]; //~ERROR the trait `core::ops::Index<i32>` is not implemented
-    //~^ERROR the trait `core::ops::Index<i32>` is not implemented
+    //~^ ERROR the trait `core::ops::Index<i32>` is not implemented
 }
diff --git a/src/test/compile-fail/intrinsic-return-address.rs b/src/test/compile-fail/intrinsic-return-address.rs
index a80d3931555..b83f0f73436 100644
--- a/src/test/compile-fail/intrinsic-return-address.rs
+++ b/src/test/compile-fail/intrinsic-return-address.rs
@@ -27,5 +27,3 @@ unsafe fn g() -> isize {
 }
 
 fn main() {}
-
-
diff --git a/src/test/compile-fail/issue-10536.rs b/src/test/compile-fail/issue-10536.rs
index 370a6228db6..3b0ea55cfa9 100644
--- a/src/test/compile-fail/issue-10536.rs
+++ b/src/test/compile-fail/issue-10536.rs
@@ -29,4 +29,3 @@ pub fn main() {
     // least throw a conventional error.
     assert!({one! two});
 }
-
diff --git a/src/test/compile-fail/issue-11192.rs b/src/test/compile-fail/issue-11192.rs
index 7313d357ffc..7d8a1528aba 100644
--- a/src/test/compile-fail/issue-11192.rs
+++ b/src/test/compile-fail/issue-11192.rs
@@ -30,4 +30,3 @@ fn main() {
     test(&*ptr);
     //~^ ERROR: cannot borrow `*ptr` as immutable
 }
-
diff --git a/src/test/compile-fail/issue-11593.rs b/src/test/compile-fail/issue-11593.rs
index ecc584d81b0..2749438433d 100644
--- a/src/test/compile-fail/issue-11593.rs
+++ b/src/test/compile-fail/issue-11593.rs
@@ -18,4 +18,3 @@ impl private_trait_xc::Foo for Bar {}
 //~^ ERROR: trait `Foo` is private
 
 fn main() {}
-
diff --git a/src/test/compile-fail/issue-11844.rs b/src/test/compile-fail/issue-11844.rs
index 560cbe1b8a8..a6dbe954ec0 100644
--- a/src/test/compile-fail/issue-11844.rs
+++ b/src/test/compile-fail/issue-11844.rs
@@ -18,4 +18,3 @@ fn main() {
         None => panic!()
     }
 }
-
diff --git a/src/test/compile-fail/issue-12041.rs b/src/test/compile-fail/issue-12041.rs
index 735f529277c..f0f4bf5ca71 100644
--- a/src/test/compile-fail/issue-12041.rs
+++ b/src/test/compile-fail/issue-12041.rs
@@ -21,4 +21,3 @@ fn main() {
         }
     });
 }
-
diff --git a/src/test/compile-fail/issue-12612.rs b/src/test/compile-fail/issue-12612.rs
index 0550472dabb..41cd3863001 100644
--- a/src/test/compile-fail/issue-12612.rs
+++ b/src/test/compile-fail/issue-12612.rs
@@ -20,4 +20,3 @@ mod test {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/issue-13407.rs b/src/test/compile-fail/issue-13407.rs
new file mode 100644
index 00000000000..f845eba4060
--- /dev/null
+++ b/src/test/compile-fail/issue-13407.rs
@@ -0,0 +1,19 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod A {
+    struct C;
+}
+
+fn main() {
+    A::C = 1;
+    //~^ ERROR: illegal left-hand side expression
+    //~| ERROR: mismatched types
+}
diff --git a/src/test/compile-fail/issue-13446.rs b/src/test/compile-fail/issue-13446.rs
index a0a7660428d..53d14862889 100644
--- a/src/test/compile-fail/issue-13446.rs
+++ b/src/test/compile-fail/issue-13446.rs
@@ -16,4 +16,3 @@
 static VEC: [u32; 256] = vec!();
 
 fn main() {}
-
diff --git a/src/test/compile-fail/issue-14092.rs b/src/test/compile-fail/issue-14092.rs
index 0ab37a88826..c87dcb8ae79 100644
--- a/src/test/compile-fail/issue-14092.rs
+++ b/src/test/compile-fail/issue-14092.rs
@@ -11,4 +11,3 @@
 fn fn1(0: Box) {} //~ ERROR: wrong number of type arguments: expected 1, found 0
 
 fn main() {}
-
diff --git a/src/test/compile-fail/issue-16149.rs b/src/test/compile-fail/issue-16149.rs
index a924cc9f9bb..4954c95fcd1 100644
--- a/src/test/compile-fail/issue-16149.rs
+++ b/src/test/compile-fail/issue-16149.rs
@@ -19,4 +19,3 @@ fn main() {
         _ => false
     };
 }
-
diff --git a/src/test/compile-fail/issue-16338.rs b/src/test/compile-fail/issue-16338.rs
index ba936561ae5..ba369734daa 100644
--- a/src/test/compile-fail/issue-16338.rs
+++ b/src/test/compile-fail/issue-16338.rs
@@ -18,4 +18,3 @@ fn main() {
     //~| expected &-ptr
     //~| found struct `core::raw::Slice`
 }
-
diff --git a/src/test/compile-fail/issue-16725.rs b/src/test/compile-fail/issue-16725.rs
index 218e9dba065..67fcd820429 100644
--- a/src/test/compile-fail/issue-16725.rs
+++ b/src/test/compile-fail/issue-16725.rs
@@ -16,4 +16,3 @@ fn main() {
     unsafe { foo::bar(); }
     //~^ ERROR: function `bar` is private
 }
-
diff --git a/src/test/compile-fail/issue-16922.rs b/src/test/compile-fail/issue-16922.rs
new file mode 100644
index 00000000000..b525d5f64fc
--- /dev/null
+++ b/src/test/compile-fail/issue-16922.rs
@@ -0,0 +1,20 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::any::Any;
+
+fn foo<T: Any>(value: &T) -> Box<Any> {
+    Box::new(value) as Box<Any>
+    //~^ ERROR: cannot infer an appropriate lifetime
+}
+
+fn main() {
+    let _ = foo(&5);
+}
diff --git a/src/test/compile-fail/issue-17718-const-bad-values.rs b/src/test/compile-fail/issue-17718-const-bad-values.rs
index 2347d3f3d5c..6ee869d65a8 100644
--- a/src/test/compile-fail/issue-17718-const-bad-values.rs
+++ b/src/test/compile-fail/issue-17718-const-bad-values.rs
@@ -17,4 +17,3 @@ const C2: &'static mut usize = &mut S;
 //~^^ ERROR: references in constants may only refer to immutable values
 
 fn main() {}
-
diff --git a/src/test/compile-fail/issue-18919.rs b/src/test/compile-fail/issue-18919.rs
new file mode 100644
index 00000000000..8c2c52e6fad
--- /dev/null
+++ b/src/test/compile-fail/issue-18919.rs
@@ -0,0 +1,17 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type FuncType<'f> = Fn(&isize) -> isize + 'f;
+
+fn ho_func(f: Option<FuncType>) {
+    //~^ ERROR: the trait `core::marker::Sized` is not implemented for the type
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/issue-19982.rs b/src/test/compile-fail/issue-19982.rs
new file mode 100644
index 00000000000..9dbca997341
--- /dev/null
+++ b/src/test/compile-fail/issue-19982.rs
@@ -0,0 +1,17 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(unboxed_closures)]
+
+struct Foo;
+
+impl Fn<(&(),)> for Foo { } //~ ERROR missing lifetime specifier
+
+fn main() {}
diff --git a/src/test/compile-fail/issue-20225.rs b/src/test/compile-fail/issue-20225.rs
new file mode 100644
index 00000000000..e4bedbbb7e1
--- /dev/null
+++ b/src/test/compile-fail/issue-20225.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(unboxed_closures)]
+
+struct Foo;
+
+impl<'a, T> Fn<(&'a T,)> for Foo {
+  type Output = ();
+
+  extern "rust-call" fn call(&self, (_,): (T,)) {}
+  //~^ ERROR: has an incompatible type for trait: expected &-ptr
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/issue-20261.rs b/src/test/compile-fail/issue-20261.rs
new file mode 100644
index 00000000000..33e00f9a823
--- /dev/null
+++ b/src/test/compile-fail/issue-20261.rs
@@ -0,0 +1,17 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    for (ref i,) in [].iter() { //~ ERROR: type mismatch resolving
+        i.clone();
+        //~^ ERROR: the type of this value must be known in this context
+        //~| ERROR: reached the recursion limit while auto-dereferencing
+    }
+}
diff --git a/src/test/compile-fail/issue-20714.rs b/src/test/compile-fail/issue-20714.rs
new file mode 100644
index 00000000000..cb322f00723
--- /dev/null
+++ b/src/test/compile-fail/issue-20714.rs
@@ -0,0 +1,15 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct G;
+
+fn main() {
+    let g = G(); //~ ERROR: expected function, found `G`
+}
diff --git a/src/test/compile-fail/issue-3008-2.rs b/src/test/compile-fail/issue-3008-2.rs
index 1e8f81a05e7..c744dff0c04 100644
--- a/src/test/compile-fail/issue-3008-2.rs
+++ b/src/test/compile-fail/issue-3008-2.rs
@@ -15,4 +15,3 @@ struct bar { x: bar }
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/issue-3907.rs b/src/test/compile-fail/issue-3907.rs
index 001de796b4a..a3d90a00d03 100644
--- a/src/test/compile-fail/issue-3907.rs
+++ b/src/test/compile-fail/issue-3907.rs
@@ -28,4 +28,3 @@ fn main() {
     };
     s.bar();
 }
-
diff --git a/src/test/compile-fail/issue-5844.rs b/src/test/compile-fail/issue-5844.rs
index 6c85a97f7f5..02e5b9b0921 100644
--- a/src/test/compile-fail/issue-5844.rs
+++ b/src/test/compile-fail/issue-5844.rs
@@ -15,4 +15,3 @@ extern crate issue_5844_aux;
 fn main () {
     issue_5844_aux::rand(); //~ ERROR: requires unsafe
 }
-
diff --git a/src/test/compile-fail/issue-7607-1.rs b/src/test/compile-fail/issue-7607-1.rs
index 4ac90177609..40c3d96bc9a 100644
--- a/src/test/compile-fail/issue-7607-1.rs
+++ b/src/test/compile-fail/issue-7607-1.rs
@@ -17,4 +17,3 @@ impl Fo { //~ ERROR use of undeclared type name `Fo`
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/issue-8767.rs b/src/test/compile-fail/issue-8767.rs
index 2ef0a75f77b..9abd8c9e3fc 100644
--- a/src/test/compile-fail/issue-8767.rs
+++ b/src/test/compile-fail/issue-8767.rs
@@ -15,4 +15,3 @@ impl B { //~ ERROR use of undeclared type name `B`
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/kindck-copy.rs b/src/test/compile-fail/kindck-copy.rs
index 74e372e41eb..d5bfe3d1692 100644
--- a/src/test/compile-fail/kindck-copy.rs
+++ b/src/test/compile-fail/kindck-copy.rs
@@ -80,4 +80,3 @@ fn test<'a,T,U:Copy>(_: &'a isize) {
 
 pub fn main() {
 }
-
diff --git a/src/test/compile-fail/kindck-nonsendable-1.rs b/src/test/compile-fail/kindck-nonsendable-1.rs
index c370aa4b8fb..bf2a209c4c4 100644
--- a/src/test/compile-fail/kindck-nonsendable-1.rs
+++ b/src/test/compile-fail/kindck-nonsendable-1.rs
@@ -20,4 +20,3 @@ fn main() {
     bar(move|| foo(x));
     //~^ ERROR `core::marker::Send` is not implemented
 }
-
diff --git a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs b/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs
index 55cce016335..1fa7284f6b5 100644
--- a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs
+++ b/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs
@@ -37,4 +37,3 @@ fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/linkage3.rs b/src/test/compile-fail/linkage3.rs
index c75c7002e5e..8343f718902 100644
--- a/src/test/compile-fail/linkage3.rs
+++ b/src/test/compile-fail/linkage3.rs
@@ -18,4 +18,3 @@ extern {
 fn main() {
     println!("{:?}", foo);
 }
-
diff --git a/src/test/compile-fail/lint-dead-code-3.rs b/src/test/compile-fail/lint-dead-code-3.rs
index f60c39ba020..13ee3f16361 100644
--- a/src/test/compile-fail/lint-dead-code-3.rs
+++ b/src/test/compile-fail/lint-dead-code-3.rs
@@ -19,7 +19,7 @@ extern crate libc;
 
 pub use extern_foo as x;
 extern {
-    fn extern_foo();
+    pub fn extern_foo();
 }
 
 struct Foo; //~ ERROR: struct is never used
diff --git a/src/test/compile-fail/lint-exceeding-bitshifts.rs b/src/test/compile-fail/lint-exceeding-bitshifts.rs
index 345e56e2e58..171dedd5b2e 100644
--- a/src/test/compile-fail/lint-exceeding-bitshifts.rs
+++ b/src/test/compile-fail/lint-exceeding-bitshifts.rs
@@ -60,4 +60,3 @@ fn main() {
       let n = 1_isize << std::isize::BITS; //~ ERROR: bitshift exceeds the type's number of bits
       let n = 1_usize << std::usize::BITS; //~ ERROR: bitshift exceeds the type's number of bits
 }
-
diff --git a/src/test/compile-fail/lint-stability3.rs b/src/test/compile-fail/lint-stability3.rs
index 88a93134b47..44a36f215f3 100644
--- a/src/test/compile-fail/lint-stability3.rs
+++ b/src/test/compile-fail/lint-stability3.rs
@@ -22,4 +22,3 @@ use lint_stability::*;
 fn main() {
     macro_test_arg_nested!(deprecated_text);
 }
-
diff --git a/src/test/compile-fail/lint-uppercase-variables.rs b/src/test/compile-fail/lint-uppercase-variables.rs
index a4f46cbd187..517be0eb8ac 100644
--- a/src/test/compile-fail/lint-uppercase-variables.rs
+++ b/src/test/compile-fail/lint-uppercase-variables.rs
@@ -40,4 +40,3 @@ fn main() {
 
     let _ = Something { X: 0 };
 }
-
diff --git a/src/test/compile-fail/macro-inner-attributes.rs b/src/test/compile-fail/macro-inner-attributes.rs
index e76eaea365e..abf0ed420e7 100644
--- a/src/test/compile-fail/macro-inner-attributes.rs
+++ b/src/test/compile-fail/macro-inner-attributes.rs
@@ -29,4 +29,3 @@ fn main() {
     //~^^ ERROR unresolved name `a::bar`
     b::bar();
 }
-
diff --git a/src/test/compile-fail/macro-outer-attributes.rs b/src/test/compile-fail/macro-outer-attributes.rs
index cff01f36f3a..0469a9d1cc8 100644
--- a/src/test/compile-fail/macro-outer-attributes.rs
+++ b/src/test/compile-fail/macro-outer-attributes.rs
@@ -28,4 +28,3 @@ fn main() {
     a::bar(); //~ ERROR unresolved name `a::bar`
     b::bar();
 }
-
diff --git a/src/test/compile-fail/manual-link-bad-form.rs b/src/test/compile-fail/manual-link-bad-form.rs
index bd2a3eba0b5..c251ce6a3c8 100644
--- a/src/test/compile-fail/manual-link-bad-form.rs
+++ b/src/test/compile-fail/manual-link-bad-form.rs
@@ -13,5 +13,3 @@
 
 fn main() {
 }
-
-
diff --git a/src/test/compile-fail/manual-link-bad-kind.rs b/src/test/compile-fail/manual-link-bad-kind.rs
index 4614440ddaf..5ab073c33bc 100644
--- a/src/test/compile-fail/manual-link-bad-kind.rs
+++ b/src/test/compile-fail/manual-link-bad-kind.rs
@@ -13,4 +13,3 @@
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs b/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs
index 981c4c6f40d..c1d4551fd9e 100644
--- a/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs
+++ b/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs
@@ -19,4 +19,3 @@ trait me2 {
 }
 impl me2 for usize { fn me(&self) -> usize { *self } }
 fn main() { 1_usize.me(); } //~ ERROR E0034
-
diff --git a/src/test/compile-fail/method-missing-call.rs b/src/test/compile-fail/method-missing-call.rs
index 6616dcc8e1b..b13d4250ee9 100644
--- a/src/test/compile-fail/method-missing-call.rs
+++ b/src/test/compile-fail/method-missing-call.rs
@@ -40,4 +40,3 @@ fn main() {
               .filter_map; //~ ERROR attempted to take value of method `filter_map` on type
               //~^ HELP maybe a `()` to call it is missing
 }
-
diff --git a/src/test/compile-fail/mut-cross-borrowing.rs b/src/test/compile-fail/mut-cross-borrowing.rs
index 6829cd574e1..73982fa2811 100644
--- a/src/test/compile-fail/mut-cross-borrowing.rs
+++ b/src/test/compile-fail/mut-cross-borrowing.rs
@@ -16,4 +16,3 @@ fn main() {
     let mut x: Box<_> = box 3;
     f(x)    //~ ERROR mismatched types
 }
-
diff --git a/src/test/compile-fail/object-safety-by-value-self-use.rs b/src/test/compile-fail/object-safety-by-value-self-use.rs
index 1b20a902c9d..36356cb7d52 100644
--- a/src/test/compile-fail/object-safety-by-value-self-use.rs
+++ b/src/test/compile-fail/object-safety-by-value-self-use.rs
@@ -26,4 +26,3 @@ fn use_bar(t: Box<Bar>) {
 }
 
 fn main() { }
-
diff --git a/src/test/compile-fail/opt-in-copy.rs b/src/test/compile-fail/opt-in-copy.rs
index 56f71c844ac..bc18b52a0c1 100644
--- a/src/test/compile-fail/opt-in-copy.rs
+++ b/src/test/compile-fail/opt-in-copy.rs
@@ -30,4 +30,3 @@ impl Copy for IWantToCopyThisToo {}
 //~^ ERROR the trait `Copy` may not be implemented for this type
 
 fn main() {}
-
diff --git a/src/test/compile-fail/overloaded-calls-nontuple.rs b/src/test/compile-fail/overloaded-calls-nontuple.rs
index 41ecf714613..c4019fa2209 100644
--- a/src/test/compile-fail/overloaded-calls-nontuple.rs
+++ b/src/test/compile-fail/overloaded-calls-nontuple.rs
@@ -31,4 +31,3 @@ fn main() {
     };
     drop(s(3))  //~ ERROR cannot use call notation
 }
-
diff --git a/src/test/compile-fail/pattern-bindings-after-at.rs b/src/test/compile-fail/pattern-bindings-after-at.rs
index 80544099329..da2a97b0ca8 100644
--- a/src/test/compile-fail/pattern-bindings-after-at.rs
+++ b/src/test/compile-fail/pattern-bindings-after-at.rs
@@ -23,4 +23,3 @@ fn main() {
         _ => ()
     }
 }
-
diff --git a/src/test/compile-fail/pattern-ident-path-generics.rs b/src/test/compile-fail/pattern-ident-path-generics.rs
index 58288fa4842..0b7886842b4 100644
--- a/src/test/compile-fail/pattern-ident-path-generics.rs
+++ b/src/test/compile-fail/pattern-ident-path-generics.rs
@@ -14,4 +14,3 @@ fn main() {
         Some(_) => {}
     }
 }
-
diff --git a/src/test/compile-fail/privacy1.rs b/src/test/compile-fail/privacy1.rs
index 1ae79adbad7..67dccb4c93e 100644
--- a/src/test/compile-fail/privacy1.rs
+++ b/src/test/compile-fail/privacy1.rs
@@ -27,10 +27,6 @@ mod bar {
 
     // can't publicly re-export private items
     pub use self::baz::{foo, bar};
-    //~^ ERROR: function `bar` is private
-
-    pub use self::private::ppriv;
-    //~^ ERROR: function `ppriv` is private
 
     pub struct A;
     impl A {
@@ -61,10 +57,8 @@ mod bar {
             fn bar2(&self) {}
         }
 
-        // both of these are re-exported by `bar`, but only one should be
-        // validly re-exported
         pub fn foo() {}
-        fn bar() {}
+        pub fn bar() {}
     }
 
     extern {
@@ -92,10 +86,6 @@ mod bar {
         pub fn gpub() {}
         fn gpriv() {}
     }
-
-    mod private {
-        fn ppriv() {}
-    }
 }
 
 pub fn gpub() {}
@@ -142,13 +132,13 @@ mod foo {
 
         ::bar::baz::foo(); //~ ERROR: function `foo` is inaccessible
                            //~^ NOTE: module `baz` is private
-        ::bar::baz::bar(); //~ ERROR: function `bar` is private
+        ::bar::baz::bar(); //~ ERROR: function `bar` is inaccessible
     }
 
     fn test2() {
         use bar::baz::{foo, bar};
         //~^ ERROR: function `foo` is inaccessible
-        //~^^ ERROR: function `bar` is private
+        //~^^ ERROR: function `bar` is inaccessible
         foo();
         bar();
     }
diff --git a/src/test/compile-fail/region-bound-on-closure-outlives-call.rs b/src/test/compile-fail/region-bound-on-closure-outlives-call.rs
index 9f35c636b45..b73c283fa51 100644
--- a/src/test/compile-fail/region-bound-on-closure-outlives-call.rs
+++ b/src/test/compile-fail/region-bound-on-closure-outlives-call.rs
@@ -13,4 +13,3 @@ fn call_rec<F>(mut f: F) -> usize where F: FnMut(usize) -> usize {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/region-object-lifetime-1.rs b/src/test/compile-fail/region-object-lifetime-1.rs
index 2095fb903b8..1e615be9d6a 100644
--- a/src/test/compile-fail/region-object-lifetime-1.rs
+++ b/src/test/compile-fail/region-object-lifetime-1.rs
@@ -26,4 +26,3 @@ fn borrowed_receiver_same_lifetime<'a>(x: &'a Foo) -> &'a () {
 
 #[rustc_error]
 fn main() {} //~ ERROR compilation successful
-
diff --git a/src/test/compile-fail/region-object-lifetime-2.rs b/src/test/compile-fail/region-object-lifetime-2.rs
index f9bf4e257b3..e011b8f5697 100644
--- a/src/test/compile-fail/region-object-lifetime-2.rs
+++ b/src/test/compile-fail/region-object-lifetime-2.rs
@@ -21,4 +21,3 @@ fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/region-object-lifetime-3.rs b/src/test/compile-fail/region-object-lifetime-3.rs
index 097053276c7..84dd97643a1 100644
--- a/src/test/compile-fail/region-object-lifetime-3.rs
+++ b/src/test/compile-fail/region-object-lifetime-3.rs
@@ -26,4 +26,3 @@ fn borrowed_receiver_related_lifetimes<'a,'b>(x: &'a (Foo+'b)) -> &'a () {
 
 #[rustc_error]
 fn main() {} //~ ERROR compilation successful
-
diff --git a/src/test/compile-fail/region-object-lifetime-4.rs b/src/test/compile-fail/region-object-lifetime-4.rs
index fe0ff8dc3fe..0a68e7f1076 100644
--- a/src/test/compile-fail/region-object-lifetime-4.rs
+++ b/src/test/compile-fail/region-object-lifetime-4.rs
@@ -23,4 +23,3 @@ fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/region-object-lifetime-5.rs b/src/test/compile-fail/region-object-lifetime-5.rs
index f07f753d825..26aad0e33b1 100644
--- a/src/test/compile-fail/region-object-lifetime-5.rs
+++ b/src/test/compile-fail/region-object-lifetime-5.rs
@@ -22,4 +22,3 @@ fn owned_receiver(x: Box<Foo>) -> &'static () {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs b/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs
index 9418156ffcd..5db9a01c012 100644
--- a/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs
+++ b/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs
@@ -20,4 +20,3 @@ fn main() {
         f = move |a: isize, b: isize| { a + b + *c_ref };
     }
 }
-
diff --git a/src/test/compile-fail/regions-close-associated-type-into-object.rs b/src/test/compile-fail/regions-close-associated-type-into-object.rs
index 72a024e563c..f80b0ffa5aa 100644
--- a/src/test/compile-fail/regions-close-associated-type-into-object.rs
+++ b/src/test/compile-fail/regions-close-associated-type-into-object.rs
@@ -84,4 +84,3 @@ fn meh1<'a, T: Iter>(v: &'a T) -> Box<X+'a>
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/regions-close-object-into-object-1.rs b/src/test/compile-fail/regions-close-object-into-object-1.rs
index 7bbce7dad53..4c831a2b659 100644
--- a/src/test/compile-fail/regions-close-object-into-object-1.rs
+++ b/src/test/compile-fail/regions-close-object-into-object-1.rs
@@ -25,4 +25,3 @@ fn f<'a, T:'static, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/regions-close-object-into-object-3.rs b/src/test/compile-fail/regions-close-object-into-object-3.rs
index e22d0c7d0a4..b723efff3c9 100644
--- a/src/test/compile-fail/regions-close-object-into-object-3.rs
+++ b/src/test/compile-fail/regions-close-object-into-object-3.rs
@@ -24,4 +24,3 @@ fn h<'a, T, U>(v: Box<A<U>+'static>) -> Box<X+'static> {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/regions-close-object-into-object-4.rs b/src/test/compile-fail/regions-close-object-into-object-4.rs
index 147a575d38c..9b311588bb1 100644
--- a/src/test/compile-fail/regions-close-object-into-object-4.rs
+++ b/src/test/compile-fail/regions-close-object-into-object-4.rs
@@ -23,4 +23,3 @@ fn i<'a, T, U>(v: Box<A<U>+'a>) -> Box<X+'static> {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/regions-close-object-into-object-5.rs b/src/test/compile-fail/regions-close-object-into-object-5.rs
index bdc52eca2cb..f3b5ccabe79 100644
--- a/src/test/compile-fail/regions-close-object-into-object-5.rs
+++ b/src/test/compile-fail/regions-close-object-into-object-5.rs
@@ -27,4 +27,3 @@ fn f<'a, T, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/regions-close-param-into-object.rs b/src/test/compile-fail/regions-close-param-into-object.rs
index eebf93bc893..7324d4a4a0e 100644
--- a/src/test/compile-fail/regions-close-param-into-object.rs
+++ b/src/test/compile-fail/regions-close-param-into-object.rs
@@ -37,4 +37,3 @@ fn p4<'a,T>(v: Box<T>) -> Box<X+'a>
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs b/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs
index 8673d95de1b..af3ee7f3537 100644
--- a/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs
+++ b/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs
@@ -12,4 +12,3 @@ extern crate std;
 //~^ ERROR an external crate named `std` has already been imported
 
 fn main(){}
-
diff --git a/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs b/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs
index f27b11d5411..0c601a81178 100644
--- a/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs
+++ b/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs
@@ -12,4 +12,3 @@ use std::slice as std; //~ ERROR import `std` conflicts with imported crate
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/resolve-conflict-import-vs-import.rs b/src/test/compile-fail/resolve-conflict-import-vs-import.rs
index beb4b74f326..10afe82f2ef 100644
--- a/src/test/compile-fail/resolve-conflict-import-vs-import.rs
+++ b/src/test/compile-fail/resolve-conflict-import-vs-import.rs
@@ -14,4 +14,3 @@ use std::mem::transmute;
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs b/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs
index 9d40196d4ac..e685353592f 100644
--- a/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs
+++ b/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs
@@ -12,4 +12,3 @@ fn std() {}    //~ ERROR the name `std` conflicts with an external crate
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/resolve-conflict-item-vs-import.rs b/src/test/compile-fail/resolve-conflict-item-vs-import.rs
index 96800918351..1edf815ecae 100644
--- a/src/test/compile-fail/resolve-conflict-item-vs-import.rs
+++ b/src/test/compile-fail/resolve-conflict-item-vs-import.rs
@@ -15,4 +15,3 @@ fn transmute() {}
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/resolve-unknown-trait.rs b/src/test/compile-fail/resolve-unknown-trait.rs
index 3983a84f6ad..fd4dce51fc8 100644
--- a/src/test/compile-fail/resolve-unknown-trait.rs
+++ b/src/test/compile-fail/resolve-unknown-trait.rs
@@ -17,4 +17,3 @@ impl SomeNonExistentTrait for isize {}
 
 fn f<T:SomeNonExistentTrait>() {}
 //~^ ERROR use of undeclared trait name `SomeNonExistentTrait`
-
diff --git a/src/test/compile-fail/retslot-cast.rs b/src/test/compile-fail/retslot-cast.rs
index fafae0cb705..4ef07ecb438 100644
--- a/src/test/compile-fail/retslot-cast.rs
+++ b/src/test/compile-fail/retslot-cast.rs
@@ -12,9 +12,15 @@
 #![allow(warnings)]
 
 pub fn fail(x: Option<& (Iterator+Send)>) -> Option<&Iterator> {
-    // This call used to trigger an LLVM assertion because the return slot had type
-    // "Option<&Iterator>"* instead of "Option<&(Iterator+Send)>"*
-    inner(x)
+    // This call used to trigger an LLVM assertion because the return
+    // slot had type "Option<&Iterator>"* instead of
+    // "Option<&(Iterator+Send)>"* -- but this now yields a
+    // compilation error and I'm not sure how to create a comparable
+    // test. To ensure that this PARTICULAR failure doesn't occur
+    // again, though, I've left this test here, so if this ever starts
+    // to compile again, we can adjust the test appropriately (clearly
+    // it should never ICE...). -nmatsakis
+    inner(x) //~ ERROR mismatched types
 }
 
 pub fn inner(x: Option<& (Iterator+Send)>) -> Option<&(Iterator+Send)> {
@@ -22,4 +28,4 @@ pub fn inner(x: Option<& (Iterator+Send)>) -> Option<&(Iterator+Send)> {
 }
 
 #[rustc_error]
-fn main() {} //~ ERROR compilation successful
+fn main() {}
diff --git a/src/test/compile-fail/shadowing-in-the-same-pattern.rs b/src/test/compile-fail/shadowing-in-the-same-pattern.rs
index c29534128ae..e847d332416 100644
--- a/src/test/compile-fail/shadowing-in-the-same-pattern.rs
+++ b/src/test/compile-fail/shadowing-in-the-same-pattern.rs
@@ -15,4 +15,3 @@ fn f((a, a): (isize, isize)) {} //~ ERROR identifier `a` is bound more than once
 fn main() {
     let (a, a) = (1, 1);    //~ ERROR identifier `a` is bound more than once
 }
-
diff --git a/src/test/compile-fail/static-array-across-crate.rs b/src/test/compile-fail/static-array-across-crate.rs
new file mode 100644
index 00000000000..422cf630429
--- /dev/null
+++ b/src/test/compile-fail/static-array-across-crate.rs
@@ -0,0 +1,20 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:pub_static_array.rs
+
+extern crate "pub_static_array" as array;
+
+use array::ARRAY;
+
+static X: &'static u8 = &ARRAY[0];
+//~^ ERROR: cannot refer to the interior of another static, use a constant
+
+pub fn main() {}
diff --git a/src/test/compile-fail/struct-variant-privacy-xc.rs b/src/test/compile-fail/struct-variant-privacy-xc.rs
index c58273361ad..b8be7d0cdc2 100644
--- a/src/test/compile-fail/struct-variant-privacy-xc.rs
+++ b/src/test/compile-fail/struct-variant-privacy-xc.rs
@@ -18,4 +18,3 @@ fn f(b: struct_variant_privacy::Bar) { //~ ERROR enum `Bar` is private
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/structure-constructor-type-mismatch.rs b/src/test/compile-fail/structure-constructor-type-mismatch.rs
index ea6d63ca540..02c4f3d5d52 100644
--- a/src/test/compile-fail/structure-constructor-type-mismatch.rs
+++ b/src/test/compile-fail/structure-constructor-type-mismatch.rs
@@ -62,4 +62,3 @@ fn main() {
         y: 10,
     };
 }
-
diff --git a/src/test/compile-fail/trait-as-struct-constructor.rs b/src/test/compile-fail/trait-as-struct-constructor.rs
index fff14414094..1fd711ca4fb 100644
--- a/src/test/compile-fail/trait-as-struct-constructor.rs
+++ b/src/test/compile-fail/trait-as-struct-constructor.rs
@@ -14,4 +14,3 @@ fn main() {
     TraitNotAStruct{ value: 0 };
     //~^ ERROR: use of trait `TraitNotAStruct` as a struct constructor [E0159]
 }
-
diff --git a/src/test/compile-fail/trait-bounds-impl-comparison-2.rs b/src/test/compile-fail/trait-bounds-impl-comparison-2.rs
index 284c4fac953..217540415a7 100644
--- a/src/test/compile-fail/trait-bounds-impl-comparison-2.rs
+++ b/src/test/compile-fail/trait-bounds-impl-comparison-2.rs
@@ -32,4 +32,3 @@ struct ZipIterator<T, U> {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs
index 448b186f6a5..e126a3040e9 100644
--- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs
+++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs
@@ -15,7 +15,7 @@ trait Foo {
 // This should emit the less confusing error, not the more confusing one.
 
 fn foo(_x: Foo + Send) {
-    //~^ERROR the trait `core::marker::Sized` is not implemented
+    //~^ ERROR the trait `core::marker::Sized` is not implemented
 }
 
 fn main() { }
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs
index df44e847c50..d39b7e15edc 100644
--- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs
+++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs
@@ -25,4 +25,3 @@ fn main() {
     let baz: Foo<usize> = panic!();
     //~^ ERROR not implemented
 }
-
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs
index 18871d0d386..d93c9bafaef 100644
--- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs
+++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs
@@ -23,4 +23,3 @@ static X: Foo<usize> = Foo {
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs
index ded75aa1d85..5f95a7ca6e2 100644
--- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs
+++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs
@@ -22,4 +22,3 @@ fn kaboom(y: Bar<f32>) {}
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs
index 8a9732de7fb..840787022e6 100644
--- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs
+++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs
@@ -23,4 +23,3 @@ fn main() {
     //~^ ERROR not implemented
     let _ = bar;
 }
-
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs
index 8dfdb2f205d..ce0a7d3bb36 100644
--- a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs
+++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs
@@ -66,4 +66,3 @@ impl PolyTrait<Foo<usize>> for Struct {
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/trait-coercion-generic-regions.rs b/src/test/compile-fail/trait-coercion-generic-regions.rs
index bbe256d1c8f..9ba017e150e 100644
--- a/src/test/compile-fail/trait-coercion-generic-regions.rs
+++ b/src/test/compile-fail/trait-coercion-generic-regions.rs
@@ -28,4 +28,3 @@ fn main() {
     // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let s: Box<Trait<&'static str>> = Box::new(Struct { person: person });
 }
-
diff --git a/src/test/compile-fail/transmute-different-sizes.rs b/src/test/compile-fail/transmute-different-sizes.rs
index 5c61212a7f5..918589b8fd3 100644
--- a/src/test/compile-fail/transmute-different-sizes.rs
+++ b/src/test/compile-fail/transmute-different-sizes.rs
@@ -25,5 +25,3 @@ unsafe fn g<T>(x: &T) {
 }
 
 fn main() {}
-
-
diff --git a/src/test/compile-fail/type-params-in-different-spaces-2.rs b/src/test/compile-fail/type-params-in-different-spaces-2.rs
index 3a4cc9e874e..71e9113603a 100644
--- a/src/test/compile-fail/type-params-in-different-spaces-2.rs
+++ b/src/test/compile-fail/type-params-in-different-spaces-2.rs
@@ -29,4 +29,3 @@ trait B<T>: Tr<T> {
 
 fn main() {
 }
-
diff --git a/src/test/compile-fail/type-params-in-different-spaces-3.rs b/src/test/compile-fail/type-params-in-different-spaces-3.rs
index c113e1b7815..3ad1e9ab538 100644
--- a/src/test/compile-fail/type-params-in-different-spaces-3.rs
+++ b/src/test/compile-fail/type-params-in-different-spaces-3.rs
@@ -15,4 +15,3 @@ trait Tr : Sized {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/ufcs-explicit-self-bad.rs b/src/test/compile-fail/ufcs-explicit-self-bad.rs
index cbcf31b5b7e..5d2b5fa52db 100644
--- a/src/test/compile-fail/ufcs-explicit-self-bad.rs
+++ b/src/test/compile-fail/ufcs-explicit-self-bad.rs
@@ -63,4 +63,3 @@ fn main() {
     };
     println!("{} {}", bar.foo(2), bar.bar(2));
 }
-
diff --git a/src/test/compile-fail/ufcs-qpath-self-mismatch.rs b/src/test/compile-fail/ufcs-qpath-self-mismatch.rs
index 868c1eae4a9..8e60064beca 100644
--- a/src/test/compile-fail/ufcs-qpath-self-mismatch.rs
+++ b/src/test/compile-fail/ufcs-qpath-self-mismatch.rs
@@ -18,4 +18,3 @@ fn main() {
     <i32 as Add<i32>>::add(1, 2u32);
     //~^ ERROR mismatched types
 }
-
diff --git a/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs b/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs
index f28bf7acadd..b195a932aca 100644
--- a/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs
+++ b/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs
@@ -17,4 +17,3 @@ type Typedef = isize;
 fn g<F:Typedef(isize) -> isize>(x: F) {} //~ ERROR `Typedef` is not a trait
 
 fn main() {}
-
diff --git a/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs b/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs
index 1f0d5aae36d..55156e28cd7 100644
--- a/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs
+++ b/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs
@@ -20,4 +20,3 @@ fn bar2<T>(x: &T) where T: Fn<()> {
 }
 
 fn main() { }
-
diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs
index a3991a87b78..1e36c47c097 100644
--- a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs
+++ b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs
@@ -22,4 +22,3 @@ fn bar() {
 }
 
 fn main() { }
-
diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs
index ad85cdcaa03..f50d91a4ddd 100644
--- a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs
+++ b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs
@@ -20,4 +20,3 @@ fn foo(b: Box<Bar()>) {
 }
 
 fn main() { }
-
diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs b/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs
index 5810ffcf21a..e6e18d996b9 100644
--- a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs
+++ b/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs
@@ -17,4 +17,3 @@ fn f<F:Trait(isize) -> isize>(x: F) {}
 //~| ERROR no associated type `Output`
 
 fn main() {}
-
diff --git a/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs b/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs
index bbafd5109ed..92e6affa4c2 100644
--- a/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs
+++ b/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs
@@ -35,4 +35,3 @@ fn main() {
     //~^ ERROR not implemented
     //~| ERROR not implemented
 }
-
diff --git a/src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs b/src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs
index f993b8fa8c4..226b516e09d 100644
--- a/src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs
+++ b/src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs
@@ -15,4 +15,3 @@ fn main() {
     let () = zero.call_mut(());
     //~^ ERROR we have not yet inferred what kind of closure it is
 }
-
diff --git a/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs b/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs
index afbc141b5d2..7c5ea031596 100644
--- a/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs
+++ b/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs
@@ -29,4 +29,3 @@ fn main() {
 
     tick2(); //~ ERROR cannot borrow
 }
-
diff --git a/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs b/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs
index f430e9fc759..1a52e22419e 100644
--- a/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs
+++ b/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs
@@ -16,4 +16,3 @@ fn main() {
     let mut_ = to_fn_mut(|x| x);
     mut_.call((0, )); //~ ERROR does not implement any method in scope named `call`
 }
-
diff --git a/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs b/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs
index c2a2e5162ac..28e8b8db2a4 100644
--- a/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs
+++ b/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs
@@ -25,4 +25,3 @@ pub fn main() {
     //~| ERROR type mismatch
     println!("{}", z);
 }
-
diff --git a/src/test/compile-fail/unboxed-closures-wrong-abi.rs b/src/test/compile-fail/unboxed-closures-wrong-abi.rs
index 96619bef36f..40655f8a3ce 100644
--- a/src/test/compile-fail/unboxed-closures-wrong-abi.rs
+++ b/src/test/compile-fail/unboxed-closures-wrong-abi.rs
@@ -35,4 +35,3 @@ fn c() {
 }
 
 fn main() { }
-
diff --git a/src/test/compile-fail/variance-issue-20533.rs b/src/test/compile-fail/variance-issue-20533.rs
index e5473f12bf2..60690012485 100644
--- a/src/test/compile-fail/variance-issue-20533.rs
+++ b/src/test/compile-fail/variance-issue-20533.rs
@@ -51,4 +51,3 @@ fn main() {
         drop(x);
     }
 }
-
diff --git a/src/test/compile-fail/variance-trait-matching.rs b/src/test/compile-fail/variance-trait-matching.rs
index d4dab5f0ed0..ec020f18818 100644
--- a/src/test/compile-fail/variance-trait-matching.rs
+++ b/src/test/compile-fail/variance-trait-matching.rs
@@ -27,4 +27,3 @@ fn f() -> &'static mut isize {
 }
 
 fn main() {}
-
diff --git a/src/test/compile-fail/vector-cast-weirdness.rs b/src/test/compile-fail/vector-cast-weirdness.rs
index c5109ce473e..97e67cd2eae 100644
--- a/src/test/compile-fail/vector-cast-weirdness.rs
+++ b/src/test/compile-fail/vector-cast-weirdness.rs
@@ -28,4 +28,3 @@ fn main() {
     let t1: *mut [u8; 2] = &mut x1.y as *mut _;
     let h1: *mut [u8; 2] = &mut x1.y as *mut [u8; 2];
 }
-
diff --git a/src/test/compile-fail/walk-struct-literal-with.rs b/src/test/compile-fail/walk-struct-literal-with.rs
index 0f3754e09e4..10503084b9d 100644
--- a/src/test/compile-fail/walk-struct-literal-with.rs
+++ b/src/test/compile-fail/walk-struct-literal-with.rs
@@ -25,4 +25,3 @@ fn main(){
     let end = Mine{other_val:1, ..start.make_string_bar()};
     println!("{}", start.test); //~ ERROR use of moved value: `start.test`
 }
-
diff --git a/src/test/compile-fail/where-clauses-unsatisfied.rs b/src/test/compile-fail/where-clauses-unsatisfied.rs
index 4a4a5f3193d..269df212489 100644
--- a/src/test/compile-fail/where-clauses-unsatisfied.rs
+++ b/src/test/compile-fail/where-clauses-unsatisfied.rs
@@ -17,4 +17,3 @@ fn main() {
     drop(equal(&Struct, &Struct))
     //~^ ERROR the trait `core::cmp::Eq` is not implemented
 }
-
diff --git a/src/test/debuginfo/function-arg-initialization.rs b/src/test/debuginfo/function-arg-initialization.rs
index 9eadf3cc19b..7cefb6044f6 100644
--- a/src/test/debuginfo/function-arg-initialization.rs
+++ b/src/test/debuginfo/function-arg-initialization.rs
@@ -330,6 +330,3 @@ fn main() {
     while_expr(40, 41, 42);
     loop_expr(43, 44, 45);
 }
-
-
-
diff --git a/src/test/debuginfo/generic-method-on-generic-struct.rs b/src/test/debuginfo/generic-method-on-generic-struct.rs
index 8b698d900af..07b6d745544 100644
--- a/src/test/debuginfo/generic-method-on-generic-struct.rs
+++ b/src/test/debuginfo/generic-method-on-generic-struct.rs
@@ -149,4 +149,3 @@ fn main() {
 }
 
 fn zzz() {()}
-
diff --git a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs
index e097ec2adb1..59935e55b33 100644
--- a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs
+++ b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs
@@ -20,4 +20,3 @@ fn main() {
     let _ = ||();
     let _ = (1_usize..3).map(|_| 5);
 }
-
diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs
index e51842992cc..c140390604b 100644
--- a/src/test/debuginfo/limited-debuginfo.rs
+++ b/src/test/debuginfo/limited-debuginfo.rs
@@ -54,4 +54,3 @@ fn some_function(a: int, b: int) {
 }
 
 fn some_other_function(a: int, b: int) -> bool { true }
-
diff --git a/src/test/debuginfo/method-on-enum.rs b/src/test/debuginfo/method-on-enum.rs
index 638d73f0d4e..7172a880f4c 100644
--- a/src/test/debuginfo/method-on-enum.rs
+++ b/src/test/debuginfo/method-on-enum.rs
@@ -151,4 +151,3 @@ fn main() {
 }
 
 fn zzz() {()}
-
diff --git a/src/test/debuginfo/method-on-generic-struct.rs b/src/test/debuginfo/method-on-generic-struct.rs
index 784d60eec9a..bf6635f833f 100644
--- a/src/test/debuginfo/method-on-generic-struct.rs
+++ b/src/test/debuginfo/method-on-generic-struct.rs
@@ -150,4 +150,3 @@ fn main() {
 }
 
 fn zzz() {()}
-
diff --git a/src/test/debuginfo/method-on-struct.rs b/src/test/debuginfo/method-on-struct.rs
index a91586a6aa6..54779e00708 100644
--- a/src/test/debuginfo/method-on-struct.rs
+++ b/src/test/debuginfo/method-on-struct.rs
@@ -150,4 +150,3 @@ fn main() {
 }
 
 fn zzz() {()}
-
diff --git a/src/test/debuginfo/method-on-trait.rs b/src/test/debuginfo/method-on-trait.rs
index e2c827ee517..7954bcae1b2 100644
--- a/src/test/debuginfo/method-on-trait.rs
+++ b/src/test/debuginfo/method-on-trait.rs
@@ -156,4 +156,3 @@ fn main() {
 }
 
 fn zzz() {()}
-
diff --git a/src/test/debuginfo/method-on-tuple-struct.rs b/src/test/debuginfo/method-on-tuple-struct.rs
index e8bc40f1810..af128706650 100644
--- a/src/test/debuginfo/method-on-tuple-struct.rs
+++ b/src/test/debuginfo/method-on-tuple-struct.rs
@@ -148,4 +148,3 @@ fn main() {
 }
 
 fn zzz() {()}
-
diff --git a/src/test/debuginfo/no-debug-attribute.rs b/src/test/debuginfo/no-debug-attribute.rs
index 5b2045d59dc..f39e8ee2229 100644
--- a/src/test/debuginfo/no-debug-attribute.rs
+++ b/src/test/debuginfo/no-debug-attribute.rs
@@ -40,4 +40,3 @@ fn main() {
     function_without_debuginfo();
     function_with_debuginfo();
 }
-
diff --git a/src/test/debuginfo/recursive-struct.rs b/src/test/debuginfo/recursive-struct.rs
index 25afd3514b0..fe262a7ea8d 100644
--- a/src/test/debuginfo/recursive-struct.rs
+++ b/src/test/debuginfo/recursive-struct.rs
@@ -219,4 +219,3 @@ fn main() {
 }
 
 fn zzz() {()}
-
diff --git a/src/test/debuginfo/self-in-default-method.rs b/src/test/debuginfo/self-in-default-method.rs
index 03a79993342..008eeda92d0 100644
--- a/src/test/debuginfo/self-in-default-method.rs
+++ b/src/test/debuginfo/self-in-default-method.rs
@@ -150,4 +150,3 @@ fn main() {
 }
 
 fn zzz() {()}
-
diff --git a/src/test/debuginfo/self-in-generic-default-method.rs b/src/test/debuginfo/self-in-generic-default-method.rs
index 5869625bafe..94e5f6f6c10 100644
--- a/src/test/debuginfo/self-in-generic-default-method.rs
+++ b/src/test/debuginfo/self-in-generic-default-method.rs
@@ -151,4 +151,3 @@ fn main() {
 }
 
 fn zzz() {()}
-
diff --git a/src/test/parse-fail/ascii-only-character-escape.rs b/src/test/parse-fail/ascii-only-character-escape.rs
index 1ba25a827a5..bcfcc434703 100644
--- a/src/test/parse-fail/ascii-only-character-escape.rs
+++ b/src/test/parse-fail/ascii-only-character-escape.rs
@@ -14,4 +14,3 @@ fn main() {
     let z = "\xe2"; //~ ERROR may only be used
     let a = b"\x00e2";  // ok because byte literal
 }
-
diff --git a/src/test/parse-fail/byte-literals.rs b/src/test/parse-fail/byte-literals.rs
index 436078fa762..08935a24a1b 100644
--- a/src/test/parse-fail/byte-literals.rs
+++ b/src/test/parse-fail/byte-literals.rs
@@ -21,5 +21,3 @@ pub fn main() {
     b'é';  //~ ERROR byte constant must be ASCII
     b'a  //~ ERROR unterminated byte constant
 }
-
-
diff --git a/src/test/parse-fail/byte-string-literals.rs b/src/test/parse-fail/byte-string-literals.rs
index ec67cdd77e1..ee3d86a6638 100644
--- a/src/test/parse-fail/byte-string-literals.rs
+++ b/src/test/parse-fail/byte-string-literals.rs
@@ -19,5 +19,3 @@ pub fn main() {
     b"é";  //~ ERROR byte constant must be ASCII
     b"a  //~ ERROR unterminated double quote byte string
 }
-
-
diff --git a/src/test/parse-fail/issue-10392-2.rs b/src/test/parse-fail/issue-10392-2.rs
index b077081c5b0..2a3dd7fba0c 100644
--- a/src/test/parse-fail/issue-10392-2.rs
+++ b/src/test/parse-fail/issue-10392-2.rs
@@ -15,4 +15,3 @@ fn a() -> A { panic!() }
 fn main() {
     let A { .., } = a(); //~ ERROR: expected `}`
 }
-
diff --git a/src/test/parse-fail/issue-17718-const-mut.rs b/src/test/parse-fail/issue-17718-const-mut.rs
index 5177ebbc188..b7feeecbfd9 100644
--- a/src/test/parse-fail/issue-17718-const-mut.rs
+++ b/src/test/parse-fail/issue-17718-const-mut.rs
@@ -15,4 +15,3 @@ FOO: usize = 3;
 
 fn main() {
 }
-
diff --git a/src/test/parse-fail/issue-20711-2.rs b/src/test/parse-fail/issue-20711-2.rs
index a6c4570c60f..a50a757160d 100644
--- a/src/test/parse-fail/issue-20711-2.rs
+++ b/src/test/parse-fail/issue-20711-2.rs
@@ -17,4 +17,3 @@ impl Foo {
 } //~ ERROR expected one of `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}`
 
 fn main() {}
-
diff --git a/src/test/parse-fail/issue-2354-1.rs b/src/test/parse-fail/issue-2354-1.rs
index d37837b9714..48cdeeb0d70 100644
--- a/src/test/parse-fail/issue-2354-1.rs
+++ b/src/test/parse-fail/issue-2354-1.rs
@@ -9,4 +9,3 @@
 // except according to those terms.
 
 static foo: isize = 2; } //~ ERROR incorrect close delimiter:
-
diff --git a/src/test/parse-fail/keywords-followed-by-double-colon.rs b/src/test/parse-fail/keywords-followed-by-double-colon.rs
index f69b041597e..ba04a5ac9af 100644
--- a/src/test/parse-fail/keywords-followed-by-double-colon.rs
+++ b/src/test/parse-fail/keywords-followed-by-double-colon.rs
@@ -12,4 +12,3 @@ fn main() {
     struct::foo();  //~ ERROR expected identifier
     mut::baz(); //~ ERROR expected identifier
 }
-
diff --git a/src/test/parse-fail/macro-attribute.rs b/src/test/parse-fail/macro-attribute.rs
index 77ea0c9c4f3..52f867fe913 100644
--- a/src/test/parse-fail/macro-attribute.rs
+++ b/src/test/parse-fail/macro-attribute.rs
@@ -10,4 +10,3 @@
 
 #[doc = $not_there] //~ error: unexpected token: `$`
 fn main() { }
-
diff --git a/src/test/parse-fail/macros-no-semicolon.rs b/src/test/parse-fail/macros-no-semicolon.rs
index 0e85551e216..23b27b49a86 100644
--- a/src/test/parse-fail/macros-no-semicolon.rs
+++ b/src/test/parse-fail/macros-no-semicolon.rs
@@ -13,4 +13,3 @@ fn main() {
     assert!(3 == 4) //~ ERROR expected one of `.`, `;`, `}`, or an operator, found `assert`
     println!("hello");
 }
-
diff --git a/src/test/parse-fail/obsolete-proc.rs b/src/test/parse-fail/obsolete-proc.rs
index f1ed0be7640..4767c66c2a0 100644
--- a/src/test/parse-fail/obsolete-proc.rs
+++ b/src/test/parse-fail/obsolete-proc.rs
@@ -14,4 +14,4 @@ fn foo(p: proc()) { } //~ ERROR `proc` is a reserved keyword
 
 fn bar() { proc() 1; }
 
-fn main() { }
\ No newline at end of file
+fn main() { }
diff --git a/src/test/parse-fail/raw-byte-string-eof.rs b/src/test/parse-fail/raw-byte-string-eof.rs
index 83ea9db39b7..ccf9e2d8688 100644
--- a/src/test/parse-fail/raw-byte-string-eof.rs
+++ b/src/test/parse-fail/raw-byte-string-eof.rs
@@ -12,5 +12,3 @@
 pub fn main() {
     br##"a"#;  //~ unterminated raw string
 }
-
-
diff --git a/src/test/parse-fail/raw-byte-string-literals.rs b/src/test/parse-fail/raw-byte-string-literals.rs
index 7a3d1b2318a..d6073a10307 100644
--- a/src/test/parse-fail/raw-byte-string-literals.rs
+++ b/src/test/parse-fail/raw-byte-string-literals.rs
@@ -13,5 +13,3 @@ pub fn main() {
     br"é";  //~ raw byte string must be ASCII
     br##~"a"~##;  //~ only `#` is allowed in raw string delimitation
 }
-
-
diff --git a/src/test/parse-fail/struct-literal-in-for.rs b/src/test/parse-fail/struct-literal-in-for.rs
index 4bb5d5e6aa1..a6d4da526fb 100644
--- a/src/test/parse-fail/struct-literal-in-for.rs
+++ b/src/test/parse-fail/struct-literal-in-for.rs
@@ -25,4 +25,3 @@ fn main() {
         println!("yo");
     }
 }
-
diff --git a/src/test/parse-fail/struct-literal-in-if.rs b/src/test/parse-fail/struct-literal-in-if.rs
index b2bc8a4901f..00ece3fcca3 100644
--- a/src/test/parse-fail/struct-literal-in-if.rs
+++ b/src/test/parse-fail/struct-literal-in-if.rs
@@ -25,4 +25,3 @@ fn main() {
         println!("yo");
     }
 }
-
diff --git a/src/test/parse-fail/struct-literal-in-match-discriminant.rs b/src/test/parse-fail/struct-literal-in-match-discriminant.rs
index e6948b7c7c9..cdcf98a42f9 100644
--- a/src/test/parse-fail/struct-literal-in-match-discriminant.rs
+++ b/src/test/parse-fail/struct-literal-in-match-discriminant.rs
@@ -21,4 +21,3 @@ fn main() {
         } => {}
     }
 }
-
diff --git a/src/test/parse-fail/struct-literal-in-while.rs b/src/test/parse-fail/struct-literal-in-while.rs
index 05fa3a8dd5f..c23b5dbb9cc 100644
--- a/src/test/parse-fail/struct-literal-in-while.rs
+++ b/src/test/parse-fail/struct-literal-in-while.rs
@@ -25,4 +25,3 @@ fn main() {
         println!("yo");
     }
 }
-
diff --git a/src/test/parse-fail/type-parameters-in-field-exprs.rs b/src/test/parse-fail/type-parameters-in-field-exprs.rs
index 54ddb3e19fa..191bd782124 100644
--- a/src/test/parse-fail/type-parameters-in-field-exprs.rs
+++ b/src/test/parse-fail/type-parameters-in-field-exprs.rs
@@ -21,4 +21,3 @@ fn main() {
     f.x::<isize>;
     //~^ ERROR field expressions may not have type parameters
 }
-
diff --git a/src/test/parse-fail/unboxed-closure-sugar-used-on-struct-3.rs b/src/test/parse-fail/unboxed-closure-sugar-used-on-struct-3.rs
index d86f55d5368..de6291c7cc3 100644
--- a/src/test/parse-fail/unboxed-closure-sugar-used-on-struct-3.rs
+++ b/src/test/parse-fail/unboxed-closure-sugar-used-on-struct-3.rs
@@ -26,4 +26,3 @@ fn bar() {
 }
 
 fn main() { }
-
diff --git a/src/test/parse-fail/use-mod-4.rs b/src/test/parse-fail/use-mod-4.rs
index a8b551b5376..52d0d1a5fba 100644
--- a/src/test/parse-fail/use-mod-4.rs
+++ b/src/test/parse-fail/use-mod-4.rs
@@ -12,4 +12,3 @@ use foo::self;
 //~^ ERROR expected identifier, found keyword `self`
 
 fn main() {}
-
diff --git a/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs b/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs
index b96c7c2de6b..ebdbdc4b2b5 100644
--- a/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs
+++ b/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs
@@ -20,4 +20,3 @@ fn equal2<T>(_: &T, _: &T) -> bool where T: {
 
 fn main() {
 }
-
diff --git a/src/test/pretty/asm-clobbers.rs b/src/test/pretty/asm-clobbers.rs
index 20a3ac226bd..c72add8d3d6 100644
--- a/src/test/pretty/asm-clobbers.rs
+++ b/src/test/pretty/asm-clobbers.rs
@@ -11,4 +11,3 @@
 #![feature(asm)]
 
 pub fn main() { unsafe { asm!("" : : : "hello", "world") }; }
-
diff --git a/src/test/pretty/closure-reform-pretty.rs b/src/test/pretty/closure-reform-pretty.rs
index 094e3ce9156..33a80f46946 100644
--- a/src/test/pretty/closure-reform-pretty.rs
+++ b/src/test/pretty/closure-reform-pretty.rs
@@ -24,4 +24,3 @@ fn call_extern(f: fn() -> int) { }
 fn call_abid_extern(f: extern "C" fn() -> int) { }
 
 pub fn main() { }
-
diff --git a/src/test/pretty/path-type-bounds.rs b/src/test/pretty/path-type-bounds.rs
index 9e1f2aa8bfe..0a20300e4f4 100644
--- a/src/test/pretty/path-type-bounds.rs
+++ b/src/test/pretty/path-type-bounds.rs
@@ -23,4 +23,3 @@ fn main() {
 
     Box::new(1) as Box<Tr+ Sync>;
 }
-
diff --git a/src/test/pretty/where-clauses.rs b/src/test/pretty/where-clauses.rs
index 0f3b914334e..ad582ac1b62 100644
--- a/src/test/pretty/where-clauses.rs
+++ b/src/test/pretty/where-clauses.rs
@@ -13,4 +13,3 @@
 fn f<'a, 'b, T>(t: T) -> int where T: 'a, 'a:'b, T: Eq { 0 }
 
 fn main() { }
-
diff --git a/src/test/run-make/allow-non-lint-warnings-cmdline/Makefile b/src/test/run-make/allow-non-lint-warnings-cmdline/Makefile
index 961342591aa..c14006cc2e0 100644
--- a/src/test/run-make/allow-non-lint-warnings-cmdline/Makefile
+++ b/src/test/run-make/allow-non-lint-warnings-cmdline/Makefile
@@ -9,4 +9,3 @@ all: foo
 # This is just to make sure the above command actually succeeds
 foo:
 	$(RUSTC) foo.rs -A warnings
-
diff --git a/src/test/run-make/allow-warnings-cmdline-stability/Makefile b/src/test/run-make/allow-warnings-cmdline-stability/Makefile
index 64b7f58caea..3eecaf93142 100644
--- a/src/test/run-make/allow-warnings-cmdline-stability/Makefile
+++ b/src/test/run-make/allow-warnings-cmdline-stability/Makefile
@@ -13,7 +13,3 @@ bar:
 
 foo: bar
 	$(RUSTC) foo.rs -A warnings
-
-
-
-
diff --git a/src/test/run-make/compiler-lookup-paths/c.rs b/src/test/run-make/compiler-lookup-paths/c.rs
index 8a801d589fb..b5c54558a4f 100644
--- a/src/test/run-make/compiler-lookup-paths/c.rs
+++ b/src/test/run-make/compiler-lookup-paths/c.rs
@@ -10,4 +10,3 @@
 
 #![crate_type = "lib"]
 extern crate b;
-
diff --git a/src/test/run-make/crate-name-priority/foo1.rs b/src/test/run-make/crate-name-priority/foo1.rs
index 0f02f100572..a397d6bc749 100644
--- a/src/test/run-make/crate-name-priority/foo1.rs
+++ b/src/test/run-make/crate-name-priority/foo1.rs
@@ -11,4 +11,3 @@
 #![crate_name = "foo"]
 
 fn main() {}
-
diff --git a/src/test/run-make/extern-flag-disambiguates/Makefile b/src/test/run-make/extern-flag-disambiguates/Makefile
index 049b76c1b64..81930e969a9 100644
--- a/src/test/run-make/extern-flag-disambiguates/Makefile
+++ b/src/test/run-make/extern-flag-disambiguates/Makefile
@@ -23,4 +23,3 @@ all:
 	@echo after
 	$(RUSTC) --cfg after  d.rs --extern a=$(TMPDIR)/liba-1.rlib
 	$(call RUN,d)
-
diff --git a/src/test/run-make/extern-flag-fun/bar.rs b/src/test/run-make/extern-flag-fun/bar.rs
index 2152aa79c33..e6c76025738 100644
--- a/src/test/run-make/extern-flag-fun/bar.rs
+++ b/src/test/run-make/extern-flag-fun/bar.rs
@@ -7,4 +7,3 @@
 // <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.
-
diff --git a/src/test/run-make/extern-overrides-distribution/main.rs b/src/test/run-make/extern-overrides-distribution/main.rs
index 92b353c892a..451841e7368 100644
--- a/src/test/run-make/extern-overrides-distribution/main.rs
+++ b/src/test/run-make/extern-overrides-distribution/main.rs
@@ -13,4 +13,3 @@ extern crate libc;
 fn main() {
     libc::foo();
 }
-
diff --git a/src/test/run-make/interdependent-c-libraries/Makefile b/src/test/run-make/interdependent-c-libraries/Makefile
index 7654917b462..cf7683479f0 100644
--- a/src/test/run-make/interdependent-c-libraries/Makefile
+++ b/src/test/run-make/interdependent-c-libraries/Makefile
@@ -12,4 +12,3 @@ all: $(call STATICLIB,foo) $(call STATICLIB,bar)
 	$(RUSTC) foo.rs
 	$(RUSTC) bar.rs
 	$(RUSTC) main.rs -Z print-link-args
-
diff --git a/src/test/run-make/interdependent-c-libraries/bar.rs b/src/test/run-make/interdependent-c-libraries/bar.rs
index 5311af2959b..88fc98615f0 100644
--- a/src/test/run-make/interdependent-c-libraries/bar.rs
+++ b/src/test/run-make/interdependent-c-libraries/bar.rs
@@ -20,4 +20,3 @@ extern {
 pub fn doit() {
     unsafe { bar(); }
 }
-
diff --git a/src/test/run-make/issue-14500/Makefile b/src/test/run-make/issue-14500/Makefile
index 446c6e5c81b..c19d3d5c30f 100644
--- a/src/test/run-make/issue-14500/Makefile
+++ b/src/test/run-make/issue-14500/Makefile
@@ -11,4 +11,3 @@ all:
 	$(RUSTC) bar.rs --crate-type=staticlib -C lto -L. -o $(TMPDIR)/libbar.a
 	$(CC) foo.c -lbar -o $(call RUN_BINFILE,foo) $(EXTRACFLAGS)
 	$(call RUN,foo)
-
diff --git a/src/test/run-make/libs-and-bins/Makefile b/src/test/run-make/libs-and-bins/Makefile
index 4d975d2f717..cc3b257a5c5 100644
--- a/src/test/run-make/libs-and-bins/Makefile
+++ b/src/test/run-make/libs-and-bins/Makefile
@@ -4,4 +4,3 @@ all:
 	$(RUSTC) foo.rs
 	$(call RUN,foo)
 	rm $(TMPDIR)/$(call DYLIB_GLOB,foo)
-
diff --git a/src/test/run-make/link-path-order/Makefile b/src/test/run-make/link-path-order/Makefile
index b8ebe6db6fd..116c7ae991c 100644
--- a/src/test/run-make/link-path-order/Makefile
+++ b/src/test/run-make/link-path-order/Makefile
@@ -14,4 +14,3 @@ all: $(TMPDIR)/libcorrect.a $(TMPDIR)/libwrong.a
 	$(call RUN,should_succeed)
 	$(RUSTC) main.rs -o $(TMPDIR)/should_fail -L $(WRONG_DIR) -L $(CORRECT_DIR)
 	$(call FAIL,should_fail)
-
diff --git a/src/test/run-make/linkage-attr-on-static/Makefile b/src/test/run-make/linkage-attr-on-static/Makefile
index 6bcde96335c..1871a5bbdc7 100644
--- a/src/test/run-make/linkage-attr-on-static/Makefile
+++ b/src/test/run-make/linkage-attr-on-static/Makefile
@@ -5,4 +5,3 @@ all:
 	$(AR) rcs $(TMPDIR)/libfoo.a $(TMPDIR)/foo.o
 	$(RUSTC) bar.rs -lfoo -L $(TMPDIR)
 	$(call RUN,bar) || exit 1
-
diff --git a/src/test/run-make/manual-link/Makefile b/src/test/run-make/manual-link/Makefile
index d0536956152..dccf0d99b0f 100644
--- a/src/test/run-make/manual-link/Makefile
+++ b/src/test/run-make/manual-link/Makefile
@@ -4,4 +4,3 @@ all: $(TMPDIR)/libbar.a
 	$(RUSTC) foo.rs -lstatic=bar
 	$(RUSTC) main.rs
 	$(call RUN,main)
-
diff --git a/src/test/run-make/many-crates-but-no-match/Makefile b/src/test/run-make/many-crates-but-no-match/Makefile
index da5fc78f328..edf8e9df465 100644
--- a/src/test/run-make/many-crates-but-no-match/Makefile
+++ b/src/test/run-make/many-crates-but-no-match/Makefile
@@ -16,7 +16,7 @@ A3=$(TMPDIR)/a3
 # A hack to match distinct lines of output from a single run.
 LOG=$(TMPDIR)/log.txt
 
-all: 
+all:
 	mkdir -p $(A1) $(A2) $(A3)
 	$(RUSTC) --crate-type=rlib crateA1.rs
 	mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A1)
diff --git a/src/test/run-make/missing-crate-dependency/Makefile b/src/test/run-make/missing-crate-dependency/Makefile
index 3f8b97f2566..275658047d3 100644
--- a/src/test/run-make/missing-crate-dependency/Makefile
+++ b/src/test/run-make/missing-crate-dependency/Makefile
@@ -1,6 +1,6 @@
 -include ../tools.mk
 
-all: 
+all:
 	$(RUSTC) --crate-type=rlib crateA.rs
 	$(RUSTC) --crate-type=rlib crateB.rs
 	$(call REMOVE_RLIBS,crateA)
diff --git a/src/test/run-make/mixing-formats/baz2.rs b/src/test/run-make/mixing-formats/baz2.rs
index 4cfa65330bd..c5066ccd656 100644
--- a/src/test/run-make/mixing-formats/baz2.rs
+++ b/src/test/run-make/mixing-formats/baz2.rs
@@ -12,4 +12,3 @@ extern crate bar1;
 extern crate bar2;
 
 fn main() {}
-
diff --git a/src/test/run-make/obey-crate-type-flag/test.rs b/src/test/run-make/obey-crate-type-flag/test.rs
index 8eb82b48eac..e6c8b8eb179 100644
--- a/src/test/run-make/obey-crate-type-flag/test.rs
+++ b/src/test/run-make/obey-crate-type-flag/test.rs
@@ -10,4 +10,3 @@
 
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
-
diff --git a/src/test/run-make/rustdoc-default-impl/bar.rs b/src/test/run-make/rustdoc-default-impl/bar.rs
index c9fae80d858..60a2f7202f8 100644
--- a/src/test/run-make/rustdoc-default-impl/bar.rs
+++ b/src/test/run-make/rustdoc-default-impl/bar.rs
@@ -14,4 +14,3 @@ pub use foo::bar;
 
 pub fn wut<T: bar::Bar>() {
 }
-
diff --git a/src/test/run-make/rustdoc-extern-method/Makefile b/src/test/run-make/rustdoc-extern-method/Makefile
index c87684f59ea..55cbd2da6ae 100644
--- a/src/test/run-make/rustdoc-extern-method/Makefile
+++ b/src/test/run-make/rustdoc-extern-method/Makefile
@@ -5,4 +5,3 @@ all: foo.rs bar.rs
 	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
 	$(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc bar.rs
 	$(HTMLDOCCK) $(TMPDIR)/doc bar.rs
-
diff --git a/src/test/run-make/rustdoc-negative-impl/Makefile b/src/test/run-make/rustdoc-negative-impl/Makefile
index 1316ee256e1..c1b1683efdb 100644
--- a/src/test/run-make/rustdoc-negative-impl/Makefile
+++ b/src/test/run-make/rustdoc-negative-impl/Makefile
@@ -3,4 +3,3 @@
 all: foo.rs
 	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
 	$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
-
diff --git a/src/test/run-make/rustdoc-recursion/Makefile b/src/test/run-make/rustdoc-recursion/Makefile
index b7fc6d6c0ad..ba971836e5a 100644
--- a/src/test/run-make/rustdoc-recursion/Makefile
+++ b/src/test/run-make/rustdoc-recursion/Makefile
@@ -9,4 +9,3 @@ all:
 else
 all:
 endif
-
diff --git a/src/test/run-make/rustdoc-recursion/foo.rs b/src/test/run-make/rustdoc-recursion/foo.rs
index 29a909f139e..7505d20566d 100644
--- a/src/test/run-make/rustdoc-recursion/foo.rs
+++ b/src/test/run-make/rustdoc-recursion/foo.rs
@@ -22,4 +22,3 @@ mod m {
         pub use super::*;
     }
 }
-
diff --git a/src/test/run-make/rustdoc-viewpath-self/Makefile b/src/test/run-make/rustdoc-viewpath-self/Makefile
index 1316ee256e1..c1b1683efdb 100644
--- a/src/test/run-make/rustdoc-viewpath-self/Makefile
+++ b/src/test/run-make/rustdoc-viewpath-self/Makefile
@@ -3,4 +3,3 @@
 all: foo.rs
 	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
 	$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
-
diff --git a/src/test/run-make/rustdoc-where/Makefile b/src/test/run-make/rustdoc-where/Makefile
index 1316ee256e1..c1b1683efdb 100644
--- a/src/test/run-make/rustdoc-where/Makefile
+++ b/src/test/run-make/rustdoc-where/Makefile
@@ -3,4 +3,3 @@
 all: foo.rs
 	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
 	$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
-
diff --git a/src/test/run-make/tools.mk b/src/test/run-make/tools.mk
index 23c422bc7a7..7b604bedfd0 100644
--- a/src/test/run-make/tools.mk
+++ b/src/test/run-make/tools.mk
@@ -83,4 +83,3 @@ REMOVE_RLIBS      = rm $(TMPDIR)/$(call RLIB_GLOB,$(1))
 
 $(TMPDIR)/lib%.o: %.c
 	$(CC) -c -o $@ $<
-
diff --git a/src/test/run-pass-fulldeps/compiler-calls.rs b/src/test/run-pass-fulldeps/compiler-calls.rs
index 75a968c3f81..8492424a145 100644
--- a/src/test/run-pass-fulldeps/compiler-calls.rs
+++ b/src/test/run-pass-fulldeps/compiler-calls.rs
@@ -80,4 +80,3 @@ fn main() {
     rustc_driver::run_compiler(args.as_slice(), &mut tc);
     assert!(tc.count == 30);
 }
-
diff --git a/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs b/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs
index aecec44f6fd..0bbb9ed1285 100644
--- a/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs
+++ b/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs
@@ -36,4 +36,3 @@ pub fn main() {
         assert!(DROP_RAN);
     }
 }
-
diff --git a/src/test/run-pass/as-precedence.rs b/src/test/run-pass/as-precedence.rs
index 0760f13200c..de294f88a4c 100644
--- a/src/test/run-pass/as-precedence.rs
+++ b/src/test/run-pass/as-precedence.rs
@@ -15,4 +15,3 @@ fn main() {
     assert_eq!(3 as uint + 3, 6);
     assert_eq!(3 as (uint) + 3, 6);
 }
-
diff --git a/src/test/run-pass/backtrace-debuginfo-aux.rs b/src/test/run-pass/backtrace-debuginfo-aux.rs
index 074ee97c37a..f0d36ea976e 100644
--- a/src/test/run-pass/backtrace-debuginfo-aux.rs
+++ b/src/test/run-pass/backtrace-debuginfo-aux.rs
@@ -19,4 +19,3 @@ pub fn callback<F>(f: F) where F: FnOnce((&'static str, u32)) {
 pub fn callback_inlined<F>(f: F) where F: FnOnce((&'static str, u32)) {
     f((file!(), line!()))
 }
-
diff --git a/src/test/run-pass/backtrace-debuginfo.rs b/src/test/run-pass/backtrace-debuginfo.rs
index 23aadbc7053..088fa19356c 100644
--- a/src/test/run-pass/backtrace-debuginfo.rs
+++ b/src/test/run-pass/backtrace-debuginfo.rs
@@ -157,4 +157,3 @@ fn main() {
         run_test(&args[0]);
     }
 }
-
diff --git a/src/test/run-pass/bare-fn-implements-fn-mut.rs b/src/test/run-pass/bare-fn-implements-fn-mut.rs
index 758776298e1..e8118e90a9f 100644
--- a/src/test/run-pass/bare-fn-implements-fn-mut.rs
+++ b/src/test/run-pass/bare-fn-implements-fn-mut.rs
@@ -35,4 +35,3 @@ fn main() {
     assert_eq!(call_g(g, "foo".to_string(), "bar".to_string()),
                "foobar");
 }
-
diff --git a/src/test/run-pass/bitv-perf-test.rs b/src/test/run-pass/bitv-perf-test.rs
index 24bfbd9eb44..e6982949501 100644
--- a/src/test/run-pass/bitv-perf-test.rs
+++ b/src/test/run-pass/bitv-perf-test.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/borrowck-field-sensitivity.rs b/src/test/run-pass/borrowck-field-sensitivity.rs
index 89d80190042..533445052ae 100644
--- a/src/test/run-pass/borrowck-field-sensitivity.rs
+++ b/src/test/run-pass/borrowck-field-sensitivity.rs
@@ -270,4 +270,3 @@ fn main() {
     borrow_after_assign_after_uninit();
     move_after_assign_after_uninit();
 }
-
diff --git a/src/test/run-pass/borrowck-move-by-capture-ok.rs b/src/test/run-pass/borrowck-move-by-capture-ok.rs
index 27fbfc96410..269063bbd05 100644
--- a/src/test/run-pass/borrowck-move-by-capture-ok.rs
+++ b/src/test/run-pass/borrowck-move-by-capture-ok.rs
@@ -17,4 +17,3 @@ pub fn main() {
     let h = || -> int *bar;
     assert_eq!(h(), 3);
 }
-
diff --git a/src/test/run-pass/borrowck-use-mut-borrow.rs b/src/test/run-pass/borrowck-use-mut-borrow.rs
index 7be12ff3cc9..4b69e554cda 100644
--- a/src/test/run-pass/borrowck-use-mut-borrow.rs
+++ b/src/test/run-pass/borrowck-use-mut-borrow.rs
@@ -57,4 +57,3 @@ fn main() {
     field_move_after_field_borrow();
     fu_field_move_after_field_borrow();
 }
-
diff --git a/src/test/run-pass/can-copy-pod.rs b/src/test/run-pass/can-copy-pod.rs
index 099374b5937..9c8bc5411ef 100644
--- a/src/test/run-pass/can-copy-pod.rs
+++ b/src/test/run-pass/can-copy-pod.rs
@@ -21,5 +21,3 @@ fn can_copy_copy<T:Copy>(v: T) {
 }
 
 pub fn main() {}
-
-
diff --git a/src/test/run-pass/capture-clauses-boxed-closures.rs b/src/test/run-pass/capture-clauses-boxed-closures.rs
index 1a85797fa6d..6518df11517 100644
--- a/src/test/run-pass/capture-clauses-boxed-closures.rs
+++ b/src/test/run-pass/capture-clauses-boxed-closures.rs
@@ -20,4 +20,3 @@ fn main() {
     each(&elems, |val| sum += *val);
     assert_eq!(sum, 15);
 }
-
diff --git a/src/test/run-pass/class-exports.rs b/src/test/run-pass/class-exports.rs
index 1cf4c35ee96..a3f857ab4b0 100644
--- a/src/test/run-pass/class-exports.rs
+++ b/src/test/run-pass/class-exports.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/cleanup-arm-conditional.rs b/src/test/run-pass/cleanup-arm-conditional.rs
index 0d155ae085c..cb152f1c64e 100644
--- a/src/test/run-pass/cleanup-arm-conditional.rs
+++ b/src/test/run-pass/cleanup-arm-conditional.rs
@@ -52,4 +52,3 @@ pub fn main() {
     let t = Test { x: 1 };
     do_something(&t);
 }
-
diff --git a/src/test/run-pass/cleanup-shortcircuit.rs b/src/test/run-pass/cleanup-shortcircuit.rs
index 59f63a79c3d..4466dda6c69 100644
--- a/src/test/run-pass/cleanup-shortcircuit.rs
+++ b/src/test/run-pass/cleanup-shortcircuit.rs
@@ -36,4 +36,3 @@ pub fn main() {
         unsafe { *(0 as *mut int) = 0; }
     }
 }
-
diff --git a/src/test/run-pass/closure-reform.rs b/src/test/run-pass/closure-reform.rs
index a4495c3c68e..af64553b913 100644
--- a/src/test/run-pass/closure-reform.rs
+++ b/src/test/run-pass/closure-reform.rs
@@ -66,4 +66,3 @@ pub fn main() {
 
     call_bare_again(println);
 }
-
diff --git a/src/test/run-pass/conditional-compile.rs b/src/test/run-pass/conditional-compile.rs
index 178fc3dcd4f..f77be4d9c06 100644
--- a/src/test/run-pass/conditional-compile.rs
+++ b/src/test/run-pass/conditional-compile.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/deriving-meta-multiple.rs b/src/test/run-pass/deriving-meta-multiple.rs
index 62ec2f8e590..3164021a72e 100644
--- a/src/test/run-pass/deriving-meta-multiple.rs
+++ b/src/test/run-pass/deriving-meta-multiple.rs
@@ -1,4 +1,3 @@
-
 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
diff --git a/src/test/run-pass/deriving-meta.rs b/src/test/run-pass/deriving-meta.rs
index 82cf9db3232..16df6e7004f 100644
--- a/src/test/run-pass/deriving-meta.rs
+++ b/src/test/run-pass/deriving-meta.rs
@@ -1,4 +1,3 @@
-
 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
diff --git a/src/test/run-pass/deriving-via-extension-hash-enum.rs b/src/test/run-pass/deriving-via-extension-hash-enum.rs
index 10bd1b29444..2d6997341fb 100644
--- a/src/test/run-pass/deriving-via-extension-hash-enum.rs
+++ b/src/test/run-pass/deriving-via-extension-hash-enum.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/deriving-via-extension-hash-struct.rs b/src/test/run-pass/deriving-via-extension-hash-struct.rs
index 19809def9a1..448d5bfd4cb 100644
--- a/src/test/run-pass/deriving-via-extension-hash-struct.rs
+++ b/src/test/run-pass/deriving-via-extension-hash-struct.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/deriving-via-extension-type-params.rs b/src/test/run-pass/deriving-via-extension-type-params.rs
index 890b4e69783..1a31743b4c0 100644
--- a/src/test/run-pass/deriving-via-extension-type-params.rs
+++ b/src/test/run-pass/deriving-via-extension-type-params.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/drop-with-type-ascription-1.rs b/src/test/run-pass/drop-with-type-ascription-1.rs
index f9fcf8ced28..4f1fc91a53c 100644
--- a/src/test/run-pass/drop-with-type-ascription-1.rs
+++ b/src/test/run-pass/drop-with-type-ascription-1.rs
@@ -14,4 +14,3 @@ fn main() {
     let invalid_string = &foo[0];
     assert_eq!(*invalid_string, "hello");
 }
-
diff --git a/src/test/run-pass/drop-with-type-ascription-2.rs b/src/test/run-pass/drop-with-type-ascription-2.rs
index f3d79f0c7d5..ec8de2a709e 100644
--- a/src/test/run-pass/drop-with-type-ascription-2.rs
+++ b/src/test/run-pass/drop-with-type-ascription-2.rs
@@ -14,4 +14,3 @@ fn main() {
     assert_eq!(arr[0], "asdf");
     assert_eq!(arr[0], "asdf");
 }
-
diff --git a/src/test/run-pass/duplicated-external-mods.rs b/src/test/run-pass/duplicated-external-mods.rs
index 65e2b178abf..f7b1cef83ea 100644
--- a/src/test/run-pass/duplicated-external-mods.rs
+++ b/src/test/run-pass/duplicated-external-mods.rs
@@ -13,4 +13,3 @@
 extern crate anonexternmod;
 
 pub fn main() { }
-
diff --git a/src/test/run-pass/export-multi.rs b/src/test/run-pass/export-multi.rs
index 2e44bf5be5b..09e816cff0b 100644
--- a/src/test/run-pass/export-multi.rs
+++ b/src/test/run-pass/export-multi.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/export-non-interference3.rs b/src/test/run-pass/export-non-interference3.rs
index 091c389840a..b7ef4df7ed6 100644
--- a/src/test/run-pass/export-non-interference3.rs
+++ b/src/test/run-pass/export-non-interference3.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/extern-compare-with-return-type.rs b/src/test/run-pass/extern-compare-with-return-type.rs
index 3febff18704..612b6ee14e1 100644
--- a/src/test/run-pass/extern-compare-with-return-type.rs
+++ b/src/test/run-pass/extern-compare-with-return-type.rs
@@ -31,4 +31,3 @@ pub fn main() {
     assert!(uintuintuintuintret as uintuintuintuintret ==
             uintuintuintuintret as uintuintuintuintret);
 }
-
diff --git a/src/test/run-pass/extern-mod-syntax.rs b/src/test/run-pass/extern-mod-syntax.rs
index 3e430b6e728..4d4f5036fc1 100644
--- a/src/test/run-pass/extern-mod-syntax.rs
+++ b/src/test/run-pass/extern-mod-syntax.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/for-loop-goofiness.rs b/src/test/run-pass/for-loop-goofiness.rs
index 7754751120e..84218befcd8 100644
--- a/src/test/run-pass/for-loop-goofiness.rs
+++ b/src/test/run-pass/for-loop-goofiness.rs
@@ -21,4 +21,3 @@ pub fn main() {
         assert_eq!(*i, 3);
     }
 }
-
diff --git a/src/test/run-pass/format-nan.rs b/src/test/run-pass/format-nan.rs
index 1024bc21d2b..9670d2de3ef 100644
--- a/src/test/run-pass/format-nan.rs
+++ b/src/test/run-pass/format-nan.rs
@@ -15,4 +15,3 @@ pub fn main() {
     assert_eq!(format!("{:e}", f64::NAN), x);
     assert_eq!(format!("{:E}", f64::NAN), x);
 }
-
diff --git a/src/test/run-pass/import-from.rs b/src/test/run-pass/import-from.rs
index bbf914411fd..38602bef229 100644
--- a/src/test/run-pass/import-from.rs
+++ b/src/test/run-pass/import-from.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/import-trailing-comma.rs b/src/test/run-pass/import-trailing-comma.rs
index 42a90b3e39a..b46f81479bf 100644
--- a/src/test/run-pass/import-trailing-comma.rs
+++ b/src/test/run-pass/import-trailing-comma.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/import2.rs b/src/test/run-pass/import2.rs
index d684c30aca1..4086acc0a8e 100644
--- a/src/test/run-pass/import2.rs
+++ b/src/test/run-pass/import2.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/import3.rs b/src/test/run-pass/import3.rs
index 4a3358488d8..2c09eff7b12 100644
--- a/src/test/run-pass/import3.rs
+++ b/src/test/run-pass/import3.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/import4.rs b/src/test/run-pass/import4.rs
index 44f6b6140fb..229813ff55c 100644
--- a/src/test/run-pass/import4.rs
+++ b/src/test/run-pass/import4.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/import5.rs b/src/test/run-pass/import5.rs
index 18cc1aa0848..0cad094d55d 100644
--- a/src/test/run-pass/import5.rs
+++ b/src/test/run-pass/import5.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/import6.rs b/src/test/run-pass/import6.rs
index 802dfc1f2ed..545bd7cee5e 100644
--- a/src/test/run-pass/import6.rs
+++ b/src/test/run-pass/import6.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/import7.rs b/src/test/run-pass/import7.rs
index 15e935c8f4f..4b9d1328951 100644
--- a/src/test/run-pass/import7.rs
+++ b/src/test/run-pass/import7.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/import8.rs b/src/test/run-pass/import8.rs
index 119107404d7..532c3843284 100644
--- a/src/test/run-pass/import8.rs
+++ b/src/test/run-pass/import8.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/inherent-trait-method-order.rs b/src/test/run-pass/inherent-trait-method-order.rs
index 6643636c570..9674c86b379 100644
--- a/src/test/run-pass/inherent-trait-method-order.rs
+++ b/src/test/run-pass/inherent-trait-method-order.rs
@@ -31,4 +31,3 @@ fn main() {
     let x = &(&(&Foo));
     x.foo();
 }
-
diff --git a/src/test/run-pass/integer-literal-suffix-inference-2.rs b/src/test/run-pass/integer-literal-suffix-inference-2.rs
index 05973a545a2..77e7ee62643 100644
--- a/src/test/run-pass/integer-literal-suffix-inference-2.rs
+++ b/src/test/run-pass/integer-literal-suffix-inference-2.rs
@@ -14,4 +14,3 @@ fn main() {
     let a = 3;
     foo(&a as *const _ as *const ());
 }
-
diff --git a/src/test/run-pass/integer-literal-suffix-inference-3.rs b/src/test/run-pass/integer-literal-suffix-inference-3.rs
index 05b275a0d8c..31aca964def 100644
--- a/src/test/run-pass/integer-literal-suffix-inference-3.rs
+++ b/src/test/run-pass/integer-literal-suffix-inference-3.rs
@@ -11,4 +11,3 @@
 fn main() {
     println!("{}", std::mem::size_of_val(&1));
 }
-
diff --git a/src/test/run-pass/intrinsic-assume.rs b/src/test/run-pass/intrinsic-assume.rs
index abf9b94c59d..837c2d21513 100644
--- a/src/test/run-pass/intrinsic-assume.rs
+++ b/src/test/run-pass/intrinsic-assume.rs
@@ -22,4 +22,3 @@ fn main() {
     let x = unsafe { f(34) };
     assert_eq!(x, 42);
 }
-
diff --git a/src/test/run-pass/intrinsic-return-address.rs b/src/test/run-pass/intrinsic-return-address.rs
index 91af669340d..99578abed38 100644
--- a/src/test/run-pass/intrinsic-return-address.rs
+++ b/src/test/run-pass/intrinsic-return-address.rs
@@ -40,4 +40,3 @@ fn main() {
     let actual_address = &pt as *const Point as uint;
     assert_eq!(intrinsic_reported_address, actual_address);
 }
-
diff --git a/src/test/run-pass/intrinsics-math.rs b/src/test/run-pass/intrinsics-math.rs
index ab65f35dd34..028b2bfb0ec 100644
--- a/src/test/run-pass/intrinsics-math.rs
+++ b/src/test/run-pass/intrinsics-math.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/issue-11736.rs b/src/test/run-pass/issue-11736.rs
index b09d516dd35..c6e0a5be763 100644
--- a/src/test/run-pass/issue-11736.rs
+++ b/src/test/run-pass/issue-11736.rs
@@ -32,4 +32,3 @@ fn main() {
         }
     }
 }
-
diff --git a/src/test/run-pass/issue-11820.rs b/src/test/run-pass/issue-11820.rs
new file mode 100644
index 00000000000..f7aaf495377
--- /dev/null
+++ b/src/test/run-pass/issue-11820.rs
@@ -0,0 +1,19 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct NoClone;
+
+fn main() {
+  let rnc = &NoClone;
+  let rsnc = &Some(NoClone);
+
+  let _: &NoClone = rnc.clone();
+  let _: &Option<NoClone> = rsnc.clone();
+}
diff --git a/src/test/run-pass/issue-12729.rs b/src/test/run-pass/issue-12729.rs
index 09c0c8604ad..9bf4c94d7e3 100644
--- a/src/test/run-pass/issue-12729.rs
+++ b/src/test/run-pass/issue-12729.rs
@@ -18,4 +18,3 @@ mod bar {
     }
 }
 fn main() {}
-
diff --git a/src/test/run-pass/issue-14421.rs b/src/test/run-pass/issue-14421.rs
index c595f98cd0e..4bdf5a31c71 100644
--- a/src/test/run-pass/issue-14421.rs
+++ b/src/test/run-pass/issue-14421.rs
@@ -19,4 +19,3 @@ pub fn main() {
     let mut an_A: B = make();
     an_A.foo();
 }
-
diff --git a/src/test/run-pass/issue-15155.rs b/src/test/run-pass/issue-15155.rs
index 3a63e63355c..e1ecaaab026 100644
--- a/src/test/run-pass/issue-15155.rs
+++ b/src/test/run-pass/issue-15155.rs
@@ -28,5 +28,3 @@ fn main() {
     test_trait::<TraitWithSend>();
     test_trait::<IndirectTraitWithSend>();
 }
-
-
diff --git a/src/test/run-pass/issue-15221.rs b/src/test/run-pass/issue-15221.rs
index 49e5b14aff8..6310ce39d99 100644
--- a/src/test/run-pass/issue-15221.rs
+++ b/src/test/run-pass/issue-15221.rs
@@ -20,4 +20,3 @@ fn main() {
     let outer!(g1) = 13;
     g1;
 }
-
diff --git a/src/test/run-pass/issue-16151.rs b/src/test/run-pass/issue-16151.rs
index 5401d6a6fdc..60d5ea8c84c 100644
--- a/src/test/run-pass/issue-16151.rs
+++ b/src/test/run-pass/issue-16151.rs
@@ -35,4 +35,3 @@ fn main() {
         assert_eq!(DROP_COUNT, 3);
     }
 }
-
diff --git a/src/test/run-pass/issue-16278.rs b/src/test/run-pass/issue-16278.rs
index ade312da21b..41af72db200 100644
--- a/src/test/run-pass/issue-16278.rs
+++ b/src/test/run-pass/issue-16278.rs
@@ -17,4 +17,3 @@ fn main() {assert_eq!(b"", b"\
 assert_eq!(b"\n", b"
 ");
 }
-
diff --git a/src/test/run-pass/issue-16452.rs b/src/test/run-pass/issue-16452.rs
index da480207490..f89dbfd2da9 100644
--- a/src/test/run-pass/issue-16452.rs
+++ b/src/test/run-pass/issue-16452.rs
@@ -14,4 +14,3 @@ fn main() {
         () => { static MAGIC: uint = 0; }
     }
 }
-
diff --git a/src/test/run-pass/issue-16597.rs b/src/test/run-pass/issue-16597.rs
index 72e948e613b..d074095dbde 100644
--- a/src/test/run-pass/issue-16597.rs
+++ b/src/test/run-pass/issue-16597.rs
@@ -15,5 +15,5 @@ mod test {
     use super::*;
 
     #[test]
-    fn test(){}
+    pub fn test(){}
 }
diff --git a/src/test/run-pass/issue-16922.rs b/src/test/run-pass/issue-16922.rs
new file mode 100644
index 00000000000..25909bcbfe9
--- /dev/null
+++ b/src/test/run-pass/issue-16922.rs
@@ -0,0 +1,18 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::any::Any;
+
+fn foo(_: &u8) {
+}
+
+fn main() {
+    let _ = &foo as &Any;
+}
diff --git a/src/test/run-pass/issue-19982.rs b/src/test/run-pass/issue-19982.rs
new file mode 100644
index 00000000000..3082fc27a7d
--- /dev/null
+++ b/src/test/run-pass/issue-19982.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(core,unboxed_closures)]
+
+#[allow(dead_code)]
+struct Foo;
+
+impl<'a> Fn<(&'a (),)> for Foo {
+    type Output = ();
+
+    extern "rust-call" fn call(&self, (_,): (&(),)) {}
+}
+
+fn main() {}
diff --git a/src/test/run-pass/issue-20396.rs b/src/test/run-pass/issue-20396.rs
new file mode 100644
index 00000000000..63a88988162
--- /dev/null
+++ b/src/test/run-pass/issue-20396.rs
@@ -0,0 +1,23 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(dead_code)]
+
+trait Foo<T> {
+    fn noop(&self, _: T);
+}
+
+enum Bar<T> { Bla(T) }
+
+struct Baz<'a> {
+    inner: for<'b> Foo<Bar<&'b ()>> + 'a,
+}
+
+fn main() {}
diff --git a/src/test/run-pass/issue-20823.rs b/src/test/run-pass/issue-20823.rs
index 561b6195476..c297998b649 100644
--- a/src/test/run-pass/issue-20823.rs
+++ b/src/test/run-pass/issue-20823.rs
@@ -14,4 +14,4 @@
 #![deny(unstable)]
 
 #[test]
-fn foo() {}
+pub fn foo() {}
diff --git a/src/test/run-pass/issue-21058.rs b/src/test/run-pass/issue-21058.rs
index 3cdd57aed5a..e53fe3c44a2 100644
--- a/src/test/run-pass/issue-21058.rs
+++ b/src/test/run-pass/issue-21058.rs
@@ -13,17 +13,17 @@ struct NT(str);
 struct DST { a: u32, b: str }
 
 fn main() {
-    // get_tydesc should support unsized types
+    // type_name should support unsized types
     assert_eq!(unsafe {(
         // Slice
-        (*std::intrinsics::get_tydesc::<[u8]>()).name,
+        std::intrinsics::type_name::<[u8]>(),
         // str
-        (*std::intrinsics::get_tydesc::<str>()).name,
+        std::intrinsics::type_name::<str>(),
         // Trait
-        (*std::intrinsics::get_tydesc::<Copy>()).name,
+        std::intrinsics::type_name::<Copy>(),
         // Newtype
-        (*std::intrinsics::get_tydesc::<NT>()).name,
+        std::intrinsics::type_name::<NT>(),
         // DST
-        (*std::intrinsics::get_tydesc::<DST>()).name
+        std::intrinsics::type_name::<DST>()
     )}, ("[u8]", "str", "core::marker::Copy", "NT", "DST"));
 }
diff --git a/src/test/run-pass/issue-21520.rs b/src/test/run-pass/issue-21520.rs
index 3a813641a3f..6eed3574152 100644
--- a/src/test/run-pass/issue-21520.rs
+++ b/src/test/run-pass/issue-21520.rs
@@ -26,4 +26,3 @@ struct Bar<T:Foo>
 }
 
 fn main() { }
-
diff --git a/src/test/run-pass/issue-2214.rs b/src/test/run-pass/issue-2214.rs
index a319ee5e600..1dcbfd92fa0 100644
--- a/src/test/run-pass/issue-2214.rs
+++ b/src/test/run-pass/issue-2214.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/issue-2383.rs b/src/test/run-pass/issue-2383.rs
index a5a05283f80..9599a908950 100644
--- a/src/test/run-pass/issue-2383.rs
+++ b/src/test/run-pass/issue-2383.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs
index ae146d8d353..3a1178c2824 100644
--- a/src/test/run-pass/issue-2718.rs
+++ b/src/test/run-pass/issue-2718.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/issue-2804-2.rs b/src/test/run-pass/issue-2804-2.rs
index 952ea1e9d3d..4f89d28332a 100644
--- a/src/test/run-pass/issue-2804-2.rs
+++ b/src/test/run-pass/issue-2804-2.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs
index 25b933b8f96..b9b5aec62fc 100644
--- a/src/test/run-pass/issue-2804.rs
+++ b/src/test/run-pass/issue-2804.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs
index b55f3691358..3f954c3c918 100644
--- a/src/test/run-pass/issue-2904.rs
+++ b/src/test/run-pass/issue-2904.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/issue-3026.rs b/src/test/run-pass/issue-3026.rs
index 98c9f3d5ec5..8da15496844 100644
--- a/src/test/run-pass/issue-3026.rs
+++ b/src/test/run-pass/issue-3026.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/issue-3979.rs b/src/test/run-pass/issue-3979.rs
index 4f69342830b..36939a2877e 100644
--- a/src/test/run-pass/issue-3979.rs
+++ b/src/test/run-pass/issue-3979.rs
@@ -1,4 +1,3 @@
-
 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
diff --git a/src/test/run-pass/issue-4759.rs b/src/test/run-pass/issue-4759.rs
index 2245e80971a..142f088a684 100644
--- a/src/test/run-pass/issue-4759.rs
+++ b/src/test/run-pass/issue-4759.rs
@@ -25,4 +25,3 @@ pub fn main() {
     let T { a: a } = T { a: box 0 };
     a.f();
 }
-
diff --git a/src/test/run-pass/issue-5060.rs b/src/test/run-pass/issue-5060.rs
index 7c3b0a5f1f0..5726f236e2e 100644
--- a/src/test/run-pass/issue-5060.rs
+++ b/src/test/run-pass/issue-5060.rs
@@ -24,4 +24,3 @@ macro_rules! print_hd_tl {
 pub fn main() {
     print_hd_tl!(x, y, z, w)
 }
-
diff --git a/src/test/run-pass/issue-5666.rs b/src/test/run-pass/issue-5666.rs
index 4f304e3b436..e28a929d527 100644
--- a/src/test/run-pass/issue-5666.rs
+++ b/src/test/run-pass/issue-5666.rs
@@ -35,4 +35,3 @@ pub fn main() {
         println!("{}", pup.bark());
     }
 }
-
diff --git a/src/test/run-pass/issue-5950.rs b/src/test/run-pass/issue-5950.rs
index c9413258e0f..88bbba44bbe 100644
--- a/src/test/run-pass/issue-5950.rs
+++ b/src/test/run-pass/issue-5950.rs
@@ -11,6 +11,6 @@
 
 pub use local as local_alias;
 
-mod local { }
+pub mod local { }
 
 pub fn main() {}
diff --git a/src/test/run-pass/issue-6318.rs b/src/test/run-pass/issue-6318.rs
index 6e608d34bd5..61bc70465e0 100644
--- a/src/test/run-pass/issue-6318.rs
+++ b/src/test/run-pass/issue-6318.rs
@@ -28,4 +28,3 @@ pub fn main() {
         Thing::A(_a) => 0,
     };
 }
-
diff --git a/src/test/run-pass/issue-6919.rs b/src/test/run-pass/issue-6919.rs
index c684c4d897b..10dae96d88d 100644
--- a/src/test/run-pass/issue-6919.rs
+++ b/src/test/run-pass/issue-6919.rs
@@ -16,4 +16,3 @@ extern crate issue6919_3;
 pub fn main() {
     let _ = issue6919_3::D.k;
 }
-
diff --git a/src/test/run-pass/issue-7222.rs b/src/test/run-pass/issue-7222.rs
index 65ea895c2c8..0ca4e428bc4 100644
--- a/src/test/run-pass/issue-7222.rs
+++ b/src/test/run-pass/issue-7222.rs
@@ -16,4 +16,3 @@ pub fn main() {
         _ => ()
     }
 }
-
diff --git a/src/test/run-pass/issue-7607-2.rs b/src/test/run-pass/issue-7607-2.rs
index c52051fab96..a0408a03590 100644
--- a/src/test/run-pass/issue-7607-2.rs
+++ b/src/test/run-pass/issue-7607-2.rs
@@ -20,5 +20,3 @@ pub mod b {
 }
 
 pub fn main() { }
-
-
diff --git a/src/test/run-pass/issue-8248.rs b/src/test/run-pass/issue-8248.rs
index 7bc8dbe616f..3800564b867 100644
--- a/src/test/run-pass/issue-8248.rs
+++ b/src/test/run-pass/issue-8248.rs
@@ -20,4 +20,3 @@ pub fn main() {
     let mut b = B;
     foo(&mut b as &mut A);
 }
-
diff --git a/src/test/run-pass/issue-8249.rs b/src/test/run-pass/issue-8249.rs
index 83c9e9bf450..10d3ade648d 100644
--- a/src/test/run-pass/issue-8249.rs
+++ b/src/test/run-pass/issue-8249.rs
@@ -24,4 +24,3 @@ fn foo(a: &mut A) {
 
 pub fn main() {
 }
-
diff --git a/src/test/run-pass/issue-8398.rs b/src/test/run-pass/issue-8398.rs
index e52e3295c6e..f8065d0bcd3 100644
--- a/src/test/run-pass/issue-8398.rs
+++ b/src/test/run-pass/issue-8398.rs
@@ -15,4 +15,3 @@ fn foo(a: &mut old_io::Writer) {
 }
 
 pub fn main(){}
-
diff --git a/src/test/run-pass/issue-9188.rs b/src/test/run-pass/issue-9188.rs
index 31797deccf9..73d3b355935 100644
--- a/src/test/run-pass/issue-9188.rs
+++ b/src/test/run-pass/issue-9188.rs
@@ -17,4 +17,3 @@ pub fn main() {
     let b = issue_9188::foo::<int>();
     assert_eq!(*a, *b);
 }
-
diff --git a/src/test/run-pass/issue-9951.rs b/src/test/run-pass/issue-9951.rs
new file mode 100644
index 00000000000..210f647e5be
--- /dev/null
+++ b/src/test/run-pass/issue-9951.rs
@@ -0,0 +1,28 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(unused_variables)]
+
+trait Bar {
+  fn noop(&self);
+}
+impl Bar for u8 {
+  fn noop(&self) {}
+}
+
+fn main() {
+    let (a, b) = (&5u8 as &Bar, &9u8 as &Bar);
+    let (c, d): (&Bar, &Bar) = (a, b);
+
+    let (a, b) = (Box::new(5u8) as Box<Bar>, Box::new(9u8) as Box<Bar>);
+    let (c, d): (&Bar, &Bar) = (&*a, &*b);
+
+    let (c, d): (&Bar, &Bar) = (&5, &9);
+}
diff --git a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs
index f2d509ee61d..9d6ca1e9cfb 100644
--- a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs
+++ b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs
@@ -50,4 +50,3 @@ fn car() {
 }
 
 pub fn main() {}
-
diff --git a/src/test/run-pass/kinds-in-metadata.rs b/src/test/run-pass/kinds-in-metadata.rs
index 233db83d289..bd75f547507 100644
--- a/src/test/run-pass/kinds-in-metadata.rs
+++ b/src/test/run-pass/kinds-in-metadata.rs
@@ -22,4 +22,3 @@ use kinds_in_metadata::f;
 pub fn main() {
     f::<int>();
 }
-
diff --git a/src/test/run-pass/loop-label-shadowing.rs b/src/test/run-pass/loop-label-shadowing.rs
index d96ff869fa0..090872e69ea 100644
--- a/src/test/run-pass/loop-label-shadowing.rs
+++ b/src/test/run-pass/loop-label-shadowing.rs
@@ -16,4 +16,3 @@ fn main() {
         foo.push(*i);
     }
 }
-
diff --git a/src/test/run-pass/macro-delimiter-significance.rs b/src/test/run-pass/macro-delimiter-significance.rs
index 01362f0f83f..a2ae3fbf83b 100644
--- a/src/test/run-pass/macro-delimiter-significance.rs
+++ b/src/test/run-pass/macro-delimiter-significance.rs
@@ -11,4 +11,3 @@
 fn main() {
     vec![1_usize, 2, 3].len();
 }
-
diff --git a/src/test/run-pass/macro-meta-items.rs b/src/test/run-pass/macro-meta-items.rs
index 47e3a072399..605cade2b3f 100644
--- a/src/test/run-pass/macro-meta-items.rs
+++ b/src/test/run-pass/macro-meta-items.rs
@@ -38,4 +38,3 @@ pub fn main() {
     emit!(baz);
     println!("{}", MISTYPED);
 }
-
diff --git a/src/test/run-pass/macro-method-issue-4621.rs b/src/test/run-pass/macro-method-issue-4621.rs
index fd16958d896..c58a0301424 100644
--- a/src/test/run-pass/macro-method-issue-4621.rs
+++ b/src/test/run-pass/macro-method-issue-4621.rs
@@ -16,6 +16,3 @@ impl A { make_thirteen_method!(); }
 fn main() {
     assert_eq!(A.thirteen(),13);
 }
-
-
-
diff --git a/src/test/run-pass/macro-with-attrs2.rs b/src/test/run-pass/macro-with-attrs2.rs
index d683979462b..b56dff6b01f 100644
--- a/src/test/run-pass/macro-with-attrs2.rs
+++ b/src/test/run-pass/macro-with-attrs2.rs
@@ -17,4 +17,3 @@ macro_rules! foo { () => (2) }
 pub fn main() {
     assert_eq!(foo!(), 2);
 }
-
diff --git a/src/test/run-pass/method-normalize-bounds-issue-20604.rs b/src/test/run-pass/method-normalize-bounds-issue-20604.rs
index 73489948da5..5ba5d7f8d72 100644
--- a/src/test/run-pass/method-normalize-bounds-issue-20604.rs
+++ b/src/test/run-pass/method-normalize-bounds-issue-20604.rs
@@ -62,4 +62,3 @@ fn foo<K: Hash<SipHasher>>(map: &Map<SipState>) {
 }
 
 fn main() {}
-
diff --git a/src/test/run-pass/mid-path-type-params.rs b/src/test/run-pass/mid-path-type-params.rs
index 4a04a71f9a0..85c05d408e8 100644
--- a/src/test/run-pass/mid-path-type-params.rs
+++ b/src/test/run-pass/mid-path-type-params.rs
@@ -40,4 +40,3 @@ pub fn main() {
     let _ = S::<int>::new::<f64>(1, 1.0);
     let _: S2 = Trait::<int>::new::<f64>(1, 1.0);
 }
-
diff --git a/src/test/run-pass/mod-view-items.rs b/src/test/run-pass/mod-view-items.rs
index f03ec7b6f3e..1513eb88835 100644
--- a/src/test/run-pass/mod-view-items.rs
+++ b/src/test/run-pass/mod-view-items.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/namespaced-enum-emulate-flat-xc.rs b/src/test/run-pass/namespaced-enum-emulate-flat-xc.rs
index 680cdf14e8f..ea7e05d24e2 100644
--- a/src/test/run-pass/namespaced-enum-emulate-flat-xc.rs
+++ b/src/test/run-pass/namespaced-enum-emulate-flat-xc.rs
@@ -28,4 +28,3 @@ fn _f2(f: Bar) {
 }
 
 pub fn main() {}
-
diff --git a/src/test/run-pass/namespaced-enums-xcrate.rs b/src/test/run-pass/namespaced-enums-xcrate.rs
index 7545908dcbb..3b56d6c59a1 100644
--- a/src/test/run-pass/namespaced-enums-xcrate.rs
+++ b/src/test/run-pass/namespaced-enums-xcrate.rs
@@ -21,4 +21,3 @@ fn _foo (f: Foo) {
 }
 
 pub fn main() {}
-
diff --git a/src/test/run-pass/new-box.rs b/src/test/run-pass/new-box.rs
index 1f2207ad873..3e4665bb231 100644
--- a/src/test/run-pass/new-box.rs
+++ b/src/test/run-pass/new-box.rs
@@ -39,4 +39,3 @@ fn main() {
     f(box 1234);
     g(box Struct as Box<Trait>);
 }
-
diff --git a/src/test/run-pass/overloaded-calls-simple.rs b/src/test/run-pass/overloaded-calls-simple.rs
index f9e838d9b3d..d18a91c5452 100644
--- a/src/test/run-pass/overloaded-calls-simple.rs
+++ b/src/test/run-pass/overloaded-calls-simple.rs
@@ -70,4 +70,3 @@ fn main() {
     let ans = s(3, 1);
     assert_eq!(ans, 27);
 }
-
diff --git a/src/test/run-pass/overloaded-calls-zero-args.rs b/src/test/run-pass/overloaded-calls-zero-args.rs
index ce7395673b3..78e84b9d55b 100644
--- a/src/test/run-pass/overloaded-calls-zero-args.rs
+++ b/src/test/run-pass/overloaded-calls-zero-args.rs
@@ -32,5 +32,3 @@ fn main() {
     let ans = s();
     assert_eq!(ans, 9);
 }
-
-
diff --git a/src/test/run-pass/placement-new-arena.rs b/src/test/run-pass/placement-new-arena.rs
index 7ad93d271a9..c4cf8357baa 100644
--- a/src/test/run-pass/placement-new-arena.rs
+++ b/src/test/run-pass/placement-new-arena.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/ranges-precedence.rs b/src/test/run-pass/ranges-precedence.rs
index 41ed9a74d13..18afcdd7f3f 100644
--- a/src/test/run-pass/ranges-precedence.rs
+++ b/src/test/run-pass/ranges-precedence.rs
@@ -58,4 +58,3 @@ fn main() {
     let y = ..;
     assert!(y == (..));
 }
-
diff --git a/src/test/run-pass/self-shadowing-import.rs b/src/test/run-pass/self-shadowing-import.rs
index 19fdd04069e..47380287ab6 100644
--- a/src/test/run-pass/self-shadowing-import.rs
+++ b/src/test/run-pass/self-shadowing-import.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/sepcomp-fns-backwards.rs b/src/test/run-pass/sepcomp-fns-backwards.rs
index 61f008ad854..35a8c9330bf 100644
--- a/src/test/run-pass/sepcomp-fns-backwards.rs
+++ b/src/test/run-pass/sepcomp-fns-backwards.rs
@@ -38,4 +38,3 @@ fn main() {
     assert_eq!(a::two(), 2);
     assert_eq!(b::three(), 3);
 }
-
diff --git a/src/test/run-pass/sepcomp-statics.rs b/src/test/run-pass/sepcomp-statics.rs
index 26a5c4d1c50..0e8d33f74f8 100644
--- a/src/test/run-pass/sepcomp-statics.rs
+++ b/src/test/run-pass/sepcomp-statics.rs
@@ -36,4 +36,3 @@ fn main() {
     assert_eq!(a::TWO, 2);
     assert_eq!(b::THREE, 3);
 }
-
diff --git a/src/test/run-pass/struct-aliases-xcrate.rs b/src/test/run-pass/struct-aliases-xcrate.rs
index 9046cafe757..7d99a2d1dcf 100644
--- a/src/test/run-pass/struct-aliases-xcrate.rs
+++ b/src/test/run-pass/struct-aliases-xcrate.rs
@@ -28,4 +28,3 @@ fn main() {
         }
     }
 }
-
diff --git a/src/test/run-pass/struct-aliases.rs b/src/test/run-pass/struct-aliases.rs
index 2cf961a5c0c..2e24bb64bed 100644
--- a/src/test/run-pass/struct-aliases.rs
+++ b/src/test/run-pass/struct-aliases.rs
@@ -30,4 +30,3 @@ fn main() {
         }
     }
 }
-
diff --git a/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs b/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs
index 7c99c968e35..df3c9a0f119 100644
--- a/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs
+++ b/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs
@@ -13,8 +13,7 @@
 extern crate test;
 
 #[bench]
-fn bench_explicit_return_type(_: &mut ::test::Bencher) -> () {}
+pub fn bench_explicit_return_type(_: &mut ::test::Bencher) -> () {}
 
 #[test]
-fn test_explicit_return_type() -> () {}
-
+pub fn test_explicit_return_type() -> () {}
diff --git a/src/test/run-pass/test-should-fail-good-message.rs b/src/test/run-pass/test-should-fail-good-message.rs
index b8e05b4d35a..28698499303 100644
--- a/src/test/run-pass/test-should-fail-good-message.rs
+++ b/src/test/run-pass/test-should-fail-good-message.rs
@@ -13,14 +13,12 @@
 
 #[test]
 #[should_panic(expected = "foo")]
-fn test_foo() {
+pub fn test_foo() {
     panic!("foo bar")
 }
 
 #[test]
 #[should_panic(expected = "foo")]
-fn test_foo_dynamic() {
+pub fn test_foo_dynamic() {
     panic!("{} bar", "foo")
 }
-
-
diff --git a/src/test/run-pass/trait-bounds-impl-comparison-duplicates.rs b/src/test/run-pass/trait-bounds-impl-comparison-duplicates.rs
index 5b744a44132..5c913f7921d 100644
--- a/src/test/run-pass/trait-bounds-impl-comparison-duplicates.rs
+++ b/src/test/run-pass/trait-bounds-impl-comparison-duplicates.rs
@@ -21,5 +21,3 @@ impl A for int {
 }
 
 fn main() {}
-
-
diff --git a/src/test/run-pass/trait-coercion-generic.rs b/src/test/run-pass/trait-coercion-generic.rs
index 1565ccfe459..96203ba4779 100644
--- a/src/test/run-pass/trait-coercion-generic.rs
+++ b/src/test/run-pass/trait-coercion-generic.rs
@@ -32,4 +32,3 @@ pub fn main() {
     let c: &Trait<&'static str> = &a;
     c.f("Joe");
 }
-
diff --git a/src/test/run-pass/trait-coercion.rs b/src/test/run-pass/trait-coercion.rs
index 6db7113b050..b02f8eb0aa9 100644
--- a/src/test/run-pass/trait-coercion.rs
+++ b/src/test/run-pass/trait-coercion.rs
@@ -45,4 +45,3 @@ pub fn main() {
     let out = old_io::stdout();
     foo(Box::new(out));
 }
-
diff --git a/src/test/run-pass/trait-contravariant-self.rs b/src/test/run-pass/trait-contravariant-self.rs
index 19d76b88901..17c68d64948 100644
--- a/src/test/run-pass/trait-contravariant-self.rs
+++ b/src/test/run-pass/trait-contravariant-self.rs
@@ -38,5 +38,3 @@ fn main() {
     let x: Box<Foo+Send> = (box SFoo);
     wants_bar(&x);
 }
-
-
diff --git a/src/test/run-pass/trait-inheritance-num.rs b/src/test/run-pass/trait-inheritance-num.rs
index 9a30d51f4c5..5fb28eb9d8d 100644
--- a/src/test/run-pass/trait-inheritance-num.rs
+++ b/src/test/run-pass/trait-inheritance-num.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/trait-inheritance-num0.rs b/src/test/run-pass/trait-inheritance-num0.rs
index d68b6a54f71..183d6659062 100644
--- a/src/test/run-pass/trait-inheritance-num0.rs
+++ b/src/test/run-pass/trait-inheritance-num0.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/trait-inheritance-num2.rs b/src/test/run-pass/trait-inheritance-num2.rs
index f89eea46090..1fb28c50652 100644
--- a/src/test/run-pass/trait-inheritance-num2.rs
+++ b/src/test/run-pass/trait-inheritance-num2.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/trait-static-method-overwriting.rs b/src/test/run-pass/trait-static-method-overwriting.rs
index 10439d5c86a..31968da6ee3 100644
--- a/src/test/run-pass/trait-static-method-overwriting.rs
+++ b/src/test/run-pass/trait-static-method-overwriting.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/tydesc-name.rs b/src/test/run-pass/tydesc-name.rs
index e3b148ac92d..2e7717fcfe1 100644
--- a/src/test/run-pass/tydesc-name.rs
+++ b/src/test/run-pass/tydesc-name.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-use std::intrinsics::get_tydesc;
+use std::intrinsics::type_name;
 
 struct Foo<T> {
     x: T
@@ -17,7 +17,7 @@ struct Foo<T> {
 
 pub fn main() {
     unsafe {
-        assert_eq!((*get_tydesc::<int>()).name, "isize");
-        assert_eq!((*get_tydesc::<Foo<uint>>()).name, "Foo<usize>");
+        assert_eq!(type_name::<int>(), "isize");
+        assert_eq!(type_name::<Foo<uint>>(), "Foo<usize>");
     }
 }
diff --git a/src/test/run-pass/ufcs-explicit-self.rs b/src/test/run-pass/ufcs-explicit-self.rs
index 832c1f8802d..810148b012d 100644
--- a/src/test/run-pass/ufcs-explicit-self.rs
+++ b/src/test/run-pass/ufcs-explicit-self.rs
@@ -57,4 +57,3 @@ fn main() {
     let bar: Box<Bar<int>> = bar;
     println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2));
 }
-
diff --git a/src/test/run-pass/unboxed-closures-all-traits.rs b/src/test/run-pass/unboxed-closures-all-traits.rs
index 7e71e1da462..b4b0d2b0148 100644
--- a/src/test/run-pass/unboxed-closures-all-traits.rs
+++ b/src/test/run-pass/unboxed-closures-all-traits.rs
@@ -28,4 +28,3 @@ fn main() {
     assert_eq!(b(move |x: int, y| x + y + z), 14);
     assert_eq!(c(move |x: int, y| x + y + z), 18);
 }
-
diff --git a/src/test/run-pass/unboxed-closures-boxed.rs b/src/test/run-pass/unboxed-closures-boxed.rs
index d515ccf2ec0..5dea6a7c6db 100644
--- a/src/test/run-pass/unboxed-closures-boxed.rs
+++ b/src/test/run-pass/unboxed-closures-boxed.rs
@@ -25,4 +25,3 @@ pub fn main() {
     println!("{}", z);
     assert_eq!(z, 5);
 }
-
diff --git a/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs b/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs
index 52311544297..271381f520e 100644
--- a/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs
+++ b/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs
@@ -26,4 +26,3 @@ pub fn main() {
     println!("{}", z);
     assert_eq!(z, 5);
 }
-
diff --git a/src/test/run-pass/unboxed-closures-call-sugar-object.rs b/src/test/run-pass/unboxed-closures-call-sugar-object.rs
index a34799fdcc5..e51e35d2c65 100644
--- a/src/test/run-pass/unboxed-closures-call-sugar-object.rs
+++ b/src/test/run-pass/unboxed-closures-call-sugar-object.rs
@@ -24,4 +24,3 @@ pub fn main() {
     println!("{}", z);
     assert_eq!(z, 5);
 }
-
diff --git a/src/test/run-pass/unboxed-closures-direct-sugary-call.rs b/src/test/run-pass/unboxed-closures-direct-sugary-call.rs
index 0c49c815170..6b2dcfa69b4 100644
--- a/src/test/run-pass/unboxed-closures-direct-sugary-call.rs
+++ b/src/test/run-pass/unboxed-closures-direct-sugary-call.rs
@@ -14,4 +14,3 @@ fn main() {
     let mut unboxed = || {};
     unboxed();
 }
-
diff --git a/src/test/run-pass/unboxed-closures-drop.rs b/src/test/run-pass/unboxed-closures-drop.rs
index f4a24c17e6e..e61d454023f 100644
--- a/src/test/run-pass/unboxed-closures-drop.rs
+++ b/src/test/run-pass/unboxed-closures-drop.rs
@@ -124,4 +124,3 @@ fn main() {
     test_fn_mut();
     test_fn_once();
 }
-
diff --git a/src/test/run-pass/unboxed-closures-extern-fn-hr.rs b/src/test/run-pass/unboxed-closures-extern-fn-hr.rs
index df753f0f33e..6a071f6a4c5 100644
--- a/src/test/run-pass/unboxed-closures-extern-fn-hr.rs
+++ b/src/test/run-pass/unboxed-closures-extern-fn-hr.rs
@@ -42,4 +42,3 @@ fn main() {
     assert_eq!(y, square(&22));
     assert_eq!(z, square(&22));
 }
-
diff --git a/src/test/run-pass/unboxed-closures-extern-fn.rs b/src/test/run-pass/unboxed-closures-extern-fn.rs
index a25f5e265e8..ed941ac0fdb 100644
--- a/src/test/run-pass/unboxed-closures-extern-fn.rs
+++ b/src/test/run-pass/unboxed-closures-extern-fn.rs
@@ -37,4 +37,3 @@ fn main() {
     assert_eq!(y, square(22));
     assert_eq!(z, square(22));
 }
-
diff --git a/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs b/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs
index 5d6029e703b..0aab5be2877 100644
--- a/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs
+++ b/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs
@@ -44,4 +44,3 @@ fn main() {
     assert_eq!(x, y);
     assert_eq!(y, z);
 }
-
diff --git a/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs b/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs
index 95dae41c684..a8bb0918932 100644
--- a/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs
+++ b/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs
@@ -39,4 +39,3 @@ fn main() {
     let z = call_it_once(S, 22);
     assert_eq!(y, z);
 }
-
diff --git a/src/test/run-pass/unboxed-closures-generic.rs b/src/test/run-pass/unboxed-closures-generic.rs
index f4af42a866b..47936ba9382 100644
--- a/src/test/run-pass/unboxed-closures-generic.rs
+++ b/src/test/run-pass/unboxed-closures-generic.rs
@@ -22,4 +22,3 @@ pub fn main() {
     println!("{}", z);
     assert_eq!(z, 5);
 }
-
diff --git a/src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs b/src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs
index 09b8c8f4454..17833033492 100644
--- a/src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs
+++ b/src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs
@@ -26,4 +26,3 @@ fn main() {
 
     assert_eq!(counter, 2);
 }
-
diff --git a/src/test/run-pass/unboxed-closures-manual-impl.rs b/src/test/run-pass/unboxed-closures-manual-impl.rs
index 37075de0405..f1b79a1829e 100644
--- a/src/test/run-pass/unboxed-closures-manual-impl.rs
+++ b/src/test/run-pass/unboxed-closures-manual-impl.rs
@@ -1,4 +1,3 @@
-
 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
@@ -37,4 +36,3 @@ fn main() {
     assert!(x == 4);
     assert!(y == 4);
 }
-
diff --git a/src/test/run-pass/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures-prelude.rs
index 16a55ab550d..4ed3fa5ca2d 100644
--- a/src/test/run-pass/unboxed-closures-prelude.rs
+++ b/src/test/run-pass/unboxed-closures-prelude.rs
@@ -28,4 +28,3 @@ fn main() {
 fn call<F:FnOnce(int) -> int>(f: F, x: int) -> int {
     f(x)
 }
-
diff --git a/src/test/run-pass/unboxed-closures-single-word-env.rs b/src/test/run-pass/unboxed-closures-single-word-env.rs
index 9e543f925f8..84544d6d24b 100644
--- a/src/test/run-pass/unboxed-closures-single-word-env.rs
+++ b/src/test/run-pass/unboxed-closures-single-word-env.rs
@@ -31,4 +31,3 @@ fn main() {
     assert_eq!(b(move |x: int, y| x + y + z), 17);
     assert_eq!(c(move |x: int, y| x + y + z), 21);
 }
-
diff --git a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs
index 7a6b68a5e09..1f5481ccde9 100644
--- a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs
+++ b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs
@@ -14,4 +14,3 @@ fn main() {
     let onetime = |x| x;
     onetime(0);
 }
-
diff --git a/src/test/run-pass/unboxed-closures-zero-args.rs b/src/test/run-pass/unboxed-closures-zero-args.rs
index 8e3d44df798..c81b0515aec 100644
--- a/src/test/run-pass/unboxed-closures-zero-args.rs
+++ b/src/test/run-pass/unboxed-closures-zero-args.rs
@@ -14,4 +14,3 @@ fn main() {
     let mut zero = || {};
     let () = zero();
 }
-
diff --git a/src/test/run-pass/use.rs b/src/test/run-pass/use.rs
index 65a392e63c5..c25cd15b2cd 100644
--- a/src/test/run-pass/use.rs
+++ b/src/test/run-pass/use.rs
@@ -1,4 +1,3 @@
-
 // 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.
diff --git a/src/test/run-pass/variance-trait-matching.rs b/src/test/run-pass/variance-trait-matching.rs
index 10441bee3cb..d46ffa80183 100644
--- a/src/test/run-pass/variance-trait-matching.rs
+++ b/src/test/run-pass/variance-trait-matching.rs
@@ -45,5 +45,3 @@ fn main() {
     let y = get(&x);
     assert_eq!(y, 23);
 }
-
-
diff --git a/src/test/run-pass/visible-private-types-feature-gate.rs b/src/test/run-pass/visible-private-types-feature-gate.rs
index 46e93b25697..3060c12d39a 100644
--- a/src/test/run-pass/visible-private-types-feature-gate.rs
+++ b/src/test/run-pass/visible-private-types-feature-gate.rs
@@ -19,4 +19,3 @@ struct Baz;
 pub fn f(_: Baz) {}
 
 fn main() {}
-
diff --git a/src/test/run-pass/where-clause-method-substituion.rs b/src/test/run-pass/where-clause-method-substituion.rs
index ecc210ea579..e2280f0b07b 100644
--- a/src/test/run-pass/where-clause-method-substituion.rs
+++ b/src/test/run-pass/where-clause-method-substituion.rs
@@ -27,4 +27,3 @@ impl Bar<X> for i32 {
 fn main() {
     1.method::<S>();
 }
-
diff --git a/src/test/run-pass/where-clauses-cross-crate.rs b/src/test/run-pass/where-clauses-cross-crate.rs
index b822abd6732..6a2fec7260a 100644
--- a/src/test/run-pass/where-clauses-cross-crate.rs
+++ b/src/test/run-pass/where-clauses-cross-crate.rs
@@ -20,4 +20,3 @@ fn main() {
     println!("{}", "hello".equal(&"hello"));
     println!("{}", "hello".equals::<int,&str>(&1, &1, &"foo", &"bar"));
 }
-
diff --git a/src/test/run-pass/where-clauses-unboxed-closures.rs b/src/test/run-pass/where-clauses-unboxed-closures.rs
index 7edcdf64292..dbff4b9599b 100644
--- a/src/test/run-pass/where-clauses-unboxed-closures.rs
+++ b/src/test/run-pass/where-clauses-unboxed-closures.rs
@@ -23,4 +23,3 @@ fn main() {
     // OK
     warm_up(|b| () );
 }
-
diff --git a/src/test/run-pass/where-clauses.rs b/src/test/run-pass/where-clauses.rs
index 92bc7edf285..0f0741dcea7 100644
--- a/src/test/run-pass/where-clauses.rs
+++ b/src/test/run-pass/where-clauses.rs
@@ -34,4 +34,3 @@ fn main() {
     println!("{}", "hello".equal(&"hello"));
     println!("{}", "hello".equals::<int,&str>(&1, &1, &"foo", &"bar"));
 }
-
diff --git a/src/test/run-pass/where-for-self.rs b/src/test/run-pass/where-for-self.rs
index 67757d7efa8..4e841029a6b 100644
--- a/src/test/run-pass/where-for-self.rs
+++ b/src/test/run-pass/where-for-self.rs
@@ -62,4 +62,3 @@ fn main() {
         assert!(COUNT == 12);
     }
 }
-