about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiletest/common.rs56
-rw-r--r--src/compiletest/compiletest.rs8
-rw-r--r--src/compiletest/errors.rs6
-rw-r--r--src/compiletest/header.rs20
-rw-r--r--src/compiletest/procsrv.rs31
-rw-r--r--src/compiletest/runtest.rs11
-rw-r--r--src/doc/README.md4
-rw-r--r--src/doc/complement-lang-faq.md6
-rw-r--r--src/doc/guide-container.md2
-rw-r--r--src/doc/guide-pointers.md4
-rw-r--r--src/doc/guide-runtime.md3
-rw-r--r--src/doc/guide-unsafe.md16
-rw-r--r--src/doc/po/ja/complement-cheatsheet.md.po82
-rw-r--r--src/doc/po/ja/complement-lang-faq.md.po2
-rw-r--r--src/doc/po/ja/complement-project-faq.md.po2
-rw-r--r--src/doc/po/ja/complement-usage-faq.md.po10
-rw-r--r--src/doc/po/ja/guide-conditions.md.po2
-rw-r--r--src/doc/po/ja/guide-container.md.po2
-rw-r--r--src/doc/po/ja/guide-ffi.md.po2
-rw-r--r--src/doc/po/ja/guide-lifetimes.md.po2
-rw-r--r--src/doc/po/ja/guide-macros.md.po2
-rw-r--r--src/doc/po/ja/guide-pointers.md.po2
-rw-r--r--src/doc/po/ja/guide-runtime.md.po2
-rw-r--r--src/doc/po/ja/guide-tasks.md.po2
-rw-r--r--src/doc/po/ja/guide-testing.md.po2
-rw-r--r--src/doc/po/ja/index.md.po2
-rw-r--r--src/doc/po/ja/rust.md.po4
-rw-r--r--src/doc/po/ja/rustdoc.md.po2
-rw-r--r--src/doc/po/ja/tutorial.md.po56
-rw-r--r--src/doc/rust.md357
-rw-r--r--src/doc/rustdoc.md4
-rw-r--r--src/doc/tutorial.md130
-rwxr-xr-xsrc/etc/combine-tests.py2
-rw-r--r--src/etc/emacs/rust-mode.el6
-rw-r--r--src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang2
-rw-r--r--src/etc/install.sh151
-rw-r--r--src/etc/kate/rust.xml3
-rw-r--r--src/etc/pkg/Distribution.xml6
-rw-r--r--src/etc/pkg/rust-logo.pngbin0 -> 5844 bytes
-rw-r--r--src/etc/pkg/welcome.rtf12
-rw-r--r--src/etc/vim/syntax/rust.vim4
-rw-r--r--src/libarena/lib.rs121
-rw-r--r--src/libcollections/bitv.rs20
-rw-r--r--src/libcollections/btree.rs8
-rw-r--r--src/libcollections/deque.rs6
-rw-r--r--src/libcollections/dlist.rs26
-rw-r--r--src/libcollections/enum_set.rs6
-rw-r--r--src/libcollections/hashmap.rs78
-rw-r--r--src/libcollections/lib.rs18
-rw-r--r--src/libcollections/list.rs237
-rw-r--r--src/libcollections/lru_cache.rs8
-rw-r--r--src/libcollections/priority_queue.rs13
-rw-r--r--src/libcollections/ringbuf.rs26
-rw-r--r--src/libcollections/smallintmap.rs21
-rw-r--r--src/libcollections/treemap.rs54
-rw-r--r--src/libcollections/trie.rs68
-rw-r--r--src/libflate/lib.rs20
-rw-r--r--src/libfourcc/lib.rs20
-rw-r--r--src/libgetopts/lib.rs47
-rw-r--r--src/libglob/lib.rs32
-rw-r--r--src/libgreen/basic.rs24
-rw-r--r--src/libgreen/context.rs4
-rw-r--r--src/libgreen/coroutine.rs4
-rw-r--r--src/libgreen/lib.rs49
-rw-r--r--src/libgreen/macros.rs2
-rw-r--r--src/libgreen/message_queue.rs4
-rw-r--r--src/libgreen/sched.rs45
-rw-r--r--src/libgreen/simple.rs6
-rw-r--r--src/libgreen/sleeper_list.rs2
-rw-r--r--src/libgreen/stack.rs8
-rw-r--r--src/libgreen/task.rs19
-rw-r--r--src/libhexfloat/lib.rs20
-rw-r--r--src/liblog/directive.rs4
-rw-r--r--src/liblog/lib.rs28
-rw-r--r--src/liblog/macros.rs14
-rw-r--r--src/libnative/io/addrinfo.rs4
-rw-r--r--src/libnative/io/file_unix.rs10
-rw-r--r--src/libnative/io/file_win32.rs6
-rw-r--r--src/libnative/io/mod.rs119
-rw-r--r--src/libnative/io/net.rs26
-rw-r--r--src/libnative/io/pipe_unix.rs20
-rw-r--r--src/libnative/io/pipe_win32.rs26
-rw-r--r--src/libnative/io/process.rs95
-rw-r--r--src/libnative/io/timer_other.rs8
-rw-r--r--src/libnative/io/timer_timerfd.rs20
-rw-r--r--src/libnative/io/timer_win32.rs6
-rw-r--r--src/libnative/lib.rs36
-rw-r--r--src/libnative/task.rs23
-rw-r--r--src/libnum/bigint.rs10
-rw-r--r--src/libnum/complex.rs6
-rw-r--r--src/libnum/lib.rs18
-rw-r--r--src/libnum/rational.rs4
-rw-r--r--src/librand/distributions/exponential.rs6
-rw-r--r--src/librand/distributions/gamma.rs23
-rw-r--r--src/librand/distributions/mod.rs84
-rw-r--r--src/librand/distributions/normal.rs10
-rw-r--r--src/librand/distributions/range.rs6
-rw-r--r--src/librand/isaac.rs103
-rw-r--r--src/librand/lib.rs175
-rw-r--r--src/librand/os.rs27
-rw-r--r--src/librand/reader.rs3
-rw-r--r--src/librand/reseeding.rs22
-rw-r--r--src/librustc/back/abi.rs35
-rw-r--r--src/librustc/back/archive.rs29
-rw-r--r--src/librustc/back/link.rs10
-rw-r--r--src/librustc/back/lto.rs4
-rw-r--r--src/librustc/back/rpath.rs17
-rw-r--r--src/librustc/back/svh.rs2
-rw-r--r--src/librustc/back/target_strs.rs12
-rw-r--r--src/librustc/driver/driver.rs61
-rw-r--r--src/librustc/driver/session.rs83
-rw-r--r--src/librustc/front/config.rs2
-rw-r--r--src/librustc/front/feature_gate.rs9
-rw-r--r--src/librustc/front/std_inject.rs5
-rw-r--r--src/librustc/front/test.rs34
-rw-r--r--src/librustc/lib.rs31
-rw-r--r--src/librustc/lib/llvm.rs71
-rw-r--r--src/librustc/metadata/common.rs15
-rw-r--r--src/librustc/metadata/creader.rs57
-rw-r--r--src/librustc/metadata/csearch.rs61
-rw-r--r--src/librustc/metadata/cstore.rs41
-rw-r--r--src/librustc/metadata/decoder.rs112
-rw-r--r--src/librustc/metadata/encoder.rs192
-rw-r--r--src/librustc/metadata/filesearch.rs66
-rw-r--r--src/librustc/metadata/loader.rs93
-rw-r--r--src/librustc/metadata/tydecode.rs23
-rw-r--r--src/librustc/metadata/tyencode.rs25
-rw-r--r--src/librustc/middle/astencode.rs318
-rw-r--r--src/librustc/middle/borrowck/gather_loans/restrictions.rs7
-rw-r--r--src/librustc/middle/borrowck/mod.rs24
-rw-r--r--src/librustc/middle/borrowck/move_data.rs42
-rw-r--r--src/librustc/middle/cfg/construct.rs4
-rw-r--r--src/librustc/middle/cfg/mod.rs2
-rw-r--r--src/librustc/middle/check_const.rs2
-rw-r--r--src/librustc/middle/check_loop.rs14
-rw-r--r--src/librustc/middle/check_match.rs35
-rw-r--r--src/librustc/middle/const_eval.rs12
-rw-r--r--src/librustc/middle/dataflow.rs48
-rw-r--r--src/librustc/middle/dead.rs2
-rw-r--r--src/librustc/middle/entry.rs6
-rw-r--r--src/librustc/middle/freevars.rs10
-rw-r--r--src/librustc/middle/graph.rs24
-rw-r--r--src/librustc/middle/kind.rs13
-rw-r--r--src/librustc/middle/lang_items.rs11
-rw-r--r--src/librustc/middle/lint.rs54
-rw-r--r--src/librustc/middle/liveness.rs4
-rw-r--r--src/librustc/middle/mem_categorization.rs83
-rw-r--r--src/librustc/middle/moves.rs18
-rw-r--r--src/librustc/middle/pat_util.rs6
-rw-r--r--src/librustc/middle/privacy.rs200
-rw-r--r--src/librustc/middle/region.rs19
-rw-r--r--src/librustc/middle/resolve.rs161
-rw-r--r--src/librustc/middle/resolve_lifetime.rs2
-rw-r--r--src/librustc/middle/subst.rs4
-rw-r--r--src/librustc/middle/trans/_match.rs163
-rw-r--r--src/librustc/middle/trans/adt.rs91
-rw-r--r--src/librustc/middle/trans/asm.rs13
-rw-r--r--src/librustc/middle/trans/base.rs126
-rw-r--r--src/librustc/middle/trans/basic_block.rs2
-rw-r--r--src/librustc/middle/trans/build.rs3
-rw-r--r--src/librustc/middle/trans/builder.rs17
-rw-r--r--src/librustc/middle/trans/cabi.rs18
-rw-r--r--src/librustc/middle/trans/cabi_arm.rs2
-rw-r--r--src/librustc/middle/trans/cabi_mips.rs2
-rw-r--r--src/librustc/middle/trans/cabi_x86_64.rs2
-rw-r--r--src/librustc/middle/trans/callee.rs105
-rw-r--r--src/librustc/middle/trans/cleanup.rs2
-rw-r--r--src/librustc/middle/trans/closure.rs2
-rw-r--r--src/librustc/middle/trans/common.rs163
-rw-r--r--src/librustc/middle/trans/consts.rs11
-rw-r--r--src/librustc/middle/trans/context.rs176
-rw-r--r--src/librustc/middle/trans/controlflow.rs4
-rw-r--r--src/librustc/middle/trans/datum.rs60
-rw-r--r--src/librustc/middle/trans/debuginfo.rs121
-rw-r--r--src/librustc/middle/trans/expr.rs29
-rw-r--r--src/librustc/middle/trans/foreign.rs36
-rw-r--r--src/librustc/middle/trans/glue.rs2
-rw-r--r--src/librustc/middle/trans/intrinsic.rs4
-rw-r--r--src/librustc/middle/trans/llrepr.rs2
-rw-r--r--src/librustc/middle/trans/macros.rs2
-rw-r--r--src/librustc/middle/trans/meth.rs31
-rw-r--r--src/librustc/middle/trans/monomorphize.rs7
-rw-r--r--src/librustc/middle/trans/reflect.rs33
-rw-r--r--src/librustc/middle/trans/tvec.rs56
-rw-r--r--src/librustc/middle/trans/type_.rs24
-rw-r--r--src/librustc/middle/trans/type_of.rs5
-rw-r--r--src/librustc/middle/trans/value.rs4
-rw-r--r--src/librustc/middle/ty.rs572
-rw-r--r--src/librustc/middle/ty_fold.rs6
-rw-r--r--src/librustc/middle/typeck/astconv.rs27
-rw-r--r--src/librustc/middle/typeck/check/_match.rs12
-rw-r--r--src/librustc/middle/typeck/check/method.rs15
-rw-r--r--src/librustc/middle/typeck/check/mod.rs135
-rw-r--r--src/librustc/middle/typeck/check/regionck.rs6
-rw-r--r--src/librustc/middle/typeck/check/vtable.rs4
-rw-r--r--src/librustc/middle/typeck/check/writeback.rs4
-rw-r--r--src/librustc/middle/typeck/coherence.rs5
-rw-r--r--src/librustc/middle/typeck/collect.rs58
-rw-r--r--src/librustc/middle/typeck/infer/coercion.rs5
-rw-r--r--src/librustc/middle/typeck/infer/combine.rs36
-rw-r--r--src/librustc/middle/typeck/infer/error_reporting.rs2
-rw-r--r--src/librustc/middle/typeck/infer/glb.rs2
-rw-r--r--src/librustc/middle/typeck/infer/lub.rs6
-rw-r--r--src/librustc/middle/typeck/infer/macros.rs2
-rw-r--r--src/librustc/middle/typeck/infer/mod.rs48
-rw-r--r--src/librustc/middle/typeck/infer/region_inference/mod.rs19
-rw-r--r--src/librustc/middle/typeck/infer/resolve.rs17
-rw-r--r--src/librustc/middle/typeck/infer/sub.rs2
-rw-r--r--src/librustc/middle/typeck/infer/to_str.rs2
-rw-r--r--src/librustc/middle/typeck/infer/unify.rs10
-rw-r--r--src/librustc/middle/typeck/mod.rs52
-rw-r--r--src/librustc/middle/typeck/rscope.rs8
-rw-r--r--src/librustc/util/common.rs22
-rw-r--r--src/librustc/util/ppaux.rs76
-rw-r--r--src/librustc/util/sha2.rs2
-rw-r--r--src/librustdoc/clean.rs206
-rw-r--r--src/librustdoc/core.rs8
-rw-r--r--src/librustdoc/doctree.rs162
-rw-r--r--src/librustdoc/flock.rs42
-rw-r--r--src/librustdoc/html/escape.rs2
-rw-r--r--src/librustdoc/html/format.rs6
-rw-r--r--src/librustdoc/html/highlight.rs4
-rw-r--r--src/librustdoc/html/layout.rs16
-rw-r--r--src/librustdoc/html/markdown.rs19
-rw-r--r--src/librustdoc/html/render.rs36
-rw-r--r--src/librustdoc/html/toc.rs16
-rw-r--r--src/librustdoc/lib.rs20
-rw-r--r--src/librustdoc/passes.rs10
-rw-r--r--src/librustdoc/plugins.rs6
-rw-r--r--src/librustdoc/test.rs48
-rw-r--r--src/librustdoc/visit_ast.rs12
-rw-r--r--src/librustuv/access.rs6
-rw-r--r--src/librustuv/async.rs7
-rw-r--r--src/librustuv/file.rs10
-rw-r--r--src/librustuv/homing.rs8
-rw-r--r--src/librustuv/idle.rs4
-rw-r--r--src/librustuv/lib.rs28
-rw-r--r--src/librustuv/macros.rs2
-rw-r--r--src/librustuv/net.rs42
-rw-r--r--src/librustuv/pipe.rs24
-rw-r--r--src/librustuv/queue.rs8
-rw-r--r--src/librustuv/rc.rs2
-rw-r--r--src/librustuv/stream.rs4
-rw-r--r--src/librustuv/uvio.rs69
-rw-r--r--src/librustuv/uvll.rs70
-rw-r--r--src/libsemver/lib.rs26
-rw-r--r--src/libserialize/base64.rs24
-rw-r--r--src/libserialize/collection_impls.rs242
-rw-r--r--src/libserialize/ebml.rs655
-rw-r--r--src/libserialize/hex.rs4
-rw-r--r--src/libserialize/json.rs882
-rw-r--r--src/libserialize/lib.rs16
-rw-r--r--src/libserialize/serialize.rs473
-rw-r--r--src/libstd/ascii.rs24
-rw-r--r--src/libstd/c_str.rs8
-rw-r--r--src/libstd/c_vec.rs15
-rw-r--r--src/libstd/cell.rs73
-rw-r--r--src/libstd/cleanup.rs2
-rw-r--r--src/libstd/cmp.rs118
-rw-r--r--src/libstd/comm/mod.rs26
-rw-r--r--src/libstd/comm/select.rs24
-rw-r--r--src/libstd/fmt/mod.rs24
-rw-r--r--src/libstd/fmt/num.rs22
-rw-r--r--src/libstd/fmt/parse.rs34
-rw-r--r--src/libstd/fmt/rt.rs28
-rw-r--r--src/libstd/gc.rs10
-rw-r--r--src/libstd/hash/mod.rs2
-rw-r--r--src/libstd/hash/sip.rs24
-rw-r--r--src/libstd/intrinsics.rs18
-rw-r--r--src/libstd/io/buffered.rs20
-rw-r--r--src/libstd/io/comm_adapters.rs10
-rw-r--r--src/libstd/io/extensions.rs4
-rw-r--r--src/libstd/io/fs.rs11
-rw-r--r--src/libstd/io/mem.rs16
-rw-r--r--src/libstd/io/mod.rs134
-rw-r--r--src/libstd/io/net/addrinfo.rs25
-rw-r--r--src/libstd/io/net/ip.rs6
-rw-r--r--src/libstd/io/net/tcp.rs13
-rw-r--r--src/libstd/io/net/udp.rs9
-rw-r--r--src/libstd/io/net/unix.rs17
-rw-r--r--src/libstd/io/pipe.rs6
-rw-r--r--src/libstd/io/process.rs69
-rw-r--r--src/libstd/io/signal.rs6
-rw-r--r--src/libstd/io/stdio.rs25
-rw-r--r--src/libstd/io/tempfile.rs2
-rw-r--r--src/libstd/io/test.rs10
-rw-r--r--src/libstd/io/timer.rs5
-rw-r--r--src/libstd/io/util.rs14
-rw-r--r--src/libstd/iter.rs126
-rw-r--r--src/libstd/kinds.rs12
-rw-r--r--src/libstd/lib.rs28
-rw-r--r--src/libstd/libc.rs922
-rw-r--r--src/libstd/local_data.rs11
-rw-r--r--src/libstd/macros.rs261
-rw-r--r--src/libstd/mem.rs4
-rw-r--r--src/libstd/num/cmath.rs151
-rw-r--r--src/libstd/num/f32.rs193
-rw-r--r--src/libstd/num/f64.rs203
-rw-r--r--src/libstd/num/float_macros.rs4
-rw-r--r--src/libstd/num/i16.rs2
-rw-r--r--src/libstd/num/i32.rs2
-rw-r--r--src/libstd/num/i64.rs2
-rw-r--r--src/libstd/num/i8.rs2
-rw-r--r--src/libstd/num/int.rs2
-rw-r--r--src/libstd/num/int_macros.rs4
-rw-r--r--src/libstd/num/mod.rs88
-rw-r--r--src/libstd/num/strconv.rs36
-rw-r--r--src/libstd/num/u16.rs2
-rw-r--r--src/libstd/num/u32.rs2
-rw-r--r--src/libstd/num/u64.rs2
-rw-r--r--src/libstd/num/u8.rs2
-rw-r--r--src/libstd/num/uint.rs2
-rw-r--r--src/libstd/num/uint_macros.rs4
-rw-r--r--src/libstd/option.rs11
-rw-r--r--src/libstd/os.rs38
-rw-r--r--src/libstd/path/mod.rs4
-rw-r--r--src/libstd/path/posix.rs4
-rw-r--r--src/libstd/path/windows.rs10
-rw-r--r--src/libstd/prelude.rs2
-rw-r--r--src/libstd/raw.rs34
-rw-r--r--src/libstd/rc.rs12
-rw-r--r--src/libstd/reflect.rs4
-rw-r--r--src/libstd/repr.rs14
-rw-r--r--src/libstd/result.rs2
-rw-r--r--src/libstd/rt/at_exit_imp.rs5
-rw-r--r--src/libstd/rt/backtrace.rs2
-rw-r--r--src/libstd/rt/bookkeeping.rs4
-rw-r--r--src/libstd/rt/global_heap.rs13
-rw-r--r--src/libstd/rt/libunwind.rs28
-rw-r--r--src/libstd/rt/local_heap.rs8
-rw-r--r--src/libstd/rt/local_ptr.rs4
-rw-r--r--src/libstd/rt/macros.rs2
-rw-r--r--src/libstd/rt/mod.rs7
-rw-r--r--src/libstd/rt/rtio.rs167
-rw-r--r--src/libstd/rt/task.rs41
-rw-r--r--src/libstd/rt/thread.rs24
-rw-r--r--src/libstd/rt/thread_local_storage.rs2
-rw-r--r--src/libstd/rt/unwind.rs8
-rw-r--r--src/libstd/slice.rs185
-rw-r--r--src/libstd/str.rs60
-rw-r--r--src/libstd/sync/arc.rs2
-rw-r--r--src/libstd/sync/atomics.rs168
-rw-r--r--src/libstd/sync/deque.rs6
-rw-r--r--src/libstd/sync/mpmc_bounded_queue.rs4
-rw-r--r--src/libstd/sync/mpsc_queue.rs4
-rw-r--r--src/libstd/sync/spsc_queue.rs16
-rw-r--r--src/libstd/task.rs60
-rw-r--r--src/libstd/tuple.rs2
-rw-r--r--src/libstd/ty.rs6
-rw-r--r--src/libstd/unicode.rs4
-rw-r--r--src/libstd/unstable/dynamic_lib.rs2
-rw-r--r--src/libstd/unstable/mod.rs4
-rw-r--r--src/libstd/unstable/mutex.rs18
-rw-r--r--src/libstd/unstable/simd.rs30
-rw-r--r--src/libstd/unstable/sync.rs2
-rw-r--r--src/libstd/vec.rs214
-rw-r--r--src/libsync/arc.rs46
-rw-r--r--src/libsync/comm.rs6
-rw-r--r--src/libsync/future.rs10
-rw-r--r--src/libsync/lib.rs20
-rw-r--r--src/libsync/lock.rs34
-rw-r--r--src/libsync/mpsc_intrusive.rs12
-rw-r--r--src/libsync/mutex.rs18
-rw-r--r--src/libsync/one.rs6
-rw-r--r--src/libsync/raw.rs36
-rw-r--r--src/libsync/task_pool.rs18
-rw-r--r--src/libsyntax/abi.rs274
-rw-r--r--src/libsyntax/ast.rs338
-rw-r--r--src/libsyntax/ast_map.rs20
-rw-r--r--src/libsyntax/ast_util.rs35
-rw-r--r--src/libsyntax/attr.rs4
-rw-r--r--src/libsyntax/codemap.rs72
-rw-r--r--src/libsyntax/crateid.rs6
-rw-r--r--src/libsyntax/diagnostic.rs64
-rw-r--r--src/libsyntax/ext/base.rs34
-rw-r--r--src/libsyntax/ext/build.rs64
-rw-r--r--src/libsyntax/ext/deriving/clone.rs6
-rw-r--r--src/libsyntax/ext/deriving/decodable.rs30
-rw-r--r--src/libsyntax/ext/deriving/default.rs6
-rw-r--r--src/libsyntax/ext/deriving/encodable.rs40
-rw-r--r--src/libsyntax/ext/deriving/generic.rs92
-rw-r--r--src/libsyntax/ext/deriving/rand.rs6
-rw-r--r--src/libsyntax/ext/deriving/ty.rs28
-rw-r--r--src/libsyntax/ext/deriving/zero.rs6
-rw-r--r--src/libsyntax/ext/expand.rs12
-rw-r--r--src/libsyntax/ext/log_syntax.rs4
-rw-r--r--src/libsyntax/ext/quote.rs6
-rw-r--r--src/libsyntax/ext/source_util.rs2
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs55
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs19
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs327
-rw-r--r--src/libsyntax/fold.rs122
-rw-r--r--src/libsyntax/lib.rs22
-rw-r--r--src/libsyntax/owned_slice.rs19
-rw-r--r--src/libsyntax/parse/attr.rs24
-rw-r--r--src/libsyntax/parse/comments.rs74
-rw-r--r--src/libsyntax/parse/common.rs4
-rw-r--r--src/libsyntax/parse/lexer.rs329
-rw-r--r--src/libsyntax/parse/mod.rs15
-rw-r--r--src/libsyntax/parse/parser.rs304
-rw-r--r--src/libsyntax/parse/token.rs52
-rw-r--r--src/libsyntax/print/pp.rs2
-rw-r--r--src/libsyntax/print/pprust.rs119
-rw-r--r--src/libsyntax/util/interner.rs10
-rw-r--r--src/libsyntax/util/parser_testing.rs2
-rw-r--r--src/libsyntax/util/small_vector.rs4
-rw-r--r--src/libsyntax/visit.rs8
-rw-r--r--src/libterm/lib.rs27
-rw-r--r--src/libterm/terminfo/mod.rs8
-rw-r--r--src/libterm/terminfo/parm.rs31
-rw-r--r--src/libterm/terminfo/parser/compiled.rs6
-rw-r--r--src/libtest/lib.rs82
-rw-r--r--src/libtest/stats.rs26
-rw-r--r--src/libtime/lib.rs44
-rw-r--r--src/liburl/lib.rs40
-rw-r--r--src/libuuid/lib.rs36
-rw-r--r--src/libworkcache/lib.rs66
-rw-r--r--src/rustllvm/RustWrapper.cpp47
-rw-r--r--src/rustllvm/rustllvm.def.in634
-rw-r--r--src/snapshots.txt16
-rw-r--r--src/test/auxiliary/anon_trait_static_method_lib.rs2
-rw-r--r--src/test/auxiliary/cci_class.rs4
-rw-r--r--src/test/auxiliary/cci_class_2.rs4
-rw-r--r--src/test/auxiliary/cci_class_3.rs4
-rw-r--r--src/test/auxiliary/cci_class_4.rs6
-rw-r--r--src/test/auxiliary/cci_class_5.rs4
-rw-r--r--src/test/auxiliary/cci_class_6.rs6
-rw-r--r--src/test/auxiliary/cci_class_cast.rs6
-rw-r--r--src/test/auxiliary/crateresolve5-1.rs2
-rw-r--r--src/test/auxiliary/crateresolve5-2.rs2
-rw-r--r--src/test/auxiliary/explicit_self_xcrate.rs2
-rw-r--r--src/test/auxiliary/impl_privacy_xc_1.rs4
-rw-r--r--src/test/auxiliary/impl_privacy_xc_2.rs2
-rw-r--r--src/test/auxiliary/issue-11508.rs2
-rw-r--r--src/test/auxiliary/issue-11529.rs2
-rw-r--r--src/test/auxiliary/issue-11908-1.rs2
-rw-r--r--src/test/auxiliary/issue-11908-2.rs2
-rw-r--r--src/test/auxiliary/issue-2631-a.rs2
-rw-r--r--src/test/auxiliary/issue-7899.rs2
-rw-r--r--src/test/auxiliary/issue-8044.rs4
-rw-r--r--src/test/auxiliary/issue2378b.rs2
-rw-r--r--src/test/auxiliary/issue_10031_aux.rs2
-rw-r--r--src/test/auxiliary/issue_2316_b.rs4
-rw-r--r--src/test/auxiliary/issue_2472_b.rs2
-rw-r--r--src/test/auxiliary/issue_2723_a.rs2
-rw-r--r--src/test/auxiliary/kinds_in_metadata.rs4
-rw-r--r--src/test/auxiliary/lint_stability.rs28
-rw-r--r--src/test/auxiliary/logging_right_crate.rs4
-rw-r--r--src/test/auxiliary/macro_crate_outlive_expansion_phase.rs4
-rw-r--r--src/test/auxiliary/newtype_struct_xc.rs2
-rw-r--r--src/test/auxiliary/overloaded_autoderef_xc.rs2
-rw-r--r--src/test/auxiliary/privacy-tuple-struct.rs14
-rw-r--r--src/test/auxiliary/pub_use_xcrate1.rs2
-rw-r--r--src/test/auxiliary/struct-field-privacy.rs4
-rw-r--r--src/test/auxiliary/struct_destructuring_cross_crate.rs4
-rw-r--r--src/test/auxiliary/struct_variant_xc_aux.rs8
-rw-r--r--src/test/auxiliary/trait_default_method_xc_aux.rs2
-rw-r--r--src/test/auxiliary/trait_default_method_xc_aux_2.rs2
-rw-r--r--src/test/auxiliary/trait_inheritance_auto_xc_2_aux.rs2
-rw-r--r--src/test/auxiliary/trait_inheritance_cross_trait_call_xc_aux.rs2
-rw-r--r--src/test/auxiliary/trait_inheritance_overloading_xc.rs2
-rw-r--r--src/test/auxiliary/trait_superkinds_in_metadata.rs2
-rw-r--r--src/test/auxiliary/xc_private_method_lib.rs2
-rw-r--r--src/test/bench/core-std.rs6
-rw-r--r--src/test/bench/noise.rs15
-rw-r--r--src/test/bench/rt-spawn-rate.rs10
-rw-r--r--src/test/bench/shootout-fannkuch-redux.rs10
-rw-r--r--src/test/bench/shootout-k-nucleotide-pipes.rs3
-rw-r--r--src/test/bench/shootout-k-nucleotide.rs74
-rw-r--r--src/test/bench/shootout-meteor.rs6
-rw-r--r--src/test/bench/shootout-reverse-complement.rs10
-rw-r--r--src/test/bench/silly-test-spawn.rs14
-rw-r--r--src/test/bench/task-perf-alloc-unwind.rs9
-rw-r--r--src/test/compile-fail/asm-in-bad-modifier.rs2
-rw-r--r--src/test/compile-fail/asm-misplaced-option.rs4
-rw-r--r--src/test/compile-fail/asm-out-assign-imm.rs2
-rw-r--r--src/test/compile-fail/asm-out-no-modifier.rs2
-rw-r--r--src/test/compile-fail/asm-out-read-uninit.rs2
-rw-r--r--src/test/compile-fail/attr-bad-crate-attr.rc2
-rw-r--r--src/test/compile-fail/auto-ref-slice-plus-ref.rs2
-rw-r--r--src/test/compile-fail/autoderef-full-lval.rs2
-rw-r--r--src/test/compile-fail/bad-mid-path-type-params.rs2
-rw-r--r--src/test/compile-fail/borrowck-lend-flow-match.rs4
-rw-r--r--src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs2
-rw-r--r--src/test/compile-fail/borrowck-loan-rcvr.rs2
-rw-r--r--src/test/compile-fail/borrowck-move-out-of-static-item.rs4
-rw-r--r--src/test/compile-fail/borrowck-move-subcomponent.rs2
-rw-r--r--src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs2
-rw-r--r--src/test/compile-fail/borrowck-struct-update-with-dtor.rs4
-rw-r--r--src/test/compile-fail/box-static-bound.rs2
-rw-r--r--src/test/compile-fail/break-outside-loop.rs2
-rw-r--r--src/test/compile-fail/check-static-values-constraints.rs2
-rw-r--r--src/test/compile-fail/cleanup-rvalue-scopes-cf.rs2
-rw-r--r--src/test/compile-fail/deriving-primitive.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Clone-enum.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Clone-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Clone-tuple-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Default-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Default-tuple-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Eq-enum-struct-variant.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Eq-enum.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Eq-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Eq-tuple-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Hash-enum.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Hash-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Hash-tuple-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Ord-enum.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Ord-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Ord-tuple-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Rand-enum.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Rand-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Rand-tuple-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Show-enum.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Show-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Show-tuple-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs2
-rw-r--r--src/test/compile-fail/deriving-span-TotalEq-enum.rs2
-rw-r--r--src/test/compile-fail/deriving-span-TotalEq-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs2
-rw-r--r--src/test/compile-fail/deriving-span-TotalOrd-enum.rs2
-rw-r--r--src/test/compile-fail/deriving-span-TotalOrd-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Zero-struct.rs2
-rw-r--r--src/test/compile-fail/deriving-span-Zero-tuple-struct.rs2
-rw-r--r--src/test/compile-fail/drop-on-non-struct.rs2
-rw-r--r--src/test/compile-fail/dup-struct-enum-struct-variant.rs2
-rw-r--r--src/test/compile-fail/gated-bad-feature.rs12
-rw-r--r--src/test/compile-fail/gated-concat_idents.rs13
-rw-r--r--src/test/compile-fail/gated-default-type-param-usage.rs2
-rw-r--r--src/test/compile-fail/gated-non-ascii-idents.rs2
-rw-r--r--src/test/compile-fail/generic-impl-less-params-with-defaults.rs2
-rw-r--r--src/test/compile-fail/generic-impl-more-params-with-defaults.rs2
-rw-r--r--src/test/compile-fail/generic-non-trailing-defaults.rs2
-rw-r--r--src/test/compile-fail/generic-type-less-params-with-defaults.rs2
-rw-r--r--src/test/compile-fail/generic-type-more-params-with-defaults.rs2
-rw-r--r--src/test/compile-fail/generic-type-params-forward-mention.rs2
-rw-r--r--src/test/compile-fail/generic-type-params-name-repr.rs2
-rw-r--r--src/test/compile-fail/glob-resolve1.rs2
-rw-r--r--src/test/compile-fail/hygienic-label-1.rs2
-rw-r--r--src/test/compile-fail/hygienic-label-2.rs2
-rw-r--r--src/test/compile-fail/hygienic-label-3.rs2
-rw-r--r--src/test/compile-fail/hygienic-label-4.rs2
-rw-r--r--src/test/compile-fail/import-glob-0.rs4
-rw-r--r--src/test/compile-fail/import-glob-circular.rs4
-rw-r--r--src/test/compile-fail/indexing-requires-a-uint.rs25
-rw-r--r--src/test/compile-fail/integral-indexing.rs26
-rw-r--r--src/test/compile-fail/invalid-crate-type.rs2
-rw-r--r--src/test/compile-fail/issue-1697.rs2
-rw-r--r--src/test/compile-fail/issue-2063-resource.rs2
-rw-r--r--src/test/compile-fail/issue-2150.rs8
-rw-r--r--src/test/compile-fail/issue-3668.rs2
-rw-r--r--src/test/compile-fail/issue-3763.rs4
-rw-r--r--src/test/compile-fail/issue-4366-2.rs2
-rw-r--r--src/test/compile-fail/issue-4366.rs2
-rw-r--r--src/test/compile-fail/issue-5060-fail.rs2
-rw-r--r--src/test/compile-fail/issue-6804.rs2
-rw-r--r--src/test/compile-fail/issue-7013.rs4
-rw-r--r--src/test/compile-fail/issue-7061.rs2
-rw-r--r--src/test/compile-fail/issue-7246.rs4
-rw-r--r--src/test/compile-fail/issue-7364.rs2
-rw-r--r--src/test/compile-fail/issue-897-2.rs2
-rw-r--r--src/test/compile-fail/kindck-copy.rs86
-rw-r--r--src/test/compile-fail/kindck-destructor-owned.rs2
-rw-r--r--src/test/compile-fail/kindck-nonsendable-1.rs9
-rw-r--r--src/test/compile-fail/kindck-owned-trait-contains.rs4
-rw-r--r--src/test/compile-fail/kindck-pod.rs86
-rw-r--r--src/test/compile-fail/linkage2.rs2
-rw-r--r--src/test/compile-fail/linkage3.rs2
-rw-r--r--src/test/compile-fail/lint-allocation.rs2
-rw-r--r--src/test/compile-fail/lint-change-warnings.rs4
-rw-r--r--src/test/compile-fail/lint-ctypes-enum.rs4
-rw-r--r--src/test/compile-fail/lint-ctypes.rs2
-rw-r--r--src/test/compile-fail/lint-dead-code-1.rs12
-rw-r--r--src/test/compile-fail/lint-dead-code-2.rs4
-rw-r--r--src/test/compile-fail/lint-dead-code-3.rs8
-rw-r--r--src/test/compile-fail/lint-deprecated-owned-vector.rs2
-rw-r--r--src/test/compile-fail/lint-heap-memory.rs8
-rw-r--r--src/test/compile-fail/lint-impl-fn.rs4
-rw-r--r--src/test/compile-fail/lint-managed-heap-memory.rs4
-rw-r--r--src/test/compile-fail/lint-misplaced-attr.rs4
-rw-r--r--src/test/compile-fail/lint-missing-doc.rs30
-rw-r--r--src/test/compile-fail/lint-non-camel-case-types.rs4
-rw-r--r--src/test/compile-fail/lint-non-uppercase-statics.rs4
-rw-r--r--src/test/compile-fail/lint-obsolete-attr.rs4
-rw-r--r--src/test/compile-fail/lint-owned-heap-memory.rs2
-rw-r--r--src/test/compile-fail/lint-qualification.rs2
-rw-r--r--src/test/compile-fail/lint-raw-ptr-deriving.rs35
-rw-r--r--src/test/compile-fail/lint-stability.rs10
-rw-r--r--src/test/compile-fail/lint-type-limits.rs2
-rw-r--r--src/test/compile-fail/lint-type-overflow.rs2
-rw-r--r--src/test/compile-fail/lint-unknown-attr.rs4
-rw-r--r--src/test/compile-fail/lint-unknown-feature.rs4
-rw-r--r--src/test/compile-fail/lint-unnecessary-casts.rs2
-rw-r--r--src/test/compile-fail/lint-unnecessary-parens.rs2
-rw-r--r--src/test/compile-fail/lint-unsafe-block.rs8
-rw-r--r--src/test/compile-fail/lint-unused-import-tricky-globs.rs6
-rw-r--r--src/test/compile-fail/lint-unused-import-tricky-names.rs6
-rw-r--r--src/test/compile-fail/lint-unused-imports.rs12
-rw-r--r--src/test/compile-fail/lint-unused-mut-self.rs8
-rw-r--r--src/test/compile-fail/lint-unused-mut-variables.rs10
-rw-r--r--src/test/compile-fail/lint-unused-unsafe.rs6
-rw-r--r--src/test/compile-fail/lint-uppercase-variables.rs2
-rw-r--r--src/test/compile-fail/lint-visible-private-types.rs16
-rw-r--r--src/test/compile-fail/liveness-dead.rs4
-rw-r--r--src/test/compile-fail/liveness-return-last-stmt-semi.rs2
-rw-r--r--src/test/compile-fail/liveness-unused.rs6
-rw-r--r--src/test/compile-fail/macro-crate-unexported-macro.rs2
-rw-r--r--src/test/compile-fail/macro-crate-unknown-crate.rs2
-rw-r--r--src/test/compile-fail/macro-incomplete-parse.rs2
-rw-r--r--src/test/compile-fail/macro-inner-attributes.rs6
-rw-r--r--src/test/compile-fail/macro-outer-attributes.rs6
-rw-r--r--src/test/compile-fail/macros-nonfatal-errors.rs4
-rw-r--r--src/test/compile-fail/marker-no-copy.rs (renamed from src/test/compile-fail/marker-no-pod.rs)4
-rw-r--r--src/test/compile-fail/match-static-const-lc.rs4
-rw-r--r--src/test/compile-fail/moves-based-on-type-exprs.rs2
-rw-r--r--src/test/compile-fail/name-clash-nullary.rs4
-rw-r--r--src/test/compile-fail/no-implicit-prelude.rs2
-rw-r--r--src/test/compile-fail/no-send-res-ports.rs2
-rw-r--r--src/test/compile-fail/no_crate_type.rs2
-rw-r--r--src/test/compile-fail/occurs-check.rs2
-rw-r--r--src/test/compile-fail/once-cant-call-twice-on-heap.rs2
-rw-r--r--src/test/compile-fail/once-cant-call-twice-on-stack.rs2
-rw-r--r--src/test/compile-fail/once-fn-subtyping.rs2
-rw-r--r--src/test/compile-fail/phase-syntax-doesnt-resolve.rs2
-rw-r--r--src/test/compile-fail/pinned-deep-copy.rs2
-rw-r--r--src/test/compile-fail/privacy-ns1.rs6
-rw-r--r--src/test/compile-fail/privacy-ns2.rs6
-rw-r--r--src/test/compile-fail/privacy1.rs4
-rw-r--r--src/test/compile-fail/privacy2.rs4
-rw-r--r--src/test/compile-fail/privacy3.rs4
-rw-r--r--src/test/compile-fail/privacy4.rs4
-rw-r--r--src/test/compile-fail/privacy5.rs137
-rw-r--r--src/test/compile-fail/private-impl-method.rs2
-rw-r--r--src/test/compile-fail/private-struct-field-ctor.rs2
-rw-r--r--src/test/compile-fail/private-struct-field-pattern.rs2
-rw-r--r--src/test/compile-fail/private-struct-field.rs2
-rw-r--r--src/test/compile-fail/qquote-1.rs2
-rw-r--r--src/test/compile-fail/qquote-2.rs2
-rw-r--r--src/test/compile-fail/regions-infer-borrow-scope-too-big.rs2
-rw-r--r--src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs2
-rw-r--r--src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs2
-rw-r--r--src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs2
-rw-r--r--src/test/compile-fail/regions-infer-paramd-indirect.rs2
-rw-r--r--src/test/compile-fail/simd-experimental.rs2
-rw-r--r--src/test/compile-fail/simd-type.rs2
-rw-r--r--src/test/compile-fail/static-assert.rs2
-rw-r--r--src/test/compile-fail/static-assert2.rs2
-rw-r--r--src/test/compile-fail/static-items-cant-move.rs4
-rw-r--r--src/test/compile-fail/static-region-bound.rs2
-rw-r--r--src/test/compile-fail/std-uncopyable-atomics.rs2
-rw-r--r--src/test/compile-fail/struct-field-privacy.rs8
-rw-r--r--src/test/compile-fail/struct-like-enum-nonexhaustive.rs2
-rw-r--r--src/test/compile-fail/syntax-extension-fourcc-bad-len.rs2
-rw-r--r--src/test/compile-fail/syntax-extension-fourcc-invalid-endian.rs2
-rw-r--r--src/test/compile-fail/syntax-extension-fourcc-non-ascii-str.rs2
-rw-r--r--src/test/compile-fail/syntax-extension-fourcc-non-literal.rs2
-rw-r--r--src/test/compile-fail/syntax-extension-fourcc-unsupported-literal.rs2
-rw-r--r--src/test/compile-fail/syntax-extension-hexfloat-bad-lits.rs2
-rw-r--r--src/test/compile-fail/syntax-extension-hexfloat-bad-types.rs2
-rw-r--r--src/test/compile-fail/syntax-extension-minor.rs1
-rw-r--r--src/test/compile-fail/terr-sorts.rs2
-rw-r--r--src/test/compile-fail/trace_macros-format.rs2
-rw-r--r--src/test/compile-fail/trait-bounds-sugar.rs2
-rw-r--r--src/test/compile-fail/trait-impl-method-mismatch.rs2
-rw-r--r--src/test/compile-fail/unique-unique-kind.rs2
-rw-r--r--src/test/compile-fail/unique-vec-res.rs2
-rw-r--r--src/test/compile-fail/unreachable-code.rs4
-rw-r--r--src/test/compile-fail/unsafe-around-compiler-generated-unsafe.rs2
-rw-r--r--src/test/compile-fail/unsendable-class.rs2
-rw-r--r--src/test/compile-fail/unused-result.rs4
-rw-r--r--src/test/compile-fail/warn-foreign-int-types.rs4
-rw-r--r--src/test/compile-fail/wrong-mul-method-signature.rs33
-rw-r--r--src/test/debug-info/basic-types-globals-metadata.rs71
-rw-r--r--src/test/debug-info/basic-types-globals.rs75
-rw-r--r--src/test/debug-info/basic-types-metadata.rs3
-rw-r--r--src/test/debug-info/basic-types-mut-globals.rs129
-rw-r--r--src/test/debug-info/c-style-enum.rs70
-rw-r--r--src/test/debug-info/include_string.rs12
-rw-r--r--src/test/debug-info/lexical-scope-in-for-loop.rs1
-rw-r--r--src/test/debug-info/lexical-scope-in-if.rs1
-rw-r--r--src/test/debug-info/lexical-scope-in-match.rs1
-rw-r--r--src/test/debug-info/lexical-scopes-in-block-expression.rs132
-rw-r--r--src/test/debug-info/simd.rs2
-rw-r--r--src/test/debug-info/simple-struct.rs109
-rw-r--r--src/test/debug-info/simple-tuple.rs75
-rw-r--r--src/test/debug-info/var-captured-in-nested-closure.rs1
-rw-r--r--src/test/debug-info/vec-slices.rs13
-rw-r--r--src/test/debug-info/vec.rs11
-rw-r--r--src/test/pretty/attr-fn-inner.rs2
-rw-r--r--src/test/pretty/doc-comments.rs2
-rw-r--r--src/test/pretty/raw-str-nonexpr.rs2
-rw-r--r--src/test/run-fail/fail-macro-any.rs2
-rw-r--r--src/test/run-fail/glob-use-std.rs4
-rw-r--r--src/test/run-fail/rt-set-exit-status-fail.rs4
-rw-r--r--src/test/run-fail/rt-set-exit-status-fail2.rs4
-rw-r--r--src/test/run-fail/rt-set-exit-status.rs4
-rw-r--r--src/test/run-fail/unwind-box-fn-unique.rs2
-rw-r--r--src/test/run-fail/unwind-misc-1.rs2
-rw-r--r--src/test/run-make/crate-data-smoke/Makefile2
-rw-r--r--src/test/run-make/crate-data-smoke/crate.rs2
-rw-r--r--src/test/run-make/many-crates-but-no-match/Makefile34
-rw-r--r--src/test/run-make/many-crates-but-no-match/crateA1.rs14
-rw-r--r--src/test/run-make/many-crates-but-no-match/crateA2.rs14
-rw-r--r--src/test/run-make/many-crates-but-no-match/crateA3.rs14
-rw-r--r--src/test/run-make/many-crates-but-no-match/crateB.rs11
-rw-r--r--src/test/run-make/many-crates-but-no-match/crateC.rs (renamed from src/test/compile-fail/struct-variant-privacy.rs)11
-rw-r--r--src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs2
-rw-r--r--src/test/run-pass-fulldeps/macro-crate.rs2
-rw-r--r--src/test/run-pass-fulldeps/phase-syntax-link-does-resolve.rs2
-rw-r--r--src/test/run-pass-fulldeps/qquote.rs2
-rw-r--r--src/test/run-pass-fulldeps/quote-tokens.rs2
-rw-r--r--src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs2
-rw-r--r--src/test/run-pass-fulldeps/syntax-extension-fourcc.rs2
-rw-r--r--src/test/run-pass-fulldeps/syntax-extension-hexfloat.rs2
-rw-r--r--src/test/run-pass/alignment-gep-tup-like-1.rs4
-rw-r--r--src/test/run-pass/asm-concat-src.rs2
-rw-r--r--src/test/run-pass/asm-in-out-operand.rs2
-rw-r--r--src/test/run-pass/asm-out-assign.rs2
-rw-r--r--src/test/run-pass/assignability-trait.rs2
-rw-r--r--src/test/run-pass/backtrace.rs3
-rw-r--r--src/test/run-pass/builtin-superkinds-in-metadata.rs4
-rw-r--r--src/test/run-pass/can-copy-pod.rs4
-rw-r--r--src/test/run-pass/capturing-logging.rs4
-rw-r--r--src/test/run-pass/clone-with-exterior.rs2
-rw-r--r--src/test/run-pass/close-over-big-then-small-data.rs4
-rw-r--r--src/test/run-pass/conditional-debug-macro-off.rs2
-rw-r--r--src/test/run-pass/core-run-destroy.rs45
-rw-r--r--src/test/run-pass/cycle-collection.rs2
-rw-r--r--src/test/run-pass/empty-allocation-non-null.rs19
-rw-r--r--src/test/run-pass/export-glob-imports-target.rs2
-rw-r--r--src/test/run-pass/extern-fn-reachable.rs1
-rw-r--r--src/test/run-pass/fsu-moves-and-copies.rs24
-rw-r--r--src/test/run-pass/ifmt.rs2
-rw-r--r--src/test/run-pass/import-glob-0.rs2
-rw-r--r--src/test/run-pass/import-glob-crate.rs2
-rw-r--r--src/test/run-pass/import-in-block.rs4
-rw-r--r--src/test/run-pass/integral-indexing.rs28
-rw-r--r--src/test/run-pass/intrinsics-integer.rs2
-rw-r--r--src/test/run-pass/issue-12582.rs29
-rw-r--r--src/test/run-pass/issue-13027.rs170
-rw-r--r--src/test/run-pass/issue-2190-1.rs4
-rw-r--r--src/test/run-pass/issue-2526-a.rs2
-rw-r--r--src/test/run-pass/issue-3563-3.rs4
-rw-r--r--src/test/run-pass/issue-3609.rs2
-rw-r--r--src/test/run-pass/issue-3847.rs2
-rw-r--r--src/test/run-pass/issue-4016.rs4
-rw-r--r--src/test/run-pass/issue-4036.rs2
-rw-r--r--src/test/run-pass/issue-4830.rs2
-rw-r--r--src/test/run-pass/issue-980.rs4
-rw-r--r--src/test/run-pass/item-attributes.rs4
-rw-r--r--src/test/run-pass/kindck-owned-trait-contains-1.rs4
-rw-r--r--src/test/run-pass/kinds-in-metadata.rs2
-rw-r--r--src/test/run-pass/linkage1.rs2
-rw-r--r--src/test/run-pass/log-knows-the-names-of-variants-in-std.rs21
-rw-r--r--src/test/run-pass/logging-enabled-debug.rs2
-rw-r--r--src/test/run-pass/logging-enabled.rs2
-rw-r--r--src/test/run-pass/macro-attributes.rs4
-rw-r--r--src/test/run-pass/macro-crate-def-only.rs2
-rw-r--r--src/test/run-pass/macro-export-inner-module.rs2
-rw-r--r--src/test/run-pass/macro-meta-items.rs44
-rw-r--r--src/test/run-pass/method-attributes.rs4
-rw-r--r--src/test/run-pass/module-qualified-struct-destructure.rs4
-rw-r--r--src/test/run-pass/non-boolean-pure-fns.rs36
-rw-r--r--src/test/run-pass/out-of-stack.rs6
-rw-r--r--src/test/run-pass/overloaded-autoderef-order.rs4
-rw-r--r--src/test/run-pass/parameterized-trait-with-bounds.rs27
-rw-r--r--src/test/run-pass/phase-use-ignored.rs2
-rw-r--r--src/test/run-pass/privacy-ns.rs2
-rw-r--r--src/test/run-pass/reexport-star.rs2
-rw-r--r--src/test/run-pass/regions-early-bound-trait-param.rs135
-rw-r--r--src/test/run-pass/sendfn-spawn-with-fn-arg.rs2
-rw-r--r--src/test/run-pass/sigpipe-should-be-ignored.rs36
-rw-r--r--src/test/run-pass/simd-binop.rs4
-rw-r--r--src/test/run-pass/simd-generics.rs2
-rw-r--r--src/test/run-pass/simd-issue-10604.rs4
-rw-r--r--src/test/run-pass/simd-type.rs2
-rw-r--r--src/test/run-pass/tag-exports.rs2
-rw-r--r--src/test/run-pass/tcp-stress.rs2
-rw-r--r--src/test/run-pass/tempfile.rs6
-rw-r--r--src/test/run-pass/trait-bounds-basic.rs2
-rw-r--r--src/test/run-pass/trait-cast.rs6
-rw-r--r--src/test/run-pass/trait-default-method-xc.rs2
-rw-r--r--src/test/run-pass/uniq-cc-generic.rs7
-rw-r--r--src/test/run-pass/uniq-cc.rs2
-rw-r--r--src/test/run-pass/use.rs2
-rw-r--r--src/test/run-pass/utf8.rs2
-rw-r--r--src/test/run-pass/vec-concat.rs2
-rw-r--r--src/test/run-pass/vec-macro-with-brackets.rs23
-rw-r--r--src/test/run-pass/vector-sort-failure-safe.rs4
-rw-r--r--src/test/run-pass/warn-ctypes-inhibit.rs4
796 files changed, 11186 insertions, 10848 deletions
diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs
index 4d1f7ab5956..ea6e98fafa7 100644
--- a/src/compiletest/common.rs
+++ b/src/compiletest/common.rs
@@ -21,87 +21,87 @@ pub enum mode {
 #[deriving(Clone)]
 pub struct config {
     // The library paths required for running the compiler
-    compile_lib_path: ~str,
+    pub compile_lib_path: ~str,
 
     // The library paths required for running compiled programs
-    run_lib_path: ~str,
+    pub run_lib_path: ~str,
 
     // The rustc executable
-    rustc_path: Path,
+    pub rustc_path: Path,
 
     // The clang executable
-    clang_path: Option<Path>,
+    pub clang_path: Option<Path>,
 
     // The llvm binaries path
-    llvm_bin_path: Option<Path>,
+    pub llvm_bin_path: Option<Path>,
 
     // The directory containing the tests to run
-    src_base: Path,
+    pub src_base: Path,
 
     // The directory where programs should be built
-    build_base: Path,
+    pub build_base: Path,
 
     // Directory for auxiliary libraries
-    aux_base: Path,
+    pub aux_base: Path,
 
     // The name of the stage being built (stage1, etc)
-    stage_id: ~str,
+    pub stage_id: ~str,
 
     // The test mode, compile-fail, run-fail, run-pass
-    mode: mode,
+    pub mode: mode,
 
     // Run ignored tests
-    run_ignored: bool,
+    pub run_ignored: bool,
 
     // Only run tests that match this filter
-    filter: Option<~str>,
+    pub filter: Option<~str>,
 
     // Write out a parseable log of tests that were run
-    logfile: Option<Path>,
+    pub logfile: Option<Path>,
 
     // Write out a json file containing any metrics of the run
-    save_metrics: Option<Path>,
+    pub save_metrics: Option<Path>,
 
     // Write and ratchet a metrics file
-    ratchet_metrics: Option<Path>,
+    pub ratchet_metrics: Option<Path>,
 
     // Percent change in metrics to consider noise
-    ratchet_noise_percent: Option<f64>,
+    pub ratchet_noise_percent: Option<f64>,
 
-    // "Shard" of the testsuite to run: this has the form of
+    // "Shard" of the testsuite to pub run: this has the form of
     // two numbers (a,b), and causes only those tests with
     // positional order equal to a mod b to run.
-    test_shard: Option<(uint,uint)>,
+    pub test_shard: Option<(uint,uint)>,
 
     // A command line to prefix program execution with,
     // for running under valgrind
-    runtool: Option<~str>,
+    pub runtool: Option<~str>,
 
     // Flags to pass to the compiler when building for the host
-    host_rustcflags: Option<~str>,
+    pub host_rustcflags: Option<~str>,
 
     // Flags to pass to the compiler when building for the target
-    target_rustcflags: Option<~str>,
+    pub target_rustcflags: Option<~str>,
 
     // Run tests using the JIT
-    jit: bool,
+    pub jit: bool,
 
     // Target system to be tested
-    target: ~str,
+    pub target: ~str,
 
     // Host triple for the compiler being invoked
-    host: ~str,
+    pub host: ~str,
 
     // Extra parameter to run adb on arm-linux-androideabi
-    adb_path: ~str,
+    pub adb_path: ~str,
 
     // Extra parameter to run test sute on arm-linux-androideabi
-    adb_test_dir: ~str,
+    pub adb_test_dir: ~str,
 
     // status whether android device available or not
-    adb_device_status: bool,
+    pub adb_device_status: bool,
 
     // Explain what's going on
-    verbose: bool
+    pub verbose: bool
 
 }
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index 6c70362dbb3..1491555fea0 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[crate_type = "bin"];
-#[feature(phase)];
+#![crate_type = "bin"]
+#![feature(phase)]
 
-#[allow(non_camel_case_types)];
-#[deny(warnings)];
+#![allow(non_camel_case_types)]
+#![deny(warnings)]
 
 extern crate test;
 extern crate getopts;
diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs
index 285bad0fc4b..42b756271d4 100644
--- a/src/compiletest/errors.rs
+++ b/src/compiletest/errors.rs
@@ -10,7 +10,11 @@
 
 use std::io::{BufferedReader, File};
 
-pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
+pub struct ExpectedError {
+    pub line: uint,
+    pub kind: ~str,
+    pub msg: ~str,
+}
 
 // Load any test directives embedded in the file
 pub fn load_errors(testfile: &Path) -> Vec<ExpectedError> {
diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs
index f6ae45d766a..b45a68518a3 100644
--- a/src/compiletest/header.rs
+++ b/src/compiletest/header.rs
@@ -14,26 +14,26 @@ use util;
 
 pub struct TestProps {
     // Lines that should be expected, in order, on standard out
-    error_patterns: Vec<~str> ,
+    pub error_patterns: Vec<~str> ,
     // Extra flags to pass to the compiler
-    compile_flags: Option<~str>,
+    pub compile_flags: Option<~str>,
     // If present, the name of a file that this test should match when
     // pretty-printed
-    pp_exact: Option<Path>,
+    pub pp_exact: Option<Path>,
     // Modules from aux directory that should be compiled
-    aux_builds: Vec<~str> ,
+    pub aux_builds: Vec<~str> ,
     // Environment settings to use during execution
-    exec_env: Vec<(~str,~str)> ,
+    pub exec_env: Vec<(~str,~str)> ,
     // Commands to be given to the debugger, when testing debug info
-    debugger_cmds: Vec<~str> ,
+    pub debugger_cmds: Vec<~str> ,
     // Lines to check if they appear in the expected debugger output
-    check_lines: Vec<~str> ,
+    pub check_lines: Vec<~str> ,
     // Flag to force a crate to be built with the host architecture
-    force_host: bool,
+    pub force_host: bool,
     // Check stdout for error-pattern output as well as stderr
-    check_stdout: bool,
+    pub check_stdout: bool,
     // Don't force a --crate-type=dylib flag on the command line
-    no_prefer_dynamic: bool,
+    pub no_prefer_dynamic: bool,
 }
 
 // Load any test directives embedded in the file
diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs
index 78ff059a67f..34918e39182 100644
--- a/src/compiletest/procsrv.rs
+++ b/src/compiletest/procsrv.rs
@@ -11,26 +11,27 @@
 use std::os;
 use std::str;
 use std::io::process::{ProcessExit, Process, ProcessConfig, ProcessOutput};
-use std::vec;
 
 #[cfg(target_os = "win32")]
-fn target_env(lib_path: &str, prog: &str) -> Vec<(~str,~str)> {
-
-    let mut env = os::env();
+fn target_env(lib_path: &str, prog: &str) -> Vec<(~str, ~str)> {
+    let env = os::env();
 
     // Make sure we include the aux directory in the path
     assert!(prog.ends_with(".exe"));
     let aux_path = prog.slice(0u, prog.len() - 4u).to_owned() + ".libaux";
 
-    env = env.map(|pair| {
-        let (k,v) = (*pair).clone();
-        if k == ~"PATH" { (~"PATH", v + ";" + lib_path + ";" + aux_path) }
-        else { (k,v) }
-    });
+    let mut new_env: Vec<_> = env.move_iter().map(|(k, v)| {
+        let new_v = if "PATH" == k {
+            format!("{};{};{}", v, lib_path, aux_path)
+        } else {
+            v
+        };
+        (k, new_v)
+    }).collect();
     if prog.ends_with("rustc.exe") {
-        env.push((~"RUST_THREADS", ~"1"));
+        new_env.push((~"RUST_THREADS", ~"1"));
     }
-    return env;
+    return new_env;
 }
 
 #[cfg(target_os = "linux")]
@@ -58,7 +59,7 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(~str,~str)> {
     return env;
 }
 
-pub struct Result {status: ProcessExit, out: ~str, err: ~str}
+pub struct Result {pub status: ProcessExit, pub out: ~str, pub err: ~str}
 
 pub fn run(lib_path: &str,
            prog: &str,
@@ -66,8 +67,7 @@ pub fn run(lib_path: &str,
            env: Vec<(~str, ~str)> ,
            input: Option<~str>) -> Option<Result> {
 
-    let env = vec::append(env.clone(),
-                             target_env(lib_path, prog).as_slice());
+    let env = env.clone().append(target_env(lib_path, prog).as_slice());
     let mut opt_process = Process::configure(ProcessConfig {
         program: prog,
         args: args,
@@ -98,8 +98,7 @@ pub fn run_background(lib_path: &str,
            env: Vec<(~str, ~str)> ,
            input: Option<~str>) -> Option<Process> {
 
-    let env = vec::append(env.clone(),
-                             target_env(lib_path, prog).as_slice());
+    let env = env.clone().append(target_env(lib_path, prog).as_slice());
     let opt_process = Process::configure(ProcessConfig {
         program: prog,
         args: args,
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 3b8c86b7c41..e057909a06c 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -33,7 +33,6 @@ use std::os;
 use std::str;
 use std::task;
 use std::slice;
-use std::vec;
 use test::MetricMap;
 
 pub fn run(config: config, testfile: ~str) {
@@ -530,7 +529,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
                 c
             }
         } ).collect();
-        str::from_chars( c )
+        str::from_chars(c.as_slice())
     }
 
     #[cfg(target_os = "win32")]
@@ -683,7 +682,7 @@ fn compile_test_(config: &config, props: &TestProps,
     let link_args = vec!(~"-L", aux_dir.as_str().unwrap().to_owned());
     let args = make_compile_args(config,
                                  props,
-                                 vec::append(link_args, extra_args),
+                                 link_args.append(extra_args),
                                  |a, b| ThisFile(make_exe_name(a, b)), testfile);
     compose_and_run_compiler(config, props, testfile, args, None)
 }
@@ -734,8 +733,7 @@ fn compose_and_run_compiler(
         let aux_args =
             make_compile_args(config,
                               &aux_props,
-                              vec::append(crate_type,
-                                             extra_link_args.as_slice()),
+                              crate_type.append(extra_link_args.as_slice()),
                               |a,b| {
                                   let f = make_lib_name(a, b, testfile);
                                   ThisDirectory(f.dir_path())
@@ -1108,8 +1106,7 @@ fn compile_test_and_save_bitcode(config: &config, props: &TestProps,
     let llvm_args = vec!(~"--emit=obj", ~"--crate-type=lib", ~"-C", ~"save-temps");
     let args = make_compile_args(config,
                                  props,
-                                 vec::append(link_args,
-                                                llvm_args.as_slice()),
+                                 link_args.append(llvm_args.as_slice()),
                                  |a, b| ThisFile(make_o_name(a, b)), testfile);
     compose_and_run_compiler(config, props, testfile, args, None)
 }
diff --git a/src/doc/README.md b/src/doc/README.md
index be0938022d2..40980ee0560 100644
--- a/src/doc/README.md
+++ b/src/doc/README.md
@@ -53,12 +53,12 @@ To generate .pot and .po files, do something like:
 ~~~~
 po4a --copyright-holder="The Rust Project Developers" \
     --package-name="Rust" \
-    --package-version="0.10-pre" \
+    --package-version="0.11-pre" \
     -M UTF-8 -L UTF-8 \
     src/doc/po4a.conf
 ~~~~
 
-(the version number must be changed if it is not 0.10-pre now.)
+(the version number must be changed if it is not 0.11-pre now.)
 
 Now you can translate documents with .po files, commonly used with gettext. If
 you are not familiar with gettext-based translation, please read the online
diff --git a/src/doc/complement-lang-faq.md b/src/doc/complement-lang-faq.md
index 5b38ef5645e..3053c90217f 100644
--- a/src/doc/complement-lang-faq.md
+++ b/src/doc/complement-lang-faq.md
@@ -31,10 +31,10 @@ You may also be interested in browsing [GitHub's Rust][github-rust] page.
 
 ## Does it run on Windows?
 
-Yes. All development happens in lock-step on all 3 target platforms. Using MinGW, not Cygwin. Note that the windows implementation currently has some limitations: in particular tasks [cannot unwind on windows][unwind], and all Rust executables [require a MinGW installation at runtime][libgcc].
+Yes. All development happens in lock-step on all 3 target platforms. Using MinGW, not Cygwin. Note that the windows implementation currently has some limitations: in particular 64-bit build is [not fully supported yet][win64], and all executables created by rustc [depends on libgcc DLL at runtime][libgcc].
 
-[unwind]: https://github.com/mozilla/rust/issues/908
-[libgcc]: https://github.com/mozilla/rust/issues/1603
+[win64]: https://github.com/mozilla/rust/issues/1237
+[libgcc]: https://github.com/mozilla/rust/issues/11782
 
 ## Is it OO? How do I do this thing I normally do in an OO language?
 
diff --git a/src/doc/guide-container.md b/src/doc/guide-container.md
index dbf8c6512d4..861aba57ec3 100644
--- a/src/doc/guide-container.md
+++ b/src/doc/guide-container.md
@@ -278,7 +278,7 @@ vectors is as follows:
 
 ~~~ {.ignore}
 impl<A> FromIterator<A> for ~[A] {
-    pub fn from_iterator<T: Iterator<A>>(iterator: &mut T) -> ~[A] {
+    pub fn from_iter<T: Iterator<A>>(iterator: &mut T) -> ~[A] {
         let (lower, _) = iterator.size_hint();
         let mut xs = with_capacity(lower);
         for x in iterator {
diff --git a/src/doc/guide-pointers.md b/src/doc/guide-pointers.md
index 19696b42a37..76e3b521957 100644
--- a/src/doc/guide-pointers.md
+++ b/src/doc/guide-pointers.md
@@ -332,8 +332,6 @@ sense, they're simple: just keep whatever ownership the data already has. For
 example:
 
 ~~~rust
-use std::num::sqrt;
-
 struct Point {
     x: f32,
     y: f32,
@@ -343,7 +341,7 @@ fn compute_distance(p1: &Point, p2: &Point) -> f32 {
     let x_d = p1.x - p2.x;
     let y_d = p1.y - p2.y;
 
-    sqrt(x_d * x_d + y_d * y_d)
+    (x_d * x_d + y_d * y_d).sqrt()
 }
 
 fn main() {
diff --git a/src/doc/guide-runtime.md b/src/doc/guide-runtime.md
index b52c520761e..2efb2ae8a8a 100644
--- a/src/doc/guide-runtime.md
+++ b/src/doc/guide-runtime.md
@@ -216,8 +216,7 @@ into the pool of schedulers in order to spawn a new task.
 
 With two implementations of the runtime available, a choice obviously needs to
 be made to see which will be used. The compiler itself will always by-default
-link to one of these runtimes. At the time of this writing, the default runtime
-is `libgreen` but in the future this will become `libnative`.
+link to one of these runtimes.
 
 Having a default decision made in the compiler is done out of necessity and
 convenience. The compiler's decision of runtime to link to is *not* an
diff --git a/src/doc/guide-unsafe.md b/src/doc/guide-unsafe.md
index 9835e50d547..47b629ac4d0 100644
--- a/src/doc/guide-unsafe.md
+++ b/src/doc/guide-unsafe.md
@@ -200,7 +200,7 @@ use std::ptr;
 // Unique<T> has the same semantics as ~T
 pub struct Unique<T> {
     // It contains a single raw, mutable pointer to the object in question.
-    priv ptr: *mut T
+    ptr: *mut T
 }
 
 // Implement methods for creating and using the values in the box.
@@ -294,7 +294,7 @@ asm!(assembly template
    );
 ```
 
-Any use of `asm` is feature gated (requires `#[feature(asm)];` on the
+Any use of `asm` is feature gated (requires `#![feature(asm)]` on the
 crate to allow) and of course requires an `unsafe` block.
 
 > **Note**: the examples here are given in x86/x86-64 assembly, but all
@@ -306,7 +306,7 @@ The `assembly template` is the only required parameter and must be a
 literal string (i.e `""`)
 
 ```
-#[feature(asm)];
+#![feature(asm)]
 
 #[cfg(target_arch = "x86")]
 #[cfg(target_arch = "x86_64")]
@@ -334,7 +334,7 @@ Output operands, input operands, clobbers and options are all optional
 but you must add the right number of `:` if you skip them:
 
 ```
-# #[feature(asm)];
+# #![feature(asm)]
 # #[cfg(target_arch = "x86")] #[cfg(target_arch = "x86_64")]
 # fn main() { unsafe {
 asm!("xor %eax, %eax"
@@ -348,7 +348,7 @@ asm!("xor %eax, %eax"
 Whitespace also doesn't matter:
 
 ```
-# #[feature(asm)];
+# #![feature(asm)]
 # #[cfg(target_arch = "x86")] #[cfg(target_arch = "x86_64")]
 # fn main() { unsafe {
 asm!("xor %eax, %eax" ::: "eax");
@@ -362,7 +362,7 @@ Input and output operands follow the same format: `:
 expressions must be mutable lvalues:
 
 ```
-# #[feature(asm)];
+# #![feature(asm)]
 # #[cfg(target_arch = "x86")] #[cfg(target_arch = "x86_64")]
 fn add(a: int, b: int) -> int {
     let mut c = 0;
@@ -390,7 +390,7 @@ compiler not to assume any values loaded into those registers will
 stay valid.
 
 ```
-# #[feature(asm)];
+# #![feature(asm)]
 # #[cfg(target_arch = "x86")] #[cfg(target_arch = "x86_64")]
 # fn main() { unsafe {
 // Put the value 0x200 in eax
@@ -595,7 +595,7 @@ Other features provided by lang items include:
 - stack unwinding and general failure; the `eh_personality`, `fail_`
   and `fail_bounds_checks` lang items.
 - the traits in `std::kinds` used to indicate types that satisfy
-  various kinds; lang items `send`, `share` and `pod`.
+  various kinds; lang items `send`, `share` and `copy`.
 - the marker types and variance indicators found in
   `std::kinds::markers`; lang items `covariant_type`,
   `contravariant_lifetime`, `no_share_bound`, etc.
diff --git a/src/doc/po/ja/complement-cheatsheet.md.po b/src/doc/po/ja/complement-cheatsheet.md.po
index 72ef1d5a010..55dfacfe51e 100644
--- a/src/doc/po/ja/complement-cheatsheet.md.po
+++ b/src/doc/po/ja/complement-cheatsheet.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
@@ -20,14 +20,14 @@ msgstr ""
 #: src/doc/complement-cheatsheet.md:8
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "Use [`ToStr`](http://static.rust-lang.org/doc/master/std/to_str/trait.ToStr."
 "html)."
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/complement-cheatsheet.md:13
@@ -46,15 +46,15 @@ msgstr ""
 #: src/doc/complement-cheatsheet.md:17
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "Use [`FromStr`](http://static.rust-lang.org/doc/master/std/from_str/trait."
 "FromStr.html), and its helper function, [`from_str`](http://static.rust-lang."
 "org/doc/master/std/from_str/fn.from_str.html)."
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/complement-cheatsheet.md:22
@@ -73,14 +73,14 @@ msgstr ""
 #: src/doc/complement-cheatsheet.md:26
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "Use [`ToStrRadix`](http://static.rust-lang.org/doc/master/std/num/trait."
 "ToStrRadix.html)."
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/complement-cheatsheet.md:29
@@ -108,15 +108,15 @@ msgstr ""
 #: src/doc/complement-cheatsheet.md:37
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "Use [`FromStrRadix`](http://static.rust-lang.org/doc/master/std/num/trait."
 "FromStrRadix.html), and its helper function, [`from_str_radix`](http://"
 "static.rust-lang.org/doc/master/std/num/fn.from_str_radix.html)."
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/complement-cheatsheet.md:40
@@ -153,16 +153,16 @@ msgstr "## 演算子"
 #: src/doc/complement-cheatsheet.md:50
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "Use [`File::open`](http://static.rust-lang.org/doc/master/std/io/fs/struct."
 "File.html#method.open) to create a [`File`](http://static.rust-lang.org/doc/"
 "master/std/io/fs/struct.File.html) struct, which implements the [`Reader`]"
 "(http://static.rust-lang.org/doc/master/std/io/trait.Reader.html) trait."
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/complement-cheatsheet.md:54
@@ -177,15 +177,15 @@ msgstr ""
 #: src/doc/complement-cheatsheet.md:63
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "Use the [`lines`](http://static.rust-lang.org/doc/master/std/io/trait.Buffer."
 "html#method.lines) method on a [`BufferedReader`](http://static.rust-lang."
 "org/doc/master/std/io/buffered/struct.BufferedReader.html)."
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/complement-cheatsheet.md:67
@@ -207,14 +207,14 @@ msgstr "## 他のクレートの利用"
 #: src/doc/complement-cheatsheet.md:81
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "Use the [`find_str`](http://static.rust-lang.org/doc/master/std/str/trait."
 "StrSlice.html#tymethod.find_str) method."
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/complement-cheatsheet.md:88 src/doc/guide-container.md:4
@@ -226,34 +226,34 @@ msgstr "## 本書の表記について"
 #: src/doc/complement-cheatsheet.md:92
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "The [`Container`](http://static.rust-lang.org/doc/master/std/container/trait."
 "Container.html) trait provides the `len` method."
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/complement-cheatsheet.md:104
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "Use the [`iter`](http://static.rust-lang.org/doc/master/std/vec/trait."
 "ImmutableVector.html#tymethod.iter) method."
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/complement-cheatsheet.md:113
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "(See also [`mut_iter`](http://static.rust-lang.org/doc/master/std/vec/trait."
 "MutableVector.html#tymethod.mut_iter) which yields `&mut int` and "
@@ -261,8 +261,8 @@ msgid ""
 "OwnedVector.html#tymethod.move_iter) which yields `int` while consuming the "
 "`values` vector.)"
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/complement-cheatsheet.md:115 src/doc/rust.md:3019
diff --git a/src/doc/po/ja/complement-lang-faq.md.po b/src/doc/po/ja/complement-lang-faq.md.po
index 02dee63f312..1f324ac2a9e 100644
--- a/src/doc/po/ja/complement-lang-faq.md.po
+++ b/src/doc/po/ja/complement-lang-faq.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/complement-project-faq.md.po b/src/doc/po/ja/complement-project-faq.md.po
index 190f88cf80d..5060a77a128 100644
--- a/src/doc/po/ja/complement-project-faq.md.po
+++ b/src/doc/po/ja/complement-project-faq.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/complement-usage-faq.md.po b/src/doc/po/ja/complement-usage-faq.md.po
index 9ffdd7b1f43..aa3ed6effa0 100644
--- a/src/doc/po/ja/complement-usage-faq.md.po
+++ b/src/doc/po/ja/complement-usage-faq.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-02-03 08:13+0900\n"
 "Last-Translator: Automatically generated\n"
@@ -27,9 +27,9 @@ msgstr "## 構造体"
 #: src/doc/complement-usage-faq.md:18
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid "[1]:http://doc.rust-lang.org/doc/master/rust.html#logging-system"
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
diff --git a/src/doc/po/ja/guide-conditions.md.po b/src/doc/po/ja/guide-conditions.md.po
index a65d6eec419..0e84562c22c 100644
--- a/src/doc/po/ja/guide-conditions.md.po
+++ b/src/doc/po/ja/guide-conditions.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/guide-container.md.po b/src/doc/po/ja/guide-container.md.po
index 23e1c7734f0..035a482cad9 100644
--- a/src/doc/po/ja/guide-container.md.po
+++ b/src/doc/po/ja/guide-container.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/guide-ffi.md.po b/src/doc/po/ja/guide-ffi.md.po
index 3155b9f6505..6c5f56bfedc 100644
--- a/src/doc/po/ja/guide-ffi.md.po
+++ b/src/doc/po/ja/guide-ffi.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/guide-lifetimes.md.po b/src/doc/po/ja/guide-lifetimes.md.po
index bbe4b3a4a85..5d7246ede47 100644
--- a/src/doc/po/ja/guide-lifetimes.md.po
+++ b/src/doc/po/ja/guide-lifetimes.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/guide-macros.md.po b/src/doc/po/ja/guide-macros.md.po
index 82b0d20d5e5..5501b98f6e9 100644
--- a/src/doc/po/ja/guide-macros.md.po
+++ b/src/doc/po/ja/guide-macros.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/guide-pointers.md.po b/src/doc/po/ja/guide-pointers.md.po
index 2b130821c4c..0e421f5c7b1 100644
--- a/src/doc/po/ja/guide-pointers.md.po
+++ b/src/doc/po/ja/guide-pointers.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/guide-runtime.md.po b/src/doc/po/ja/guide-runtime.md.po
index 2e02fe344eb..c85dd997c43 100644
--- a/src/doc/po/ja/guide-runtime.md.po
+++ b/src/doc/po/ja/guide-runtime.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-02-03 08:13+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/guide-tasks.md.po b/src/doc/po/ja/guide-tasks.md.po
index ab761ca4ea7..6fbb80f0fa5 100644
--- a/src/doc/po/ja/guide-tasks.md.po
+++ b/src/doc/po/ja/guide-tasks.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/guide-testing.md.po b/src/doc/po/ja/guide-testing.md.po
index 6ec1a4467da..e4d123c8118 100644
--- a/src/doc/po/ja/guide-testing.md.po
+++ b/src/doc/po/ja/guide-testing.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/index.md.po b/src/doc/po/ja/index.md.po
index 7bf6868ceed..afe30505c8c 100644
--- a/src/doc/po/ja/index.md.po
+++ b/src/doc/po/ja/index.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-14 21:02+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/rust.md.po b/src/doc/po/ja/rust.md.po
index 0e96f4db84b..de0164cc6b6 100644
--- a/src/doc/po/ja/rust.md.po
+++ b/src/doc/po/ja/rust.md.po
@@ -1,5 +1,5 @@
 # Japanese translations for Rust package
-# Copyright (C) 2013 The Rust Project Developers
+# Copyright (C) 2013-2014 The Rust Project Developers
 # This file is distributed under the same license as the Rust package.
 # Automatically generated, 2013.
 #
@@ -886,7 +886,7 @@ msgstr ""
 #: src/doc/rust.md:2008
 #, fuzzy
 #| msgid "~~~~ use std::task::spawn;"
-msgid "~~~~ {.ignore} #[warn(unstable)];"
+msgid "~~~~ {.ignore} #![warn(unstable)]"
 msgstr ""
 "~~~~\n"
 "use std::task::spawn;"
diff --git a/src/doc/po/ja/rustdoc.md.po b/src/doc/po/ja/rustdoc.md.po
index e0d89edaa02..d775929df5d 100644
--- a/src/doc/po/ja/rustdoc.md.po
+++ b/src/doc/po/ja/rustdoc.md.po
@@ -5,7 +5,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Rust 0.10-pre\n"
+"Project-Id-Version: Rust 0.11-pre\n"
 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
 "Last-Translator: Automatically generated\n"
diff --git a/src/doc/po/ja/tutorial.md.po b/src/doc/po/ja/tutorial.md.po
index 2646460346b..f17d3df9c1c 100644
--- a/src/doc/po/ja/tutorial.md.po
+++ b/src/doc/po/ja/tutorial.md.po
@@ -356,17 +356,17 @@ msgstr "上記条件を満たしていれば、以下のような手順でビル
 #: src/doc/tutorial.md:112
 #, fuzzy
 #| msgid ""
-#| "~~~~ {.notrust} $ curl -O http://static.rust-lang.org/dist/rust-0.7.tar."
-#| "gz $ tar -xzf rust-0.7.tar.gz $ cd rust-0.7 $ ./configure $ make && make "
+#| "~~~~ {.notrust} $ curl -O http://static.rust-lang.org/dist/rust-nightly.tar."
+#| "gz $ tar -xzf rust-nightly.tar.gz $ cd rust-nightly $ ./configure $ make && make "
 #| "install ~~~~"
 msgid ""
-"~~~~ {.notrust} $ curl -O http://static.rust-lang.org/dist/rust-0.9.tar.gz $ "
-"tar -xzf rust-0.9.tar.gz $ cd rust-0.9 $ ./configure $ make && make install "
+"~~~~ {.notrust} $ curl -O http://static.rust-lang.org/dist/rust-nightly.tar.gz $ "
+"tar -xzf rust-nightly.tar.gz $ cd rust-nightly $ ./configure $ make && make install "
 "~~~~"
 msgstr ""
 "~~~~ {.notrust}\n"
-"$ curl -O http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"$ tar -xzf rust-0.7.tar.gz $ cd rust-0.7 $ ./configure\n"
+"$ curl -O http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"$ tar -xzf rust-nightly.tar.gz $ cd rust-nightly $ ./configure\n"
 "$ make && make install\n"
 "~~~~"
 
@@ -405,14 +405,14 @@ msgstr ""
 #: src/doc/tutorial.md:125
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.9.tar.gz [win-exe]: "
-"http://static.rust-lang.org/dist/rust-0.9-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+"http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/tutorial.md:127
@@ -1002,14 +1002,14 @@ msgstr ""
 #: src/doc/tutorial.md:385
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "[transmute]: http://static.rust-lang.org/doc/master/std/cast/fn.transmute."
 "html"
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/tutorial.md:387
@@ -1078,14 +1078,14 @@ msgstr ""
 #: src/doc/tutorial.md:412
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "[pf]: http://en.cppreference.com/w/cpp/io/c/fprintf [fmt]: http://static."
 "rust-lang.org/doc/master/std/fmt/index.html"
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/tutorial.md:416
@@ -2161,14 +2161,14 @@ msgstr ""
 #: src/doc/tutorial.md:944
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "[gc]: http://static.rust-lang.org/doc/master/std/gc/struct.Gc.html [rc]: "
 "http://static.rust-lang.org/doc/master/std/rc/struct.Rc.html"
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/tutorial.md:946
@@ -2553,14 +2553,14 @@ msgstr ""
 #: src/doc/tutorial.md:1461
 #, fuzzy
 #| msgid ""
-#| "[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz [win-exe]: "
-#| "http://static.rust-lang.org/dist/rust-0.7-install.exe"
+#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
+#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
 "[refcell]: http://static.rust-lang.org/doc/master/std/cell/struct.RefCell."
 "html"
 msgstr ""
-"[tarball]: http://static.rust-lang.org/dist/rust-0.7.tar.gz\n"
-"[win-exe]: http://static.rust-lang.org/dist/rust-0.7-install.exe"
+"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
+"[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe"
 
 #. type: Plain text
 #: src/doc/tutorial.md:1463
diff --git a/src/doc/rust.md b/src/doc/rust.md
index ef66fc7abe2..96ec52c8cf9 100644
--- a/src/doc/rust.md
+++ b/src/doc/rust.md
@@ -153,7 +153,7 @@ Some productions are defined by exclusion of particular Unicode characters:
 ~~~~ {.notrust .ebnf .gram}
 comment : block_comment | line_comment ;
 block_comment : "/*" block_comment_body * '*' + '/' ;
-block_comment_body : (block_comment | character) * ;
+block_comment_body : [block_comment | character] * ;
 line_comment : "//" non_eol * ;
 ~~~~
 
@@ -205,13 +205,13 @@ The keywords are the following strings:
 ~~~~ {.notrust .keyword}
 as
 break
-do
+crate
 else enum extern
 false fn for
 if impl in
 let loop
 match mod mut
-priv pub
+priv proc pub
 ref return
 self static struct super
 true trait type
@@ -496,16 +496,16 @@ All of the above extensions are expressions with values.
 ## Macros
 
 ~~~~ {.notrust .ebnf .gram}
-expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')'
-macro_rule : '(' matcher * ')' "=>" '(' transcriber * ')' ';'
+expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')' ;
+macro_rule : '(' matcher * ')' "=>" '(' transcriber * ')' ';' ;
 matcher : '(' matcher * ')' | '[' matcher * ']'
         | '{' matcher * '}' | '$' ident ':' ident
         | '$' '(' matcher * ')' sep_token? [ '*' | '+' ]
-        | non_special_token
+        | non_special_token ;
 transcriber : '(' transcriber * ')' | '[' transcriber * ']'
             | '{' transcriber * '}' | '$' ident
             | '$' '(' transcriber * ')' sep_token? [ '*' | '+' ]
-            | non_special_token
+            | non_special_token ;
 ~~~~
 
 User-defined syntax extensions are called "macros",
@@ -609,20 +609,20 @@ and may optionally begin with any number of `attributes` that apply to the conta
 Attributes on the anonymous crate module define important metadata that influences
 the behavior of the compiler.
 
-~~~~
-// Package ID
-#[ crate_id = "projx#2.5" ];
+~~~~ {.rust}
+// Crate ID
+#![crate_id = "projx#2.5"]
 
 // Additional metadata attributes
-#[ desc = "Project X" ];
-#[ license = "BSD" ];
-#[ comment = "This is a comment on Project X." ];
+#![desc = "Project X"]
+#![license = "BSD"]
+#![comment = "This is a comment on Project X."]
 
 // Specify the output type
-#[ crate_type = "lib" ];
+#![crate_type = "lib"]
 
 // Turn on a warning
-#[ warn(non_camel_case_types) ];
+#![warn(non_camel_case_types)]
 ~~~~
 
 A crate that contains a `main` function can be compiled to an executable.
@@ -791,7 +791,7 @@ extern crate std; // equivalent to: extern crate std = "std";
 
 extern crate ruststd = "std"; // linking to 'std' under another name
 
-extern crate foo = "some/where/rust-foo#foo:1.0"; // a full package ID for external tools
+extern crate foo = "some/where/rust-foo#foo:1.0"; // a full crate ID for external tools
 ~~~~
 
 ##### Use declarations
@@ -802,7 +802,7 @@ use_decl : "pub" ? "use" ident [ '=' path
 
 path_glob : ident [ "::" path_glob ] ?
           | '*'
-          | '{' ident [ ',' ident ] * '}'
+          | '{' ident [ ',' ident ] * '}' ;
 ~~~~
 
 A _use declaration_ creates one or more local name bindings synonymous
@@ -825,14 +825,14 @@ Use declarations support a number of convenient shortcuts:
 An example of `use` declarations:
 
 ~~~~
-use std::num::sin;
+use std::iter::range_step;
 use std::option::{Some, None};
 
 # fn foo<T>(_: T){}
 
 fn main() {
-    // Equivalent to 'std::num::sin(1.0);'
-    sin(1.0);
+    // Equivalent to 'std::iter::range_step(0, 10, 2);'
+    range_step(0, 10, 2);
 
     // Equivalent to 'foo(~[std::option::Some(1.0), std::option::None]);'
     foo(~[Some(1.0), None]);
@@ -874,7 +874,7 @@ and `extern crate` declarations.
 An example of what will and will not work for `use` items:
 
 ~~~~
-# #[allow(unused_imports)];
+# #![allow(unused_imports)]
 use foo::native::start;  // good: foo is at the root of the crate
 use foo::baz::foobaz;    // good: foo is at the root of the crate
 
@@ -1457,7 +1457,7 @@ impl Seq<bool> for u32 {
 ### External blocks
 
 ~~~~ {.notrust .ebnf .gram}
-extern_block_item : "extern" '{' extern_block '} ;
+extern_block_item : "extern" '{' extern_block '}' ;
 extern_block : [ foreign_fn ] * ;
 ~~~~
 
@@ -1504,11 +1504,9 @@ specified name.
 extern { }
 ~~~~
 
-The type of a function
-declared in an extern block
-is `extern "abi" fn(A1, ..., An) -> R`,
-where `A1...An` are the declared types of its arguments
-and `R` is the decalred return type.
+The type of a function declared in an extern block is `extern "abi" fn(A1,
+..., An) -> R`, where `A1...An` are the declared types of its arguments and
+`R` is the declared return type.
 
 ## Visibility and Privacy
 
@@ -1526,12 +1524,9 @@ of an item to see whether it should be allowed or not. This is where privacy
 warnings are generated, or otherwise "you used a private item of another module
 and weren't allowed to."
 
-By default, everything in rust is *private*, with two exceptions. The first
-exception is that struct fields are public by default (but the struct itself is
-still private by default), and the remaining exception is that enum variants in
-a `pub` enum are the default visibility of the enum container itself.. You are
-allowed to alter this default visibility with the `pub` keyword (or `priv`
-keyword for struct fields and enum variants). When an item is declared as `pub`,
+By default, everything in rust is *private*, with one exception. Enum variants
+in a `pub` enum are also public by default. You are allowed to alter this
+default visibility with the `priv` keyword. When an item is declared as `pub`,
 it can be thought of as being accessible to the outside world. For example:
 
 ~~~~
@@ -1541,7 +1536,7 @@ struct Foo;
 
 // Declare a public struct with a private field
 pub struct Bar {
-    priv field: int
+    field: int
 }
 
 // Declare a public enum with public and private variants
@@ -1682,77 +1677,139 @@ import public items from their destination, not private items.
 ## Attributes
 
 ~~~~ {.notrust .ebnf .gram}
-attribute : '#' '[' attr_list ']' ;
-attr_list : attr [ ',' attr_list ]*
+attribute : '#' '!' ? '[' attr_list ']' ;
+attr_list : attr [ ',' attr_list ]* ;
 attr : ident [ '=' literal
              | '(' attr_list ')' ] ? ;
 ~~~~
 
 Static entities in Rust -- crates, modules and items -- may have _attributes_
-applied to them. ^[Attributes in Rust are modeled on Attributes in ECMA-335,
-C#]
-An attribute is a general, free-form metadatum that is interpreted according to name, convention, and language and compiler version.
-Attributes may appear as any of
+applied to them. Attributes in Rust are modeled on Attributes in ECMA-335,
+with the syntax coming from ECMA-334 (C#). An attribute is a general,
+free-form metadatum that is interpreted according to name, convention, and
+language and compiler version. Attributes may appear as any of:
 
 * A single identifier, the attribute name
-* An identifier followed by the equals sign '=' and a literal, providing a key/value pair
+* An identifier followed by the equals sign '=' and a literal, providing a
+  key/value pair
 * An identifier followed by a parenthesized list of sub-attribute arguments
 
-Attributes terminated by a semi-colon apply to the entity that the attribute is declared
-within. Attributes that are not terminated by a semi-colon apply to the next entity.
+Attributes with a bang ("!") after the hash ("#") apply to the item that the
+attribute is declared within. Attributes that do not have a bang after the
+hash apply to the item that follows the attribute.
 
 An example of attributes:
 
-~~~~ {.ignore}
+~~~~ {.rust}
 // General metadata applied to the enclosing module or crate.
-#[license = "BSD"];
+#![license = "BSD"]
 
 // A function marked as a unit test
 #[test]
 fn test_foo() {
-  ...
+  /* ... */
 }
 
 // A conditionally-compiled module
 #[cfg(target_os="linux")]
 mod bar {
-  ...
+  /* ... */
 }
 
 // A lint attribute used to suppress a warning/error
 #[allow(non_camel_case_types)]
-pub type int8_t = i8;
-~~~~
-
-> **Note:** In future versions of Rust, user-provided extensions to the compiler
-> will be able to interpret attributes.  When this facility is provided, the
-> compiler will distinguish between language-reserved and user-available
-> attributes.
-
-At present, only the Rust compiler interprets attributes, so all attribute names
-are effectively reserved. Some significant attributes include:
-
-* The `doc` attribute, for documenting code in-place.
-* The `cfg` attribute, for conditional-compilation by build-configuration (see
-  [Conditional compilation](#conditional-compilation)).
-* The `crate_id` attribute, for describing the package ID of a crate.
-* The `lang` attribute, for custom definitions of traits and functions that are
-  known to the Rust compiler (see [Language items](#language-items)).
-* The `link` attribute, for describing linkage metadata for a extern blocks.
-* The `test` attribute, for marking functions as unit tests.
-* The `allow`, `warn`, `forbid`, and `deny` attributes, for
-  controlling lint checks (see [Lint check attributes](#lint-check-attributes)).
-* The `deriving` attribute, for automatically generating implementations of
-  certain traits.
-* The `inline` attribute, for expanding functions at caller location (see
-  [Inline attributes](#inline-attributes)).
-* The `static_assert` attribute, for asserting that a static bool is true at
-  compiletime.
-* The `thread_local` attribute, for defining a `static mut` as a thread-local.
-  Note that this is only a low-level building block, and is not local to a
-  *task*, nor does it provide safety.
-
-Other attributes may be added or removed during development of the language.
+type int8_t = i8;
+~~~~
+
+> **Note:** At some point in the future, the compiler will distinguish between
+> language-reserved and user-available attributes. Until then, there is
+> effectively no difference between an attribute handled by a loadable syntax
+> extension and the compiler.
+
+### Crate-only attributes
+
+- `crate_id` - specify the this crate's crate ID.
+- `crate_type` - see [linkage](#linkage).
+- `feature` - see [compiler features](#compiler-features).
+- `no_main` - disable emitting the `main` symbol. Useful when some other
+  object being linked to defines `main`.
+- `no_start` - disable linking to the `native` crate, which specifies the
+  "start" language item.
+- `no_std` - disable linking to the `std` crate.
+
+### Module-only attributes
+
+- `macro_escape` - macros defined in this module will be visible in the
+  module's parent, after this module has been included.
+- `no_implicit_prelude` - disable injecting `use std::prelude::*` in this
+  module.
+- `path` - specifies the file to load the module from. `#[path="foo.rs"] mod
+  bar;` is equivalent to `mod bar { /* contents of foo.rs */ }`. The path is
+  taken relative to the directory that the current module is in.
+
+### Function-only attributes
+
+- `macro_registrar` - when using loadable syntax extensions, mark this
+  function as the registration point for the current crate's syntax
+  extensions.
+- `main` - indicates that this function should be passed to the entry point,
+  rather than the function in the crate root named `main`.
+- `start` - indicates that this function should be used as the entry point,
+  overriding the "start" language item.  See the "start" [language
+  item](#language-items) for more details.
+
+### Static-only attributes
+
+- `address_insignificant` - references to this static may alias with
+  references to other statics, potentially of unrelated type.
+- `thread_local` - on a `static mut`, this signals that the value of this
+  static may change depending on the current thread. The exact consequences of
+  this are implementation-defined.
+
+### FFI attributes
+
+On an `extern` block, the following attributes are interpreted:
+
+- `link_args` - specify arguments to the linker, rather than just the library
+  name and type. This is feature gated and the exact behavior is
+  implementation-defined (due to variety of linker invocation syntax).
+- `link` - indicate that a native library should be linked to for the
+  declarations in this block to be linked correctly. See [external
+  blocks](#external-blocks)
+
+On declarations inside an `extern` block, the following attributes are
+interpreted:
+
+- `link_name` - the name of the symbol that this function or static should be
+  imported as.
+- `linkage` - on a static, this specifies the [linkage
+  type](http://llvm.org/docs/LangRef.html#linkage-types).
+
+### Miscellaneous attributes
+
+- `link_section` - on statics and functions, this specifies the section of the
+  object file that this item's contents will be placed into.
+- `macro_export` - export a macro for cross-crate usage.
+- `no_mangle` - on any item, do not apply the standard name mangling. Set the
+  symbol for this item to its identifier.
+- `packed` - on structs or enums, eliminate any padding that would be used to
+  align fields.
+- `repr` - on C-like enums, this sets the underlying type used for
+  representation. Useful for FFI. Takes one argument, which is the primitive
+  type this enum should be represented for, or `C`, which specifies that it
+  should be the default `enum` size of the C ABI for that platform. Note that
+  enum representation in C is undefined, and this may be incorrect when the C
+  code is compiled with certain flags.
+- `simd` - on certain tuple structs, derive the arithmetic operators, which
+  lower to the target's SIMD instructions, if any.
+- `static_assert` - on statics whose type is `bool`, terminates compilation
+  with an error if it is not initialized to `true`.
+- `unsafe_destructor` - allow implementations of the "drop" language item
+  where the type it is implemented for does not implement the "send" language
+  item.
+- `unsafe_no_drop_flag` - on structs, remove the flag that prevents
+  destructors from being run twice. Destructors might be run multiple times on
+  the same object with this attribute.
 
 ### Conditional compilation
 
@@ -1794,9 +1851,7 @@ one of `foo` and `bar` to be defined (this resembles in the disjunctive normal
 form). Additionally, one can reverse a condition by enclosing it in a
 `not(...)`, like e. g. `#[cfg(not(target_os = "win32"))]`.
 
-To pass a configuration option which triggers a `#[cfg(identifier)]` one can use
-`rustc --cfg identifier`. In addition to that, the following configurations are
-pre-defined by the compiler:
+The following configurations must be defined by the implementation:
 
  * `target_arch = "..."`. Target CPU architecture, such as `"x86"`, `"x86_64"`
    `"mips"`, or `"arm"`.
@@ -1808,8 +1863,8 @@ pre-defined by the compiler:
  * `target_os = "..."`. Operating system of the target, examples include
    `"win32"`, `"macos"`, `"linux"`, `"android"` or `"freebsd"`.
  * `target_word_size = "..."`. Target word size in bits. This is set to `"32"`
-   for 32-bit CPU targets, and likewise set to `"64"` for 64-bit CPU targets.
- * `test`. Only set in test builds (`rustc --test`).
+   for targets with 32-bit pointers, and likewise set to `"64"` for 64-bit
+   pointers.
  * `unix`. See `target_family`.
  * `windows`. See `target_family`.
 
@@ -1825,8 +1880,8 @@ For any lint check `C`:
  * `deny(C)` signals an error after encountering a violation of `C`,
  * `allow(C)` overrides the check for `C` so that violations will go
     unreported,
- * `forbid(C)` is the same as `deny(C)`, but also forbids uses of
-   `allow(C)` within the entity.
+ * `forbid(C)` is the same as `deny(C)`, but also forbids changing the lint
+    level afterwards.
 
 The lint checks supported by the compiler can be found via `rustc -W help`,
 along with their default settings.
@@ -1884,11 +1939,11 @@ mod m3 {
 
 ### Language items
 
-Some primitive Rust operations are defined in Rust code,
-rather than being implemented directly in C or assembly language.
-The definitions of these operations have to be easy for the compiler to find.
-The `lang` attribute makes it possible to declare these operations.
-For example, the `str` module in the Rust standard library defines the string equality function:
+Some primitive Rust operations are defined in Rust code, rather than being
+implemented directly in C or assembly language.  The definitions of these
+operations have to be easy for the compiler to find.  The `lang` attribute
+makes it possible to declare these operations.  For example, the `str` module
+in the Rust standard library defines the string equality function:
 
 ~~~~ {.ignore}
 #[lang="str_eq"]
@@ -1903,16 +1958,23 @@ when generating calls to the string equality function.
 
 A complete list of the built-in language items follows:
 
-#### Traits
+#### Built-in Traits
 
-`const`
-  : Cannot be mutated.
-`owned`
-  : Are uniquely owned.
-`durable`
-  : Contain references.
+`send`
+  : Able to be sent across task boundaries.
+`sized`
+  : Has a size known at compile time.
+`copy`
+  : Types that do not move ownership when used by-value.
+`share`
+  : Able to be safely shared between tasks when aliased.
 `drop`
-  : Have finalizers.
+  : Have destructors.
+
+#### Operators
+
+These language items are traits:
+
 `add`
   : Elements can be added (for example, integers and floats).
 `sub`
@@ -1943,17 +2005,54 @@ A complete list of the built-in language items follows:
   : Elements can be compared for equality.
 `ord`
   : Elements have a partial ordering.
+`deref`
+  : `*` can be applied, yielding a reference to another type
+`deref_mut`
+  : `*` can be applied, yielding a mutable reference to another type
 
-#### Operations
+
+These are functions:
 
 `str_eq`
-  : Compare two strings for equality.
+  : Compare two strings (`&str`) for equality.
 `uniq_str_eq`
-  : Compare two owned strings for equality.
-`annihilate`
-  : Destroy a box before freeing it.
-`log_type`
-  : Generically print a string representation of any type.
+  : Compare two owned strings (`~str`) for equality.
+`strdup_uniq`
+  : Return a new unique string
+    containing a copy of the contents of a unique string.
+
+#### Types
+
+`unsafe`
+  : A type whose contents can be mutated through an immutable reference
+`type_id`
+  : The type returned by the `type_id` intrinsic.
+
+#### Marker types
+
+These types help drive the compiler's analysis
+
+`covariant_type`
+  : The type parameter should be considered covariant
+`contravariant_type`
+  : The type parameter should be considered contravariant
+`invariant_type`
+  : The type parameter should be considered invariant
+`covariant_lifetime`
+  : The lifetime parameter should be considered covariant
+`contravariant_lifetime`
+  : The lifetime parameter should be considered contravariant
+`invariant_lifetime`
+  : The lifetime parameter should be considered invariant
+`no_send_bound`
+  : This type does not implement "send", even if eligible
+`no_copy_bound`
+  : This type does not implement "copy", even if eligible
+`no_share_bound`
+  : This type does not implement "share", even if eligible
+`managed_bound`
+  : This type implements "managed"
+
 `fail_`
   : Abort the program with an error.
 `fail_bounds_check`
@@ -1966,15 +2065,6 @@ A complete list of the built-in language items follows:
   : Allocate memory on the managed heap.
 `free`
   : Free memory that was allocated on the managed heap.
-`borrow_as_imm`
-  : Create an immutable reference to a mutable value.
-`return_to_mut`
-  : Release a reference created with `return_to_mut`
-`check_not_borrowed`
-  : Fail if a value has existing references to it.
-`strdup_uniq`
-  : Return a new unique string
-    containing a copy of the contents of a unique string.
 
 > **Note:** This list is likely to become out of date. We should auto-generate it
 > from `librustc/middle/lang_items.rs`.
@@ -2042,6 +2132,7 @@ Supported traits for `deriving` are:
 * `Show`, to format a value using the `{}` formatter.
 
 ### Stability
+
 One can indicate the stability of an API using the following attributes:
 
 * `deprecated`: This item should no longer be used, e.g. it has been
@@ -2068,7 +2159,7 @@ be unstable for the purposes of the lint. One can give an optional
 string that will be displayed when the lint flags the use of an item.
 
 ~~~~ {.ignore}
-#[warn(unstable)];
+#![warn(unstable)]
 
 #[deprecated="replaced by `best`"]
 fn bad() {
@@ -2104,10 +2195,10 @@ necessarily ready for every-day use. These features are often of "prototype
 quality" or "almost production ready", but may not be stable enough to be
 considered a full-fleged language feature.
 
-For this reason, rust recognizes a special crate-level attribute of the form:
+For this reason, Rust recognizes a special crate-level attribute of the form:
 
 ~~~~ {.ignore}
-#[feature(feature1, feature2, feature3)]
+#![feature(feature1, feature2, feature3)]
 ~~~~
 
 This directive informs the compiler that the feature list: `feature1`,
@@ -2115,7 +2206,7 @@ This directive informs the compiler that the feature list: `feature1`,
 crate-level, not at a module-level. Without this directive, all features are
 considered off, and using the features will result in a compiler error.
 
-The currently implemented features of the compiler are:
+The currently implemented features of the reference compiler are:
 
 * `macro_rules` - The definition of new macros. This does not encompass
                   macro-invocation, that is always enabled by default, this only
@@ -2331,7 +2422,7 @@ struct_expr : expr_path '{' ident ':' expr
                       [ ".." expr ] '}' |
               expr_path '(' expr
                       [ ',' expr ] * ')' |
-              expr_path
+              expr_path ;
 ~~~~
 
 There are several forms of structure expressions.
@@ -2353,7 +2444,7 @@ The following are examples of structure expressions:
 ~~~~
 # struct Point { x: f64, y: f64 }
 # struct TuplePoint(f64, f64);
-# mod game { pub struct User<'a> { name: &'a str, age: uint, score: uint } }
+# mod game { pub struct User<'a> { pub name: &'a str, pub age: uint, pub score: uint } }
 # struct Cookie; fn some_fn<T>(t: T) {}
 Point {x: 10.0, y: 20.0};
 TuplePoint(10.0, 20.0);
@@ -2382,7 +2473,7 @@ Point3d {y: 0, z: 10, .. base};
 ~~~~ {.notrust .ebnf .gram}
 block_expr : '{' [ view_item ] *
                  [ stmt ';' | item ] *
-                 [ expr ] '}'
+                 [ expr ] '}' ;
 ~~~~
 
 A _block expression_ is similar to a module in terms of the declarations that
@@ -2409,7 +2500,7 @@ or dynamically dispatching if the left-hand-side expression is an indirect [obje
 ### Field expressions
 
 ~~~~ {.notrust .ebnf .gram}
-field_expr : expr '.' ident
+field_expr : expr '.' ident ;
 ~~~~
 
 A _field expression_ consists of an expression followed by a single dot and an identifier,
@@ -2431,9 +2522,9 @@ it is automatically dereferenced to make the field access possible.
 ### Vector expressions
 
 ~~~~ {.notrust .ebnf .gram}
-vec_expr : '[' "mut" ? vec_elems? ']'
+vec_expr : '[' "mut" ? vec_elems? ']' ;
 
-vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
+vec_elems : [expr [',' expr]*] | [expr ',' ".." expr] ;
 ~~~~
 
 A [_vector_](#vector-types) _expression_ is written by enclosing zero or
@@ -2453,7 +2544,7 @@ as a [literal](#literals) or a [static item](#static-items).
 ### Index expressions
 
 ~~~~ {.notrust .ebnf .gram}
-idx_expr : expr '[' expr ']'
+idx_expr : expr '[' expr ']' ;
 ~~~~
 
 [Vector](#vector-types)-typed expressions can be indexed by writing a
@@ -2466,12 +2557,12 @@ task in a _failing state_.
 
 ~~~~ {.ignore}
 # use std::task;
-# do task::spawn {
+# task::spawn(proc() {
 
 ([1, 2, 3, 4])[0];
 (["a", "b"])[10]; // fails
 
-# }
+# })
 ~~~~
 
 ### Unary operator expressions
@@ -2875,7 +2966,7 @@ then any `else` block is executed.
 ~~~~ {.notrust .ebnf .gram}
 match_expr : "match" expr '{' match_arm [ '|' match_arm ] * '}' ;
 
-match_arm : match_pat '=>' [ expr "," | '{' block '}' ] ;
+match_arm : match_pat "=>" [ expr "," | '{' block '}' ] ;
 
 match_pat : pat [ ".." pat ] ? [ "if" expr ] ;
 ~~~~
@@ -3139,7 +3230,7 @@ The types `char` and `str` hold textual data.
 A value of type `char` is a [Unicode scalar value](
 http://www.unicode.org/glossary/#unicode_scalar_value)
 (ie. a code point that is not a surrogate),
-represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF 
+represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF
 or 0xE000 to 0x10FFFF range.
 A `[char]` vector is effectively an UCS-4 / UTF-32 string.
 
@@ -3439,12 +3530,12 @@ The kinds are:
     This kind includes scalars, owning pointers, owned closures, and
     structural types containing only other owned types.
     All `Send` types are `'static`.
-`Pod`
+`Copy`
   : Types of this kind consist of "Plain Old Data"
     which can be copied by simply moving bits.
     All values of this kind can be implicitly copied.
     This kind includes scalars and immutable references,
-    as well as structural types containing other `Pod` types.
+    as well as structural types containing other `Copy` types.
 `'static`
   : Types of this kind do not contain any references (except for
     references with the `static` lifetime, which are allowed).
@@ -3886,7 +3977,7 @@ Rust provides several macros to log information. Here's a simple Rust program
 that demonstrates all four of them:
 
 ~~~~
-#[feature(phase)];
+#![feature(phase)]
 #[phase(syntax, link)] extern crate log;
 
 fn main() {
diff --git a/src/doc/rustdoc.md b/src/doc/rustdoc.md
index 5d41f297e7d..96419e1bfd2 100644
--- a/src/doc/rustdoc.md
+++ b/src/doc/rustdoc.md
@@ -165,12 +165,12 @@ that one can still write things like `#[deriving(Eq)]`).
     # // what's actually being documented.
     # fn fib(n: int) { n + 2 }
 
-    do spawn { fib(200); }
+    spawn(proc() { fib(200); })
     ```
     */
     # fn foo() {}
 
-The documentation online would look like `do spawn { fib(200); }`, but when
+The documentation online would look like `spawn(proc() { fib(200); })`, but when
 testing this code, the `fib` function will be included (so it can compile).
 
 ## Running tests (advanced)
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md
index 09539e6d59d..d0463ca17d3 100644
--- a/src/doc/tutorial.md
+++ b/src/doc/tutorial.md
@@ -100,9 +100,9 @@ If you've fulfilled those prerequisites, something along these lines
 should work.
 
 ~~~~ {.notrust}
-$ curl -O http://static.rust-lang.org/dist/rust-0.9.tar.gz
-$ tar -xzf rust-0.9.tar.gz
-$ cd rust-0.9
+$ curl -O http://static.rust-lang.org/dist/rust-nightly.tar.gz
+$ tar -xzf rust-nightly.tar.gz
+$ cd rust-nightly
 $ ./configure
 $ make && make install
 ~~~~
@@ -117,8 +117,8 @@ When complete, `make install` will place several programs into
 `/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
 API-documentation tool.
 
-[tarball]: http://static.rust-lang.org/dist/rust-0.9.tar.gz
-[win-exe]: http://static.rust-lang.org/dist/rust-0.9-install.exe
+[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz
+[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe
 
 ## Compiling your first program
 
@@ -504,13 +504,12 @@ matching in order to bind names to the contents of data types.
 
 ~~~~
 use std::f64;
-use std::num::atan;
 fn angle(vector: (f64, f64)) -> f64 {
     let pi = f64::consts::PI;
     match vector {
       (0.0, y) if y < 0.0 => 1.5 * pi,
       (0.0, _) => 0.5 * pi,
-      (x, y) => atan(y / x)
+      (x, y) => (y / x).atan()
     }
 }
 ~~~~
@@ -1409,20 +1408,17 @@ struct Point {
 ~~~~
 
 We can use this simple definition to allocate points in many different
-ways. For example, in this code, each of these three local variables
+ways. For example, in this code, each of these local variables
 contains a point, but allocated in a different location:
 
 ~~~
 # struct Point { x: f64, y: f64 }
 let on_the_stack : Point  =  Point { x: 3.0, y: 4.0 };
-let managed_box  : @Point = @Point { x: 5.0, y: 1.0 };
 let owned_box    : ~Point = ~Point { x: 7.0, y: 9.0 };
 ~~~
 
 Suppose we want to write a procedure that computes the distance
-between any two points, no matter where they are stored. For example,
-we might like to compute the distance between `on_the_stack` and
-`managed_box`, or between `managed_box` and `owned_box`. One option is
+between any two points, no matter where they are stored. One option is
 to define a function that takes two arguments of type point—that is,
 it takes the points by value. But this will cause the points to be
 copied when we call the function. For points, this is probably not so
@@ -1430,12 +1426,11 @@ bad, but often copies are expensive. So we’d like to define a function
 that takes the points by pointer. We can use references to do this:
 
 ~~~
-use std::num::sqrt;
 # struct Point { x: f64, y: f64 }
 fn compute_distance(p1: &Point, p2: &Point) -> f64 {
     let x_d = p1.x - p2.x;
     let y_d = p1.y - p2.y;
-    sqrt(x_d * x_d + y_d * y_d)
+    (x_d * x_d + y_d * y_d).sqrt()
 }
 ~~~
 
@@ -1444,11 +1439,9 @@ Now we can call `compute_distance()` in various ways:
 ~~~
 # struct Point{ x: f64, y: f64 };
 # let on_the_stack : Point  =  Point { x: 3.0, y: 4.0 };
-# let managed_box  : @Point = @Point { x: 5.0, y: 1.0 };
 # let owned_box    : ~Point = ~Point { x: 7.0, y: 9.0 };
 # fn compute_distance(p1: &Point, p2: &Point) -> f64 { 0.0 }
-compute_distance(&on_the_stack, managed_box);
-compute_distance(managed_box, owned_box);
+compute_distance(&on_the_stack, owned_box);
 ~~~
 
 Here the `&` operator is used to take the address of the variable
@@ -1458,11 +1451,11 @@ reference. We also call this _borrowing_ the local variable
 `on_the_stack`, because we are creating an alias: that is, another
 route to the same data.
 
-In the case of the boxes `managed_box` and `owned_box`, however, no
+In the case of `owned_box`, however, no
 explicit action is necessary. The compiler will automatically convert
-a box like `@point` or `~point` to a reference like
+a box `~point` to a reference like
 `&point`. This is another form of borrowing; in this case, the
-contents of the managed/owned box are being lent out.
+contents of the owned box are being lent out.
 
 Whenever a value is borrowed, there are some limitations on what you
 can do with the original. For example, if the contents of a variable
@@ -1499,11 +1492,10 @@ Rust uses the unary star operator (`*`) to access the contents of a
 box or pointer, similarly to C.
 
 ~~~
-let managed = @10;
-let owned = ~20;
-let borrowed = &30;
+let owned = ~10;
+let borrowed = &20;
 
-let sum = *managed + *owned + *borrowed;
+let sum = *owned + *borrowed;
 ~~~
 
 Dereferenced mutable pointers may appear on the left hand side of
@@ -1511,14 +1503,13 @@ assignments. Such an assignment modifies the value that the pointer
 points to.
 
 ~~~
-let managed = @10;
-let mut owned = ~20;
+let mut owned = ~10;
 
-let mut value = 30;
+let mut value = 20;
 let borrowed = &mut value;
 
 *owned = *borrowed + 100;
-*borrowed = *managed + 1000;
+*borrowed = *owned + 1000;
 ~~~
 
 Pointers have high operator precedence, but lower precedence than the
@@ -1529,7 +1520,7 @@ can sometimes make code awkward and parenthesis-filled.
 # struct Point { x: f64, y: f64 }
 # enum Shape { Rectangle(Point, Point) }
 # impl Shape { fn area(&self) -> int { 0 } }
-let start = @Point { x: 10.0, y: 20.0 };
+let start = ~Point { x: 10.0, y: 20.0 };
 let end = ~Point { x: (*start).x + 100.0, y: (*start).y + 100.0 };
 let rect = &Rectangle(*start, *end);
 let area = (*rect).area();
@@ -1543,7 +1534,7 @@ dot), so in most cases, explicitly dereferencing the receiver is not necessary.
 # struct Point { x: f64, y: f64 }
 # enum Shape { Rectangle(Point, Point) }
 # impl Shape { fn area(&self) -> int { 0 } }
-let start = @Point { x: 10.0, y: 20.0 };
+let start = ~Point { x: 10.0, y: 20.0 };
 let end = ~Point { x: start.x + 100.0, y: start.y + 100.0 };
 let rect = &Rectangle(*start, *end);
 let area = rect.area();
@@ -1555,7 +1546,7 @@ something silly like
 
 ~~~
 # struct Point { x: f64, y: f64 }
-let point = &@~Point { x: 10.0, y: 20.0 };
+let point = &~Point { x: 10.0, y: 20.0 };
 println!("{:f}", point.x);
 ~~~
 
@@ -1764,7 +1755,10 @@ access local variables in the enclosing scope.
 
 ~~~~
 let mut max = 0;
-[1, 2, 3].map(|x| if *x > max { max = *x });
+let f = |x: int| if x > max { max = x };
+for x in [1, 2, 3].iter() {
+    f(*x);
+}
 ~~~~
 
 Stack closures are very efficient because their environment is
@@ -1780,8 +1774,8 @@ pervasively in Rust code.
 
 Owned closures, written `proc`,
 hold on to things that can safely be sent between
-processes. They copy the values they close over, much like managed
-closures, but they also own them: that is, no other code can access
+processes. They copy the values they close over,
+but they also own them: that is, no other code can access
 them. Owned closures are used in concurrent code, particularly
 for spawning [tasks][tasks].
 
@@ -1910,10 +1904,9 @@ to a reference.
 #    fn draw_value(self) { /* ... */ }
 # }
 # let s = Circle(Point { x: 1.0, y: 2.0 }, 3.0);
-// As with typical function arguments, managed and owned pointers
+// As with typical function arguments, owned pointers
 // are automatically converted to references
 
-(@s).draw_reference();
 (~s).draw_reference();
 
 // Unlike typical function arguments, the self value will
@@ -1924,7 +1917,7 @@ s.draw_reference();
 (& &s).draw_reference();
 
 // ... and dereferenced and borrowed
-(&@~s).draw_reference();
+(&~s).draw_reference();
 ~~~
 
 Implementations may also define standalone (sometimes called "static")
@@ -2093,7 +2086,7 @@ and may not be overridden:
 
 * `Send` - Sendable types.
 Types are sendable
-unless they contain managed boxes, managed closures, or references.
+unless they contain references.
 
 * `Share` - Types that are *threadsafe*
 These are types that are safe to be used across several threads with access to
@@ -2103,10 +2096,10 @@ a `&T` pointer. `MutexArc` is an example of a *sharable* type with internal muta
 These are types that do not contain any data whose lifetime is bound to
 a particular stack frame. These are types that do not contain any
 references, or types where the only contained references
-have the `'static` lifetime. (For more on named lifetimes and their uses, 
+have the `'static` lifetime. (For more on named lifetimes and their uses,
 see the [references and lifetimes guide][lifetimes].)
 
-> ***Note:*** These two traits were referred to as 'kinds' in earlier
+> ***Note:*** These built-in traits were referred to as 'kinds' in earlier
 > iterations of the language, and often still are.
 
 Additionally, the `Drop` trait is used to define destructors. This
@@ -2300,7 +2293,7 @@ impl Shape for Circle {
     fn new(area: f64) -> Circle { Circle { radius: (area / PI).sqrt() } }
 }
 impl Shape for Square {
-    fn new(area: f64) -> Square { Square { length: (area).sqrt() } }
+    fn new(area: f64) -> Square { Square { length: area.sqrt() } }
 }
 
 let area = 42.5;
@@ -2409,7 +2402,7 @@ that, like strings and vectors, objects have dynamic size and may
 only be referred to via one of the pointer types.
 Other pointer types work as well.
 Casts to traits may only be done with compatible pointers so,
-for example, an `@Circle` may not be cast to an `~Drawable`.
+for example, an `&Circle` may not be cast to an `~Drawable`.
 
 ~~~
 # type Circle = int; type Rectangle = int;
@@ -2430,23 +2423,25 @@ select the method to call at runtime.
 
 This usage of traits is similar to Java interfaces.
 
-By default, each of the three storage classes for traits enforce a
-particular set of built-in kinds that their contents must fulfill in
-order to be packaged up in a trait object of that storage class.
+There are some built-in bounds, such as `Send` and `Share`, which are properties
+of the components of types. By design, trait objects don't know the exact type
+of their contents and so the compiler cannot reason about those properties.
+
+You can instruct the compiler, however, that the contents of a trait object must
+acribe to a particular bound with a trailing colon (`:`). These are examples of
+valid types:
 
-* The contents of owned traits (`~Trait`) must fulfill the `Send` bound.
-* The contents of reference traits (`&Trait`) are not constrained by any bound.
+~~~rust
+trait Foo {}
+trait Bar<T> {}
 
-Consequently, the trait objects themselves automatically fulfill their
-respective kind bounds. However, this default behavior can be overridden by
-specifying a list of bounds on the trait type, for example, by writing `~Trait:`
-(which indicates that the contents of the owned trait need not fulfill any
-bounds), or by writing `~Trait:Send+Share`, which indicates that in addition
-to fulfilling `Send`, contents must also fulfill `Share`, and as a consequence,
-the trait itself fulfills `Share`.
+fn sendable_foo(f: ~Foo:Send) { /* ... */ }
+fn shareable_bar<T: Share>(b: &Bar<T>: Share) { /* ... */ }
+~~~
 
-* `~Trait:Send` is equivalent to `~Trait`.
-* `&Trait:` is equivalent to `&Trait`.
+When no colon is specified (such as the type `~Foo`), it is inferred that the
+value ascribes to no bounds. They must be added manually if any bounds are
+necessary for usage.
 
 Builtin kind bounds can also be specified on closure types in the same way (for
 example, by writing `fn:Send()`), and the default behaviours are the same as
@@ -2510,8 +2505,8 @@ use std::f64::consts::PI;
 # impl Circle for CircleStruct { fn radius(&self) -> f64 { (self.area() / PI).sqrt() } }
 # impl Shape for CircleStruct { fn area(&self) -> f64 { PI * square(self.radius) } }
 
-let concrete = @CircleStruct{center:Point{x:3.0,y:4.0},radius:5.0};
-let mycircle: @Circle = concrete as @Circle;
+let concrete = ~CircleStruct{center:Point{x:3.0,y:4.0},radius:5.0};
+let mycircle: ~Circle = concrete as ~Circle;
 let nonsense = mycircle.radius() * mycircle.area();
 ~~~
 
@@ -2597,8 +2592,6 @@ As you can see, your module hierarchy is now three modules deep: There is the cr
 function, and the module `farm`. The module `farm` also contains two functions and a third module `barn`,
 which contains a function `hay`.
 
-(In case you already stumbled over `extern crate`: It isn't directly related to a bare `mod`, we'll get to it later. )
-
 ## Paths and visibility
 
 We've now defined a nice module hierarchy. But how do we access the items in it from our `main` function?
@@ -2652,8 +2645,8 @@ Rust doesn't support encapsulation: both struct fields and methods can
 be private. But this encapsulation is at the module level, not the
 struct level.
 
-For convenience, fields are _public_ by default, and can be made _private_ with
-the `priv` keyword:
+Fields are _private_ by default, and can be made _public_ with
+the `pub` keyword:
 
 ~~~
 mod farm {
@@ -2662,8 +2655,8 @@ mod farm {
 # impl Human { pub fn rest(&self) { } }
 # pub fn make_me_a_farm() -> Farm { Farm { chickens: ~[], farmer: Human(0) } }
     pub struct Farm {
-        priv chickens: ~[Chicken],
-        farmer: Human
+        chickens: ~[Chicken],
+        pub farmer: Human
     }
 
     impl Farm {
@@ -2840,11 +2833,11 @@ use farm::cow;
 
 The path you give to `use` is per default global, meaning relative to the crate root,
 no matter how deep the module hierarchy is, or whether the module body it's written in
-is contained in its own file (remember: files are irrelevant).
+is contained in its own file. (Remember: files are irrelevant.)
 
-This is different to other languages, where you often only find a single import construct that combines the semantic
+This is different from other languages, where you often only find a single import construct that combines the semantic
 of `mod foo;` and `use`-statements, and which tend to work relative to the source file or use an absolute file path
-- Rubys `require` or C/C++'s `#include` come to mind.
+- Ruby's `require` or C/C++'s `#include` come to mind.
 
 However, it's also possible to import things relative to the module of the `use`-statement:
 Adding a `super::` in front of the path will start in the parent module,
@@ -3024,7 +3017,7 @@ The nested `barn` module is private, but the `pub use` allows users
 of the module `farm` to access a function from `barn` without needing
 to know that `barn` exists.
 
-In other words, you can use them to decouple an public api from their internal implementation.
+In other words, you can use it to decouple a public api from its internal implementation.
 
 ## Using libraries
 
@@ -3047,7 +3040,6 @@ fn main() {
 }
 ~~~
 
-Despite its name, `extern crate` is a distinct construct from regular `mod` declarations:
 A statement of the form `extern crate foo;` will cause `rustc` to search for the crate `foo`,
 and if it finds a matching binary it lets you use it from inside your crate.
 
diff --git a/src/etc/combine-tests.py b/src/etc/combine-tests.py
index a7f23405de5..68423b416f6 100755
--- a/src/etc/combine-tests.py
+++ b/src/etc/combine-tests.py
@@ -54,7 +54,7 @@ c.write(
 #[crate_id=\"run_pass_stage2#0.1\"];
 #[crate_id=\"run_pass_stage2#0.1\"];
 #[feature(globs, macro_rules, struct_variant, managed_boxes)];
-#[allow(warnings)];
+#![allow(warnings)]
 extern crate collections;
 """
 )
diff --git a/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el
index 3a99af3446c..26bdf7d7fba 100644
--- a/src/etc/emacs/rust-mode.el
+++ b/src/etc/emacs/rust-mode.el
@@ -122,7 +122,7 @@
                        ;; but the "else" or "{" should align with the beginning
                        ;; of the expression it's in.)
                        (looking-at "\\<else\\>\\|{")
-                       
+
                        (save-excursion
                          (rust-rewind-irrelevant)
                          ;; Point is now at the end of the previous ine
@@ -196,8 +196,8 @@
      ;; Special types
      (,(regexp-opt rust-special-types 'words) . font-lock-type-face)
 
-     ;; Attributes like `#[bar(baz)]`
-     (,(rust-re-grab (concat "#\\[" rust-re-ident "[^]]*\\]"))
+     ;; Attributes like `#[bar(baz)]` or `#![bar(baz)]`
+     (,(rust-re-grab (concat "#\\!?[" rust-re-ident "[^]]*\\]"))
       1 font-lock-preprocessor-face)
 
      ;; Syntax extension invocations like `foo!`, highlight including the !
diff --git a/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang b/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang
index b9b0aa55a86..7ffa35b94e4 100644
--- a/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang
+++ b/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang
@@ -282,7 +282,7 @@
     </context>
 
     <context id="attribute" style-ref="attribute" class="attribute">
-      <start extended="true">\#\[</start>
+      <start extended="true">\#!?\[</start>
       <end>\]</end>
       <include>
         <context ref="def:in-comment"/>
diff --git a/src/etc/install.sh b/src/etc/install.sh
index 8dfc1903094..dc09c7dfd00 100644
--- a/src/etc/install.sh
+++ b/src/etc/install.sh
@@ -45,7 +45,6 @@ putvar() {
     else
         printf "install: %-20s := %s %s\n" $1 "$T" "$2"
     fi
-    printf "%-20s := %s\n" $1 "$T" >>config.tmp
 }
 
 valopt() {
@@ -189,6 +188,16 @@ validate_opt () {
     done
 }
 
+absolutify() {
+    FILE_PATH="${1}"
+    FILE_PATH_DIRNAME="$(dirname ${FILE_PATH})"
+    FILE_PATH_BASENAME="$(basename ${FILE_PATH})"
+    FILE_ABS_PATH="$(cd ${FILE_PATH_DIRNAME} && pwd)"
+    FILE_PATH="${FILE_ABS_PATH}/${FILE_PATH_BASENAME}"
+    # This is the return value
+    ABSOLUTIFIED="${FILE_PATH}"
+}
+
 CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
 CFG_SELF="$0"
 CFG_ARGS="$@"
@@ -212,7 +221,12 @@ BOOL_OPTIONS=""
 VAL_OPTIONS=""
 
 flag uninstall "only uninstall from the installation prefix"
+opt verify 1 "verify that the installed binaries run correctly"
 valopt prefix "/usr/local" "set installation prefix"
+# NB This isn't quite the same definition as in `configure`.
+# just using 'lib' instead of CFG_LIBDIR_RELATIVE
+valopt libdir "${CFG_PREFIX}/lib" "install libraries"
+valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
 
 if [ $HELP -eq 1 ]
 then
@@ -223,49 +237,93 @@ fi
 step_msg "validating $CFG_SELF args"
 validate_opt
 
+
+# OK, let's get installing ...
+
+# Sanity check: can we run the binaries?
+if [ -z "${CFG_DISABLE_VERIFY}" ]
+then
+    # Don't do this if uninstalling. Failure here won't help in any way.
+    if [ -z "${CFG_UNINSTALL}" ]
+    then
+        msg "verifying platform can run binaries"
+        "${CFG_SRC_DIR}/bin/rustc" --version > /dev/null
+        if [ $? -ne 0 ]
+        then
+            err "can't execute rustc binary on this platform"
+        fi
+    fi
+fi
+
 # Sanity check: can we can write to the destination?
-umask 022 && mkdir -p "${CFG_PREFIX}/lib"
-need_ok "directory creation failed"
-touch "${CFG_PREFIX}/lib/rust-install-probe" 2> /dev/null
+msg "verifying destination is writable"
+umask 022 && mkdir -p "${CFG_LIBDIR}"
+need_ok "can't write to destination. consider \`sudo\`."
+touch "${CFG_LIBDIR}/rust-install-probe" > /dev/null
 if [ $? -ne 0 ]
 then
-    err "can't write to destination. try again with 'sudo'."
+    err "can't write to destination. consider \`sudo\`."
 fi
-rm "${CFG_PREFIX}/lib/rust-install-probe"
+rm -f "${CFG_LIBDIR}/rust-install-probe"
 need_ok "failed to remove install probe"
 
+# Sanity check: don't install to the directory containing the installer.
+# That would surely cause chaos.
+msg "verifying destination is not the same as source"
+INSTALLER_DIR="$(cd $(dirname $0) && pwd)"
+PREFIX_DIR="$(cd ${CFG_PREFIX} && pwd)"
+if [ "${INSTALLER_DIR}" = "${PREFIX_DIR}" ]
+then
+    err "can't install to same directory as installer"
+fi
+
+# Using an absolute path to libdir in a few places so that the status
+# messages are consistently using absolute paths.
+absolutify "${CFG_LIBDIR}"
+ABS_LIBDIR="${ABSOLUTIFIED}"
+
+# The file name of the manifest we're going to create during install
+INSTALLED_MANIFEST="${ABS_LIBDIR}/rustlib/manifest"
 
 # First, uninstall from the installation prefix.
 # Errors are warnings - try to rm everything in the manifest even if some fail.
-# FIXME: Hardcoded 'rustlib' ignores CFG_RUSTLIBDIR
-if [ -f "${CFG_PREFIX}/lib/rustlib/manifest" ]
+if [ -f "${INSTALLED_MANIFEST}" ]
 then
     # Iterate through installed manifest and remove files
     while read p; do
-        msg "removing ${CFG_PREFIX}/$p"
-        if [ -f "${CFG_PREFIX}/$p" ]
+        # The installed manifest contains absolute paths
+        msg "removing $p"
+        if [ -f "$p" ]
         then
-            rm "${CFG_PREFIX}/$p"
+            rm -f "$p"
             if [ $? -ne 0 ]
             then
-                warn "failed to remove ${CFG_PREFIX}/$p"
+                warn "failed to remove $p"
             fi
         else
-            warn "supposedly installed file ${CFG_PREFIX}/$p does not exist!"
+            warn "supposedly installed file $p does not exist!"
         fi
-    done < "${CFG_PREFIX}/lib/rustlib/manifest"
+    done < "${INSTALLED_MANIFEST}"
+
+    # If we fail to remove rustlib below, then the installed manifest will
+    # still be full; the installed manifest needs to be empty before install.
+    msg "removing ${INSTALLED_MANIFEST}"
+    rm -f "${INSTALLED_MANIFEST}"
+    # For the above reason, this is a hard error
+    need_ok "failed to remove installed manifest"
 
     # Remove 'rustlib' directory
-    msg "removing ${CFG_PREFIX}/lib/rustlib"
-    rm -r "${CFG_PREFIX}/lib/rustlib"
+    msg "removing ${ABS_LIBDIR}/rustlib"
+    rm -Rf "${ABS_LIBDIR}/rustlib"
     if [ $? -ne 0 ]
     then
         warn "failed to remove rustlib"
     fi
 else
+    # There's no manifest. If we were asked to uninstall, then that's a problem.
     if [ -n "${CFG_UNINSTALL}" ]
     then
-        err "unable to find installation manifest at ${CFG_PREFIX}/lib/rustlib"
+        err "unable to find installation manifest at ${CFG_LIBDIR}/rustlib"
     fi
 fi
 
@@ -278,24 +336,71 @@ then
     exit 0
 fi
 
+# Create the installed manifest, which we will fill in with absolute file paths
+mkdir -p "${CFG_LIBDIR}/rustlib"
+need_ok "failed to create rustlib"
+touch "${INSTALLED_MANIFEST}"
+need_ok "failed to create installed manifest"
 
 # Now install, iterate through the new manifest and copy files
 while read p; do
 
-    umask 022 && mkdir -p "${CFG_PREFIX}/$(dirname $p)"
+    # Decide the destination of the file
+    FILE_INSTALL_PATH="${CFG_PREFIX}/$p"
+
+    if echo "$p" | grep "^lib/" > /dev/null
+    then
+        pp=`echo $p | sed 's/^lib\///'`
+        FILE_INSTALL_PATH="${CFG_LIBDIR}/$pp"
+    fi
+
+    if echo "$p" | grep "^share/man/" > /dev/null
+    then
+        pp=`echo $p | sed 's/^share\/man\///'`
+        FILE_INSTALL_PATH="${CFG_MANDIR}/$pp"
+    fi
+
+    # Make sure there's a directory for it
+    umask 022 && mkdir -p "$(dirname ${FILE_INSTALL_PATH})"
     need_ok "directory creation failed"
 
-    msg "${CFG_PREFIX}/$p"
-    if echo "$p" | grep "/bin/" > /dev/null
+    # Make the path absolute so we can uninstall it later without
+    # starting from the installation cwd
+    absolutify "${FILE_INSTALL_PATH}"
+    FILE_INSTALL_PATH="${ABSOLUTIFIED}"
+
+    # Install the file
+    msg "${FILE_INSTALL_PATH}"
+    if echo "$p" | grep "^bin/" > /dev/null
     then
-        install -m755 "${CFG_SRC_DIR}/$p" "${CFG_PREFIX}/$p"
+        install -m755 "${CFG_SRC_DIR}/$p" "${FILE_INSTALL_PATH}"
     else
-        install -m644 "${CFG_SRC_DIR}/$p" "${CFG_PREFIX}/$p"
+        install -m644 "${CFG_SRC_DIR}/$p" "${FILE_INSTALL_PATH}"
     fi
     need_ok "file creation failed"
 
+    # Update the manifest
+    echo "${FILE_INSTALL_PATH}" >> "${INSTALLED_MANIFEST}"
+    need_ok "failed to update manifest"
+
 # The manifest lists all files to install
-done < "${CFG_SRC_DIR}/lib/rustlib/manifest"
+done < "${CFG_SRC_DIR}/lib/rustlib/manifest.in"
+
+# Sanity check: can we run the installed binaries?
+if [ -z "${CFG_DISABLE_VERIFY}" ]
+then
+    msg "verifying installed binaries are executable"
+    "${CFG_PREFIX}/bin/rustc" --version > /dev/null
+    if [ $? -ne 0 ]
+    then
+        ERR="can't execute installed rustc binary. "
+        ERR="${ERR}installation may be broken. "
+        ERR="${ERR}if this is expected then rerun install.sh with \`--disable-verify\` "
+        ERR="${ERR}or \`make install\` with \`--disable-verify-install\`"
+        err "${ERR}"
+    fi
+fi
+
 
 echo
 echo "    Rust is ready to roll."
diff --git a/src/etc/kate/rust.xml b/src/etc/kate/rust.xml
index 288085d8bae..7fc44ebad29 100644
--- a/src/etc/kate/rust.xml
+++ b/src/etc/kate/rust.xml
@@ -7,7 +7,7 @@
 	<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
 	<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?">
 ]>
-<language name="Rust" version="0.10-pre" kateversion="2.4" section="Sources" extensions="*.rs" mimetype="text/x-rust" priority="15">
+<language name="Rust" version="0.11-pre" kateversion="2.4" section="Sources" extensions="*.rs" mimetype="text/x-rust" priority="15">
 <highlighting>
 	<list name="fn">
 		<item> fn </item>
@@ -202,6 +202,7 @@
 			<RegExpr String="[0-9][0-9_]*\.[0-9_]*([eE][+-]?[0-9_]+)?(f32|f64|f)?" attribute="Number" context="#stay"/>
 			<RegExpr String="[0-9][0-9_]*&rustIntSuf;" attribute="Number" context="#stay"/>
 			<Detect2Chars char="#" char1="[" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
+			<Detect2Chars char="#" char1="!" char2="[" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
 			<RegExpr String="&rustIdent;::" attribute="Scope"/>
 			<RegExpr String="&rustIdent;!" attribute="Macro"/>
 			<RegExpr String="&apos;&rustIdent;(?!&apos;)" attribute="Lifetime"/>
diff --git a/src/etc/pkg/Distribution.xml b/src/etc/pkg/Distribution.xml
index 9c2e5d65884..c7383c0bb1a 100644
--- a/src/etc/pkg/Distribution.xml
+++ b/src/etc/pkg/Distribution.xml
@@ -14,9 +14,13 @@
             <line choice="org.rust-lang.rust"/>
         </line>
     </choices-outline>
-    <choice id="default"/>
+    <choice id="default"
+            customLocation="usr/local"/>
     <choice id="org.rust-lang.rust" visible="false">
         <pkg-ref id="org.rust-lang.rust"/>
     </choice>
     <pkg-ref id="org.rust-lang.rust" version="0" onConclusion="none">rust.pkg</pkg-ref>
+    <welcome file="welcome.rtf" mime-type="text/enriched"/>
+    <background file="rust-logo.png" mime-type="image/png"
+                alignment="bottomleft"/>
 </installer-gui-script>
diff --git a/src/etc/pkg/rust-logo.png b/src/etc/pkg/rust-logo.png
new file mode 100644
index 00000000000..2c3de300087
--- /dev/null
+++ b/src/etc/pkg/rust-logo.png
Binary files differdiff --git a/src/etc/pkg/welcome.rtf b/src/etc/pkg/welcome.rtf
new file mode 100644
index 00000000000..2433348998e
--- /dev/null
+++ b/src/etc/pkg/welcome.rtf
@@ -0,0 +1,12 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf190
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\margl1440\margr1440\vieww10800\viewh6300\viewkind0
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
+
+\f0\fs28 \cf0 \
+\
+	You will be guided through the steps necessary to\
+	install this software.\
+\
+	This will install Rust to /usr/local}
diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim
index c63948d3ed1..dd631b19322 100644
--- a/src/etc/vim/syntax/rust.vim
+++ b/src/etc/vim/syntax/rust.vim
@@ -52,7 +52,7 @@ syn keyword   rustType        f64 i8 i16 i32 i64 str Self
 " to make it easy to update.
 
 " Core operators {{{3
-syn keyword   rustTrait       Freeze Pod Send Sized
+syn keyword   rustTrait       Share Copy Send Sized
 syn keyword   rustTrait       Add Sub Mul Div Rem Neg Not
 syn keyword   rustTrait       BitAnd BitOr BitXor
 syn keyword   rustTrait       Drop
@@ -135,7 +135,7 @@ syn match     rustStringContinuation display contained /\\\n\s*/
 syn region    rustString      start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustSpecial,rustSpecialError,rustStringContinuation,@Spell
 syn region    rustString      start='r\z(#*\)"' end='"\z1' contains=@Spell
 
-syn region    rustAttribute   start="#\[" end="\]" contains=rustString,rustDeriving
+syn region    rustAttribute   start="#!\?\[" end="\]" contains=rustString,rustDeriving
 syn region    rustDeriving    start="deriving(" end=")" contained contains=rustTrait
 
 " Number literals
diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs
index 94e340368fe..be42fab8b54 100644
--- a/src/libarena/lib.rs
+++ b/src/libarena/lib.rs
@@ -1,4 +1,4 @@
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -15,20 +15,17 @@
 //! of individual objects while the arena itself is still alive. The benefit
 //! of an arena is very fast allocation; just a pointer bump.
 
-#[crate_id = "arena#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-#[allow(missing_doc)];
-#[feature(managed_boxes)];
+#![crate_id = "arena#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+#![allow(missing_doc)]
 
 extern crate collections;
 
-use collections::list::{List, Cons, Nil};
-
 use std::cast::{transmute, transmute_mut, transmute_mut_region};
 use std::cast;
 use std::cell::{Cell, RefCell};
@@ -48,7 +45,7 @@ use std::intrinsics;
 struct Chunk {
     data: Rc<RefCell<Vec<u8> >>,
     fill: Cell<uint>,
-    is_pod: Cell<bool>,
+    is_copy: Cell<bool>,
 }
 impl Chunk {
     fn capacity(&self) -> uint {
@@ -85,9 +82,9 @@ pub struct Arena {
     // The head is separated out from the list as a unbenchmarked
     // microoptimization, to avoid needing to case on the list to
     // access the head.
-    priv head: Chunk,
-    priv pod_head: Chunk,
-    priv chunks: RefCell<@List<Chunk>>,
+    head: Chunk,
+    copy_head: Chunk,
+    chunks: RefCell<Vec<Chunk>>,
 }
 
 impl Arena {
@@ -98,17 +95,17 @@ impl Arena {
     pub fn new_with_size(initial_size: uint) -> Arena {
         Arena {
             head: chunk(initial_size, false),
-            pod_head: chunk(initial_size, true),
-            chunks: RefCell::new(@Nil),
+            copy_head: chunk(initial_size, true),
+            chunks: RefCell::new(Vec::new()),
         }
     }
 }
 
-fn chunk(size: uint, is_pod: bool) -> Chunk {
+fn chunk(size: uint, is_copy: bool) -> Chunk {
     Chunk {
         data: Rc::new(RefCell::new(Vec::with_capacity(size))),
         fill: Cell::new(0u),
-        is_pod: Cell::new(is_pod),
+        is_copy: Cell::new(is_copy),
     }
 }
 
@@ -117,8 +114,8 @@ impl Drop for Arena {
     fn drop(&mut self) {
         unsafe {
             destroy_chunk(&self.head);
-            for chunk in self.chunks.get().iter() {
-                if !chunk.is_pod.get() {
+            for chunk in self.chunks.borrow().iter() {
+                if !chunk.is_copy.get() {
                     destroy_chunk(chunk);
                 }
             }
@@ -173,41 +170,41 @@ fn un_bitpack_tydesc_ptr(p: uint) -> (*TyDesc, bool) {
 
 impl Arena {
     fn chunk_size(&self) -> uint {
-        self.pod_head.capacity()
+        self.copy_head.capacity()
     }
     // Functions for the POD part of the arena
-    fn alloc_pod_grow(&mut self, n_bytes: uint, align: uint) -> *u8 {
+    fn alloc_copy_grow(&mut self, n_bytes: uint, align: uint) -> *u8 {
         // Allocate a new chunk.
         let new_min_chunk_size = cmp::max(n_bytes, self.chunk_size());
-        self.chunks.set(@Cons(self.pod_head.clone(), self.chunks.get()));
-        self.pod_head =
+        self.chunks.borrow_mut().push(self.copy_head.clone());
+        self.copy_head =
             chunk(num::next_power_of_two(new_min_chunk_size + 1u), true);
 
-        return self.alloc_pod_inner(n_bytes, align);
+        return self.alloc_copy_inner(n_bytes, align);
     }
 
     #[inline]
-    fn alloc_pod_inner(&mut self, n_bytes: uint, align: uint) -> *u8 {
+    fn alloc_copy_inner(&mut self, n_bytes: uint, align: uint) -> *u8 {
         unsafe {
             let this = transmute_mut_region(self);
-            let start = round_up(this.pod_head.fill.get(), align);
+            let start = round_up(this.copy_head.fill.get(), align);
             let end = start + n_bytes;
             if end > self.chunk_size() {
-                return this.alloc_pod_grow(n_bytes, align);
+                return this.alloc_copy_grow(n_bytes, align);
             }
-            this.pod_head.fill.set(end);
+            this.copy_head.fill.set(end);
 
             //debug!("idx = {}, size = {}, align = {}, fill = {}",
             //       start, n_bytes, align, head.fill.get());
 
-            this.pod_head.as_ptr().offset(start as int)
+            this.copy_head.as_ptr().offset(start as int)
         }
     }
 
     #[inline]
-    fn alloc_pod<'a, T>(&'a mut self, op: || -> T) -> &'a T {
+    fn alloc_copy<'a, T>(&'a mut self, op: || -> T) -> &'a T {
         unsafe {
-            let ptr = self.alloc_pod_inner(mem::size_of::<T>(), mem::min_align_of::<T>());
+            let ptr = self.alloc_copy_inner(mem::size_of::<T>(), mem::min_align_of::<T>());
             let ptr: *mut T = transmute(ptr);
             mem::move_val_init(&mut (*ptr), op());
             return transmute(ptr);
@@ -215,19 +212,19 @@ impl Arena {
     }
 
     // Functions for the non-POD part of the arena
-    fn alloc_nonpod_grow(&mut self, n_bytes: uint, align: uint)
+    fn alloc_noncopy_grow(&mut self, n_bytes: uint, align: uint)
                          -> (*u8, *u8) {
         // Allocate a new chunk.
         let new_min_chunk_size = cmp::max(n_bytes, self.chunk_size());
-        self.chunks.set(@Cons(self.head.clone(), self.chunks.get()));
+        self.chunks.borrow_mut().push(self.head.clone());
         self.head =
             chunk(num::next_power_of_two(new_min_chunk_size + 1u), false);
 
-        return self.alloc_nonpod_inner(n_bytes, align);
+        return self.alloc_noncopy_inner(n_bytes, align);
     }
 
     #[inline]
-    fn alloc_nonpod_inner(&mut self, n_bytes: uint, align: uint)
+    fn alloc_noncopy_inner(&mut self, n_bytes: uint, align: uint)
                           -> (*u8, *u8) {
         unsafe {
             let start;
@@ -245,7 +242,7 @@ impl Arena {
             }
 
             if end > self.head.capacity() {
-                return self.alloc_nonpod_grow(n_bytes, align);
+                return self.alloc_noncopy_grow(n_bytes, align);
             }
 
             let head = transmute_mut_region(&mut self.head);
@@ -260,11 +257,11 @@ impl Arena {
     }
 
     #[inline]
-    fn alloc_nonpod<'a, T>(&'a mut self, op: || -> T) -> &'a T {
+    fn alloc_noncopy<'a, T>(&'a mut self, op: || -> T) -> &'a T {
         unsafe {
             let tydesc = get_tydesc::<T>();
             let (ty_ptr, ptr) =
-                self.alloc_nonpod_inner(mem::size_of::<T>(), mem::min_align_of::<T>());
+                self.alloc_noncopy_inner(mem::size_of::<T>(), mem::min_align_of::<T>());
             let ty_ptr: *mut uint = transmute(ty_ptr);
             let ptr: *mut T = transmute(ptr);
             // Write in our tydesc along with a bit indicating that it
@@ -287,9 +284,9 @@ impl Arena {
             // FIXME: Borrow check
             let this = transmute_mut(self);
             if intrinsics::needs_drop::<T>() {
-                this.alloc_nonpod(op)
+                this.alloc_noncopy(op)
             } else {
-                this.alloc_pod(op)
+                this.alloc_copy(op)
             }
         }
     }
@@ -301,7 +298,7 @@ fn test_arena_destructors() {
     for i in range(0u, 10) {
         // Arena allocate something with drop glue to make sure it
         // doesn't leak.
-        arena.alloc(|| @i);
+        arena.alloc(|| Rc::new(i));
         // Allocate something with funny size and alignment, to keep
         // things interesting.
         arena.alloc(|| [0u8, 1u8, 2u8]);
@@ -316,13 +313,13 @@ fn test_arena_destructors_fail() {
     for i in range(0u, 10) {
         // Arena allocate something with drop glue to make sure it
         // doesn't leak.
-        arena.alloc(|| { @i });
+        arena.alloc(|| { Rc::new(i) });
         // Allocate something with funny size and alignment, to keep
         // things interesting.
         arena.alloc(|| { [0u8, 1u8, 2u8] });
     }
     // Now, fail while allocating
-    arena.alloc::<@int>(|| {
+    arena.alloc::<Rc<int>>(|| {
         // Now fail.
         fail!();
     });
@@ -335,14 +332,14 @@ fn test_arena_destructors_fail() {
 /// run again for these objects.
 pub struct TypedArena<T> {
     /// A pointer to the next object to be allocated.
-    priv ptr: *T,
+    ptr: *T,
 
     /// A pointer to the end of the allocated area. When this pointer is
     /// reached, a new chunk is allocated.
-    priv end: *T,
+    end: *T,
 
     /// A pointer to the first arena segment.
-    priv first: Option<~TypedArenaChunk<T>>,
+    first: Option<~TypedArenaChunk<T>>,
 }
 
 struct TypedArenaChunk<T> {
@@ -496,7 +493,7 @@ mod tests {
     }
 
     #[test]
-    pub fn test_pod() {
+    pub fn test_copy() {
         let arena = TypedArena::new();
         for _ in range(0, 100000) {
             arena.alloc(Point {
@@ -508,7 +505,7 @@ mod tests {
     }
 
     #[bench]
-    pub fn bench_pod(bh: &mut BenchHarness) {
+    pub fn bench_copy(bh: &mut BenchHarness) {
         let arena = TypedArena::new();
         bh.iter(|| {
             arena.alloc(Point {
@@ -520,7 +517,7 @@ mod tests {
     }
 
     #[bench]
-    pub fn bench_pod_nonarena(bh: &mut BenchHarness) {
+    pub fn bench_copy_nonarena(bh: &mut BenchHarness) {
         bh.iter(|| {
             ~Point {
                 x: 1,
@@ -531,7 +528,7 @@ mod tests {
     }
 
     #[bench]
-    pub fn bench_pod_old_arena(bh: &mut BenchHarness) {
+    pub fn bench_copy_old_arena(bh: &mut BenchHarness) {
         let arena = Arena::new();
         bh.iter(|| {
             arena.alloc(|| {
@@ -544,16 +541,16 @@ mod tests {
         })
     }
 
-    struct Nonpod {
+    struct Noncopy {
         string: ~str,
         array: Vec<int> ,
     }
 
     #[test]
-    pub fn test_nonpod() {
+    pub fn test_noncopy() {
         let arena = TypedArena::new();
         for _ in range(0, 100000) {
-            arena.alloc(Nonpod {
+            arena.alloc(Noncopy {
                 string: ~"hello world",
                 array: vec!( 1, 2, 3, 4, 5 ),
             });
@@ -561,10 +558,10 @@ mod tests {
     }
 
     #[bench]
-    pub fn bench_nonpod(bh: &mut BenchHarness) {
+    pub fn bench_noncopy(bh: &mut BenchHarness) {
         let arena = TypedArena::new();
         bh.iter(|| {
-            arena.alloc(Nonpod {
+            arena.alloc(Noncopy {
                 string: ~"hello world",
                 array: vec!( 1, 2, 3, 4, 5 ),
             })
@@ -572,9 +569,9 @@ mod tests {
     }
 
     #[bench]
-    pub fn bench_nonpod_nonarena(bh: &mut BenchHarness) {
+    pub fn bench_noncopy_nonarena(bh: &mut BenchHarness) {
         bh.iter(|| {
-            ~Nonpod {
+            ~Noncopy {
                 string: ~"hello world",
                 array: vec!( 1, 2, 3, 4, 5 ),
             }
@@ -582,10 +579,10 @@ mod tests {
     }
 
     #[bench]
-    pub fn bench_nonpod_old_arena(bh: &mut BenchHarness) {
+    pub fn bench_noncopy_old_arena(bh: &mut BenchHarness) {
         let arena = Arena::new();
         bh.iter(|| {
-            arena.alloc(|| Nonpod {
+            arena.alloc(|| Noncopy {
                 string: ~"hello world",
                 array: vec!( 1, 2, 3, 4, 5 ),
             })
diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs
index 7075e47bddf..510e8908427 100644
--- a/src/libcollections/bitv.rs
+++ b/src/libcollections/bitv.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 
 use std::cmp;
@@ -227,9 +227,9 @@ enum Op {Union, Intersect, Assign, Difference}
 #[deriving(Clone)]
 pub struct Bitv {
     /// Internal representation of the bit vector (small or large)
-    priv rep: BitvVariant,
+    rep: BitvVariant,
     /// The number of valid bits in the internal representation
-    priv nbits: uint
+    nbits: uint
 }
 
 fn die() -> ! {
@@ -587,9 +587,9 @@ fn iterate_bits(base: uint, bits: uint, f: |uint| -> bool) -> bool {
 
 /// An iterator for `Bitv`.
 pub struct Bits<'a> {
-    priv bitv: &'a Bitv,
-    priv next_idx: uint,
-    priv end_idx: uint,
+    bitv: &'a Bitv,
+    next_idx: uint,
+    end_idx: uint,
 }
 
 impl<'a> Iterator<bool> for Bits<'a> {
@@ -648,12 +648,12 @@ impl<'a> RandomAccessIterator<bool> for Bits<'a> {
 /// as a `uint`.
 #[deriving(Clone)]
 pub struct BitvSet {
-    priv size: uint,
+    size: uint,
 
     // In theory this is a `Bitv` instead of always a `BigBitv`, but knowing that
     // there's an array of storage makes our lives a whole lot easier when
     // performing union/intersection/etc operations
-    priv bitv: BigBitv
+    bitv: BigBitv
 }
 
 impl BitvSet {
@@ -912,8 +912,8 @@ impl BitvSet {
 }
 
 pub struct BitPositions<'a> {
-    priv set: &'a BitvSet,
-    priv next_idx: uint
+    set: &'a BitvSet,
+    next_idx: uint
 }
 
 impl<'a> Iterator<uint> for BitPositions<'a> {
diff --git a/src/libcollections/btree.rs b/src/libcollections/btree.rs
index 3f53ede6027..b516997b81e 100644
--- a/src/libcollections/btree.rs
+++ b/src/libcollections/btree.rs
@@ -23,10 +23,10 @@ use std::fmt::Show;
 
 #[allow(missing_doc)]
 pub struct BTree<K, V> {
-    priv root: Node<K, V>,
-    priv len: uint,
-    priv lower_bound: uint,
-    priv upper_bound: uint
+    root: Node<K, V>,
+    len: uint,
+    lower_bound: uint,
+    upper_bound: uint
 }
 
 impl<K: TotalOrd, V> BTree<K, V> {
diff --git a/src/libcollections/deque.rs b/src/libcollections/deque.rs
index 05df04d293f..6c1391e7ca8 100644
--- a/src/libcollections/deque.rs
+++ b/src/libcollections/deque.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Container traits for extra
+//! Container traits for collections
 
 use std::container::Mutable;
 
@@ -52,7 +52,7 @@ pub mod bench {
                                                   map: &mut M,
                                                   bh: &mut BenchHarness) {
         // setup
-        let mut rng = rand::XorShiftRng::new();
+        let mut rng = rand::weak_rng();
 
         map.clear();
         for _ in range(0, n) {
@@ -89,7 +89,7 @@ pub mod bench {
                                                 map: &mut M,
                                                 bh: &mut BenchHarness) {
         // setup
-        let mut rng = rand::XorShiftRng::new();
+        let mut rng = rand::weak_rng();
         let mut keys = slice::from_fn(n, |_| rng.gen::<uint>() % n);
 
         for k in keys.iter() {
diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs
index 914244cc431..1c3a01a355d 100644
--- a/src/libcollections/dlist.rs
+++ b/src/libcollections/dlist.rs
@@ -13,7 +13,7 @@
 //! The DList allows pushing and popping elements at either end.
 //!
 //! DList implements the trait Deque. It should be imported with `use
-//! extra::container::Deque`.
+//! collections::deque::Deque`.
 
 
 // DList is constructed like a singly-linked list over the field `next`.
@@ -32,9 +32,9 @@ use deque::Deque;
 
 /// A doubly-linked list.
 pub struct DList<T> {
-    priv length: uint,
-    priv list_head: Link<T>,
-    priv list_tail: Rawlink<Node<T>>,
+    length: uint,
+    list_head: Link<T>,
+    list_tail: Rawlink<Node<T>>,
 }
 
 type Link<T> = Option<~Node<T>>;
@@ -48,9 +48,9 @@ struct Node<T> {
 
 /// Double-ended DList iterator
 pub struct Items<'a, T> {
-    priv head: &'a Link<T>,
-    priv tail: Rawlink<Node<T>>,
-    priv nelem: uint,
+    head: &'a Link<T>,
+    tail: Rawlink<Node<T>>,
+    nelem: uint,
 }
 
 // FIXME #11820: the &'a Option<> of the Link stops clone working.
@@ -60,16 +60,16 @@ impl<'a, T> Clone for Items<'a, T> {
 
 /// Double-ended mutable DList iterator
 pub struct MutItems<'a, T> {
-    priv list: &'a mut DList<T>,
-    priv head: Rawlink<Node<T>>,
-    priv tail: Rawlink<Node<T>>,
-    priv nelem: uint,
+    list: &'a mut DList<T>,
+    head: Rawlink<Node<T>>,
+    tail: Rawlink<Node<T>>,
+    nelem: uint,
 }
 
 /// DList consuming iterator
 #[deriving(Clone)]
 pub struct MoveItems<T> {
-    priv list: DList<T>
+    list: DList<T>
 }
 
 /// Rawlink is a type like Option<T> but for holding a raw pointer
@@ -582,7 +582,7 @@ impl<A> DoubleEndedIterator<A> for MoveItems<A> {
 }
 
 impl<A> FromIterator<A> for DList<A> {
-    fn from_iterator<T: Iterator<A>>(iterator: T) -> DList<A> {
+    fn from_iter<T: Iterator<A>>(iterator: T) -> DList<A> {
         let mut ret = DList::new();
         ret.extend(iterator);
         ret
diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs
index 07f3181d218..83ba09ac68b 100644
--- a/src/libcollections/enum_set.rs
+++ b/src/libcollections/enum_set.rs
@@ -20,7 +20,7 @@ use std::num::Bitwise;
 pub struct EnumSet<E> {
     // We must maintain the invariant that no bits are set
     // for which no variant exists
-    priv bits: uint
+    bits: uint
 }
 
 /// An interface for casting C-like enum to uint and back.
@@ -102,8 +102,8 @@ impl<E:CLike> BitAnd<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
 
 /// An iterator over an EnumSet
 pub struct Items<E> {
-    priv index: uint,
-    priv bits: uint,
+    index: uint,
+    bits: uint,
 }
 
 impl<E:CLike> Items<E> {
diff --git a/src/libcollections/hashmap.rs b/src/libcollections/hashmap.rs
index b03cfced7cd..7a51fca6cd5 100644
--- a/src/libcollections/hashmap.rs
+++ b/src/libcollections/hashmap.rs
@@ -100,25 +100,25 @@ mod table {
     /// this and going "what? of course there are debug-only asserts!", then
     /// please make this use them!
     pub struct RawTable<K, V> {
-        priv capacity: uint,
-        priv size:     uint,
-        priv hashes:   *mut u64,
-        priv keys:     *mut K,
-        priv vals:     *mut V,
+        capacity: uint,
+        size:     uint,
+        hashes:   *mut u64,
+        keys:     *mut K,
+        vals:     *mut V,
     }
 
     /// Represents an index into a `RawTable` with no key or value in it.
     pub struct EmptyIndex {
-        priv idx:   int,
-        priv nopod: marker::NoPod,
+        idx:   int,
+        nocopy: marker::NoCopy,
     }
 
     /// Represents an index into a `RawTable` with a key, value, and hash
     /// in it.
     pub struct FullIndex {
-        priv idx:   int,
-        priv hash:  SafeHash,
-        priv nopod: marker::NoPod,
+        idx:   int,
+        hash:  SafeHash,
+        nocopy: marker::NoCopy,
     }
 
     impl FullIndex {
@@ -142,7 +142,7 @@ mod table {
     /// A hash that is not zero, since we use that to represent empty buckets.
     #[deriving(Eq)]
     pub struct SafeHash {
-        priv hash: u64,
+        hash: u64,
     }
 
     impl SafeHash {
@@ -237,19 +237,19 @@ mod table {
             let idx  = index as int;
             let hash = unsafe { *self.hashes.offset(idx) };
 
-            let nopod = marker::NoPod;
+            let nocopy = marker::NoCopy;
 
             match hash {
                 EMPTY_BUCKET =>
                     Empty(EmptyIndex {
                         idx: idx,
-                        nopod: nopod
+                        nocopy: nocopy
                     }),
                 full_hash =>
                     Full(FullIndex {
                         idx:   idx,
                         hash:  SafeHash { hash: full_hash },
-                        nopod: nopod,
+                        nocopy: nocopy,
                     })
             }
         }
@@ -320,7 +320,7 @@ mod table {
 
             self.size += 1;
 
-            FullIndex { idx: idx, hash: hash, nopod: marker::NoPod }
+            FullIndex { idx: idx, hash: hash, nocopy: marker::NoCopy }
         }
 
         /// Removes a key and value from the hashtable.
@@ -347,7 +347,7 @@ mod table {
 
                 self.size -= 1;
 
-                (EmptyIndex { idx: idx, nopod: marker::NoPod }, k, v)
+                (EmptyIndex { idx: idx, nocopy: marker::NoCopy }, k, v)
             }
         }
 
@@ -376,18 +376,18 @@ mod table {
     }
 
     pub struct Entries<'a, K, V> {
-        priv table: &'a RawTable<K, V>,
-        priv idx: uint,
+        table: &'a RawTable<K, V>,
+        idx: uint,
     }
 
     pub struct MutEntries<'a, K, V> {
-        priv table: &'a mut RawTable<K, V>,
-        priv idx: uint,
+        table: &'a mut RawTable<K, V>,
+        idx: uint,
     }
 
     pub struct MoveEntries<K, V> {
-        priv table: RawTable<K, V>,
-        priv idx: uint,
+        table: RawTable<K, V>,
+        idx: uint,
     }
 
     impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> {
@@ -675,19 +675,19 @@ static INITIAL_LOAD_FACTOR: Fraction = (9, 10);
 #[deriving(Clone)]
 pub struct HashMap<K, V, H = sip::SipHasher> {
     // All hashes are keyed on these values, to prevent hash collision attacks.
-    priv hasher: H,
+    hasher: H,
 
     // When size == grow_at, we double the capacity.
-    priv grow_at: uint,
+    grow_at: uint,
 
     // The capacity must never drop below this.
-    priv minimum_capacity: uint,
+    minimum_capacity: uint,
 
-    priv table: table::RawTable<K, V>,
+    table: table::RawTable<K, V>,
 
     // We keep this at the end since it's 4-bytes, unlike everything else
     // in this struct. Might as well save a word of padding!
-    priv load_factor: Fraction,
+    load_factor: Fraction,
 }
 
 /// Get the number of elements which will force the capacity to grow.
@@ -1356,7 +1356,7 @@ pub type Values<'a, K, V> =
     iter::Map<'static, (&'a K, &'a V), &'a V, Entries<'a, K, V>>;
 
 impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for HashMap<K, V, H> {
-    fn from_iterator<T: Iterator<(K, V)>>(iter: T) -> HashMap<K, V, H> {
+    fn from_iter<T: Iterator<(K, V)>>(iter: T) -> HashMap<K, V, H> {
         let (lower, _) = iter.size_hint();
         let mut map = HashMap::with_capacity_and_hasher(lower, Default::default());
         map.extend(iter);
@@ -1385,7 +1385,7 @@ pub type SetMoveItems<K> =
 /// requires that the elements implement the `Eq` and `Hash` traits.
 #[deriving(Clone)]
 pub struct HashSet<T, H = sip::SipHasher> {
-    priv map: HashMap<T, (), H>
+    map: HashMap<T, (), H>
 }
 
 impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Eq for HashSet<T, H> {
@@ -1540,7 +1540,7 @@ impl<T: TotalEq + Hash<S> + fmt::Show, S, H: Hasher<S>> fmt::Show for HashSet<T,
 }
 
 impl<T: TotalEq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T, H> {
-    fn from_iterator<I: Iterator<T>>(iter: I) -> HashSet<T, H> {
+    fn from_iter<I: Iterator<T>>(iter: I) -> HashSet<T, H> {
         let (lower, _) = iter.size_hint();
         let mut set = HashSet::with_capacity_and_hasher(lower, Default::default());
         set.extend(iter);
@@ -1600,12 +1600,12 @@ mod test_map {
 
     #[deriving(Hash, Eq, TotalEq)]
     struct Dropable {
-        k: int
+        k: uint
     }
 
 
     impl Dropable {
-        fn new(k: int) -> Dropable {
+        fn new(k: uint) -> Dropable {
             local_data::get_mut(drop_vector,
                 |v| { v.unwrap().as_mut_slice()[k] += 1; });
 
@@ -1628,24 +1628,24 @@ mod test_map {
             let mut m = HashMap::new();
 
             local_data::get(drop_vector, |v| {
-                for i in range(0, 200) {
+                for i in range(0u, 200) {
                     assert_eq!(v.unwrap().as_slice()[i], 0);
                 }
             });
 
-            for i in range(0, 100) {
+            for i in range(0u, 100) {
                 let d1 = Dropable::new(i);
                 let d2 = Dropable::new(i+100);
                 m.insert(d1, d2);
             }
 
             local_data::get(drop_vector, |v| {
-                for i in range(0, 200) {
+                for i in range(0u, 200) {
                     assert_eq!(v.unwrap().as_slice()[i], 1);
                 }
             });
 
-            for i in range(0, 50) {
+            for i in range(0u, 50) {
                 let k = Dropable::new(i);
                 let v = m.pop(&k);
 
@@ -1658,12 +1658,12 @@ mod test_map {
             }
 
             local_data::get(drop_vector, |v| {
-                for i in range(0, 50) {
+                for i in range(0u, 50) {
                     assert_eq!(v.unwrap().as_slice()[i], 0);
                     assert_eq!(v.unwrap().as_slice()[i+100], 0);
                 }
 
-                for i in range(50, 100) {
+                for i in range(50u, 100) {
                     assert_eq!(v.unwrap().as_slice()[i], 1);
                     assert_eq!(v.unwrap().as_slice()[i+100], 1);
                 }
@@ -1671,7 +1671,7 @@ mod test_map {
         }
 
         local_data::get(drop_vector, |v| {
-            for i in range(0, 200) {
+            for i in range(0u, 200) {
                 assert_eq!(v.unwrap().as_slice()[i], 0);
             }
         });
diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs
index fba85b05231..ef5289ae373 100644
--- a/src/libcollections/lib.rs
+++ b/src/libcollections/lib.rs
@@ -12,15 +12,15 @@
  * Collection types.
  */
 
-#[crate_id = "collections#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
+#![crate_id = "collections#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
 
-#[feature(macro_rules, managed_boxes, default_type_params, phase)];
+#![feature(macro_rules, managed_boxes, default_type_params, phase)]
 
 extern crate rand;
 
@@ -33,7 +33,6 @@ pub use deque::Deque;
 pub use dlist::DList;
 pub use enum_set::EnumSet;
 pub use hashmap::{HashMap, HashSet};
-pub use list::List;
 pub use lru_cache::LruCache;
 pub use priority_queue::PriorityQueue;
 pub use ringbuf::RingBuf;
@@ -47,7 +46,6 @@ pub mod deque;
 pub mod dlist;
 pub mod enum_set;
 pub mod hashmap;
-pub mod list;
 pub mod lru_cache;
 pub mod priority_queue;
 pub mod ringbuf;
diff --git a/src/libcollections/list.rs b/src/libcollections/list.rs
deleted file mode 100644
index 18da9671419..00000000000
--- a/src/libcollections/list.rs
+++ /dev/null
@@ -1,237 +0,0 @@
-// 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.
-//
-// 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.
-
-//! A standard, garbage-collected linked list.
-
-use std::container::Container;
-
-#[deriving(Clone, Eq)]
-#[allow(missing_doc)]
-pub enum List<T> {
-    Cons(T, @List<T>),
-    Nil,
-}
-
-pub struct Items<'a, T> {
-    priv head: &'a List<T>,
-    priv next: Option<&'a @List<T>>
-}
-
-impl<'a, T> Iterator<&'a T> for Items<'a, T> {
-    fn next(&mut self) -> Option<&'a T> {
-        match self.next {
-            None => match *self.head {
-                Nil => None,
-                Cons(ref value, ref tail) => {
-                    self.next = Some(tail);
-                    Some(value)
-                }
-            },
-            Some(next) => match **next {
-                Nil => None,
-                Cons(ref value, ref tail) => {
-                    self.next = Some(tail);
-                    Some(value)
-                }
-            }
-        }
-    }
-}
-
-impl<T> List<T> {
-    /// Returns a forward iterator
-    pub fn iter<'a>(&'a self) -> Items<'a, T> {
-        Items {
-            head: self,
-            next: None
-        }
-    }
-
-    /// Returns the first element of a list
-    pub fn head<'a>(&'a self) -> Option<&'a T> {
-        match *self {
-          Nil => None,
-          Cons(ref head, _) => Some(head)
-        }
-    }
-
-    /// Returns all but the first element of a list
-    pub fn tail(&self) -> Option<@List<T>> {
-        match *self {
-            Nil => None,
-            Cons(_, tail) => Some(tail)
-        }
-    }
-}
-
-impl<T> Container for List<T> {
-    /// Returns the length of a list
-    fn len(&self) -> uint { self.iter().len() }
-
-    /// Returns true if the list is empty
-    fn is_empty(&self) -> bool { match *self { Nil => true, _ => false } }
-}
-
-impl<T:Eq> List<T> {
-    /// Returns true if a list contains an element with the given value
-    pub fn contains(&self, element: T) -> bool {
-        self.iter().any(|list_element| *list_element == element)
-    }
-}
-
-impl<T:'static + Clone> List<T> {
-    /// Create a list from a vector
-    pub fn from_vec(v: &[T]) -> List<T> {
-        match v.len() {
-            0 => Nil,
-            _ => v.rev_iter().fold(Nil, |tail, value: &T| Cons(value.clone(), @tail))
-        }
-    }
-
-    /// Appends one list to another, returning a new list
-    pub fn append(&self, other: List<T>) -> List<T> {
-        match other {
-            Nil => return self.clone(),
-            _ => match *self {
-                Nil => return other,
-                Cons(ref value, tail) => Cons(value.clone(), @tail.append(other))
-            }
-        }
-    }
-
-    /// Push one element into the front of a list, returning a new list
-    pub fn unshift(&self, element: T) -> List<T> {
-        Cons(element, @(self.clone()))
-    }
-}
-
-#[cfg(test)]
-mod tests {
-    use list::{List, Nil};
-    use list;
-
-    #[test]
-    fn test_iter() {
-        let list = List::from_vec([0, 1, 2]);
-        let mut iter = list.iter();
-        assert_eq!(&0, iter.next().unwrap());
-        assert_eq!(&1, iter.next().unwrap());
-        assert_eq!(&2, iter.next().unwrap());
-        assert_eq!(None, iter.next());
-    }
-
-    #[test]
-    fn test_is_empty() {
-        let empty : list::List<int> = List::from_vec([]);
-        let full1 = List::from_vec([1]);
-        let full2 = List::from_vec(['r', 'u']);
-
-        assert!(empty.is_empty());
-        assert!(!full1.is_empty());
-        assert!(!full2.is_empty());
-    }
-
-    #[test]
-    fn test_from_vec() {
-        let list = List::from_vec([0, 1, 2]);
-        assert_eq!(list.head().unwrap(), &0);
-
-        let mut tail = list.tail().unwrap();
-        assert_eq!(tail.head().unwrap(), &1);
-
-        tail = tail.tail().unwrap();
-        assert_eq!(tail.head().unwrap(), &2);
-    }
-
-    #[test]
-    fn test_from_vec_empty() {
-        let empty : list::List<int> = List::from_vec([]);
-        assert!(empty == Nil::<int>);
-    }
-
-    #[test]
-    fn test_fold() {
-        fn add_(a: uint, b: &uint) -> uint { a + *b }
-        fn subtract_(a: uint, b: &uint) -> uint { a - *b }
-
-        let empty = Nil::<uint>;
-        assert_eq!(empty.iter().fold(0u, add_), 0u);
-        assert_eq!(empty.iter().fold(10u, subtract_), 10u);
-
-        let list = List::from_vec([0u, 1u, 2u, 3u, 4u]);
-        assert_eq!(list.iter().fold(0u, add_), 10u);
-        assert_eq!(list.iter().fold(10u, subtract_), 0u);
-    }
-
-    #[test]
-    fn test_find_success() {
-        fn match_(i: & &int) -> bool { **i == 2 }
-
-        let list = List::from_vec([0, 1, 2]);
-        assert_eq!(list.iter().find(match_).unwrap(), &2);
-    }
-
-    #[test]
-    fn test_find_fail() {
-        fn match_(_i: & &int) -> bool { false }
-
-        let empty = Nil::<int>;
-        assert_eq!(empty.iter().find(match_), None);
-
-        let list = List::from_vec([0, 1, 2]);
-        assert_eq!(list.iter().find(match_), None);
-    }
-
-    #[test]
-    fn test_any() {
-        fn match_(i: &int) -> bool { *i == 2 }
-
-        let empty = Nil::<int>;
-        assert_eq!(empty.iter().any(match_), false);
-
-        let list = List::from_vec([0, 1, 2]);
-        assert_eq!(list.iter().any(match_), true);
-    }
-
-    #[test]
-    fn test_contains() {
-        let empty = Nil::<int>;
-        assert!((!empty.contains(5)));
-
-        let list = List::from_vec([5, 8, 6]);
-        assert!((list.contains(5)));
-        assert!((!list.contains(7)));
-        assert!((list.contains(8)));
-    }
-
-    #[test]
-    fn test_len() {
-        let empty = Nil::<int>;
-        assert_eq!(empty.len(), 0u);
-
-        let list = List::from_vec([0, 1, 2]);
-        assert_eq!(list.len(), 3u);
-    }
-
-    #[test]
-    fn test_append() {
-        assert!(List::from_vec([1, 2, 3, 4]) ==
-                List::from_vec([1, 2]).append(List::from_vec([3, 4])));
-    }
-
-    #[test]
-    fn test_unshift() {
-        let list = List::from_vec([1]);
-        let new_list = list.unshift(0);
-        assert_eq!(list.len(), 1u);
-        assert_eq!(new_list.len(), 2u);
-        assert!(new_list == List::from_vec([0, 1]));
-    }
-}
diff --git a/src/libcollections/lru_cache.rs b/src/libcollections/lru_cache.rs
index e328b41cc0f..bd40d183945 100644
--- a/src/libcollections/lru_cache.rs
+++ b/src/libcollections/lru_cache.rs
@@ -56,10 +56,10 @@ struct LruEntry<K, V> {
 
 /// An LRU Cache.
 pub struct LruCache<K, V> {
-    priv map: HashMap<KeyRef<K>, ~LruEntry<K, V>>,
-    priv max_size: uint,
-    priv head: *mut LruEntry<K, V>,
-    priv tail: *mut LruEntry<K, V>,
+    map: HashMap<KeyRef<K>, ~LruEntry<K, V>>,
+    max_size: uint,
+    head: *mut LruEntry<K, V>,
+    tail: *mut LruEntry<K, V>,
 }
 
 impl<S, K: Hash<S>> Hash<S> for KeyRef<K> {
diff --git a/src/libcollections/priority_queue.rs b/src/libcollections/priority_queue.rs
index 65ccfe3ff70..a13785104ab 100644
--- a/src/libcollections/priority_queue.rs
+++ b/src/libcollections/priority_queue.rs
@@ -10,7 +10,7 @@
 
 //! A priority queue implemented with a binary heap
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use std::clone::Clone;
 use std::mem::{move_val_init, init, replace, swap};
@@ -19,7 +19,7 @@ use std::slice;
 /// A priority queue implemented with a binary heap
 #[deriving(Clone)]
 pub struct PriorityQueue<T> {
-    priv data: ~[T],
+    data: ~[T],
 }
 
 impl<T:Ord> Container for PriorityQueue<T> {
@@ -117,6 +117,11 @@ impl<T:Ord> PriorityQueue<T> {
     /// Create an empty PriorityQueue
     pub fn new() -> PriorityQueue<T> { PriorityQueue{data: ~[],} }
 
+    /// Create an empty PriorityQueue with capacity `capacity`
+    pub fn with_capacity(capacity: uint) -> PriorityQueue<T> {
+        PriorityQueue { data: slice::with_capacity(capacity) }
+    }
+
     /// Create a PriorityQueue from a vector (heapify)
     pub fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
         let mut q = PriorityQueue{data: xs,};
@@ -181,7 +186,7 @@ impl<T:Ord> PriorityQueue<T> {
 
 /// PriorityQueue iterator
 pub struct Items <'a, T> {
-    priv iter: slice::Items<'a, T>,
+    iter: slice::Items<'a, T>,
 }
 
 impl<'a, T> Iterator<&'a T> for Items<'a, T> {
@@ -193,7 +198,7 @@ impl<'a, T> Iterator<&'a T> for Items<'a, T> {
 }
 
 impl<T: Ord> FromIterator<T> for PriorityQueue<T> {
-    fn from_iterator<Iter: Iterator<T>>(iter: Iter) -> PriorityQueue<T> {
+    fn from_iter<Iter: Iterator<T>>(iter: Iter) -> PriorityQueue<T> {
         let mut q = PriorityQueue::new();
         q.extend(iter);
         q
diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs
index 05a4a2ba5fb..705e0f7d3d4 100644
--- a/src/libcollections/ringbuf.rs
+++ b/src/libcollections/ringbuf.rs
@@ -11,7 +11,7 @@
 //! A double-ended queue implemented as a circular buffer
 //!
 //! RingBuf implements the trait Deque. It should be imported with `use
-//! extra::container::Deque`.
+//! collections::deque::Deque`.
 
 use std::cmp;
 use std::slice;
@@ -25,9 +25,9 @@ static MINIMUM_CAPACITY: uint = 2u;
 /// RingBuf is a circular buffer that implements Deque.
 #[deriving(Clone)]
 pub struct RingBuf<T> {
-    priv nelts: uint,
-    priv lo: uint,
-    priv elts: ~[Option<T>]
+    nelts: uint,
+    lo: uint,
+    elts: ~[Option<T>]
 }
 
 impl<T> Container for RingBuf<T> {
@@ -230,10 +230,10 @@ impl<T> RingBuf<T> {
 
 /// RingBuf iterator
 pub struct Items<'a, T> {
-    priv lo: uint,
-    priv index: uint,
-    priv rindex: uint,
-    priv elts: &'a [Option<T>],
+    lo: uint,
+    index: uint,
+    rindex: uint,
+    elts: &'a [Option<T>],
 }
 
 impl<'a, T> Iterator<&'a T> for Items<'a, T> {
@@ -285,9 +285,9 @@ impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> {
 
 /// RingBuf mutable iterator
 pub struct MutItems<'a, T> {
-    priv remaining1: &'a mut [Option<T>],
-    priv remaining2: &'a mut [Option<T>],
-    priv nelts: uint,
+    remaining1: &'a mut [Option<T>],
+    remaining2: &'a mut [Option<T>],
+    nelts: uint,
 }
 
 impl<'a, T> Iterator<&'a mut T> for MutItems<'a, T> {
@@ -386,7 +386,7 @@ impl<A: Eq> Eq for RingBuf<A> {
 }
 
 impl<A> FromIterator<A> for RingBuf<A> {
-    fn from_iterator<T: Iterator<A>>(iterator: T) -> RingBuf<A> {
+    fn from_iter<T: Iterator<A>>(iterator: T) -> RingBuf<A> {
         let (lower, _) = iterator.size_hint();
         let mut deq = RingBuf::with_capacity(lower);
         deq.extend(iterator);
@@ -778,7 +778,7 @@ mod tests {
     }
 
     #[test]
-    fn test_from_iterator() {
+    fn test_from_iter() {
         use std::iter;
         let v = ~[1,2,3,4,5,6,7];
         let deq: RingBuf<int> = v.iter().map(|&x| x).collect();
diff --git a/src/libcollections/smallintmap.rs b/src/libcollections/smallintmap.rs
index 64be1b92e26..bd4f85aa81a 100644
--- a/src/libcollections/smallintmap.rs
+++ b/src/libcollections/smallintmap.rs
@@ -13,7 +13,7 @@
  * are O(highest integer key).
  */
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use std::iter::{Enumerate, FilterMap, Rev};
 use std::mem::replace;
@@ -21,7 +21,7 @@ use std::slice;
 
 #[allow(missing_doc)]
 pub struct SmallIntMap<T> {
-    priv v: ~[Option<T>],
+    v: ~[Option<T>],
 }
 
 impl<V> Container for SmallIntMap<V> {
@@ -112,6 +112,11 @@ impl<V> SmallIntMap<V> {
     /// Create an empty SmallIntMap
     pub fn new() -> SmallIntMap<V> { SmallIntMap{v: ~[]} }
 
+    /// Create an empty SmallIntMap with capacity `capacity`
+    pub fn with_capacity(capacity: uint) -> SmallIntMap<V> {
+        SmallIntMap { v: slice::with_capacity(capacity) }
+    }
+
     pub fn get<'a>(&'a self, key: &uint) -> &'a V {
         self.find(key).expect("key not present")
     }
@@ -234,9 +239,9 @@ macro_rules! double_ended_iterator {
 }
 
 pub struct Entries<'a, T> {
-    priv front: uint,
-    priv back: uint,
-    priv iter: slice::Items<'a, Option<T>>
+    front: uint,
+    back: uint,
+    iter: slice::Items<'a, Option<T>>
 }
 
 iterator!(impl Entries -> (uint, &'a T), get_ref)
@@ -244,9 +249,9 @@ double_ended_iterator!(impl Entries -> (uint, &'a T), get_ref)
 pub type RevEntries<'a, T> = Rev<Entries<'a, T>>;
 
 pub struct MutEntries<'a, T> {
-    priv front: uint,
-    priv back: uint,
-    priv iter: slice::MutItems<'a, Option<T>>
+    front: uint,
+    back: uint,
+    iter: slice::MutItems<'a, Option<T>>
 }
 
 iterator!(impl MutEntries -> (uint, &'a mut T), get_mut_ref)
diff --git a/src/libcollections/treemap.rs b/src/libcollections/treemap.rs
index 80886f96086..0a5e653f8eb 100644
--- a/src/libcollections/treemap.rs
+++ b/src/libcollections/treemap.rs
@@ -36,8 +36,8 @@ use std::ptr;
 #[allow(missing_doc)]
 #[deriving(Clone)]
 pub struct TreeMap<K, V> {
-    priv root: Option<~TreeNode<K, V>>,
-    priv length: uint
+    root: Option<~TreeNode<K, V>>,
+    length: uint
 }
 
 impl<K: Eq + TotalOrd, V: Eq> Eq for TreeMap<K, V> {
@@ -273,24 +273,24 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
 
 /// Lazy forward iterator over a map
 pub struct Entries<'a, K, V> {
-    priv stack: ~[&'a TreeNode<K, V>],
+    stack: ~[&'a TreeNode<K, V>],
     // See the comment on MutEntries; this is just to allow
     // code-sharing (for this immutable-values iterator it *could* very
     // well be Option<&'a TreeNode<K,V>>).
-    priv node: *TreeNode<K, V>,
-    priv remaining_min: uint,
-    priv remaining_max: uint
+    node: *TreeNode<K, V>,
+    remaining_min: uint,
+    remaining_max: uint
 }
 
 /// Lazy backward iterator over a map
 pub struct RevEntries<'a, K, V> {
-    priv iter: Entries<'a, K, V>,
+    iter: Entries<'a, K, V>,
 }
 
 /// Lazy forward iterator over a map that allows for the mutation of
 /// the values.
 pub struct MutEntries<'a, K, V> {
-    priv stack: ~[&'a mut TreeNode<K, V>],
+    stack: ~[&'a mut TreeNode<K, V>],
     // Unfortunately, we require some unsafe-ness to get around the
     // fact that we would be storing a reference *into* one of the
     // nodes in the stack.
@@ -310,14 +310,14 @@ pub struct MutEntries<'a, K, V> {
     // it under control.
     //
     // (This field can legitimately be null.)
-    priv node: *mut TreeNode<K, V>,
-    priv remaining_min: uint,
-    priv remaining_max: uint
+    node: *mut TreeNode<K, V>,
+    remaining_min: uint,
+    remaining_max: uint
 }
 
 /// Lazy backward iterator over a map
 pub struct RevMutEntries<'a, K, V> {
-    priv iter: MutEntries<'a, K, V>,
+    iter: MutEntries<'a, K, V>,
 }
 
 
@@ -482,8 +482,8 @@ fn mut_deref<K, V>(x: &mut Option<~TreeNode<K, V>>) -> *mut TreeNode<K, V> {
 
 /// Lazy forward iterator over a map that consumes the map while iterating
 pub struct MoveEntries<K, V> {
-    priv stack: ~[TreeNode<K, V>],
-    priv remaining: uint
+    stack: ~[TreeNode<K, V>],
+    remaining: uint
 }
 
 impl<K, V> Iterator<(K, V)> for MoveEntries<K,V> {
@@ -551,7 +551,7 @@ impl<'a, T> Iterator<&'a T> for RevSetItems<'a, T> {
 /// `TotalOrd` trait.
 #[deriving(Clone)]
 pub struct TreeSet<T> {
-    priv map: TreeMap<T, ()>
+    map: TreeMap<T, ()>
 }
 
 impl<T: Eq + TotalOrd> Eq for TreeSet<T> {
@@ -703,36 +703,36 @@ impl<T: TotalOrd> TreeSet<T> {
 
 /// Lazy forward iterator over a set
 pub struct SetItems<'a, T> {
-    priv iter: Entries<'a, T, ()>
+    iter: Entries<'a, T, ()>
 }
 
 /// Lazy backward iterator over a set
 pub struct RevSetItems<'a, T> {
-    priv iter: RevEntries<'a, T, ()>
+    iter: RevEntries<'a, T, ()>
 }
 
 /// Lazy iterator producing elements in the set difference (in-order)
 pub struct DifferenceItems<'a, T> {
-    priv a: Peekable<&'a T, SetItems<'a, T>>,
-    priv b: Peekable<&'a T, SetItems<'a, T>>,
+    a: Peekable<&'a T, SetItems<'a, T>>,
+    b: Peekable<&'a T, SetItems<'a, T>>,
 }
 
 /// Lazy iterator producing elements in the set symmetric difference (in-order)
 pub struct SymDifferenceItems<'a, T> {
-    priv a: Peekable<&'a T, SetItems<'a, T>>,
-    priv b: Peekable<&'a T, SetItems<'a, T>>,
+    a: Peekable<&'a T, SetItems<'a, T>>,
+    b: Peekable<&'a T, SetItems<'a, T>>,
 }
 
 /// Lazy iterator producing elements in the set intersection (in-order)
 pub struct IntersectionItems<'a, T> {
-    priv a: Peekable<&'a T, SetItems<'a, T>>,
-    priv b: Peekable<&'a T, SetItems<'a, T>>,
+    a: Peekable<&'a T, SetItems<'a, T>>,
+    b: Peekable<&'a T, SetItems<'a, T>>,
 }
 
 /// Lazy iterator producing elements in the set intersection (in-order)
 pub struct UnionItems<'a, T> {
-    priv a: Peekable<&'a T, SetItems<'a, T>>,
-    priv b: Peekable<&'a T, SetItems<'a, T>>,
+    a: Peekable<&'a T, SetItems<'a, T>>,
+    b: Peekable<&'a T, SetItems<'a, T>>,
 }
 
 /// Compare `x` and `y`, but return `short` if x is None and `long` if y is None
@@ -971,7 +971,7 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
 }
 
 impl<K: TotalOrd, V> FromIterator<(K, V)> for TreeMap<K, V> {
-    fn from_iterator<T: Iterator<(K, V)>>(iter: T) -> TreeMap<K, V> {
+    fn from_iter<T: Iterator<(K, V)>>(iter: T) -> TreeMap<K, V> {
         let mut map = TreeMap::new();
         map.extend(iter);
         map
@@ -988,7 +988,7 @@ impl<K: TotalOrd, V> Extendable<(K, V)> for TreeMap<K, V> {
 }
 
 impl<T: TotalOrd> FromIterator<T> for TreeSet<T> {
-    fn from_iterator<Iter: Iterator<T>>(iter: Iter) -> TreeSet<T> {
+    fn from_iter<Iter: Iterator<T>>(iter: Iter) -> TreeSet<T> {
         let mut set = TreeSet::new();
         set.extend(iter);
         set
diff --git a/src/libcollections/trie.rs b/src/libcollections/trie.rs
index f1cc9367509..8b83e658386 100644
--- a/src/libcollections/trie.rs
+++ b/src/libcollections/trie.rs
@@ -30,8 +30,8 @@ enum Child<T> {
 
 #[allow(missing_doc)]
 pub struct TrieMap<T> {
-    priv root: TrieNode<T>,
-    priv length: uint
+    root: TrieNode<T>,
+    length: uint
 }
 
 impl<T> Container for TrieMap<T> {
@@ -261,7 +261,7 @@ impl<T> TrieMap<T> {
 }
 
 impl<T> FromIterator<(uint, T)> for TrieMap<T> {
-    fn from_iterator<Iter: Iterator<(uint, T)>>(iter: Iter) -> TrieMap<T> {
+    fn from_iter<Iter: Iterator<(uint, T)>>(iter: Iter) -> TrieMap<T> {
         let mut map = TrieMap::new();
         map.extend(iter);
         map
@@ -278,7 +278,7 @@ impl<T> Extendable<(uint, T)> for TrieMap<T> {
 
 #[allow(missing_doc)]
 pub struct TrieSet {
-    priv map: TrieMap<()>
+    map: TrieMap<()>
 }
 
 impl Container for TrieSet {
@@ -293,32 +293,46 @@ impl Mutable for TrieSet {
     fn clear(&mut self) { self.map.clear() }
 }
 
-impl TrieSet {
-    /// Create an empty TrieSet
+impl Set<uint> for TrieSet {
     #[inline]
-    pub fn new() -> TrieSet {
-        TrieSet{map: TrieMap::new()}
+    fn contains(&self, value: &uint) -> bool {
+        self.map.contains_key(value)
     }
 
-    /// Return true if the set contains a value
     #[inline]
-    pub fn contains(&self, value: &uint) -> bool {
-        self.map.contains_key(value)
+    fn is_disjoint(&self, other: &TrieSet) -> bool {
+        self.iter().all(|v| !other.contains(&v))
     }
 
-    /// Add a value to the set. Return true if the value was not already
-    /// present in the set.
     #[inline]
-    pub fn insert(&mut self, value: uint) -> bool {
+    fn is_subset(&self, other: &TrieSet) -> bool {
+        self.iter().all(|v| other.contains(&v))
+    }
+
+    #[inline]
+    fn is_superset(&self, other: &TrieSet) -> bool {
+        other.is_subset(self)
+    }
+}
+
+impl MutableSet<uint> for TrieSet {
+    #[inline]
+    fn insert(&mut self, value: uint) -> bool {
         self.map.insert(value, ())
     }
 
-    /// Remove a value from the set. Return true if the value was
-    /// present in the set.
     #[inline]
-    pub fn remove(&mut self, value: &uint) -> bool {
+    fn remove(&mut self, value: &uint) -> bool {
         self.map.remove(value)
     }
+}
+
+impl TrieSet {
+    /// Create an empty TrieSet
+    #[inline]
+    pub fn new() -> TrieSet {
+        TrieSet{map: TrieMap::new()}
+    }
 
     /// Visit all values in reverse order
     #[inline]
@@ -346,7 +360,7 @@ impl TrieSet {
 }
 
 impl FromIterator<uint> for TrieSet {
-    fn from_iterator<Iter: Iterator<uint>>(iter: Iter) -> TrieSet {
+    fn from_iter<Iter: Iterator<uint>>(iter: Iter) -> TrieSet {
         let mut set = TrieSet::new();
         set.extend(iter);
         set
@@ -474,19 +488,19 @@ fn remove<T>(count: &mut uint, child: &mut Child<T>, key: uint,
 
 /// Forward iterator over a map
 pub struct Entries<'a, T> {
-    priv stack: [slice::Items<'a, Child<T>>, .. NUM_CHUNKS],
-    priv length: uint,
-    priv remaining_min: uint,
-    priv remaining_max: uint
+    stack: [slice::Items<'a, Child<T>>, .. NUM_CHUNKS],
+    length: uint,
+    remaining_min: uint,
+    remaining_max: uint
 }
 
 /// Forward iterator over the key-value pairs of a map, with the
 /// values being mutable.
 pub struct MutEntries<'a, T> {
-    priv stack: [slice::MutItems<'a, Child<T>>, .. NUM_CHUNKS],
-    priv length: uint,
-    priv remaining_min: uint,
-    priv remaining_max: uint
+    stack: [slice::MutItems<'a, Child<T>>, .. NUM_CHUNKS],
+    length: uint,
+    remaining_min: uint,
+    remaining_max: uint
 }
 
 // FIXME #5846: see `addr!` above.
@@ -605,7 +619,7 @@ iterator_impl! { MutEntries, iter = mut_iter, mutability = mut }
 
 /// Forward iterator over a set
 pub struct SetItems<'a> {
-    priv iter: Entries<'a, ()>
+    iter: Entries<'a, ()>
 }
 
 impl<'a> Iterator<uint> for SetItems<'a> {
diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs
index ca9475a0b23..ddcd8cf46bb 100644
--- a/src/libflate/lib.rs
+++ b/src/libflate/lib.rs
@@ -14,15 +14,15 @@ Simple compression
 
 */
 
-#[crate_id = "flate#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-#[feature(phase)];
-#[deny(deprecated_owned_vector)];
+#![crate_id = "flate#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+#![feature(phase)]
+#![deny(deprecated_owned_vector)]
 
 #[cfg(test)] #[phase(syntax, link)] extern crate log;
 
@@ -112,7 +112,7 @@ mod tests {
         for _ in range(0, 20) {
             let mut input = ~[];
             for _ in range(0, 2000) {
-                input.push_all(r.choose(words.as_slice()));
+                input.push_all(r.choose(words.as_slice()).as_slice());
             }
             debug!("de/inflate of {} bytes of random word-sequences",
                    input.len());
diff --git a/src/libfourcc/lib.rs b/src/libfourcc/lib.rs
index 98ac0d83433..267b0592d76 100644
--- a/src/libfourcc/lib.rs
+++ b/src/libfourcc/lib.rs
@@ -39,16 +39,16 @@ fn main() {
 
 */
 
-#[crate_id = "fourcc#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-
-#[deny(deprecated_owned_vector)];
-#[feature(macro_registrar, managed_boxes)];
+#![crate_id = "fourcc#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+
+#![deny(deprecated_owned_vector)]
+#![feature(macro_registrar, managed_boxes)]
 
 extern crate syntax;
 
diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs
index 4c6584a7d43..9d4f2e2f8f0 100644
--- a/src/libgetopts/lib.rs
+++ b/src/libgetopts/lib.rs
@@ -76,16 +76,16 @@
 //! }
 //! ~~~
 
-#[crate_id = "getopts#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-#[feature(globs, phase)];
-#[deny(missing_doc)];
-#[deny(deprecated_owned_vector)];
+#![crate_id = "getopts#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+#![feature(globs, phase)]
+#![deny(missing_doc)]
+#![deny(deprecated_owned_vector)]
 
 #[cfg(test)] #[phase(syntax, link)] extern crate log;
 
@@ -130,13 +130,13 @@ pub enum Occur {
 #[deriving(Clone, Eq)]
 pub struct Opt {
     /// Name of the option
-    name: Name,
+    pub name: Name,
     /// Whether it has an argument
-    hasarg: HasArg,
+    pub hasarg: HasArg,
     /// How often it can occur
-    occur: Occur,
+    pub occur: Occur,
     /// Which options it aliases
-    priv aliases: Vec<Opt> ,
+    pub aliases: Vec<Opt> ,
 }
 
 /// One group of options, e.g., both -h and --help, along with
@@ -144,17 +144,17 @@ pub struct Opt {
 #[deriving(Clone, Eq)]
 pub struct OptGroup {
     /// Short Name of the `OptGroup`
-    short_name: ~str,
+    pub short_name: ~str,
     /// Long Name of the `OptGroup`
-    long_name: ~str,
+    pub long_name: ~str,
     /// Hint
-    hint: ~str,
+    pub hint: ~str,
     /// Description
-    desc: ~str,
+    pub desc: ~str,
     /// Whether it has an argument
-    hasarg: HasArg,
+    pub hasarg: HasArg,
     /// How often it can occur
-    occur: Occur
+    pub occur: Occur
 }
 
 /// Describes wether an option is given at all or has a value.
@@ -169,11 +169,12 @@ enum Optval {
 #[deriving(Clone, Eq)]
 pub struct Matches {
     /// Options that matched
-    priv opts: Vec<Opt> ,
+    opts: Vec<Opt> ,
     /// Values of the Options that matched
-    priv vals: Vec<Vec<Optval> > ,
+    vals: Vec<Vec<Optval> > ,
     /// Free string fragments
-    free: Vec<~str> }
+    pub free: Vec<~str>,
+}
 
 /// The type returned when the command line does not conform to the
 /// expected format. Call the `to_err_msg` method to retrieve the
diff --git a/src/libglob/lib.rs b/src/libglob/lib.rs
index 9c017a27faa..5065fed0129 100644
--- a/src/libglob/lib.rs
+++ b/src/libglob/lib.rs
@@ -23,13 +23,13 @@
  * `glob`/`fnmatch` functions.
  */
 
-#[crate_id = "glob#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
+#![crate_id = "glob#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
 
 use std::cell::Cell;
 use std::{cmp, os, path};
@@ -41,10 +41,11 @@ use std::path::is_sep;
  * pattern - see the `glob` function for more details.
  */
 pub struct Paths {
-    priv root: Path,
-    priv dir_patterns: Vec<Pattern> ,
-    priv options: MatchOptions,
-    priv todo: Vec<(Path,uint)> }
+    root: Path,
+    dir_patterns: Vec<Pattern>,
+    options: MatchOptions,
+    todo: Vec<(Path,uint)>,
+}
 
 ///
 /// Return an iterator that produces all the Paths that match the given pattern,
@@ -176,7 +177,8 @@ fn list_dir_sorted(path: &Path) -> Vec<Path> {
  */
 #[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash, Default)]
 pub struct Pattern {
-    priv tokens: Vec<PatternToken> }
+    tokens: Vec<PatternToken>,
+}
 
 #[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash)]
 enum PatternToken {
@@ -513,13 +515,13 @@ pub struct MatchOptions {
      * currently only considers upper/lower case relationships between ASCII characters,
      * but in future this might be extended to work with Unicode.
      */
-    priv case_sensitive: bool,
+    case_sensitive: bool,
 
     /**
      * If this is true then path-component separator characters (e.g. `/` on Posix)
      * must be matched by a literal `/`, rather than by `*` or `?` or `[...]`
      */
-    priv require_literal_separator: bool,
+    require_literal_separator: bool,
 
     /**
      * If this is true then paths that contain components that start with a `.` will
@@ -527,7 +529,7 @@ pub struct MatchOptions {
      * will not match. This is useful because such files are conventionally considered
      * hidden on Unix systems and it might be desirable to skip them when listing files.
      */
-    priv require_literal_leading_dot: bool
+    require_literal_leading_dot: bool
 }
 
 impl MatchOptions {
diff --git a/src/libgreen/basic.rs b/src/libgreen/basic.rs
index b2596e56815..d2599aab14c 100644
--- a/src/libgreen/basic.rs
+++ b/src/libgreen/basic.rs
@@ -22,14 +22,14 @@ use std::rt::rtio::{EventLoop, IoFactory, RemoteCallback, PausableIdleCallback,
 use std::unstable::sync::Exclusive;
 
 /// This is the only exported function from this module.
-pub fn event_loop() -> ~EventLoop {
-    ~BasicLoop::new() as ~EventLoop
+pub fn event_loop() -> ~EventLoop:Send {
+    ~BasicLoop::new() as ~EventLoop:Send
 }
 
 struct BasicLoop {
-    work: ~[proc()],                  // pending work
+    work: ~[proc:Send()],             // pending work
     idle: Option<*mut BasicPausable>, // only one is allowed
-    remotes: ~[(uint, ~Callback)],
+    remotes: ~[(uint, ~Callback:Send)],
     next_remote: uint,
     messages: Exclusive<~[Message]>,
 }
@@ -135,26 +135,28 @@ impl EventLoop for BasicLoop {
         }
     }
 
-    fn callback(&mut self, f: proc()) {
+    fn callback(&mut self, f: proc:Send()) {
         self.work.push(f);
     }
 
     // FIXME: Seems like a really weird requirement to have an event loop provide.
-    fn pausable_idle_callback(&mut self, cb: ~Callback) -> ~PausableIdleCallback {
+    fn pausable_idle_callback(&mut self, cb: ~Callback:Send)
+        -> ~PausableIdleCallback:Send
+    {
         let callback = ~BasicPausable::new(self, cb);
         rtassert!(self.idle.is_none());
         unsafe {
             let cb_ptr: &*mut BasicPausable = cast::transmute(&callback);
             self.idle = Some(*cb_ptr);
         }
-        return callback as ~PausableIdleCallback;
+        callback as ~PausableIdleCallback:Send
     }
 
-    fn remote_callback(&mut self, f: ~Callback) -> ~RemoteCallback {
+    fn remote_callback(&mut self, f: ~Callback:Send) -> ~RemoteCallback:Send {
         let id = self.next_remote;
         self.next_remote += 1;
         self.remotes.push((id, f));
-        ~BasicRemote::new(self.messages.clone(), id) as ~RemoteCallback
+        ~BasicRemote::new(self.messages.clone(), id) as ~RemoteCallback:Send
     }
 
     fn io<'a>(&'a mut self) -> Option<&'a mut IoFactory> { None }
@@ -195,12 +197,12 @@ impl Drop for BasicRemote {
 
 struct BasicPausable {
     eloop: *mut BasicLoop,
-    work: ~Callback,
+    work: ~Callback:Send,
     active: bool,
 }
 
 impl BasicPausable {
-    fn new(eloop: &mut BasicLoop, cb: ~Callback) -> BasicPausable {
+    fn new(eloop: &mut BasicLoop, cb: ~Callback:Send) -> BasicPausable {
         BasicPausable {
             active: false,
             work: cb,
diff --git a/src/libgreen/context.rs b/src/libgreen/context.rs
index f072df73368..a521c9bee87 100644
--- a/src/libgreen/context.rs
+++ b/src/libgreen/context.rs
@@ -22,9 +22,9 @@ use std::raw;
 // then misalign the regs again.
 pub struct Context {
     /// Hold the registers while the task or scheduler is suspended
-    priv regs: ~Registers,
+    regs: ~Registers,
     /// Lower bound and upper bound for the stack
-    priv stack_bounds: Option<(uint, uint)>,
+    stack_bounds: Option<(uint, uint)>,
 }
 
 pub type InitFn = extern "C" fn(uint, *(), *()) -> !;
diff --git a/src/libgreen/coroutine.rs b/src/libgreen/coroutine.rs
index b20892886c6..f2e64dc25a9 100644
--- a/src/libgreen/coroutine.rs
+++ b/src/libgreen/coroutine.rs
@@ -22,10 +22,10 @@ pub struct Coroutine {
     ///
     /// Servo needs this to be public in order to tell SpiderMonkey
     /// about the stack bounds.
-    current_stack_segment: Stack,
+    pub current_stack_segment: Stack,
 
     /// Always valid if the task is alive and not running.
-    saved_context: Context
+    pub saved_context: Context
 }
 
 impl Coroutine {
diff --git a/src/libgreen/lib.rs b/src/libgreen/lib.rs
index 3f7685d6c20..5de8c637cf2 100644
--- a/src/libgreen/lib.rs
+++ b/src/libgreen/lib.rs
@@ -184,17 +184,17 @@
 //! pool.shutdown();
 //! ```
 
-#[crate_id = "green#0.10-pre"];
-#[license = "MIT/ASL2"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
+#![crate_id = "green#0.11-pre"]
+#![license = "MIT/ASL2"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
 
 // NB this does *not* include globs, please keep it that way.
-#[feature(macro_rules, phase)];
-#[allow(visible_private_types)];
+#![feature(macro_rules, phase)]
+#![allow(visible_private_types)]
 
 #[cfg(test)] #[phase(syntax, link)] extern crate log;
 #[cfg(test)] extern crate rustuv;
@@ -247,7 +247,7 @@ pub mod task;
 /// The return value is used as the process return code. 0 on success, 101 on
 /// error.
 pub fn start(argc: int, argv: **u8,
-             event_loop_factory: fn() -> ~rtio::EventLoop,
+             event_loop_factory: fn() -> ~rtio::EventLoop:Send,
              main: proc()) -> int {
     rt::init(argc, argv);
     let mut main = Some(main);
@@ -268,7 +268,8 @@ pub fn start(argc: int, argv: **u8,
 ///
 /// This function will not return until all schedulers in the associated pool
 /// have returned.
-pub fn run(event_loop_factory: fn() -> ~rtio::EventLoop, main: proc()) -> int {
+pub fn run(event_loop_factory: fn() -> ~rtio::EventLoop:Send,
+           main: proc()) -> int {
     // Create a scheduler pool and spawn the main task into this pool. We will
     // get notified over a channel when the main task exits.
     let mut cfg = PoolConfig::new();
@@ -295,10 +296,10 @@ pub fn run(event_loop_factory: fn() -> ~rtio::EventLoop, main: proc()) -> int {
 /// Configuration of how an M:N pool of schedulers is spawned.
 pub struct PoolConfig {
     /// The number of schedulers (OS threads) to spawn into this M:N pool.
-    threads: uint,
+    pub threads: uint,
     /// A factory function used to create new event loops. If this is not
     /// specified then the default event loop factory is used.
-    event_loop_factory: fn() -> ~rtio::EventLoop,
+    pub event_loop_factory: fn() -> ~rtio::EventLoop:Send,
 }
 
 impl PoolConfig {
@@ -315,17 +316,17 @@ impl PoolConfig {
 /// A structure representing a handle to a pool of schedulers. This handle is
 /// used to keep the pool alive and also reap the status from the pool.
 pub struct SchedPool {
-    priv id: uint,
-    priv threads: ~[Thread<()>],
-    priv handles: ~[SchedHandle],
-    priv stealers: ~[deque::Stealer<~task::GreenTask>],
-    priv next_friend: uint,
-    priv stack_pool: StackPool,
-    priv deque_pool: deque::BufferPool<~task::GreenTask>,
-    priv sleepers: SleeperList,
-    priv factory: fn() -> ~rtio::EventLoop,
-    priv task_state: TaskState,
-    priv tasks_done: Receiver<()>,
+    id: uint,
+    threads: ~[Thread<()>],
+    handles: ~[SchedHandle],
+    stealers: ~[deque::Stealer<~task::GreenTask>],
+    next_friend: uint,
+    stack_pool: StackPool,
+    deque_pool: deque::BufferPool<~task::GreenTask>,
+    sleepers: SleeperList,
+    factory: fn() -> ~rtio::EventLoop:Send,
+    task_state: TaskState,
+    tasks_done: Receiver<()>,
 }
 
 /// This is an internal state shared among a pool of schedulers. This is used to
diff --git a/src/libgreen/macros.rs b/src/libgreen/macros.rs
index ab106138ae1..599ef8d4077 100644
--- a/src/libgreen/macros.rs
+++ b/src/libgreen/macros.rs
@@ -10,7 +10,7 @@
 
 // FIXME: this file probably shouldn't exist
 
-#[macro_escape];
+#![macro_escape]
 
 use std::fmt;
 
diff --git a/src/libgreen/message_queue.rs b/src/libgreen/message_queue.rs
index 3a118476aff..50666b8c649 100644
--- a/src/libgreen/message_queue.rs
+++ b/src/libgreen/message_queue.rs
@@ -23,11 +23,11 @@ pub fn queue<T: Send>() -> (Consumer<T>, Producer<T>) {
 }
 
 pub struct Producer<T> {
-    priv inner: UnsafeArc<mpsc::Queue<T>>,
+    inner: UnsafeArc<mpsc::Queue<T>>,
 }
 
 pub struct Consumer<T> {
-    priv inner: UnsafeArc<mpsc::Queue<T>>,
+    inner: UnsafeArc<mpsc::Queue<T>>,
 }
 
 impl<T: Send> Consumer<T> {
diff --git a/src/libgreen/sched.rs b/src/libgreen/sched.rs
index 5571d4f4687..683df846d62 100644
--- a/src/libgreen/sched.rs
+++ b/src/libgreen/sched.rs
@@ -39,7 +39,12 @@ pub struct Scheduler {
     /// ID number of the pool that this scheduler is a member of. When
     /// reawakening green tasks, this is used to ensure that tasks aren't
     /// reawoken on the wrong pool of schedulers.
-    pool_id: uint,
+    pub pool_id: uint,
+    /// The pool of stacks that this scheduler has cached
+    pub stack_pool: StackPool,
+    /// Bookkeeping for the number of tasks which are currently running around
+    /// inside this pool of schedulers
+    pub task_state: TaskState,
     /// There are N work queues, one per scheduler.
     work_queue: deque::Worker<~GreenTask>,
     /// Work queues for the other schedulers. These are created by
@@ -64,7 +69,6 @@ pub struct Scheduler {
     /// A flag to indicate we've received the shutdown message and should
     /// no longer try to go to sleep, but exit instead.
     no_sleep: bool,
-    stack_pool: StackPool,
     /// The scheduler runs on a special task. When it is not running
     /// it is stored here instead of the work queue.
     sched_task: Option<~GreenTask>,
@@ -79,7 +83,7 @@ pub struct Scheduler {
     /// A fast XorShift rng for scheduler use
     rng: XorShiftRng,
     /// A togglable idle callback
-    idle_callback: Option<~PausableIdleCallback>,
+    idle_callback: Option<~PausableIdleCallback:Send>,
     /// A countdown that starts at a random value and is decremented
     /// every time a yield check is performed. When it hits 0 a task
     /// will yield.
@@ -87,9 +91,6 @@ pub struct Scheduler {
     /// A flag to tell the scheduler loop it needs to do some stealing
     /// in order to introduce randomness as part of a yield
     steal_for_yield: bool,
-    /// Bookkeeping for the number of tasks which are currently running around
-    /// inside this pool of schedulers
-    task_state: TaskState,
 
     // n.b. currently destructors of an object are run in top-to-bottom in order
     //      of field declaration. Due to its nature, the pausable idle callback
@@ -99,7 +100,7 @@ pub struct Scheduler {
     //      destroyed before it's actually destroyed.
 
     /// The event loop used to drive the scheduler and perform I/O
-    event_loop: ~EventLoop,
+    pub event_loop: ~EventLoop:Send,
 }
 
 /// An indication of how hard to work on a given operation, the difference
@@ -122,7 +123,7 @@ impl Scheduler {
     // * Initialization Functions
 
     pub fn new(pool_id: uint,
-               event_loop: ~EventLoop,
+               event_loop: ~EventLoop:Send,
                work_queue: deque::Worker<~GreenTask>,
                work_queues: ~[deque::Stealer<~GreenTask>],
                sleeper_list: SleeperList,
@@ -135,7 +136,7 @@ impl Scheduler {
     }
 
     pub fn new_special(pool_id: uint,
-                       event_loop: ~EventLoop,
+                       event_loop: ~EventLoop:Send,
                        work_queue: deque::Worker<~GreenTask>,
                        work_queues: ~[deque::Stealer<~GreenTask>],
                        sleeper_list: SleeperList,
@@ -182,7 +183,7 @@ impl Scheduler {
     pub fn bootstrap(mut ~self) {
 
         // Build an Idle callback.
-        let cb = ~SchedRunner as ~Callback;
+        let cb = ~SchedRunner as ~Callback:Send;
         self.idle_callback = Some(self.event_loop.pausable_idle_callback(cb));
 
         // Create a task for the scheduler with an empty context.
@@ -230,7 +231,7 @@ impl Scheduler {
         // mutable reference to the event_loop to give it the "run"
         // command.
         unsafe {
-            let event_loop: *mut ~EventLoop = &mut self.event_loop;
+            let event_loop: *mut ~EventLoop:Send = &mut self.event_loop;
             // Our scheduler must be in the task before the event loop
             // is started.
             stask.put_with_sched(self);
@@ -868,7 +869,7 @@ impl Scheduler {
     }
 
     pub fn make_handle(&mut self) -> SchedHandle {
-        let remote = self.event_loop.remote_callback(~SchedRunner as ~Callback);
+        let remote = self.event_loop.remote_callback(~SchedRunner);
 
         return SchedHandle {
             remote: remote,
@@ -893,9 +894,9 @@ pub enum SchedMessage {
 }
 
 pub struct SchedHandle {
-    priv remote: ~RemoteCallback,
-    priv queue: msgq::Producer<SchedMessage>,
-    sched_id: uint
+    remote: ~RemoteCallback:Send,
+    queue: msgq::Producer<SchedMessage>,
+    pub sched_id: uint
 }
 
 impl SchedHandle {
@@ -966,7 +967,12 @@ impl ClosureConverter for UnsafeTaskReceiver {
 // worry there.
 #[cfg(windows)]
 fn new_sched_rng() -> XorShiftRng {
-    XorShiftRng::new()
+    match XorShiftRng::new() {
+        Ok(r) => r,
+        Err(e) => {
+            rtabort!("sched: failed to create seeded RNG: {}", e)
+        }
+    }
 }
 #[cfg(unix)]
 fn new_sched_rng() -> XorShiftRng {
@@ -1007,7 +1013,6 @@ mod test {
 
     use std::comm;
     use std::task::TaskOpts;
-    use std::rt::Runtime;
     use std::rt::task::Task;
     use std::rt::local::Local;
 
@@ -1034,7 +1039,7 @@ mod test {
         match task.get().maybe_take_runtime::<GreenTask>() {
             Some(green) => {
                 let ret = green.sched.get_ref().sched_id();
-                task.get().put_runtime(green as ~Runtime);
+                task.get().put_runtime(green);
                 return ret;
             }
             None => fail!()
@@ -1474,7 +1479,7 @@ mod test {
             let mut handle = pool.spawn_sched();
             handle.send(PinnedTask(pool.task(TaskOpts::new(), proc() {
                 unsafe {
-                    let mut guard = LOCK.lock();
+                    let guard = LOCK.lock();
 
                     start_tx.send(());
                     guard.wait();   // block the scheduler thread
@@ -1510,7 +1515,7 @@ mod test {
                 child_tx.send(20);
                 pingpong(&parent_rx, &child_tx);
                 unsafe {
-                    let mut guard = LOCK.lock();
+                    let guard = LOCK.lock();
                     guard.signal();   // wakeup waiting scheduler
                     guard.wait();     // wait for them to grab the lock
                 }
diff --git a/src/libgreen/simple.rs b/src/libgreen/simple.rs
index 01e620df2d6..75a53b0bbd3 100644
--- a/src/libgreen/simple.rs
+++ b/src/libgreen/simple.rs
@@ -34,7 +34,7 @@ impl Runtime for SimpleTask {
 
         let me = &mut *self as *mut SimpleTask;
         let cur_dupe = &*cur_task as *Task;
-        cur_task.put_runtime(self as ~Runtime);
+        cur_task.put_runtime(self);
         let task = BlockedTask::block(cur_task);
 
         // See libnative/task.rs for what's going on here with the `awoken`
@@ -57,7 +57,7 @@ impl Runtime for SimpleTask {
     }
     fn reawaken(mut ~self, mut to_wake: ~Task) {
         let me = &mut *self as *mut SimpleTask;
-        to_wake.put_runtime(self as ~Runtime);
+        to_wake.put_runtime(self);
         unsafe {
             cast::forget(to_wake);
             let guard = (*me).lock.lock();
@@ -86,6 +86,6 @@ pub fn task() -> ~Task {
     task.put_runtime(~SimpleTask {
         lock: unsafe {NativeMutex::new()},
         awoken: false,
-    } as ~Runtime);
+    });
     return task;
 }
diff --git a/src/libgreen/sleeper_list.rs b/src/libgreen/sleeper_list.rs
index 5be260efdfa..5df866955e6 100644
--- a/src/libgreen/sleeper_list.rs
+++ b/src/libgreen/sleeper_list.rs
@@ -16,7 +16,7 @@ use std::sync::mpmc_bounded_queue::Queue;
 use sched::SchedHandle;
 
 pub struct SleeperList {
-    priv q: Queue<SchedHandle>,
+    q: Queue<SchedHandle>,
 }
 
 impl SleeperList {
diff --git a/src/libgreen/stack.rs b/src/libgreen/stack.rs
index 053d73c010e..497c1dc664a 100644
--- a/src/libgreen/stack.rs
+++ b/src/libgreen/stack.rs
@@ -15,9 +15,9 @@ use std::libc;
 
 /// A task's stack. The name "Stack" is a vestige of segmented stacks.
 pub struct Stack {
-    priv buf: MemoryMap,
-    priv min_size: uint,
-    priv valgrind_id: libc::c_uint,
+    buf: MemoryMap,
+    min_size: uint,
+    valgrind_id: libc::c_uint,
 }
 
 // Try to use MAP_STACK on platforms that support it (it's what we're doing
@@ -126,7 +126,7 @@ impl Drop for Stack {
 pub struct StackPool {
     // Ideally this would be some datastructure that preserved ordering on
     // Stack.min_size.
-    priv stacks: ~[Stack],
+    stacks: ~[Stack],
 }
 
 impl StackPool {
diff --git a/src/libgreen/task.rs b/src/libgreen/task.rs
index 25e868470bf..6fa40c0e42b 100644
--- a/src/libgreen/task.rs
+++ b/src/libgreen/task.rs
@@ -42,32 +42,32 @@ pub struct GreenTask {
     /// context and the stack that this task owns. This field is optional to
     /// relinquish ownership back to a scheduler to recycle stacks at a later
     /// date.
-    coroutine: Option<Coroutine>,
+    pub coroutine: Option<Coroutine>,
 
     /// Optional handle back into the home sched pool of this task. This field
     /// is lazily initialized.
-    handle: Option<SchedHandle>,
+    pub handle: Option<SchedHandle>,
 
     /// Slot for maintaining ownership of a scheduler. If a task is running,
     /// this value will be Some(sched) where the task is running on "sched".
-    sched: Option<~Scheduler>,
+    pub sched: Option<~Scheduler>,
 
     /// Temporary ownership slot of a std::rt::task::Task object. This is used
     /// to squirrel that libstd task away while we're performing green task
     /// operations.
-    task: Option<~Task>,
+    pub task: Option<~Task>,
 
     /// Dictates whether this is a sched task or a normal green task
-    task_type: TaskType,
+    pub task_type: TaskType,
 
     /// Home pool that this task was spawned into. This field is lazily
     /// initialized until when the task is initially scheduled, and is used to
     /// make sure that tasks are always woken up in the correct pool of
     /// schedulers.
-    pool_id: uint,
+    pub pool_id: uint,
 
     // See the comments in the scheduler about why this is necessary
-    nasty_deschedule_lock: NativeMutex,
+    pub nasty_deschedule_lock: NativeMutex,
 }
 
 pub enum TaskType {
@@ -287,7 +287,7 @@ impl GreenTask {
 
     pub fn swap(mut ~self) -> ~Task {
         let mut task = self.task.take_unwrap();
-        task.put_runtime(self as ~Runtime);
+        task.put_runtime(self);
         return task;
     }
 
@@ -482,7 +482,6 @@ impl Runtime for GreenTask {
 
 #[cfg(test)]
 mod tests {
-    use std::rt::Runtime;
     use std::rt::local::Local;
     use std::rt::task::Task;
     use std::task;
@@ -576,7 +575,7 @@ mod tests {
                 let mut task: ~Task = Local::take();
                 match task.maybe_take_runtime::<GreenTask>() {
                     Some(ops) => {
-                        task.put_runtime(ops as ~Runtime);
+                        task.put_runtime(ops);
                     }
                     None => fail!(),
                 }
diff --git a/src/libhexfloat/lib.rs b/src/libhexfloat/lib.rs
index 1be72393372..9f2f417080f 100644
--- a/src/libhexfloat/lib.rs
+++ b/src/libhexfloat/lib.rs
@@ -36,16 +36,16 @@ fn main() {
 
 */
 
-#[crate_id = "hexfloat#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-
-#[deny(deprecated_owned_vector)];
-#[feature(macro_registrar, managed_boxes)];
+#![crate_id = "hexfloat#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+
+#![deny(deprecated_owned_vector)]
+#![feature(macro_registrar, managed_boxes)]
 
 extern crate syntax;
 
diff --git a/src/liblog/directive.rs b/src/liblog/directive.rs
index 50639a59eb9..0d901d54e85 100644
--- a/src/liblog/directive.rs
+++ b/src/liblog/directive.rs
@@ -12,8 +12,8 @@ use std::cmp;
 
 #[deriving(Show, Clone)]
 pub struct LogDirective {
-    name: Option<~str>,
-    level: u32,
+    pub name: Option<~str>,
+    pub level: u32,
 }
 
 static LOG_LEVEL_NAMES: [&'static str, ..4] = ["error", "warn", "info",
diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs
index 75a8eae6c08..0656dd1f641 100644
--- a/src/liblog/lib.rs
+++ b/src/liblog/lib.rs
@@ -1,4 +1,4 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -15,7 +15,7 @@ Utilities for program-wide and customizable logging
 ## Example
 
 ```
-#[feature(phase)];
+#![feature(phase)]
 #[phase(syntax, link)] extern crate log;
 
 fn main() {
@@ -105,16 +105,16 @@ if logging is disabled, none of the components of the log will be executed.
 
 */
 
-#[crate_id = "log#0.10-pre"];
-#[license = "MIT/ASL2"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
+#![crate_id = "log#0.11-pre"]
+#![license = "MIT/ASL2"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
 
-#[feature(macro_rules)];
-#[deny(missing_doc, deprecated_owned_vector)];
+#![feature(macro_rules)]
+#![deny(missing_doc, deprecated_owned_vector)]
 
 extern crate sync;
 
@@ -156,7 +156,7 @@ pub static WARN: u32 = 2;
 /// Error log level
 pub static ERROR: u32 = 1;
 
-local_data_key!(local_logger: ~Logger)
+local_data_key!(local_logger: ~Logger:Send)
 
 /// A trait used to represent an interface to a task-local logger. Each task
 /// can have its own custom logger which can respond to logging messages
@@ -203,7 +203,7 @@ pub fn log(level: u32, args: &fmt::Arguments) {
     // frob the slot while we're doing the logging. This will destroy any logger
     // set during logging.
     let mut logger = local_data::pop(local_logger).unwrap_or_else(|| {
-        ~DefaultLogger { handle: io::stderr() } as ~Logger
+        ~DefaultLogger { handle: io::stderr() } as ~Logger:Send
     });
     logger.log(level, args);
     local_data::set(local_logger, logger);
@@ -217,7 +217,7 @@ pub fn log_level() -> u32 { unsafe { LOG_LEVEL } }
 
 /// Replaces the task-local logger with the specified logger, returning the old
 /// logger.
-pub fn set_logger(logger: ~Logger) -> Option<~Logger> {
+pub fn set_logger(logger: ~Logger:Send) -> Option<~Logger:Send> {
     let prev = local_data::pop(local_logger);
     local_data::set(local_logger, logger);
     return prev;
diff --git a/src/liblog/macros.rs b/src/liblog/macros.rs
index 1560eeebfca..f1d4a318bf0 100644
--- a/src/liblog/macros.rs
+++ b/src/liblog/macros.rs
@@ -10,7 +10,7 @@
 
 //! Logging macros
 
-#[macro_escape];
+#![macro_escape]
 
 /// The standard logging macro
 ///
@@ -21,7 +21,7 @@
 /// # Example
 ///
 /// ```
-/// #[feature(phase)];
+/// #![feature(phase)]
 /// #[phase(syntax, link)] extern crate log;
 ///
 /// # fn main() {
@@ -45,7 +45,7 @@ macro_rules! log(
 /// # Example
 ///
 /// ```
-/// #[feature(phase)];
+/// #![feature(phase)]
 /// #[phase(syntax, link)] extern crate log;
 ///
 /// # fn main() {
@@ -63,7 +63,7 @@ macro_rules! error(
 /// # Example
 ///
 /// ```
-/// #[feature(phase)];
+/// #![feature(phase)]
 /// #[phase(syntax, link)] extern crate log;
 ///
 /// # fn main() {
@@ -81,7 +81,7 @@ macro_rules! warn(
 /// # Example
 ///
 /// ```
-/// #[feature(phase)];
+/// #![feature(phase)]
 /// #[phase(syntax, link)] extern crate log;
 ///
 /// # fn main() {
@@ -101,7 +101,7 @@ macro_rules! info(
 /// # Example
 ///
 /// ```
-/// #[feature(phase)];
+/// #![feature(phase)]
 /// #[phase(syntax, link)] extern crate log;
 ///
 /// # fn main() {
@@ -118,7 +118,7 @@ macro_rules! debug(
 /// # Example
 ///
 /// ```
-/// #[feature(phase)];
+/// #![feature(phase)]
 /// #[phase(syntax, link)] extern crate log;
 ///
 /// # fn main() {
diff --git a/src/libnative/io/addrinfo.rs b/src/libnative/io/addrinfo.rs
index ff617e5a230..bca564870e2 100644
--- a/src/libnative/io/addrinfo.rs
+++ b/src/libnative/io/addrinfo.rs
@@ -96,10 +96,8 @@ extern "system" {
 
 #[cfg(windows)]
 fn get_error(_: c_int) -> IoError {
-    use super::translate_error;
-
     unsafe {
-        translate_error(WSAGetLastError() as i32, true)
+        IoError::from_errno(WSAGetLastError() as uint, true)
     }
 }
 
diff --git a/src/libnative/io/file_unix.rs b/src/libnative/io/file_unix.rs
index b997aa4f11c..143228b14e9 100644
--- a/src/libnative/io/file_unix.rs
+++ b/src/libnative/io/file_unix.rs
@@ -30,7 +30,7 @@ struct Inner {
 }
 
 pub struct FileDesc {
-    priv inner: UnsafeArc<Inner>
+    inner: UnsafeArc<Inner>
 }
 
 impl FileDesc {
@@ -176,8 +176,8 @@ impl rtio::RtioPipe for FileDesc {
     fn write(&mut self, buf: &[u8]) -> Result<(), IoError> {
         self.inner_write(buf)
     }
-    fn clone(&self) -> ~rtio::RtioPipe {
-        ~FileDesc { inner: self.inner.clone() } as ~rtio::RtioPipe
+    fn clone(&self) -> ~rtio::RtioPipe:Send {
+        ~FileDesc { inner: self.inner.clone() } as ~rtio::RtioPipe:Send
     }
 }
 
@@ -216,8 +216,8 @@ impl Drop for Inner {
 }
 
 pub struct CFile {
-    priv file: *libc::FILE,
-    priv fd: FileDesc,
+    file: *libc::FILE,
+    fd: FileDesc,
 }
 
 impl CFile {
diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs
index 28b963ab348..c19e81b5de4 100644
--- a/src/libnative/io/file_win32.rs
+++ b/src/libnative/io/file_win32.rs
@@ -34,7 +34,7 @@ struct Inner {
 }
 
 pub struct FileDesc {
-    priv inner: UnsafeArc<Inner>
+    inner: UnsafeArc<Inner>
 }
 
 impl FileDesc {
@@ -206,8 +206,8 @@ impl rtio::RtioPipe for FileDesc {
     fn write(&mut self, buf: &[u8]) -> Result<(), IoError> {
         self.inner_write(buf)
     }
-    fn clone(&self) -> ~rtio::RtioPipe {
-        ~FileDesc { inner: self.inner.clone() } as ~rtio::RtioPipe
+    fn clone(&self) -> ~rtio::RtioPipe:Send {
+        ~FileDesc { inner: self.inner.clone() } as ~rtio::RtioPipe:Send
     }
 }
 
diff --git a/src/libnative/io/mod.rs b/src/libnative/io/mod.rs
index e802c8f0301..34843102456 100644
--- a/src/libnative/io/mod.rs
+++ b/src/libnative/io/mod.rs
@@ -86,73 +86,10 @@ fn unimpl() -> IoError {
     }
 }
 
-fn translate_error(errno: i32, detail: bool) -> IoError {
-    #[cfg(windows)]
-    fn get_err(errno: i32) -> (io::IoErrorKind, &'static str) {
-        match errno {
-            libc::EOF => (io::EndOfFile, "end of file"),
-            libc::ERROR_NO_DATA => (io::BrokenPipe, "the pipe is being closed"),
-            libc::ERROR_FILE_NOT_FOUND => (io::FileNotFound, "file not found"),
-            libc::ERROR_INVALID_NAME => (io::InvalidInput, "invalid file name"),
-            libc::WSAECONNREFUSED => (io::ConnectionRefused, "connection refused"),
-            libc::WSAECONNRESET => (io::ConnectionReset, "connection reset"),
-            libc::WSAEACCES => (io::PermissionDenied, "permission denied"),
-            libc::WSAEWOULDBLOCK => {
-                (io::ResourceUnavailable, "resource temporarily unavailable")
-            }
-            libc::WSAENOTCONN => (io::NotConnected, "not connected"),
-            libc::WSAECONNABORTED => (io::ConnectionAborted, "connection aborted"),
-            libc::WSAEADDRNOTAVAIL => (io::ConnectionRefused, "address not available"),
-            libc::WSAEADDRINUSE => (io::ConnectionRefused, "address in use"),
-            libc::ERROR_BROKEN_PIPE => (io::EndOfFile, "the pipe has ended"),
-
-            // libuv maps this error code to EISDIR. we do too. if it is found
-            // to be incorrect, we can add in some more machinery to only
-            // return this message when ERROR_INVALID_FUNCTION after certain
-            // win32 calls.
-            libc::ERROR_INVALID_FUNCTION => (io::InvalidInput,
-                                             "illegal operation on a directory"),
-
-            _ => (io::OtherIoError, "unknown error")
-        }
-    }
-
-    #[cfg(not(windows))]
-    fn get_err(errno: i32) -> (io::IoErrorKind, &'static str) {
-        // FIXME: this should probably be a bit more descriptive...
-        match errno {
-            libc::EOF => (io::EndOfFile, "end of file"),
-            libc::ECONNREFUSED => (io::ConnectionRefused, "connection refused"),
-            libc::ECONNRESET => (io::ConnectionReset, "connection reset"),
-            libc::EPERM | libc::EACCES =>
-                (io::PermissionDenied, "permission denied"),
-            libc::EPIPE => (io::BrokenPipe, "broken pipe"),
-            libc::ENOTCONN => (io::NotConnected, "not connected"),
-            libc::ECONNABORTED => (io::ConnectionAborted, "connection aborted"),
-            libc::EADDRNOTAVAIL => (io::ConnectionRefused, "address not available"),
-            libc::EADDRINUSE => (io::ConnectionRefused, "address in use"),
-            libc::ENOENT => (io::FileNotFound, "no such file or directory"),
-            libc::EISDIR => (io::InvalidInput, "illegal operation on a directory"),
-
-            // These two constants can have the same value on some systems, but
-            // different values on others, so we can't use a match clause
-            x if x == libc::EAGAIN || x == libc::EWOULDBLOCK =>
-                (io::ResourceUnavailable, "resource temporarily unavailable"),
-
-            _ => (io::OtherIoError, "unknown error")
-        }
-    }
-
-    let (kind, desc) = get_err(errno);
-    IoError {
-        kind: kind,
-        desc: desc,
-        detail: if detail {Some(os::last_os_error())} else {None},
-    }
+fn last_error() -> IoError {
+    IoError::last_error()
 }
 
-fn last_error() -> IoError { translate_error(os::errno() as i32, true) }
-
 // unix has nonzero values as errors
 fn mkerr_libc(ret: libc::c_int) -> IoResult<()> {
     if ret != 0 {
@@ -215,7 +152,7 @@ fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
 /// Implementation of rt::rtio's IoFactory trait to generate handles to the
 /// native I/O functionality.
 pub struct IoFactory {
-    priv cannot_construct_outside_of_this_module: ()
+    cannot_construct_outside_of_this_module: ()
 }
 
 impl IoFactory {
@@ -227,20 +164,20 @@ impl IoFactory {
 
 impl rtio::IoFactory for IoFactory {
     // networking
-    fn tcp_connect(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpStream> {
-        net::TcpStream::connect(addr).map(|s| ~s as ~RtioTcpStream)
+    fn tcp_connect(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpStream:Send> {
+        net::TcpStream::connect(addr).map(|s| ~s as ~RtioTcpStream:Send)
     }
-    fn tcp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpListener> {
-        net::TcpListener::bind(addr).map(|s| ~s as ~RtioTcpListener)
+    fn tcp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpListener:Send> {
+        net::TcpListener::bind(addr).map(|s| ~s as ~RtioTcpListener:Send)
     }
-    fn udp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioUdpSocket> {
-        net::UdpSocket::bind(addr).map(|u| ~u as ~RtioUdpSocket)
+    fn udp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioUdpSocket:Send> {
+        net::UdpSocket::bind(addr).map(|u| ~u as ~RtioUdpSocket:Send)
     }
-    fn unix_bind(&mut self, path: &CString) -> IoResult<~RtioUnixListener> {
-        pipe::UnixListener::bind(path).map(|s| ~s as ~RtioUnixListener)
+    fn unix_bind(&mut self, path: &CString) -> IoResult<~RtioUnixListener:Send> {
+        pipe::UnixListener::bind(path).map(|s| ~s as ~RtioUnixListener:Send)
     }
-    fn unix_connect(&mut self, path: &CString) -> IoResult<~RtioPipe> {
-        pipe::UnixStream::connect(path).map(|s| ~s as ~RtioPipe)
+    fn unix_connect(&mut self, path: &CString) -> IoResult<~RtioPipe:Send> {
+        pipe::UnixStream::connect(path).map(|s| ~s as ~RtioPipe:Send)
     }
     fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
                           hint: Option<ai::Hint>) -> IoResult<~[ai::Info]> {
@@ -249,16 +186,16 @@ impl rtio::IoFactory for IoFactory {
 
     // filesystem operations
     fn fs_from_raw_fd(&mut self, fd: c_int,
-                      close: CloseBehavior) -> ~RtioFileStream {
+                      close: CloseBehavior) -> ~RtioFileStream:Send {
         let close = match close {
             rtio::CloseSynchronously | rtio::CloseAsynchronously => true,
             rtio::DontClose => false
         };
-        ~file::FileDesc::new(fd, close) as ~RtioFileStream
+        ~file::FileDesc::new(fd, close) as ~RtioFileStream:Send
     }
     fn fs_open(&mut self, path: &CString, fm: io::FileMode, fa: io::FileAccess)
-        -> IoResult<~RtioFileStream> {
-        file::open(path, fm, fa).map(|fd| ~fd as ~RtioFileStream)
+        -> IoResult<~RtioFileStream:Send> {
+        file::open(path, fm, fa).map(|fd| ~fd as ~RtioFileStream:Send)
     }
     fn fs_unlink(&mut self, path: &CString) -> IoResult<()> {
         file::unlink(path)
@@ -304,25 +241,27 @@ impl rtio::IoFactory for IoFactory {
     }
 
     // misc
-    fn timer_init(&mut self) -> IoResult<~RtioTimer> {
-        timer::Timer::new().map(|t| ~t as ~RtioTimer)
+    fn timer_init(&mut self) -> IoResult<~RtioTimer:Send> {
+        timer::Timer::new().map(|t| ~t as ~RtioTimer:Send)
     }
     fn spawn(&mut self, config: ProcessConfig)
-            -> IoResult<(~RtioProcess, ~[Option<~RtioPipe>])> {
+            -> IoResult<(~RtioProcess:Send, ~[Option<~RtioPipe:Send>])> {
         process::Process::spawn(config).map(|(p, io)| {
-            (~p as ~RtioProcess,
-             io.move_iter().map(|p| p.map(|p| ~p as ~RtioPipe)).collect())
+            (~p as ~RtioProcess:Send,
+             io.move_iter().map(|p| p.map(|p| ~p as ~RtioPipe:Send)).collect())
         })
     }
     fn kill(&mut self, pid: libc::pid_t, signum: int) -> IoResult<()> {
         process::Process::kill(pid, signum)
     }
-    fn pipe_open(&mut self, fd: c_int) -> IoResult<~RtioPipe> {
-        Ok(~file::FileDesc::new(fd, true) as ~RtioPipe)
+    fn pipe_open(&mut self, fd: c_int) -> IoResult<~RtioPipe:Send> {
+        Ok(~file::FileDesc::new(fd, true) as ~RtioPipe:Send)
     }
-    fn tty_open(&mut self, fd: c_int, _readable: bool) -> IoResult<~RtioTTY> {
+    fn tty_open(&mut self, fd: c_int, _readable: bool)
+        -> IoResult<~RtioTTY:Send>
+    {
         if unsafe { libc::isatty(fd) } != 0 {
-            Ok(~file::FileDesc::new(fd, true) as ~RtioTTY)
+            Ok(~file::FileDesc::new(fd, true) as ~RtioTTY:Send)
         } else {
             Err(IoError {
                 kind: io::MismatchedFileTypeForOperation,
@@ -332,7 +271,7 @@ impl rtio::IoFactory for IoFactory {
         }
     }
     fn signal(&mut self, _signal: Signum, _channel: Sender<Signum>)
-        -> IoResult<~RtioSignal> {
+        -> IoResult<~RtioSignal:Send> {
         Err(unimpl())
     }
 }
diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs
index 6a711072942..6ddd69eb019 100644
--- a/src/libnative/io/net.rs
+++ b/src/libnative/io/net.rs
@@ -120,7 +120,7 @@ fn last_error() -> io::IoError {
     extern "system" {
         fn WSAGetLastError() -> libc::c_int;
     }
-    super::translate_error(unsafe { WSAGetLastError() }, true)
+    io::IoError::from_errno(unsafe { WSAGetLastError() } as uint, true)
 }
 
 #[cfg(not(windows))]
@@ -237,7 +237,7 @@ pub fn init() {
 ////////////////////////////////////////////////////////////////////////////////
 
 pub struct TcpStream {
-    priv inner: UnsafeArc<Inner>,
+    inner: UnsafeArc<Inner>,
 }
 
 struct Inner {
@@ -348,8 +348,8 @@ impl rtio::RtioTcpStream for TcpStream {
         self.set_keepalive(None)
     }
 
-    fn clone(&self) -> ~rtio::RtioTcpStream {
-        ~TcpStream { inner: self.inner.clone() } as ~rtio::RtioTcpStream
+    fn clone(&self) -> ~rtio::RtioTcpStream:Send {
+        ~TcpStream { inner: self.inner.clone() } as ~rtio::RtioTcpStream:Send
     }
     fn close_write(&mut self) -> IoResult<()> {
         super::mkerr_libc(unsafe {
@@ -373,7 +373,7 @@ impl Drop for Inner {
 ////////////////////////////////////////////////////////////////////////////////
 
 pub struct TcpListener {
-    priv inner: UnsafeArc<Inner>,
+    inner: UnsafeArc<Inner>,
 }
 
 impl TcpListener {
@@ -418,8 +418,8 @@ impl TcpListener {
 }
 
 impl rtio::RtioTcpListener for TcpListener {
-    fn listen(~self) -> IoResult<~rtio::RtioTcpAcceptor> {
-        self.native_listen(128).map(|a| ~a as ~rtio::RtioTcpAcceptor)
+    fn listen(~self) -> IoResult<~rtio::RtioTcpAcceptor:Send> {
+        self.native_listen(128).map(|a| ~a as ~rtio::RtioTcpAcceptor:Send)
     }
 }
 
@@ -430,7 +430,7 @@ impl rtio::RtioSocket for TcpListener {
 }
 
 pub struct TcpAcceptor {
-    priv listener: TcpListener,
+    listener: TcpListener,
 }
 
 impl TcpAcceptor {
@@ -461,8 +461,8 @@ impl rtio::RtioSocket for TcpAcceptor {
 }
 
 impl rtio::RtioTcpAcceptor for TcpAcceptor {
-    fn accept(&mut self) -> IoResult<~rtio::RtioTcpStream> {
-        self.native_accept().map(|s| ~s as ~rtio::RtioTcpStream)
+    fn accept(&mut self) -> IoResult<~rtio::RtioTcpStream:Send> {
+        self.native_accept().map(|s| ~s as ~rtio::RtioTcpStream:Send)
     }
 
     fn accept_simultaneously(&mut self) -> IoResult<()> { Ok(()) }
@@ -474,7 +474,7 @@ impl rtio::RtioTcpAcceptor for TcpAcceptor {
 ////////////////////////////////////////////////////////////////////////////////
 
 pub struct UdpSocket {
-    priv inner: UnsafeArc<Inner>,
+    inner: UnsafeArc<Inner>,
 }
 
 impl UdpSocket {
@@ -630,7 +630,7 @@ impl rtio::RtioUdpSocket for UdpSocket {
         self.set_broadcast(false)
     }
 
-    fn clone(&self) -> ~rtio::RtioUdpSocket {
-        ~UdpSocket { inner: self.inner.clone() } as ~rtio::RtioUdpSocket
+    fn clone(&self) -> ~rtio::RtioUdpSocket:Send {
+        ~UdpSocket { inner: self.inner.clone() } as ~rtio::RtioUdpSocket:Send
     }
 }
diff --git a/src/libnative/io/pipe_unix.rs b/src/libnative/io/pipe_unix.rs
index 9e81dc02cc5..fb9ac27d830 100644
--- a/src/libnative/io/pipe_unix.rs
+++ b/src/libnative/io/pipe_unix.rs
@@ -106,7 +106,7 @@ fn bind(addr: &CString, ty: libc::c_int) -> IoResult<Inner> {
 ////////////////////////////////////////////////////////////////////////////////
 
 pub struct UnixStream {
-    priv inner: UnsafeArc<Inner>,
+    inner: UnsafeArc<Inner>,
 }
 
 impl UnixStream {
@@ -150,8 +150,8 @@ impl rtio::RtioPipe for UnixStream {
         }
     }
 
-    fn clone(&self) -> ~rtio::RtioPipe {
-        ~UnixStream { inner: self.inner.clone() } as ~rtio::RtioPipe
+    fn clone(&self) -> ~rtio::RtioPipe:Send {
+        ~UnixStream { inner: self.inner.clone() } as ~rtio::RtioPipe:Send
     }
 }
 
@@ -160,7 +160,7 @@ impl rtio::RtioPipe for UnixStream {
 ////////////////////////////////////////////////////////////////////////////////
 
 pub struct UnixDatagram {
-    priv inner: UnsafeArc<Inner>,
+    inner: UnsafeArc<Inner>,
 }
 
 impl UnixDatagram {
@@ -231,7 +231,7 @@ impl UnixDatagram {
 ////////////////////////////////////////////////////////////////////////////////
 
 pub struct UnixListener {
-    priv inner: Inner,
+    inner: Inner,
 }
 
 impl UnixListener {
@@ -250,13 +250,13 @@ impl UnixListener {
 }
 
 impl rtio::RtioUnixListener for UnixListener {
-    fn listen(~self) -> IoResult<~rtio::RtioUnixAcceptor> {
-        self.native_listen(128).map(|a| ~a as ~rtio::RtioUnixAcceptor)
+    fn listen(~self) -> IoResult<~rtio::RtioUnixAcceptor:Send> {
+        self.native_listen(128).map(|a| ~a as ~rtio::RtioUnixAcceptor:Send)
     }
 }
 
 pub struct UnixAcceptor {
-    priv listener: UnixListener,
+    listener: UnixListener,
 }
 
 impl UnixAcceptor {
@@ -279,7 +279,7 @@ impl UnixAcceptor {
 }
 
 impl rtio::RtioUnixAcceptor for UnixAcceptor {
-    fn accept(&mut self) -> IoResult<~rtio::RtioPipe> {
-        self.native_accept().map(|s| ~s as ~rtio::RtioPipe)
+    fn accept(&mut self) -> IoResult<~rtio::RtioPipe:Send> {
+        self.native_accept().map(|s| ~s as ~rtio::RtioPipe:Send)
     }
 }
diff --git a/src/libnative/io/pipe_win32.rs b/src/libnative/io/pipe_win32.rs
index e5e9592eb5a..36f2dc7d65c 100644
--- a/src/libnative/io/pipe_win32.rs
+++ b/src/libnative/io/pipe_win32.rs
@@ -154,9 +154,9 @@ unsafe fn pipe(name: *u16, init: bool) -> libc::HANDLE {
 ////////////////////////////////////////////////////////////////////////////////
 
 pub struct UnixStream {
-    priv inner: UnsafeArc<Inner>,
-    priv write: Option<Event>,
-    priv read: Option<Event>,
+    inner: UnsafeArc<Inner>,
+    write: Option<Event>,
+    read: Option<Event>,
 }
 
 impl UnixStream {
@@ -335,12 +335,12 @@ impl rtio::RtioPipe for UnixStream {
         Ok(())
     }
 
-    fn clone(&self) -> ~rtio::RtioPipe {
+    fn clone(&self) -> ~rtio::RtioPipe:Send {
         ~UnixStream {
             inner: self.inner.clone(),
             read: None,
             write: None,
-        } as ~rtio::RtioPipe
+        } as ~rtio::RtioPipe:Send
     }
 }
 
@@ -349,8 +349,8 @@ impl rtio::RtioPipe for UnixStream {
 ////////////////////////////////////////////////////////////////////////////////
 
 pub struct UnixListener {
-    priv handle: libc::HANDLE,
-    priv name: CString,
+    handle: libc::HANDLE,
+    name: CString,
 }
 
 impl UnixListener {
@@ -383,14 +383,14 @@ impl Drop for UnixListener {
 }
 
 impl rtio::RtioUnixListener for UnixListener {
-    fn listen(~self) -> IoResult<~rtio::RtioUnixAcceptor> {
-        self.native_listen().map(|a| ~a as ~rtio::RtioUnixAcceptor)
+    fn listen(~self) -> IoResult<~rtio::RtioUnixAcceptor:Send> {
+        self.native_listen().map(|a| ~a as ~rtio::RtioUnixAcceptor:Send)
     }
 }
 
 pub struct UnixAcceptor {
-    priv listener: UnixListener,
-    priv event: Event,
+    listener: UnixListener,
+    event: Event,
 }
 
 impl UnixAcceptor {
@@ -485,8 +485,8 @@ impl UnixAcceptor {
 }
 
 impl rtio::RtioUnixAcceptor for UnixAcceptor {
-    fn accept(&mut self) -> IoResult<~rtio::RtioPipe> {
-        self.native_accept().map(|s| ~s as ~rtio::RtioPipe)
+    fn accept(&mut self) -> IoResult<~rtio::RtioPipe:Send> {
+        self.native_accept().map(|s| ~s as ~rtio::RtioPipe:Send)
     }
 }
 
diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs
index 28f0817670b..d2e2db63c1b 100644
--- a/src/libnative/io/process.rs
+++ b/src/libnative/io/process.rs
@@ -31,15 +31,15 @@ use super::file;
  */
 pub struct Process {
     /// The unique id of the process (this should never be negative).
-    priv pid: pid_t,
+    pid: pid_t,
 
     /// A handle to the process - on unix this will always be NULL, but on
     /// windows it will be a HANDLE to the process, which will prevent the
     /// pid being re-used until the handle is closed.
-    priv handle: *(),
+    handle: *(),
 
     /// None until finish() is called.
-    priv exit_code: Option<p::ProcessExit>,
+    exit_code: Option<p::ProcessExit>,
 }
 
 impl Process {
@@ -134,6 +134,18 @@ impl rtio::RtioProcess for Process {
     }
 
     fn kill(&mut self, signum: int) -> Result<(), io::IoError> {
+        // On linux (and possibly other unices), a process that has exited will
+        // continue to accept signals because it is "defunct". The delivery of
+        // signals will only fail once the child has been reaped. For this
+        // reason, if the process hasn't exited yet, then we attempt to collect
+        // their status with WNOHANG.
+        if self.exit_code.is_none() {
+            match waitpid_nowait(self.pid) {
+                Some(code) => { self.exit_code = Some(code); }
+                None => {}
+            }
+        }
+
         // if the process has finished, and therefore had waitpid called,
         // and we kill it, then on unix we might ending up killing a
         // newer process that happens to have the same (re-used) id
@@ -469,7 +481,7 @@ fn spawn_process_os(config: p::ProcessConfig,
                                     (bytes[1] << 16) as i32 |
                                     (bytes[2] <<  8) as i32 |
                                     (bytes[3] <<  0) as i32;
-                        Err(super::translate_error(errno, false))
+                        Err(io::IoError::from_errno(errno as uint, false))
                     }
                     Err(e) => {
                         assert!(e.kind == io::BrokenPipe ||
@@ -585,7 +597,7 @@ fn with_argv<T>(prog: &str, args: &[~str], cb: proc:(**libc::c_char) -> T) -> T
     // Next, convert each of the byte strings into a pointer. This is
     // technically unsafe as the caller could leak these pointers out of our
     // scope.
-    let mut ptrs = tmps.map(|tmp| tmp.with_ref(|buf| buf));
+    let mut ptrs: Vec<_> = tmps.iter().map(|tmp| tmp.with_ref(|buf| buf)).collect();
 
     // Finally, make sure we add a null pointer.
     ptrs.push(ptr::null());
@@ -610,7 +622,9 @@ fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: proc:(*c_void) -> T) -> T {
             }
 
             // Once again, this is unsafe.
-            let mut ptrs = tmps.map(|tmp| tmp.with_ref(|buf| buf));
+            let mut ptrs: Vec<*libc::c_char> = tmps.iter()
+                                                   .map(|tmp| tmp.with_ref(|buf| buf))
+                                                   .collect();
             ptrs.push(ptr::null());
 
             cb(ptrs.as_ptr() as *c_void)
@@ -662,6 +676,31 @@ fn free_handle(_handle: *()) {
     // unix has no process handle object, just a pid
 }
 
+#[cfg(unix)]
+fn translate_status(status: c_int) -> p::ProcessExit {
+    #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
+    mod imp {
+        pub fn WIFEXITED(status: i32) -> bool { (status & 0xff) == 0 }
+        pub fn WEXITSTATUS(status: i32) -> i32 { (status >> 8) & 0xff }
+        pub fn WTERMSIG(status: i32) -> i32 { status & 0x7f }
+    }
+
+    #[cfg(target_os = "macos")]
+    #[cfg(target_os = "freebsd")]
+    mod imp {
+        pub fn WIFEXITED(status: i32) -> bool { (status & 0x7f) == 0 }
+        pub fn WEXITSTATUS(status: i32) -> i32 { status >> 8 }
+        pub fn WTERMSIG(status: i32) -> i32 { status & 0o177 }
+    }
+
+    if imp::WIFEXITED(status) {
+        p::ExitStatus(imp::WEXITSTATUS(status) as int)
+    } else {
+        p::ExitSignal(imp::WTERMSIG(status) as int)
+    }
+}
+
 /**
  * Waits for a process to exit and returns the exit code, failing
  * if there is no process with the specified id.
@@ -723,33 +762,31 @@ fn waitpid(pid: pid_t) -> p::ProcessExit {
     #[cfg(unix)]
     fn waitpid_os(pid: pid_t) -> p::ProcessExit {
         use std::libc::funcs::posix01::wait;
-
-        #[cfg(target_os = "linux")]
-        #[cfg(target_os = "android")]
-        mod imp {
-            pub fn WIFEXITED(status: i32) -> bool { (status & 0xff) == 0 }
-            pub fn WEXITSTATUS(status: i32) -> i32 { (status >> 8) & 0xff }
-            pub fn WTERMSIG(status: i32) -> i32 { status & 0x7f }
+        let mut status = 0 as c_int;
+        match retry(|| unsafe { wait::waitpid(pid, &mut status, 0) }) {
+            -1 => fail!("unknown waitpid error: {}", super::last_error()),
+            _ => translate_status(status),
         }
+    }
+}
 
-        #[cfg(target_os = "macos")]
-        #[cfg(target_os = "freebsd")]
-        mod imp {
-            pub fn WIFEXITED(status: i32) -> bool { (status & 0x7f) == 0 }
-            pub fn WEXITSTATUS(status: i32) -> i32 { status >> 8 }
-            pub fn WTERMSIG(status: i32) -> i32 { status & 0o177 }
-        }
+fn waitpid_nowait(pid: pid_t) -> Option<p::ProcessExit> {
+    return waitpid_os(pid);
 
+    // This code path isn't necessary on windows
+    #[cfg(windows)]
+    fn waitpid_os(_pid: pid_t) -> Option<p::ProcessExit> { None }
+
+    #[cfg(unix)]
+    fn waitpid_os(pid: pid_t) -> Option<p::ProcessExit> {
+        use std::libc::funcs::posix01::wait;
         let mut status = 0 as c_int;
-        match retry(|| unsafe { wait::waitpid(pid, &mut status, 0) }) {
-            -1 => fail!("unknown waitpid error: {}", super::last_error()),
-            _ => {
-                if imp::WIFEXITED(status) {
-                    p::ExitStatus(imp::WEXITSTATUS(status) as int)
-                } else {
-                    p::ExitSignal(imp::WTERMSIG(status) as int)
-                }
-            }
+        match retry(|| unsafe {
+            wait::waitpid(pid, &mut status, libc::WNOHANG)
+        }) {
+            n if n == pid => Some(translate_status(status)),
+            0 => None,
+            n => fail!("unknown waitpid error `{}`: {}", n, super::last_error()),
         }
     }
 }
diff --git a/src/libnative/io/timer_other.rs b/src/libnative/io/timer_other.rs
index edd7af312c8..7979075aa02 100644
--- a/src/libnative/io/timer_other.rs
+++ b/src/libnative/io/timer_other.rs
@@ -59,8 +59,8 @@ use io::IoResult;
 use io::timer_helper;
 
 pub struct Timer {
-    priv id: uint,
-    priv inner: Option<~Inner>,
+    id: uint,
+    inner: Option<~Inner>,
 }
 
 struct Inner {
@@ -296,7 +296,7 @@ mod imp {
     }
 
     pub fn fd_set(set: &mut fd_set, fd: i32) {
-        set.fds_bits[fd / 32] |= 1 << (fd % 32);
+        set.fds_bits[(fd / 32) as uint] |= 1 << (fd % 32);
     }
 
     extern {
@@ -323,7 +323,7 @@ mod imp {
     }
 
     pub fn fd_set(set: &mut fd_set, fd: i32) {
-        set.fds_bits[fd / 64] |= (1 << (fd % 64)) as u64;
+        set.fds_bits[(fd / 64) as uint] |= (1 << (fd % 64)) as u64;
     }
 
     extern {
diff --git a/src/libnative/io/timer_timerfd.rs b/src/libnative/io/timer_timerfd.rs
index a8018bec0a6..d7202d9d765 100644
--- a/src/libnative/io/timer_timerfd.rs
+++ b/src/libnative/io/timer_timerfd.rs
@@ -40,8 +40,8 @@ use io::IoResult;
 use io::timer_helper;
 
 pub struct Timer {
-    priv fd: FileDesc,
-    priv on_worker: bool,
+    fd: FileDesc,
+    on_worker: bool,
 }
 
 #[allow(visible_private_types)]
@@ -285,24 +285,24 @@ mod imp {
     #[cfg(target_arch = "x86_64")]
     #[packed]
     pub struct epoll_event {
-        events: u32,
-        data: i64,
+        pub events: u32,
+        pub data: i64,
     }
 
     #[cfg(not(target_arch = "x86_64"))]
     pub struct epoll_event {
-        events: u32,
-        data: i64,
+        pub events: u32,
+        pub data: i64,
     }
 
     pub struct timespec {
-        tv_sec: libc::time_t,
-        tv_nsec: libc::c_long,
+        pub tv_sec: libc::time_t,
+        pub tv_nsec: libc::c_long,
     }
 
     pub struct itimerspec {
-        it_interval: timespec,
-        it_value: timespec,
+        pub it_interval: timespec,
+        pub it_value: timespec,
     }
 
     extern {
diff --git a/src/libnative/io/timer_win32.rs b/src/libnative/io/timer_win32.rs
index cdfe2e0d033..3e420e45448 100644
--- a/src/libnative/io/timer_win32.rs
+++ b/src/libnative/io/timer_win32.rs
@@ -29,8 +29,8 @@ use io::timer_helper;
 use io::IoResult;
 
 pub struct Timer {
-    priv obj: libc::HANDLE,
-    priv on_worker: bool,
+    obj: libc::HANDLE,
+    on_worker: bool,
 }
 
 pub enum Req {
@@ -78,7 +78,7 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>) {
             }
         } else {
             let remove = {
-                match &chans[idx - 1] {
+                match &chans[idx as uint - 1] {
                     &(ref c, oneshot) => !c.try_send(()) || oneshot
                 }
             };
diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs
index 34e85a9819a..7e05c4c961c 100644
--- a/src/libnative/lib.rs
+++ b/src/libnative/lib.rs
@@ -41,15 +41,15 @@
 //! }
 //! ```
 
-#[crate_id = "native#0.10-pre"];
-#[license = "MIT/ASL2"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-#[deny(unused_result, unused_must_use)];
-#[allow(non_camel_case_types)];
+#![crate_id = "native#0.11-pre"]
+#![license = "MIT/ASL2"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+#![deny(unused_result, unused_must_use)]
+#![allow(non_camel_case_types)]
 
 // NB this crate explicitly does *not* allow glob imports, please seriously
 //    consider whether they're needed before adding that feature here (the
@@ -97,6 +97,24 @@ pub fn start(argc: int, argv: **u8, main: proc()) -> int {
     // frames above our current position.
     let my_stack_bottom = my_stack_top + 20000 - OS_DEFAULT_STACK_ESTIMATE;
 
+    // When using libgreen, one of the first things that we do is to turn off
+    // the SIGPIPE signal (set it to ignore). By default, some platforms will
+    // send a *signal* when a EPIPE error would otherwise be delivered. This
+    // runtime doesn't install a SIGPIPE handler, causing it to kill the
+    // program, which isn't exactly what we want!
+    //
+    // Hence, we set SIGPIPE to ignore when the program starts up in order to
+    // prevent this problem.
+    #[cfg(windows)] fn ignore_sigpipe() {}
+    #[cfg(unix)] fn ignore_sigpipe() {
+        use std::libc;
+        use std::libc::funcs::posix01::signal::signal;
+        unsafe {
+            assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != -1);
+        }
+    }
+    ignore_sigpipe();
+
     rt::init(argc, argv);
     let mut exit_code = None;
     let mut main = Some(main);
diff --git a/src/libnative/task.rs b/src/libnative/task.rs
index 659e417b8ad..662c6417ca8 100644
--- a/src/libnative/task.rs
+++ b/src/libnative/task.rs
@@ -35,7 +35,7 @@ pub fn new(stack_bounds: (uint, uint)) -> ~Task {
     let mut task = ~Task::new();
     let mut ops = ops();
     ops.stack_bounds = stack_bounds;
-    task.put_runtime(ops as ~rt::Runtime);
+    task.put_runtime(ops);
     return task;
 }
 
@@ -50,13 +50,13 @@ fn ops() -> ~Ops {
 }
 
 /// Spawns a function with the default configuration
-pub fn spawn(f: proc()) {
+pub fn spawn(f: proc:Send()) {
     spawn_opts(TaskOpts::new(), f)
 }
 
 /// Spawns a new task given the configuration options and a procedure to run
 /// inside the task.
-pub fn spawn_opts(opts: TaskOpts, f: proc()) {
+pub fn spawn_opts(opts: TaskOpts, f: proc:Send()) {
     let TaskOpts {
         notify_chan, name, stack_size,
         stderr, stdout,
@@ -98,7 +98,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc()) {
 
         let mut f = Some(f);
         let mut task = task;
-        task.put_runtime(ops as ~rt::Runtime);
+        task.put_runtime(ops);
         let t = task.run(|| { f.take_unwrap()() });
         drop(t);
         bookkeeping::decrement();
@@ -121,7 +121,7 @@ struct Ops {
 impl rt::Runtime for Ops {
     fn yield_now(~self, mut cur_task: ~Task) {
         // put the task back in TLS and then invoke the OS thread yield
-        cur_task.put_runtime(self as ~rt::Runtime);
+        cur_task.put_runtime(self);
         Local::put(cur_task);
         Thread::yield_now();
     }
@@ -129,7 +129,7 @@ impl rt::Runtime for Ops {
     fn maybe_yield(~self, mut cur_task: ~Task) {
         // just put the task back in TLS, on OS threads we never need to
         // opportunistically yield b/c the OS will do that for us (preemption)
-        cur_task.put_runtime(self as ~rt::Runtime);
+        cur_task.put_runtime(self);
         Local::put(cur_task);
     }
 
@@ -183,7 +183,7 @@ impl rt::Runtime for Ops {
     fn deschedule(mut ~self, times: uint, mut cur_task: ~Task,
                   f: |BlockedTask| -> Result<(), BlockedTask>) {
         let me = &mut *self as *mut Ops;
-        cur_task.put_runtime(self as ~rt::Runtime);
+        cur_task.put_runtime(self);
 
         unsafe {
             let cur_task_dupe = &*cur_task as *Task;
@@ -230,7 +230,7 @@ impl rt::Runtime for Ops {
     fn reawaken(mut ~self, mut to_wake: ~Task) {
         unsafe {
             let me = &mut *self as *mut Ops;
-            to_wake.put_runtime(self as ~rt::Runtime);
+            to_wake.put_runtime(self);
             cast::forget(to_wake);
             let guard = (*me).lock.lock();
             (*me).awoken = true;
@@ -238,8 +238,8 @@ impl rt::Runtime for Ops {
         }
     }
 
-    fn spawn_sibling(~self, mut cur_task: ~Task, opts: TaskOpts, f: proc()) {
-        cur_task.put_runtime(self as ~rt::Runtime);
+    fn spawn_sibling(~self, mut cur_task: ~Task, opts: TaskOpts, f: proc:Send()) {
+        cur_task.put_runtime(self);
         Local::put(cur_task);
 
         task::spawn_opts(opts, f);
@@ -252,7 +252,6 @@ impl rt::Runtime for Ops {
 
 #[cfg(test)]
 mod tests {
-    use std::rt::Runtime;
     use std::rt::local::Local;
     use std::rt::task::Task;
     use std::task;
@@ -335,7 +334,7 @@ mod tests {
                 let mut task: ~Task = Local::take();
                 match task.maybe_take_runtime::<Ops>() {
                     Some(ops) => {
-                        task.put_runtime(ops as ~Runtime);
+                        task.put_runtime(ops);
                     }
                     None => fail!(),
                 }
diff --git a/src/libnum/bigint.rs b/src/libnum/bigint.rs
index 86db7cbb625..f6f0db4b6a9 100644
--- a/src/libnum/bigint.rs
+++ b/src/libnum/bigint.rs
@@ -28,7 +28,6 @@ use rand::Rng;
 use std::str;
 use std::uint;
 use std::{i64, u64};
-use std::vec;
 
 /**
 A `BigDigit` is a `BigUint`'s composing element.
@@ -87,7 +86,7 @@ A `BigUint`-typed value `BigUint { data: ~[a, b, c] }` represents a number
 */
 #[deriving(Clone)]
 pub struct BigUint {
-    priv data: Vec<BigDigit>
+    data: Vec<BigDigit>
 }
 
 impl Eq for BigUint {
@@ -747,8 +746,7 @@ impl BigUint {
     fn shl_unit(&self, n_unit: uint) -> BigUint {
         if n_unit == 0 || self.is_zero() { return (*self).clone(); }
 
-        return BigUint::new(vec::append(Vec::from_elem(n_unit, ZERO_BIG_DIGIT),
-                                           self.data.as_slice()));
+        BigUint::new(Vec::from_elem(n_unit, ZERO_BIG_DIGIT).append(self.data.as_slice()))
     }
 
     #[inline]
@@ -865,8 +863,8 @@ impl Neg<Sign> for Sign {
 /// A big signed integer type.
 #[deriving(Clone)]
 pub struct BigInt {
-    priv sign: Sign,
-    priv data: BigUint
+    sign: Sign,
+    data: BigUint
 }
 
 impl Eq for BigInt {
diff --git a/src/libnum/complex.rs b/src/libnum/complex.rs
index b226e773dbb..069dd2164f5 100644
--- a/src/libnum/complex.rs
+++ b/src/libnum/complex.rs
@@ -25,9 +25,9 @@ use std::num::{Zero,One,ToStrRadix};
 #[deriving(Eq,Clone)]
 pub struct Cmplx<T> {
     /// Real portion of the complex number
-    re: T,
+    pub re: T,
     /// Imaginary portion of the complex number
-    im: T
+    pub im: T
 }
 
 pub type Complex32 = Cmplx<f32>;
@@ -190,7 +190,7 @@ impl<T: ToStrRadix + Num + Ord> ToStrRadix for Cmplx<T> {
 
 #[cfg(test)]
 mod test {
-    #[allow(non_uppercase_statics)];
+    #![allow(non_uppercase_statics)]
 
     use super::{Complex64, Cmplx};
     use std::num::{Zero,One,Float};
diff --git a/src/libnum/lib.rs b/src/libnum/lib.rs
index 501ae23e27d..986ba9e9a5c 100644
--- a/src/libnum/lib.rs
+++ b/src/libnum/lib.rs
@@ -8,17 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(macro_rules)];
+#![feature(macro_rules)]
 
-#[crate_id = "num#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
+#![crate_id = "num#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
 
-#[deny(deprecated_owned_vector)];
+#![deny(deprecated_owned_vector)]
 
 extern crate rand;
 
diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs
index bea003bcf18..e6b63f23741 100644
--- a/src/libnum/rational.rs
+++ b/src/libnum/rational.rs
@@ -22,8 +22,8 @@ use bigint::{BigInt, BigUint, Sign, Plus, Minus};
 #[deriving(Clone)]
 #[allow(missing_doc)]
 pub struct Ratio<T> {
-    priv numer: T,
-    priv denom: T
+    numer: T,
+    denom: T
 }
 
 /// Alias for a `Ratio` of machine-sized integers.
diff --git a/src/librand/distributions/exponential.rs b/src/librand/distributions/exponential.rs
index 369828d5969..70dd0da3130 100644
--- a/src/librand/distributions/exponential.rs
+++ b/src/librand/distributions/exponential.rs
@@ -28,7 +28,7 @@ use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
 /// Generate Normal Random
 /// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
 /// College, Oxford
-pub struct Exp1(f64);
+pub struct Exp1(pub f64);
 
 // This could be done via `-rng.gen::<f64>().ln()` but that is slower.
 impl Rand for Exp1 {
@@ -66,7 +66,7 @@ impl Rand for Exp1 {
 /// ```
 pub struct Exp {
     /// `lambda` stored as `1/lambda`, since this is what we scale by.
-    priv lambda_inverse: f64
+    lambda_inverse: f64
 }
 
 impl Exp {
@@ -126,7 +126,7 @@ mod bench {
 
     #[bench]
     fn rand_exp(bh: &mut BenchHarness) {
-        let mut rng = XorShiftRng::new();
+        let mut rng = XorShiftRng::new().unwrap();
         let mut exp = Exp::new(2.71828 * 3.14159);
 
         bh.iter(|| {
diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs
index 029333cd788..575e621cc66 100644
--- a/src/librand/distributions/gamma.rs
+++ b/src/librand/distributions/gamma.rs
@@ -11,7 +11,6 @@
 //! The Gamma and derived distributions.
 
 use std::num::Float;
-use std::num;
 use {Rng, Open01};
 use super::normal::StandardNormal;
 use super::{IndependentSample, Sample, Exp};
@@ -114,7 +113,7 @@ impl GammaLargeShape {
         GammaLargeShape {
             shape: shape,
             scale: scale,
-            c: 1. / num::sqrt(9. * d),
+            c: 1. / (9. * d).sqrt(),
             d: d
         }
     }
@@ -143,7 +142,7 @@ impl IndependentSample<f64> for GammaSmallShape {
     fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64 {
         let Open01(u) = rng.gen::<Open01<f64>>();
 
-        self.large_shape.ind_sample(rng) * num::powf(u, self.inv_shape)
+        self.large_shape.ind_sample(rng) * u.powf(&self.inv_shape)
     }
 }
 impl IndependentSample<f64> for GammaLargeShape {
@@ -160,7 +159,7 @@ impl IndependentSample<f64> for GammaLargeShape {
 
             let x_sqr = x * x;
             if u < 1.0 - 0.0331 * x_sqr * x_sqr ||
-                num::ln(u) < 0.5 * x_sqr + self.d * (1.0 - v + num::ln(v)) {
+                u.ln() < 0.5 * x_sqr + self.d * (1.0 - v + v.ln()) {
                 return self.d * v * self.scale
             }
         }
@@ -236,11 +235,11 @@ impl IndependentSample<f64> for ChiSquared {
 /// println!("{} is from an F(2, 32) distribution", v)
 /// ```
 pub struct FisherF {
-    priv numer: ChiSquared,
-    priv denom: ChiSquared,
+    numer: ChiSquared,
+    denom: ChiSquared,
     // denom_dof / numer_dof so that this can just be a straight
     // multiplication, rather than a division.
-    priv dof_ratio: f64,
+    dof_ratio: f64,
 }
 
 impl FisherF {
@@ -279,8 +278,8 @@ impl IndependentSample<f64> for FisherF {
 /// println!("{} is from a t(11) distribution", v)
 /// ```
 pub struct StudentT {
-    priv chi: ChiSquared,
-    priv dof: f64
+    chi: ChiSquared,
+    dof: f64
 }
 
 impl StudentT {
@@ -370,14 +369,14 @@ mod bench {
     use self::test::BenchHarness;
     use std::mem::size_of;
     use distributions::IndependentSample;
-    use {StdRng, RAND_BENCH_N};
+    use {XorShiftRng, RAND_BENCH_N};
     use super::Gamma;
 
 
     #[bench]
     fn bench_gamma_large_shape(bh: &mut BenchHarness) {
         let gamma = Gamma::new(10., 1.0);
-        let mut rng = StdRng::new();
+        let mut rng = XorShiftRng::new().unwrap();
 
         bh.iter(|| {
             for _ in range(0, RAND_BENCH_N) {
@@ -390,7 +389,7 @@ mod bench {
     #[bench]
     fn bench_gamma_small_shape(bh: &mut BenchHarness) {
         let gamma = Gamma::new(0.1, 1.0);
-        let mut rng = StdRng::new();
+        let mut rng = XorShiftRng::new().unwrap();
 
         bh.iter(|| {
             for _ in range(0, RAND_BENCH_N) {
diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs
index 22a09b152c7..af63e52e885 100644
--- a/src/librand/distributions/mod.rs
+++ b/src/librand/distributions/mod.rs
@@ -71,9 +71,9 @@ impl<Sup: Rand> IndependentSample<Sup> for RandSample<Sup> {
 /// A value with a particular weight for use with `WeightedChoice`.
 pub struct Weighted<T> {
     /// The numerical weight of this item
-    weight: uint,
+    pub weight: uint,
     /// The actual item which is being weighted
-    item: T,
+    pub item: T,
 }
 
 /// A distribution that selects from a finite collection of weighted items.
@@ -91,9 +91,9 @@ pub struct Weighted<T> {
 /// ```rust
 /// use rand::distributions::{Weighted, WeightedChoice, IndependentSample};
 ///
-/// let wc = WeightedChoice::new(~[Weighted { weight: 2, item: 'a' },
-///                                Weighted { weight: 4, item: 'b' },
-///                                Weighted { weight: 1, item: 'c' }]);
+/// let wc = WeightedChoice::new(vec!(Weighted { weight: 2, item: 'a' },
+///                                   Weighted { weight: 4, item: 'b' },
+///                                   Weighted { weight: 1, item: 'c' }));
 /// let mut rng = rand::task_rng();
 /// for _ in range(0, 16) {
 ///      // on average prints 'a' 4 times, 'b' 8 and 'c' twice.
@@ -101,8 +101,8 @@ pub struct Weighted<T> {
 /// }
 /// ```
 pub struct WeightedChoice<T> {
-    priv items: ~[Weighted<T>],
-    priv weight_range: Range<uint>
+    items: Vec<Weighted<T>>,
+    weight_range: Range<uint>
 }
 
 impl<T: Clone> WeightedChoice<T> {
@@ -112,7 +112,7 @@ impl<T: Clone> WeightedChoice<T> {
     /// - `v` is empty
     /// - the total weight is 0
     /// - the total weight is larger than a `uint` can contain.
-    pub fn new(mut items: ~[Weighted<T>]) -> WeightedChoice<T> {
+    pub fn new(mut items: Vec<Weighted<T>>) -> WeightedChoice<T> {
         // strictly speaking, this is subsumed by the total weight == 0 case
         assert!(!items.is_empty(), "WeightedChoice::new called with no items");
 
@@ -153,8 +153,8 @@ impl<T: Clone> IndependentSample<T> for WeightedChoice<T> {
         let sample_weight = self.weight_range.ind_sample(rng);
 
         // short circuit when it's the first item
-        if sample_weight < self.items[0].weight {
-            return self.items[0].item.clone();
+        if sample_weight < self.items.get(0).weight {
+            return self.items.get(0).item.clone();
         }
 
         let mut idx = 0;
@@ -169,7 +169,7 @@ impl<T: Clone> IndependentSample<T> for WeightedChoice<T> {
         // one is exactly the total weight.)
         while modifier > 1 {
             let i = idx + modifier / 2;
-            if self.items[i].weight <= sample_weight {
+            if self.items.get(i).weight <= sample_weight {
                 // we're small, so look to the right, but allow this
                 // exact element still.
                 idx = i;
@@ -182,7 +182,7 @@ impl<T: Clone> IndependentSample<T> for WeightedChoice<T> {
             }
             modifier /= 2;
         }
-        return self.items[idx + 1].item.clone();
+        return self.items.get(idx + 1).item.clone();
     }
 }
 
@@ -297,54 +297,54 @@ mod tests {
             }}
         );
 
-        t!(~[Weighted { weight: 1, item: 10}], ~[10]);
+        t!(vec!(Weighted { weight: 1, item: 10}), [10]);
 
         // skip some
-        t!(~[Weighted { weight: 0, item: 20},
-             Weighted { weight: 2, item: 21},
-             Weighted { weight: 0, item: 22},
-             Weighted { weight: 1, item: 23}],
-           ~[21,21, 23]);
+        t!(vec!(Weighted { weight: 0, item: 20},
+                Weighted { weight: 2, item: 21},
+                Weighted { weight: 0, item: 22},
+                Weighted { weight: 1, item: 23}),
+           [21,21, 23]);
 
         // different weights
-        t!(~[Weighted { weight: 4, item: 30},
-             Weighted { weight: 3, item: 31}],
-           ~[30,30,30,30, 31,31,31]);
+        t!(vec!(Weighted { weight: 4, item: 30},
+                Weighted { weight: 3, item: 31}),
+           [30,30,30,30, 31,31,31]);
 
         // check that we're binary searching
         // correctly with some vectors of odd
         // length.
-        t!(~[Weighted { weight: 1, item: 40},
-             Weighted { weight: 1, item: 41},
-             Weighted { weight: 1, item: 42},
-             Weighted { weight: 1, item: 43},
-             Weighted { weight: 1, item: 44}],
-           ~[40, 41, 42, 43, 44]);
-        t!(~[Weighted { weight: 1, item: 50},
-             Weighted { weight: 1, item: 51},
-             Weighted { weight: 1, item: 52},
-             Weighted { weight: 1, item: 53},
-             Weighted { weight: 1, item: 54},
-             Weighted { weight: 1, item: 55},
-             Weighted { weight: 1, item: 56}],
-           ~[50, 51, 52, 53, 54, 55, 56]);
+        t!(vec!(Weighted { weight: 1, item: 40},
+                Weighted { weight: 1, item: 41},
+                Weighted { weight: 1, item: 42},
+                Weighted { weight: 1, item: 43},
+                Weighted { weight: 1, item: 44}),
+           [40, 41, 42, 43, 44]);
+        t!(vec!(Weighted { weight: 1, item: 50},
+                Weighted { weight: 1, item: 51},
+                Weighted { weight: 1, item: 52},
+                Weighted { weight: 1, item: 53},
+                Weighted { weight: 1, item: 54},
+                Weighted { weight: 1, item: 55},
+                Weighted { weight: 1, item: 56}),
+           [50, 51, 52, 53, 54, 55, 56]);
     }
 
     #[test] #[should_fail]
     fn test_weighted_choice_no_items() {
-        WeightedChoice::<int>::new(~[]);
+        WeightedChoice::<int>::new(vec!());
     }
     #[test] #[should_fail]
     fn test_weighted_choice_zero_weight() {
-        WeightedChoice::new(~[Weighted { weight: 0, item: 0},
-                              Weighted { weight: 0, item: 1}]);
+        WeightedChoice::new(vec!(Weighted { weight: 0, item: 0},
+                                 Weighted { weight: 0, item: 1}));
     }
     #[test] #[should_fail]
     fn test_weighted_choice_weight_overflows() {
         let x = (-1) as uint / 2; // x + x + 2 is the overflow
-        WeightedChoice::new(~[Weighted { weight: x, item: 0 },
-                              Weighted { weight: 1, item: 1 },
-                              Weighted { weight: x, item: 2 },
-                              Weighted { weight: 1, item: 3 }]);
+        WeightedChoice::new(vec!(Weighted { weight: x, item: 0 },
+                                 Weighted { weight: 1, item: 1 },
+                                 Weighted { weight: x, item: 2 },
+                                 Weighted { weight: 1, item: 3 }));
     }
 }
diff --git a/src/librand/distributions/normal.rs b/src/librand/distributions/normal.rs
index 4c9567efc6e..2745ddd4ce7 100644
--- a/src/librand/distributions/normal.rs
+++ b/src/librand/distributions/normal.rs
@@ -27,7 +27,7 @@ use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
 /// Generate Normal Random
 /// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
 /// College, Oxford
-pub struct StandardNormal(f64);
+pub struct StandardNormal(pub f64);
 
 impl Rand for StandardNormal {
     fn rand<R:Rng>(rng: &mut R) -> StandardNormal {
@@ -82,8 +82,8 @@ impl Rand for StandardNormal {
 /// println!("{} is from a N(2, 9) distribution", v)
 /// ```
 pub struct Normal {
-    priv mean: f64,
-    priv std_dev: f64
+    mean: f64,
+    std_dev: f64,
 }
 
 impl Normal {
@@ -124,7 +124,7 @@ impl IndependentSample<f64> for Normal {
 /// println!("{} is from an ln N(2, 9) distribution", v)
 /// ```
 pub struct LogNormal {
-    priv norm: Normal
+    norm: Normal
 }
 
 impl LogNormal {
@@ -193,7 +193,7 @@ mod bench {
 
     #[bench]
     fn rand_normal(bh: &mut BenchHarness) {
-        let mut rng = XorShiftRng::new();
+        let mut rng = XorShiftRng::new().unwrap();
         let mut normal = Normal::new(-2.71828, 3.14159);
 
         bh.iter(|| {
diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs
index 8256a37f2ec..cee80b62e3d 100644
--- a/src/librand/distributions/range.rs
+++ b/src/librand/distributions/range.rs
@@ -46,9 +46,9 @@ use distributions::{Sample, IndependentSample};
 /// }
 /// ```
 pub struct Range<X> {
-    priv low: X,
-    priv range: X,
-    priv accept_zone: X
+    low: X,
+    range: X,
+    accept_zone: X
 }
 
 impl<X: SampleRange + Ord> Range<X> {
diff --git a/src/librand/isaac.rs b/src/librand/isaac.rs
index d0dc5b90867..1d9da40f18b 100644
--- a/src/librand/isaac.rs
+++ b/src/librand/isaac.rs
@@ -11,6 +11,7 @@
 //! The ISAAC random number generator.
 
 use {Rng, SeedableRng, OSRng};
+use std::io::IoResult;
 use std::iter::{range_step, Repeat};
 use std::slice::raw;
 use std::mem;
@@ -28,12 +29,12 @@ static RAND_SIZE: u32 = 1 << RAND_SIZE_LEN;
 /// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number
 /// generator*](http://www.burtleburtle.net/bob/rand/isaacafa.html)
 pub struct IsaacRng {
-    priv cnt: u32,
-    priv rsl: [u32, .. RAND_SIZE],
-    priv mem: [u32, .. RAND_SIZE],
-    priv a: u32,
-    priv b: u32,
-    priv c: u32
+    cnt: u32,
+    rsl: [u32, .. RAND_SIZE],
+    mem: [u32, .. RAND_SIZE],
+    a: u32,
+    b: u32,
+    c: u32
 }
 static EMPTY: IsaacRng = IsaacRng {
     cnt: 0,
@@ -44,19 +45,23 @@ static EMPTY: IsaacRng = IsaacRng {
 
 impl IsaacRng {
     /// Create an ISAAC random number generator with a random seed.
-    pub fn new() -> IsaacRng {
+    ///
+    /// This reads randomness from the operating system (via `OSRng`)
+    /// which may fail, any error is propagated via the `IoResult`
+    /// return value.
+    pub fn new() -> IoResult<IsaacRng> {
         let mut rng = EMPTY;
-
+        let mut os_rng = try!(OSRng::new());
         unsafe {
             let ptr = rng.rsl.as_mut_ptr();
 
             raw::mut_buf_as_slice(ptr as *mut u8, mem::size_of_val(&rng.rsl), |slice| {
-                OSRng::new().fill_bytes(slice);
+                os_rng.fill_bytes(slice);
             })
         }
 
         rng.init(true);
-        rng
+        Ok(rng)
     }
 
     /// Create an ISAAC random number generator using the default
@@ -98,7 +103,7 @@ impl IsaacRng {
         if use_rsl {
             macro_rules! memloop (
                 ($arr:expr) => {{
-                    for i in range_step(0u32, RAND_SIZE, 8) {
+                    for i in range_step(0, RAND_SIZE as uint, 8) {
                         a+=$arr[i  ]; b+=$arr[i+1];
                         c+=$arr[i+2]; d+=$arr[i+3];
                         e+=$arr[i+4]; f+=$arr[i+5];
@@ -115,7 +120,7 @@ impl IsaacRng {
             memloop!(self.rsl);
             memloop!(self.mem);
         } else {
-            for i in range_step(0u32, RAND_SIZE, 8) {
+            for i in range_step(0, RAND_SIZE as uint, 8) {
                 mix!();
                 self.mem[i  ]=a; self.mem[i+1]=b;
                 self.mem[i+2]=c; self.mem[i+3]=d;
@@ -138,7 +143,7 @@ impl IsaacRng {
         static MIDPOINT: uint = RAND_SIZE as uint / 2;
 
         macro_rules! ind (($x:expr) => {
-            self.mem[($x >> 2) & (RAND_SIZE - 1)]
+            self.mem[(($x >> 2) & (RAND_SIZE - 1)) as uint]
         });
         macro_rules! rngstep(
             ($j:expr, $shift:expr) => {{
@@ -183,7 +188,7 @@ impl Rng for IsaacRng {
             self.isaac();
         }
         self.cnt -= 1;
-        self.rsl[self.cnt]
+        self.rsl[self.cnt as uint]
     }
 }
 
@@ -231,12 +236,12 @@ static RAND_SIZE_64: uint = 1 << RAND_SIZE_64_LEN;
 /// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number
 /// generator*](http://www.burtleburtle.net/bob/rand/isaacafa.html)
 pub struct Isaac64Rng {
-    priv cnt: uint,
-    priv rsl: [u64, .. RAND_SIZE_64],
-    priv mem: [u64, .. RAND_SIZE_64],
-    priv a: u64,
-    priv b: u64,
-    priv c: u64,
+    cnt: uint,
+    rsl: [u64, .. RAND_SIZE_64],
+    mem: [u64, .. RAND_SIZE_64],
+    a: u64,
+    b: u64,
+    c: u64,
 }
 
 static EMPTY_64: Isaac64Rng = Isaac64Rng {
@@ -249,19 +254,24 @@ static EMPTY_64: Isaac64Rng = Isaac64Rng {
 impl Isaac64Rng {
     /// Create a 64-bit ISAAC random number generator with a random
     /// seed.
-    pub fn new() -> Isaac64Rng {
+    ///
+    /// This reads randomness from the operating system (via `OSRng`)
+    /// which may fail, any error is propagated via the `IoResult`
+    /// return value.
+    pub fn new() -> IoResult<Isaac64Rng> {
         let mut rng = EMPTY_64;
+        let mut os_rng = try!(OSRng::new());
 
         unsafe {
             let ptr = rng.rsl.as_mut_ptr();
 
             raw::mut_buf_as_slice(ptr as *mut u8, mem::size_of_val(&rng.rsl), |slice| {
-                OSRng::new().fill_bytes(slice);
+                os_rng.fill_bytes(slice);
             })
         }
 
         rng.init(true);
-        rng
+        Ok(rng)
     }
 
     /// Create a 64-bit ISAAC random number generator using the
@@ -430,19 +440,18 @@ impl<'a> SeedableRng<&'a [u64]> for Isaac64Rng {
 #[cfg(test)]
 mod test {
     use super::{IsaacRng, Isaac64Rng};
-    use {Rng, SeedableRng, OSRng};
-    use std::slice;
+    use {Rng, SeedableRng, task_rng};
 
     #[test]
     fn test_rng_32_rand_seeded() {
-        let s = OSRng::new().gen_vec::<u32>(256);
+        let s = task_rng().gen_vec::<u32>(256);
         let mut ra: IsaacRng = SeedableRng::from_seed(s.as_slice());
         let mut rb: IsaacRng = SeedableRng::from_seed(s.as_slice());
         assert_eq!(ra.gen_ascii_str(100u), rb.gen_ascii_str(100u));
     }
     #[test]
     fn test_rng_64_rand_seeded() {
-        let s = OSRng::new().gen_vec::<u64>(256);
+        let s = task_rng().gen_vec::<u64>(256);
         let mut ra: Isaac64Rng = SeedableRng::from_seed(s.as_slice());
         let mut rb: Isaac64Rng = SeedableRng::from_seed(s.as_slice());
         assert_eq!(ra.gen_ascii_str(100u), rb.gen_ascii_str(100u));
@@ -465,22 +474,22 @@ mod test {
 
     #[test]
     fn test_rng_32_reseed() {
-        let s = OSRng::new().gen_vec::<u32>(256);
+        let s = task_rng().gen_vec::<u32>(256);
         let mut r: IsaacRng = SeedableRng::from_seed(s.as_slice());
         let string1 = r.gen_ascii_str(100);
 
-        r.reseed(s);
+        r.reseed(s.as_slice());
 
         let string2 = r.gen_ascii_str(100);
         assert_eq!(string1, string2);
     }
     #[test]
     fn test_rng_64_reseed() {
-        let s = OSRng::new().gen_vec::<u64>(256);
+        let s = task_rng().gen_vec::<u64>(256);
         let mut r: Isaac64Rng = SeedableRng::from_seed(s.as_slice());
         let string1 = r.gen_ascii_str(100);
 
-        r.reseed(s);
+        r.reseed(s.as_slice());
 
         let string2 = r.gen_ascii_str(100);
         assert_eq!(string1, string2);
@@ -491,43 +500,43 @@ mod test {
         let seed = &[1, 23, 456, 7890, 12345];
         let mut ra: IsaacRng = SeedableRng::from_seed(seed);
         // Regression test that isaac is actually using the above vector
-        let v = slice::from_fn(10, |_| ra.next_u32());
+        let v = Vec::from_fn(10, |_| ra.next_u32());
         assert_eq!(v,
-                   ~[2558573138, 873787463, 263499565, 2103644246, 3595684709,
-                     4203127393, 264982119, 2765226902, 2737944514, 3900253796]);
+                   vec!(2558573138, 873787463, 263499565, 2103644246, 3595684709,
+                        4203127393, 264982119, 2765226902, 2737944514, 3900253796));
 
         let seed = &[12345, 67890, 54321, 9876];
         let mut rb: IsaacRng = SeedableRng::from_seed(seed);
         // skip forward to the 10000th number
         for _ in range(0, 10000) { rb.next_u32(); }
 
-        let v = slice::from_fn(10, |_| rb.next_u32());
+        let v = Vec::from_fn(10, |_| rb.next_u32());
         assert_eq!(v,
-                   ~[3676831399, 3183332890, 2834741178, 3854698763, 2717568474,
-                     1576568959, 3507990155, 179069555, 141456972, 2478885421]);
+                   vec!(3676831399, 3183332890, 2834741178, 3854698763, 2717568474,
+                        1576568959, 3507990155, 179069555, 141456972, 2478885421));
     }
     #[test]
     fn test_rng_64_true_values() {
         let seed = &[1, 23, 456, 7890, 12345];
         let mut ra: Isaac64Rng = SeedableRng::from_seed(seed);
         // Regression test that isaac is actually using the above vector
-        let v = slice::from_fn(10, |_| ra.next_u64());
+        let v = Vec::from_fn(10, |_| ra.next_u64());
         assert_eq!(v,
-                   ~[547121783600835980, 14377643087320773276, 17351601304698403469,
-                     1238879483818134882, 11952566807690396487, 13970131091560099343,
-                     4469761996653280935, 15552757044682284409, 6860251611068737823,
-                     13722198873481261842]);
+                   vec!(547121783600835980, 14377643087320773276, 17351601304698403469,
+                        1238879483818134882, 11952566807690396487, 13970131091560099343,
+                        4469761996653280935, 15552757044682284409, 6860251611068737823,
+                        13722198873481261842));
 
         let seed = &[12345, 67890, 54321, 9876];
         let mut rb: Isaac64Rng = SeedableRng::from_seed(seed);
         // skip forward to the 10000th number
         for _ in range(0, 10000) { rb.next_u64(); }
 
-        let v = slice::from_fn(10, |_| rb.next_u64());
+        let v = Vec::from_fn(10, |_| rb.next_u64());
         assert_eq!(v,
-                   ~[18143823860592706164, 8491801882678285927, 2699425367717515619,
-                     17196852593171130876, 2606123525235546165, 15790932315217671084,
-                     596345674630742204, 9947027391921273664, 11788097613744130851,
-                     10391409374914919106]);
+                   vec!(18143823860592706164, 8491801882678285927, 2699425367717515619,
+                        17196852593171130876, 2606123525235546165, 15790932315217671084,
+                        596345674630742204, 9947027391921273664, 11788097613744130851,
+                        10391409374914919106));
     }
 }
diff --git a/src/librand/lib.rs b/src/librand/lib.rs
index e405ace3867..57b910093e0 100644
--- a/src/librand/lib.rs
+++ b/src/librand/lib.rs
@@ -62,24 +62,25 @@ println!("{:?}", tuple_ptr)
 ```
 */
 
-#[crate_id = "rand#0.10-pre"];
-#[license = "MIT/ASL2"];
-#[crate_type = "dylib"];
-#[crate_type = "rlib"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
+#![crate_id = "rand#0.11-pre"]
+#![license = "MIT/ASL2"]
+#![crate_type = "dylib"]
+#![crate_type = "rlib"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
 
-#[feature(macro_rules, managed_boxes, phase)];
+#![feature(macro_rules, managed_boxes, phase)]
+#![deny(deprecated_owned_vector)]
 
 #[cfg(test)]
 #[phase(syntax, link)] extern crate log;
 
 use std::cast;
+use std::io::IoResult;
 use std::kinds::marker;
 use std::local_data;
 use std::str;
-use std::slice;
 
 pub use isaac::{IsaacRng, Isaac64Rng};
 pub use os::OSRng;
@@ -196,12 +197,12 @@ pub trait Rng {
     /// use rand::{task_rng, Rng};
     ///
     /// let mut rng = task_rng();
-    /// let x: ~[uint] = rng.gen_vec(10);
-    /// println!("{:?}", x);
-    /// println!("{:?}", rng.gen_vec::<(f64, bool)>(5));
+    /// let x: Vec<uint> = rng.gen_vec(10);
+    /// println!("{}", x);
+    /// println!("{}", rng.gen_vec::<(f64, bool)>(5));
     /// ```
-    fn gen_vec<T: Rand>(&mut self, len: uint) -> ~[T] {
-        slice::from_fn(len, |_| self.gen())
+    fn gen_vec<T: Rand>(&mut self, len: uint) -> Vec<T> {
+        Vec::from_fn(len, |_| self.gen())
     }
 
     /// Generate a random value in the range [`low`, `high`). Fails if
@@ -290,22 +291,7 @@ pub trait Rng {
         }
     }
 
-    /// Shuffle a vec
-    ///
-    /// # Example
-    ///
-    /// ```rust
-    /// use rand::{task_rng, Rng};
-    ///
-    /// println!("{:?}", task_rng().shuffle(~[1,2,3]));
-    /// ```
-    fn shuffle<T>(&mut self, values: ~[T]) -> ~[T] {
-        let mut v = values;
-        self.shuffle_mut(v);
-        v
-    }
-
-    /// Shuffle a mutable vector in place.
+    /// Shuffle a mutable slice in place.
     ///
     /// # Example
     ///
@@ -314,12 +300,12 @@ pub trait Rng {
     ///
     /// let mut rng = task_rng();
     /// let mut y = [1,2,3];
-    /// rng.shuffle_mut(y);
-    /// println!("{:?}", y);
-    /// rng.shuffle_mut(y);
-    /// println!("{:?}", y);
+    /// rng.shuffle(y);
+    /// println!("{}", y.as_slice());
+    /// rng.shuffle(y);
+    /// println!("{}", y.as_slice());
     /// ```
-    fn shuffle_mut<T>(&mut self, values: &mut [T]) {
+    fn shuffle<T>(&mut self, values: &mut [T]) {
         let mut i = values.len();
         while i >= 2u {
             // invariant: elements with index >= i have been locked in place.
@@ -329,6 +315,12 @@ pub trait Rng {
         }
     }
 
+    /// Shuffle a mutable slice in place.
+    #[deprecated="renamed to `.shuffle`"]
+    fn shuffle_mut<T>(&mut self, values: &mut [T]) {
+        self.shuffle(values)
+    }
+
     /// Randomly sample up to `n` elements from an iterator.
     ///
     /// # Example
@@ -338,10 +330,10 @@ pub trait Rng {
     ///
     /// let mut rng = task_rng();
     /// let sample = rng.sample(range(1, 100), 5);
-    /// println!("{:?}", sample);
+    /// println!("{}", sample);
     /// ```
-    fn sample<A, T: Iterator<A>>(&mut self, iter: T, n: uint) -> ~[A] {
-        let mut reservoir : ~[A] = slice::with_capacity(n);
+    fn sample<A, T: Iterator<A>>(&mut self, iter: T, n: uint) -> Vec<A> {
+        let mut reservoir = Vec::with_capacity(n);
         for (i, elem) in iter.enumerate() {
             if i < n {
                 reservoir.push(elem);
@@ -350,7 +342,7 @@ pub trait Rng {
 
             let k = self.gen_range(0, i + 1);
             if k < reservoir.len() {
-                reservoir[k] = elem
+                *reservoir.get_mut(k) = elem
             }
         }
         reservoir
@@ -401,18 +393,18 @@ pub trait SeedableRng<Seed>: Rng {
 /// appropriate.
 #[deprecated="use `task_rng` or `StdRng::new`"]
 pub fn rng() -> StdRng {
-    StdRng::new()
+    StdRng::new().unwrap()
 }
 
 /// The standard RNG. This is designed to be efficient on the current
 /// platform.
 #[cfg(not(target_word_size="64"))]
-pub struct StdRng { priv rng: IsaacRng }
+pub struct StdRng { rng: IsaacRng }
 
 /// The standard RNG. This is designed to be efficient on the current
 /// platform.
 #[cfg(target_word_size="64")]
-pub struct StdRng { priv rng: Isaac64Rng }
+pub struct StdRng { rng: Isaac64Rng }
 
 impl StdRng {
     /// Create a randomly seeded instance of `StdRng`.
@@ -423,9 +415,12 @@ impl StdRng {
     /// number of random numbers, or doesn't need the utmost speed for
     /// generating each number, `task_rng` and/or `random` may be more
     /// appropriate.
+    ///
+    /// Reading the randomness from the OS may fail, and any error is
+    /// propagated via the `IoResult` return value.
     #[cfg(not(target_word_size="64"))]
-    pub fn new() -> StdRng {
-        StdRng { rng: IsaacRng::new() }
+    pub fn new() -> IoResult<StdRng> {
+        IsaacRng::new().map(|r| StdRng { rng: r })
     }
     /// Create a randomly seeded instance of `StdRng`.
     ///
@@ -435,9 +430,12 @@ impl StdRng {
     /// number of random numbers, or doesn't need the utmost speed for
     /// generating each number, `task_rng` and/or `random` may be more
     /// appropriate.
+    ///
+    /// Reading the randomness from the OS may fail, and any error is
+    /// propagated via the `IoResult` return value.
     #[cfg(target_word_size="64")]
-    pub fn new() -> StdRng {
-        StdRng { rng: Isaac64Rng::new() }
+    pub fn new() -> IoResult<StdRng> {
+        Isaac64Rng::new().map(|r| StdRng { rng: r })
     }
 }
 
@@ -475,7 +473,10 @@ impl<'a> SeedableRng<&'a [uint]> for StdRng {
 /// This will read randomness from the operating system to seed the
 /// generator.
 pub fn weak_rng() -> XorShiftRng {
-    XorShiftRng::new()
+    match XorShiftRng::new() {
+        Ok(r) => r,
+        Err(e) => fail!("weak_rng: failed to create seeded RNG: {}", e)
+    }
 }
 
 /// An Xorshift[1] random number
@@ -489,10 +490,10 @@ pub fn weak_rng() -> XorShiftRng {
 /// RNGs"](http://www.jstatsoft.org/v08/i14/paper). *Journal of
 /// Statistical Software*. Vol. 8 (Issue 14).
 pub struct XorShiftRng {
-    priv x: u32,
-    priv y: u32,
-    priv z: u32,
-    priv w: u32,
+    x: u32,
+    y: u32,
+    z: u32,
+    w: u32,
 }
 
 impl Rng for XorShiftRng {
@@ -537,10 +538,10 @@ impl SeedableRng<[u32, .. 4]> for XorShiftRng {
 
 impl XorShiftRng {
     /// Create an xor shift random number generator with a random seed.
-    pub fn new() -> XorShiftRng {
+    pub fn new() -> IoResult<XorShiftRng> {
         let mut s = [0u8, ..16];
+        let mut r = try!(OSRng::new());
         loop {
-            let mut r = OSRng::new();
             r.fill_bytes(s);
 
             if !s.iter().all(|x| *x == 0) {
@@ -548,7 +549,7 @@ impl XorShiftRng {
             }
         }
         let s: [u32, ..4] = unsafe { cast::transmute(s) };
-        SeedableRng::from_seed(s)
+        Ok(SeedableRng::from_seed(s))
     }
 }
 
@@ -557,7 +558,10 @@ struct TaskRngReseeder;
 
 impl reseeding::Reseeder<StdRng> for TaskRngReseeder {
     fn reseed(&mut self, rng: &mut StdRng) {
-        *rng = StdRng::new();
+        *rng = match StdRng::new() {
+            Ok(r) => r,
+            Err(e) => fail!("could not reseed task_rng: {}", e)
+        }
     }
 }
 static TASK_RNG_RESEED_THRESHOLD: uint = 32_768;
@@ -573,8 +577,8 @@ pub struct TaskRng {
     // The use of unsafe code here is OK if the invariants above are
     // satisfied; and it allows us to avoid (unnecessarily) using a
     // GC'd or RC'd pointer.
-    priv rng: *mut TaskRngInner,
-    priv marker: marker::NoSend,
+    rng: *mut TaskRngInner,
+    marker: marker::NoSend,
 }
 
 // used to make space in TLS for a random number generator
@@ -594,7 +598,11 @@ local_data_key!(TASK_RNG_KEY: ~TaskRngInner)
 pub fn task_rng() -> TaskRng {
     local_data::get_mut(TASK_RNG_KEY, |rng| match rng {
         None => {
-            let mut rng = ~reseeding::ReseedingRng::new(StdRng::new(),
+            let r = match StdRng::new() {
+                Ok(r) => r,
+                Err(e) => fail!("could not initialize task_rng: {}", e)
+            };
+            let mut rng = ~reseeding::ReseedingRng::new(r,
                                                         TASK_RNG_RESEED_THRESHOLD,
                                                         TaskRngReseeder);
             let ptr = &mut *rng as *mut TaskRngInner;
@@ -656,7 +664,7 @@ pub fn random<T: Rand>() -> T {
 /// let Open01(val) = random::<Open01<f32>>();
 /// println!("f32 from (0,1): {}", val);
 /// ```
-pub struct Open01<F>(F);
+pub struct Open01<F>(pub F);
 
 /// A wrapper for generating floating point numbers uniformly in the
 /// closed interval `[0,1]` (including both endpoints).
@@ -672,12 +680,11 @@ pub struct Open01<F>(F);
 /// let Closed01(val) = random::<Closed01<f32>>();
 /// println!("f32 from [0,1]: {}", val);
 /// ```
-pub struct Closed01<F>(F);
+pub struct Closed01<F>(pub F);
 
 #[cfg(test)]
 mod test {
-    use std::slice;
-    use super::{Rng, task_rng, random, OSRng, SeedableRng, StdRng};
+    use super::{Rng, task_rng, random, SeedableRng, StdRng};
 
     struct ConstRng { i: u64 }
     impl Rng for ConstRng {
@@ -695,8 +702,8 @@ mod test {
         let lengths = [0, 1, 2, 3, 4, 5, 6, 7,
                        80, 81, 82, 83, 84, 85, 86, 87];
         for &n in lengths.iter() {
-            let mut v = slice::from_elem(n, 0u8);
-            r.fill_bytes(v);
+            let mut v = Vec::from_elem(n, 0u8);
+            r.fill_bytes(v.as_mut_slice());
 
             // use this to get nicer error messages.
             for (i, &byte) in v.iter().enumerate() {
@@ -794,16 +801,28 @@ mod test {
     #[test]
     fn test_shuffle() {
         let mut r = task_rng();
-        let empty: ~[int] = ~[];
-        assert_eq!(r.shuffle(~[]), empty);
-        assert_eq!(r.shuffle(~[1, 1, 1]), ~[1, 1, 1]);
+        let mut empty: &mut [int] = &mut [];
+        r.shuffle(empty);
+        let mut one = [1];
+        r.shuffle(one);
+        assert_eq!(one.as_slice(), &[1]);
+
+        let mut two = [1, 2];
+        r.shuffle(two);
+        assert!(two == [1, 2] || two == [2, 1]);
+
+        let mut x = [1, 1, 1];
+        r.shuffle(x);
+        assert_eq!(x.as_slice(), &[1, 1, 1]);
     }
 
     #[test]
     fn test_task_rng() {
         let mut r = task_rng();
         r.gen::<int>();
-        assert_eq!(r.shuffle(~[1, 1, 1]), ~[1, 1, 1]);
+        let mut v = [1, 1, 1];
+        r.shuffle(v);
+        assert_eq!(v.as_slice(), &[1, 1, 1]);
         assert_eq!(r.gen_range(0u, 1u), 0u);
     }
 
@@ -825,7 +844,7 @@ mod test {
         let max_val = 100;
 
         let mut r = task_rng();
-        let vals = range(min_val, max_val).collect::<~[int]>();
+        let vals = range(min_val, max_val).collect::<Vec<int>>();
         let small_sample = r.sample(vals.iter(), 5);
         let large_sample = r.sample(vals.iter(), vals.len() + 5);
 
@@ -839,7 +858,7 @@ mod test {
 
     #[test]
     fn test_std_rng_seeded() {
-        let s = OSRng::new().gen_vec::<uint>(256);
+        let s = task_rng().gen_vec::<uint>(256);
         let mut ra: StdRng = SeedableRng::from_seed(s.as_slice());
         let mut rb: StdRng = SeedableRng::from_seed(s.as_slice());
         assert_eq!(ra.gen_ascii_str(100u), rb.gen_ascii_str(100u));
@@ -847,11 +866,11 @@ mod test {
 
     #[test]
     fn test_std_rng_reseed() {
-        let s = OSRng::new().gen_vec::<uint>(256);
+        let s = task_rng().gen_vec::<uint>(256);
         let mut r: StdRng = SeedableRng::from_seed(s.as_slice());
         let string1 = r.gen_ascii_str(100);
 
-        r.reseed(s);
+        r.reseed(s.as_slice());
 
         let string2 = r.gen_ascii_str(100);
         assert_eq!(string1, string2);
@@ -870,7 +889,7 @@ mod bench {
 
     #[bench]
     fn rand_xorshift(bh: &mut BenchHarness) {
-        let mut rng = XorShiftRng::new();
+        let mut rng = XorShiftRng::new().unwrap();
         bh.iter(|| {
             for _ in range(0, RAND_BENCH_N) {
                 rng.gen::<uint>();
@@ -881,7 +900,7 @@ mod bench {
 
     #[bench]
     fn rand_isaac(bh: &mut BenchHarness) {
-        let mut rng = IsaacRng::new();
+        let mut rng = IsaacRng::new().unwrap();
         bh.iter(|| {
             for _ in range(0, RAND_BENCH_N) {
                 rng.gen::<uint>();
@@ -892,7 +911,7 @@ mod bench {
 
     #[bench]
     fn rand_isaac64(bh: &mut BenchHarness) {
-        let mut rng = Isaac64Rng::new();
+        let mut rng = Isaac64Rng::new().unwrap();
         bh.iter(|| {
             for _ in range(0, RAND_BENCH_N) {
                 rng.gen::<uint>();
@@ -903,7 +922,7 @@ mod bench {
 
     #[bench]
     fn rand_std(bh: &mut BenchHarness) {
-        let mut rng = StdRng::new();
+        let mut rng = StdRng::new().unwrap();
         bh.iter(|| {
             for _ in range(0, RAND_BENCH_N) {
                 rng.gen::<uint>();
@@ -914,10 +933,10 @@ mod bench {
 
     #[bench]
     fn rand_shuffle_100(bh: &mut BenchHarness) {
-        let mut rng = XorShiftRng::new();
+        let mut rng = XorShiftRng::new().unwrap();
         let x : &mut[uint] = [1,..100];
         bh.iter(|| {
-            rng.shuffle_mut(x);
+            rng.shuffle(x);
         })
     }
 }
diff --git a/src/librand/os.rs b/src/librand/os.rs
index 0f4169bfe28..762e09fb3f5 100644
--- a/src/librand/os.rs
+++ b/src/librand/os.rs
@@ -17,7 +17,7 @@ pub use self::imp::OSRng;
 mod imp {
     use Rng;
     use reader::ReaderRng;
-    use std::io::File;
+    use std::io::{IoResult, File};
 
     /// A random number generator that retrieves randomness straight from
     /// the operating system. Platform sources:
@@ -30,17 +30,16 @@ mod imp {
     /// This does not block.
     #[cfg(unix)]
     pub struct OSRng {
-        priv inner: ReaderRng<File>
+        inner: ReaderRng<File>
     }
 
     impl OSRng {
         /// Create a new `OSRng`.
-        pub fn new() -> OSRng {
-            let reader = File::open(&Path::new("/dev/urandom"));
-            let reader = reader.ok().expect("Error opening /dev/urandom");
+        pub fn new() -> IoResult<OSRng> {
+            let reader = try!(File::open(&Path::new("/dev/urandom")));
             let reader_rng = ReaderRng::new(reader);
 
-            OSRng { inner: reader_rng }
+            Ok(OSRng { inner: reader_rng })
         }
     }
 
@@ -61,6 +60,7 @@ mod imp {
 mod imp {
     use Rng;
     use std::cast;
+    use std::io::{IoResult, IoError};
     use std::libc::{c_ulong, DWORD, BYTE, LPCSTR, BOOL};
     use std::os;
     use std::rt::stack;
@@ -77,7 +77,7 @@ mod imp {
     ///
     /// This does not block.
     pub struct OSRng {
-        priv hcryptprov: HCRYPTPROV
+        hcryptprov: HCRYPTPROV
     }
 
     static PROV_RSA_FULL: DWORD = 1;
@@ -99,7 +99,7 @@ mod imp {
 
     impl OSRng {
         /// Create a new `OSRng`.
-        pub fn new() -> OSRng {
+        pub fn new() -> IoResult<OSRng> {
             let mut hcp = 0;
             let mut ret = unsafe {
                 CryptAcquireContextA(&mut hcp, 0 as LPCSTR, 0 as LPCSTR,
@@ -143,9 +143,10 @@ mod imp {
             }
 
             if ret == 0 {
-                fail!("couldn't create context: {}", os::last_os_error());
+                Err(IoError::last_error())
+            } else {
+                Ok(OSRng { hcryptprov: hcp })
             }
-            OSRng { hcryptprov: hcp }
         }
     }
 
@@ -191,7 +192,7 @@ mod test {
 
     #[test]
     fn test_os_rng() {
-        let mut r = OSRng::new();
+        let mut r = OSRng::new().unwrap();
 
         r.next_u32();
         r.next_u64();
@@ -203,7 +204,7 @@ mod test {
     #[test]
     fn test_os_rng_tasks() {
 
-        let mut txs = ~[];
+        let mut txs = vec!();
         for _ in range(0, 20) {
             let (tx, rx) = channel();
             txs.push(tx);
@@ -213,7 +214,7 @@ mod test {
 
                 // deschedule to attempt to interleave things as much
                 // as possible (XXX: is this a good test?)
-                let mut r = OSRng::new();
+                let mut r = OSRng::new().unwrap();
                 task::deschedule();
                 let mut v = [0u8, .. 1000];
 
diff --git a/src/librand/reader.rs b/src/librand/reader.rs
index 9e7e38d2723..dff821d8329 100644
--- a/src/librand/reader.rs
+++ b/src/librand/reader.rs
@@ -27,7 +27,7 @@ use Rng;
 /// println!("{:x}", rng.gen::<uint>());
 /// ```
 pub struct ReaderRng<R> {
-    priv reader: R
+    reader: R
 }
 
 impl<R: Reader> ReaderRng<R> {
@@ -68,6 +68,7 @@ impl<R: Reader> Rng for ReaderRng<R> {
 }
 
 #[cfg(test)]
+#[allow(deprecated_owned_vector)]
 mod test {
     use super::ReaderRng;
     use std::io::MemReader;
diff --git a/src/librand/reseeding.rs b/src/librand/reseeding.rs
index a64124e637e..fe2ff319c1c 100644
--- a/src/librand/reseeding.rs
+++ b/src/librand/reseeding.rs
@@ -21,11 +21,11 @@ static DEFAULT_GENERATION_THRESHOLD: uint = 32 * 1024;
 /// A wrapper around any RNG which reseeds the underlying RNG after it
 /// has generated a certain number of random bytes.
 pub struct ReseedingRng<R, Rsdr> {
-    priv rng: R,
-    priv generation_threshold: uint,
-    priv bytes_generated: uint,
+    rng: R,
+    generation_threshold: uint,
+    bytes_generated: uint,
     /// Controls the behaviour when reseeding the RNG.
-    reseeder: Rsdr
+    pub reseeder: Rsdr,
 }
 
 impl<R: Rng, Rsdr: Reseeder<R>> ReseedingRng<R, Rsdr> {
@@ -100,12 +100,12 @@ impl<S, R: SeedableRng<S>, Rsdr: Reseeder<R>>
 /// # Example
 ///
 /// ```rust
-/// use rand::{Rng, SeedableRng};
+/// use rand::{Rng, SeedableRng, StdRng};
 /// use rand::reseeding::{Reseeder, ReseedingRng};
 ///
 /// struct TickTockReseeder { tick: bool }
-/// impl Reseeder<rand::StdRng> for TickTockReseeder {
-///     fn reseed(&mut self, rng: &mut rand::StdRng) {
+/// impl Reseeder<StdRng> for TickTockReseeder {
+///     fn reseed(&mut self, rng: &mut StdRng) {
 ///         let val = if self.tick {0} else {1};
 ///         rng.reseed(&[val]);
 ///         self.tick = !self.tick;
@@ -113,7 +113,9 @@ impl<S, R: SeedableRng<S>, Rsdr: Reseeder<R>>
 /// }
 /// fn main() {
 ///     let rsdr = TickTockReseeder { tick: true };
-///     let mut rng = ReseedingRng::new(rand::StdRng::new(), 10, rsdr);
+///
+///     let inner = StdRng::new().unwrap();
+///     let mut rng = ReseedingRng::new(inner, 10, rsdr);
 ///
 ///     // this will repeat, because it gets reseeded very regularly.
 ///     println!("{}", rng.gen_ascii_str(100));
@@ -203,8 +205,8 @@ mod test {
     #[test]
     fn test_rng_fill_bytes() {
         use task_rng;
-        let mut v = ~[0u8, .. fill_bytes_v_len];
-        task_rng().fill_bytes(v);
+        let mut v = Vec::from_elem(fill_bytes_v_len, 0u8);
+        task_rng().fill_bytes(v.as_mut_slice());
 
         // Sanity test: if we've gotten here, `fill_bytes` has not infinitely
         // recursed.
diff --git a/src/librustc/back/abi.rs b/src/librustc/back/abi.rs
index 83a17bd3231..c722beb43ae 100644
--- a/src/librustc/back/abi.rs
+++ b/src/librustc/back/abi.rs
@@ -8,44 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub static rc_base_field_refcnt: uint = 0u;
-
-pub static task_field_refcnt: uint = 0u;
-
-pub static task_field_stk: uint = 2u;
-
-pub static task_field_runtime_sp: uint = 3u;
-
-pub static task_field_rust_sp: uint = 4u;
-
-pub static task_field_gc_alloc_chain: uint = 5u;
-
-pub static task_field_dom: uint = 6u;
-
-pub static n_visible_task_fields: uint = 7u;
-
-pub static dom_field_interrupt_flag: uint = 1u;
-
-pub static frame_glue_fns_field_mark: uint = 0u;
-
-pub static frame_glue_fns_field_drop: uint = 1u;
-
-pub static frame_glue_fns_field_reloc: uint = 2u;
-
 pub static box_field_refcnt: uint = 0u;
 pub static box_field_tydesc: uint = 1u;
-pub static box_field_prev: uint = 2u;
-pub static box_field_next: uint = 3u;
 pub static box_field_body: uint = 4u;
 
-pub static general_code_alignment: uint = 16u;
-
-pub static tydesc_field_size: uint = 0u;
-pub static tydesc_field_align: uint = 1u;
-pub static tydesc_field_drop_glue: uint = 2u;
 pub static tydesc_field_visit_glue: uint = 3u;
-pub static tydesc_field_name_offset: uint = 4u;
-pub static n_tydesc_fields: uint = 5u;
 
 // The two halves of a closure: code and environment.
 pub static fn_field_code: uint = 0u;
@@ -64,5 +31,3 @@ pub static vec_elt_elems: uint = 2u;
 
 pub static slice_elt_base: uint = 0u;
 pub static slice_elt_len: uint = 1u;
-
-pub static abi_version: uint = 1u;
diff --git a/src/librustc/back/archive.rs b/src/librustc/back/archive.rs
index 786be3798a1..6de7bb59b61 100644
--- a/src/librustc/back/archive.rs
+++ b/src/librustc/back/archive.rs
@@ -28,12 +28,12 @@ use syntax::abi;
 pub static METADATA_FILENAME: &'static str = "rust.metadata.bin";
 
 pub struct Archive<'a> {
-    priv sess: &'a Session,
-    priv dst: Path,
+    sess: &'a Session,
+    dst: Path,
 }
 
 pub struct ArchiveRO {
-    priv ptr: ArchiveRef,
+    ptr: ArchiveRef,
 }
 
 fn run_ar(sess: &Session, args: &str, cwd: Option<&Path>,
@@ -87,29 +87,6 @@ impl<'a> Archive<'a> {
         Archive { sess: sess, dst: dst }
     }
 
-    /// Read a file in the archive
-    pub fn read(&self, file: &str) -> Vec<u8> {
-        // Apparently if "ar p" is used on windows, it generates a corrupt file
-        // which has bad headers and LLVM will immediately choke on it
-        if cfg!(windows) {
-            let loc = TempDir::new("rsar").unwrap();
-            let archive = os::make_absolute(&self.dst);
-            run_ar(self.sess, "x", Some(loc.path()), [&archive,
-                                                      &Path::new(file)]);
-            let result: Vec<u8> =
-                fs::File::open(&loc.path().join(file)).read_to_end()
-                                                      .unwrap()
-                                                      .move_iter()
-                                                      .collect();
-            result
-        } else {
-            run_ar(self.sess,
-                   "p",
-                   None,
-                   [&self.dst, &Path::new(file)]).output.move_iter().collect()
-        }
-    }
-
     /// Adds all of the contents of a native library to this archive. This will
     /// search in the relevant locations for a library named `name`.
     pub fn add_native_library(&mut self, name: &str) -> io::IoResult<()> {
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index f198a41af65..e9292f54a4b 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -687,16 +687,6 @@ pub fn mangle_exported_name(ccx: &CrateContext, path: PathElems,
     exported_name(path, hash, ccx.link_meta.crateid.version_or_default())
 }
 
-pub fn mangle_internal_name_by_type_only(ccx: &CrateContext,
-                                         t: ty::t,
-                                         name: &str) -> ~str {
-    let s = ppaux::ty_to_short_str(ccx.tcx(), t);
-    let path = [PathName(token::intern(name)),
-                PathName(token::intern(s))];
-    let hash = get_symbol_hash(ccx, t);
-    mangle(ast_map::Values(path.iter()), Some(hash.as_slice()), None)
-}
-
 pub fn mangle_internal_name_by_type_and_seq(ccx: &CrateContext,
                                             t: ty::t,
                                             name: &str) -> ~str {
diff --git a/src/librustc/back/lto.rs b/src/librustc/back/lto.rs
index ef3496f113b..674f5e77cc0 100644
--- a/src/librustc/back/lto.rs
+++ b/src/librustc/back/lto.rs
@@ -69,8 +69,8 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
     }
 
     // Internalize everything but the reachable symbols of the current module
-    let cstrs = reachable.map(|s| s.to_c_str());
-    let arr = cstrs.map(|c| c.with_ref(|p| p));
+    let cstrs: Vec<::std::c_str::CString> = reachable.iter().map(|s| s.to_c_str()).collect();
+    let arr: Vec<*i8> = cstrs.iter().map(|c| c.with_ref(|p| p)).collect();
     let ptr = arr.as_ptr();
     unsafe {
         llvm::LLVMRustRunRestrictionPass(llmod, ptr as **libc::c_char,
diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs
index 08e96ec9215..c47f9893cd2 100644
--- a/src/librustc/back/rpath.rs
+++ b/src/librustc/back/rpath.rs
@@ -54,8 +54,9 @@ pub fn get_rpath_flags(sess: &Session, out_filename: &Path) -> Vec<~str> {
 }
 
 fn get_sysroot_absolute_rt_lib(sess: &Session) -> Path {
-    let r = filesearch::relative_target_lib_path(sess.opts.target_triple);
-    let mut p = sess.filesearch().sysroot.join(&r);
+    let sysroot = sess.filesearch().sysroot;
+    let r = filesearch::relative_target_lib_path(sysroot, sess.opts.target_triple);
+    let mut p = sysroot.join(&r);
     p.push(os::dll_filename("rustrt"));
     p
 }
@@ -91,7 +92,7 @@ fn get_rpaths(os: abi::Os,
     let abs_rpaths = get_absolute_rpaths(libs);
 
     // And a final backup rpath to the global library location.
-    let fallback_rpaths = vec!(get_install_prefix_rpath(target_triple));
+    let fallback_rpaths = vec!(get_install_prefix_rpath(sysroot, target_triple));
 
     fn log_rpaths(desc: &str, rpaths: &[~str]) {
         debug!("{} rpaths:", desc);
@@ -156,10 +157,10 @@ pub fn get_absolute_rpath(lib: &Path) -> ~str {
     p.as_str().expect("non-utf8 component in rpath").to_owned()
 }
 
-pub fn get_install_prefix_rpath(target_triple: &str) -> ~str {
+pub fn get_install_prefix_rpath(sysroot: &Path, target_triple: &str) -> ~str {
     let install_prefix = env!("CFG_PREFIX");
 
-    let tlib = filesearch::relative_target_lib_path(target_triple);
+    let tlib = filesearch::relative_target_lib_path(sysroot, target_triple);
     let mut path = Path::new(install_prefix);
     path.push(&tlib);
     let path = os::make_absolute(&path);
@@ -195,7 +196,8 @@ mod test {
 
     #[test]
     fn test_prefix_rpath() {
-        let res = get_install_prefix_rpath("triple");
+        let sysroot = filesearch::get_or_default_sysroot();
+        let res = get_install_prefix_rpath(&sysroot, "triple");
         let mut d = Path::new(env!("CFG_PREFIX"));
         d.push("lib");
         d.push(filesearch::rustlibdir());
@@ -208,7 +210,8 @@ mod test {
 
     #[test]
     fn test_prefix_rpath_abs() {
-        let res = get_install_prefix_rpath("triple");
+        let sysroot = filesearch::get_or_default_sysroot();
+        let res = get_install_prefix_rpath(&sysroot, "triple");
         assert!(Path::new(res).is_absolute());
     }
 
diff --git a/src/librustc/back/svh.rs b/src/librustc/back/svh.rs
index a34323d6ddc..a2c579d13f4 100644
--- a/src/librustc/back/svh.rs
+++ b/src/librustc/back/svh.rs
@@ -54,7 +54,7 @@ use syntax::ast;
 
 #[deriving(Clone, Eq)]
 pub struct Svh {
-    priv hash: ~str,
+    hash: ~str,
 }
 
 impl Svh {
diff --git a/src/librustc/back/target_strs.rs b/src/librustc/back/target_strs.rs
index 1528fff5113..e8cdbbdad48 100644
--- a/src/librustc/back/target_strs.rs
+++ b/src/librustc/back/target_strs.rs
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 pub struct t {
-    module_asm: ~str,
-    meta_sect_name: ~str,
-    data_layout: ~str,
-    target_triple: ~str,
-    cc_args: Vec<~str> ,
+    pub module_asm: ~str,
+    pub meta_sect_name: ~str,
+    pub data_layout: ~str,
+    pub target_triple: ~str,
+    pub cc_args: Vec<~str> ,
 }
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index fb0de959489..7cb8a3c4efd 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -37,7 +37,6 @@ use std::io::fs;
 use std::io::MemReader;
 use std::mem::drop;
 use std::os;
-use std::vec;
 use getopts::{optopt, optmulti, optflag, optflagopt};
 use getopts;
 use syntax::ast;
@@ -137,8 +136,7 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig {
     } else {
         InternedString::new("nogc")
     });
-    return vec::append(user_cfg.move_iter().collect(),
-                          default_cfg.as_slice());
+    user_cfg.move_iter().collect::<Vec<_>>().append(default_cfg.as_slice())
 }
 
 // Convert strings provided as --cfg [cfgspec] into a crate_cfg
@@ -168,6 +166,7 @@ impl Input {
     }
 }
 
+
 pub fn phase_1_parse_input(sess: &Session, cfg: ast::CrateConfig, input: &Input)
     -> ast::Crate {
     let krate = time(sess.time_passes(), "parsing", (), |_| {
@@ -187,7 +186,8 @@ pub fn phase_1_parse_input(sess: &Session, cfg: ast::CrateConfig, input: &Input)
     if sess.opts.debugging_opts & session::AST_JSON_NOEXPAND != 0 {
         let mut stdout = io::BufferedWriter::new(io::stdout());
         let mut json = json::PrettyEncoder::new(&mut stdout);
-        krate.encode(&mut json);
+        // unwrapping so IoError isn't ignored
+        krate.encode(&mut json).unwrap();
     }
 
     if sess.show_span() {
@@ -212,9 +212,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
     let time_passes = sess.time_passes();
 
     sess.building_library.set(session::building_library(&sess.opts, &krate));
-    sess.crate_types.set(session::collect_crate_types(sess,
-                                                      krate.attrs
-                                                           .as_slice()));
+    *sess.crate_types.borrow_mut() = session::collect_crate_types(sess, krate.attrs.as_slice());
 
     time(time_passes, "gated feature checking", (), |_|
          front::feature_gate::check_crate(sess, &krate));
@@ -262,19 +260,20 @@ pub fn phase_2_configure_and_expand(sess: &Session,
     if sess.opts.debugging_opts & session::AST_JSON != 0 {
         let mut stdout = io::BufferedWriter::new(io::stdout());
         let mut json = json::PrettyEncoder::new(&mut stdout);
-        krate.encode(&mut json);
+        // unwrapping so IoError isn't ignored
+        krate.encode(&mut json).unwrap();
     }
 
     (krate, map)
 }
 
 pub struct CrateAnalysis {
-    exp_map2: middle::resolve::ExportMap2,
-    exported_items: middle::privacy::ExportedItems,
-    public_items: middle::privacy::PublicItems,
-    ty_cx: ty::ctxt,
-    maps: astencode::Maps,
-    reachable: NodeSet,
+    pub exp_map2: middle::resolve::ExportMap2,
+    pub exported_items: middle::privacy::ExportedItems,
+    pub public_items: middle::privacy::PublicItems,
+    pub ty_cx: ty::ctxt,
+    pub maps: astencode::Maps,
+    pub reachable: NodeSet,
 }
 
 /// Run the resolution, typechecking, region checking and other
@@ -324,6 +323,9 @@ pub fn phase_3_run_analysis_passes(sess: Session,
     let region_map = time(time_passes, "region resolution", (), |_|
                           middle::region::resolve_crate(&sess, krate));
 
+    time(time_passes, "loop checking", (), |_|
+         middle::check_loop::check_crate(&sess, krate));
+
     let ty_cx = ty::mk_ctxt(sess, def_map, named_region_map, ast_map,
                             freevars, region_map, lang_items);
 
@@ -349,9 +351,6 @@ pub fn phase_3_run_analysis_passes(sess: Session,
     time(time_passes, "effect checking", (), |_|
          middle::effect::check_crate(&ty_cx, method_map, krate));
 
-    time(time_passes, "loop checking", (), |_|
-         middle::check_loop::check_crate(&ty_cx, krate));
-
     let middle::moves::MoveMaps {moves_map, moved_variables_set,
                                  capture_map} =
         time(time_passes, "compute moves", (), |_|
@@ -408,12 +407,12 @@ pub fn phase_3_run_analysis_passes(sess: Session,
 }
 
 pub struct CrateTranslation {
-    context: ContextRef,
-    module: ModuleRef,
-    metadata_module: ModuleRef,
-    link: LinkMeta,
-    metadata: Vec<u8> ,
-    reachable: Vec<~str> ,
+    pub context: ContextRef,
+    pub module: ModuleRef,
+    pub metadata_module: ModuleRef,
+    pub link: LinkMeta,
+    pub metadata: Vec<u8>,
+    pub reachable: Vec<~str>,
 }
 
 /// Run the translation phase to LLVM, after which the AST and analysis can
@@ -800,7 +799,7 @@ pub fn host_triple() -> ~str {
     // Instead of grabbing the host triple (for the current host), we grab (at
     // compile time) the target triple that this rustc is built with and
     // calling that (at runtime) the host triple.
-    (env!("CFG_COMPILER")).to_owned()
+    (env!("CFG_COMPILER_HOST_TRIPLE")).to_owned()
 }
 
 pub fn build_session_options(matches: &getopts::Matches) -> session::Options {
@@ -833,9 +832,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> session::Options {
 
         let level_short = level_name.slice_chars(0, 1);
         let level_short = level_short.to_ascii().to_upper().into_str();
-        let flags = vec::append(matches.opt_strs(level_short)
-                                          .move_iter()
-                                          .collect(),
+        let flags = matches.opt_strs(level_short).move_iter().collect::<Vec<_>>().append(
                                    matches.opt_strs(level_name).as_slice());
         for lint_name in flags.iter() {
             let lint_name = lint_name.replace("-", "_");
@@ -940,9 +937,9 @@ pub fn build_session_options(matches: &getopts::Matches) -> session::Options {
         NoDebugInfo
     };
 
-    let addl_lib_search_paths = matches.opt_strs("L").map(|s| {
+    let addl_lib_search_paths = matches.opt_strs("L").iter().map(|s| {
         Path::new(s.as_slice())
-    }).move_iter().collect();
+    }).collect();
 
     let cfg = parse_cfgspecs(matches.opt_strs("cfg").move_iter().collect());
     let test = matches.opt_present("test");
@@ -1125,9 +1122,9 @@ pub fn optgroups() -> Vec<getopts::OptGroup> {
 }
 
 pub struct OutputFilenames {
-    out_directory: Path,
-    out_filestem: ~str,
-    single_output_file: Option<Path>,
+    pub out_directory: Path,
+    pub out_filestem: ~str,
+    pub single_output_file: Option<Path>,
 }
 
 impl OutputFilenames {
diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs
index 29bf5b9c93f..c25a2e79824 100644
--- a/src/librustc/driver/session.rs
+++ b/src/librustc/driver/session.rs
@@ -31,11 +31,11 @@ use std::cell::{Cell, RefCell};
 use collections::HashSet;
 
 pub struct Config {
-    os: abi::Os,
-    arch: abi::Architecture,
-    target_strs: target_strs::t,
-    int_type: IntTy,
-    uint_type: UintTy,
+    pub os: abi::Os,
+    pub arch: abi::Architecture,
+    pub target_strs: target_strs::t,
+    pub int_type: IntTy,
+    pub uint_type: UintTy,
 }
 
 macro_rules! debugging_opts(
@@ -124,34 +124,34 @@ pub enum DebugInfoLevel {
 pub struct Options {
     // The crate config requested for the session, which may be combined
     // with additional crate configurations during the compile process
-    crate_types: Vec<CrateType> ,
+    pub crate_types: Vec<CrateType> ,
 
-    gc: bool,
-    optimize: OptLevel,
-    debuginfo: DebugInfoLevel,
-    lint_opts: Vec<(lint::Lint, lint::level)> ,
-    output_types: Vec<back::link::OutputType> ,
+    pub gc: bool,
+    pub optimize: OptLevel,
+    pub debuginfo: DebugInfoLevel,
+    pub lint_opts: Vec<(lint::Lint, lint::level)> ,
+    pub output_types: Vec<back::link::OutputType> ,
     // This was mutable for rustpkg, which updates search paths based on the
     // parsed code. It remains mutable in case its replacements wants to use
     // this.
-    addl_lib_search_paths: RefCell<HashSet<Path>>,
-    maybe_sysroot: Option<Path>,
-    target_triple: ~str,
+    pub addl_lib_search_paths: RefCell<HashSet<Path>>,
+    pub maybe_sysroot: Option<Path>,
+    pub target_triple: ~str,
     // User-specified cfg meta items. The compiler itself will add additional
     // items to the crate config, and during parsing the entire crate config
     // will be added to the crate AST node.  This should not be used for
     // anything except building the full crate config prior to parsing.
-    cfg: ast::CrateConfig,
-    test: bool,
-    parse_only: bool,
-    no_trans: bool,
-    no_analysis: bool,
-    debugging_opts: u64,
+    pub cfg: ast::CrateConfig,
+    pub test: bool,
+    pub parse_only: bool,
+    pub no_trans: bool,
+    pub no_analysis: bool,
+    pub debugging_opts: u64,
     /// Whether to write dependency files. It's (enabled, optional filename).
-    write_dependency_info: (bool, Option<Path>),
+    pub write_dependency_info: (bool, Option<Path>),
     /// Crate id-related things to maybe print. It's (crate_id, crate_name, crate_file_name).
-    print_metas: (bool, bool, bool),
-    cg: CodegenOptions,
+    pub print_metas: (bool, bool, bool),
+    pub cg: CodegenOptions,
 }
 
 // The type of entry function, so
@@ -174,28 +174,28 @@ pub enum CrateType {
 }
 
 pub struct Session {
-    targ_cfg: Config,
-    opts: Options,
-    cstore: metadata::cstore::CStore,
-    parse_sess: ParseSess,
+    pub targ_cfg: Config,
+    pub opts: Options,
+    pub cstore: metadata::cstore::CStore,
+    pub parse_sess: ParseSess,
     // For a library crate, this is always none
-    entry_fn: RefCell<Option<(NodeId, codemap::Span)>>,
-    entry_type: Cell<Option<EntryFnType>>,
-    macro_registrar_fn: RefCell<Option<ast::DefId>>,
-    default_sysroot: Option<Path>,
-    building_library: Cell<bool>,
+    pub entry_fn: RefCell<Option<(NodeId, codemap::Span)>>,
+    pub entry_type: Cell<Option<EntryFnType>>,
+    pub macro_registrar_fn: RefCell<Option<ast::DefId>>,
+    pub default_sysroot: Option<Path>,
+    pub building_library: Cell<bool>,
     // The name of the root source file of the crate, in the local file system. The path is always
     // expected to be absolute. `None` means that there is no source file.
-    local_crate_source_file: Option<Path>,
-    working_dir: Path,
-    lints: RefCell<NodeMap<Vec<(lint::Lint, codemap::Span, ~str)>>>,
-    node_id: Cell<ast::NodeId>,
-    crate_types: RefCell<Vec<CrateType>>,
-    features: front::feature_gate::Features,
+    pub local_crate_source_file: Option<Path>,
+    pub working_dir: Path,
+    pub lints: RefCell<NodeMap<Vec<(lint::Lint, codemap::Span, ~str)>>>,
+    pub node_id: Cell<ast::NodeId>,
+    pub crate_types: RefCell<Vec<CrateType>>,
+    pub features: front::feature_gate::Features,
 
     /// The maximum recursion limit for potentially infinitely recursive
     /// operations such as auto-dereference and monomorphization.
-    recursion_limit: Cell<uint>,
+    pub recursion_limit: Cell<uint>,
 }
 
 impl Session {
@@ -232,6 +232,9 @@ impl Session {
     pub fn span_end_note(&self, sp: Span, msg: &str) {
         self.diagnostic().span_end_note(sp, msg)
     }
+    pub fn fileline_note(&self, sp: Span, msg: &str) {
+        self.diagnostic().fileline_note(sp, msg)
+    }
     pub fn note(&self, msg: &str) {
         self.diagnostic().handler().note(msg)
     }
@@ -365,7 +368,7 @@ macro_rules! cgoptions(
     ($($opt:ident : $t:ty = ($init:expr, $parse:ident, $desc:expr)),* ,) =>
 (
     #[deriving(Clone)]
-    pub struct CodegenOptions { $($opt: $t),* }
+    pub struct CodegenOptions { $(pub $opt: $t),* }
 
     pub fn basic_codegen_options() -> CodegenOptions {
         CodegenOptions { $($opt: $init),* }
diff --git a/src/librustc/front/config.rs b/src/librustc/front/config.rs
index b4861d196e0..cfbe772a165 100644
--- a/src/librustc/front/config.rs
+++ b/src/librustc/front/config.rs
@@ -90,7 +90,7 @@ fn fold_foreign_mod(cx: &mut Context, nm: &ast::ForeignMod) -> ast::ForeignMod {
         filter_view_item(cx, a).map(|x| cx.fold_view_item(x))
     }).collect();
     ast::ForeignMod {
-        abis: nm.abis,
+        abi: nm.abi,
         view_items: filtered_view_items,
         items: filtered_items
     }
diff --git a/src/librustc/front/feature_gate.rs b/src/librustc/front/feature_gate.rs
index c3743db8adc..5c0b9c89565 100644
--- a/src/librustc/front/feature_gate.rs
+++ b/src/librustc/front/feature_gate.rs
@@ -49,6 +49,8 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
     ("macro_registrar", Active),
     ("log_syntax", Active),
     ("trace_macros", Active),
+    ("concat_idents", Active),
+
     ("simd", Active),
     ("default_type_params", Active),
     ("quote", Active),
@@ -74,7 +76,7 @@ enum Status {
 
 /// A set of features to be used by later passes.
 pub struct Features {
-    default_type_params: Cell<bool>
+    pub default_type_params: Cell<bool>
 }
 
 impl Features {
@@ -229,6 +231,11 @@ impl<'a> Visitor<()> for Context<'a> {
                 stable enough for use and is subject to change");
         }
 
+        else if id == token::str_to_ident("concat_idents") {
+            self.gate_feature("concat_idents", path.span, "`concat_idents` is not \
+                stable enough for use and is subject to change");
+        }
+
         else {
             for &quote in quotes.iter() {
                 if id == token::str_to_ident(quote) {
diff --git a/src/librustc/front/std_inject.rs b/src/librustc/front/std_inject.rs
index 9a0c06c0955..895abe17470 100644
--- a/src/librustc/front/std_inject.rs
+++ b/src/librustc/front/std_inject.rs
@@ -11,7 +11,6 @@
 
 use driver::session::Session;
 
-use std::vec;
 use syntax::ast;
 use syntax::attr;
 use syntax::codemap::DUMMY_SP;
@@ -23,7 +22,7 @@ use syntax::parse::token::InternedString;
 use syntax::parse::token;
 use syntax::util::small_vector::SmallVector;
 
-pub static VERSION: &'static str = "0.10-pre";
+pub static VERSION: &'static str = "0.11-pre";
 
 pub fn maybe_inject_crates_ref(sess: &Session, krate: ast::Crate)
                                -> ast::Crate {
@@ -173,7 +172,7 @@ impl<'a> fold::Folder for PreludeInjector<'a> {
             span: DUMMY_SP,
         };
 
-        let vis = vec::append(vec!(vi2), module.view_items.as_slice());
+        let vis = (vec!(vi2)).append(module.view_items.as_slice());
 
         // FIXME #2543: Bad copy.
         let new_module = ast::Mod {
diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs
index cb6b5eefade..86d2e039505 100644
--- a/src/librustc/front/test.rs
+++ b/src/librustc/front/test.rs
@@ -10,8 +10,8 @@
 
 // Code that generates a test runner to run all the tests in a crate
 
-#[allow(dead_code)];
-#[allow(unused_imports)];
+#![allow(dead_code)]
+#![allow(unused_imports)]
 
 use driver::session::Session;
 use front::config;
@@ -90,7 +90,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
     fn fold_item(&mut self, i: @ast::Item) -> SmallVector<@ast::Item> {
         self.cx.path.borrow_mut().push(i.ident);
         debug!("current path: {}",
-               ast_util::path_name_i(self.cx.path.get().as_slice()));
+               ast_util::path_name_i(self.cx.path.borrow().as_slice()));
 
         if is_test_fn(&self.cx, i) || is_bench_fn(&self.cx, i) {
             match i.node {
@@ -104,7 +104,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
                     debug!("this is a test function");
                     let test = Test {
                         span: i.span,
-                        path: self.cx.path.get(),
+                        path: self.cx.path.borrow().clone(),
                         bench: is_bench_fn(&self.cx, i),
                         ignore: is_ignored(&self.cx, i),
                         should_fail: should_fail(i)
@@ -272,7 +272,7 @@ fn should_fail(i: @ast::Item) -> bool {
 fn add_test_module(cx: &TestCtxt, m: &ast::Mod) -> ast::Mod {
     let testmod = mk_test_module(cx);
     ast::Mod {
-        items: vec::append_one(m.items.clone(), testmod),
+        items: m.items.clone().append_one(testmod),
         ..(*m).clone()
     }
 }
@@ -282,7 +282,7 @@ fn add_test_module(cx: &TestCtxt, m: &ast::Mod) -> ast::Mod {
 We're going to be building a module that looks more or less like:
 
 mod __test {
-  #[!resolve_unexported]
+  #![!resolve_unexported]
   extern crate test (name = "test", vers = "...");
   fn main() {
     test::test_main_static(::os::args(), tests)
@@ -326,8 +326,8 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::Item {
     // with our list of tests
     let mainfn = (quote_item!(&cx.ext_cx,
         pub fn main() {
-            #[allow(deprecated_owned_vector)];
-            #[main];
+            #![main]
+            #![allow(deprecated_owned_vector)]
             test::test_main_static(::std::os::args(), TESTS);
         }
     )).unwrap();
@@ -404,21 +404,17 @@ fn is_test_crate(krate: &ast::Crate) -> bool {
 }
 
 fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr {
-    let mut descs = Vec::new();
     debug!("building test vector from {} tests", cx.testfns.borrow().len());
-    for test in cx.testfns.borrow().iter() {
-        descs.push(mk_test_desc_and_fn_rec(cx, test));
-    }
-
-    let inner_expr = @ast::Expr {
-        id: ast::DUMMY_NODE_ID,
-        node: ast::ExprVec(descs, ast::MutImmutable),
-        span: DUMMY_SP,
-    };
 
     @ast::Expr {
         id: ast::DUMMY_NODE_ID,
-        node: ast::ExprVstore(inner_expr, ast::ExprVstoreSlice),
+        node: ast::ExprVstore(@ast::Expr {
+            id: ast::DUMMY_NODE_ID,
+            node: ast::ExprVec(cx.testfns.borrow().iter().map(|test| {
+                mk_test_desc_and_fn_rec(cx, test)
+            }).collect()),
+            span: DUMMY_SP,
+        }, ast::ExprVstoreSlice),
         span: DUMMY_SP,
     }
 }
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index 6aff1530104..893cc019ca7 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -18,18 +18,18 @@ This API is completely unstable and subject to change.
 
 */
 
-#[crate_id = "rustc#0.10-pre"];
-#[comment = "The Rust compiler"];
-#[license = "MIT/ASL2"];
-#[crate_type = "dylib"];
-#[crate_type = "rlib"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+#![crate_id = "rustc#0.11-pre"]
+#![comment = "The Rust compiler"]
+#![license = "MIT/ASL2"]
+#![crate_type = "dylib"]
+#![crate_type = "rlib"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
+      html_root_url = "http://static.rust-lang.org/doc/master")]
 
-#[allow(deprecated)];
-#[feature(macro_rules, globs, struct_variant, managed_boxes, quote,
-          default_type_params, phase)];
+#![allow(deprecated)]
+#![feature(macro_rules, globs, struct_variant, managed_boxes, quote,
+           default_type_params, phase)]
 
 extern crate flate;
 extern crate arena;
@@ -54,7 +54,6 @@ use std::io;
 use std::os;
 use std::str;
 use std::task;
-use std::vec;
 use syntax::ast;
 use syntax::diagnostic::Emitter;
 use syntax::diagnostic;
@@ -239,9 +238,7 @@ pub fn run_compiler(args: &[~str]) {
         return;
     }
 
-    let lint_flags = vec::append(matches.opt_strs("W")
-                                           .move_iter()
-                                           .collect(),
+    let lint_flags = matches.opt_strs("W").move_iter().collect::<Vec<_>>().append(
                                     matches.opt_strs("warn").as_slice());
     if lint_flags.iter().any(|x| x == &~"help") {
         describe_warnings();
@@ -365,7 +362,7 @@ fn parse_crate_attrs(sess: &session::Session, input: &d::Input) ->
 ///
 /// The diagnostic emitter yielded to the procedure should be used for reporting
 /// errors of the compiler.
-pub fn monitor(f: proc()) {
+pub fn monitor(f: proc:Send()) {
     // FIXME: This is a hack for newsched since it doesn't support split stacks.
     // rustc needs a lot of stack! When optimizations are disabled, it needs
     // even *more* stack than usual as well.
@@ -387,7 +384,7 @@ pub fn monitor(f: proc()) {
     let mut r = io::ChanReader::new(rx);
 
     match task_builder.try(proc() {
-        io::stdio::set_stderr(~w as ~io::Writer);
+        io::stdio::set_stderr(~w);
         f()
     }) {
         Ok(()) => { /* fallthrough */ }
@@ -425,7 +422,7 @@ pub fn monitor(f: proc()) {
             // Fail so the process returns a failure code, but don't pollute the
             // output with some unnecessary failure messages, we've already
             // printed everything that we needed to.
-            io::stdio::set_stderr(~io::util::NullWriter as ~io::Writer);
+            io::stdio::set_stderr(~io::util::NullWriter);
             fail!();
         }
     }
diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs
index 36ebb3d5139..9cfe064ad98 100644
--- a/src/librustc/lib/llvm.rs
+++ b/src/librustc/lib/llvm.rs
@@ -8,8 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_uppercase_pattern_statics)];
-#[allow(non_camel_case_types)];
+#![allow(non_uppercase_pattern_statics)]
+#![allow(non_camel_case_types)]
+#![allow(dead_code)]
 
 use std::c_str::ToCStr;
 use std::cell::RefCell;
@@ -277,6 +278,7 @@ pub mod debuginfo {
     pub type DIDerivedType = DIType;
     pub type DICompositeType = DIDerivedType;
     pub type DIVariable = DIDescriptor;
+    pub type DIGlobalVariable = DIDescriptor;
     pub type DIArray = DIDescriptor;
     pub type DISubrange = DIDescriptor;
 
@@ -1436,8 +1438,6 @@ pub mod llvm {
                                           -> Bool;
         /** Moves the section iterator to point to the next section. */
         pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
-        /** Returns the current section name. */
-        pub fn LLVMGetSectionName(SI: SectionIteratorRef) -> *c_char;
         /** Returns the current section size. */
         pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
         /** Returns the current section contents as a string buffer. */
@@ -1589,6 +1589,18 @@ pub mod llvm {
                                                Col: c_uint)
                                                -> DILexicalBlock;
 
+        pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
+                                                 Context: DIDescriptor,
+                                                 Name: *c_char,
+                                                 LinkageName: *c_char,
+                                                 File: DIFile,
+                                                 LineNo: c_uint,
+                                                 Ty: DIType,
+                                                 isLocalToUnit: bool,
+                                                 Val: ValueRef,
+                                                 Decl: ValueRef)
+                                                 -> DIGlobalVariable;
+
         pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef,
                                                 Tag: c_uint,
                                                 Scope: DIDescriptor,
@@ -1770,6 +1782,9 @@ pub mod llvm {
 
         pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
         pub fn LLVMVersionMinor() -> c_int;
+
+        pub fn LLVMRustGetSectionName(SI: SectionIteratorRef,
+                                      data: *mut *c_char) -> c_int;
     }
 }
 
@@ -1848,7 +1863,7 @@ impl TypeNames {
     }
 
     pub fn types_to_str(&self, tys: &[Type]) -> ~str {
-        let strs = tys.map(|t| self.type_to_str(*t));
+        let strs: Vec<~str> = tys.iter().map(|t| self.type_to_str(*t)).collect();
         format!("[{}]", strs.connect(","))
     }
 
@@ -1865,7 +1880,7 @@ impl TypeNames {
 /* Memory-managed interface to target data. */
 
 pub struct target_data_res {
-    td: TargetDataRef,
+    pub td: TargetDataRef,
 }
 
 impl Drop for target_data_res {
@@ -1883,7 +1898,7 @@ pub fn target_data_res(td: TargetDataRef) -> target_data_res {
 }
 
 pub struct TargetData {
-    lltd: TargetDataRef,
+    pub lltd: TargetDataRef,
     dtor: @target_data_res
 }
 
@@ -1898,46 +1913,10 @@ pub fn mk_target_data(string_rep: &str) -> TargetData {
     }
 }
 
-/* Memory-managed interface to pass managers. */
-
-pub struct pass_manager_res {
-    pm: PassManagerRef,
-}
-
-impl Drop for pass_manager_res {
-    fn drop(&mut self) {
-        unsafe {
-            llvm::LLVMDisposePassManager(self.pm);
-        }
-    }
-}
-
-pub fn pass_manager_res(pm: PassManagerRef) -> pass_manager_res {
-    pass_manager_res {
-        pm: pm
-    }
-}
-
-pub struct PassManager {
-    llpm: PassManagerRef,
-    dtor: @pass_manager_res
-}
-
-pub fn mk_pass_manager() -> PassManager {
-    unsafe {
-        let llpm = llvm::LLVMCreatePassManager();
-
-        PassManager {
-            llpm: llpm,
-            dtor: @pass_manager_res(llpm)
-        }
-    }
-}
-
 /* Memory-managed interface to object files. */
 
 pub struct ObjectFile {
-    llof: ObjectFileRef,
+    pub llof: ObjectFileRef,
 }
 
 impl ObjectFile {
@@ -1968,7 +1947,7 @@ impl Drop for ObjectFile {
 /* Memory-managed interface to section iterators. */
 
 pub struct section_iter_res {
-    si: SectionIteratorRef,
+    pub si: SectionIteratorRef,
 }
 
 impl Drop for section_iter_res {
@@ -1986,7 +1965,7 @@ pub fn section_iter_res(si: SectionIteratorRef) -> section_iter_res {
 }
 
 pub struct SectionIter {
-    llsi: SectionIteratorRef,
+    pub llsi: SectionIteratorRef,
     dtor: @section_iter_res
 }
 
diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs
index 7b7d526411c..264829b18a3 100644
--- a/src/librustc/metadata/common.rs
+++ b/src/librustc/metadata/common.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use std::cast;
 use syntax::crateid::CrateId;
@@ -73,8 +73,6 @@ pub static tag_crate_dep: uint = 0x19;
 pub static tag_crate_hash: uint = 0x1a;
 pub static tag_crate_crateid: uint = 0x1b;
 
-pub static tag_parent_item: uint = 0x1c;
-
 pub static tag_crate_dep_crateid: uint = 0x1d;
 pub static tag_crate_dep_hash: uint = 0x1e;
 
@@ -94,10 +92,8 @@ pub static tag_path_len: uint = 0x25;
 pub static tag_path_elem_mod: uint = 0x26;
 pub static tag_path_elem_name: uint = 0x27;
 pub static tag_item_field: uint = 0x28;
-pub static tag_struct_mut: uint = 0x29;
 
 pub static tag_item_variances: uint = 0x2a;
-pub static tag_mod_impl_trait: uint = 0x2b;
 /*
   trait items contain tag_item_trait_method elements,
   impl items contain tag_item_impl_method elements, and classes
@@ -108,7 +104,6 @@ pub static tag_mod_impl_trait: uint = 0x2b;
  */
 pub static tag_item_impl_method: uint = 0x2c;
 pub static tag_item_trait_method_explicit_self: uint = 0x2d;
-pub static tag_item_trait_method_self_ty_region: uint = 0x2e;
 
 
 // Reexports are found within module tags. Each reexport contains def_ids
@@ -173,12 +168,8 @@ pub static tag_lang_items_item_id: uint = 0x4a;
 pub static tag_lang_items_item_node_id: uint = 0x4b;
 
 pub static tag_item_unnamed_field: uint = 0x4c;
-pub static tag_items_data_item_struct_ctor: uint = 0x4d;
 pub static tag_items_data_item_visibility: uint = 0x4e;
 
-pub static tag_link_args: uint = 0x4f;
-pub static tag_link_args_arg: uint = 0x50;
-
 pub static tag_item_method_tps: uint = 0x51;
 pub static tag_item_method_fty: uint = 0x52;
 
@@ -210,6 +201,6 @@ pub static tag_macro_def: uint = 0x65;
 
 #[deriving(Clone, Show)]
 pub struct LinkMeta {
-    crateid: CrateId,
-    crate_hash: Svh,
+    pub crateid: CrateId,
+    pub crate_hash: Svh,
 }
diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs
index 958c6373a8c..8ce4a2f8eed 100644
--- a/src/librustc/metadata/creader.rs
+++ b/src/librustc/metadata/creader.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 //! Validates all used crates and extern libraries and loads their metadata
 
@@ -21,8 +21,10 @@ use metadata::cstore;
 use metadata::decoder;
 use metadata::loader;
 use metadata::loader::Os;
+use metadata::loader::CratePaths;
 
 use std::cell::RefCell;
+use std::rc::Rc;
 use collections::HashMap;
 use syntax::ast;
 use syntax::abi;
@@ -41,7 +43,7 @@ use syntax::visit;
 pub fn read_crates(sess: &Session,
                    krate: &ast::Crate,
                    os: loader::Os,
-                   intr: @IdentInterner) {
+                   intr: Rc<IdentInterner>) {
     let mut e = Env {
         sess: sess,
         os: os,
@@ -114,7 +116,7 @@ struct Env<'a> {
     os: loader::Os,
     crate_cache: @RefCell<Vec<cache_entry>>,
     next_crate_num: ast::CrateNum,
-    intr: @IdentInterner
+    intr: Rc<IdentInterner>
 }
 
 fn visit_crate(e: &Env, c: &ast::Crate) {
@@ -140,7 +142,7 @@ fn visit_view_item(e: &mut Env, i: &ast::ViewItem) {
 
     match extract_crate_info(e, i) {
         Some(info) => {
-            let cnum = resolve_crate(e, None, info.ident, &info.crate_id, None,
+            let cnum = resolve_crate(e, &None, info.ident, &info.crate_id, None,
                                      i.span);
             e.sess.cstore.add_extern_mod_stmt_cnum(info.id, cnum);
         }
@@ -186,7 +188,7 @@ fn extract_crate_info(e: &Env, i: &ast::ViewItem) -> Option<CrateInfo> {
 fn visit_item(e: &Env, i: &ast::Item) {
     match i.node {
         ast::ItemForeignMod(ref fm) => {
-            if fm.abis.is_rust() || fm.abis.is_intrinsic() {
+            if fm.abi == abi::Rust || fm.abi == abi::RustIntrinsic {
                 return;
             }
 
@@ -277,13 +279,13 @@ fn existing_match(e: &Env, crate_id: &CrateId,
     None
 }
 
-fn resolve_crate(e: &mut Env,
-                 root_ident: Option<&str>,
-                 ident: &str,
-                 crate_id: &CrateId,
-                 hash: Option<&Svh>,
-                 span: Span)
-              -> ast::CrateNum {
+fn resolve_crate<'a>(e: &mut Env,
+                     root: &Option<CratePaths>,
+                     ident: &str,
+                     crate_id: &CrateId,
+                     hash: Option<&Svh>,
+                     span: Span)
+                     -> ast::CrateNum {
     match existing_match(e, crate_id, hash) {
         None => {
             let id_hash = link::crate_id_hash(crate_id);
@@ -295,12 +297,12 @@ fn resolve_crate(e: &mut Env,
                 id_hash: id_hash,
                 hash: hash.map(|a| &*a),
                 os: e.os,
-                intr: e.intr,
-                rejected_via_hash: false,
+                intr: e.intr.clone(),
+                rejected_via_hash: vec!(),
             };
             let loader::Library {
                 dylib, rlib, metadata
-            } = load_ctxt.load_library_crate(root_ident);
+            } = load_ctxt.load_library_crate(root);
 
             let crate_id = decoder::get_crate_id(metadata.as_slice());
             let hash = decoder::get_crate_hash(metadata.as_slice());
@@ -315,15 +317,22 @@ fn resolve_crate(e: &mut Env,
             });
             e.next_crate_num += 1;
 
-            // Maintain a reference to the top most crate.
-            let root_crate = match root_ident {
-                Some(c) => c,
-                None => load_ctxt.ident.clone()
+            // Stash paths for top-most crate locally if necessary.
+            let crate_paths = if root.is_none() {
+                Some(CratePaths {
+                    ident: load_ctxt.ident.to_owned(),
+                    dylib: dylib.clone(),
+                    rlib:  rlib.clone(),
+                })
+            } else {
+                None
             };
+            // Maintain a reference to the top most crate.
+            let root = if root.is_some() { root } else { &crate_paths };
 
             // Now resolve the crates referenced by this crate
             let cnum_map = resolve_crate_deps(e,
-            Some(root_crate),
+            root,
             metadata.as_slice(),
             span);
 
@@ -348,7 +357,7 @@ fn resolve_crate(e: &mut Env,
 
 // Go through the crate metadata and load any crates that it references
 fn resolve_crate_deps(e: &mut Env,
-                      root_ident: Option<&str>,
+                      root: &Option<CratePaths>,
                       cdata: &[u8], span : Span)
                    -> cstore::cnum_map {
     debug!("resolving deps of external crate");
@@ -359,7 +368,7 @@ fn resolve_crate_deps(e: &mut Env,
     for dep in r.iter() {
         let extrn_cnum = dep.cnum;
         debug!("resolving dep crate {} hash: `{}`", dep.crate_id, dep.hash);
-        let local_cnum = resolve_crate(e, root_ident,
+        let local_cnum = resolve_crate(e, root,
                                        dep.crate_id.name.as_slice(),
                                        &dep.crate_id,
                                        Some(&dep.hash),
@@ -370,7 +379,7 @@ fn resolve_crate_deps(e: &mut Env,
 }
 
 pub struct Loader<'a> {
-    priv env: Env<'a>,
+    env: Env<'a>,
 }
 
 impl<'a> Loader<'a> {
@@ -392,7 +401,7 @@ impl<'a> Loader<'a> {
 impl<'a> CrateLoader for Loader<'a> {
     fn load_crate(&mut self, krate: &ast::ViewItem) -> MacroCrate {
         let info = extract_crate_info(&self.env, krate).unwrap();
-        let cnum = resolve_crate(&mut self.env, None, info.ident,
+        let cnum = resolve_crate(&mut self.env, &None, info.ident,
                                  &info.crate_id, None, krate.span);
         let library = self.env.sess.cstore.get_used_crate_source(cnum).unwrap();
         MacroCrate {
diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs
index 47202feef9a..977db296af9 100644
--- a/src/librustc/metadata/csearch.rs
+++ b/src/librustc/metadata/csearch.rs
@@ -10,7 +10,7 @@
 
 // Searching for information from the cstore
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use metadata::common::*;
 use metadata::cstore;
@@ -20,17 +20,16 @@ use middle::typeck;
 
 use reader = serialize::ebml::reader;
 use std::rc::Rc;
-use std::vec;
 use syntax::ast;
 use syntax::ast_map;
 use syntax::diagnostic::expect;
 use syntax::parse::token;
 
 pub struct StaticMethodInfo {
-    ident: ast::Ident,
-    def_id: ast::DefId,
-    purity: ast::Purity,
-    vis: ast::Visibility,
+    pub ident: ast::Ident,
+    pub def_id: ast::DefId,
+    pub purity: ast::Purity,
+    pub vis: ast::Visibility,
 }
 
 pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> ~str {
@@ -38,12 +37,6 @@ pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> ~str {
     return decoder::get_symbol(cdata, def.node);
 }
 
-pub fn get_type_param_count(cstore: &cstore::CStore, def: ast::DefId)
-                         -> uint {
-    let cdata = cstore.get_crate_data(def.krate).data();
-    return decoder::get_type_param_count(cdata, def.node);
-}
-
 /// Iterates over all the language items in the given crate.
 pub fn each_lang_item(cstore: &cstore::CStore,
                       cnum: ast::CrateNum,
@@ -63,7 +56,7 @@ pub fn each_child_of_item(cstore: &cstore::CStore,
     let get_crate_data: decoder::GetCrateDataCb = |cnum| {
         cstore.get_crate_data(cnum)
     };
-    decoder::each_child_of_item(cstore.intr,
+    decoder::each_child_of_item(cstore.intr.clone(),
                                 crate_data,
                                 def_id.node,
                                 get_crate_data,
@@ -80,7 +73,7 @@ pub fn each_top_level_item_of_crate(cstore: &cstore::CStore,
     let get_crate_data: decoder::GetCrateDataCb = |cnum| {
         cstore.get_crate_data(cnum)
     };
-    decoder::each_top_level_item_of_crate(cstore.intr,
+    decoder::each_top_level_item_of_crate(cstore.intr.clone(),
                                           crate_data,
                                           get_crate_data,
                                           callback)
@@ -93,8 +86,7 @@ pub fn get_item_path(tcx: &ty::ctxt, def: ast::DefId) -> Vec<ast_map::PathElem>
 
     // FIXME #1920: This path is not always correct if the crate is not linked
     // into the root namespace.
-    vec::append(vec!(ast_map::PathMod(token::intern(cdata.name))),
-                   path.as_slice())
+    (vec!(ast_map::PathMod(token::intern(cdata.name)))).append(path.as_slice())
 }
 
 pub enum found_ast {
@@ -118,19 +110,19 @@ pub fn get_enum_variants(tcx: &ty::ctxt, def: ast::DefId)
                       -> Vec<@ty::VariantInfo> {
     let cstore = &tcx.sess.cstore;
     let cdata = cstore.get_crate_data(def.krate);
-    return decoder::get_enum_variants(cstore.intr, cdata, def.node, tcx)
+    return decoder::get_enum_variants(cstore.intr.clone(), cdata, def.node, tcx)
 }
 
 /// Returns information about the given implementation.
 pub fn get_impl(tcx: &ty::ctxt, impl_def_id: ast::DefId)
                 -> ty::Impl {
     let cdata = tcx.sess.cstore.get_crate_data(impl_def_id.krate);
-    decoder::get_impl(tcx.sess.cstore.intr, cdata, impl_def_id.node, tcx)
+    decoder::get_impl(tcx.sess.cstore.intr.clone(), cdata, impl_def_id.node, tcx)
 }
 
 pub fn get_method(tcx: &ty::ctxt, def: ast::DefId) -> ty::Method {
     let cdata = tcx.sess.cstore.get_crate_data(def.krate);
-    decoder::get_method(tcx.sess.cstore.intr, cdata, def.node, tcx)
+    decoder::get_method(tcx.sess.cstore.intr.clone(), cdata, def.node, tcx)
 }
 
 pub fn get_method_name_and_explicit_self(cstore: &cstore::CStore,
@@ -138,7 +130,7 @@ pub fn get_method_name_and_explicit_self(cstore: &cstore::CStore,
                                      -> (ast::Ident, ast::ExplicitSelf_)
 {
     let cdata = cstore.get_crate_data(def.krate);
-    decoder::get_method_name_and_explicit_self(cstore.intr, cdata, def.node)
+    decoder::get_method_name_and_explicit_self(cstore.intr.clone(), cdata, def.node)
 }
 
 pub fn get_trait_method_def_ids(cstore: &cstore::CStore,
@@ -158,7 +150,7 @@ pub fn get_provided_trait_methods(tcx: &ty::ctxt,
                                -> Vec<@ty::Method> {
     let cstore = &tcx.sess.cstore;
     let cdata = cstore.get_crate_data(def.krate);
-    decoder::get_provided_trait_methods(cstore.intr, cdata, def.node, tcx)
+    decoder::get_provided_trait_methods(cstore.intr.clone(), cdata, def.node, tcx)
 }
 
 pub fn get_supertraits(tcx: &ty::ctxt, def: ast::DefId) -> Vec<@ty::TraitRef> {
@@ -177,7 +169,7 @@ pub fn get_static_methods_if_impl(cstore: &cstore::CStore,
                                   def: ast::DefId)
                                -> Option<Vec<StaticMethodInfo> > {
     let cdata = cstore.get_crate_data(def.krate);
-    decoder::get_static_methods_if_impl(cstore.intr, cdata, def.node)
+    decoder::get_static_methods_if_impl(cstore.intr.clone(), cdata, def.node)
 }
 
 pub fn get_item_attrs(cstore: &cstore::CStore,
@@ -191,7 +183,7 @@ pub fn get_struct_fields(cstore: &cstore::CStore,
                          def: ast::DefId)
                       -> Vec<ty::field_ty> {
     let cdata = cstore.get_crate_data(def.krate);
-    decoder::get_struct_fields(cstore.intr, cdata, def.node)
+    decoder::get_struct_fields(cstore.intr.clone(), cdata, def.node)
 }
 
 pub fn get_type(tcx: &ty::ctxt,
@@ -246,21 +238,6 @@ pub fn get_impl_vtables(tcx: &ty::ctxt,
     decoder::get_impl_vtables(cdata, def.node, tcx)
 }
 
-pub fn get_impl_method(cstore: &cstore::CStore,
-                       def: ast::DefId,
-                       mname: ast::Ident)
-                    -> Option<ast::DefId> {
-    let cdata = cstore.get_crate_data(def.krate);
-    decoder::get_impl_method(cstore.intr, cdata, def.node, mname)
-}
-
-pub fn get_item_visibility(cstore: &cstore::CStore,
-                           def_id: ast::DefId)
-                        -> ast::Visibility {
-    let cdata = cstore.get_crate_data(def_id.krate);
-    decoder::get_item_visibility(cdata, def_id.node)
-}
-
 pub fn get_native_libraries(cstore: &cstore::CStore,
                             crate_num: ast::CrateNum)
                                 -> Vec<(cstore::NativeLibaryKind, ~str)> {
@@ -313,3 +290,11 @@ pub fn get_exported_macros(cstore: &cstore::CStore,
     let cdata = cstore.get_crate_data(crate_num);
     decoder::get_exported_macros(cdata)
 }
+
+pub fn get_tuple_struct_definition_if_ctor(cstore: &cstore::CStore,
+                                           def_id: ast::DefId)
+    -> Option<ast::DefId>
+{
+    let cdata = cstore.get_crate_data(def_id.krate);
+    decoder::get_tuple_struct_definition_if_ctor(cdata, def_id.node)
+}
diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs
index 02c092ca508..e3a3239bdb5 100644
--- a/src/librustc/metadata/cstore.rs
+++ b/src/librustc/metadata/cstore.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 // The crate store - a central repo for information collected about external
 // crates and libraries
@@ -19,10 +19,10 @@ use metadata::loader;
 
 use std::cell::RefCell;
 use std::c_vec::CVec;
+use std::rc::Rc;
 use collections::HashMap;
 use syntax::ast;
 use syntax::parse::token::IdentInterner;
-use syntax::crateid::CrateId;
 
 // A map from external crate numbers (as decoded from some crate file) to
 // local crate numbers (as generated during this session). Each external
@@ -36,10 +36,10 @@ pub enum MetadataBlob {
 }
 
 pub struct crate_metadata {
-    name: ~str,
-    data: MetadataBlob,
-    cnum_map: cnum_map,
-    cnum: ast::CrateNum
+    pub name: ~str,
+    pub data: MetadataBlob,
+    pub cnum_map: cnum_map,
+    pub cnum: ast::CrateNum,
 }
 
 #[deriving(Eq)]
@@ -59,25 +59,25 @@ pub enum NativeLibaryKind {
 // must be non-None.
 #[deriving(Eq, Clone)]
 pub struct CrateSource {
-    dylib: Option<Path>,
-    rlib: Option<Path>,
-    cnum: ast::CrateNum,
+    pub dylib: Option<Path>,
+    pub rlib: Option<Path>,
+    pub cnum: ast::CrateNum,
 }
 
 pub struct CStore {
-    priv metas: RefCell<HashMap<ast::CrateNum, @crate_metadata>>,
-    priv extern_mod_crate_map: RefCell<extern_mod_crate_map>,
-    priv used_crate_sources: RefCell<Vec<CrateSource> >,
-    priv used_libraries: RefCell<Vec<(~str, NativeLibaryKind)> >,
-    priv used_link_args: RefCell<Vec<~str> >,
-    intr: @IdentInterner
+    metas: RefCell<HashMap<ast::CrateNum, @crate_metadata>>,
+    extern_mod_crate_map: RefCell<extern_mod_crate_map>,
+    used_crate_sources: RefCell<Vec<CrateSource>>,
+    used_libraries: RefCell<Vec<(~str, NativeLibaryKind)>>,
+    used_link_args: RefCell<Vec<~str>>,
+    pub intr: Rc<IdentInterner>,
 }
 
 // Map from NodeId's of local extern crate statements to crate numbers
 type extern_mod_crate_map = HashMap<ast::NodeId, ast::CrateNum>;
 
 impl CStore {
-    pub fn new(intr: @IdentInterner) -> CStore {
+    pub fn new(intr: Rc<IdentInterner>) -> CStore {
         CStore {
             metas: RefCell::new(HashMap::new()),
             extern_mod_crate_map: RefCell::new(HashMap::new()),
@@ -97,19 +97,10 @@ impl CStore {
         decoder::get_crate_hash(cdata.data())
     }
 
-    pub fn get_crate_id(&self, cnum: ast::CrateNum) -> CrateId {
-        let cdata = self.get_crate_data(cnum);
-        decoder::get_crate_id(cdata.data())
-    }
-
     pub fn set_crate_data(&self, cnum: ast::CrateNum, data: @crate_metadata) {
         self.metas.borrow_mut().insert(cnum, data);
     }
 
-    pub fn have_crate_data(&self, cnum: ast::CrateNum) -> bool {
-        self.metas.borrow().contains_key(&cnum)
-    }
-
     pub fn iter_crate_data(&self, i: |ast::CrateNum, @crate_metadata|) {
         for (&k, &v) in self.metas.borrow().iter() {
             i(k, v);
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs
index 3387c47842a..556f0a38b03 100644
--- a/src/librustc/metadata/decoder.rs
+++ b/src/librustc/metadata/decoder.rs
@@ -10,7 +10,7 @@
 
 // Decoding metadata from a single crate's metadata
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use back::svh::Svh;
 use metadata::cstore::crate_metadata;
@@ -59,7 +59,7 @@ fn lookup_hash<'a>(d: ebml::Doc<'a>, eq_fn: |&[u8]| -> bool,
     let table = reader::get_doc(index, tag_index_table);
     let hash_pos = table.start + (hash % 256 * 4) as uint;
     let pos = u64_from_be_bytes(d.data, hash_pos, 4) as uint;
-    let tagged_doc = reader::doc_at(d.data, pos);
+    let tagged_doc = reader::doc_at(d.data, pos).unwrap();
 
     let belt = tag_index_buckets_bucket_elt;
 
@@ -67,7 +67,7 @@ fn lookup_hash<'a>(d: ebml::Doc<'a>, eq_fn: |&[u8]| -> bool,
     reader::tagged_docs(tagged_doc.doc, belt, |elt| {
         let pos = u64_from_be_bytes(elt.data, elt.start, 4) as uint;
         if eq_fn(elt.data.slice(elt.start + 4, elt.end)) {
-            ret = Some(reader::doc_at(d.data, pos).doc);
+            ret = Some(reader::doc_at(d.data, pos).unwrap().doc);
             false
         } else {
             true
@@ -267,7 +267,7 @@ fn item_region_param_defs(item_doc: ebml::Doc, cdata: Cmd)
     reader::tagged_docs(item_doc, tag_region_param_def, |rp_doc| {
             let ident_str_doc = reader::get_doc(rp_doc,
                                                 tag_region_param_def_ident);
-            let ident = item_name(token::get_ident_interner(), ident_str_doc);
+            let ident = item_name(&*token::get_ident_interner(), ident_str_doc);
             let def_id_doc = reader::get_doc(rp_doc,
                                              tag_region_param_def_def_id);
             let def_id = reader::with_doc_data(def_id_doc, parse_def_id);
@@ -279,13 +279,6 @@ fn item_region_param_defs(item_doc: ebml::Doc, cdata: Cmd)
     Rc::new(v)
 }
 
-fn item_ty_param_count(item: ebml::Doc) -> uint {
-    let mut n = 0u;
-    reader::tagged_docs(item, tag_items_data_item_ty_param_bounds,
-                      |_p| { n += 1u; true } );
-    n
-}
-
 fn enum_variant_ids(item: ebml::Doc, cdata: Cmd) -> Vec<ast::DefId> {
     let mut ids: Vec<ast::DefId> = Vec::new();
     let v = tag_items_data_item_variant;
@@ -420,10 +413,6 @@ pub fn get_type(cdata: Cmd, id: ast::NodeId, tcx: &ty::ctxt)
     }
 }
 
-pub fn get_type_param_count(data: &[u8], id: ast::NodeId) -> uint {
-    item_ty_param_count(lookup_item(id, data))
-}
-
 pub fn get_impl_trait(cdata: Cmd,
                       id: ast::NodeId,
                       tcx: &ty::ctxt) -> Option<@ty::TraitRef>
@@ -449,20 +438,6 @@ pub fn get_impl_vtables(cdata: Cmd,
 }
 
 
-pub fn get_impl_method(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
-                       name: ast::Ident) -> Option<ast::DefId> {
-    let items = reader::get_doc(reader::Doc(cdata.data()), tag_items);
-    let mut found = None;
-    reader::tagged_docs(find_item(id, items), tag_item_impl_method, |mid| {
-        let m_did = reader::with_doc_data(mid, parse_def_id);
-        if item_name(intr, find_item(m_did.node, items)) == name {
-            found = Some(translate_def_id(cdata, m_did));
-        }
-        true
-    });
-    found
-}
-
 pub fn get_symbol(data: &[u8], id: ast::NodeId) -> ~str {
     return item_symbol(lookup_item(id, data));
 }
@@ -475,14 +450,6 @@ pub enum DefLike {
     DlField
 }
 
-pub fn def_like_to_def(def_like: DefLike) -> ast::Def {
-    match def_like {
-        DlDef(def) => return def,
-        DlImpl(..) => fail!("found impl in def_like_to_def"),
-        DlField => fail!("found field in def_like_to_def")
-    }
-}
-
 /// Iterates over the language items in the given crate.
 pub fn each_lang_item(cdata: Cmd, f: |ast::NodeId, uint| -> bool) -> bool {
     let root = reader::Doc(cdata.data());
@@ -498,7 +465,7 @@ pub fn each_lang_item(cdata: Cmd, f: |ast::NodeId, uint| -> bool) -> bool {
     })
 }
 
-fn each_child_of_item_or_crate(intr: @IdentInterner,
+fn each_child_of_item_or_crate(intr: Rc<IdentInterner>,
                                cdata: Cmd,
                                item_doc: ebml::Doc,
                                get_crate_data: GetCrateDataCb,
@@ -525,7 +492,7 @@ fn each_child_of_item_or_crate(intr: @IdentInterner,
             None => {}
             Some(child_item_doc) => {
                 // Hand off the item to the callback.
-                let child_name = item_name(intr, child_item_doc);
+                let child_name = item_name(&*intr, child_item_doc);
                 let def_like = item_to_def_like(child_item_doc,
                                                 child_def_id,
                                                 cdata.cnum);
@@ -566,7 +533,7 @@ fn each_child_of_item_or_crate(intr: @IdentInterner,
                                     // Hand off the static method
                                     // to the callback.
                                     let static_method_name =
-                                        item_name(intr, impl_method_doc);
+                                        item_name(&*intr, impl_method_doc);
                                     let static_method_def_like =
                                         item_to_def_like(impl_method_doc,
                                                          impl_method_def_id,
@@ -627,7 +594,7 @@ fn each_child_of_item_or_crate(intr: @IdentInterner,
 }
 
 /// Iterates over each child of the given item.
-pub fn each_child_of_item(intr: @IdentInterner,
+pub fn each_child_of_item(intr: Rc<IdentInterner>,
                           cdata: Cmd,
                           id: ast::NodeId,
                           get_crate_data: GetCrateDataCb,
@@ -648,7 +615,7 @@ pub fn each_child_of_item(intr: @IdentInterner,
 }
 
 /// Iterates over all the top-level crate items.
-pub fn each_top_level_item_of_crate(intr: @IdentInterner,
+pub fn each_top_level_item_of_crate(intr: Rc<IdentInterner>,
                                     cdata: Cmd,
                                     get_crate_data: GetCrateDataCb,
                                     callback: |DefLike,
@@ -700,7 +667,7 @@ pub fn maybe_get_item_ast(cdata: Cmd, tcx: &ty::ctxt, id: ast::NodeId,
     }
 }
 
-pub fn get_enum_variants(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
+pub fn get_enum_variants(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId,
                      tcx: &ty::ctxt) -> Vec<@ty::VariantInfo> {
     let data = cdata.data();
     let items = reader::get_doc(reader::Doc(data), tag_items);
@@ -712,7 +679,7 @@ pub fn get_enum_variants(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
         let item = find_item(did.node, items);
         let ctor_ty = item_type(ast::DefId { krate: cdata.cnum, node: id},
                                 item, tcx, cdata);
-        let name = item_name(intr, item);
+        let name = item_name(&*intr, item);
         let arg_tys = match ty::get(ctor_ty).sty {
           ty::ty_bare_fn(ref f) => f.sig.inputs.clone(),
           _ => Vec::new(), // Nullary enum variant.
@@ -759,12 +726,12 @@ fn get_explicit_self(item: ebml::Doc) -> ast::ExplicitSelf_ {
     }
 }
 
-fn item_impl_methods(intr: @IdentInterner, cdata: Cmd, item: ebml::Doc,
+fn item_impl_methods(intr: Rc<IdentInterner>, cdata: Cmd, item: ebml::Doc,
                      tcx: &ty::ctxt) -> Vec<@ty::Method> {
     let mut rslt = Vec::new();
     reader::tagged_docs(item, tag_item_impl_method, |doc| {
         let m_did = reader::with_doc_data(doc, parse_def_id);
-        rslt.push(@get_method(intr, cdata, m_did.node, tcx));
+        rslt.push(@get_method(intr.clone(), cdata, m_did.node, tcx));
         true
     });
 
@@ -772,7 +739,7 @@ fn item_impl_methods(intr: @IdentInterner, cdata: Cmd, item: ebml::Doc,
 }
 
 /// Returns information about the given implementation.
-pub fn get_impl(intr: @IdentInterner, cdata: Cmd, impl_id: ast::NodeId,
+pub fn get_impl(intr: Rc<IdentInterner>, cdata: Cmd, impl_id: ast::NodeId,
                tcx: &ty::ctxt)
                 -> ty::Impl {
     let data = cdata.data();
@@ -782,23 +749,23 @@ pub fn get_impl(intr: @IdentInterner, cdata: Cmd, impl_id: ast::NodeId,
             krate: cdata.cnum,
             node: impl_id,
         },
-        ident: item_name(intr, impl_item),
+        ident: item_name(&*intr, impl_item),
         methods: item_impl_methods(intr, cdata, impl_item, tcx),
     }
 }
 
 pub fn get_method_name_and_explicit_self(
-    intr: @IdentInterner,
+    intr: Rc<IdentInterner>,
     cdata: Cmd,
     id: ast::NodeId) -> (ast::Ident, ast::ExplicitSelf_)
 {
     let method_doc = lookup_item(id, cdata.data());
-    let name = item_name(intr, method_doc);
+    let name = item_name(&*intr, method_doc);
     let explicit_self = get_explicit_self(method_doc);
     (name, explicit_self)
 }
 
-pub fn get_method(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
+pub fn get_method(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId,
                   tcx: &ty::ctxt) -> ty::Method
 {
     let method_doc = lookup_item(id, cdata.data());
@@ -812,7 +779,7 @@ pub fn get_method(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
         _ => ImplContainer(container_id),
     };
 
-    let name = item_name(intr, method_doc);
+    let name = item_name(&*intr, method_doc);
     let type_param_defs = item_ty_param_defs(method_doc, tcx, cdata,
                                              tag_item_method_tps);
     let rp_defs = item_region_param_defs(method_doc, cdata);
@@ -853,10 +820,10 @@ pub fn get_item_variances(cdata: Cmd, id: ast::NodeId) -> ty::ItemVariances {
     let item_doc = lookup_item(id, data);
     let variance_doc = reader::get_doc(item_doc, tag_item_variances);
     let mut decoder = reader::Decoder(variance_doc);
-    Decodable::decode(&mut decoder)
+    Decodable::decode(&mut decoder).unwrap()
 }
 
-pub fn get_provided_trait_methods(intr: @IdentInterner, cdata: Cmd,
+pub fn get_provided_trait_methods(intr: Rc<IdentInterner>, cdata: Cmd,
                                   id: ast::NodeId, tcx: &ty::ctxt) ->
         Vec<@ty::Method> {
     let data = cdata.data();
@@ -868,7 +835,7 @@ pub fn get_provided_trait_methods(intr: @IdentInterner, cdata: Cmd,
         let mth = lookup_item(did.node, data);
 
         if item_method_sort(mth) == 'p' {
-            result.push(@get_method(intr, cdata, did.node, tcx));
+            result.push(@get_method(intr.clone(), cdata, did.node, tcx));
         }
         true
     });
@@ -910,7 +877,7 @@ pub fn get_type_name_if_impl(cdata: Cmd,
     ret
 }
 
-pub fn get_static_methods_if_impl(intr: @IdentInterner,
+pub fn get_static_methods_if_impl(intr: Rc<IdentInterner>,
                                   cdata: Cmd,
                                   node_id: ast::NodeId)
                                -> Option<Vec<StaticMethodInfo> > {
@@ -946,7 +913,7 @@ pub fn get_static_methods_if_impl(intr: @IdentInterner,
                 }
 
                 static_impl_methods.push(StaticMethodInfo {
-                    ident: item_name(intr, impl_method_doc),
+                    ident: item_name(&*intr, impl_method_doc),
                     def_id: item_def_id(impl_method_doc, cdata),
                     purity: purity,
                     vis: item_visibility(impl_method_doc),
@@ -962,23 +929,26 @@ pub fn get_static_methods_if_impl(intr: @IdentInterner,
 /// If node_id is the constructor of a tuple struct, retrieve the NodeId of
 /// the actual type definition, otherwise, return None
 pub fn get_tuple_struct_definition_if_ctor(cdata: Cmd,
-                                           node_id: ast::NodeId) -> Option<ast::NodeId> {
+                                           node_id: ast::NodeId)
+    -> Option<ast::DefId>
+{
     let item = lookup_item(node_id, cdata.data());
     let mut ret = None;
     reader::tagged_docs(item, tag_items_data_item_is_tuple_struct_ctor, |_| {
         ret = Some(item_reqd_and_translated_parent_item(cdata.cnum, item));
         false
     });
-    ret.map(|x| x.node)
+    ret
 }
 
 pub fn get_item_attrs(cdata: Cmd,
-                      node_id: ast::NodeId,
+                      orig_node_id: ast::NodeId,
                       f: |Vec<@ast::MetaItem> |) {
     // The attributes for a tuple struct are attached to the definition, not the ctor;
     // we assume that someone passing in a tuple struct ctor is actually wanting to
     // look at the definition
-    let node_id = get_tuple_struct_definition_if_ctor(cdata, node_id).unwrap_or(node_id);
+    let node_id = get_tuple_struct_definition_if_ctor(cdata, orig_node_id);
+    let node_id = node_id.map(|x| x.node).unwrap_or(orig_node_id);
     let item = lookup_item(node_id, cdata.data());
     reader::tagged_docs(item, tag_attributes, |attributes| {
         reader::tagged_docs(attributes, tag_attribute, |attribute| {
@@ -998,7 +968,7 @@ fn struct_field_family_to_visibility(family: Family) -> ast::Visibility {
     }
 }
 
-pub fn get_struct_fields(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId)
+pub fn get_struct_fields(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId)
     -> Vec<ty::field_ty> {
     let data = cdata.data();
     let item = lookup_item(id, data);
@@ -1007,7 +977,7 @@ pub fn get_struct_fields(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId)
         let f = item_family(an_item);
         if f == PublicField || f == PrivateField || f == InheritedField {
             // FIXME #6993: name should be of type Name, not Ident
-            let name = item_name(intr, an_item);
+            let name = item_name(&*intr, an_item);
             let did = item_def_id(an_item, cdata);
             result.push(ty::field_ty {
                 name: name.name,
@@ -1019,21 +989,17 @@ pub fn get_struct_fields(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId)
     });
     reader::tagged_docs(item, tag_item_unnamed_field, |an_item| {
         let did = item_def_id(an_item, cdata);
+        let f = item_family(an_item);
         result.push(ty::field_ty {
             name: special_idents::unnamed_field.name,
             id: did,
-            vis: ast::Inherited,
+            vis: struct_field_family_to_visibility(f),
         });
         true
     });
     result
 }
 
-pub fn get_item_visibility(cdata: Cmd, id: ast::NodeId)
-                        -> ast::Visibility {
-    item_visibility(lookup_item(id, cdata.data()))
-}
-
 fn get_meta_items(md: ebml::Doc) -> Vec<@ast::MetaItem> {
     let mut items: Vec<@ast::MetaItem> = Vec::new();
     reader::tagged_docs(md, tag_meta_item_word, |meta_item_doc| {
@@ -1102,14 +1068,14 @@ fn list_crate_attributes(md: ebml::Doc, hash: &Svh,
 }
 
 pub fn get_crate_attributes(data: &[u8]) -> Vec<ast::Attribute> {
-    return get_attributes(reader::Doc(data));
+    get_attributes(reader::Doc(data))
 }
 
 #[deriving(Clone)]
 pub struct CrateDep {
-    cnum: ast::CrateNum,
-    crate_id: CrateId,
-    hash: Svh,
+    pub cnum: ast::CrateNum,
+    pub crate_id: CrateId,
+    pub hash: Svh,
 }
 
 pub fn get_crate_deps(data: &[u8]) -> Vec<CrateDep> {
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index d97e9f2b3e1..e453acac810 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -10,8 +10,8 @@
 
 // Metadata encoding
 
-#[allow(unused_must_use)]; // everything is just a MemWriter, can't fail
-#[allow(non_camel_case_types)];
+#![allow(unused_must_use)] // everything is just a MemWriter, can't fail
+#![allow(non_camel_case_types)]
 
 use back::svh::Svh;
 use metadata::common::*;
@@ -33,7 +33,7 @@ use std::hash::Hash;
 use std::io::MemWriter;
 use std::str;
 use collections::HashMap;
-use syntax::abi::AbiSet;
+use syntax::abi;
 use syntax::ast::*;
 use syntax::ast;
 use syntax::ast_map::{PathElem, PathElems};
@@ -62,19 +62,21 @@ pub enum InlinedItemRef<'a> {
     IIForeignRef(&'a ast::ForeignItem)
 }
 
+pub type Encoder<'a> = writer::Encoder<'a, MemWriter>;
+
 pub type EncodeInlinedItem<'a> = 'a |ecx: &EncodeContext,
-                                     ebml_w: &mut writer::Encoder,
+                                     ebml_w: &mut Encoder,
                                      ii: InlinedItemRef|;
 
 pub struct EncodeParams<'a> {
-    diag: &'a SpanHandler,
-    tcx: &'a ty::ctxt,
-    reexports2: middle::resolve::ExportMap2,
-    item_symbols: &'a RefCell<NodeMap<~str>>,
-    non_inlineable_statics: &'a RefCell<NodeSet>,
-    link_meta: &'a LinkMeta,
-    cstore: &'a cstore::CStore,
-    encode_inlined_item: EncodeInlinedItem<'a>,
+    pub diag: &'a SpanHandler,
+    pub tcx: &'a ty::ctxt,
+    pub reexports2: middle::resolve::ExportMap2,
+    pub item_symbols: &'a RefCell<NodeMap<~str>>,
+    pub non_inlineable_statics: &'a RefCell<NodeSet>,
+    pub link_meta: &'a LinkMeta,
+    pub cstore: &'a cstore::CStore,
+    pub encode_inlined_item: EncodeInlinedItem<'a>,
 }
 
 pub struct Stats {
@@ -94,27 +96,27 @@ pub struct Stats {
 }
 
 pub struct EncodeContext<'a> {
-    diag: &'a SpanHandler,
-    tcx: &'a ty::ctxt,
-    stats: @Stats,
-    reexports2: middle::resolve::ExportMap2,
-    item_symbols: &'a RefCell<NodeMap<~str>>,
-    non_inlineable_statics: &'a RefCell<NodeSet>,
-    link_meta: &'a LinkMeta,
-    cstore: &'a cstore::CStore,
-    encode_inlined_item: EncodeInlinedItem<'a>,
-    type_abbrevs: abbrev_map,
-}
-
-fn encode_name(ebml_w: &mut writer::Encoder, name: Name) {
+    pub diag: &'a SpanHandler,
+    pub tcx: &'a ty::ctxt,
+    pub stats: @Stats,
+    pub reexports2: middle::resolve::ExportMap2,
+    pub item_symbols: &'a RefCell<NodeMap<~str>>,
+    pub non_inlineable_statics: &'a RefCell<NodeSet>,
+    pub link_meta: &'a LinkMeta,
+    pub cstore: &'a cstore::CStore,
+    pub encode_inlined_item: EncodeInlinedItem<'a>,
+    pub type_abbrevs: abbrev_map,
+}
+
+fn encode_name(ebml_w: &mut Encoder, name: Name) {
     ebml_w.wr_tagged_str(tag_paths_data_name, token::get_name(name).get());
 }
 
-fn encode_impl_type_basename(ebml_w: &mut writer::Encoder, name: Ident) {
+fn encode_impl_type_basename(ebml_w: &mut Encoder, name: Ident) {
     ebml_w.wr_tagged_str(tag_item_impl_type_basename, token::get_ident(name).get());
 }
 
-pub fn encode_def_id(ebml_w: &mut writer::Encoder, id: DefId) {
+pub fn encode_def_id(ebml_w: &mut Encoder, id: DefId) {
     ebml_w.wr_tagged_str(tag_def_id, def_to_str(id));
 }
 
@@ -124,7 +126,7 @@ struct entry<T> {
     pos: u64
 }
 
-fn encode_trait_ref(ebml_w: &mut writer::Encoder,
+fn encode_trait_ref(ebml_w: &mut Encoder,
                     ecx: &EncodeContext,
                     trait_ref: &ty::TraitRef,
                     tag: uint) {
@@ -140,7 +142,7 @@ fn encode_trait_ref(ebml_w: &mut writer::Encoder,
     ebml_w.end_tag();
 }
 
-fn encode_impl_vtables(ebml_w: &mut writer::Encoder,
+fn encode_impl_vtables(ebml_w: &mut Encoder,
                        ecx: &EncodeContext,
                        vtables: &typeck::impl_res) {
     ebml_w.start_tag(tag_item_impl_vtables);
@@ -150,7 +152,7 @@ fn encode_impl_vtables(ebml_w: &mut writer::Encoder,
 }
 
 // Item info table encoding
-fn encode_family(ebml_w: &mut writer::Encoder, c: char) {
+fn encode_family(ebml_w: &mut Encoder, c: char) {
     ebml_w.start_tag(tag_items_data_item_family);
     ebml_w.writer.write(&[c as u8]);
     ebml_w.end_tag();
@@ -160,7 +162,7 @@ pub fn def_to_str(did: DefId) -> ~str {
     format!("{}:{}", did.krate, did.node)
 }
 
-fn encode_ty_type_param_defs(ebml_w: &mut writer::Encoder,
+fn encode_ty_type_param_defs(ebml_w: &mut Encoder,
                              ecx: &EncodeContext,
                              params: &[ty::TypeParameterDef],
                              tag: uint) {
@@ -177,7 +179,7 @@ fn encode_ty_type_param_defs(ebml_w: &mut writer::Encoder,
     }
 }
 
-fn encode_region_param_defs(ebml_w: &mut writer::Encoder,
+fn encode_region_param_defs(ebml_w: &mut Encoder,
                             params: &[ty::RegionParameterDef]) {
     for param in params.iter() {
         ebml_w.start_tag(tag_region_param_def);
@@ -193,7 +195,7 @@ fn encode_region_param_defs(ebml_w: &mut writer::Encoder,
     }
 }
 
-fn encode_item_variances(ebml_w: &mut writer::Encoder,
+fn encode_item_variances(ebml_w: &mut Encoder,
                          ecx: &EncodeContext,
                          id: ast::NodeId) {
     let v = ty::item_variances(ecx.tcx, ast_util::local_def(id));
@@ -202,7 +204,7 @@ fn encode_item_variances(ebml_w: &mut writer::Encoder,
     ebml_w.end_tag();
 }
 
-fn encode_bounds_and_type(ebml_w: &mut writer::Encoder,
+fn encode_bounds_and_type(ebml_w: &mut Encoder,
                           ecx: &EncodeContext,
                           tpt: &ty::ty_param_bounds_and_ty) {
     encode_ty_type_param_defs(ebml_w, ecx, tpt.generics.type_param_defs(),
@@ -211,7 +213,7 @@ fn encode_bounds_and_type(ebml_w: &mut writer::Encoder,
     encode_type(ecx, ebml_w, tpt.ty);
 }
 
-fn encode_variant_id(ebml_w: &mut writer::Encoder, vid: DefId) {
+fn encode_variant_id(ebml_w: &mut Encoder, vid: DefId) {
     ebml_w.start_tag(tag_items_data_item_variant);
     let s = def_to_str(vid);
     ebml_w.writer.write(s.as_bytes());
@@ -219,7 +221,7 @@ fn encode_variant_id(ebml_w: &mut writer::Encoder, vid: DefId) {
 }
 
 pub fn write_type(ecx: &EncodeContext,
-                  ebml_w: &mut writer::Encoder,
+                  ebml_w: &mut Encoder,
                   typ: ty::t) {
     let ty_str_ctxt = &tyencode::ctxt {
         diag: ecx.diag,
@@ -231,7 +233,7 @@ pub fn write_type(ecx: &EncodeContext,
 }
 
 pub fn write_vstore(ecx: &EncodeContext,
-                    ebml_w: &mut writer::Encoder,
+                    ebml_w: &mut Encoder,
                     vstore: ty::vstore) {
     let ty_str_ctxt = &tyencode::ctxt {
         diag: ecx.diag,
@@ -243,7 +245,7 @@ pub fn write_vstore(ecx: &EncodeContext,
 }
 
 fn encode_type(ecx: &EncodeContext,
-               ebml_w: &mut writer::Encoder,
+               ebml_w: &mut Encoder,
                typ: ty::t) {
     ebml_w.start_tag(tag_items_data_item_type);
     write_type(ecx, ebml_w, typ);
@@ -251,7 +253,7 @@ fn encode_type(ecx: &EncodeContext,
 }
 
 fn encode_method_fty(ecx: &EncodeContext,
-                     ebml_w: &mut writer::Encoder,
+                     ebml_w: &mut Encoder,
                      typ: &ty::BareFnTy) {
     ebml_w.start_tag(tag_item_method_fty);
 
@@ -267,7 +269,7 @@ fn encode_method_fty(ecx: &EncodeContext,
 }
 
 fn encode_symbol(ecx: &EncodeContext,
-                 ebml_w: &mut writer::Encoder,
+                 ebml_w: &mut Encoder,
                  id: NodeId) {
     ebml_w.start_tag(tag_items_data_item_symbol);
     match ecx.item_symbols.borrow().find(&id) {
@@ -284,7 +286,7 @@ fn encode_symbol(ecx: &EncodeContext,
 }
 
 fn encode_disr_val(_: &EncodeContext,
-                   ebml_w: &mut writer::Encoder,
+                   ebml_w: &mut Encoder,
                    disr_val: ty::Disr) {
     ebml_w.start_tag(tag_disr_val);
     let s = disr_val.to_str();
@@ -292,14 +294,14 @@ fn encode_disr_val(_: &EncodeContext,
     ebml_w.end_tag();
 }
 
-fn encode_parent_item(ebml_w: &mut writer::Encoder, id: DefId) {
+fn encode_parent_item(ebml_w: &mut Encoder, id: DefId) {
     ebml_w.start_tag(tag_items_data_parent_item);
     let s = def_to_str(id);
     ebml_w.writer.write(s.as_bytes());
     ebml_w.end_tag();
 }
 
-fn encode_struct_fields(ebml_w: &mut writer::Encoder,
+fn encode_struct_fields(ebml_w: &mut Encoder,
                         def: @StructDef) {
     for f in def.fields.iter() {
         match f.node.kind {
@@ -310,8 +312,9 @@ fn encode_struct_fields(ebml_w: &mut writer::Encoder,
                encode_def_id(ebml_w, local_def(f.node.id));
                ebml_w.end_tag();
             }
-            UnnamedField => {
+            UnnamedField(vis) => {
                 ebml_w.start_tag(tag_item_unnamed_field);
+                encode_struct_field_family(ebml_w, vis);
                 encode_def_id(ebml_w, local_def(f.node.id));
                 ebml_w.end_tag();
             }
@@ -320,7 +323,7 @@ fn encode_struct_fields(ebml_w: &mut writer::Encoder,
 }
 
 fn encode_enum_variant_info(ecx: &EncodeContext,
-                            ebml_w: &mut writer::Encoder,
+                            ebml_w: &mut Encoder,
                             id: NodeId,
                             variants: &[P<Variant>],
                             index: @RefCell<Vec<entry<i64>> >,
@@ -377,7 +380,7 @@ fn encode_enum_variant_info(ecx: &EncodeContext,
     }
 }
 
-fn encode_path<PI: Iterator<PathElem> + Clone>(ebml_w: &mut writer::Encoder,
+fn encode_path<PI: Iterator<PathElem> + Clone>(ebml_w: &mut Encoder,
                                                mut path: PI) {
     ebml_w.start_tag(tag_path);
     ebml_w.wr_tagged_u32(tag_path_len, path.clone().len() as u32);
@@ -391,7 +394,7 @@ fn encode_path<PI: Iterator<PathElem> + Clone>(ebml_w: &mut writer::Encoder,
     ebml_w.end_tag();
 }
 
-fn encode_reexported_static_method(ebml_w: &mut writer::Encoder,
+fn encode_reexported_static_method(ebml_w: &mut Encoder,
                                    exp: &middle::resolve::Export2,
                                    method_def_id: DefId,
                                    method_ident: Ident) {
@@ -408,7 +411,7 @@ fn encode_reexported_static_method(ebml_w: &mut writer::Encoder,
 }
 
 fn encode_reexported_static_base_methods(ecx: &EncodeContext,
-                                         ebml_w: &mut writer::Encoder,
+                                         ebml_w: &mut Encoder,
                                          exp: &middle::resolve::Export2)
                                          -> bool {
     match ecx.tcx.inherent_impls.borrow().find(&exp.def_id) {
@@ -428,7 +431,7 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext,
 }
 
 fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
-                                          ebml_w: &mut writer::Encoder,
+                                          ebml_w: &mut Encoder,
                                           exp: &middle::resolve::Export2)
                                           -> bool {
     match ecx.tcx.trait_methods_cache.borrow().find(&exp.def_id) {
@@ -446,7 +449,7 @@ fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
 }
 
 fn encode_reexported_static_methods(ecx: &EncodeContext,
-                                    ebml_w: &mut writer::Encoder,
+                                    ebml_w: &mut Encoder,
                                     mod_path: PathElems,
                                     exp: &middle::resolve::Export2) {
     match ecx.tcx.map.find(exp.def_id.node) {
@@ -513,8 +516,7 @@ fn each_auxiliary_node_id(item: @Item, callback: |NodeId| -> bool) -> bool {
             // If this is a newtype struct, return the constructor.
             match struct_def.ctor_id {
                 Some(ctor_id) if struct_def.fields.len() > 0 &&
-                        struct_def.fields.get(0).node.kind ==
-                        ast::UnnamedField => {
+                        struct_def.fields.get(0).node.kind.is_unnamed() => {
                     continue_ = callback(ctor_id);
                 }
                 _ => {}
@@ -527,7 +529,7 @@ fn each_auxiliary_node_id(item: @Item, callback: |NodeId| -> bool) -> bool {
 }
 
 fn encode_reexports(ecx: &EncodeContext,
-                    ebml_w: &mut writer::Encoder,
+                    ebml_w: &mut Encoder,
                     id: NodeId,
                     path: PathElems) {
     debug!("(encoding info for module) encoding reexports for {}", id);
@@ -560,7 +562,7 @@ fn encode_reexports(ecx: &EncodeContext,
 }
 
 fn encode_info_for_mod(ecx: &EncodeContext,
-                       ebml_w: &mut writer::Encoder,
+                       ebml_w: &mut Encoder,
                        md: &Mod,
                        id: NodeId,
                        path: PathElems,
@@ -613,7 +615,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
     ebml_w.end_tag();
 }
 
-fn encode_struct_field_family(ebml_w: &mut writer::Encoder,
+fn encode_struct_field_family(ebml_w: &mut Encoder,
                               visibility: Visibility) {
     encode_family(ebml_w, match visibility {
         Public => 'g',
@@ -622,7 +624,7 @@ fn encode_struct_field_family(ebml_w: &mut writer::Encoder,
     });
 }
 
-fn encode_visibility(ebml_w: &mut writer::Encoder, visibility: Visibility) {
+fn encode_visibility(ebml_w: &mut Encoder, visibility: Visibility) {
     ebml_w.start_tag(tag_items_data_item_visibility);
     let ch = match visibility {
         Public => 'y',
@@ -633,7 +635,7 @@ fn encode_visibility(ebml_w: &mut writer::Encoder, visibility: Visibility) {
     ebml_w.end_tag();
 }
 
-fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::ExplicitSelf_) {
+fn encode_explicit_self(ebml_w: &mut Encoder, explicit_self: ast::ExplicitSelf_) {
     ebml_w.start_tag(tag_item_trait_method_explicit_self);
 
     // Encode the base self type.
@@ -650,7 +652,7 @@ fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::Explic
 
     ebml_w.end_tag();
 
-    fn encode_mutability(ebml_w: &mut writer::Encoder,
+    fn encode_mutability(ebml_w: &mut Encoder,
                          m: ast::Mutability) {
         match m {
             MutImmutable => { ebml_w.writer.write(&[ 'i' as u8 ]); }
@@ -659,13 +661,13 @@ fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::Explic
     }
 }
 
-fn encode_method_sort(ebml_w: &mut writer::Encoder, sort: char) {
+fn encode_method_sort(ebml_w: &mut Encoder, sort: char) {
     ebml_w.start_tag(tag_item_trait_method_sort);
     ebml_w.writer.write(&[ sort as u8 ]);
     ebml_w.end_tag();
 }
 
-fn encode_provided_source(ebml_w: &mut writer::Encoder,
+fn encode_provided_source(ebml_w: &mut Encoder,
                           source_opt: Option<DefId>) {
     for source in source_opt.iter() {
         ebml_w.start_tag(tag_item_method_provided_source);
@@ -677,7 +679,7 @@ fn encode_provided_source(ebml_w: &mut writer::Encoder,
 
 /* Returns an index of items in this class */
 fn encode_info_for_struct(ecx: &EncodeContext,
-                          ebml_w: &mut writer::Encoder,
+                          ebml_w: &mut Encoder,
                           fields: &[StructField],
                           global_index: @RefCell<Vec<entry<i64>> >)
                           -> Vec<entry<i64>> {
@@ -690,7 +692,7 @@ fn encode_info_for_struct(ecx: &EncodeContext,
     for field in fields.iter() {
         let (nm, vis) = match field.node.kind {
             NamedField(nm, vis) => (nm, vis),
-            UnnamedField => (special_idents::unnamed_field, Inherited)
+            UnnamedField(vis) => (special_idents::unnamed_field, vis)
         };
 
         let id = field.node.id;
@@ -712,7 +714,7 @@ fn encode_info_for_struct(ecx: &EncodeContext,
 }
 
 fn encode_info_for_struct_ctor(ecx: &EncodeContext,
-                               ebml_w: &mut writer::Encoder,
+                               ebml_w: &mut Encoder,
                                name: ast::Ident,
                                ctor_id: NodeId,
                                index: @RefCell<Vec<entry<i64>> >,
@@ -746,7 +748,7 @@ fn encode_info_for_struct_ctor(ecx: &EncodeContext,
 }
 
 fn encode_method_ty_fields(ecx: &EncodeContext,
-                           ebml_w: &mut writer::Encoder,
+                           ebml_w: &mut Encoder,
                            method_ty: &ty::Method) {
     encode_def_id(ebml_w, method_ty.def_id);
     encode_name(ebml_w, method_ty.ident.name);
@@ -767,7 +769,7 @@ fn encode_method_ty_fields(ecx: &EncodeContext,
 }
 
 fn encode_info_for_method(ecx: &EncodeContext,
-                          ebml_w: &mut writer::Encoder,
+                          ebml_w: &mut Encoder,
                           m: &ty::Method,
                           impl_path: PathElems,
                           is_default_impl: bool,
@@ -836,7 +838,7 @@ fn should_inline(attrs: &[Attribute]) -> bool {
 
 // Encodes the inherent implementations of a structure, enumeration, or trait.
 fn encode_inherent_implementations(ecx: &EncodeContext,
-                                   ebml_w: &mut writer::Encoder,
+                                   ebml_w: &mut Encoder,
                                    def_id: DefId) {
     match ecx.tcx.inherent_impls.borrow().find(&def_id) {
         None => {}
@@ -852,7 +854,7 @@ fn encode_inherent_implementations(ecx: &EncodeContext,
 
 // Encodes the implementations of a trait defined in this crate.
 fn encode_extension_implementations(ecx: &EncodeContext,
-                                    ebml_w: &mut writer::Encoder,
+                                    ebml_w: &mut Encoder,
                                     trait_def_id: DefId) {
     match ecx.tcx.trait_impls.borrow().find(&trait_def_id) {
         None => {}
@@ -867,14 +869,14 @@ fn encode_extension_implementations(ecx: &EncodeContext,
 }
 
 fn encode_info_for_item(ecx: &EncodeContext,
-                        ebml_w: &mut writer::Encoder,
+                        ebml_w: &mut Encoder,
                         item: &Item,
                         index: @RefCell<Vec<entry<i64>> >,
                         path: PathElems,
                         vis: ast::Visibility) {
     let tcx = ecx.tcx;
 
-    fn add_to_index(item: &Item, ebml_w: &writer::Encoder,
+    fn add_to_index(item: &Item, ebml_w: &Encoder,
                      index: @RefCell<Vec<entry<i64>> >) {
         index.borrow_mut().push(entry {
             val: item.id as i64,
@@ -1211,11 +1213,11 @@ fn encode_info_for_item(ecx: &EncodeContext,
 }
 
 fn encode_info_for_foreign_item(ecx: &EncodeContext,
-                                ebml_w: &mut writer::Encoder,
+                                ebml_w: &mut Encoder,
                                 nitem: &ForeignItem,
                                 index: @RefCell<Vec<entry<i64>> >,
                                 path: PathElems,
-                                abi: AbiSet) {
+                                abi: abi::Abi) {
     index.borrow_mut().push(entry {
         val: nitem.id as i64,
         pos: ebml_w.writer.tell().unwrap(),
@@ -1229,7 +1231,7 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
         encode_bounds_and_type(ebml_w, ecx,
                                &lookup_item_type(ecx.tcx,local_def(nitem.id)));
         encode_name(ebml_w, nitem.ident.name);
-        if abi.is_intrinsic() {
+        if abi == abi::RustIntrinsic {
             (ecx.encode_inlined_item)(ecx, ebml_w, IIForeignRef(nitem));
         } else {
             encode_symbol(ecx, ebml_w, nitem.id);
@@ -1253,7 +1255,7 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
 fn my_visit_expr(_e: &Expr) { }
 
 fn my_visit_item(i: &Item,
-                 ebml_w: &mut writer::Encoder,
+                 ebml_w: &mut Encoder,
                  ecx_ptr: *int,
                  index: @RefCell<Vec<entry<i64>> >) {
     let mut ebml_w = unsafe { ebml_w.unsafe_clone() };
@@ -1265,7 +1267,7 @@ fn my_visit_item(i: &Item,
 }
 
 fn my_visit_foreign_item(ni: &ForeignItem,
-                         ebml_w: &mut writer::Encoder,
+                         ebml_w: &mut Encoder,
                          ecx_ptr:*int,
                          index: @RefCell<Vec<entry<i64>> >) {
     // See above
@@ -1277,16 +1279,16 @@ fn my_visit_foreign_item(ni: &ForeignItem,
     let mut ebml_w = unsafe {
         ebml_w.unsafe_clone()
     };
-    let abis = ecx.tcx.map.get_foreign_abis(ni.id);
+    let abi = ecx.tcx.map.get_foreign_abi(ni.id);
     ecx.tcx.map.with_path(ni.id, |path| {
         encode_info_for_foreign_item(ecx, &mut ebml_w,
                                      ni, index,
-                                     path, abis);
+                                     path, abi);
     });
 }
 
 struct EncodeVisitor<'a,'b> {
-    ebml_w_for_visit_item: &'a mut writer::Encoder<'b>,
+    ebml_w_for_visit_item: &'a mut Encoder<'b>,
     ecx_ptr:*int,
     index: @RefCell<Vec<entry<i64>> >,
 }
@@ -1313,7 +1315,7 @@ impl<'a,'b> visit::Visitor<()> for EncodeVisitor<'a,'b> {
 }
 
 fn encode_info_for_items(ecx: &EncodeContext,
-                         ebml_w: &mut writer::Encoder,
+                         ebml_w: &mut Encoder,
                          krate: &Crate)
                          -> Vec<entry<i64>> {
     let index = @RefCell::new(Vec::new());
@@ -1343,7 +1345,7 @@ fn encode_info_for_items(ecx: &EncodeContext,
     }
 
     ebml_w.end_tag();
-    return /*bad*/(*index).get();
+    return /*bad*/index.borrow().clone();
 }
 
 
@@ -1363,13 +1365,13 @@ fn create_index<T:Clone + Hash + 'static>(
 
     let mut buckets_frozen = Vec::new();
     for bucket in buckets.iter() {
-        buckets_frozen.push(@/*bad*/(**bucket).get());
+        buckets_frozen.push(@/*bad*/bucket.borrow().clone());
     }
     return buckets_frozen;
 }
 
 fn encode_index<T:'static>(
-                ebml_w: &mut writer::Encoder,
+                ebml_w: &mut Encoder,
                 buckets: Vec<@Vec<entry<T>> > ,
                 write_fn: |&mut MemWriter, &T|) {
     ebml_w.start_tag(tag_index);
@@ -1407,7 +1409,7 @@ fn write_i64(writer: &mut MemWriter, &n: &i64) {
     wr.write_be_u32(n as u32);
 }
 
-fn encode_meta_item(ebml_w: &mut writer::Encoder, mi: @MetaItem) {
+fn encode_meta_item(ebml_w: &mut Encoder, mi: @MetaItem) {
     match mi.node {
       MetaWord(ref name) => {
         ebml_w.start_tag(tag_meta_item_word);
@@ -1444,7 +1446,7 @@ fn encode_meta_item(ebml_w: &mut writer::Encoder, mi: @MetaItem) {
     }
 }
 
-fn encode_attributes(ebml_w: &mut writer::Encoder, attrs: &[Attribute]) {
+fn encode_attributes(ebml_w: &mut Encoder, attrs: &[Attribute]) {
     ebml_w.start_tag(tag_attributes);
     for attr in attrs.iter() {
         ebml_w.start_tag(tag_attribute);
@@ -1480,7 +1482,7 @@ fn synthesize_crate_attrs(ecx: &EncodeContext,
     attrs
 }
 
-fn encode_crate_deps(ebml_w: &mut writer::Encoder, cstore: &cstore::CStore) {
+fn encode_crate_deps(ebml_w: &mut Encoder, cstore: &cstore::CStore) {
     fn get_ordered_deps(cstore: &cstore::CStore) -> Vec<decoder::CrateDep> {
         // Pull the cnums and name,vers,hash out of cstore
         let mut deps = Vec::new();
@@ -1518,7 +1520,7 @@ fn encode_crate_deps(ebml_w: &mut writer::Encoder, cstore: &cstore::CStore) {
     ebml_w.end_tag();
 }
 
-fn encode_lang_items(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
+fn encode_lang_items(ecx: &EncodeContext, ebml_w: &mut Encoder) {
     ebml_w.start_tag(tag_lang_items);
 
     for (i, def_id) in ecx.tcx.lang_items.items() {
@@ -1548,7 +1550,7 @@ fn encode_lang_items(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
     ebml_w.end_tag();   // tag_lang_items
 }
 
-fn encode_native_libraries(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
+fn encode_native_libraries(ecx: &EncodeContext, ebml_w: &mut Encoder) {
     ebml_w.start_tag(tag_native_libraries);
 
     for &(ref lib, kind) in ecx.tcx.sess.cstore.get_used_libraries()
@@ -1574,7 +1576,7 @@ fn encode_native_libraries(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
     ebml_w.end_tag();
 }
 
-fn encode_macro_registrar_fn(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
+fn encode_macro_registrar_fn(ecx: &EncodeContext, ebml_w: &mut Encoder) {
     match *ecx.tcx.sess.macro_registrar_fn.borrow() {
         Some(did) => {
             ebml_w.start_tag(tag_macro_registrar_fn);
@@ -1587,7 +1589,7 @@ fn encode_macro_registrar_fn(ecx: &EncodeContext, ebml_w: &mut writer::Encoder)
 
 struct MacroDefVisitor<'a, 'b> {
     ecx: &'a EncodeContext<'a>,
-    ebml_w: &'a mut writer::Encoder<'b>
+    ebml_w: &'a mut Encoder<'b>
 }
 
 impl<'a, 'b> Visitor<()> for MacroDefVisitor<'a, 'b> {
@@ -1608,7 +1610,7 @@ impl<'a, 'b> Visitor<()> for MacroDefVisitor<'a, 'b> {
 
 fn encode_macro_defs(ecx: &EncodeContext,
                      krate: &Crate,
-                     ebml_w: &mut writer::Encoder) {
+                     ebml_w: &mut Encoder) {
     ebml_w.start_tag(tag_exported_macros);
     {
         let mut visitor = MacroDefVisitor {
@@ -1622,7 +1624,7 @@ fn encode_macro_defs(ecx: &EncodeContext,
 
 struct ImplVisitor<'a,'b> {
     ecx: &'a EncodeContext<'a>,
-    ebml_w: &'a mut writer::Encoder<'b>,
+    ebml_w: &'a mut Encoder<'b>,
 }
 
 impl<'a,'b> Visitor<()> for ImplVisitor<'a,'b> {
@@ -1660,7 +1662,7 @@ impl<'a,'b> Visitor<()> for ImplVisitor<'a,'b> {
 /// * Implementations of traits not defined in this crate.
 fn encode_impls(ecx: &EncodeContext,
                 krate: &Crate,
-                ebml_w: &mut writer::Encoder) {
+                ebml_w: &mut Encoder) {
     ebml_w.start_tag(tag_impls);
 
     {
@@ -1676,7 +1678,7 @@ fn encode_impls(ecx: &EncodeContext,
 
 fn encode_misc_info(ecx: &EncodeContext,
                     krate: &Crate,
-                    ebml_w: &mut writer::Encoder) {
+                    ebml_w: &mut Encoder) {
     ebml_w.start_tag(tag_misc_info);
     ebml_w.start_tag(tag_misc_info_crate_items);
     for &item in krate.module.items.iter() {
@@ -1699,7 +1701,7 @@ fn encode_misc_info(ecx: &EncodeContext,
     ebml_w.end_tag();
 }
 
-fn encode_crate_dep(ebml_w: &mut writer::Encoder,
+fn encode_crate_dep(ebml_w: &mut Encoder,
                     dep: decoder::CrateDep) {
     ebml_w.start_tag(tag_crate_dep);
     ebml_w.start_tag(tag_crate_dep_crateid);
@@ -1711,13 +1713,13 @@ fn encode_crate_dep(ebml_w: &mut writer::Encoder,
     ebml_w.end_tag();
 }
 
-fn encode_hash(ebml_w: &mut writer::Encoder, hash: &Svh) {
+fn encode_hash(ebml_w: &mut Encoder, hash: &Svh) {
     ebml_w.start_tag(tag_crate_hash);
     ebml_w.writer.write(hash.as_str().as_bytes());
     ebml_w.end_tag();
 }
 
-fn encode_crate_id(ebml_w: &mut writer::Encoder, crate_id: &CrateId) {
+fn encode_crate_id(ebml_w: &mut Encoder, crate_id: &CrateId) {
     ebml_w.start_tag(tag_crate_crateid);
     ebml_w.writer.write(crate_id.to_str().as_bytes());
     ebml_w.end_tag();
diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index fa794c88345..b83f42da0a0 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use std::cell::RefCell;
 use std::os;
@@ -26,9 +26,9 @@ pub enum FileMatch { FileMatches, FileDoesntMatch }
 pub type pick<'a> = 'a |path: &Path| -> FileMatch;
 
 pub struct FileSearch<'a> {
-    sysroot: &'a Path,
-    addl_lib_search_paths: &'a RefCell<HashSet<Path>>,
-    target_triple: &'a str
+    pub sysroot: &'a Path,
+    pub addl_lib_search_paths: &'a RefCell<HashSet<Path>>,
+    pub target_triple: &'a str
 }
 
 impl<'a> FileSearch<'a> {
@@ -60,7 +60,8 @@ impl<'a> FileSearch<'a> {
         if !found {
             let rustpath = rust_path();
             for path in rustpath.iter() {
-                let tlib_path = make_rustpkg_target_lib_path(path, self.target_triple);
+                let tlib_path = make_rustpkg_target_lib_path(
+                    self.sysroot, path, self.target_triple);
                 debug!("is {} in visited_dirs? {:?}", tlib_path.display(),
                         visited_dirs.contains_equiv(&tlib_path.as_vec().to_owned()));
 
@@ -83,12 +84,6 @@ impl<'a> FileSearch<'a> {
         make_target_lib_path(self.sysroot, self.target_triple)
     }
 
-    pub fn get_target_lib_file_path(&self, file: &Path) -> Path {
-        let mut p = self.get_target_lib_path();
-        p.push(file);
-        p
-    }
-
     pub fn search(&self, pick: pick) {
         self.for_each_lib_search_path(|lib_search_path| {
             debug!("searching {}", lib_search_path.display());
@@ -136,8 +131,8 @@ impl<'a> FileSearch<'a> {
     }
 }
 
-pub fn relative_target_lib_path(target_triple: &str) -> Path {
-    let mut p = Path::new(libdir());
+pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> Path {
+    let mut p = Path::new(find_libdir(sysroot));
     assert!(p.is_relative());
     p.push(rustlibdir());
     p.push(target_triple);
@@ -147,12 +142,13 @@ pub fn relative_target_lib_path(target_triple: &str) -> Path {
 
 fn make_target_lib_path(sysroot: &Path,
                         target_triple: &str) -> Path {
-    sysroot.join(&relative_target_lib_path(target_triple))
+    sysroot.join(&relative_target_lib_path(sysroot, target_triple))
 }
 
-fn make_rustpkg_target_lib_path(dir: &Path,
-                        target_triple: &str) -> Path {
-    let mut p = dir.join(libdir());
+fn make_rustpkg_target_lib_path(sysroot: &Path,
+                                dir: &Path,
+                                target_triple: &str) -> Path {
+    let mut p = dir.join(find_libdir(sysroot));
     p.push(target_triple);
     p
 }
@@ -198,9 +194,9 @@ pub fn get_rust_path() -> Option<~str> {
 pub fn rust_path() -> Vec<Path> {
     let mut env_rust_path: Vec<Path> = match get_rust_path() {
         Some(env_path) => {
-            let env_path_components: Vec<&str> =
-                env_path.split_str(PATH_ENTRY_SEPARATOR).collect();
-            env_path_components.map(|&s| Path::new(s))
+            let env_path_components =
+                env_path.split_str(PATH_ENTRY_SEPARATOR);
+            env_path_components.map(|s| Path::new(s)).collect()
         }
         None => Vec::new()
     };
@@ -235,12 +231,36 @@ pub fn rust_path() -> Vec<Path> {
 
 // The name of the directory rustc expects libraries to be located.
 // On Unix should be "lib", on windows "bin"
-pub fn libdir() -> ~str {
-    (env!("CFG_LIBDIR_RELATIVE")).to_owned()
+#[cfg(unix)]
+fn find_libdir(sysroot: &Path) -> ~str {
+    // FIXME: This is a quick hack to make the rustc binary able to locate
+    // Rust libraries in Linux environments where libraries might be installed
+    // to lib64/lib32. This would be more foolproof by basing the sysroot off
+    // of the directory where librustc is located, rather than where the rustc
+    // binary is.
+
+    if sysroot.join(primary_libdir_name()).join(rustlibdir()).exists() {
+        return primary_libdir_name();
+    } else {
+        return secondary_libdir_name();
+    }
+
+    #[cfg(target_word_size = "64")]
+    fn primary_libdir_name() -> ~str { ~"lib64" }
+
+    #[cfg(target_word_size = "32")]
+    fn primary_libdir_name() -> ~str { ~"lib32" }
+
+    fn secondary_libdir_name() -> ~str { ~"lib" }
+}
+
+#[cfg(windows)]
+fn find_libdir(_sysroot: &Path) -> ~str {
+    ~"bin"
 }
 
 // The name of rustc's own place to organize libraries.
 // Used to be "rustc", now the default is "rustlib"
 pub fn rustlibdir() -> ~str {
-    (env!("CFG_RUSTLIBDIR")).to_owned()
+    ~"rustlib"
 }
diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs
index c6706383855..4f4ef31e15b 100644
--- a/src/librustc/metadata/loader.rs
+++ b/src/librustc/metadata/loader.rs
@@ -29,8 +29,10 @@ use std::cast;
 use std::cmp;
 use std::io;
 use std::os::consts::{macos, freebsd, linux, android, win32};
-use std::str;
+use std::ptr;
+use std::rc::Rc;
 use std::slice;
+use std::str;
 
 use collections::{HashMap, HashSet};
 use flate;
@@ -44,28 +46,49 @@ pub enum Os {
     OsFreebsd
 }
 
+pub struct HashMismatch {
+    path: Path,
+}
+
 pub struct Context<'a> {
-    sess: &'a Session,
-    span: Span,
-    ident: &'a str,
-    crate_id: &'a CrateId,
-    id_hash: &'a str,
-    hash: Option<&'a Svh>,
-    os: Os,
-    intr: @IdentInterner,
-    rejected_via_hash: bool,
+    pub sess: &'a Session,
+    pub span: Span,
+    pub ident: &'a str,
+    pub crate_id: &'a CrateId,
+    pub id_hash: &'a str,
+    pub hash: Option<&'a Svh>,
+    pub os: Os,
+    pub intr: Rc<IdentInterner>,
+    pub rejected_via_hash: Vec<HashMismatch>
 }
 
 pub struct Library {
-    dylib: Option<Path>,
-    rlib: Option<Path>,
-    metadata: MetadataBlob,
+    pub dylib: Option<Path>,
+    pub rlib: Option<Path>,
+    pub metadata: MetadataBlob,
 }
 
 pub struct ArchiveMetadata {
-    priv archive: ArchiveRO,
+    archive: ArchiveRO,
     // See comments in ArchiveMetadata::new for why this is static
-    priv data: &'static [u8],
+    data: &'static [u8],
+}
+
+pub struct CratePaths {
+    pub ident: ~str,
+    pub dylib: Option<Path>,
+    pub rlib: Option<Path>
+}
+
+impl CratePaths {
+    fn paths(&self) -> Vec<Path> {
+        match (&self.dylib, &self.rlib) {
+            (&None,    &None)              => vec!(),
+            (&Some(ref p), &None) |
+            (&None, &Some(ref p))          => vec!(p.clone()),
+            (&Some(ref p1), &Some(ref p2)) => vec!(p1.clone(), p2.clone()),
+        }
+    }
 }
 
 // FIXME(#11857) this should be a "real" realpath
@@ -81,26 +104,43 @@ fn realpath(p: &Path) -> Path {
 }
 
 impl<'a> Context<'a> {
-    pub fn load_library_crate(&mut self, root_ident: Option<&str>) -> Library {
+    pub fn load_library_crate(&mut self, root: &Option<CratePaths>) -> Library {
         match self.find_library_crate() {
             Some(t) => t,
             None => {
                 self.sess.abort_if_errors();
-                let message = if self.rejected_via_hash {
+                let message = if self.rejected_via_hash.len() > 0 {
                     format!("found possibly newer version of crate `{}`",
                             self.ident)
                 } else {
                     format!("can't find crate for `{}`", self.ident)
                 };
-                let message = match root_ident {
-                    None => message,
-                    Some(c) => format!("{} which `{}` depends on", message, c),
+                let message = match root {
+                    &None => message,
+                    &Some(ref r) => format!("{} which `{}` depends on",
+                                            message, r.ident)
                 };
                 self.sess.span_err(self.span, message);
 
-                if self.rejected_via_hash {
+                if self.rejected_via_hash.len() > 0 {
                     self.sess.span_note(self.span, "perhaps this crate needs \
                                                     to be recompiled?");
+                    let mismatches = self.rejected_via_hash.iter();
+                    for (i, &HashMismatch{ ref path }) in mismatches.enumerate() {
+                        self.sess.fileline_note(self.span,
+                            format!("crate `{}` path \\#{}: {}",
+                                    self.ident, i+1, path.display()));
+                    }
+                    match root {
+                        &None => {}
+                        &Some(ref r) => {
+                            for (i, path) in r.paths().iter().enumerate() {
+                                self.sess.fileline_note(self.span,
+                                    format!("crate `{}` path \\#{}: {}",
+                                            r.ident, i+1, path.display()));
+                            }
+                        }
+                    }
                 }
                 self.sess.abort_if_errors();
                 unreachable!()
@@ -290,7 +330,7 @@ impl<'a> Context<'a> {
             info!("{} reading metadata from: {}", flavor, lib.display());
             let metadata = match get_metadata_section(self.os, &lib) {
                 Ok(blob) => {
-                    if self.crate_matches(blob.as_slice()) {
+                    if self.crate_matches(blob.as_slice(), &lib) {
                         blob
                     } else {
                         info!("metadata mismatch");
@@ -325,7 +365,7 @@ impl<'a> Context<'a> {
         return if error > 0 {None} else {ret}
     }
 
-    fn crate_matches(&mut self, crate_data: &[u8]) -> bool {
+    fn crate_matches(&mut self, crate_data: &[u8], libpath: &Path) -> bool {
         match decoder::maybe_get_crate_id(crate_data) {
             Some(ref id) if self.crate_id.matches(id) => {}
             _ => return false
@@ -337,7 +377,7 @@ impl<'a> Context<'a> {
             None => true,
             Some(myhash) => {
                 if *myhash != hash {
-                    self.rejected_via_hash = true;
+                    self.rejected_via_hash.push(HashMismatch{ path: libpath.clone() });
                     false
                 } else {
                     true
@@ -438,8 +478,9 @@ fn get_metadata_section_imp(os: Os, filename: &Path) -> Result<MetadataBlob, ~st
         };
         let si = mk_section_iter(of.llof);
         while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False {
-            let name_buf = llvm::LLVMGetSectionName(si.llsi);
-            let name = str::raw::from_c_str(name_buf);
+            let mut name_buf = ptr::null();
+            let name_len = llvm::LLVMRustGetSectionName(si.llsi, &mut name_buf);
+            let name = str::raw::from_buf_len(name_buf as *u8, name_len as uint);
             debug!("get_metadata_section: name {}", name);
             if read_meta_section_name(os) == name {
                 let cbuf = llvm::LLVMGetSectionContents(si.llsi);
diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs
index 9ee2779079c..409957b8625 100644
--- a/src/librustc/metadata/tydecode.rs
+++ b/src/librustc/metadata/tydecode.rs
@@ -14,13 +14,12 @@
 // tjc note: Would be great to have a `match check` macro equivalent
 // for some of these
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use middle::ty;
 
 use std::str;
 use std::uint;
-use syntax::abi::AbiSet;
 use syntax::abi;
 use syntax::ast;
 use syntax::ast::*;
@@ -460,18 +459,12 @@ fn parse_purity(c: char) -> Purity {
     }
 }
 
-fn parse_abi_set(st: &mut PState) -> AbiSet {
+fn parse_abi_set(st: &mut PState) -> abi::Abi {
     assert_eq!(next(st), '[');
-    let mut abis = AbiSet::empty();
-    while peek(st) != ']' {
-         scan(st, |c| c == ',', |bytes| {
-                 let abi_str = str::from_utf8(bytes).unwrap().to_owned();
-                 let abi = abi::lookup(abi_str).expect(abi_str);
-                 abis.add(abi);
-              });
-    }
-    assert_eq!(next(st), ']');
-    return abis;
+    scan(st, |c| c == ']', |bytes| {
+        let abi_str = str::from_utf8(bytes).unwrap().to_owned();
+        abi::lookup(abi_str).expect(abi_str)
+    })
 }
 
 fn parse_onceness(c: char) -> ast::Onceness {
@@ -505,7 +498,7 @@ fn parse_bare_fn_ty(st: &mut PState, conv: conv_did) -> ty::BareFnTy {
     let sig = parse_sig(st, |x,y| conv(x,y));
     ty::BareFnTy {
         purity: purity,
-        abis: abi,
+        abi: abi,
         sig: sig
     }
 }
@@ -591,7 +584,7 @@ fn parse_bounds(st: &mut PState, conv: conv_did) -> ty::ParamBounds {
                 param_bounds.builtin_bounds.add(ty::BoundSized);
             }
             'P' => {
-                param_bounds.builtin_bounds.add(ty::BoundPod);
+                param_bounds.builtin_bounds.add(ty::BoundCopy);
             }
             'T' => {
                 param_bounds.builtin_bounds.add(ty::BoundShare);
diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs
index 5b3c2962ac0..4053db72a28 100644
--- a/src/librustc/metadata/tyencode.rs
+++ b/src/librustc/metadata/tyencode.rs
@@ -10,8 +10,8 @@
 
 // Type encoding
 
-#[allow(unused_must_use)]; // as with encoding, everything is a no-fail MemWriter
-#[allow(non_camel_case_types)];
+#![allow(unused_must_use)] // as with encoding, everything is a no-fail MemWriter
+#![allow(non_camel_case_types)]
 
 use std::cell::RefCell;
 use collections::HashMap;
@@ -23,7 +23,7 @@ use std::fmt;
 use middle::ty::param_ty;
 use middle::ty;
 
-use syntax::abi::AbiSet;
+use syntax::abi::Abi;
 use syntax::ast;
 use syntax::ast::*;
 use syntax::diagnostic::SpanHandler;
@@ -34,12 +34,12 @@ macro_rules! mywrite( ($wr:expr, $($arg:tt)*) => (
 ) )
 
 pub struct ctxt<'a> {
-    diag: &'a SpanHandler,
+    pub diag: &'a SpanHandler,
     // Def -> str Callback:
-    ds: fn(DefId) -> ~str,
+    pub ds: fn(DefId) -> ~str,
     // The type context.
-    tcx: &'a ty::ctxt,
-    abbrevs: abbrev_ctxt
+    pub tcx: &'a ty::ctxt,
+    pub abbrevs: abbrev_ctxt
 }
 
 // Compact string representation for ty.t values. API ty_str & parse_from_str.
@@ -341,12 +341,9 @@ fn enc_purity(w: &mut MemWriter, p: Purity) {
     }
 }
 
-fn enc_abi_set(w: &mut MemWriter, abis: AbiSet) {
+fn enc_abi(w: &mut MemWriter, abi: Abi) {
     mywrite!(w, "[");
-    abis.each(|abi| {
-        mywrite!(w, "{},", abi.name());
-        true
-    });
+    mywrite!(w, "{}", abi.name());
     mywrite!(w, "]")
 }
 
@@ -359,7 +356,7 @@ fn enc_onceness(w: &mut MemWriter, o: Onceness) {
 
 pub fn enc_bare_fn_ty(w: &mut MemWriter, cx: &ctxt, ft: &ty::BareFnTy) {
     enc_purity(w, ft.purity);
-    enc_abi_set(w, ft.abis);
+    enc_abi(w, ft.abi);
     enc_fn_sig(w, cx, &ft.sig);
 }
 
@@ -394,7 +391,7 @@ fn enc_bounds(w: &mut MemWriter, cx: &ctxt, bs: &ty::ParamBounds) {
             ty::BoundSend => mywrite!(w, "S"),
             ty::BoundStatic => mywrite!(w, "O"),
             ty::BoundSized => mywrite!(w, "Z"),
-            ty::BoundPod => mywrite!(w, "P"),
+            ty::BoundCopy => mywrite!(w, "P"),
             ty::BoundShare => mywrite!(w, "T"),
         }
     }
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index 94947b95cd3..e6f6a87be4f 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
+// FIXME: remove this after snapshot, and Results are handled
+#![allow(unused_must_use)]
 
 use c = metadata::common;
 use cstore = metadata::cstore;
@@ -36,6 +38,7 @@ use std::libc;
 use std::cast;
 use std::cell::RefCell;
 use std::io::Seek;
+use std::io::MemWriter;
 use std::rc::Rc;
 
 use serialize::ebml::reader;
@@ -50,10 +53,10 @@ use writer = serialize::ebml::writer;
 
 // Auxiliary maps of things to be encoded
 pub struct Maps {
-    root_map: middle::borrowck::root_map,
-    method_map: middle::typeck::MethodMap,
-    vtable_map: middle::typeck::vtable_map,
-    capture_map: RefCell<middle::moves::CaptureMap>,
+    pub root_map: middle::borrowck::root_map,
+    pub method_map: middle::typeck::MethodMap,
+    pub vtable_map: middle::typeck::vtable_map,
+    pub capture_map: RefCell<middle::moves::CaptureMap>,
 }
 
 struct DecodeContext<'a> {
@@ -76,11 +79,13 @@ trait tr_intern {
     fn tr_intern(&self, xcx: &ExtendedDecodeContext) -> ast::DefId;
 }
 
+pub type Encoder<'a> = writer::Encoder<'a, MemWriter>;
+
 // ______________________________________________________________________
 // Top-level methods.
 
 pub fn encode_inlined_item(ecx: &e::EncodeContext,
-                           ebml_w: &mut writer::Encoder,
+                           ebml_w: &mut Encoder,
                            ii: e::InlinedItemRef,
                            maps: &Maps) {
     let id = match ii {
@@ -106,13 +111,6 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
            ebml_w.writer.tell());
 }
 
-pub fn encode_exported_macro(ebml_w: &mut writer::Encoder, i: &ast::Item) {
-    match i.node {
-        ast::ItemMac(..) => encode_ast(ebml_w, ast::IIItem(@i.clone())),
-        _ => fail!("expected a macro")
-    }
-}
-
 pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
                            tcx: &ty::ctxt,
                            maps: &Maps,
@@ -136,7 +134,7 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
             path_as_str.as_ref().map(|x| x.as_slice())
         });
         let mut ast_dsr = reader::Decoder(ast_doc);
-        let from_id_range = Decodable::decode(&mut ast_dsr);
+        let from_id_range = Decodable::decode(&mut ast_dsr).unwrap();
         let to_id_range = reserve_id_range(&dcx.tcx.sess, from_id_range);
         let xcx = &ExtendedDecodeContext {
             dcx: dcx,
@@ -168,13 +166,6 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
     }
 }
 
-pub fn decode_exported_macro(par_doc: ebml::Doc) -> @ast::Item {
-    match decode_ast(par_doc) {
-        ast::IIItem(item) => item,
-        _ => fail!("expected item")
-    }
-}
-
 // ______________________________________________________________________
 // Enumerating the IDs which appear in an AST
 
@@ -272,9 +263,9 @@ trait def_id_encoder_helpers {
     fn emit_def_id(&mut self, did: ast::DefId);
 }
 
-impl<S:serialize::Encoder> def_id_encoder_helpers for S {
+impl<S:serialize::Encoder<E>, E> def_id_encoder_helpers for S {
     fn emit_def_id(&mut self, did: ast::DefId) {
-        did.encode(self)
+        did.encode(self).unwrap()
     }
 }
 
@@ -284,15 +275,15 @@ trait def_id_decoder_helpers {
                          cdata: @cstore::crate_metadata) -> ast::DefId;
 }
 
-impl<D:serialize::Decoder> def_id_decoder_helpers for D {
+impl<D:serialize::Decoder<E>, E> def_id_decoder_helpers for D {
     fn read_def_id(&mut self, xcx: &ExtendedDecodeContext) -> ast::DefId {
-        let did: ast::DefId = Decodable::decode(self);
+        let did: ast::DefId = Decodable::decode(self).unwrap();
         did.tr(xcx)
     }
 
     fn read_def_id_noxcx(&mut self,
                          cdata: @cstore::crate_metadata) -> ast::DefId {
-        let did: ast::DefId = Decodable::decode(self);
+        let did: ast::DefId = Decodable::decode(self).unwrap();
         decoder::translate_def_id(cdata, did)
     }
 }
@@ -312,7 +303,7 @@ impl<D:serialize::Decoder> def_id_decoder_helpers for D {
 // We also have to adjust the spans: for now we just insert a dummy span,
 // but eventually we should add entries to the local codemap as required.
 
-fn encode_ast(ebml_w: &mut writer::Encoder, item: ast::InlinedItem) {
+fn encode_ast(ebml_w: &mut Encoder, item: ast::InlinedItem) {
     ebml_w.start_tag(c::tag_tree as uint);
     item.encode(ebml_w);
     ebml_w.end_tag();
@@ -372,7 +363,7 @@ fn simplify_ast(ii: e::InlinedItemRef) -> ast::InlinedItem {
 fn decode_ast(par_doc: ebml::Doc) -> ast::InlinedItem {
     let chi_doc = par_doc.get(c::tag_tree as uint);
     let mut d = reader::Decoder(chi_doc);
-    Decodable::decode(&mut d)
+    Decodable::decode(&mut d).unwrap()
 }
 
 struct AstRenumberer<'a> {
@@ -418,7 +409,7 @@ fn renumber_and_map_ast(xcx: &ExtendedDecodeContext,
 
 fn decode_def(xcx: &ExtendedDecodeContext, doc: ebml::Doc) -> ast::Def {
     let mut dsr = reader::Decoder(doc);
-    let def: ast::Def = Decodable::decode(&mut dsr);
+    let def: ast::Def = Decodable::decode(&mut dsr).unwrap();
     def.tr(xcx)
 }
 
@@ -525,8 +516,8 @@ impl tr for ty::BoundRegion {
 // ______________________________________________________________________
 // Encoding and decoding of freevar information
 
-fn encode_freevar_entry(ebml_w: &mut writer::Encoder, fv: @freevar_entry) {
-    (*fv).encode(ebml_w)
+fn encode_freevar_entry(ebml_w: &mut Encoder, fv: @freevar_entry) {
+    (*fv).encode(ebml_w).unwrap();
 }
 
 trait ebml_decoder_helper {
@@ -537,7 +528,7 @@ trait ebml_decoder_helper {
 impl<'a> ebml_decoder_helper for reader::Decoder<'a> {
     fn read_freevar_entry(&mut self, xcx: &ExtendedDecodeContext)
                           -> freevar_entry {
-        let fv: freevar_entry = Decodable::decode(self);
+        let fv: freevar_entry = Decodable::decode(self).unwrap();
         fv.tr(xcx)
     }
 }
@@ -562,7 +553,7 @@ trait capture_var_helper {
 impl<'a> capture_var_helper for reader::Decoder<'a> {
     fn read_capture_var(&mut self, xcx: &ExtendedDecodeContext)
                         -> moves::CaptureVar {
-        let cvar: moves::CaptureVar = Decodable::decode(self);
+        let cvar: moves::CaptureVar = Decodable::decode(self).unwrap();
         cvar.tr(xcx)
     }
 }
@@ -585,23 +576,23 @@ trait read_method_callee_helper {
 }
 
 fn encode_method_callee(ecx: &e::EncodeContext,
-                        ebml_w: &mut writer::Encoder,
+                        ebml_w: &mut Encoder,
                         autoderef: u32,
                         method: &MethodCallee) {
     ebml_w.emit_struct("MethodCallee", 4, |ebml_w| {
         ebml_w.emit_struct_field("autoderef", 0u, |ebml_w| {
-            autoderef.encode(ebml_w);
+            autoderef.encode(ebml_w)
         });
         ebml_w.emit_struct_field("origin", 1u, |ebml_w| {
-            method.origin.encode(ebml_w);
+            method.origin.encode(ebml_w)
         });
         ebml_w.emit_struct_field("ty", 2u, |ebml_w| {
-            ebml_w.emit_ty(ecx, method.ty);
+            Ok(ebml_w.emit_ty(ecx, method.ty))
         });
         ebml_w.emit_struct_field("substs", 3u, |ebml_w| {
-            ebml_w.emit_substs(ecx, &method.substs);
-        });
-    })
+            Ok(ebml_w.emit_substs(ecx, &method.substs))
+        })
+    }).unwrap();
 }
 
 impl<'a> read_method_callee_helper for reader::Decoder<'a> {
@@ -609,21 +600,21 @@ impl<'a> read_method_callee_helper for reader::Decoder<'a> {
         self.read_struct("MethodCallee", 4, |this| {
             let autoderef = this.read_struct_field("autoderef", 0, |this| {
                 Decodable::decode(this)
-            });
-            (autoderef, MethodCallee {
+            }).unwrap();
+            Ok((autoderef, MethodCallee {
                 origin: this.read_struct_field("origin", 1, |this| {
                     let method_origin: MethodOrigin =
-                        Decodable::decode(this);
-                    method_origin.tr(xcx)
-                }),
+                        Decodable::decode(this).unwrap();
+                    Ok(method_origin.tr(xcx))
+                }).unwrap(),
                 ty: this.read_struct_field("ty", 2, |this| {
-                    this.read_ty(xcx)
-                }),
+                    Ok(this.read_ty(xcx))
+                }).unwrap(),
                 substs: this.read_struct_field("substs", 3, |this| {
-                    this.read_substs(xcx)
-                })
-            })
-        })
+                    Ok(this.read_substs(xcx))
+                }).unwrap()
+            }))
+        }).unwrap()
     }
 }
 
@@ -655,70 +646,70 @@ impl tr for MethodOrigin {
 // Encoding and decoding vtable_res
 
 fn encode_vtable_res_with_key(ecx: &e::EncodeContext,
-                              ebml_w: &mut writer::Encoder,
+                              ebml_w: &mut Encoder,
                               autoderef: u32,
                               dr: typeck::vtable_res) {
     ebml_w.emit_struct("VtableWithKey", 2, |ebml_w| {
         ebml_w.emit_struct_field("autoderef", 0u, |ebml_w| {
-            autoderef.encode(ebml_w);
+            autoderef.encode(ebml_w)
         });
         ebml_w.emit_struct_field("vtable_res", 1u, |ebml_w| {
-            encode_vtable_res(ecx, ebml_w, dr);
-        });
-    })
+            Ok(encode_vtable_res(ecx, ebml_w, dr))
+        })
+    }).unwrap()
 }
 
 pub fn encode_vtable_res(ecx: &e::EncodeContext,
-                     ebml_w: &mut writer::Encoder,
+                     ebml_w: &mut Encoder,
                      dr: typeck::vtable_res) {
     // can't autogenerate this code because automatic code of
     // ty::t doesn't work, and there is no way (atm) to have
     // hand-written encoding routines combine with auto-generated
     // ones.  perhaps we should fix this.
     ebml_w.emit_from_vec(dr.as_slice(), |ebml_w, param_tables| {
-        encode_vtable_param_res(ecx, ebml_w, *param_tables);
-    })
+        Ok(encode_vtable_param_res(ecx, ebml_w, *param_tables))
+    }).unwrap()
 }
 
 pub fn encode_vtable_param_res(ecx: &e::EncodeContext,
-                     ebml_w: &mut writer::Encoder,
+                     ebml_w: &mut Encoder,
                      param_tables: typeck::vtable_param_res) {
     ebml_w.emit_from_vec(param_tables.as_slice(), |ebml_w, vtable_origin| {
-        encode_vtable_origin(ecx, ebml_w, vtable_origin)
-    })
+        Ok(encode_vtable_origin(ecx, ebml_w, vtable_origin))
+    }).unwrap()
 }
 
 
 pub fn encode_vtable_origin(ecx: &e::EncodeContext,
-                        ebml_w: &mut writer::Encoder,
+                        ebml_w: &mut Encoder,
                         vtable_origin: &typeck::vtable_origin) {
     ebml_w.emit_enum("vtable_origin", |ebml_w| {
         match *vtable_origin {
           typeck::vtable_static(def_id, ref tys, vtable_res) => {
             ebml_w.emit_enum_variant("vtable_static", 0u, 3u, |ebml_w| {
                 ebml_w.emit_enum_variant_arg(0u, |ebml_w| {
-                    ebml_w.emit_def_id(def_id)
+                    Ok(ebml_w.emit_def_id(def_id))
                 });
                 ebml_w.emit_enum_variant_arg(1u, |ebml_w| {
-                    ebml_w.emit_tys(ecx, tys.as_slice());
+                    Ok(ebml_w.emit_tys(ecx, tys.as_slice()))
                 });
                 ebml_w.emit_enum_variant_arg(2u, |ebml_w| {
-                    encode_vtable_res(ecx, ebml_w, vtable_res);
+                    Ok(encode_vtable_res(ecx, ebml_w, vtable_res))
                 })
             })
           }
           typeck::vtable_param(pn, bn) => {
             ebml_w.emit_enum_variant("vtable_param", 1u, 2u, |ebml_w| {
                 ebml_w.emit_enum_variant_arg(0u, |ebml_w| {
-                    pn.encode(ebml_w);
+                    pn.encode(ebml_w)
                 });
                 ebml_w.emit_enum_variant_arg(1u, |ebml_w| {
-                    ebml_w.emit_uint(bn);
+                    ebml_w.emit_uint(bn)
                 })
             })
           }
         }
-    })
+    }).unwrap()
 }
 
 pub trait vtable_decoder_helpers {
@@ -745,18 +736,19 @@ impl<'a> vtable_decoder_helpers for reader::Decoder<'a> {
         self.read_struct("VtableWithKey", 2, |this| {
             let autoderef = this.read_struct_field("autoderef", 0, |this| {
                 Decodable::decode(this)
-            });
-            (autoderef, this.read_struct_field("vtable_res", 1, |this| {
-                this.read_vtable_res(tcx, cdata)
-            }))
-        })
+            }).unwrap();
+            Ok((autoderef, this.read_struct_field("vtable_res", 1, |this| {
+                Ok(this.read_vtable_res(tcx, cdata))
+            }).unwrap()))
+        }).unwrap()
     }
 
     fn read_vtable_res(&mut self,
                        tcx: &ty::ctxt, cdata: @cstore::crate_metadata)
                       -> typeck::vtable_res {
         @self.read_to_vec(|this|
-                          this.read_vtable_param_res(tcx, cdata))
+                          Ok(this.read_vtable_param_res(tcx, cdata)))
+             .unwrap()
              .move_iter()
              .collect()
     }
@@ -765,7 +757,8 @@ impl<'a> vtable_decoder_helpers for reader::Decoder<'a> {
                              tcx: &ty::ctxt, cdata: @cstore::crate_metadata)
                       -> typeck::vtable_param_res {
         @self.read_to_vec(|this|
-                          this.read_vtable_origin(tcx, cdata))
+                          Ok(this.read_vtable_origin(tcx, cdata)))
+             .unwrap()
              .move_iter()
              .collect()
     }
@@ -778,35 +771,35 @@ impl<'a> vtable_decoder_helpers for reader::Decoder<'a> {
                                     "vtable_param",
                                     "vtable_self"],
                                    |this, i| {
-                match i {
+                Ok(match i {
                   0 => {
                     typeck::vtable_static(
                         this.read_enum_variant_arg(0u, |this| {
-                            this.read_def_id_noxcx(cdata)
-                        }),
+                            Ok(this.read_def_id_noxcx(cdata))
+                        }).unwrap(),
                         this.read_enum_variant_arg(1u, |this| {
-                            this.read_tys_noxcx(tcx, cdata)
-                        }),
+                            Ok(this.read_tys_noxcx(tcx, cdata))
+                        }).unwrap(),
                         this.read_enum_variant_arg(2u, |this| {
-                            this.read_vtable_res(tcx, cdata)
-                        })
+                            Ok(this.read_vtable_res(tcx, cdata))
+                        }).unwrap()
                     )
                   }
                   1 => {
                     typeck::vtable_param(
                         this.read_enum_variant_arg(0u, |this| {
                             Decodable::decode(this)
-                        }),
+                        }).unwrap(),
                         this.read_enum_variant_arg(1u, |this| {
                             this.read_uint()
-                        })
+                        }).unwrap()
                     )
                   }
                   // hard to avoid - user input
                   _ => fail!("bad enum variant")
-                }
+                })
             })
-        })
+        }).unwrap()
     }
 }
 
@@ -842,27 +835,27 @@ trait ebml_writer_helpers {
     fn emit_auto_adjustment(&mut self, ecx: &e::EncodeContext, adj: &ty::AutoAdjustment);
 }
 
-impl<'a> ebml_writer_helpers for writer::Encoder<'a> {
+impl<'a> ebml_writer_helpers for Encoder<'a> {
     fn emit_ty(&mut self, ecx: &e::EncodeContext, ty: ty::t) {
-        self.emit_opaque(|this| e::write_type(ecx, this, ty))
+        self.emit_opaque(|this| Ok(e::write_type(ecx, this, ty)));
     }
 
     fn emit_vstore(&mut self, ecx: &e::EncodeContext, vstore: ty::vstore) {
-        self.emit_opaque(|this| e::write_vstore(ecx, this, vstore))
+        self.emit_opaque(|this| Ok(e::write_vstore(ecx, this, vstore)));
     }
 
     fn emit_tys(&mut self, ecx: &e::EncodeContext, tys: &[ty::t]) {
-        self.emit_from_vec(tys, |this, ty| this.emit_ty(ecx, *ty))
+        self.emit_from_vec(tys, |this, ty| Ok(this.emit_ty(ecx, *ty)));
     }
 
     fn emit_type_param_def(&mut self,
                            ecx: &e::EncodeContext,
                            type_param_def: &ty::TypeParameterDef) {
         self.emit_opaque(|this| {
-            tyencode::enc_type_param_def(this.writer,
+            Ok(tyencode::enc_type_param_def(this.writer,
                                          &ecx.ty_str_ctxt(),
-                                         type_param_def)
-        })
+                                         type_param_def))
+        });
     }
 
     fn emit_tpbt(&mut self,
@@ -874,22 +867,24 @@ impl<'a> ebml_writer_helpers for writer::Encoder<'a> {
                     this.emit_struct_field("type_param_defs", 0, |this| {
                         this.emit_from_vec(tpbt.generics.type_param_defs(),
                                            |this, type_param_def| {
-                            this.emit_type_param_def(ecx, type_param_def);
+                            Ok(this.emit_type_param_def(ecx, type_param_def))
                         })
                     });
                     this.emit_struct_field("region_param_defs", 1, |this| {
-                        tpbt.generics.region_param_defs().encode(this);
+                        tpbt.generics.region_param_defs().encode(this)
                     })
                 })
             });
             this.emit_struct_field("ty", 1, |this| {
-                this.emit_ty(ecx, tpbt.ty);
+                Ok(this.emit_ty(ecx, tpbt.ty))
             })
-        })
+        });
     }
 
     fn emit_substs(&mut self, ecx: &e::EncodeContext, substs: &ty::substs) {
-        self.emit_opaque(|this| tyencode::enc_substs(this.writer, &ecx.ty_str_ctxt(), substs))
+        self.emit_opaque(|this| Ok(tyencode::enc_substs(this.writer,
+                                                           &ecx.ty_str_ctxt(),
+                                                           substs)));
     }
 
     fn emit_auto_adjustment(&mut self, ecx: &e::EncodeContext, adj: &ty::AutoAdjustment) {
@@ -898,14 +893,14 @@ impl<'a> ebml_writer_helpers for writer::Encoder<'a> {
                 ty::AutoAddEnv(region, sigil) => {
                     this.emit_enum_variant("AutoAddEnv", 0, 2, |this| {
                         this.emit_enum_variant_arg(0, |this| region.encode(this));
-                        this.emit_enum_variant_arg(1, |this| sigil.encode(this));
-                    });
+                        this.emit_enum_variant_arg(1, |this| sigil.encode(this))
+                    })
                 }
 
                 ty::AutoDerefRef(ref auto_deref_ref) => {
                     this.emit_enum_variant("AutoDerefRef", 1, 1, |this| {
-                        this.emit_enum_variant_arg(0, |this| auto_deref_ref.encode(this));
-                    });
+                        this.emit_enum_variant_arg(0, |this| auto_deref_ref.encode(this))
+                    })
                 }
 
                 ty::AutoObject(sigil, region, m, b, def_id, ref substs) => {
@@ -915,8 +910,8 @@ impl<'a> ebml_writer_helpers for writer::Encoder<'a> {
                         this.emit_enum_variant_arg(2, |this| m.encode(this));
                         this.emit_enum_variant_arg(3, |this| b.encode(this));
                         this.emit_enum_variant_arg(4, |this| def_id.encode(this));
-                        this.emit_enum_variant_arg(5, |this| this.emit_substs(ecx, substs));
-                    });
+                        this.emit_enum_variant_arg(5, |this| Ok(this.emit_substs(ecx, substs)))
+                    })
                 }
             }
         });
@@ -928,23 +923,23 @@ trait write_tag_and_id {
     fn id(&mut self, id: ast::NodeId);
 }
 
-impl<'a> write_tag_and_id for writer::Encoder<'a> {
+impl<'a> write_tag_and_id for Encoder<'a> {
     fn tag(&mut self,
            tag_id: c::astencode_tag,
-           f: |&mut writer::Encoder<'a>|) {
+           f: |&mut Encoder<'a>|) {
         self.start_tag(tag_id as uint);
         f(self);
         self.end_tag();
     }
 
     fn id(&mut self, id: ast::NodeId) {
-        self.wr_tagged_u64(c::tag_table_id as uint, id as u64)
+        self.wr_tagged_u64(c::tag_table_id as uint, id as u64);
     }
 }
 
 struct SideTableEncodingIdVisitor<'a,'b> {
     ecx_ptr: *libc::c_void,
-    new_ebml_w: &'a mut writer::Encoder<'b>,
+    new_ebml_w: &'a mut Encoder<'b>,
     maps: &'a Maps,
 }
 
@@ -969,7 +964,7 @@ impl<'a,'b> ast_util::IdVisitingOperation for
 
 fn encode_side_tables_for_ii(ecx: &e::EncodeContext,
                              maps: &Maps,
-                             ebml_w: &mut writer::Encoder,
+                             ebml_w: &mut Encoder,
                              ii: &ast::InlinedItem) {
     ebml_w.start_tag(c::tag_table as uint);
     let mut new_ebml_w = unsafe {
@@ -991,7 +986,7 @@ fn encode_side_tables_for_ii(ecx: &e::EncodeContext,
 
 fn encode_side_tables_for_id(ecx: &e::EncodeContext,
                              maps: &Maps,
-                             ebml_w: &mut writer::Encoder,
+                             ebml_w: &mut Encoder,
                              id: ast::NodeId) {
     let tcx = ecx.tcx;
 
@@ -1000,7 +995,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
     for def in tcx.def_map.borrow().find(&id).iter() {
         ebml_w.tag(c::tag_table_def, |ebml_w| {
             ebml_w.id(id);
-            ebml_w.tag(c::tag_table_val, |ebml_w| (*def).encode(ebml_w));
+            ebml_w.tag(c::tag_table_val, |ebml_w| (*def).encode(ebml_w).unwrap());
         })
     }
 
@@ -1027,8 +1022,8 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
             ebml_w.id(id);
             ebml_w.tag(c::tag_table_val, |ebml_w| {
                 ebml_w.emit_from_vec(fv.as_slice(), |ebml_w, fv_entry| {
-                    encode_freevar_entry(ebml_w, *fv_entry)
-                })
+                    Ok(encode_freevar_entry(ebml_w, *fv_entry))
+                });
             })
         })
     }
@@ -1112,8 +1107,8 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
             ebml_w.id(id);
             ebml_w.tag(c::tag_table_val, |ebml_w| {
                 ebml_w.emit_from_vec(cap_vars.as_slice(), |ebml_w, cap_var| {
-                    cap_var.encode(ebml_w);
-                })
+                    cap_var.encode(ebml_w)
+                });
             })
         })
     }
@@ -1159,19 +1154,20 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
     fn read_ty_noxcx(&mut self,
                      tcx: &ty::ctxt, cdata: @cstore::crate_metadata) -> ty::t {
         self.read_opaque(|_, doc| {
-            tydecode::parse_ty_data(
+            Ok(tydecode::parse_ty_data(
                 doc.data,
                 cdata.cnum,
                 doc.start,
                 tcx,
-                |_, id| decoder::translate_def_id(cdata, id))
-        })
+                |_, id| decoder::translate_def_id(cdata, id)))
+        }).unwrap()
     }
 
     fn read_tys_noxcx(&mut self,
                       tcx: &ty::ctxt,
                       cdata: @cstore::crate_metadata) -> Vec<ty::t> {
-        self.read_to_vec(|this| this.read_ty_noxcx(tcx, cdata) )
+        self.read_to_vec(|this| Ok(this.read_ty_noxcx(tcx, cdata)) )
+            .unwrap()
             .move_iter()
             .collect()
     }
@@ -1192,8 +1188,8 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
                 xcx.dcx.tcx,
                 |s, a| this.convert_def_id(xcx, s, a));
 
-            ty
-        });
+            Ok(ty)
+        }).unwrap();
 
         fn type_string(doc: ebml::Doc) -> ~str {
             let mut str = ~"";
@@ -1205,94 +1201,96 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
     }
 
     fn read_tys(&mut self, xcx: &ExtendedDecodeContext) -> Vec<ty::t> {
-        self.read_to_vec(|this| this.read_ty(xcx)).move_iter().collect()
+        self.read_to_vec(|this| Ok(this.read_ty(xcx))).unwrap().move_iter().collect()
     }
 
     fn read_type_param_def(&mut self, xcx: &ExtendedDecodeContext)
                            -> ty::TypeParameterDef {
         self.read_opaque(|this, doc| {
-            tydecode::parse_type_param_def_data(
+            Ok(tydecode::parse_type_param_def_data(
                 doc.data,
                 doc.start,
                 xcx.dcx.cdata.cnum,
                 xcx.dcx.tcx,
-                |s, a| this.convert_def_id(xcx, s, a))
-        })
+                |s, a| this.convert_def_id(xcx, s, a)))
+        }).unwrap()
     }
 
     fn read_ty_param_bounds_and_ty(&mut self, xcx: &ExtendedDecodeContext)
                                    -> ty::ty_param_bounds_and_ty {
         self.read_struct("ty_param_bounds_and_ty", 2, |this| {
-            ty::ty_param_bounds_and_ty {
+            Ok(ty::ty_param_bounds_and_ty {
                 generics: this.read_struct_field("generics", 0, |this| {
                     this.read_struct("Generics", 2, |this| {
-                        ty::Generics {
+                        Ok(ty::Generics {
                             type_param_defs:
                                 this.read_struct_field("type_param_defs",
                                                        0,
                                                        |this| {
-                                    Rc::new(this.read_to_vec(|this|
-                                                             this.read_type_param_def(xcx))
+                                    Ok(Rc::new(this.read_to_vec(|this|
+                                                             Ok(this.read_type_param_def(xcx)))
+                                                .unwrap()
                                                 .move_iter()
-                                                .collect())
-                            }),
+                                                .collect()))
+                            }).unwrap(),
                             region_param_defs:
                                 this.read_struct_field("region_param_defs",
                                                        1,
                                                        |this| {
                                     Decodable::decode(this)
-                                })
-                        }
+                                }).unwrap()
+                        })
                     })
-                }),
+                }).unwrap(),
                 ty: this.read_struct_field("ty", 1, |this| {
-                    this.read_ty(xcx)
-                })
-            }
-        })
+                    Ok(this.read_ty(xcx))
+                }).unwrap()
+            })
+        }).unwrap()
     }
 
     fn read_substs(&mut self, xcx: &ExtendedDecodeContext) -> ty::substs {
         self.read_opaque(|this, doc| {
-            tydecode::parse_substs_data(doc.data,
+            Ok(tydecode::parse_substs_data(doc.data,
                                         xcx.dcx.cdata.cnum,
                                         doc.start,
                                         xcx.dcx.tcx,
-                                        |s, a| this.convert_def_id(xcx, s, a))
-        })
+                                        |s, a| this.convert_def_id(xcx, s, a)))
+        }).unwrap()
     }
 
     fn read_auto_adjustment(&mut self, xcx: &ExtendedDecodeContext) -> ty::AutoAdjustment {
         self.read_enum("AutoAdjustment", |this| {
             let variants = ["AutoAddEnv", "AutoDerefRef", "AutoObject"];
             this.read_enum_variant(variants, |this, i| {
-                match i {
+                Ok(match i {
                     0 => {
                         let region: ty::Region =
-                            this.read_enum_variant_arg(0, |this| Decodable::decode(this));
+                            this.read_enum_variant_arg(0, |this| Decodable::decode(this)).unwrap();
                         let sigil: ast::Sigil =
-                            this.read_enum_variant_arg(1, |this| Decodable::decode(this));
+                            this.read_enum_variant_arg(1, |this| Decodable::decode(this)).unwrap();
 
                         ty:: AutoAddEnv(region.tr(xcx), sigil)
                     }
                     1 => {
                         let auto_deref_ref: ty::AutoDerefRef =
-                            this.read_enum_variant_arg(0, |this| Decodable::decode(this));
+                            this.read_enum_variant_arg(0, |this| Decodable::decode(this)).unwrap();
 
                         ty::AutoDerefRef(auto_deref_ref.tr(xcx))
                     }
                     2 => {
                         let sigil: ast::Sigil =
-                            this.read_enum_variant_arg(0, |this| Decodable::decode(this));
+                            this.read_enum_variant_arg(0, |this| Decodable::decode(this)).unwrap();
                         let region: Option<ty::Region> =
-                            this.read_enum_variant_arg(1, |this| Decodable::decode(this));
+                            this.read_enum_variant_arg(1, |this| Decodable::decode(this)).unwrap();
                         let m: ast::Mutability =
-                            this.read_enum_variant_arg(2, |this| Decodable::decode(this));
+                            this.read_enum_variant_arg(2, |this| Decodable::decode(this)).unwrap();
                         let b: ty::BuiltinBounds =
-                            this.read_enum_variant_arg(3, |this| Decodable::decode(this));
+                            this.read_enum_variant_arg(3, |this| Decodable::decode(this)).unwrap();
                         let def_id: ast::DefId =
-                            this.read_enum_variant_arg(4, |this| Decodable::decode(this));
-                        let substs = this.read_enum_variant_arg(5, |this| this.read_substs(xcx));
+                            this.read_enum_variant_arg(4, |this| Decodable::decode(this)).unwrap();
+                        let substs = this.read_enum_variant_arg(5, |this| Ok(this.read_substs(xcx)))
+                                    .unwrap();
 
                         let region = match region {
                             Some(r) => Some(r.tr(xcx)),
@@ -1302,9 +1300,9 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
                         ty::AutoObject(sigil, region, m, b, def_id.tr(xcx), substs)
                     }
                     _ => fail!("bad enum variant for ty::AutoAdjustment")
-                }
+                })
             })
-        })
+        }).unwrap()
     }
 
     fn convert_def_id(&mut self,
@@ -1388,8 +1386,8 @@ fn decode_side_tables(xcx: &ExtendedDecodeContext,
                     }
                     c::tag_table_freevars => {
                         let fv_info = @val_dsr.read_to_vec(|val_dsr| {
-                            @val_dsr.read_freevar_entry(xcx)
-                        }).move_iter().collect();
+                            Ok(@val_dsr.read_freevar_entry(xcx))
+                        }).unwrap().move_iter().collect();
                         dcx.tcx.freevars.borrow_mut().insert(id, fv_info);
                     }
                     c::tag_table_tcache => {
@@ -1425,7 +1423,9 @@ fn decode_side_tables(xcx: &ExtendedDecodeContext,
                     }
                     c::tag_table_capture_map => {
                         let cvars =
-                                val_dsr.read_to_vec(|val_dsr| val_dsr.read_capture_var(xcx))
+                                val_dsr.read_to_vec(
+                                            |val_dsr| Ok(val_dsr.read_capture_var(xcx)))
+                                       .unwrap()
                                        .move_iter()
                                        .collect();
                         dcx.maps.capture_map.borrow_mut().insert(id, Rc::new(cvars));
@@ -1447,7 +1447,7 @@ fn decode_side_tables(xcx: &ExtendedDecodeContext,
 // Testing of astencode_gen
 
 #[cfg(test)]
-fn encode_item_ast(ebml_w: &mut writer::Encoder, item: @ast::Item) {
+fn encode_item_ast(ebml_w: &mut Encoder, item: @ast::Item) {
     ebml_w.start_tag(c::tag_tree as uint);
     (*item).encode(ebml_w);
     ebml_w.end_tag();
@@ -1457,7 +1457,7 @@ fn encode_item_ast(ebml_w: &mut writer::Encoder, item: @ast::Item) {
 fn decode_item_ast(par_doc: ebml::Doc) -> @ast::Item {
     let chi_doc = par_doc.get(c::tag_tree as uint);
     let mut d = reader::Decoder(chi_doc);
-    @Decodable::decode(&mut d)
+    @Decodable::decode(&mut d).unwrap()
 }
 
 #[cfg(test)]
diff --git a/src/librustc/middle/borrowck/gather_loans/restrictions.rs b/src/librustc/middle/borrowck/gather_loans/restrictions.rs
index 39ec183da45..39ea9e17b26 100644
--- a/src/librustc/middle/borrowck/gather_loans/restrictions.rs
+++ b/src/librustc/middle/borrowck/gather_loans/restrictions.rs
@@ -12,7 +12,6 @@
  * Computes the restrictions that result from a borrow.
  */
 
-use std::vec;
 use middle::borrowck::*;
 use mc = middle::mem_categorization;
 use middle::ty;
@@ -173,11 +172,7 @@ impl<'a> RestrictionsContext<'a> {
             Safe => Safe,
             SafeIf(base_lp, base_vec) => {
                 let lp = @LpExtend(base_lp, mc, elem);
-                SafeIf(lp, vec::append_one(base_vec,
-                                              Restriction {
-                                                  loan_path: lp,
-                                                  set: restrictions
-                                              }))
+                SafeIf(lp, base_vec.append_one(Restriction { loan_path: lp, set: restrictions }))
             }
         }
     }
diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs
index d7d936a7048..6f4f2f6345e 100644
--- a/src/librustc/middle/borrowck/mod.rs
+++ b/src/librustc/middle/borrowck/mod.rs
@@ -10,7 +10,7 @@
 
 /*! See doc.rs for a thorough explanation of the borrow checker */
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use mc = middle::mem_categorization;
 use middle::ty;
@@ -207,8 +207,8 @@ pub struct BorrowStats {
 // is T, which is not a box.
 #[deriving(Eq, TotalEq, Hash)]
 pub struct root_map_key {
-    id: ast::NodeId,
-    derefs: uint
+    pub id: ast::NodeId,
+    pub derefs: uint
 }
 
 pub type BckResult<T> = Result<T, BckError>;
@@ -326,6 +326,7 @@ pub struct RestrictionSet {
     bits: u32
 }
 
+#[allow(dead_code)] // potentially useful
 pub static RESTR_EMPTY: RestrictionSet  = RestrictionSet {bits: 0b0000};
 pub static RESTR_MUTATE: RestrictionSet = RestrictionSet {bits: 0b0001};
 pub static RESTR_FREEZE: RestrictionSet = RestrictionSet {bits: 0b0010};
@@ -334,10 +335,6 @@ impl RestrictionSet {
     pub fn intersects(&self, restr: RestrictionSet) -> bool {
         (self.bits & restr.bits) != 0
     }
-
-    pub fn contains_all(&self, restr: RestrictionSet) -> bool {
-        (self.bits & restr.bits) == restr.bits
-    }
 }
 
 impl BitOr<RestrictionSet,RestrictionSet> for RestrictionSet {
@@ -378,7 +375,7 @@ impl Repr for RestrictionSet {
 // uncovered after a certain number of auto-derefs.
 
 pub struct RootInfo {
-    scope: ast::NodeId,
+    pub scope: ast::NodeId,
 }
 
 pub type root_map = @RefCell<HashMap<root_map_key, RootInfo>>;
@@ -862,17 +859,6 @@ impl<'a> BorrowckCtxt<'a> {
     pub fn cmt_to_str(&self, cmt: mc::cmt) -> ~str {
         self.mc().cmt_to_str(cmt)
     }
-
-    pub fn mut_to_str(&self, mutbl: ast::Mutability) -> ~str {
-        self.mc().mut_to_str(mutbl)
-    }
-
-    pub fn mut_to_keyword(&self, mutbl: ast::Mutability) -> &'static str {
-        match mutbl {
-            ast::MutImmutable => "",
-            ast::MutMutable => "mut",
-        }
-    }
 }
 
 impl DataFlowOperator for LoanDataFlowOperator {
diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs
index 22bacca5485..0e18946a3a1 100644
--- a/src/librustc/middle/borrowck/move_data.rs
+++ b/src/librustc/middle/borrowck/move_data.rs
@@ -30,37 +30,37 @@ use util::ppaux::Repr;
 
 pub struct MoveData {
     /// Move paths. See section "Move paths" in `doc.rs`.
-    paths: RefCell<Vec<MovePath>>,
+    pub paths: RefCell<Vec<MovePath>>,
 
     /// Cache of loan path to move path index, for easy lookup.
-    path_map: RefCell<HashMap<@LoanPath, MovePathIndex>>,
+    pub path_map: RefCell<HashMap<@LoanPath, MovePathIndex>>,
 
     /// Each move or uninitialized variable gets an entry here.
-    moves: RefCell<Vec<Move>>,
+    pub moves: RefCell<Vec<Move>>,
 
     /// Assignments to a variable, like `x = foo`. These are assigned
     /// bits for dataflow, since we must track them to ensure that
     /// immutable variables are assigned at most once along each path.
-    var_assignments: RefCell<Vec<Assignment>>,
+    pub var_assignments: RefCell<Vec<Assignment>>,
 
     /// Assignments to a path, like `x.f = foo`. These are not
     /// assigned dataflow bits, but we track them because they still
     /// kill move bits.
-    path_assignments: RefCell<Vec<Assignment>>,
+    pub path_assignments: RefCell<Vec<Assignment>>,
 
     /// Assignments to a variable or path, like `x = foo`, but not `x += foo`.
-    assignee_ids: RefCell<HashSet<ast::NodeId>>,
+    pub assignee_ids: RefCell<HashSet<ast::NodeId>>,
 }
 
 pub struct FlowedMoveData<'a> {
-    move_data: MoveData,
+    pub move_data: MoveData,
 
-    dfcx_moves: MoveDataFlow<'a>,
+    pub dfcx_moves: MoveDataFlow<'a>,
 
     // We could (and maybe should, for efficiency) combine both move
     // and assign data flow into one, but this way it's easier to
     // distinguish the bits that correspond to moves and assignments.
-    dfcx_assign: AssignDataFlow<'a>
+    pub dfcx_assign: AssignDataFlow<'a>
 }
 
 /// Index into `MoveData.paths`, used like a pointer
@@ -97,21 +97,21 @@ static InvalidMoveIndex: MoveIndex =
 
 pub struct MovePath {
     /// Loan path corresponding to this move path
-    loan_path: @LoanPath,
+    pub loan_path: @LoanPath,
 
     /// Parent pointer, `InvalidMovePathIndex` if root
-    parent: MovePathIndex,
+    pub parent: MovePathIndex,
 
     /// Head of linked list of moves to this path,
     /// `InvalidMoveIndex` if not moved
-    first_move: MoveIndex,
+    pub first_move: MoveIndex,
 
     /// First node in linked list of children, `InvalidMovePathIndex` if leaf
-    first_child: MovePathIndex,
+    pub first_child: MovePathIndex,
 
     /// Next node in linked list of parent's children (siblings),
     /// `InvalidMovePathIndex` if none.
-    next_sibling: MovePathIndex,
+    pub next_sibling: MovePathIndex,
 }
 
 pub enum MoveKind {
@@ -123,27 +123,27 @@ pub enum MoveKind {
 
 pub struct Move {
     /// Path being moved.
-    path: MovePathIndex,
+    pub path: MovePathIndex,
 
     /// id of node that is doing the move.
-    id: ast::NodeId,
+    pub id: ast::NodeId,
 
     /// Kind of move, for error messages.
-    kind: MoveKind,
+    pub kind: MoveKind,
 
     /// Next node in linked list of moves from `path`, or `InvalidMoveIndex`
-    next_move: MoveIndex
+    pub next_move: MoveIndex
 }
 
 pub struct Assignment {
     /// Path being assigned.
-    path: MovePathIndex,
+    pub path: MovePathIndex,
 
     /// id where assignment occurs
-    id: ast::NodeId,
+    pub id: ast::NodeId,
 
     /// span of node where assignment occurs
-    span: Span,
+    pub span: Span,
 }
 
 pub struct MoveDataFlowOperator;
diff --git a/src/librustc/middle/cfg/construct.rs b/src/librustc/middle/cfg/construct.rs
index a66e9191b33..d631340fc4e 100644
--- a/src/librustc/middle/cfg/construct.rs
+++ b/src/librustc/middle/cfg/construct.rs
@@ -347,7 +347,7 @@ impl<'a> CFGBuilder<'a> {
                 self.add_node(expr.id, [])
             }
 
-            ast::ExprVec(ref elems, _) => {
+            ast::ExprVec(ref elems) => {
                 self.straightline(expr, pred, elems.as_slice())
             }
 
@@ -379,7 +379,7 @@ impl<'a> CFGBuilder<'a> {
                 self.straightline(expr, base_exit, field_exprs.as_slice())
             }
 
-            ast::ExprRepeat(elem, count, _) => {
+            ast::ExprRepeat(elem, count) => {
                 self.straightline(expr, pred, [elem, count])
             }
 
diff --git a/src/librustc/middle/cfg/mod.rs b/src/librustc/middle/cfg/mod.rs
index 9c2dcd74351..97ea996bb7e 100644
--- a/src/librustc/middle/cfg/mod.rs
+++ b/src/librustc/middle/cfg/mod.rs
@@ -15,6 +15,8 @@ Uses `Graph` as the underlying representation.
 
 */
 
+#![allow(dead_code)] // still a WIP, #6298
+
 use middle::graph;
 use middle::ty;
 use middle::typeck;
diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs
index 6d95202d2c1..e3a0a6a9782 100644
--- a/src/librustc/middle/check_const.rs
+++ b/src/librustc/middle/check_const.rs
@@ -157,7 +157,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr, is_const: bool) {
           }
           ExprVstore(_, ExprVstoreMutSlice) |
           ExprVstore(_, ExprVstoreSlice) |
-          ExprVec(_, MutImmutable) |
+          ExprVec(_) |
           ExprAddrOf(MutImmutable, _) |
           ExprParen(..) |
           ExprField(..) |
diff --git a/src/librustc/middle/check_loop.rs b/src/librustc/middle/check_loop.rs
index 4b99ce28505..4f08d818f4a 100644
--- a/src/librustc/middle/check_loop.rs
+++ b/src/librustc/middle/check_loop.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::ty;
+use driver::session::Session;
 
 use syntax::ast;
 use syntax::codemap::Span;
@@ -21,11 +21,11 @@ enum Context {
 }
 
 struct CheckLoopVisitor<'a> {
-    tcx: &'a ty::ctxt,
+    sess: &'a Session,
 }
 
-pub fn check_crate(tcx: &ty::ctxt, krate: &ast::Crate) {
-    visit::walk_crate(&mut CheckLoopVisitor { tcx: tcx }, krate, Normal)
+pub fn check_crate(sess: &Session, krate: &ast::Crate) {
+    visit::walk_crate(&mut CheckLoopVisitor { sess: sess }, krate, Normal)
 }
 
 impl<'a> Visitor<Context> for CheckLoopVisitor<'a> {
@@ -57,12 +57,10 @@ impl<'a> CheckLoopVisitor<'a> {
         match cx {
             Loop => {}
             Closure => {
-                self.tcx.sess.span_err(span, format!("`{}` inside of a closure",
-                                                     name));
+                self.sess.span_err(span, format!("`{}` inside of a closure", name));
             }
             Normal => {
-                self.tcx.sess.span_err(span, format!("`{}` outside of loop",
-                                                     name));
+                self.sess.span_err(span, format!("`{}` outside of loop", name));
             }
         }
     }
diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs
index 12c22edcd2e..c4cb76620bf 100644
--- a/src/librustc/middle/check_match.rs
+++ b/src/librustc/middle/check_match.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use middle::const_eval::{compare_const_vals, lookup_const_by_id};
 use middle::const_eval::{eval_const_expr, const_val, const_bool, const_float};
@@ -21,7 +21,6 @@ use util::ppaux::ty_to_str;
 
 use std::cmp;
 use std::iter;
-use std::vec;
 use syntax::ast::*;
 use syntax::ast_util::{unguarded_pat, walk_pat};
 use syntax::codemap::{DUMMY_SP, Span};
@@ -163,7 +162,7 @@ fn raw_pat(p: @Pat) -> @Pat {
 
 fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: Vec<@Pat> ) {
     assert!((!pats.is_empty()));
-    let ext = match is_useful(cx, &pats.map(|p| vec!(*p)), [wild()]) {
+    let ext = match is_useful(cx, &pats.iter().map(|p| vec!(*p)).collect(), [wild()]) {
         not_useful => {
             // This is good, wildcard pattern isn't reachable
             return;
@@ -560,11 +559,10 @@ fn specialize(cx: &MatchCheckCtxt,
         Pat{id: pat_id, node: n, span: pat_span} =>
             match n {
             PatWild => {
-                Some(vec::append(Vec::from_elem(arity, wild()), r.tail()))
+                Some(Vec::from_elem(arity, wild()).append(r.tail()))
             }
             PatWildMulti => {
-                Some(vec::append(Vec::from_elem(arity, wild_multi()),
-                                    r.tail()))
+                Some(Vec::from_elem(arity, wild_multi()).append(r.tail()))
             }
             PatIdent(_, _, _) => {
                 let opt_def = cx.tcx.def_map.borrow().find_copy(&pat_id);
@@ -615,12 +613,7 @@ fn specialize(cx: &MatchCheckCtxt,
                         }
                     }
                     _ => {
-                        Some(
-                            vec::append(
-                                Vec::from_elem(arity, wild()),
-                                r.tail()
-                            )
-                        )
+                        Some(Vec::from_elem(arity, wild()).append(r.tail()))
                     }
                 }
             }
@@ -667,7 +660,7 @@ fn specialize(cx: &MatchCheckCtxt,
                             Some(args) => args.iter().map(|x| *x).collect(),
                             None => Vec::from_elem(arity, wild())
                         };
-                        Some(vec::append(args, r.tail()))
+                        Some(args.append(r.tail()))
                     }
                     DefVariant(_, _, _) => None,
 
@@ -680,7 +673,7 @@ fn specialize(cx: &MatchCheckCtxt,
                             }
                             None => new_args = Vec::from_elem(arity, wild())
                         }
-                        Some(vec::append(new_args, r.tail()))
+                        Some(new_args.append(r.tail()))
                     }
                     _ => None
                 }
@@ -692,13 +685,13 @@ fn specialize(cx: &MatchCheckCtxt,
                     DefVariant(_, variant_id, _) => {
                         if variant(variant_id) == *ctor_id {
                             let struct_fields = ty::lookup_struct_fields(cx.tcx, variant_id);
-                            let args = struct_fields.map(|sf| {
+                            let args = struct_fields.iter().map(|sf| {
                                 match pattern_fields.iter().find(|f| f.ident.name == sf.name) {
                                     Some(f) => f.pat,
                                     _ => wild()
                                 }
-                            });
-                            Some(vec::append(args, r.tail()))
+                            }).collect::<Vec<_>>();
+                            Some(args.append(r.tail()))
                         } else {
                             None
                         }
@@ -728,16 +721,16 @@ fn specialize(cx: &MatchCheckCtxt,
                                 Some(f) => f.pat,
                                 _ => wild()
                             }
-                        }).collect();
-                        Some(vec::append(args, r.tail()))
+                        }).collect::<Vec<_>>();
+                        Some(args.append(r.tail()))
                     }
                 }
             }
             PatTup(args) => {
-                Some(vec::append(args.iter().map(|x| *x).collect(), r.tail()))
+                Some(args.iter().map(|x| *x).collect::<Vec<_>>().append(r.tail()))
             }
             PatUniq(a) | PatRegion(a) => {
-                Some(vec::append(vec!(a), r.tail()))
+                Some((vec!(a)).append(r.tail()))
             }
             PatLit(expr) => {
                 let e_v = eval_const_expr(cx.tcx, expr);
diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs
index 8d7cff98f42..aca8367f0b8 100644
--- a/src/librustc/middle/const_eval.rs
+++ b/src/librustc/middle/const_eval.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use metadata::csearch;
 use middle::astencode;
@@ -213,7 +213,7 @@ impl<'a> ConstEvalVisitor<'a> {
                 join(self.classify(a), self.classify(b)),
 
             ast::ExprTup(ref es) |
-            ast::ExprVec(ref es, ast::MutImmutable) =>
+            ast::ExprVec(ref es) =>
                 join_all(es.iter().map(|e| self.classify(*e))),
 
             ast::ExprVstore(e, vstore) => {
@@ -521,11 +521,3 @@ pub fn compare_const_vals(a: &const_val, b: &const_val) -> Option<int> {
 pub fn compare_lit_exprs(tcx: &ty::ctxt, a: &Expr, b: &Expr) -> Option<int> {
     compare_const_vals(&eval_const_expr(tcx, a), &eval_const_expr(tcx, b))
 }
-
-pub fn lit_expr_eq(tcx: &ty::ctxt, a: &Expr, b: &Expr) -> Option<bool> {
-    compare_lit_exprs(tcx, a, b).map(|val| val == 0)
-}
-
-pub fn lit_eq(a: &Lit, b: &Lit) -> Option<bool> {
-    compare_const_vals(&lit_to_const(a), &lit_to_const(b)).map(|val| val == 0)
-}
diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs
index 178688917e8..2ef1adba771 100644
--- a/src/librustc/middle/dataflow.rs
+++ b/src/librustc/middle/dataflow.rs
@@ -31,21 +31,21 @@ use util::nodemap::NodeMap;
 
 #[deriving(Clone)]
 pub struct DataFlowContext<'a, O> {
-    priv tcx: &'a ty::ctxt,
-    priv method_map: typeck::MethodMap,
+    tcx: &'a ty::ctxt,
+    method_map: typeck::MethodMap,
 
     /// the data flow operator
-    priv oper: O,
+    oper: O,
 
     /// number of bits to propagate per id
-    priv bits_per_id: uint,
+    bits_per_id: uint,
 
     /// number of words we will use to store bits_per_id.
     /// equal to bits_per_id/uint::BITS rounded up.
-    priv words_per_id: uint,
+    words_per_id: uint,
 
     // mapping from node to bitset index.
-    priv nodeid_to_bitset: NodeMap<uint>,
+    nodeid_to_bitset: NodeMap<uint>,
 
     // Bit sets per id.  The following three fields (`gens`, `kills`,
     // and `on_entry`) all have the same structure. For each id in
@@ -54,14 +54,15 @@ pub struct DataFlowContext<'a, O> {
     // the full vector (see the method `compute_id_range()`).
 
     /// bits generated as we exit the scope `id`. Updated by `add_gen()`.
-    priv gens: Vec<uint> ,
+    gens: Vec<uint>,
 
     /// bits killed as we exit the scope `id`. Updated by `add_kill()`.
-    priv kills: Vec<uint> ,
+    kills: Vec<uint>,
 
     /// bits that are valid on entry to the scope `id`. Updated by
     /// `propagate()`.
-    priv on_entry: Vec<uint> }
+    on_entry: Vec<uint>,
+}
 
 /// Parameterization for the precise form of data flow that is used.
 pub trait DataFlowOperator {
@@ -245,31 +246,6 @@ impl<'a, O:DataFlowOperator> DataFlowContext<'a, O> {
         self.each_bit(on_entry, f)
     }
 
-    pub fn each_bit_on_entry(&mut self,
-                             id: ast::NodeId,
-                             f: |uint| -> bool)
-                             -> bool {
-        //! Iterates through each bit that is set on entry to `id`.
-        //! Only useful after `propagate()` has been called.
-
-        let (start, end) = self.compute_id_range(id);
-        let on_entry = self.on_entry.slice(start, end);
-        debug!("each_bit_on_entry(id={:?}, on_entry={})",
-               id, bits_to_str(on_entry));
-        self.each_bit(on_entry, f)
-    }
-
-    pub fn each_gen_bit(&mut self, id: ast::NodeId, f: |uint| -> bool)
-                        -> bool {
-        //! Iterates through each bit in the gen set for `id`.
-
-        let (start, end) = self.compute_id_range(id);
-        let gens = self.gens.slice(start, end);
-        debug!("each_gen_bit(id={:?}, gens={})",
-               id, bits_to_str(gens));
-        self.each_bit(gens, f)
-    }
-
     pub fn each_gen_bit_frozen(&self, id: ast::NodeId, f: |uint| -> bool)
                                -> bool {
         //! Iterates through each bit in the gen set for `id`.
@@ -562,11 +538,11 @@ impl<'a, 'b, O:DataFlowOperator> PropagationContext<'a, 'b, O> {
                 self.walk_expr(l, in_out, loop_scopes);
             }
 
-            ast::ExprVec(ref exprs, _) => {
+            ast::ExprVec(ref exprs) => {
                 self.walk_exprs(exprs.as_slice(), in_out, loop_scopes)
             }
 
-            ast::ExprRepeat(l, r, _) => {
+            ast::ExprRepeat(l, r) => {
                 self.walk_expr(l, in_out, loop_scopes);
                 self.walk_expr(r, in_out, loop_scopes);
             }
diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs
index 1d23218583f..d0bf70ea1c2 100644
--- a/src/librustc/middle/dead.rs
+++ b/src/librustc/middle/dead.rs
@@ -270,7 +270,7 @@ fn create_and_seed_worklist(tcx: &ty::ctxt,
     }
 
     // Seed entry point
-    match tcx.sess.entry_fn.get() {
+    match *tcx.sess.entry_fn.borrow() {
         Some((id, _)) => worklist.push(id),
         None => ()
     }
diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs
index 7adfd6e0af0..441a3a36729 100644
--- a/src/librustc/middle/entry.rs
+++ b/src/librustc/middle/entry.rs
@@ -123,13 +123,13 @@ fn find_item(item: &Item, ctxt: &mut EntryContext) {
 
 fn configure_main(this: &mut EntryContext) {
     if this.start_fn.is_some() {
-        this.session.entry_fn.set(this.start_fn);
+        *this.session.entry_fn.borrow_mut() = this.start_fn;
         this.session.entry_type.set(Some(session::EntryStart));
     } else if this.attr_main_fn.is_some() {
-        this.session.entry_fn.set(this.attr_main_fn);
+        *this.session.entry_fn.borrow_mut() = this.attr_main_fn;
         this.session.entry_type.set(Some(session::EntryMain));
     } else if this.main_fn.is_some() {
-        this.session.entry_fn.set(this.main_fn);
+        *this.session.entry_fn.borrow_mut() = this.main_fn;
         this.session.entry_type.set(Some(session::EntryMain));
     } else {
         if !this.session.building_library.get() {
diff --git a/src/librustc/middle/freevars.rs b/src/librustc/middle/freevars.rs
index 84a3bb525af..d6adb19419b 100644
--- a/src/librustc/middle/freevars.rs
+++ b/src/librustc/middle/freevars.rs
@@ -11,7 +11,7 @@
 // A pass that annotates for each loops and functions with the free
 // variables that they contain.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use middle::resolve;
 use middle::ty;
@@ -26,8 +26,8 @@ use syntax::visit::Visitor;
 // (The def_upvar will already have been stripped).
 #[deriving(Encodable, Decodable)]
 pub struct freevar_entry {
-    def: ast::Def, //< The variable being accessed free.
-    span: Span     //< First span where it is accessed (there can be multiple)
+    pub def: ast::Def, //< The variable being accessed free.
+    pub span: Span     //< First span where it is accessed (there can be multiple)
 }
 pub type freevar_info = @Vec<@freevar_entry> ;
 pub type freevar_map = NodeMap<freevar_info>;
@@ -145,7 +145,3 @@ pub fn get_freevars(tcx: &ty::ctxt, fid: ast::NodeId) -> freevar_info {
         Some(&d) => return d
     }
 }
-
-pub fn has_freevars(tcx: &ty::ctxt, fid: ast::NodeId) -> bool {
-    !get_freevars(tcx, fid).is_empty()
-}
diff --git a/src/librustc/middle/graph.rs b/src/librustc/middle/graph.rs
index 66539c63d53..2705f9bf9bf 100644
--- a/src/librustc/middle/graph.rs
+++ b/src/librustc/middle/graph.rs
@@ -34,35 +34,37 @@ be indexed by the direction (see the type `Direction`).
 
 */
 
+#![allow(dead_code)] // still WIP
+
 use std::uint;
 
 pub struct Graph<N,E> {
-    priv nodes: Vec<Node<N>> ,
-    priv edges: Vec<Edge<E>> ,
+    nodes: Vec<Node<N>> ,
+    edges: Vec<Edge<E>> ,
 }
 
 pub struct Node<N> {
-    priv first_edge: [EdgeIndex, ..2], // see module comment
-    data: N,
+    first_edge: [EdgeIndex, ..2], // see module comment
+    pub data: N,
 }
 
 pub struct Edge<E> {
-    priv next_edge: [EdgeIndex, ..2], // see module comment
-    priv source: NodeIndex,
-    priv target: NodeIndex,
-    data: E,
+    next_edge: [EdgeIndex, ..2], // see module comment
+    source: NodeIndex,
+    target: NodeIndex,
+    pub data: E,
 }
 
 #[deriving(Eq)]
-pub struct NodeIndex(uint);
+pub struct NodeIndex(pub uint);
 pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
 
 #[deriving(Eq)]
-pub struct EdgeIndex(uint);
+pub struct EdgeIndex(pub uint);
 pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
 
 // Use a private field here to guarantee no more instances are created:
-pub struct Direction { priv repr: uint }
+pub struct Direction { repr: uint }
 pub static Outgoing: Direction = Direction { repr: 0 };
 pub static Incoming: Direction = Direction { repr: 1 };
 
diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs
index fd53c2e544d..09f396e932f 100644
--- a/src/librustc/middle/kind.rs
+++ b/src/librustc/middle/kind.rs
@@ -309,7 +309,7 @@ pub fn check_expr(cx: &mut Context, e: &Expr) {
             let target_ty = ty::expr_ty(cx.tcx, e);
             check_trait_cast(cx, source_ty, target_ty, source.span);
         }
-        ExprRepeat(element, count_expr, _) => {
+        ExprRepeat(element, count_expr) => {
             let count = ty::eval_repeat_count(cx.tcx, count_expr);
             if count > 1 {
                 let element_ty = ty::expr_ty(cx.tcx, element);
@@ -450,17 +450,6 @@ fn check_copy(cx: &Context, ty: ty::t, sp: Span, reason: &str) {
     }
 }
 
-pub fn check_send(cx: &Context, ty: ty::t, sp: Span) -> bool {
-    if !ty::type_is_sendable(cx.tcx, ty) {
-        cx.tcx.sess.span_err(
-            sp, format!("value has non-sendable type `{}`",
-                     ty_to_str(cx.tcx, ty)));
-        false
-    } else {
-        true
-    }
-}
-
 pub fn check_static(tcx: &ty::ctxt, ty: ty::t, sp: Span) -> bool {
     if !ty::type_is_static(tcx, ty) {
         match ty::get(ty).sty {
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index 2ba408bfa00..7fca0e56aa2 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -47,7 +47,7 @@ pub enum LangItem {
 }
 
 pub struct LanguageItems {
-    items: Vec<Option<ast::DefId>> ,
+    pub items: Vec<Option<ast::DefId>> ,
 }
 
 impl LanguageItems {
@@ -86,8 +86,8 @@ impl LanguageItems {
             Some(ty::BoundSend)
         } else if Some(id) == self.sized_trait() {
             Some(ty::BoundSized)
-        } else if Some(id) == self.pod_trait() {
-            Some(ty::BoundPod)
+        } else if Some(id) == self.copy_trait() {
+            Some(ty::BoundCopy)
         } else if Some(id) == self.share_trait() {
             Some(ty::BoundShare)
         } else {
@@ -96,6 +96,7 @@ impl LanguageItems {
     }
 
     $(
+        #[allow(dead_code)]
         pub fn $method(&self) -> Option<ast::DefId> {
             *self.items.get($variant as uint)
         }
@@ -210,7 +211,7 @@ lets_do_this! {
 //  Variant name,                    Name,                      Method name;
     SendTraitLangItem,               "send",                    send_trait;
     SizedTraitLangItem,              "sized",                   sized_trait;
-    PodTraitLangItem,                "pod",                     pod_trait;
+    CopyTraitLangItem,               "copy",                    copy_trait;
     ShareTraitLangItem,              "share",                   share_trait;
 
     DropTraitLangItem,               "drop",                    drop_trait;
@@ -271,7 +272,7 @@ lets_do_this! {
     InvariantLifetimeItem,           "invariant_lifetime",      invariant_lifetime;
 
     NoSendItem,                      "no_send_bound",           no_send_bound;
-    NoPodItem,                       "no_pod_bound",            no_pod_bound;
+    NoCopyItem,                      "no_copy_bound",           no_copy_bound;
     NoShareItem,                     "no_share_bound",          no_share_bound;
     ManagedItem,                     "managed_bound",           managed_bound;
 }
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs
index 8c20cf39b49..da74d0c7729 100644
--- a/src/librustc/middle/lint.rs
+++ b/src/librustc/middle/lint.rs
@@ -33,7 +33,7 @@
 //! modify the Context visitor appropriately. If you're adding lints from the
 //! Context itself, span_lint should be used instead of add_lint.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use driver::session;
 use metadata::csearch;
@@ -59,6 +59,7 @@ use std::u32;
 use std::u64;
 use std::u8;
 use collections::SmallIntMap;
+use syntax::abi;
 use syntax::ast_map;
 use syntax::ast_util::IdVisitingOperation;
 use syntax::attr::{AttrMetaMethods, AttributeMethods};
@@ -115,6 +116,8 @@ pub enum Lint {
     DeprecatedOwnedVector,
 
     Warnings,
+
+    RawPointerDeriving,
 }
 
 pub fn level_to_str(lv: level) -> &'static str {
@@ -133,9 +136,9 @@ pub enum level {
 
 #[deriving(Clone, Eq, Ord, TotalEq, TotalOrd)]
 pub struct LintSpec {
-    default: level,
-    lint: Lint,
-    desc: &'static str,
+    pub default: level,
+    pub lint: Lint,
+    pub desc: &'static str,
 }
 
 pub type LintDict = HashMap<&'static str, LintSpec>;
@@ -406,6 +409,13 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
         desc: "use of a `~[T]` vector",
         default: allow,
     }),
+
+    ("raw_pointer_deriving",
+     LintSpec {
+        lint: RawPointerDeriving,
+        desc: "uses of #[deriving] with raw pointers are rarely correct",
+        default: warn,
+    }),
 ];
 
 /*
@@ -883,7 +893,7 @@ fn check_item_ctypes(cx: &Context, it: &ast::Item) {
     }
 
     match it.node {
-      ast::ItemForeignMod(ref nmod) if !nmod.abis.is_intrinsic() => {
+      ast::ItemForeignMod(ref nmod) if nmod.abi != abi::RustIntrinsic => {
         for ni in nmod.items.iter() {
             match ni.node {
                 ast::ForeignItemFn(decl, _) => check_foreign_fn(cx, decl),
@@ -959,6 +969,37 @@ fn check_heap_item(cx: &Context, it: &ast::Item) {
     }
 }
 
+struct RawPtrDerivingVisitor<'a> {
+    cx: &'a Context<'a>
+}
+
+impl<'a> Visitor<()> for RawPtrDerivingVisitor<'a> {
+    fn visit_ty(&mut self, ty: &ast::Ty, _: ()) {
+        static MSG: &'static str = "use of `#[deriving]` with a raw pointer";
+        match ty.node {
+            ast::TyPtr(..) => self.cx.span_lint(RawPointerDeriving, ty.span, MSG),
+            _ => {}
+        }
+        visit::walk_ty(self, ty, ());
+    }
+    // explicit override to a no-op to reduce code bloat
+    fn visit_expr(&mut self, _: &ast::Expr, _: ()) {}
+    fn visit_block(&mut self, _: &ast::Block, _: ()) {}
+}
+
+fn check_raw_ptr_deriving(cx: &Context, item: &ast::Item) {
+    if !attr::contains_name(item.attrs.as_slice(), "deriving") {
+        return
+    }
+    match item.node {
+        ast::ItemStruct(..) | ast::ItemEnum(..) => {
+            let mut visitor = RawPtrDerivingVisitor { cx: cx };
+            visit::walk_item(&mut visitor, item, ());
+        }
+        _ => {}
+    }
+}
+
 static crate_attrs: &'static [&'static str] = &[
     "crate_type", "feature", "no_start", "no_main", "no_std", "crate_id",
     "desc", "comment", "license", "copyright", // not used in rustc now
@@ -1466,7 +1507,7 @@ fn check_missing_doc_ty_method(cx: &Context, tm: &ast::TypeMethod) {
 
 fn check_missing_doc_struct_field(cx: &Context, sf: &ast::StructField) {
     match sf.node.kind {
-        ast::NamedField(_, vis) if vis != ast::Private =>
+        ast::NamedField(_, vis) if vis == ast::Public =>
             check_missing_doc_attrs(cx,
                                     Some(cx.cur_struct_def_id),
                                     sf.node.attrs.as_slice(),
@@ -1585,6 +1626,7 @@ impl<'a> Visitor<()> for Context<'a> {
             check_heap_item(cx, it);
             check_missing_doc_item(cx, it);
             check_attrs_usage(cx, it.attrs.as_slice());
+            check_raw_ptr_deriving(cx, it);
 
             cx.visit_ids(|v| v.visit_item(it, ()));
 
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index 42b7260a4ae..046103c439d 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -1109,11 +1109,11 @@ impl<'a> Liveness<'a> {
             self.propagate_through_expr(expr, succ)
           }
 
-          ExprVec(ref exprs, _) => {
+          ExprVec(ref exprs) => {
             self.propagate_through_exprs(exprs.as_slice(), succ)
           }
 
-          ExprRepeat(element, count, _) => {
+          ExprRepeat(element, count) => {
             let succ = self.propagate_through_expr(count, succ);
             self.propagate_through_expr(element, succ)
           }
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index 1eb6ab4a8b8..e376e66ca6f 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -60,11 +60,11 @@
  * tied to `x`. The type of `x'` will be a borrowed pointer.
  */
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use middle::ty;
 use middle::typeck;
-use util::ppaux::{ty_to_str, region_ptr_to_str, Repr};
+use util::ppaux::{ty_to_str, Repr};
 
 use syntax::ast::{MutImmutable, MutMutable};
 use syntax::ast;
@@ -90,8 +90,8 @@ pub enum categorization {
 
 #[deriving(Eq)]
 pub struct CopiedUpvar {
-    upvar_id: ast::NodeId,
-    onceness: ast::Onceness,
+    pub upvar_id: ast::NodeId,
+    pub onceness: ast::Onceness,
 }
 
 // different kinds of pointers:
@@ -147,11 +147,11 @@ pub enum MutabilityCategory {
 // fashion. For more details, see the method `cat_pattern`
 #[deriving(Eq)]
 pub struct cmt_ {
-    id: ast::NodeId,          // id of expr/pat producing this value
-    span: Span,                // span of same expr/pat
-    cat: categorization,       // categorization of expr
-    mutbl: MutabilityCategory, // mutability of expr as lvalue
-    ty: ty::t                  // type of the expr (*see WARNING above*)
+    pub id: ast::NodeId,          // id of expr/pat producing this value
+    pub span: Span,                // span of same expr/pat
+    pub cat: categorization,       // categorization of expr
+    pub mutbl: MutabilityCategory, // mutability of expr as lvalue
+    pub ty: ty::t                  // type of the expr (*see WARNING above*)
 }
 
 pub type cmt = @cmt_;
@@ -242,7 +242,7 @@ impl ast_node for ast::Pat {
 }
 
 pub struct MemCategorizationContext<TYPER> {
-    typer: TYPER
+    pub typer: TYPER
 }
 
 pub type McResult<T> = Result<T, ()>;
@@ -674,20 +674,6 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
         }
     }
 
-    /// inherited mutability: used in cases where the mutability of a
-    /// component is inherited from the base it is a part of. For
-    /// example, a record field is mutable if it is declared mutable
-    /// or if the container is mutable.
-    pub fn inherited_mutability(&mut self,
-                                base_m: MutabilityCategory,
-                                interior_m: ast::Mutability)
-                                -> MutabilityCategory {
-        match interior_m {
-            MutImmutable => base_m.inherit(),
-            MutMutable => McDeclared
-        }
-    }
-
     pub fn cat_field<N:ast_node>(&mut self,
                                  node: &N,
                                  base_cmt: cmt,
@@ -1114,13 +1100,6 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
         Ok(())
     }
 
-    pub fn mut_to_str(&mut self, mutbl: ast::Mutability) -> ~str {
-        match mutbl {
-          MutMutable => ~"mutable",
-          MutImmutable => ~"immutable"
-        }
-    }
-
     pub fn cmt_to_str(&self, cmt: cmt) -> ~str {
         match cmt.cat {
           cat_static_item => {
@@ -1174,48 +1153,6 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
           }
         }
     }
-
-    pub fn region_to_str(&self, r: ty::Region) -> ~str {
-        region_ptr_to_str(self.tcx(), r)
-    }
-}
-
-/// The node_id here is the node of the expression that references the field.
-/// This function looks it up in the def map in case the type happens to be
-/// an enum to determine which variant is in use.
-pub fn field_mutbl(tcx: &ty::ctxt,
-                   base_ty: ty::t,
-                   // FIXME #6993: change type to Name
-                   f_name: ast::Ident,
-                   node_id: ast::NodeId)
-                -> Option<ast::Mutability> {
-    // Need to refactor so that struct/enum fields can be treated uniformly.
-    match ty::get(base_ty).sty {
-      ty::ty_struct(did, _) => {
-        let r = ty::lookup_struct_fields(tcx, did);
-        for fld in r.iter() {
-            if fld.name == f_name.name {
-                return Some(ast::MutImmutable);
-            }
-        }
-      }
-      ty::ty_enum(..) => {
-        match tcx.def_map.borrow().get_copy(&node_id) {
-          ast::DefVariant(_, variant_id, _) => {
-            let r = ty::lookup_struct_fields(tcx, variant_id);
-            for fld in r.iter() {
-                if fld.name == f_name.name {
-                    return Some(ast::MutImmutable);
-                }
-            }
-          }
-          _ => {}
-        }
-      }
-      _ => { }
-    }
-
-    return None;
 }
 
 pub enum InteriorSafety {
diff --git a/src/librustc/middle/moves.rs b/src/librustc/middle/moves.rs
index b6cfff5c86f..dbc28f9fdd5 100644
--- a/src/librustc/middle/moves.rs
+++ b/src/librustc/middle/moves.rs
@@ -153,9 +153,9 @@ pub enum CaptureMode {
 
 #[deriving(Encodable, Decodable)]
 pub struct CaptureVar {
-    def: Def,         // Variable being accessed free
-    span: Span,       // Location of an access to this variable
-    mode: CaptureMode // How variable is being accessed
+    pub def: Def,         // Variable being accessed free
+    pub span: Span,       // Location of an access to this variable
+    pub mode: CaptureMode // How variable is being accessed
 }
 
 pub type CaptureMap = NodeMap<Rc<Vec<CaptureVar>>>;
@@ -163,15 +163,15 @@ pub type CaptureMap = NodeMap<Rc<Vec<CaptureVar>>>;
 /** See the section Output on the module comment for explanation. */
 #[deriving(Clone)]
 pub struct MoveMaps {
-    moves_map: NodeSet,
+    pub moves_map: NodeSet,
     /**
      * Set of variable node-ids that are moved.
      *
-     * Note: The `moves_map` stores expression ids that are moves,
+     * pub Note: The `moves_map` stores expression ids that are moves,
      * whereas this set stores the ids of the variables that are
      * moved at some point */
-    moved_variables_set: NodeSet,
-    capture_map: CaptureMap
+    pub moved_variables_set: NodeSet,
+    pub capture_map: CaptureMap
 }
 
 #[deriving(Clone)]
@@ -473,7 +473,7 @@ impl<'a> VisitContext<'a> {
                 self.use_expr(base, expr_mode);
             }
 
-            ExprVec(ref exprs, _) => {
+            ExprVec(ref exprs) => {
                 self.consume_exprs(exprs.as_slice());
             }
 
@@ -539,7 +539,7 @@ impl<'a> VisitContext<'a> {
                 // }
             }
 
-            ExprRepeat(base, count, _) => {
+            ExprRepeat(base, count) => {
                 self.consume_expr(base);
                 self.consume_expr(count);
             }
diff --git a/src/librustc/middle/pat_util.rs b/src/librustc/middle/pat_util.rs
index e9d01b9048f..2d50d2e0f77 100644
--- a/src/librustc/middle/pat_util.rs
+++ b/src/librustc/middle/pat_util.rs
@@ -86,12 +86,6 @@ pub fn pat_bindings(dm: resolve::DefMap,
     });
 }
 
-pub fn pat_binding_ids(dm: resolve::DefMap, pat: &Pat) -> Vec<NodeId> {
-    let mut found = Vec::new();
-    pat_bindings(dm, pat, |_bm, b_id, _sp, _pt| found.push(b_id) );
-    return found;
-}
-
 /// Checks if the pattern contains any patterns that bind something to
 /// an ident, e.g. `foo`, or `Foo(foo)` or `foo @ Bar(..)`.
 pub fn pat_contains_bindings(dm: resolve::DefMap, pat: &Pat) -> bool {
diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs
index 0c2abfd23c3..9d9faee3645 100644
--- a/src/librustc/middle/privacy.rs
+++ b/src/librustc/middle/privacy.rs
@@ -359,6 +359,12 @@ enum PrivacyResult {
     DisallowedBy(ast::NodeId),
 }
 
+enum FieldName {
+    UnnamedField(uint), // index
+    // FIXME #6993: change type (and name) from Ident to Name
+    NamedField(ast::Ident),
+}
+
 impl<'a> PrivacyVisitor<'a> {
     // used when debugging
     fn nodestr(&self, id: ast::NodeId) -> ~str {
@@ -561,61 +567,23 @@ impl<'a> PrivacyVisitor<'a> {
     }
 
     // Checks that a field is in scope.
-    // FIXME #6993: change type (and name) from Ident to Name
-    fn check_field(&mut self, span: Span, id: ast::DefId, ident: ast::Ident,
-                   enum_id: Option<ast::DefId>) {
+    fn check_field(&mut self, span: Span, id: ast::DefId,
+                   name: FieldName) {
         let fields = ty::lookup_struct_fields(self.tcx, id);
-        let struct_vis = if is_local(id) {
-            match self.tcx.map.get(id.node) {
-                ast_map::NodeItem(ref it) => it.vis,
-                ast_map::NodeVariant(ref v) => {
-                    if v.node.vis == ast::Inherited {
-                        let parent = self.tcx.map.get_parent(id.node);
-                        self.tcx.map.expect_item(parent).vis
-                    } else {
-                        v.node.vis
-                    }
-                }
-                _ => {
-                    self.tcx.sess.span_bug(span,
-                                           format!("not an item or variant def"));
-                }
-            }
-        } else {
-            let cstore = &self.tcx.sess.cstore;
-            match enum_id {
-                Some(enum_id) => {
-                    let v = csearch::get_enum_variants(self.tcx, enum_id);
-                    match v.iter().find(|v| v.id == id) {
-                        Some(variant) => {
-                            if variant.vis == ast::Inherited {
-                                csearch::get_item_visibility(cstore, enum_id)
-                            } else {
-                                variant.vis
-                            }
-                        }
-                        None => {
-                            self.tcx.sess.span_bug(span, "no xcrate variant");
-                        }
-                    }
-                }
-                None => csearch::get_item_visibility(cstore, id)
+        let field = match name {
+            NamedField(ident) => {
+                fields.iter().find(|f| f.name == ident.name).unwrap()
             }
+            UnnamedField(idx) => fields.get(idx)
         };
-
-        for field in fields.iter() {
-            if field.name != ident.name { continue; }
-            // public structs have public fields by default, and private structs
-            // have private fields by default.
-            if struct_vis == ast::Public && field.vis != ast::Private { break }
-            if struct_vis != ast::Public && field.vis == ast::Public { break }
-            if !is_local(field.id) ||
-               !self.private_accessible(field.id.node) {
-                self.tcx.sess.span_err(span,
-                                       format!("field `{}` is private",
-                                               token::get_ident(ident)))
-            }
-            break;
+        if field.vis == ast::Public { return }
+        if !is_local(field.id) || !self.private_accessible(field.id.node) {
+            let msg = match name {
+                NamedField(name) => format!("field `{}` is private",
+                                            token::get_ident(name)),
+                UnnamedField(idx) => format!("field \\#{} is private", idx + 1),
+            };
+            self.tcx.sess.span_err(span, msg);
         }
     }
 
@@ -678,10 +646,11 @@ impl<'a> PrivacyVisitor<'a> {
                             _ => {},
                         }
                     }
-                    // If an import is not used in either namespace, we still want to check
-                    // that it could be legal. Therefore we check in both namespaces and only
-                    // report an error if both would be illegal. We only report one error,
-                    // even if it is illegal to import from both namespaces.
+                    // If an import is not used in either namespace, we still
+                    // want to check that it could be legal. Therefore we check
+                    // in both namespaces and only report an error if both would
+                    // be illegal. We only report one error, even if it is
+                    // illegal to import from both namespaces.
                     match (value_priv, check_value, type_priv, check_type) {
                         (Some(p), resolve::Unused, None, _) |
                         (None, _, Some(p), resolve::Unused) => {
@@ -745,7 +714,8 @@ impl<'a> PrivacyVisitor<'a> {
             // is whether the trait itself is accessible or not.
             MethodParam(MethodParam { trait_id: trait_id, .. }) |
             MethodObject(MethodObject { trait_id: trait_id, .. }) => {
-                self.report_error(self.ensure_public(span, trait_id, None, "source trait"));
+                self.report_error(self.ensure_public(span, trait_id, None,
+                                                     "source trait"));
             }
         }
     }
@@ -770,7 +740,7 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
                 match ty::get(ty::expr_ty_adjusted(self.tcx, base,
                                                    &*self.method_map.borrow())).sty {
                     ty::ty_struct(id, _) => {
-                        self.check_field(expr.span, id, ident, None);
+                        self.check_field(expr.span, id, NamedField(ident));
                     }
                     _ => {}
                 }
@@ -793,17 +763,16 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
                 match ty::get(ty::expr_ty(self.tcx, expr)).sty {
                     ty::ty_struct(id, _) => {
                         for field in (*fields).iter() {
-                            self.check_field(expr.span, id, field.ident.node,
-                                             None);
+                            self.check_field(expr.span, id,
+                                             NamedField(field.ident.node));
                         }
                     }
                     ty::ty_enum(_, _) => {
                         match self.tcx.def_map.borrow().get_copy(&expr.id) {
-                            ast::DefVariant(enum_id, variant_id, _) => {
+                            ast::DefVariant(_, variant_id, _) => {
                                 for field in fields.iter() {
                                     self.check_field(expr.span, variant_id,
-                                                     field.ident.node,
-                                                     Some(enum_id));
+                                                     NamedField(field.ident.node));
                                 }
                             }
                             _ => self.tcx.sess.span_bug(expr.span,
@@ -818,6 +787,46 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
                                                             struct type?!"),
                 }
             }
+            ast::ExprPath(..) => {
+                let guard = |did: ast::DefId| {
+                    let fields = ty::lookup_struct_fields(self.tcx, did);
+                    let any_priv = fields.iter().any(|f| {
+                        f.vis != ast::Public && (
+                            !is_local(f.id) ||
+                            !self.private_accessible(f.id.node))
+                    });
+                    if any_priv {
+                        self.tcx.sess.span_err(expr.span,
+                            "cannot invoke tuple struct constructor \
+                             with private fields");
+                    }
+                };
+                match self.tcx.def_map.borrow().find(&expr.id) {
+                    Some(&ast::DefStruct(did)) => {
+                        guard(if is_local(did) {
+                            local_def(self.tcx.map.get_parent(did.node))
+                        } else {
+                            // "tuple structs" with zero fields (such as
+                            // `pub struct Foo;`) don't have a ctor_id, hence
+                            // the unwrap_or to the same struct id.
+                            let maybe_did =
+                                csearch::get_tuple_struct_definition_if_ctor(
+                                    &self.tcx.sess.cstore, did);
+                            maybe_did.unwrap_or(did)
+                        })
+                    }
+                    // Tuple struct constructors across crates are identified as
+                    // DefFn types, so we explicitly handle that case here.
+                    Some(&ast::DefFn(did, _)) if !is_local(did) => {
+                        match csearch::get_tuple_struct_definition_if_ctor(
+                                    &self.tcx.sess.cstore, did) {
+                            Some(did) => guard(did),
+                            None => {}
+                        }
+                    }
+                    _ => {}
+                }
+            }
             _ => {}
         }
 
@@ -867,16 +876,16 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
                 match ty::get(ty::pat_ty(self.tcx, pattern)).sty {
                     ty::ty_struct(id, _) => {
                         for field in fields.iter() {
-                            self.check_field(pattern.span, id, field.ident,
-                                             None);
+                            self.check_field(pattern.span, id,
+                                             NamedField(field.ident));
                         }
                     }
                     ty::ty_enum(_, _) => {
                         match self.tcx.def_map.borrow().find(&pattern.id) {
-                            Some(&ast::DefVariant(enum_id, variant_id, _)) => {
+                            Some(&ast::DefVariant(_, variant_id, _)) => {
                                 for field in fields.iter() {
                                     self.check_field(pattern.span, variant_id,
-                                                     field.ident, Some(enum_id));
+                                                     NamedField(field.ident));
                                 }
                             }
                             _ => self.tcx.sess.span_bug(pattern.span,
@@ -891,6 +900,27 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
                                                  struct type?!"),
                 }
             }
+
+            // Patterns which bind no fields are allowable (the path is check
+            // elsewhere).
+            ast::PatEnum(_, Some(ref fields)) => {
+                match ty::get(ty::pat_ty(self.tcx, pattern)).sty {
+                    ty::ty_struct(id, _) => {
+                        for (i, field) in fields.iter().enumerate() {
+                            match field.node {
+                                ast::PatWild(..) => continue,
+                                _ => {}
+                            }
+                            self.check_field(field.span, id, UnnamedField(i));
+                        }
+                    }
+                    ty::ty_enum(..) => {
+                        // enum fields have no privacy at this time
+                    }
+                    _ => {}
+                }
+
+            }
             _ => {}
         }
 
@@ -992,24 +1022,14 @@ impl<'a> SanePrivacyVisitor<'a> {
                 }
             }
         };
-        let check_struct = |def: &@ast::StructDef,
-                            vis: ast::Visibility,
-                            parent_vis: Option<ast::Visibility>| {
-            let public_def = match vis {
-                ast::Public => true,
-                ast::Inherited | ast::Private => parent_vis == Some(ast::Public),
-            };
+        let check_struct = |def: &@ast::StructDef| {
             for f in def.fields.iter() {
-               match f.node.kind {
-                    ast::NamedField(_, ast::Public) if public_def => {
-                        tcx.sess.span_err(f.span, "unnecessary `pub` \
-                                                   visibility");
-                    }
-                    ast::NamedField(_, ast::Private) if !public_def => {
+                match f.node.kind {
+                    ast::NamedField(_, ast::Private) => {
                         tcx.sess.span_err(f.span, "unnecessary `priv` \
                                                    visibility");
                     }
-                    ast::NamedField(..) | ast::UnnamedField => {}
+                    ast::NamedField(..) | ast::UnnamedField(..) => {}
                 }
             }
         };
@@ -1062,15 +1082,13 @@ impl<'a> SanePrivacyVisitor<'a> {
                     }
 
                     match v.node.kind {
-                        ast::StructVariantKind(ref s) => {
-                            check_struct(s, v.node.vis, Some(item.vis));
-                        }
+                        ast::StructVariantKind(ref s) => check_struct(s),
                         ast::TupleVariantKind(..) => {}
                     }
                 }
             }
 
-            ast::ItemStruct(ref def, _) => check_struct(def, item.vis, None),
+            ast::ItemStruct(ref def, _) => check_struct(def),
 
             ast::ItemTrait(_, _, ref methods) => {
                 for m in methods.iter() {
@@ -1106,7 +1124,7 @@ impl<'a> SanePrivacyVisitor<'a> {
             for f in def.fields.iter() {
                match f.node.kind {
                     ast::NamedField(_, p) => check_inherited(f.span, p),
-                    ast::UnnamedField => {}
+                    ast::UnnamedField(..) => {}
                 }
             }
         };
@@ -1376,12 +1394,10 @@ impl<'a> Visitor<()> for VisiblePrivateTypesVisitor<'a> {
 
     fn visit_struct_field(&mut self, s: &ast::StructField, _: ()) {
         match s.node.kind {
-            // the only way to get here is by being inside a public
-            // struct/enum variant, so the only way to have a private
-            // field is with an explicit `priv`.
-            ast::NamedField(_, ast::Private) => {}
-
-            _ => visit::walk_struct_field(self, s, ())
+            ast::NamedField(_, ast::Public)  => {
+                visit::walk_struct_field(self, s, ());
+            }
+            _ => {}
         }
     }
 
diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs
index 16c513f16f3..8a5e0d3df17 100644
--- a/src/librustc/middle/region.rs
+++ b/src/librustc/middle/region.rs
@@ -75,11 +75,11 @@ The region maps encode information about region relationships.
   for dynamic checks and/or arbitrary amounts of stack space.
 */
 pub struct RegionMaps {
-    priv scope_map: RefCell<NodeMap<ast::NodeId>>,
-    priv var_map: RefCell<NodeMap<ast::NodeId>>,
-    priv free_region_map: RefCell<HashMap<FreeRegion, Vec<FreeRegion> >>,
-    priv rvalue_scopes: RefCell<NodeMap<ast::NodeId>>,
-    priv terminating_scopes: RefCell<HashSet<ast::NodeId>>,
+    scope_map: RefCell<NodeMap<ast::NodeId>>,
+    var_map: RefCell<NodeMap<ast::NodeId>>,
+    free_region_map: RefCell<HashMap<FreeRegion, Vec<FreeRegion> >>,
+    rvalue_scopes: RefCell<NodeMap<ast::NodeId>>,
+    terminating_scopes: RefCell<HashSet<ast::NodeId>>,
 }
 
 #[deriving(Clone)]
@@ -149,6 +149,7 @@ impl RegionMaps {
         self.scope_map.borrow().find(&id).map(|x| *x)
     }
 
+    #[allow(dead_code)] // used in middle::cfg
     pub fn encl_scope(&self, id: ast::NodeId) -> ast::NodeId {
         //! Returns the narrowest scope that encloses `id`, if any.
         match self.scope_map.borrow().find(&id) {
@@ -203,12 +204,6 @@ impl RegionMaps {
         return Some(id);
     }
 
-    pub fn encl_region(&self, id: ast::NodeId) -> ty::Region {
-        //! Returns the narrowest scope region that encloses `id`, if any.
-
-        ty::ReScope(self.encl_scope(id))
-    }
-
     pub fn var_region(&self, id: ast::NodeId) -> ty::Region {
         //! Returns the lifetime of the variable `id`.
 
@@ -729,7 +724,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor,
                 visitor.region_maps.record_rvalue_scope(subexpr.id, blk_id);
                 record_rvalue_scope_if_borrow_expr(visitor, subexpr, blk_id);
             }
-            ast::ExprVec(ref subexprs, _) |
+            ast::ExprVec(ref subexprs) |
             ast::ExprTup(ref subexprs) => {
                 for &subexpr in subexprs.iter() {
                     record_rvalue_scope_if_borrow_expr(
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index d86e05395b4..143b02f96d2 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use driver::session::Session;
 use metadata::csearch;
@@ -55,8 +55,8 @@ pub type TraitMap = NodeMap<Vec<DefId> >;
 pub type ExportMap2 = @RefCell<NodeMap<Vec<Export2> >>;
 
 pub struct Export2 {
-    name: ~str,        // The name of the target.
-    def_id: DefId,     // The definition of the target.
+    pub name: ~str,        // The name of the target.
+    pub def_id: DefId,     // The definition of the target.
 }
 
 // This set contains all exported definitions from external crates. The set does
@@ -73,10 +73,10 @@ pub enum LastPrivate {
     // and whether the import is in fact used for each.
     // If the Option<PrivateDep> fields are None, it means there is no defintion
     // in that namespace.
-    LastImport{value_priv: Option<PrivateDep>,
-               value_used: ImportUse,
-               type_priv: Option<PrivateDep>,
-               type_used: ImportUse},
+    LastImport{pub value_priv: Option<PrivateDep>,
+               pub value_used: ImportUse,
+               pub type_priv: Option<PrivateDep>,
+               pub type_used: ImportUse},
 }
 
 pub enum PrivateDep {
@@ -385,6 +385,10 @@ struct ImportResolution {
     type_id: Cell<NodeId>,
 }
 
+fn get<T: Clone>(cell: &RefCell<T>) -> T {
+    cell.borrow().clone()
+}
+
 impl ImportResolution {
     fn new(id: NodeId, is_public: bool) -> ImportResolution {
         ImportResolution {
@@ -400,8 +404,8 @@ impl ImportResolution {
     fn target_for_namespace(&self, namespace: Namespace)
                                 -> Option<Target> {
         match namespace {
-            TypeNS      => return self.type_target.get(),
-            ValueNS     => return self.value_target.get(),
+            TypeNS      => return self.type_target.borrow().clone(),
+            ValueNS     => return self.value_target.borrow().clone(),
         }
     }
 
@@ -546,22 +550,23 @@ impl NameBindings {
         // Merges the module with the existing type def or creates a new one.
         let module_ = @Module::new(parent_link, def_id, kind, external,
                                        is_public);
-        match self.type_def.get() {
+        let type_def = self.type_def.borrow().clone();
+        match type_def {
             None => {
-                self.type_def.set(Some(TypeNsDef {
+                *self.type_def.borrow_mut() = Some(TypeNsDef {
                     is_public: is_public,
                     module_def: Some(module_),
                     type_def: None,
                     type_span: Some(sp)
-                }));
+                });
             }
             Some(type_def) => {
-                self.type_def.set(Some(TypeNsDef {
+                *self.type_def.borrow_mut() = Some(TypeNsDef {
                     is_public: is_public,
                     module_def: Some(module_),
                     type_span: Some(sp),
                     type_def: type_def.type_def
-                }));
+                });
             }
         }
     }
@@ -574,16 +579,17 @@ impl NameBindings {
                        external: bool,
                        is_public: bool,
                        _sp: Span) {
-        match self.type_def.get() {
+        let type_def = self.type_def.borrow().clone();
+        match type_def {
             None => {
                 let module = @Module::new(parent_link, def_id, kind,
                                               external, is_public);
-                self.type_def.set(Some(TypeNsDef {
+                *self.type_def.borrow_mut() = Some(TypeNsDef {
                     is_public: is_public,
                     module_def: Some(module),
                     type_def: None,
                     type_span: None,
-                }))
+                });
             }
             Some(type_def) => {
                 match type_def.module_def {
@@ -593,12 +599,12 @@ impl NameBindings {
                                                       kind,
                                                       external,
                                                       is_public);
-                        self.type_def.set(Some(TypeNsDef {
+                        *self.type_def.borrow_mut() = Some(TypeNsDef {
                             is_public: is_public,
                             module_def: Some(module),
                             type_def: type_def.type_def,
                             type_span: None,
-                        }))
+                        });
                     }
                     Some(module_def) => module_def.kind.set(kind),
                 }
@@ -609,33 +615,34 @@ impl NameBindings {
     /// Records a type definition.
     fn define_type(&self, def: Def, sp: Span, is_public: bool) {
         // Merges the type with the existing type def or creates a new one.
-        match self.type_def.get() {
+        let type_def = self.type_def.borrow().clone();
+        match type_def {
             None => {
-                self.type_def.set(Some(TypeNsDef {
+                *self.type_def.borrow_mut() = Some(TypeNsDef {
                     module_def: None,
                     type_def: Some(def),
                     type_span: Some(sp),
                     is_public: is_public,
-                }));
+                });
             }
             Some(type_def) => {
-                self.type_def.set(Some(TypeNsDef {
+                *self.type_def.borrow_mut() = Some(TypeNsDef {
                     type_def: Some(def),
                     type_span: Some(sp),
                     module_def: type_def.module_def,
                     is_public: is_public,
-                }));
+                });
             }
         }
     }
 
     /// Records a value definition.
     fn define_value(&self, def: Def, sp: Span, is_public: bool) {
-        self.value_def.set(Some(ValueNsDef {
+        *self.value_def.borrow_mut() = Some(ValueNsDef {
             def: def,
             value_span: Some(sp),
             is_public: is_public,
-        }));
+        });
     }
 
     /// Returns the module node if applicable.
@@ -662,17 +669,17 @@ impl NameBindings {
 
     fn defined_in_namespace(&self, namespace: Namespace) -> bool {
         match namespace {
-            TypeNS   => return self.type_def.get().is_some(),
-            ValueNS  => return self.value_def.get().is_some()
+            TypeNS   => return self.type_def.borrow().is_some(),
+            ValueNS  => return self.value_def.borrow().is_some()
         }
     }
 
     fn defined_in_public_namespace(&self, namespace: Namespace) -> bool {
         match namespace {
-            TypeNS => match self.type_def.get() {
+            TypeNS => match *self.type_def.borrow() {
                 Some(def) => def.is_public, None => false
             },
-            ValueNS => match self.value_def.get() {
+            ValueNS => match *self.value_def.borrow() {
                 Some(def) => def.is_public, None => false
             }
         }
@@ -681,7 +688,7 @@ impl NameBindings {
     fn def_for_namespace(&self, namespace: Namespace) -> Option<Def> {
         match namespace {
             TypeNS => {
-                match self.type_def.get() {
+                match *self.type_def.borrow() {
                     None => None,
                     Some(type_def) => {
                         match type_def.type_def {
@@ -702,7 +709,7 @@ impl NameBindings {
                 }
             }
             ValueNS => {
-                match self.value_def.get() {
+                match *self.value_def.borrow() {
                     None => None,
                     Some(value_def) => Some(value_def.def)
                 }
@@ -714,13 +721,13 @@ impl NameBindings {
         if self.defined_in_namespace(namespace) {
             match namespace {
                 TypeNS  => {
-                    match self.type_def.get() {
+                    match *self.type_def.borrow() {
                         None => None,
                         Some(type_def) => type_def.type_span
                     }
                 }
                 ValueNS => {
-                    match self.value_def.get() {
+                    match *self.value_def.borrow() {
                         None => None,
                         Some(value_def) => value_def.value_span
                     }
@@ -1620,7 +1627,8 @@ impl<'a> Resolver<'a> {
         match def {
           DefMod(def_id) | DefForeignMod(def_id) | DefStruct(def_id) |
           DefTy(def_id) => {
-            match child_name_bindings.type_def.get() {
+            let type_def = child_name_bindings.type_def.borrow().clone();
+            match type_def {
               Some(TypeNsDef { module_def: Some(module_def), .. }) => {
                 debug!("(building reduced graph for external crate) \
                         already created module");
@@ -1812,7 +1820,8 @@ impl<'a> Resolver<'a> {
                                 // Process the static methods. First,
                                 // create the module.
                                 let type_module;
-                                match child_name_bindings.type_def.get() {
+                                let type_def = child_name_bindings.type_def.borrow().clone();
+                                match type_def {
                                     Some(TypeNsDef {
                                         module_def: Some(module_def),
                                         ..
@@ -2408,8 +2417,8 @@ impl<'a> Resolver<'a> {
         match value_result {
             BoundResult(target_module, name_bindings) => {
                 debug!("(resolving single import) found value target");
-                import_resolution.value_target.set(
-                    Some(Target::new(target_module, name_bindings)));
+                *import_resolution.value_target.borrow_mut() =
+                    Some(Target::new(target_module, name_bindings));
                 import_resolution.value_id.set(directive.id);
                 value_used_public = name_bindings.defined_in_public_namespace(ValueNS);
             }
@@ -2421,9 +2430,9 @@ impl<'a> Resolver<'a> {
         match type_result {
             BoundResult(target_module, name_bindings) => {
                 debug!("(resolving single import) found type target: {:?}",
-                       {name_bindings.type_def.get().unwrap().type_def});
-                import_resolution.type_target.set(
-                    Some(Target::new(target_module, name_bindings)));
+                       { name_bindings.type_def.borrow().clone().unwrap().type_def });
+                *import_resolution.type_target.borrow_mut() =
+                    Some(Target::new(target_module, name_bindings));
                 import_resolution.type_id.set(directive.id);
                 type_used_public = name_bindings.defined_in_public_namespace(TypeNS);
             }
@@ -2433,8 +2442,8 @@ impl<'a> Resolver<'a> {
             }
         }
 
-        if import_resolution.value_target.get().is_none() &&
-           import_resolution.type_target.get().is_none() {
+        if import_resolution.value_target.borrow().is_none() &&
+           import_resolution.type_target.borrow().is_none() {
             let msg = format!("unresolved import: there is no \
                                `{}` in `{}`",
                               token::get_ident(source),
@@ -2452,7 +2461,7 @@ impl<'a> Resolver<'a> {
         // 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_private = match import_resolution.value_target.get() {
+        let value_private = match *import_resolution.value_target.borrow() {
             Some(target) => {
                 let def = target.bindings.def_for_namespace(ValueNS).unwrap();
                 self.def_map.borrow_mut().insert(directive.id, def);
@@ -2463,7 +2472,7 @@ impl<'a> Resolver<'a> {
             // _exists is false.
             None => None,
         };
-        let type_private = match import_resolution.type_target.get() {
+        let type_private = match *import_resolution.type_target.borrow() {
             Some(target) => {
                 let def = target.bindings.def_for_namespace(TypeNS).unwrap();
                 self.def_map.borrow_mut().insert(directive.id, def);
@@ -2513,7 +2522,7 @@ impl<'a> Resolver<'a> {
         for (ident, target_import_resolution) in import_resolutions.iter() {
             debug!("(resolving glob import) writing module resolution \
                     {:?} into `{}`",
-                   target_import_resolution.type_target.get().is_none(),
+                   target_import_resolution.type_target.borrow().is_none(),
                    self.module_to_str(module_));
 
             if !target_import_resolution.is_public.get() {
@@ -2528,10 +2537,10 @@ impl<'a> Resolver<'a> {
                     // Simple: just copy the old import resolution.
                     let new_import_resolution =
                         @ImportResolution::new(id, is_public);
-                    new_import_resolution.value_target.set(
-                        target_import_resolution.value_target.get());
-                    new_import_resolution.type_target.set(
-                        target_import_resolution.type_target.get());
+                    *new_import_resolution.value_target.borrow_mut() =
+                        get(&target_import_resolution.value_target);
+                    *new_import_resolution.type_target.borrow_mut() =
+                        get(&target_import_resolution.type_target);
 
                     import_resolutions.insert
                         (*ident, new_import_resolution);
@@ -2540,22 +2549,20 @@ impl<'a> Resolver<'a> {
                     // Merge the two import resolutions at a finer-grained
                     // level.
 
-                    match target_import_resolution.value_target.get() {
+                    match *target_import_resolution.value_target.borrow() {
                         None => {
                             // Continue.
                         }
                         Some(value_target) => {
-                            dest_import_resolution.value_target.set(
-                                Some(value_target));
+                            *dest_import_resolution.value_target.borrow_mut() = Some(value_target);
                         }
                     }
-                    match target_import_resolution.type_target.get() {
+                    match *target_import_resolution.type_target.borrow() {
                         None => {
                             // Continue.
                         }
                         Some(type_target) => {
-                            dest_import_resolution.type_target.set(
-                                Some(type_target));
+                            *dest_import_resolution.type_target.borrow_mut() = Some(type_target);
                         }
                     }
                     dest_import_resolution.is_public.set(is_public);
@@ -2627,14 +2634,14 @@ impl<'a> Resolver<'a> {
         // Merge the child item into the import resolution.
         if name_bindings.defined_in_public_namespace(ValueNS) {
             debug!("(resolving glob import) ... for value target");
-            dest_import_resolution.value_target.set(
-                Some(Target::new(containing_module, name_bindings)));
+            *dest_import_resolution.value_target.borrow_mut() =
+                Some(Target::new(containing_module, name_bindings));
             dest_import_resolution.value_id.set(id);
         }
         if name_bindings.defined_in_public_namespace(TypeNS) {
             debug!("(resolving glob import) ... for type target");
-            dest_import_resolution.type_target.set(
-                Some(Target::new(containing_module, name_bindings)));
+            *dest_import_resolution.type_target.borrow_mut() =
+                Some(Target::new(containing_module, name_bindings));
             dest_import_resolution.type_id.set(id);
         }
         dest_import_resolution.is_public.set(is_public);
@@ -2692,7 +2699,7 @@ impl<'a> Resolver<'a> {
                 Success((target, used_proxy)) => {
                     // Check to see whether there are type bindings, and, if
                     // so, whether there is a module within.
-                    match target.bindings.type_def.get() {
+                    match *target.bindings.type_def.borrow() {
                         Some(type_def) => {
                             match type_def.module_def {
                                 None => {
@@ -3004,7 +3011,7 @@ impl<'a> Resolver<'a> {
         match resolve_result {
             Success((target, _)) => {
                 let bindings = &*target.bindings;
-                match bindings.type_def.get() {
+                match *bindings.type_def.borrow() {
                     Some(type_def) => {
                         match type_def.module_def {
                             None => {
@@ -4526,8 +4533,8 @@ impl<'a> Resolver<'a> {
                 debug!("(resolve bare identifier pattern) succeeded in \
                          finding {} at {:?}",
                         token::get_ident(name),
-                        target.bindings.value_def.get());
-                match target.bindings.value_def.get() {
+                        target.bindings.value_def.borrow());
+                match *target.bindings.value_def.borrow() {
                     None => {
                         fail!("resolved name in the value namespace to a \
                               set of name bindings with no def?!");
@@ -4707,18 +4714,20 @@ impl<'a> Resolver<'a> {
                                         path: &Path,
                                         namespace: Namespace)
                                         -> Option<(Def, LastPrivate)> {
-        let module_path_idents = path.segments.init().map(|ps| ps.identifier);
+        let module_path_idents = path.segments.init().iter()
+                                                     .map(|ps| ps.identifier)
+                                                     .collect::<Vec<_>>();
 
         let containing_module;
         let last_private;
         match self.resolve_module_path(self.current_module,
-                                       module_path_idents,
+                                       module_path_idents.as_slice(),
                                        UseLexicalScope,
                                        path.span,
                                        PathSearch) {
             Failed => {
                 let msg = format!("use of undeclared module `{}`",
-                                  self.idents_to_str(module_path_idents));
+                                  self.idents_to_str(module_path_idents.as_slice()));
                 self.resolve_error(path.span, msg);
                 return None;
             }
@@ -4772,21 +4781,23 @@ impl<'a> Resolver<'a> {
                                    path: &Path,
                                    namespace: Namespace)
                                        -> Option<(Def, LastPrivate)> {
-        let module_path_idents = path.segments.init().map(|ps| ps.identifier);
+        let module_path_idents = path.segments.init().iter()
+                                                     .map(|ps| ps.identifier)
+                                                     .collect::<Vec<_>>();
 
         let root_module = self.graph_root.get_module();
 
         let containing_module;
         let last_private;
         match self.resolve_module_path_from_root(root_module,
-                                                 module_path_idents,
+                                                 module_path_idents.as_slice(),
                                                  0,
                                                  path.span,
                                                  PathSearch,
                                                  LastMod(AllPublic)) {
             Failed => {
                 let msg = format!("use of undeclared module `::{}`",
-                                  self.idents_to_str(module_path_idents));
+                                  self.idents_to_str(module_path_idents.as_slice()));
                 self.resolve_error(path.span, msg);
                 return None;
             }
@@ -5404,11 +5415,11 @@ impl<'a> Resolver<'a> {
 }
 
 pub struct CrateMap {
-    def_map: DefMap,
-    exp_map2: ExportMap2,
-    trait_map: TraitMap,
-    external_exports: ExternalExports,
-    last_private_map: LastPrivateMap,
+    pub def_map: DefMap,
+    pub exp_map2: ExportMap2,
+    pub trait_map: TraitMap,
+    pub external_exports: ExternalExports,
+    pub last_private_map: LastPrivateMap,
 }
 
 /// Entry point to crate resolution.
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index 40a7bdff11f..8f4c8c84b68 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -216,7 +216,7 @@ impl<'a> LifetimeContext<'a> {
                referenced_idents={:?} \
                early_count={}",
                n,
-               referenced_idents.map(lifetime_show),
+               referenced_idents.iter().map(lifetime_show).collect::<Vec<token::InternedString>>(),
                early_count);
         if referenced_idents.is_empty() {
             let scope1 = LateScope(n, &generics.lifetimes, scope);
diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs
index c6819dbc919..7500c23e006 100644
--- a/src/librustc/middle/subst.rs
+++ b/src/librustc/middle/subst.rs
@@ -134,7 +134,7 @@ impl<T:Subst> Subst for Vec<T> {
     fn subst_spanned(&self, tcx: &ty::ctxt,
                      substs: &ty::substs,
                      span: Option<Span>) -> Vec<T> {
-        self.map(|t| t.subst_spanned(tcx, substs, span))
+        self.iter().map(|t| t.subst_spanned(tcx, substs, span)).collect()
     }
 }
 impl<T:Subst> Subst for Rc<T> {
@@ -189,7 +189,7 @@ impl Subst for ty::substs {
         ty::substs {
             regions: self.regions.subst_spanned(tcx, substs, span),
             self_ty: self.self_ty.map(|typ| typ.subst_spanned(tcx, substs, span)),
-            tps: self.tps.map(|typ| typ.subst_spanned(tcx, substs, span))
+            tps: self.tps.iter().map(|typ| typ.subst_spanned(tcx, substs, span)).collect()
         }
     }
 }
diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs
index ebb813f6d24..b27c46dae8c 100644
--- a/src/librustc/middle/trans/_match.rs
+++ b/src/librustc/middle/trans/_match.rs
@@ -192,7 +192,7 @@
  *
  */
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use back::abi;
 use driver::session::FullDebugInfo;
@@ -225,7 +225,6 @@ use util::ppaux::{Repr, vec_map_to_str};
 
 use collections::HashMap;
 use std::cell::Cell;
-use std::vec;
 use syntax::ast;
 use syntax::ast::Ident;
 use syntax::ast_util::path_to_ident;
@@ -256,43 +255,23 @@ enum Opt {
     vec_len(/* length */ uint, VecLenOpt, /*range of matches*/(uint, uint))
 }
 
+fn lit_to_expr(tcx: &ty::ctxt, a: &Lit) -> @ast::Expr {
+    match *a {
+        ExprLit(existing_a_expr) => existing_a_expr,
+        ConstLit(a_const) => const_eval::lookup_const_by_id(tcx, a_const).unwrap(),
+        UnitLikeStructLit(_) => fail!("lit_to_expr: unexpected struct lit"),
+    }
+}
+
 fn opt_eq(tcx: &ty::ctxt, a: &Opt, b: &Opt) -> bool {
     match (a, b) {
+        (&lit(UnitLikeStructLit(a)), &lit(UnitLikeStructLit(b))) => a == b,
         (&lit(a), &lit(b)) => {
-            match (a, b) {
-                (UnitLikeStructLit(a), UnitLikeStructLit(b)) => a == b,
-                _ => {
-                    let a_expr;
-                    match a {
-                        ExprLit(existing_a_expr) => a_expr = existing_a_expr,
-                            ConstLit(a_const) => {
-                                let e = const_eval::lookup_const_by_id(tcx, a_const);
-                                a_expr = e.unwrap();
-                            }
-                        UnitLikeStructLit(_) => {
-                            fail!("UnitLikeStructLit should have been handled \
-                                    above")
-                        }
-                    }
-
-                    let b_expr;
-                    match b {
-                        ExprLit(existing_b_expr) => b_expr = existing_b_expr,
-                            ConstLit(b_const) => {
-                                let e = const_eval::lookup_const_by_id(tcx, b_const);
-                                b_expr = e.unwrap();
-                            }
-                        UnitLikeStructLit(_) => {
-                            fail!("UnitLikeStructLit should have been handled \
-                                    above")
-                        }
-                    }
-
-                    match const_eval::compare_lit_exprs(tcx, a_expr, b_expr) {
-                        Some(val1) => val1 == 0,
-                        None => fail!("compare_list_exprs: type mismatch"),
-                    }
-                }
+            let a_expr = lit_to_expr(tcx, &a);
+            let b_expr = lit_to_expr(tcx, &b);
+            match const_eval::compare_lit_exprs(tcx, a_expr, b_expr) {
+                Some(val1) => val1 == 0,
+                None => fail!("compare_list_exprs: type mismatch"),
             }
         }
         (&range(a1, a2), &range(b1, b2)) => {
@@ -310,6 +289,42 @@ fn opt_eq(tcx: &ty::ctxt, a: &Opt, b: &Opt) -> bool {
     }
 }
 
+fn opt_overlap(tcx: &ty::ctxt, a: &Opt, b: &Opt) -> bool {
+    match (a, b) {
+        (&lit(a), &lit(b)) => {
+            let a_expr = lit_to_expr(tcx, &a);
+            let b_expr = lit_to_expr(tcx, &b);
+            match const_eval::compare_lit_exprs(tcx, a_expr, b_expr) {
+                Some(val1) => val1 == 0,
+                None => fail!("opt_overlap: type mismatch"),
+            }
+        }
+
+        (&range(a1, a2), &range(b1, b2)) => {
+            let m1 = const_eval::compare_lit_exprs(tcx, a1, b2);
+            let m2 = const_eval::compare_lit_exprs(tcx, b1, a2);
+            match (m1, m2) {
+                // two ranges [a1, a2] and [b1, b2] overlap iff:
+                //      a1 <= b2 && b1 <= a2
+                (Some(val1), Some(val2)) => (val1 <= 0 && val2 <= 0),
+                _ => fail!("opt_overlap: type mismatch"),
+            }
+        }
+
+        (&range(a1, a2), &lit(b)) | (&lit(b), &range(a1, a2)) => {
+            let b_expr = lit_to_expr(tcx, &b);
+            let m1 = const_eval::compare_lit_exprs(tcx, a1, b_expr);
+            let m2 = const_eval::compare_lit_exprs(tcx, a2, b_expr);
+            match (m1, m2) {
+                // b is in range [a1, a2] iff a1 <= b and b <= a2
+                (Some(val1), Some(val2)) => (val1 <= 0 && 0 <= val2),
+                _ => fail!("opt_overlap: type mismatch"),
+            }
+        }
+        _ => fail!("opt_overlap: expect lit or range")
+    }
+}
+
 pub enum opt_result<'a> {
     single_result(Result<'a>),
     lower_bound(Result<'a>),
@@ -462,11 +477,9 @@ fn expand_nested_bindings<'r,'b>(
     m.iter().map(|br| {
         match br.pats.get(col).node {
             ast::PatIdent(_, ref path, Some(inner)) => {
-                let pats = vec::append(
-                    Vec::from_slice(br.pats.slice(0u, col)),
-                    vec::append(vec!(inner),
-                                br.pats.slice(col + 1u,
-                                           br.pats.len())).as_slice());
+                let pats = Vec::from_slice(br.pats.slice(0u, col))
+                           .append((vec!(inner))
+                                   .append(br.pats.slice(col + 1u, br.pats.len())).as_slice());
 
                 let mut res = Match {
                     pats: pats,
@@ -490,7 +503,7 @@ fn assert_is_binding_or_wild(bcx: &Block, p: @ast::Pat) {
     }
 }
 
-type enter_pat<'a> = 'a |@ast::Pat| -> Option<Vec<@ast::Pat> >;
+type enter_pat<'a> = 'a |@ast::Pat| -> Option<Vec<@ast::Pat>>;
 
 fn enter_match<'r,'b>(
                bcx: &'b Block<'b>,
@@ -511,10 +524,8 @@ fn enter_match<'r,'b>(
     for br in m.iter() {
         match e(*br.pats.get(col)) {
             Some(sub) => {
-                let pats =
-                    vec::append(
-                        vec::append(sub, br.pats.slice(0u, col)),
-                        br.pats.slice(col + 1u, br.pats.len()));
+                let pats = sub.append(br.pats.slice(0u, col))
+                              .append(br.pats.slice(col + 1u, br.pats.len()));
 
                 let this = *br.pats.get(col);
                 let mut bound_ptrs = br.bound_ptrs.clone();
@@ -632,16 +643,30 @@ fn enter_opt<'r,'b>(
     let tcx = bcx.tcx();
     let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: DUMMY_SP};
     let mut i = 0;
+    // By the virtue of fact that we are in `trans` already, `enter_opt` is able
+    // to prune sub-match tree aggressively based on exact equality. But when it
+    // comes to literal or range, that strategy may lead to wrong result if there
+    // are guard function or multiple patterns inside tuple; in that case, pruning
+    // based on the overlap of patterns is required.
+    //
+    // Ideally, when constructing the sub-match tree for certain arm, only those
+    // arms beneath it matter. But that isn't how algorithm works right now and
+    // all other arms are taken into consideration when computing `guarded` below.
+    // That is ok since each round of `compile_submatch` guarantees to trim one
+    // "column" of arm patterns and the algorithm will converge.
+    let guarded = m.iter().any(|x| x.data.arm.guard.is_some());
+    let multi_pats = m.len() > 0 && m[0].pats.len() > 1;
     enter_match(bcx, tcx.def_map, m, col, val, |p| {
         let answer = match p.node {
             ast::PatEnum(..) |
             ast::PatIdent(_, _, None) if pat_is_const(tcx.def_map, p) => {
                 let const_def = tcx.def_map.borrow().get_copy(&p.id);
                 let const_def_id = ast_util::def_id_of_def(const_def);
-                if opt_eq(tcx, &lit(ConstLit(const_def_id)), opt) {
-                    Some(Vec::new())
-                } else {
-                    None
+                let konst = lit(ConstLit(const_def_id));
+                match guarded || multi_pats {
+                    false if opt_eq(tcx, &konst, opt) => Some(Vec::new()),
+                    true if opt_overlap(tcx, &konst, opt) => Some(Vec::new()),
+                    _ => None,
                 }
             }
             ast::PatEnum(_, ref subpats) => {
@@ -666,10 +691,20 @@ fn enter_opt<'r,'b>(
                 }
             }
             ast::PatLit(l) => {
-                if opt_eq(tcx, &lit(ExprLit(l)), opt) {Some(Vec::new())} else {None}
+                let lit_expr = lit(ExprLit(l));
+                match guarded || multi_pats {
+                    false if opt_eq(tcx, &lit_expr, opt) => Some(Vec::new()),
+                    true if opt_overlap(tcx, &lit_expr, opt) => Some(Vec::new()),
+                    _ => None,
+                }
             }
             ast::PatRange(l1, l2) => {
-                if opt_eq(tcx, &range(l1, l2), opt) {Some(Vec::new())} else {None}
+                let rng = range(l1, l2);
+                match guarded || multi_pats {
+                    false if opt_eq(tcx, &rng, opt) => Some(Vec::new()),
+                    true if opt_overlap(tcx, &rng, opt) => Some(Vec::new()),
+                    _ => None,
+                }
             }
             ast::PatStruct(_, ref field_pats, _) => {
                 if opt_eq(tcx, &variant_opt(bcx, p.id), opt) {
@@ -1517,8 +1552,7 @@ fn compile_submatch_continue<'r,
     let tcx = bcx.tcx();
     let dm = tcx.def_map;
 
-    let vals_left = vec::append(Vec::from_slice(vals.slice(0u, col)),
-                                   vals.slice(col + 1u, vals.len()));
+    let vals_left = Vec::from_slice(vals.slice(0u, col)).append(vals.slice(col + 1u, vals.len()));
     let ccx = bcx.fcx.ccx;
     let mut pat_id = 0;
     for br in m.iter() {
@@ -1538,10 +1572,10 @@ fn compile_submatch_continue<'r,
             let pat_ty = node_id_type(bcx, pat_id);
             let pat_repr = adt::represent_type(bcx.ccx(), pat_ty);
             expr::with_field_tys(tcx, pat_ty, Some(pat_id), |discr, field_tys| {
-                let rec_vals = rec_fields.map(|field_name| {
+                let rec_vals = rec_fields.iter().map(|field_name| {
                         let ix = ty::field_idx_strict(tcx, field_name.name, field_tys);
                         adt::trans_field_ptr(bcx, pat_repr, val, discr, ix)
-                        });
+                        }).collect::<Vec<_>>();
                 compile_submatch(
                         bcx,
                         enter_rec_or_struct(bcx,
@@ -1550,8 +1584,7 @@ fn compile_submatch_continue<'r,
                                             col,
                                             rec_fields.as_slice(),
                                             val).as_slice(),
-                        vec::append(rec_vals,
-                                       vals_left.as_slice()).as_slice(),
+                        rec_vals.append(vals_left.as_slice()).as_slice(),
                         chk);
             });
             return;
@@ -1576,8 +1609,7 @@ fn compile_submatch_continue<'r,
                                    col,
                                    val,
                                    n_tup_elts).as_slice(),
-                         vec::append(tup_vals,
-                                        vals_left.as_slice()).as_slice(),
+                         tup_vals.append(vals_left.as_slice()).as_slice(),
                          chk);
         return;
     }
@@ -1602,8 +1634,7 @@ fn compile_submatch_continue<'r,
         compile_submatch(bcx,
                          enter_tuple_struct(bcx, dm, m, col, val,
                                             struct_element_count).as_slice(),
-                         vec::append(llstructvals,
-                                        vals_left.as_slice()).as_slice(),
+                         llstructvals.append(vals_left.as_slice()).as_slice(),
                          chk);
         return;
     }
@@ -1612,8 +1643,7 @@ fn compile_submatch_continue<'r,
         let llbox = Load(bcx, val);
         compile_submatch(bcx,
                          enter_uniq(bcx, dm, m, col, val).as_slice(),
-                         vec::append(vec!(llbox),
-                                        vals_left.as_slice()).as_slice(),
+                         (vec!(llbox)).append(vals_left.as_slice()).as_slice(),
                          chk);
         return;
     }
@@ -1622,8 +1652,7 @@ fn compile_submatch_continue<'r,
         let loaded_val = Load(bcx, val);
         compile_submatch(bcx,
                          enter_region(bcx, dm, m, col, val).as_slice(),
-                         vec::append(vec!(loaded_val),
-                                        vals_left.as_slice()).as_slice(),
+                         (vec!(loaded_val)).append(vals_left.as_slice()).as_slice(),
                          chk);
         return;
     }
@@ -1804,7 +1833,7 @@ fn compile_submatch_continue<'r,
             lit(_) | range(_, _) => ()
         }
         let opt_ms = enter_opt(opt_cx, m, opt, col, size, val);
-        let opt_vals = vec::append(unpacked, vals_left.as_slice());
+        let opt_vals = unpacked.append(vals_left.as_slice());
 
         match branch_chk {
             None => {
diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs
index 1215eba17d7..b42721b754b 100644
--- a/src/librustc/middle/trans/adt.rs
+++ b/src/librustc/middle/trans/adt.rs
@@ -57,7 +57,6 @@ use middle::trans::type_::Type;
 use middle::trans::type_of;
 use middle::ty;
 use middle::ty::Disr;
-use std::vec;
 use syntax::abi::{X86, X86_64, Arm, Mips};
 use syntax::ast;
 use syntax::attr;
@@ -83,7 +82,7 @@ pub enum Repr {
      * General-case enums: for each case there is a struct, and they
      * all start with a field for the discriminant.
      */
-    General(IntType, Vec<Struct> ),
+    General(IntType, Vec<Struct>),
     /**
      * Two cases distinguished by a nullable pointer: the case with discriminant
      * `nndiscr` is represented by the struct `nonnull`, where the `ptrfield`th
@@ -95,16 +94,21 @@ pub enum Repr {
      * is represented such that `None` is a null pointer and `Some` is the
      * identity function.
      */
-    NullablePointer{ nonnull: Struct, nndiscr: Disr, ptrfield: uint,
-                     nullfields: Vec<ty::t> }
+    NullablePointer {
+        pub nonnull: Struct,
+        pub nndiscr: Disr,
+        pub ptrfield: uint,
+        pub nullfields: Vec<ty::t>,
+    }
 }
 
 /// For structs, and struct-like parts of anything fancier.
 pub struct Struct {
-    size: u64,
-    align: u64,
-    packed: bool,
-    fields: Vec<ty::t> }
+    pub size: u64,
+    pub align: u64,
+    pub packed: bool,
+    pub fields: Vec<ty::t>,
+}
 
 /**
  * Convenience for `represent_type`.  There should probably be more or
@@ -136,9 +140,9 @@ fn represent_type_uncached(cx: &CrateContext, t: ty::t) -> Repr {
         }
         ty::ty_struct(def_id, ref substs) => {
             let fields = ty::lookup_struct_fields(cx.tcx(), def_id);
-            let mut ftys = fields.map(|field| {
+            let mut ftys = fields.iter().map(|field| {
                 ty::lookup_field_type(cx.tcx(), def_id, field.id, substs)
-            });
+            }).collect::<Vec<_>>();
             let packed = ty::lookup_packed(cx.tcx(), def_id);
             let dtor = ty::ty_dtor(cx.tcx(), def_id).has_drop_flag();
             if dtor { ftys.push(ty::mk_bool()); }
@@ -158,7 +162,7 @@ fn represent_type_uncached(cx: &CrateContext, t: ty::t) -> Repr {
 
             if cases.iter().all(|c| c.tys.len() == 0) {
                 // All bodies empty -> intlike
-                let discrs = cases.map(|c| c.discr);
+                let discrs: Vec<u64> = cases.iter().map(|c| c.discr).collect();
                 let bounds = IntBounds {
                     ulo: *discrs.iter().min().unwrap(),
                     uhi: *discrs.iter().max().unwrap(),
@@ -218,12 +222,10 @@ fn represent_type_uncached(cx: &CrateContext, t: ty::t) -> Repr {
             let bounds = IntBounds { ulo: 0, uhi: (cases.len() - 1) as u64,
                                      slo: 0, shi: (cases.len() - 1) as i64 };
             let ity = range_to_inttype(cx, hint, &bounds);
-            return General(ity, cases.map(|c| {
+            return General(ity, cases.iter().map(|c| {
                 let discr = vec!(ty_of_inttype(ity));
-                mk_struct(cx,
-                          vec::append(discr, c.tys.as_slice()).as_slice(),
-                          false)
-            }))
+                mk_struct(cx, discr.append(c.tys.as_slice()).as_slice(), false)
+            }).collect())
         }
         _ => cx.sess().bug("adt::represent_type called on non-ADT type")
     }
@@ -270,18 +272,18 @@ impl Case {
 }
 
 fn get_cases(tcx: &ty::ctxt, def_id: ast::DefId, substs: &ty::substs) -> Vec<Case> {
-    ty::enum_variants(tcx, def_id).map(|vi| {
-        let arg_tys = vi.args.map(|&raw_ty| {
+    ty::enum_variants(tcx, def_id).iter().map(|vi| {
+        let arg_tys = vi.args.iter().map(|&raw_ty| {
             ty::subst(tcx, substs, raw_ty)
-        });
+        }).collect();
         Case { discr: vi.disr_val, tys: arg_tys }
-    })
+    }).collect()
 }
 
 
 fn mk_struct(cx: &CrateContext, tys: &[ty::t], packed: bool) -> Struct {
-    let lltys = tys.map(|&ty| type_of::sizing_type_of(cx, ty));
-    let llty_rec = Type::struct_(cx, lltys, packed);
+    let lltys = tys.iter().map(|&ty| type_of::sizing_type_of(cx, ty)).collect::<Vec<_>>();
+    let llty_rec = Type::struct_(cx, lltys.as_slice(), packed);
     Struct {
         size: machine::llsize_of_alloc(cx, llty_rec) /*bad*/as u64,
         align: machine::llalign_of_min(cx, llty_rec) /*bad*/as u64,
@@ -464,9 +466,9 @@ fn generic_type_of(cx: &CrateContext, r: &Repr, name: Option<&str>, sizing: bool
 
 fn struct_llfields(cx: &CrateContext, st: &Struct, sizing: bool) -> Vec<Type> {
     if sizing {
-        st.fields.map(|&ty| type_of::sizing_type_of(cx, ty))
+        st.fields.iter().map(|&ty| type_of::sizing_type_of(cx, ty)).collect()
     } else {
-        st.fields.map(|&ty| type_of::type_of(cx, ty))
+        st.fields.iter().map(|&ty| type_of::type_of(cx, ty)).collect()
     }
 }
 
@@ -643,25 +645,6 @@ pub fn num_args(r: &Repr, discr: Disr) -> uint {
 }
 
 /// Access a field, at a point when the value's case is known.
-pub fn deref_ty(ccx: &CrateContext, r: &Repr) -> ty::t {
-    match *r {
-        CEnum(..) => {
-            ccx.sess().bug("deref of c-like enum")
-        }
-        Univariant(ref st, _) => {
-            *st.fields.get(0)
-        }
-        General(_, ref cases) => {
-            assert!(cases.len() == 1);
-            *cases.get(0).fields.get(0)
-        }
-        NullablePointer{ .. } => {
-            ccx.sess().bug("deref of nullable ptr")
-        }
-    }
-}
-
-/// Access a field, at a point when the value's case is known.
 pub fn trans_field_ptr(bcx: &Block, r: &Repr, val: ValueRef, discr: Disr,
                        ix: uint) -> ValueRef {
     // Note: if this ever needs to generate conditionals (e.g., if we
@@ -700,7 +683,7 @@ fn struct_field_ptr(bcx: &Block, st: &Struct, val: ValueRef, ix: uint,
     let ccx = bcx.ccx();
 
     let val = if needs_cast {
-        let fields = st.fields.map(|&ty| type_of::type_of(ccx, ty));
+        let fields = st.fields.iter().map(|&ty| type_of::type_of(ccx, ty)).collect::<Vec<_>>();
         let real_ty = Type::struct_(ccx, fields.as_slice(), st.packed);
         PointerCast(bcx, val, real_ty.ptr_to())
     } else {
@@ -753,12 +736,8 @@ pub fn trans_const(ccx: &CrateContext, r: &Repr, discr: Disr,
             let lldiscr = C_integral(ll_inttype(ccx, ity), discr as u64, true);
             let contents = build_const_struct(ccx,
                                               case,
-                                              vec::append(
-                                                  vec!(lldiscr),
-                                                  vals).as_slice());
-            C_struct(ccx, vec::append(
-                        contents,
-                        &[padding(ccx, max_sz - case.size)]).as_slice(),
+                                              (vec!(lldiscr)).append(vals).as_slice());
+            C_struct(ccx, contents.append([padding(ccx, max_sz - case.size)]).as_slice(),
                      false)
         }
         Univariant(ref st, _dro) => {
@@ -773,11 +752,11 @@ pub fn trans_const(ccx: &CrateContext, r: &Repr, discr: Disr,
                                                  vals).as_slice(),
                          false)
             } else {
-                let vals = nonnull.fields.map(|&ty| {
+                let vals = nonnull.fields.iter().map(|&ty| {
                     // Always use null even if it's not the `ptrfield`th
                     // field; see #8506.
                     C_null(type_of::sizing_type_of(ccx, ty))
-                }).move_iter().collect::<Vec<ValueRef> >();
+                }).collect::<Vec<ValueRef>>();
                 C_struct(ccx, build_const_struct(ccx,
                                                  nonnull,
                                                  vals.as_slice()).as_slice(),
@@ -898,11 +877,3 @@ fn const_struct_field(ccx: &CrateContext, val: ValueRef, ix: uint)
         real_ix = real_ix + 1;
     }
 }
-
-/// Is it safe to bitcast a value to the one field of its one variant?
-pub fn is_newtypeish(r: &Repr) -> bool {
-    match *r {
-        Univariant(ref st, false) => st.fields.len() == 1,
-        _ => false
-    }
-}
diff --git a/src/librustc/middle/trans/asm.rs b/src/librustc/middle/trans/asm.rs
index f4ce7c3c6a6..5c32b3fba44 100644
--- a/src/librustc/middle/trans/asm.rs
+++ b/src/librustc/middle/trans/asm.rs
@@ -36,17 +36,17 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm)
     let temp_scope = fcx.push_custom_cleanup_scope();
 
     // Prepare the output operands
-    let outputs = ia.outputs.map(|&(ref c, out)| {
+    let outputs = ia.outputs.iter().map(|&(ref c, out)| {
         constraints.push((*c).clone());
 
         let out_datum = unpack_datum!(bcx, expr::trans(bcx, out));
         output_types.push(type_of::type_of(bcx.ccx(), out_datum.ty));
         out_datum.val
 
-    });
+    }).collect::<Vec<_>>();
 
     // Now the input operands
-    let inputs = ia.inputs.map(|&(ref c, input)| {
+    let inputs = ia.inputs.iter().map(|&(ref c, input)| {
         constraints.push((*c).clone());
 
         let in_datum = unpack_datum!(bcx, expr::trans(bcx, input));
@@ -57,12 +57,15 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm)
                                    cleanup::CustomScope(temp_scope),
                                    callee::DontAutorefArg)
         })
-    });
+    }).collect::<Vec<_>>();
 
     // no failure occurred preparing operands, no need to cleanup
     fcx.pop_custom_cleanup_scope(temp_scope);
 
-    let mut constraints = constraints.map(|s| s.get().to_str()).connect(",");
+    let mut constraints = constraints.iter()
+                                     .map(|s| s.get().to_str())
+                                     .collect::<Vec<~str>>()
+                                     .connect(",");
 
     let mut clobbers = getClobbers();
     if !ia.clobbers.get().is_empty() && !clobbers.is_empty() {
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index b5e64972115..9657265e140 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -23,7 +23,7 @@
 //     but one TypeRef corresponds to many `ty::t`s; for instance, tup(int, int,
 //     int) and rec(x=int, y=int, z=int) will have the same TypeRef.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use back::link::{mangle_exported_name};
 use back::{link, abi};
@@ -77,13 +77,11 @@ use std::cell::{Cell, RefCell};
 use std::libc::c_uint;
 use std::local_data;
 use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic};
-use syntax::ast_map::PathName;
 use syntax::ast_util::{local_def, is_local};
 use syntax::attr::AttrMetaMethods;
 use syntax::attr;
 use syntax::codemap::Span;
 use syntax::parse::token::InternedString;
-use syntax::parse::token;
 use syntax::visit::Visitor;
 use syntax::visit;
 use syntax::{ast, ast_util, ast_map};
@@ -246,6 +244,8 @@ fn get_extern_rust_fn(ccx: &CrateContext, inputs: &[ty::t], output: ty::t,
 pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool,
                     inputs: &[ty::t], output: ty::t,
                     name: &str) -> ValueRef {
+    use middle::ty::{BrAnon, ReLateBound};
+
     let llfty = type_of_rust_fn(ccx, has_env, inputs, output);
     let llfn = decl_cdecl_fn(ccx.llmod, name, llfty, output);
 
@@ -265,7 +265,16 @@ pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool,
                 unsafe {
                     llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
                 }
-            }
+            },
+            // When a reference in an argument has no named lifetime, it's
+            // impossible for that reference to escape this function(ie, be
+            // returned).
+            ty::ty_rptr(ReLateBound(_, BrAnon(_)), _) => {
+                debug!("marking argument of {} as nocapture because of anonymous lifetime", name);
+                unsafe {
+                    llvm::LLVMAddAttribute(llarg, lib::llvm::NoCaptureAttribute as c_uint);
+                }
+            },
             _ => {
                 // For non-immediate arguments the callee gets its own copy of
                 // the value on the stack, so there are no aliases
@@ -402,9 +411,9 @@ pub fn malloc_raw<'a>(bcx: &'a Block<'a>, t: ty::t, heap: heap)
 }
 
 pub struct MallocResult<'a> {
-    bcx: &'a Block<'a>,
-    smart_ptr: ValueRef,
-    body: ValueRef
+    pub bcx: &'a Block<'a>,
+    pub smart_ptr: ValueRef,
+    pub body: ValueRef
 }
 
 // malloc_general_dyn: usefully wraps malloc_raw_dyn; allocates a smart
@@ -436,10 +445,6 @@ pub fn malloc_general<'a>(bcx: &'a Block<'a>, t: ty::t, heap: heap)
 
 // Type descriptor and type glue stuff
 
-pub fn get_tydesc_simple(ccx: &CrateContext, t: ty::t) -> ValueRef {
-    get_tydesc(ccx, t).tydesc
-}
-
 pub fn get_tydesc(ccx: &CrateContext, t: ty::t) -> @tydesc_info {
     match ccx.tydescs.borrow().find(&t) {
         Some(&inf) => return inf,
@@ -453,6 +458,7 @@ pub fn get_tydesc(ccx: &CrateContext, t: ty::t) -> @tydesc_info {
     return inf;
 }
 
+#[allow(dead_code)] // useful
 pub fn set_optimize_for_size(f: ValueRef) {
     lib::llvm::SetFunctionAttribute(f, lib::llvm::OptimizeForSizeAttribute)
 }
@@ -461,6 +467,7 @@ pub fn set_no_inline(f: ValueRef) {
     lib::llvm::SetFunctionAttribute(f, lib::llvm::NoInlineAttribute)
 }
 
+#[allow(dead_code)] // useful
 pub fn set_no_unwind(f: ValueRef) {
     lib::llvm::SetFunctionAttribute(f, lib::llvm::NoUnwindAttribute)
 }
@@ -656,19 +663,6 @@ pub fn compare_scalar_values<'a>(
 pub type val_and_ty_fn<'r,'b> =
     'r |&'b Block<'b>, ValueRef, ty::t| -> &'b Block<'b>;
 
-pub fn load_inbounds<'a>(cx: &'a Block<'a>, p: ValueRef, idxs: &[uint])
-                     -> ValueRef {
-    return Load(cx, GEPi(cx, p, idxs));
-}
-
-pub fn store_inbounds<'a>(
-                      cx: &'a Block<'a>,
-                      v: ValueRef,
-                      p: ValueRef,
-                      idxs: &[uint]) {
-    Store(cx, v, GEPi(cx, p, idxs));
-}
-
 // Iterates through the elements of a structural type.
 pub fn iter_structural_ty<'r,
                           'b>(
@@ -861,8 +855,8 @@ pub fn trans_external_path(ccx: &CrateContext, did: ast::DefId, t: ty::t) -> Val
     let name = csearch::get_symbol(&ccx.sess().cstore, did);
     match ty::get(t).sty {
         ty::ty_bare_fn(ref fn_ty) => {
-            match fn_ty.abis.for_target(ccx.sess().targ_cfg.os,
-                                        ccx.sess().targ_cfg.arch) {
+            match fn_ty.abi.for_target(ccx.sess().targ_cfg.os,
+                                       ccx.sess().targ_cfg.arch) {
                 Some(Rust) | Some(RustIntrinsic) => {
                     get_extern_rust_fn(ccx,
                                        fn_ty.sig.inputs.as_slice(),
@@ -871,7 +865,7 @@ pub fn trans_external_path(ccx: &CrateContext, did: ast::DefId, t: ty::t) -> Val
                                        did)
                 }
                 Some(..) | None => {
-                    let c = foreign::llvm_calling_convention(ccx, fn_ty.abis);
+                    let c = foreign::llvm_calling_convention(ccx, fn_ty.abi);
                     let cconv = c.unwrap_or(lib::llvm::CCallConv);
                     let llty = type_of_fn_from_ty(ccx, t);
                     get_extern_fn(&mut *ccx.externs.borrow_mut(), ccx.llmod,
@@ -964,29 +958,6 @@ pub fn need_invoke(bcx: &Block) -> bool {
     bcx.fcx.needs_invoke()
 }
 
-pub fn do_spill(bcx: &Block, v: ValueRef, t: ty::t) -> ValueRef {
-    if ty::type_is_bot(t) {
-        return C_null(Type::i8p(bcx.ccx()));
-    }
-    let llptr = alloc_ty(bcx, t, "");
-    Store(bcx, v, llptr);
-    return llptr;
-}
-
-// Since this function does *not* root, it is the caller's responsibility to
-// ensure that the referent is pointed to by a root.
-pub fn do_spill_noroot(cx: &Block, v: ValueRef) -> ValueRef {
-    let llptr = alloca(cx, val_ty(v), "");
-    Store(cx, v, llptr);
-    return llptr;
-}
-
-pub fn spill_if_immediate(cx: &Block, v: ValueRef, t: ty::t) -> ValueRef {
-    let _icx = push_ctxt("spill_if_immediate");
-    if type_is_immediate(cx.ccx(), t) { return do_spill(cx, v, t); }
-    return v;
-}
-
 pub fn load_if_immediate(cx: &Block, v: ValueRef, t: ty::t) -> ValueRef {
     let _icx = push_ctxt("load_if_immediate");
     if type_is_immediate(cx.ccx(), t) { return Load(cx, v); }
@@ -1029,20 +1000,6 @@ pub fn raw_block<'a>(
     Block::new(llbb, is_lpad, None, fcx)
 }
 
-pub fn block_locals(b: &ast::Block, it: |@ast::Local|) {
-    for s in b.stmts.iter() {
-        match s.node {
-          ast::StmtDecl(d, _) => {
-            match d.node {
-              ast::DeclLocal(ref local) => it(*local),
-              _ => {} /* fall through */
-            }
-          }
-          _ => {} /* fall through */
-        }
-    }
-}
-
 pub fn with_cond<'a>(
                  bcx: &'a Block<'a>,
                  val: ValueRef,
@@ -1162,10 +1119,6 @@ pub fn arrayalloca(cx: &Block, ty: Type, v: ValueRef) -> ValueRef {
     return ArrayAlloca(cx, ty, v);
 }
 
-pub struct BasicBlocks {
-    sa: BasicBlockRef,
-}
-
 // Creates and returns space for, or returns the argument representing, the
 // slot where the return value of the function must go.
 pub fn make_return_pointer(fcx: &FunctionContext, output_type: ty::t)
@@ -1175,7 +1128,7 @@ pub fn make_return_pointer(fcx: &FunctionContext, output_type: ty::t)
             llvm::LLVMGetParam(fcx.llfn, 0)
         } else {
             let lloutputtype = type_of::type_of(fcx.ccx, output_type);
-            let bcx = fcx.entry_bcx.get().unwrap();
+            let bcx = fcx.entry_bcx.borrow().clone().unwrap();
             Alloca(bcx, lloutputtype, "__make_return_pointer")
         }
     }
@@ -1256,7 +1209,7 @@ pub fn init_function<'a>(
                      param_substs: Option<@param_substs>) {
     let entry_bcx = fcx.new_temp_block("entry-block");
 
-    fcx.entry_bcx.set(Some(entry_bcx));
+    *fcx.entry_bcx.borrow_mut() = Some(entry_bcx);
 
     // Use a dummy instruction as the insertion point for all allocas.
     // This is later removed in FunctionContext::cleanup.
@@ -1446,7 +1399,7 @@ pub fn trans_closure(ccx: &CrateContext,
 
     // Create the first basic block in the function and keep a handle on it to
     //  pass to finish_fn later.
-    let bcx_top = fcx.entry_bcx.get().unwrap();
+    let bcx_top = fcx.entry_bcx.borrow().clone().unwrap();
     let mut bcx = bcx_top;
     let block_ty = node_id_type(bcx, body.id);
 
@@ -1594,7 +1547,7 @@ fn trans_enum_variant_or_tuple_like_struct(ccx: &CrateContext,
 
     let arg_datums = create_datums_for_fn_args(&fcx, arg_tys.as_slice());
 
-    let bcx = fcx.entry_bcx.get().unwrap();
+    let bcx = fcx.entry_bcx.borrow().clone().unwrap();
 
     if !type_is_zero_size(fcx.ccx, result_ty) {
         let repr = adt::represent_type(ccx, result_ty);
@@ -1636,7 +1589,7 @@ pub fn trans_enum_def(ccx: &CrateContext, enum_definition: &ast::EnumDef,
 }
 
 pub struct TransItemVisitor<'a> {
-    ccx: &'a CrateContext,
+    pub ccx: &'a CrateContext,
 }
 
 impl<'a> Visitor<()> for TransItemVisitor<'a> {
@@ -1648,7 +1601,7 @@ impl<'a> Visitor<()> for TransItemVisitor<'a> {
 pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
     let _icx = push_ctxt("trans_item");
     match item.node {
-      ast::ItemFn(decl, purity, _abis, ref generics, body) => {
+      ast::ItemFn(decl, purity, _abi, ref generics, body) => {
         if purity == ast::ExternFn  {
             let llfndecl = get_item_val(ccx, item.id);
             foreign::trans_rust_fn_with_foreign_abi(
@@ -1768,7 +1721,7 @@ fn register_fn(ccx: &CrateContext,
                -> ValueRef {
     let f = match ty::get(node_type).sty {
         ty::ty_bare_fn(ref f) => {
-            assert!(f.abis.is_rust() || f.abis.is_intrinsic());
+            assert!(f.abi == Rust || f.abi == RustIntrinsic);
             f
         }
         _ => fail!("expected bare rust fn or an intrinsic")
@@ -1799,7 +1752,7 @@ pub fn register_fn_llvmty(ccx: &CrateContext,
 }
 
 pub fn is_entry_fn(sess: &Session, node_id: ast::NodeId) -> bool {
-    match sess.entry_fn.get() {
+    match *sess.entry_fn.borrow() {
         Some((entry_id, _)) => node_id == entry_id,
         None => false
     }
@@ -2044,8 +1997,8 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
 
             match ni.node {
                 ast::ForeignItemFn(..) => {
-                    let abis = ccx.tcx.map.get_foreign_abis(id);
-                    foreign::register_foreign_item_fn(ccx, abis, ni)
+                    let abi = ccx.tcx.map.get_foreign_abi(id);
+                    foreign::register_foreign_item_fn(ccx, abi, ni)
                 }
                 ast::ForeignItemStatic(..) => {
                     foreign::register_static(ccx, ni)
@@ -2131,11 +2084,6 @@ fn register_method(ccx: &CrateContext, id: ast::NodeId,
     llfn
 }
 
-pub fn vp2i(cx: &Block, v: ValueRef) -> ValueRef {
-    let ccx = cx.ccx();
-    return PtrToInt(cx, v, ccx.int_type);
-}
-
 pub fn p2i(ccx: &CrateContext, v: ValueRef) -> ValueRef {
     unsafe {
         return llvm::LLVMConstPtrToInt(v, ccx.int_type.to_ref());
@@ -2304,18 +2252,6 @@ pub fn declare_intrinsics(ccx: &mut CrateContext) {
     }
 }
 
-pub fn trap(bcx: &Block) {
-    match bcx.ccx().intrinsics.find_equiv(& &"llvm.trap") {
-      Some(&x) => { Call(bcx, x, [], []); },
-      _ => bcx.sess().bug("unbound llvm.trap in trap")
-    }
-}
-
-pub fn symname(name: &str, hash: &str, vers: &str) -> ~str {
-    let path = [PathName(token::intern(name))];
-    link::exported_name(ast_map::Values(path.iter()).chain(None), hash, vers)
-}
-
 pub fn crate_ctxt_to_encode_parms<'r>(cx: &'r CrateContext, ie: encoder::EncodeInlinedItem<'r>)
     -> encoder::EncodeParams<'r> {
 
diff --git a/src/librustc/middle/trans/basic_block.rs b/src/librustc/middle/trans/basic_block.rs
index 074c9f4fec5..303ad5fbce2 100644
--- a/src/librustc/middle/trans/basic_block.rs
+++ b/src/librustc/middle/trans/basic_block.rs
@@ -12,7 +12,7 @@ use lib::llvm::{llvm, BasicBlockRef};
 use middle::trans::value::{Users, Value};
 use std::iter::{Filter, Map};
 
-pub struct BasicBlock(BasicBlockRef);
+pub struct BasicBlock(pub BasicBlockRef);
 
 pub type Preds<'a> = Map<'a, Value, BasicBlock, Filter<'a, Value, Users>>;
 
diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs
index 79e22ea3455..f40a9ede862 100644
--- a/src/librustc/middle/trans/build.rs
+++ b/src/librustc/middle/trans/build.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(dead_code)] // FFI wrappers
 
 use lib::llvm::llvm;
 use lib::llvm::{CallConv, AtomicBinOp, AtomicOrdering, AsmDialect};
@@ -121,7 +122,7 @@ pub fn Invoke(cx: &Block,
     terminate(cx, "Invoke");
     debug!("Invoke({} with arguments ({}))",
            cx.val_to_str(fn_),
-           args.map(|a| cx.val_to_str(*a)).connect(", "));
+           args.iter().map(|a| cx.val_to_str(*a)).collect::<Vec<~str>>().connect(", "));
     B(cx).invoke(fn_, args, then, catch, attributes)
 }
 
diff --git a/src/librustc/middle/trans/builder.rs b/src/librustc/middle/trans/builder.rs
index 4526f3505be..07017de2bc2 100644
--- a/src/librustc/middle/trans/builder.rs
+++ b/src/librustc/middle/trans/builder.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(dead_code)] // FFI wrappers
+
 use lib;
 use lib::llvm::llvm;
 use lib::llvm::{CallConv, AtomicBinOp, AtomicOrdering, AsmDialect};
@@ -23,8 +25,8 @@ use std::libc::{c_uint, c_ulonglong, c_char};
 use syntax::codemap::Span;
 
 pub struct Builder<'a> {
-    llbuilder: BuilderRef,
-    ccx: &'a CrateContext,
+    pub llbuilder: BuilderRef,
+    pub ccx: &'a CrateContext,
 }
 
 // This is a really awful way to get a zero-length c-string, but better (and a
@@ -780,13 +782,13 @@ impl<'a> Builder<'a> {
         let alignstack = if alignstack { lib::llvm::True }
                          else          { lib::llvm::False };
 
-        let argtys = inputs.map(|v| {
+        let argtys = inputs.iter().map(|v| {
             debug!("Asm Input Type: {:?}", self.ccx.tn.val_to_str(*v));
             val_ty(*v)
-        });
+        }).collect::<Vec<_>>();
 
         debug!("Asm Output Type: {:?}", self.ccx.tn.type_to_str(output));
-        let fty = Type::func(argtys, &output);
+        let fty = Type::func(argtys.as_slice(), &output);
         unsafe {
             let v = llvm::LLVMInlineAsm(
                 fty.to_ref(), asm, cons, volatile, alignstack, dia as c_uint);
@@ -800,7 +802,10 @@ impl<'a> Builder<'a> {
 
         debug!("Call {} with args ({})",
                self.ccx.tn.val_to_str(llfn),
-               args.map(|&v| self.ccx.tn.val_to_str(v)).connect(", "));
+               args.iter()
+                   .map(|&v| self.ccx.tn.val_to_str(v))
+                   .collect::<Vec<~str>>()
+                   .connect(", "));
 
         unsafe {
             let v = llvm::LLVMBuildCall(self.llbuilder, llfn, args.as_ptr(),
diff --git a/src/librustc/middle/trans/cabi.rs b/src/librustc/middle/trans/cabi.rs
index ddd9f11034d..2c9be587eaa 100644
--- a/src/librustc/middle/trans/cabi.rs
+++ b/src/librustc/middle/trans/cabi.rs
@@ -35,15 +35,15 @@ pub enum ArgKind {
 /// This is borrowed from clang's ABIInfo.h
 #[deriving(Clone)]
 pub struct ArgType {
-    kind: ArgKind,
+    pub kind: ArgKind,
     /// Original LLVM type
-    ty: Type,
+    pub ty: Type,
     /// Coerced LLVM Type
-    cast: option::Option<Type>,
+    pub cast: option::Option<Type>,
     /// Dummy argument, which is emitted before the real argument
-    pad: option::Option<Type>,
+    pub pad: option::Option<Type>,
     /// LLVM attribute of argument
-    attr: option::Option<Attribute>
+    pub attr: option::Option<Attribute>
 }
 
 impl ArgType {
@@ -79,10 +79,6 @@ impl ArgType {
         }
     }
 
-    pub fn is_direct(&self) -> bool {
-        return self.kind == Direct;
-    }
-
     pub fn is_indirect(&self) -> bool {
         return self.kind == Indirect;
     }
@@ -99,10 +95,10 @@ impl ArgType {
 /// comments are reverse-engineered and may be inaccurate. -NDM
 pub struct FnType {
     /// The LLVM types of each argument.
-    arg_tys: Vec<ArgType> ,
+    pub arg_tys: Vec<ArgType> ,
 
     /// LLVM return type.
-    ret_ty: ArgType,
+    pub ret_ty: ArgType,
 }
 
 pub fn compute_abi_info(ccx: &CrateContext,
diff --git a/src/librustc/middle/trans/cabi_arm.rs b/src/librustc/middle/trans/cabi_arm.rs
index 5dc9a915746..ee2c6454aee 100644
--- a/src/librustc/middle/trans/cabi_arm.rs
+++ b/src/librustc/middle/trans/cabi_arm.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_uppercase_pattern_statics)];
+#![allow(non_uppercase_pattern_statics)]
 
 use lib::llvm::{llvm, Integer, Pointer, Float, Double, Struct, Array};
 use lib::llvm::StructRetAttribute;
diff --git a/src/librustc/middle/trans/cabi_mips.rs b/src/librustc/middle/trans/cabi_mips.rs
index a3732075855..cbcecb2220d 100644
--- a/src/librustc/middle/trans/cabi_mips.rs
+++ b/src/librustc/middle/trans/cabi_mips.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_uppercase_pattern_statics)];
+#![allow(non_uppercase_pattern_statics)]
 
 use std::libc::c_uint;
 use std::cmp;
diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs
index dbb258ea399..0ed87ef8092 100644
--- a/src/librustc/middle/trans/cabi_x86_64.rs
+++ b/src/librustc/middle/trans/cabi_x86_64.rs
@@ -11,7 +11,7 @@
 // The classification code for the x86_64 ABI is taken from the clay language
 // https://github.com/jckarter/clay/blob/master/compiler/src/externals.cpp
 
-#[allow(non_uppercase_pattern_statics)];
+#![allow(non_uppercase_pattern_statics)]
 
 use lib::llvm::{llvm, Integer, Pointer, Float, Double};
 use lib::llvm::{Struct, Array, Attribute};
diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs
index 92b97cdfc9f..13fcaa486f1 100644
--- a/src/librustc/middle/trans/callee.rs
+++ b/src/librustc/middle/trans/callee.rs
@@ -20,7 +20,7 @@ use std::slice;
 
 use back::abi;
 use driver::session;
-use lib::llvm::{ValueRef, NoAliasAttribute, StructRetAttribute};
+use lib::llvm::{ValueRef, NoAliasAttribute, StructRetAttribute, NoCaptureAttribute};
 use lib::llvm::llvm;
 use metadata::csearch;
 use middle::trans::base;
@@ -49,14 +49,13 @@ use util::ppaux::Repr;
 
 use middle::trans::type_::Type;
 
-use std::vec;
 use syntax::ast;
-use syntax::abi::AbiSet;
+use synabi = syntax::abi;
 use syntax::ast_map;
 
 pub struct MethodData {
-    llfn: ValueRef,
-    llself: ValueRef,
+    pub llfn: ValueRef,
+    pub llself: ValueRef,
 }
 
 pub enum CalleeData {
@@ -71,8 +70,8 @@ pub enum CalleeData {
 }
 
 pub struct Callee<'a> {
-    bcx: &'a Block<'a>,
-    data: CalleeData
+    pub bcx: &'a Block<'a>,
+    pub data: CalleeData
 }
 
 fn trans<'a>(bcx: &'a Block<'a>, expr: &ast::Expr) -> Callee<'a> {
@@ -227,8 +226,7 @@ fn resolve_default_method_vtables(bcx: &Block,
         None => slice::from_elem(num_method_vtables, @Vec::new())
     };
 
-    let param_vtables = @(vec::append((*trait_vtables_fixed).clone(),
-                                          method_vtables));
+    let param_vtables = @((*trait_vtables_fixed).clone().append(method_vtables));
 
     let self_vtables = resolve_param_vtables_under_param_substs(
         bcx.tcx(), param_substs, impl_res.self_vtables);
@@ -365,7 +363,7 @@ pub fn trans_fn_ref_with_vtables(
 
         match map_node {
             ast_map::NodeForeignItem(_) => {
-                tcx.map.get_foreign_abis(def_id.node).is_intrinsic()
+                tcx.map.get_foreign_abi(def_id.node) == synabi::RustIntrinsic
             }
             _ => false
         }
@@ -514,48 +512,6 @@ pub fn trans_lang_call<'a>(
                              dest)
 }
 
-pub fn trans_lang_call_with_type_params<'a>(
-                                        bcx: &'a Block<'a>,
-                                        did: ast::DefId,
-                                        args: &[ValueRef],
-                                        type_params: &[ty::t],
-                                        dest: expr::Dest)
-                                        -> &'a Block<'a> {
-    let fty;
-    if did.krate == ast::LOCAL_CRATE {
-        fty = ty::node_id_to_type(bcx.tcx(), did.node);
-    } else {
-        fty = csearch::get_type(bcx.tcx(), did).ty;
-    }
-
-    return callee::trans_call_inner(
-        bcx,
-        None,
-        fty,
-        |bcx, _| {
-            let callee =
-                trans_fn_ref_with_vtables_to_callee(bcx, did, 0,
-                                                    type_params,
-                                                    None);
-
-            let new_llval;
-            match callee.data {
-                Fn(llfn) => {
-                    let substituted = ty::subst_tps(callee.bcx.tcx(),
-                                                    type_params,
-                                                    None,
-                                                    fty);
-                    let llfnty = type_of::type_of(callee.bcx.ccx(),
-                                                      substituted);
-                    new_llval = PointerCast(callee.bcx, llfn, llfnty);
-                }
-                _ => fail!()
-            }
-            Callee { bcx: callee.bcx, data: Fn(new_llval) }
-        },
-        ArgVals(args), Some(dest)).bcx;
-}
-
 pub fn trans_call_inner<'a>(
                         bcx: &'a Block<'a>,
                         call_info: Option<NodeInfo>,
@@ -616,13 +572,11 @@ pub fn trans_call_inner<'a>(
     };
 
     let (abi, ret_ty) = match ty::get(callee_ty).sty {
-        ty::ty_bare_fn(ref f) => (f.abis, f.sig.output),
-        ty::ty_closure(ref f) => (AbiSet::Rust(), f.sig.output),
+        ty::ty_bare_fn(ref f) => (f.abi, f.sig.output),
+        ty::ty_closure(ref f) => (synabi::Rust, f.sig.output),
         _ => fail!("expected bare rust fn or closure in trans_call_inner")
     };
-    let is_rust_fn =
-        abi.is_rust() ||
-        abi.is_intrinsic();
+    let is_rust_fn = abi == synabi::Rust || abi == synabi::RustIntrinsic;
 
     // Generate a location to store the result. If the user does
     // not care about the result, just make a stack slot.
@@ -661,9 +615,15 @@ pub fn trans_call_inner<'a>(
             llargs.push(opt_llretslot.unwrap());
         }
 
+        // start at 1, because index 0 is the return value of the llvm func
+        let mut first_arg_offset = 1;
+
         // Push the environment (or a trait object's self).
         match (llenv, llself) {
-            (Some(llenv), None) => llargs.push(llenv),
+            (Some(llenv), None) => {
+                first_arg_offset += 1;
+                llargs.push(llenv)
+            },
             (None, Some(llself)) => llargs.push(llself),
             _ => {}
         }
@@ -682,6 +642,11 @@ pub fn trans_call_inner<'a>(
         let mut attrs = Vec::new();
         if type_of::return_uses_outptr(ccx, ret_ty) {
             attrs.push((1, StructRetAttribute));
+            // The outptr can be noalias and nocapture because it's entirely
+            // invisible to the program.
+            attrs.push((1, NoAliasAttribute));
+            attrs.push((1, NoCaptureAttribute));
+            first_arg_offset += 1;
         }
 
         // The `noalias` attribute on the return value is useful to a
@@ -695,6 +660,30 @@ pub fn trans_call_inner<'a>(
             _ => {}
         }
 
+        debug!("trans_callee_inner: first_arg_offset={}", first_arg_offset);
+
+        for (idx, &t) in ty::ty_fn_args(callee_ty).iter().enumerate()
+                                                  .map(|(i, v)| (i+first_arg_offset, v)) {
+            use middle::ty::{BrAnon, ReLateBound};
+            if !type_is_immediate(ccx, t) {
+                // if it's not immediate, we have a program-invisible pointer,
+                // which it can't possibly capture
+                attrs.push((idx, NoCaptureAttribute));
+                debug!("trans_callee_inner: argument {} nocapture because it's non-immediate", idx);
+                continue;
+            }
+
+            let t_ = ty::get(t);
+            match t_.sty {
+                ty::ty_rptr(ReLateBound(_, BrAnon(_)), _) => {
+                    debug!("trans_callee_inner: argument {} nocapture because \
+                           of anonymous lifetime", idx);
+                    attrs.push((idx, NoCaptureAttribute));
+                },
+                _ => { }
+            }
+        }
+
         // Invoke the actual rust fn and update bcx/llresult.
         let (llret, b) = base::invoke(bcx,
                                       llfn,
diff --git a/src/librustc/middle/trans/cleanup.rs b/src/librustc/middle/trans/cleanup.rs
index a977ea99ef1..06869d50fc4 100644
--- a/src/librustc/middle/trans/cleanup.rs
+++ b/src/librustc/middle/trans/cleanup.rs
@@ -42,7 +42,7 @@ pub struct CleanupScope<'a> {
 }
 
 pub struct CustomScopeIndex {
-    priv index: uint
+    index: uint
 }
 
 pub static EXIT_BREAK: uint = 0;
diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs
index 1d2e1d0232c..4671e21170e 100644
--- a/src/librustc/middle/trans/closure.rs
+++ b/src/librustc/middle/trans/closure.rs
@@ -464,7 +464,7 @@ pub fn get_wrapper_for_bare_fn(ccx: &CrateContext,
     let arena = TypedArena::new();
     let fcx = new_fn_ctxt(ccx, llfn, -1, true, f.sig.output, None, None, &arena);
     init_function(&fcx, true, f.sig.output, None);
-    let bcx = fcx.entry_bcx.get().unwrap();
+    let bcx = fcx.entry_bcx.borrow().clone().unwrap();
 
     let args = create_datums_for_fn_args(&fcx,
                                          ty::ty_fn_args(closure_ty)
diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs
index 78700bab3f2..369807e98d7 100644
--- a/src/librustc/middle/trans/common.rs
+++ b/src/librustc/middle/trans/common.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 //! Code that is useful in various trans modules.
 
@@ -24,7 +24,6 @@ use middle::trans::datum;
 use middle::trans::datum::{Datum, Lvalue};
 use middle::trans::debuginfo;
 use middle::trans::type_::Type;
-use middle::ty::substs;
 use middle::ty;
 use middle::typeck;
 use util::ppaux::Repr;
@@ -111,12 +110,12 @@ pub fn gensym_name(name: &str) -> PathElem {
 }
 
 pub struct tydesc_info {
-    ty: ty::t,
-    tydesc: ValueRef,
-    size: ValueRef,
-    align: ValueRef,
-    name: ValueRef,
-    visit_glue: Cell<Option<ValueRef>>,
+    pub ty: ty::t,
+    pub tydesc: ValueRef,
+    pub size: ValueRef,
+    pub align: ValueRef,
+    pub name: ValueRef,
+    pub visit_glue: Cell<Option<ValueRef>>,
 }
 
 /*
@@ -146,8 +145,8 @@ pub struct tydesc_info {
  */
 
 pub struct NodeInfo {
-    id: ast::NodeId,
-    span: Span,
+    pub id: ast::NodeId,
+    pub span: Span,
 }
 
 pub fn expr_info(expr: &ast::Expr) -> NodeInfo {
@@ -155,22 +154,22 @@ pub fn expr_info(expr: &ast::Expr) -> NodeInfo {
 }
 
 pub struct Stats {
-    n_static_tydescs: Cell<uint>,
-    n_glues_created: Cell<uint>,
-    n_null_glues: Cell<uint>,
-    n_real_glues: Cell<uint>,
-    n_fns: Cell<uint>,
-    n_monos: Cell<uint>,
-    n_inlines: Cell<uint>,
-    n_closures: Cell<uint>,
-    n_llvm_insns: Cell<uint>,
-    llvm_insns: RefCell<HashMap<~str, uint>>,
+    pub n_static_tydescs: Cell<uint>,
+    pub n_glues_created: Cell<uint>,
+    pub n_null_glues: Cell<uint>,
+    pub n_real_glues: Cell<uint>,
+    pub n_fns: Cell<uint>,
+    pub n_monos: Cell<uint>,
+    pub n_inlines: Cell<uint>,
+    pub n_closures: Cell<uint>,
+    pub n_llvm_insns: Cell<uint>,
+    pub llvm_insns: RefCell<HashMap<~str, uint>>,
     // (ident, time-in-ms, llvm-instructions)
-    fn_stats: RefCell<Vec<(~str, uint, uint)> >,
+    pub fn_stats: RefCell<Vec<(~str, uint, uint)> >,
 }
 
 pub struct BuilderRef_res {
-    b: BuilderRef,
+    pub b: BuilderRef,
 }
 
 impl Drop for BuilderRef_res {
@@ -192,10 +191,10 @@ pub type ExternMap = HashMap<~str, ValueRef>;
 // Here `self_ty` is the real type of the self parameter to this method. It
 // will only be set in the case of default methods.
 pub struct param_substs {
-    tys: Vec<ty::t> ,
-    self_ty: Option<ty::t>,
-    vtables: Option<typeck::vtable_res>,
-    self_vtables: Option<typeck::vtable_param_res>
+    pub tys: Vec<ty::t> ,
+    pub self_ty: Option<ty::t>,
+    pub vtables: Option<typeck::vtable_res>,
+    pub self_vtables: Option<typeck::vtable_param_res>
 }
 
 impl param_substs {
@@ -228,69 +227,69 @@ pub struct FunctionContext<'a> {
     // address of the first instruction in the sequence of
     // instructions for this function that will go in the .text
     // section of the executable we're generating.
-    llfn: ValueRef,
+    pub llfn: ValueRef,
 
     // The environment argument in a closure.
-    llenv: Option<ValueRef>,
+    pub llenv: Option<ValueRef>,
 
     // The place to store the return value. If the return type is immediate,
     // this is an alloca in the function. Otherwise, it's the hidden first
     // parameter to the function. After function construction, this should
     // always be Some.
-    llretptr: Cell<Option<ValueRef>>,
+    pub llretptr: Cell<Option<ValueRef>>,
 
-    entry_bcx: RefCell<Option<&'a Block<'a>>>,
+    pub entry_bcx: RefCell<Option<&'a Block<'a>>>,
 
-    // These elements: "hoisted basic blocks" containing
+    // These pub elements: "hoisted basic blocks" containing
     // administrative activities that have to happen in only one place in
     // the function, due to LLVM's quirks.
     // A marker for the place where we want to insert the function's static
     // allocas, so that LLVM will coalesce them into a single alloca call.
-    alloca_insert_pt: Cell<Option<ValueRef>>,
-    llreturn: Cell<Option<BasicBlockRef>>,
+    pub alloca_insert_pt: Cell<Option<ValueRef>>,
+    pub llreturn: Cell<Option<BasicBlockRef>>,
 
     // The a value alloca'd for calls to upcalls.rust_personality. Used when
     // outputting the resume instruction.
-    personality: Cell<Option<ValueRef>>,
+    pub personality: Cell<Option<ValueRef>>,
 
     // True if the caller expects this fn to use the out pointer to
     // return. Either way, your code should write into llretptr, but if
     // this value is false, llretptr will be a local alloca.
-    caller_expects_out_pointer: bool,
+    pub caller_expects_out_pointer: bool,
 
     // Maps arguments to allocas created for them in llallocas.
-    llargs: RefCell<NodeMap<LvalueDatum>>,
+    pub llargs: RefCell<NodeMap<LvalueDatum>>,
 
     // Maps the def_ids for local variables to the allocas created for
     // them in llallocas.
-    lllocals: RefCell<NodeMap<LvalueDatum>>,
+    pub lllocals: RefCell<NodeMap<LvalueDatum>>,
 
     // Same as above, but for closure upvars
-    llupvars: RefCell<NodeMap<ValueRef>>,
+    pub llupvars: RefCell<NodeMap<ValueRef>>,
 
     // The NodeId of the function, or -1 if it doesn't correspond to
     // a user-defined function.
-    id: ast::NodeId,
+    pub id: ast::NodeId,
 
     // If this function is being monomorphized, this contains the type
     // substitutions used.
-    param_substs: Option<@param_substs>,
+    pub param_substs: Option<@param_substs>,
 
     // The source span and nesting context where this function comes from, for
     // error reporting and symbol generation.
-    span: Option<Span>,
+    pub span: Option<Span>,
 
     // The arena that blocks are allocated from.
-    block_arena: &'a TypedArena<Block<'a>>,
+    pub block_arena: &'a TypedArena<Block<'a>>,
 
     // This function's enclosing crate context.
-    ccx: &'a CrateContext,
+    pub ccx: &'a CrateContext,
 
     // Used and maintained by the debuginfo module.
-    debug_context: debuginfo::FunctionDebugContext,
+    pub debug_context: debuginfo::FunctionDebugContext,
 
     // Cleanup scopes.
-    scopes: RefCell<Vec<cleanup::CleanupScope<'a>> >,
+    pub scopes: RefCell<Vec<cleanup::CleanupScope<'a>> >,
 }
 
 impl<'a> FunctionContext<'a> {
@@ -323,7 +322,7 @@ impl<'a> FunctionContext<'a> {
                                                      .unwrap());
         }
         // Remove the cycle between fcx and bcx, so memory can be freed
-        self.entry_bcx.set(None);
+        *self.entry_bcx.borrow_mut() = None;
     }
 
     pub fn get_llreturn(&self) -> BasicBlockRef {
@@ -405,20 +404,20 @@ pub struct Block<'a> {
     // block to the function pointed to by llfn.  We insert
     // instructions into that block by way of this block context.
     // The block pointing to this one in the function's digraph.
-    llbb: BasicBlockRef,
-    terminated: Cell<bool>,
-    unreachable: Cell<bool>,
+    pub llbb: BasicBlockRef,
+    pub terminated: Cell<bool>,
+    pub unreachable: Cell<bool>,
 
     // Is this block part of a landing pad?
-    is_lpad: bool,
+    pub is_lpad: bool,
 
     // AST node-id associated with this block, if any. Used for
     // debugging purposes only.
-    opt_node_id: Option<ast::NodeId>,
+    pub opt_node_id: Option<ast::NodeId>,
 
     // The function context for the function to which this block is
     // attached.
-    fcx: &'a FunctionContext<'a>,
+    pub fcx: &'a FunctionContext<'a>,
 }
 
 impl<'a> Block<'a> {
@@ -456,14 +455,6 @@ impl<'a> Block<'a> {
         e.repr(self.tcx())
     }
 
-    pub fn expr_is_lval(&self, e: &ast::Expr) -> bool {
-        ty::expr_is_lval(self.tcx(), self.ccx().maps.method_map, e)
-    }
-
-    pub fn expr_kind(&self, e: &ast::Expr) -> ty::ExprKind {
-        ty::expr_kind(self.tcx(), self.ccx().maps.method_map, e)
-    }
-
     pub fn def(&self, nid: ast::NodeId) -> ast::Def {
         match self.tcx().def_map.borrow().find(&nid) {
             Some(&v) => v,
@@ -493,8 +484,8 @@ impl<'a> Block<'a> {
 }
 
 pub struct Result<'a> {
-    bcx: &'a Block<'a>,
-    val: ValueRef
+    pub bcx: &'a Block<'a>,
+    pub val: ValueRef
 }
 
 pub fn rslt<'a>(bcx: &'a Block<'a>, val: ValueRef) -> Result<'a> {
@@ -504,13 +495,6 @@ pub fn rslt<'a>(bcx: &'a Block<'a>, val: ValueRef) -> Result<'a> {
     }
 }
 
-impl<'a> Result<'a> {
-    pub fn unpack(&self, bcx: &mut &'a Block<'a>) -> ValueRef {
-        *bcx = self.bcx;
-        return self.val;
-    }
-}
-
 pub fn val_ty(v: ValueRef) -> Type {
     unsafe {
         Type::from_ref(llvm::LLVMTypeOf(v))
@@ -581,7 +565,7 @@ pub fn C_u8(ccx: &CrateContext, i: uint) -> ValueRef {
 
 // This is a 'c-like' raw string, which differs from
 // our boxed-and-length-annotated strings.
-pub fn C_cstr(cx: &CrateContext, s: InternedString) -> ValueRef {
+pub fn C_cstr(cx: &CrateContext, s: InternedString, null_terminated: bool) -> ValueRef {
     unsafe {
         match cx.const_cstr_cache.borrow().find(&s) {
             Some(&llval) => return llval,
@@ -591,7 +575,7 @@ pub fn C_cstr(cx: &CrateContext, s: InternedString) -> ValueRef {
         let sc = llvm::LLVMConstStringInContext(cx.llcx,
                                                 s.get().as_ptr() as *c_char,
                                                 s.get().len() as c_uint,
-                                                False);
+                                                !null_terminated as Bool);
 
         let gsym = token::gensym("str");
         let g = format!("str{}", gsym).with_c_str(|buf| {
@@ -611,7 +595,7 @@ pub fn C_cstr(cx: &CrateContext, s: InternedString) -> ValueRef {
 pub fn C_str_slice(cx: &CrateContext, s: InternedString) -> ValueRef {
     unsafe {
         let len = s.get().len();
-        let cs = llvm::LLVMConstPointerCast(C_cstr(cx, s), Type::i8p(cx).to_ref());
+        let cs = llvm::LLVMConstPointerCast(C_cstr(cx, s, false), Type::i8p(cx).to_ref());
         C_struct(cx, [cs, C_uint(cx, len)], false)
     }
 }
@@ -744,27 +728,11 @@ pub fn mono_data_classify(t: ty::t) -> MonoDataClass {
 
 #[deriving(Eq, TotalEq, Hash)]
 pub struct mono_id_ {
-    def: ast::DefId,
-    params: Vec<mono_param_id> }
+    pub def: ast::DefId,
+    pub params: Vec<mono_param_id> }
 
 pub type mono_id = @mono_id_;
 
-pub fn umax(cx: &Block, a: ValueRef, b: ValueRef) -> ValueRef {
-    let cond = build::ICmp(cx, lib::llvm::IntULT, a, b);
-    return build::Select(cx, cond, b, a);
-}
-
-pub fn umin(cx: &Block, a: ValueRef, b: ValueRef) -> ValueRef {
-    let cond = build::ICmp(cx, lib::llvm::IntULT, a, b);
-    return build::Select(cx, cond, a, b);
-}
-
-pub fn align_to(cx: &Block, off: ValueRef, align: ValueRef) -> ValueRef {
-    let mask = build::Sub(cx, align, C_int(cx.ccx(), 1));
-    let bumped = build::Add(cx, off, mask);
-    return build::And(cx, bumped, build::Not(cx, mask));
-}
-
 pub fn monomorphize_type(bcx: &Block, t: ty::t) -> ty::t {
     match bcx.fcx.param_substs {
         Some(substs) => {
@@ -816,7 +784,10 @@ pub fn node_id_type_params(bcx: &Block, node: ExprOrMethodCall) -> Vec<ty::t> {
     if !params.iter().all(|t| !ty::type_needs_infer(*t)) {
         bcx.sess().bug(
             format!("type parameters for node {:?} include inference types: {}",
-                 node, params.map(|t| bcx.ty_to_str(*t)).connect(",")));
+                 node, params.iter()
+                             .map(|t| bcx.ty_to_str(*t))
+                             .collect::<Vec<~str>>()
+                             .connect(",")));
     }
 
     match bcx.fcx.param_substs {
@@ -925,19 +896,11 @@ pub fn find_vtable(tcx: &ty::ctxt,
     param_bounds.get(n_bound).clone()
 }
 
-pub fn dummy_substs(tps: Vec<ty::t> ) -> ty::substs {
-    substs {
-        regions: ty::ErasedRegions,
-        self_ty: None,
-        tps: tps
-    }
-}
-
 pub fn filename_and_line_num_from_span(bcx: &Block, span: Span)
                                        -> (ValueRef, ValueRef) {
     let loc = bcx.sess().codemap().lookup_char_pos(span.lo);
     let filename_cstr = C_cstr(bcx.ccx(),
-                               token::intern_and_get_ident(loc.file.name));
+                               token::intern_and_get_ident(loc.file.name), true);
     let filename = build::PointerCast(bcx, filename_cstr, Type::i8p(bcx.ccx()));
     let line = C_int(bcx.ccx(), loc.line as int);
     (filename, line)
diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs
index dc154206e71..a2b46b1f2a1 100644
--- a/src/librustc/middle/trans/consts.rs
+++ b/src/librustc/middle/trans/consts.rs
@@ -28,6 +28,7 @@ use middle::trans::inline;
 use middle::trans::machine;
 use middle::trans::type_::Type;
 use middle::trans::type_of;
+use middle::trans::debuginfo;
 use middle::ty;
 use util::ppaux::{Repr, ty_to_str};
 
@@ -35,7 +36,6 @@ use std::c_str::ToCStr;
 use std::libc::c_uint;
 use std::slice;
 use std::vec::Vec;
-use std::vec;
 use syntax::{ast, ast_util};
 
 pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: ast::Lit)
@@ -294,7 +294,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
         exprs.iter().map(|&e| const_expr(cx, e, is_local))
              .fold((Vec::new(), true),
                    |(l, all_inlineable), (val, inlineable)| {
-                (vec::append_one(l, val), all_inlineable && inlineable)
+                (l.append_one(val), all_inlineable && inlineable)
              })
     };
     unsafe {
@@ -557,7 +557,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
                    inlineable.iter().fold(true, |a, &b| a && b))
               })
           }
-          ast::ExprVec(ref es, ast::MutImmutable) => {
+          ast::ExprVec(ref es) => {
             let (v, _, inlineable) = const_vec(cx,
                                                e,
                                                es.as_slice(),
@@ -573,7 +573,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
                     _ => { cx.sess().span_bug(e.span, "bad const-slice lit") }
                 }
               }
-              ast::ExprVec(ref es, ast::MutImmutable) => {
+              ast::ExprVec(ref es) => {
                 let (cv, llunitty, _) = const_vec(cx,
                                                   e,
                                                   es.as_slice(),
@@ -592,7 +592,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
               _ => cx.sess().span_bug(e.span, "bad const-slice expr")
             }
           }
-          ast::ExprRepeat(elem, count, _) => {
+          ast::ExprRepeat(elem, count) => {
             let vec_ty = ty::expr_ty(cx.tcx(), e);
             let unit_ty = ty::sequence_element_type(cx.tcx(), vec_ty);
             let llunitty = type_of::type_of(cx, unit_ty);
@@ -688,5 +688,6 @@ pub fn trans_const(ccx: &CrateContext, m: ast::Mutability, id: ast::NodeId) {
         if m != ast::MutMutable {
             llvm::LLVMSetGlobalConstant(g, True);
         }
+        debuginfo::create_global_var_metadata(ccx, id, g);
     }
 }
diff --git a/src/librustc/middle/trans/context.rs b/src/librustc/middle/trans/context.rs
index a8ff0760eaa..f98a77eed65 100644
--- a/src/librustc/middle/trans/context.rs
+++ b/src/librustc/middle/trans/context.rs
@@ -20,7 +20,6 @@ use middle::resolve;
 use middle::trans::adt;
 use middle::trans::base;
 use middle::trans::builder::Builder;
-use middle::trans::common::{C_i32, C_null};
 use middle::trans::common::{mono_id,ExternMap,tydesc_info,BuilderRef_res,Stats};
 use middle::trans::debuginfo;
 use middle::trans::type_::Type;
@@ -30,85 +29,84 @@ use util::nodemap::{NodeMap, NodeSet, DefIdMap};
 
 use std::cell::{Cell, RefCell};
 use std::c_str::ToCStr;
-use std::libc::c_uint;
 use std::ptr;
 use collections::{HashMap, HashSet};
 use syntax::ast;
 use syntax::parse::token::InternedString;
 
 pub struct CrateContext {
-    llmod: ModuleRef,
-    llcx: ContextRef,
-    metadata_llmod: ModuleRef,
-    td: TargetData,
-    tn: TypeNames,
-    externs: RefCell<ExternMap>,
-    intrinsics: HashMap<&'static str, ValueRef>,
-    item_vals: RefCell<NodeMap<ValueRef>>,
-    exp_map2: resolve::ExportMap2,
-    reachable: NodeSet,
-    item_symbols: RefCell<NodeMap<~str>>,
-    link_meta: LinkMeta,
-    drop_glues: RefCell<HashMap<ty::t, ValueRef>>,
-    tydescs: RefCell<HashMap<ty::t, @tydesc_info>>,
-    // 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
-    // came from)
-    external_srcs: RefCell<NodeMap<ast::DefId>>,
-    // A set of static items which cannot be inlined into other crates. This
-    // will pevent in IIItem() structures from being encoded into the metadata
-    // that is generated
-    non_inlineable_statics: RefCell<NodeSet>,
-    // Cache instances of monomorphized functions
-    monomorphized: RefCell<HashMap<mono_id, ValueRef>>,
-    monomorphizing: RefCell<DefIdMap<uint>>,
-    // Cache generated vtables
-    vtables: RefCell<HashMap<(ty::t, mono_id), ValueRef>>,
-    // Cache of constant strings,
-    const_cstr_cache: RefCell<HashMap<InternedString, ValueRef>>,
-
-    // Reverse-direction for const ptrs cast from globals.
-    // Key is an int, cast from a ValueRef holding a *T,
-    // Val is a ValueRef holding a *[T].
-    //
-    // Needed because LLVM loses pointer->pointee association
-    // when we ptrcast, and we have to ptrcast during translation
-    // of a [T] const because we form a slice, a [*T,int] pair, not
-    // a pointer to an LLVM array type.
-    const_globals: RefCell<HashMap<int, ValueRef>>,
-
-    // Cache of emitted const values
-    const_values: RefCell<NodeMap<ValueRef>>,
-
-    // Cache of external const values
-    extern_const_values: RefCell<DefIdMap<ValueRef>>,
-
-    impl_method_cache: RefCell<HashMap<(ast::DefId, ast::Name), ast::DefId>>,
-
-    // Cache of closure wrappers for bare fn's.
-    closure_bare_wrapper_cache: RefCell<HashMap<ValueRef, ValueRef>>,
-
-    lltypes: RefCell<HashMap<ty::t, Type>>,
-    llsizingtypes: RefCell<HashMap<ty::t, Type>>,
-    adt_reprs: RefCell<HashMap<ty::t, @adt::Repr>>,
-    symbol_hasher: RefCell<Sha256>,
-    type_hashcodes: RefCell<HashMap<ty::t, ~str>>,
-    all_llvm_symbols: RefCell<HashSet<~str>>,
-    tcx: ty::ctxt,
-    maps: astencode::Maps,
-    stats: @Stats,
-    int_type: Type,
-    opaque_vec_type: Type,
-    builder: BuilderRef_res,
-    // Set when at least one function uses GC. Needed so that
-    // decl_gc_metadata knows whether to link to the module metadata, which
-    // is not emitted by LLVM's GC pass when no functions use GC.
-    uses_gc: bool,
-    dbg_cx: Option<debuginfo::CrateDebugContext>,
+    pub llmod: ModuleRef,
+    pub llcx: ContextRef,
+    pub metadata_llmod: ModuleRef,
+    pub td: TargetData,
+    pub tn: TypeNames,
+    pub externs: RefCell<ExternMap>,
+    pub intrinsics: HashMap<&'static str, ValueRef>,
+    pub item_vals: RefCell<NodeMap<ValueRef>>,
+    pub exp_map2: resolve::ExportMap2,
+    pub reachable: NodeSet,
+    pub item_symbols: RefCell<NodeMap<~str>>,
+    pub link_meta: LinkMeta,
+    pub drop_glues: RefCell<HashMap<ty::t, ValueRef>>,
+    pub tydescs: RefCell<HashMap<ty::t, @tydesc_info>>,
+    /// Set when running emit_tydescs to enforce that no more tydescs are
+    /// created.
+    pub finished_tydescs: Cell<bool>,
+    /// Track mapping of external ids to local items imported for inlining
+    pub external: RefCell<DefIdMap<Option<ast::NodeId>>>,
+    /// Backwards version of the `external` map (inlined items to where they
+    /// came from)
+    pub external_srcs: RefCell<NodeMap<ast::DefId>>,
+    /// A set of static items which cannot be inlined into other crates. This
+    /// will pevent in IIItem() structures from being encoded into the metadata
+    /// that is generated
+    pub non_inlineable_statics: RefCell<NodeSet>,
+    /// Cache instances of monomorphized functions
+    pub monomorphized: RefCell<HashMap<mono_id, ValueRef>>,
+    pub monomorphizing: RefCell<DefIdMap<uint>>,
+    /// Cache generated vtables
+    pub vtables: RefCell<HashMap<(ty::t, mono_id), ValueRef>>,
+    /// Cache of constant strings,
+    pub const_cstr_cache: RefCell<HashMap<InternedString, ValueRef>>,
+
+    /// Reverse-direction for const ptrs cast from globals.
+    /// Key is an int, cast from a ValueRef holding a *T,
+    /// Val is a ValueRef holding a *[T].
+    ///
+    /// Needed because LLVM loses pointer->pointee association
+    /// when we ptrcast, and we have to ptrcast during translation
+    /// of a [T] const because we form a slice, a [*T,int] pair, not
+    /// a pointer to an LLVM array type.
+    pub const_globals: RefCell<HashMap<int, ValueRef>>,
+
+    /// Cache of emitted const values
+    pub const_values: RefCell<NodeMap<ValueRef>>,
+
+    /// Cache of external const values
+    pub extern_const_values: RefCell<DefIdMap<ValueRef>>,
+
+    pub impl_method_cache: RefCell<HashMap<(ast::DefId, ast::Name), ast::DefId>>,
+
+    /// Cache of closure wrappers for bare fn's.
+    pub closure_bare_wrapper_cache: RefCell<HashMap<ValueRef, ValueRef>>,
+
+    pub lltypes: RefCell<HashMap<ty::t, Type>>,
+    pub llsizingtypes: RefCell<HashMap<ty::t, Type>>,
+    pub adt_reprs: RefCell<HashMap<ty::t, @adt::Repr>>,
+    pub symbol_hasher: RefCell<Sha256>,
+    pub type_hashcodes: RefCell<HashMap<ty::t, ~str>>,
+    pub all_llvm_symbols: RefCell<HashSet<~str>>,
+    pub tcx: ty::ctxt,
+    pub maps: astencode::Maps,
+    pub stats: @Stats,
+    pub int_type: Type,
+    pub opaque_vec_type: Type,
+    pub builder: BuilderRef_res,
+    /// Set when at least one function uses GC. Needed so that
+    /// decl_gc_metadata knows whether to link to the module metadata, which
+    /// is not emitted by LLVM's GC pass when no functions use GC.
+    pub uses_gc: bool,
+    pub dbg_cx: Option<debuginfo::CrateDebugContext>,
 }
 
 impl CrateContext {
@@ -232,36 +230,6 @@ impl CrateContext {
         Builder::new(self)
     }
 
-    pub fn const_inbounds_gepi(&self,
-                               pointer: ValueRef,
-                               indices: &[uint]) -> ValueRef {
-        debug!("const_inbounds_gepi: pointer={} indices={:?}",
-               self.tn.val_to_str(pointer), indices);
-        let v: Vec<ValueRef> =
-            indices.iter().map(|i| C_i32(self, *i as i32)).collect();
-        unsafe {
-            llvm::LLVMConstInBoundsGEP(pointer,
-                                       v.as_ptr(),
-                                       indices.len() as c_uint)
-        }
-    }
-
-    pub fn offsetof_gep(&self,
-                        llptr_ty: Type,
-                        indices: &[uint]) -> ValueRef {
-        /*!
-         * Returns the offset of applying the given GEP indices
-         * to an instance of `llptr_ty`. Similar to `offsetof` in C,
-         * except that `llptr_ty` must be a pointer type.
-         */
-
-        unsafe {
-            let null = C_null(llptr_ty);
-            llvm::LLVMConstPtrToInt(self.const_inbounds_gepi(null, indices),
-                                    self.int_type.to_ref())
-        }
-    }
-
     pub fn tydesc_type(&self) -> Type {
         self.tn.find_type("tydesc").unwrap()
     }
diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs
index 8e55319013b..a6c86f9d564 100644
--- a/src/librustc/middle/trans/controlflow.rs
+++ b/src/librustc/middle/trans/controlflow.rs
@@ -331,10 +331,10 @@ pub fn trans_fail<'a>(
                   fail_str: InternedString)
                   -> &'a Block<'a> {
     let ccx = bcx.ccx();
-    let v_fail_str = C_cstr(ccx, fail_str);
+    let v_fail_str = C_cstr(ccx, fail_str, true);
     let _icx = push_ctxt("trans_fail_value");
     let loc = bcx.sess().codemap().lookup_char_pos(sp.lo);
-    let v_filename = C_cstr(ccx, token::intern_and_get_ident(loc.file.name));
+    let v_filename = C_cstr(ccx, token::intern_and_get_ident(loc.file.name), true);
     let v_line = loc.line as int;
     let v_str = PointerCast(bcx, v_fail_str, Type::i8p(ccx));
     let v_filename = PointerCast(bcx, v_filename, Type::i8p(ccx));
diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs
index 4ca2b5a47b0..500a36c5dee 100644
--- a/src/librustc/middle/trans/datum.rs
+++ b/src/librustc/middle/trans/datum.rs
@@ -24,12 +24,10 @@ use middle::trans::expr;
 use middle::trans::glue;
 use middle::trans::tvec;
 use middle::trans::type_of;
-use middle::trans::write_guard;
 use middle::ty;
 use util::ppaux::{ty_to_str};
 
 use syntax::ast;
-use syntax::codemap::Span;
 
 /**
  * A `Datum` encapsulates the result of evaluating an expression.  It
@@ -41,18 +39,18 @@ use syntax::codemap::Span;
 pub struct Datum<K> {
     /// The llvm value.  This is either a pointer to the Rust value or
     /// the value itself, depending on `kind` below.
-    val: ValueRef,
+    pub val: ValueRef,
 
     /// The rust type of the value.
-    ty: ty::t,
+    pub ty: ty::t,
 
     /// Indicates whether this is by-ref or by-value.
-    kind: K,
+    pub kind: K,
 }
 
 pub struct DatumBlock<'a, K> {
-    bcx: &'a Block<'a>,
-    datum: Datum<K>,
+    pub bcx: &'a Block<'a>,
+    pub datum: Datum<K>,
 }
 
 pub enum Expr {
@@ -70,7 +68,7 @@ pub enum Expr {
 pub struct Lvalue;
 
 pub struct Rvalue {
-    mode: RvalueMode
+    pub mode: RvalueMode
 }
 
 pub fn Rvalue(m: RvalueMode) -> Rvalue {
@@ -160,10 +158,6 @@ pub fn rvalue_scratch_datum(bcx: &Block,
     Datum(scratch, ty, Rvalue(ByRef))
 }
 
-pub fn is_by_value_type(ccx: &CrateContext, ty: ty::t) -> bool {
-    appropriate_rvalue_mode(ccx, ty) == ByValue
-}
-
 pub fn appropriate_rvalue_mode(ccx: &CrateContext, ty: ty::t) -> RvalueMode {
     /*!
      * Indicates the "appropriate" mode for this value,
@@ -389,10 +383,7 @@ impl Datum<Expr> {
         }
     }
 
-    pub fn is_by_ref(&self) -> bool {
-        self.kind.is_by_ref()
-    }
-
+    #[allow(dead_code)] // potentially useful
     pub fn assert_lvalue(self, bcx: &Block) -> Datum<Lvalue> {
         /*!
          * Asserts that this datum *is* an lvalue and returns it.
@@ -632,6 +623,7 @@ impl<K:KindOps> Datum<K> {
         glue::take_ty(bcx, dst, self.ty)
     }
 
+    #[allow(dead_code)] // useful for debugging
     pub fn to_str(&self, ccx: &CrateContext) -> ~str {
         format!("Datum({}, {}, {:?})",
              ccx.tn.val_to_str(self.val),
@@ -645,16 +637,6 @@ impl<K:KindOps> Datum<K> {
         appropriate_rvalue_mode(ccx, self.ty)
     }
 
-    pub fn root_and_write_guard<'a>(
-                                &self,
-                                bcx: &'a Block<'a>,
-                                span: Span,
-                                expr_id: ast::NodeId,
-                                derefs: uint)
-                                -> &'a Block<'a> {
-        write_guard::root_and_write_guard(self, bcx, span, expr_id, derefs)
-    }
-
     pub fn to_llscalarish<'a>(self, bcx: &'a Block<'a>) -> ValueRef {
         /*!
          * Converts `self` into a by-value `ValueRef`. Consumes this
@@ -688,16 +670,6 @@ impl<'a, K:KindOps> DatumBlock<'a, K> {
 }
 
 impl<'a> DatumBlock<'a, Expr> {
-    pub fn assert_by_ref(self) -> DatumBlock<'a, Expr> {
-        assert!(self.datum.kind.is_by_ref());
-        self
-    }
-
-    pub fn store_to(self, dst: ValueRef) -> &'a Block<'a> {
-        let DatumBlock { bcx, datum } = self;
-        datum.store_to(bcx, dst)
-    }
-
     pub fn store_to_dest(self,
                          dest: expr::Dest,
                          expr_id: ast::NodeId) -> &'a Block<'a> {
@@ -705,22 +677,6 @@ impl<'a> DatumBlock<'a, Expr> {
         datum.store_to_dest(bcx, dest, expr_id)
     }
 
-    pub fn shallow_copy(self, dst: ValueRef) -> &'a Block<'a> {
-        self.datum.shallow_copy(self.bcx, dst)
-    }
-
-    pub fn ccx(&self) -> &'a CrateContext {
-        self.bcx.ccx()
-    }
-
-    pub fn tcx(&self) -> &'a ty::ctxt {
-        self.bcx.tcx()
-    }
-
-    pub fn to_str(&self) -> ~str {
-        self.datum.to_str(self.ccx())
-    }
-
     pub fn to_llbool(self) -> Result<'a> {
         let DatumBlock { datum, bcx } = self;
         rslt(bcx, datum.to_llbool(bcx))
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index 9f5959e05de..0a610538f31 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -173,15 +173,15 @@ static DW_ATE_unsigned_char: c_uint = 0x08;
 
 /// A context object for maintaining all state needed by the debuginfo module.
 pub struct CrateDebugContext {
-    priv llcontext: ContextRef,
-    priv builder: DIBuilderRef,
-    priv current_debug_location: Cell<DebugLocation>,
-    priv created_files: RefCell<HashMap<~str, DIFile>>,
-    priv created_types: RefCell<HashMap<uint, DIType>>,
-    priv namespace_map: RefCell<HashMap<Vec<ast::Name> , @NamespaceTreeNode>>,
+    llcontext: ContextRef,
+    builder: DIBuilderRef,
+    current_debug_location: Cell<DebugLocation>,
+    created_files: RefCell<HashMap<~str, DIFile>>,
+    created_types: RefCell<HashMap<uint, DIType>>,
+    namespace_map: RefCell<HashMap<Vec<ast::Name> , @NamespaceTreeNode>>,
     // This collection is used to assert that composite types (structs, enums, ...) have their
     // members only set once:
-    priv composite_types_completed: RefCell<HashSet<DIType>>,
+    composite_types_completed: RefCell<HashSet<DIType>>,
 }
 
 impl CrateDebugContext {
@@ -280,6 +280,66 @@ pub fn finalize(cx: &CrateContext) {
     };
 }
 
+/// Creates debug information for the given global variable.
+///
+/// Adds the created metadata nodes directly to the crate's IR.
+pub fn create_global_var_metadata(cx: &CrateContext,
+                                  node_id: ast::NodeId,
+                                  global: ValueRef) {
+    if cx.dbg_cx.is_none() {
+        return;
+    }
+
+    let var_item = cx.tcx.map.get(node_id);
+
+    let (ident, span) = match var_item {
+        ast_map::NodeItem(item) => {
+            match item.node {
+                ast::ItemStatic(..) => (item.ident, item.span),
+                _ => cx.sess().span_bug(item.span,
+                                        format!("debuginfo::create_global_var_metadata() -
+                                                Captured var-id refers to unexpected ast_item
+                                                variant: {:?}",
+                                                var_item))
+            }
+        },
+        _ => cx.sess().bug(format!("debuginfo::create_global_var_metadata() - Captured var-id \
+                                   refers to unexpected ast_map variant: {:?}",
+                                   var_item))
+    };
+
+    let filename = span_start(cx, span).file.name.clone();
+    let file_metadata = file_metadata(cx, filename);
+
+    let is_local_to_unit = is_node_local_to_unit(cx, node_id);
+    let loc = span_start(cx, span);
+
+    let variable_type = ty::node_id_to_type(cx.tcx(), node_id);
+    let type_metadata = type_metadata(cx, variable_type, span);
+
+    let namespace_node = namespace_for_item(cx, ast_util::local_def(node_id));
+    let var_name = token::get_ident(ident).get().to_str();
+    let linkage_name = namespace_node.mangled_name_of_contained_item(var_name);
+    let var_scope = namespace_node.scope;
+
+    var_name.with_c_str(|var_name| {
+        linkage_name.with_c_str(|linkage_name| {
+            unsafe {
+                llvm::LLVMDIBuilderCreateStaticVariable(DIB(cx),
+                                                        var_scope,
+                                                        var_name,
+                                                        linkage_name,
+                                                        file_metadata,
+                                                        loc.line as c_uint,
+                                                        type_metadata,
+                                                        is_local_to_unit,
+                                                        global,
+                                                        ptr::null());
+            }
+        })
+    });
+}
+
 /// Creates debug information for the given local variable.
 ///
 /// Adds the created metadata nodes directly to the crate's IR.
@@ -640,13 +700,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
     // Clang sets this parameter to the opening brace of the function's block, so let's do this too.
     let scope_line = span_start(cx, top_level_block.span).line;
 
-    // The is_local_to_unit flag indicates whether a function is local to the current compilation
-    // unit (i.e. if it is *static* in the C-sense). The *reachable* set should provide a good
-    // approximation of this, as it contains everything that might leak out of the current crate
-    // (by being externally visible or by being inlined into something externally visible). It might
-    // better to use the `exported_items` set from `driver::CrateAnalysis` in the future, but (atm)
-    // this set is not available in the translation pass.
-    let is_local_to_unit = !cx.reachable.contains(&fn_ast_id);
+    let is_local_to_unit = is_node_local_to_unit(cx, fn_ast_id);
 
     let fn_metadata = function_name.with_c_str(|function_name| {
                           linkage_name.with_c_str(|linkage_name| {
@@ -679,7 +733,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
         source_locations_enabled: Cell::new(false),
     };
 
-    let arg_pats = fn_decl.inputs.map(|arg_ref| arg_ref.pat);
+    let arg_pats = fn_decl.inputs.iter().map(|arg_ref| arg_ref.pat).collect::<Vec<_>>();
     populate_scope_map(cx,
                        arg_pats.as_slice(),
                        top_level_block,
@@ -854,6 +908,17 @@ pub fn create_function_debug_context(cx: &CrateContext,
 // Module-Internal debug info creation functions
 //=-------------------------------------------------------------------------------------------------
 
+fn is_node_local_to_unit(cx: &CrateContext, node_id: ast::NodeId) -> bool
+{
+    // The is_local_to_unit flag indicates whether a function is local to the current compilation
+    // unit (i.e. if it is *static* in the C-sense). The *reachable* set should provide a good
+    // approximation of this, as it contains everything that might leak out of the current crate
+    // (by being externally visible or by being inlined into something externally visible). It might
+    // better to use the `exported_items` set from `driver::CrateAnalysis` in the future, but (atm)
+    // this set is not available in the translation pass.
+    !cx.reachable.contains(&node_id)
+}
+
 fn create_DIArray(builder: DIBuilderRef, arr: &[DIDescriptor]) -> DIArray {
     return unsafe {
         llvm::LLVMDIBuilderGetOrCreateArray(builder, arr.as_ptr(), arr.len() as u32)
@@ -1153,7 +1218,7 @@ struct StructMemberDescriptionFactory {
 impl StructMemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
                                   -> Vec<MemberDescription> {
-        self.fields.map(|field| {
+        self.fields.iter().map(|field| {
             let name = if field.ident.name == special_idents::unnamed_field.name {
                 ~""
             } else {
@@ -1166,7 +1231,7 @@ impl StructMemberDescriptionFactory {
                 type_metadata: type_metadata(cx, field.mt.ty, self.span),
                 offset: ComputedMemberOffset,
             }
-        })
+        }).collect()
     }
 }
 
@@ -1256,14 +1321,14 @@ struct TupleMemberDescriptionFactory {
 impl TupleMemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
                                   -> Vec<MemberDescription> {
-        self.component_types.map(|&component_type| {
+        self.component_types.iter().map(|&component_type| {
             MemberDescription {
                 name: ~"",
                 llvm_type: type_of::type_of(cx, component_type),
                 type_metadata: type_metadata(cx, component_type, self.span),
                 offset: ComputedMemberOffset,
             }
-        })
+        }).collect()
     }
 }
 
@@ -1378,7 +1443,9 @@ fn describe_enum_variant(cx: &CrateContext,
                       -> (DICompositeType, Type, MemberDescriptionFactory) {
     let variant_llvm_type =
         Type::struct_(cx, struct_def.fields
+                                    .iter()
                                     .map(|&t| type_of::type_of(cx, t))
+                                    .collect::<Vec<_>>()
                                     .as_slice(),
                       struct_def.packed);
     // Could some consistency checks here: size, align, field count, discr type
@@ -1399,11 +1466,11 @@ fn describe_enum_variant(cx: &CrateContext,
                                            variant_definition_span);
 
     // Get the argument names from the enum variant info
-    let mut arg_names = match variant_info.arg_names {
+    let mut arg_names: Vec<_> = match variant_info.arg_names {
         Some(ref names) => {
-            names.map(|ident| token::get_ident(*ident).get().to_str())
+            names.iter().map(|ident| token::get_ident(*ident).get().to_str()).collect()
         }
-        None => variant_info.args.map(|_| ~"")
+        None => variant_info.args.iter().map(|_| ~"").collect()
     };
 
     // If this is not a univariant enum, there is also the (unnamed) discriminant field
@@ -2062,7 +2129,7 @@ fn type_metadata(cx: &CrateContext,
             let i8_t = ty::mk_i8();
             match *vstore {
                 ty::vstore_fixed(len) => {
-                    fixed_vec_metadata(cx, i8_t, len + 1, usage_site_span)
+                    fixed_vec_metadata(cx, i8_t, len, usage_site_span)
                 },
                 ty::vstore_uniq  => {
                     let vec_metadata = vec_metadata(cx, i8_t, usage_site_span);
@@ -2552,15 +2619,15 @@ fn populate_scope_map(cx: &CrateContext,
                 walk_expr(cx, rhs, scope_stack, scope_map);
             }
 
-            ast::ExprVec(ref init_expressions, _) |
-            ast::ExprTup(ref init_expressions)    => {
+            ast::ExprVec(ref init_expressions) |
+            ast::ExprTup(ref init_expressions) => {
                 for ie in init_expressions.iter() {
                     walk_expr(cx, *ie, scope_stack, scope_map);
                 }
             }
 
-            ast::ExprAssign(sub_exp1, sub_exp2)    |
-            ast::ExprRepeat(sub_exp1, sub_exp2, _) => {
+            ast::ExprAssign(sub_exp1, sub_exp2) |
+            ast::ExprRepeat(sub_exp1, sub_exp2) => {
                 walk_expr(cx, sub_exp1, scope_stack, scope_map);
                 walk_expr(cx, sub_exp2, scope_stack, scope_map);
             }
diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs
index 5baf4056206..49a4a3ed25c 100644
--- a/src/librustc/middle/trans/expr.rs
+++ b/src/librustc/middle/trans/expr.rs
@@ -31,7 +31,7 @@
  * See doc.rs for more comments.
  */
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use back::abi;
 use lib::llvm::{ValueRef, llvm};
@@ -67,7 +67,7 @@ use middle::typeck::MethodCall;
 use util::common::indenter;
 use util::ppaux::Repr;
 use util::nodemap::NodeMap;
-use middle::trans::machine::llsize_of;
+use middle::trans::machine::{llsize_of, llsize_of_alloc};
 use middle::trans::type_::Type;
 
 use std::slice;
@@ -994,7 +994,7 @@ fn trans_rec_or_struct<'a>(
     with_field_tys(tcx, ty, Some(id), |discr, field_tys| {
         let mut need_base = slice::from_elem(field_tys.len(), true);
 
-        let numbered_fields = fields.map(|field| {
+        let numbered_fields = fields.iter().map(|field| {
             let opt_pos =
                 field_tys.iter().position(|field_ty|
                                           field_ty.ident.name == field.ident.node.name);
@@ -1008,7 +1008,7 @@ fn trans_rec_or_struct<'a>(
                                       "Couldn't find field in struct type")
                 }
             }
-        });
+        }).collect::<Vec<_>>();
         let optbase = match base {
             Some(base_expr) => {
                 let mut leftovers = Vec::new();
@@ -1029,7 +1029,7 @@ fn trans_rec_or_struct<'a>(
         };
 
         let repr = adt::represent_type(bcx.ccx(), ty);
-        trans_adt(bcx, repr, discr, numbered_fields, optbase, dest)
+        trans_adt(bcx, repr, discr, numbered_fields.as_slice(), optbase, dest)
     })
 }
 
@@ -1200,12 +1200,19 @@ fn trans_boxed_expr<'a>(bcx: &'a Block<'a>,
         let size = llsize_of(bcx.ccx(), llty);
         let Result { bcx: bcx, val: val } = malloc_raw_dyn(bcx, contents_ty,
                                                            heap_exchange, size);
-        let custom_cleanup_scope = fcx.push_custom_cleanup_scope();
-        fcx.schedule_free_value(cleanup::CustomScope(custom_cleanup_scope),
-                                val, heap_exchange);
-        let bcx = trans_into(bcx, contents, SaveIn(val));
-        fcx.pop_custom_cleanup_scope(custom_cleanup_scope);
-        immediate_rvalue_bcx(bcx, val, box_ty).to_expr_datumblock()
+        // Unique boxes do not allocate for zero-size types. The standard library may assume
+        // that `free` is never called on the pointer returned for `~ZeroSizeType`.
+        if llsize_of_alloc(bcx.ccx(), llty) == 0 {
+            let bcx = trans_into(bcx, contents, SaveIn(val));
+            immediate_rvalue_bcx(bcx, val, box_ty).to_expr_datumblock()
+        } else {
+            let custom_cleanup_scope = fcx.push_custom_cleanup_scope();
+            fcx.schedule_free_value(cleanup::CustomScope(custom_cleanup_scope),
+                                    val, heap_exchange);
+            let bcx = trans_into(bcx, contents, SaveIn(val));
+            fcx.pop_custom_cleanup_scope(custom_cleanup_scope);
+            immediate_rvalue_bcx(bcx, val, box_ty).to_expr_datumblock()
+        }
     } else {
         let base::MallocResult { bcx, smart_ptr: bx, body } =
             base::malloc_general(bcx, contents_ty, heap);
diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs
index 4aa272a63a3..e70d7bf7568 100644
--- a/src/librustc/middle/trans/foreign.rs
+++ b/src/librustc/middle/trans/foreign.rs
@@ -27,7 +27,7 @@ use middle::ty::FnSig;
 use middle::ty;
 use std::cmp;
 use std::libc::c_uint;
-use syntax::abi::{Cdecl, Aapcs, C, AbiSet, Win64};
+use syntax::abi::{Cdecl, Aapcs, C, Win64, Abi};
 use syntax::abi::{RustIntrinsic, Rust, Stdcall, Fastcall, System};
 use syntax::codemap::Span;
 use syntax::parse::token::{InternedString, special_idents};
@@ -73,10 +73,10 @@ struct LlvmSignature {
 // Calls to external functions
 
 pub fn llvm_calling_convention(ccx: &CrateContext,
-                               abis: AbiSet) -> Option<CallConv> {
+                               abi: Abi) -> Option<CallConv> {
     let os = ccx.sess().targ_cfg.os;
     let arch = ccx.sess().targ_cfg.arch;
-    abis.for_target(os, arch).map(|abi| {
+    abi.for_target(os, arch).map(|abi| {
         match abi {
             RustIntrinsic => {
                 // Intrinsics are emitted by monomorphic fn
@@ -180,27 +180,27 @@ pub fn register_static(ccx: &CrateContext,
     }
 }
 
-pub fn register_foreign_item_fn(ccx: &CrateContext, abis: AbiSet,
+pub fn register_foreign_item_fn(ccx: &CrateContext, abi: Abi,
                                 foreign_item: &ast::ForeignItem) -> ValueRef {
     /*!
      * Registers a foreign function found in a library.
      * Just adds a LLVM global.
      */
 
-    debug!("register_foreign_item_fn(abis={}, \
+    debug!("register_foreign_item_fn(abi={}, \
             path={}, \
             foreign_item.id={})",
-           abis.repr(ccx.tcx()),
+           abi.repr(ccx.tcx()),
            ccx.tcx.map.path_to_str(foreign_item.id),
            foreign_item.id);
 
-    let cc = match llvm_calling_convention(ccx, abis) {
+    let cc = match llvm_calling_convention(ccx, abi) {
         Some(cc) => cc,
         None => {
             ccx.sess().span_fatal(foreign_item.span,
                 format!("ABI `{}` has no suitable calling convention \
                       for target architecture",
-                      abis.user_string(ccx.tcx())));
+                      abi.user_string(ccx.tcx())));
         }
     };
 
@@ -263,8 +263,8 @@ pub fn trans_native_call<'a>(
            ccx.tn.val_to_str(llfn),
            ccx.tn.val_to_str(llretptr));
 
-    let (fn_abis, fn_sig) = match ty::get(callee_ty).sty {
-        ty::ty_bare_fn(ref fn_ty) => (fn_ty.abis, fn_ty.sig.clone()),
+    let (fn_abi, fn_sig) = match ty::get(callee_ty).sty {
+        ty::ty_bare_fn(ref fn_ty) => (fn_ty.abi, fn_ty.sig.clone()),
         _ => ccx.sess().bug("trans_native_call called on non-function type")
     };
     let llsig = foreign_signature(ccx, &fn_sig, passed_arg_tys.as_slice());
@@ -354,14 +354,14 @@ pub fn trans_native_call<'a>(
         llargs_foreign.push(llarg_foreign);
     }
 
-    let cc = match llvm_calling_convention(ccx, fn_abis) {
+    let cc = match llvm_calling_convention(ccx, fn_abi) {
         Some(cc) => cc,
         None => {
             // FIXME(#8357) We really ought to report a span here
             ccx.sess().fatal(
                 format!("ABI string `{}` has no suitable ABI \
                         for target architecture",
-                        fn_abis.user_string(ccx.tcx())));
+                        fn_abi.user_string(ccx.tcx())));
         }
     };
 
@@ -435,9 +435,9 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &ast::ForeignMod) {
     for &foreign_item in foreign_mod.items.iter() {
         match foreign_item.node {
             ast::ForeignItemFn(..) => {
-                let abis = foreign_mod.abis;
-                if !(abis.is_rust() || abis.is_intrinsic()) {
-                    register_foreign_item_fn(ccx, abis, foreign_item);
+                match foreign_mod.abi {
+                    Rust | RustIntrinsic => {}
+                    abi => { register_foreign_item_fn(ccx, abi, foreign_item); }
                 }
             }
             _ => {}
@@ -486,7 +486,7 @@ pub fn register_rust_fn_with_foreign_abi(ccx: &CrateContext,
     let t = ty::node_id_to_type(ccx.tcx(), node_id);
     let (cconv, output) = match ty::get(t).sty {
         ty::ty_bare_fn(ref fn_ty) => {
-            let c = llvm_calling_convention(ccx, fn_ty.abis);
+            let c = llvm_calling_convention(ccx, fn_ty.abi);
             (c.unwrap_or(lib::llvm::CCallConv), fn_ty.sig.output)
         }
         _ => fail!("expected bare fn in register_rust_fn_with_foreign_abi")
@@ -534,7 +534,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
         // normal Rust function. This will be the type of the wrappee fn.
         let f = match ty::get(t).sty {
             ty::ty_bare_fn(ref f) => {
-                assert!(!f.abis.is_rust() && !f.abis.is_intrinsic());
+                assert!(f.abi != Rust && f.abi != RustIntrinsic);
                 f
             }
             _ => {
@@ -851,7 +851,7 @@ fn foreign_types_for_fn_ty(ccx: &CrateContext,
            ty.repr(ccx.tcx()),
            ccx.tn.types_to_str(llsig.llarg_tys.as_slice()),
            ccx.tn.type_to_str(llsig.llret_ty),
-           ccx.tn.types_to_str(fn_ty.arg_tys.map(|t| t.ty).as_slice()),
+           ccx.tn.types_to_str(fn_ty.arg_tys.iter().map(|t| t.ty).collect::<Vec<_>>().as_slice()),
            ccx.tn.type_to_str(fn_ty.ret_ty.ty),
            ret_def);
 
diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs
index da9d06b9a75..87234ce3683 100644
--- a/src/librustc/middle/trans/glue.rs
+++ b/src/librustc/middle/trans/glue.rs
@@ -463,7 +463,7 @@ fn make_generic_glue(ccx: &CrateContext,
     // 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 bcx = fcx.entry_bcx.get().unwrap();
+    let bcx = fcx.entry_bcx.borrow().clone().unwrap();
     let llrawptr0 = unsafe { llvm::LLVMGetParam(llfn, fcx.arg_pos(0) as c_uint) };
     let bcx = helper(bcx, llrawptr0, t);
     finish_fn(&fcx, bcx);
diff --git a/src/librustc/middle/trans/intrinsic.rs b/src/librustc/middle/trans/intrinsic.rs
index 9618d082068..28a39718e7f 100644
--- a/src/librustc/middle/trans/intrinsic.rs
+++ b/src/librustc/middle/trans/intrinsic.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_uppercase_pattern_statics)];
+#![allow(non_uppercase_pattern_statics)]
 
 use arena::TypedArena;
 use lib::llvm::{SequentiallyConsistent, Acquire, Release, Xchg};
@@ -199,7 +199,7 @@ pub fn trans_intrinsic(ccx: &CrateContext,
 
     set_always_inline(fcx.llfn);
 
-    let mut bcx = fcx.entry_bcx.get().unwrap();
+    let mut bcx = fcx.entry_bcx.borrow().clone().unwrap();
     let first_real_arg = fcx.arg_pos(0u);
 
     let name = token::get_ident(item.ident);
diff --git a/src/librustc/middle/trans/llrepr.rs b/src/librustc/middle/trans/llrepr.rs
index 75908a0d805..c84e4db7686 100644
--- a/src/librustc/middle/trans/llrepr.rs
+++ b/src/librustc/middle/trans/llrepr.rs
@@ -18,7 +18,7 @@ pub trait LlvmRepr {
 
 impl<'a, T:LlvmRepr> LlvmRepr for &'a [T] {
     fn llrepr(&self, ccx: &CrateContext) -> ~str {
-        let reprs = self.map(|t| t.llrepr(ccx));
+        let reprs: Vec<~str> = self.iter().map(|t| t.llrepr(ccx)).collect();
         format!("[{}]", reprs.connect(","))
     }
 }
diff --git a/src/librustc/middle/trans/macros.rs b/src/librustc/middle/trans/macros.rs
index 938484fd44c..313280cb7a8 100644
--- a/src/librustc/middle/trans/macros.rs
+++ b/src/librustc/middle/trans/macros.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[macro_escape];
+#![macro_escape]
 
 macro_rules! unpack_datum(
     ($bcx: ident, $inp: expr) => (
diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs
index 4701f38c09a..851f8207cb6 100644
--- a/src/librustc/middle/trans/meth.rs
+++ b/src/librustc/middle/trans/meth.rs
@@ -34,7 +34,7 @@ use util::common::indenter;
 use util::ppaux::Repr;
 
 use std::c_str::ToCStr;
-use std::vec;
+use syntax::abi::Rust;
 use syntax::parse::token;
 use syntax::{ast, ast_map, visit};
 
@@ -75,22 +75,6 @@ pub fn trans_impl(ccx: &CrateContext,
     }
 }
 
-/// Translates a (possibly monomorphized) method body.
-///
-/// Parameters:
-/// * `method`: the AST node for the method
-/// * `param_substs`: if this is a generic method, the current values for
-///   type parameters and so forth, else None
-/// * `llfn`: the LLVM ValueRef for the method
-///
-pub fn trans_method(ccx: &CrateContext, method: &ast::Method,
-                    param_substs: Option<@param_substs>,
-                    llfn: ValueRef) -> ValueRef {
-    trans_fn(ccx, method.decl, method.body,
-             llfn, param_substs, method.id, []);
-    llfn
-}
-
 pub fn trans_method_callee<'a>(
                            bcx: &'a Block<'a>,
                            method_call: MethodCall,
@@ -319,8 +303,7 @@ fn combine_impl_and_methods_tps(bcx: &Block,
     let node_substs = node_id_type_params(bcx, node);
     debug!("rcvr_substs={:?}", rcvr_substs.repr(ccx.tcx()));
     let ty_substs
-        = vec::append(Vec::from_slice(rcvr_substs),
-                         node_substs.tailn(node_substs.len() - n_m_tps));
+        = Vec::from_slice(rcvr_substs).append(node_substs.tailn(node_substs.len() - n_m_tps));
     debug!("n_m_tps={:?}", n_m_tps);
     debug!("node_substs={:?}", node_substs.repr(ccx.tcx()));
     debug!("ty_substs={:?}", ty_substs.repr(ccx.tcx()));
@@ -338,8 +321,8 @@ fn combine_impl_and_methods_tps(bcx: &Block,
         None => @Vec::from_elem(node_substs.len(), @Vec::new())
     };
     let vtables
-        = @vec::append(Vec::from_slice(rcvr_origins.as_slice()),
-                          r_m_origins.tailn(r_m_origins.len() - n_m_tps));
+        = @Vec::from_slice(rcvr_origins.as_slice())
+                           .append(r_m_origins.tailn(r_m_origins.len() - n_m_tps));
 
     (ty_substs, vtables)
 }
@@ -411,7 +394,7 @@ pub fn trans_trait_callee_from_llval<'a>(bcx: &'a Block<'a>,
     debug!("(translating trait callee) loading method");
     // Replace the self type (&Self or ~Self) with an opaque pointer.
     let llcallee_ty = match ty::get(callee_ty).sty {
-        ty::ty_bare_fn(ref f) if f.abis.is_rust() => {
+        ty::ty_bare_fn(ref f) if f.abi == Rust => {
             type_of_rust_fn(ccx, true, f.sig.inputs.slice_from(1), f.sig.output)
         }
         _ => {
@@ -541,7 +524,7 @@ fn emit_vtable_methods(bcx: &Block,
     ty::populate_implementations_for_trait_if_necessary(bcx.tcx(), trt_id);
 
     let trait_method_def_ids = ty::trait_method_def_ids(tcx, trt_id);
-    trait_method_def_ids.map(|method_def_id| {
+    trait_method_def_ids.iter().map(|method_def_id| {
         let ident = ty::method(tcx, *method_def_id).ident;
         // The substitutions we have are on the impl, so we grab
         // the method type from the impl to substitute into.
@@ -558,7 +541,7 @@ fn emit_vtable_methods(bcx: &Block,
         } else {
             trans_fn_ref_with_vtables(bcx, m_id, ExprId(0), substs, Some(vtables))
         }
-    })
+    }).collect()
 }
 
 pub fn trans_trait_cast<'a>(bcx: &'a Block<'a>,
diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs
index 80a7fe2facf..6f2dbc182b0 100644
--- a/src/librustc/middle/trans/monomorphize.rs
+++ b/src/librustc/middle/trans/monomorphize.rs
@@ -23,6 +23,7 @@ use middle::ty;
 use middle::typeck;
 use util::ppaux::Repr;
 
+use syntax::abi;
 use syntax::ast;
 use syntax::ast_map;
 use syntax::ast_util::local_def;
@@ -99,7 +100,7 @@ pub fn monomorphic_fn(ccx: &CrateContext,
 
     match map_node {
         ast_map::NodeForeignItem(_) => {
-            if !ccx.tcx.map.get_foreign_abis(fn_id.node).is_intrinsic() {
+            if ccx.tcx.map.get_foreign_abi(fn_id.node) != abi::RustIntrinsic {
                 // Foreign externs don't have to be monomorphized.
                 return (get_item_val(ccx, fn_id.node), true);
             }
@@ -150,7 +151,7 @@ pub fn monomorphic_fn(ccx: &CrateContext,
 
     let f = match ty::get(mono_ty).sty {
         ty::ty_bare_fn(ref f) => {
-            assert!(f.abis.is_rust() || f.abis.is_intrinsic());
+            assert!(f.abi == abi::Rust || f.abi == abi::RustIntrinsic);
             f
         }
         _ => fail!("expected bare rust fn or an intrinsic")
@@ -298,7 +299,7 @@ pub fn make_mono_id(ccx: &CrateContext,
                vts.repr(ccx.tcx()), substs.tys.repr(ccx.tcx()));
         let vts_iter = substs.self_vtables.iter().chain(vts.iter());
         vts_iter.zip(substs_iter).map(|(vtable, subst)| {
-            let v = vtable.map(|vt| meth::vtable_id(ccx, vt));
+            let v = vtable.iter().map(|vt| meth::vtable_id(ccx, vt)).collect::<Vec<_>>();
             (*subst, if !v.is_empty() { Some(@v) } else { None })
         }).collect()
       }
diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs
index a0c1b0c042a..1adf5cf8afe 100644
--- a/src/librustc/middle/trans/reflect.rs
+++ b/src/librustc/middle/trans/reflect.rs
@@ -27,7 +27,6 @@ use util::ppaux::ty_to_str;
 
 use arena::TypedArena;
 use std::libc::c_uint;
-use std::vec;
 use syntax::ast::DefId;
 use syntax::ast;
 use syntax::ast_map;
@@ -47,10 +46,6 @@ impl<'a> Reflector<'a> {
         C_uint(self.bcx.ccx(), u)
     }
 
-    pub fn c_int(&mut self, i: int) -> ValueRef {
-        C_int(self.bcx.ccx(), i)
-    }
-
     pub fn c_bool(&mut self, b: bool) -> ValueRef {
         C_bool(self.bcx.ccx(), b)
     }
@@ -63,7 +58,7 @@ impl<'a> Reflector<'a> {
         let str_ty = ty::mk_str(bcx.tcx(), str_vstore);
         let scratch = rvalue_scratch_datum(bcx, str_ty, "");
         let len = C_uint(bcx.ccx(), s.get().len());
-        let c_str = PointerCast(bcx, C_cstr(bcx.ccx(), s), Type::i8p(bcx.ccx()));
+        let c_str = PointerCast(bcx, C_cstr(bcx.ccx(), s, false), Type::i8p(bcx.ccx()));
         Store(bcx, c_str, GEPi(bcx, scratch.val, [ 0, 0 ]));
         Store(bcx, len, GEPi(bcx, scratch.val, [ 0, 1 ]));
         scratch.val
@@ -132,9 +127,7 @@ impl<'a> Reflector<'a> {
                                  -> (~str, Vec<ValueRef> ) {
         match vstore {
             ty::vstore_fixed(n) => {
-                let extra = vec::append(vec!(self.c_uint(n)),
-                                           self.c_size_and_align(t)
-                                               .as_slice());
+                let extra = (vec!(self.c_uint(n))).append(self.c_size_and_align(t).as_slice());
                 (~"fixed", extra)
             }
             ty::vstore_slice(_) => (~"slice", Vec::new()),
@@ -182,7 +175,7 @@ impl<'a> Reflector<'a> {
           }
           ty::ty_vec(ref mt, vst) => {
               let (name, extra) = self.vstore_name_and_extra(t, vst);
-              let extra = vec::append(extra, self.c_mt(mt).as_slice());
+              let extra = extra.append(self.c_mt(mt).as_slice());
               self.visit(~"evec_" + name, extra.as_slice())
           }
           // Should remove mt from box and uniq.
@@ -210,8 +203,8 @@ impl<'a> Reflector<'a> {
           }
 
           ty::ty_tup(ref tys) => {
-              let extra = vec::append(vec!(self.c_uint(tys.len())),
-                                         self.c_size_and_align(t).as_slice());
+              let extra = (vec!(self.c_uint(tys.len())))
+                          .append(self.c_size_and_align(t).as_slice());
               self.bracketed("tup", extra.as_slice(), |this| {
                   for (i, t) in tys.iter().enumerate() {
                       let extra = vec!(this.c_uint(i), this.c_tydesc(*t));
@@ -258,19 +251,19 @@ impl<'a> Reflector<'a> {
                       special_idents::unnamed_field.name;
               }
 
-              let extra = vec::append(vec!(
+              let extra = (vec!(
                   self.c_slice(token::intern_and_get_ident(ty_to_str(tcx,
                                                                      t))),
                   self.c_bool(named_fields),
                   self.c_uint(fields.len())
-              ), self.c_size_and_align(t).as_slice());
+              )).append(self.c_size_and_align(t).as_slice());
               self.bracketed("class", extra.as_slice(), |this| {
                   for (i, field) in fields.iter().enumerate() {
-                      let extra = vec::append(vec!(
+                      let extra = (vec!(
                         this.c_uint(i),
                         this.c_slice(token::get_ident(field.ident)),
                         this.c_bool(named_fields)
-                      ), this.c_mt(&field.mt).as_slice());
+                      )).append(this.c_mt(&field.mt).as_slice());
                       this.visit("class_field", extra.as_slice());
                   }
               })
@@ -307,7 +300,7 @@ impl<'a> Reflector<'a> {
                     //
                     llvm::LLVMGetParam(llfdecl, fcx.arg_pos(0u) as c_uint)
                 };
-                let bcx = fcx.entry_bcx.get().unwrap();
+                let bcx = fcx.entry_bcx.borrow().clone().unwrap();
                 let arg = BitCast(bcx, arg, llptrty);
                 let ret = adt::trans_get_discr(bcx, repr, arg, Some(Type::i64(ccx)));
                 Store(bcx, ret, fcx.llretptr.get().unwrap());
@@ -319,10 +312,8 @@ impl<'a> Reflector<'a> {
                 llfdecl
             };
 
-            let enum_args = vec::append(vec!(self.c_uint(variants.len()),
-                                                make_get_disr()),
-                                           self.c_size_and_align(t)
-                                               .as_slice());
+            let enum_args = (vec!(self.c_uint(variants.len()), make_get_disr()))
+                            .append(self.c_size_and_align(t).as_slice());
             self.bracketed("enum", enum_args.as_slice(), |this| {
                 for (i, v) in variants.iter().enumerate() {
                     let name = token::get_ident(v.name);
diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs
index 1a54c25e364..b47f509aeee 100644
--- a/src/librustc/middle/trans/tvec.rs
+++ b/src/librustc/middle/trans/tvec.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use back::abi;
 use lib;
@@ -55,14 +55,6 @@ pub fn get_fill(bcx: &Block, vptr: ValueRef) -> ValueRef {
     Load(bcx, GEPi(bcx, vptr, [0u, abi::vec_elt_fill]))
 }
 
-pub fn set_fill(bcx: &Block, vptr: ValueRef, fill: ValueRef) {
-    Store(bcx, fill, GEPi(bcx, vptr, [0u, abi::vec_elt_fill]));
-}
-
-pub fn get_alloc(bcx: &Block, vptr: ValueRef) -> ValueRef {
-    Load(bcx, GEPi(bcx, vptr, [0u, abi::vec_elt_alloc]))
-}
-
 pub fn get_dataptr(bcx: &Block, vptr: ValueRef) -> ValueRef {
     let _icx = push_ctxt("tvec::get_dataptr");
     GEPi(bcx, vptr, [0u, abi::vec_elt_elems, 0u])
@@ -102,15 +94,6 @@ pub fn alloc_raw<'a>(
     }
 }
 
-pub fn alloc_uniq_raw<'a>(
-                      bcx: &'a Block<'a>,
-                      unit_ty: ty::t,
-                      fill: ValueRef,
-                      alloc: ValueRef)
-                      -> Result<'a> {
-    alloc_raw(bcx, unit_ty, fill, alloc, heap_exchange)
-}
-
 pub fn alloc_uniq_vec<'a>(
                  bcx: &'a Block<'a>,
                  unit_ty: ty::t,
@@ -143,11 +126,11 @@ pub fn make_drop_glue_unboxed<'a>(
 }
 
 pub struct VecTypes {
-    vec_ty: ty::t,
-    unit_ty: ty::t,
-    llunit_ty: Type,
-    llunit_size: ValueRef,
-    llunit_alloc_size: u64
+    pub vec_ty: ty::t,
+    pub unit_ty: ty::t,
+    pub llunit_ty: Type,
+    pub llunit_size: ValueRef,
+    pub llunit_alloc_size: u64
 }
 
 impl VecTypes {
@@ -289,7 +272,7 @@ pub fn trans_lit_str<'a>(
             unsafe {
                 let bytes = str_lit.get().len();
                 let llbytes = C_uint(bcx.ccx(), bytes);
-                let llcstr = C_cstr(bcx.ccx(), str_lit);
+                let llcstr = C_cstr(bcx.ccx(), str_lit, false);
                 let llcstr = llvm::LLVMConstPointerCast(llcstr, Type::i8p(bcx.ccx()).to_ref());
                 Store(bcx, llcstr,
                       GEPi(bcx, lldest, [0u, abi::slice_elt_base]));
@@ -319,7 +302,7 @@ pub fn trans_uniq_vstore<'a>(bcx: &'a Block<'a>,
         ast::ExprLit(lit) => {
             match lit.node {
                 ast::LitStr(ref s, _) => {
-                    let llptrval = C_cstr(bcx.ccx(), (*s).clone());
+                    let llptrval = C_cstr(bcx.ccx(), (*s).clone(), false);
                     let llptrval = PointerCast(bcx,
                                                llptrval,
                                                Type::i8p(bcx.ccx()));
@@ -393,7 +376,7 @@ pub fn write_content<'a>(
                         SaveIn(lldest) => {
                             let bytes = s.get().len();
                             let llbytes = C_uint(bcx.ccx(), bytes);
-                            let llcstr = C_cstr(bcx.ccx(), (*s).clone());
+                            let llcstr = C_cstr(bcx.ccx(), (*s).clone(), false);
                             base::call_memcpy(bcx,
                                               lldest,
                                               llcstr,
@@ -409,7 +392,7 @@ pub fn write_content<'a>(
                 }
             }
         }
-        ast::ExprVec(ref elements, _) => {
+        ast::ExprVec(ref elements) => {
             match dest {
                 Ignore => {
                     for element in elements.iter() {
@@ -435,7 +418,7 @@ pub fn write_content<'a>(
             }
             return bcx;
         }
-        ast::ExprRepeat(element, count_expr, _) => {
+        ast::ExprRepeat(element, count_expr) => {
             match dest {
                 Ignore => {
                     return expr::trans_into(bcx, element, Ignore);
@@ -503,8 +486,8 @@ pub fn elements_required(bcx: &Block, content_expr: &ast::Expr) -> uint {
                 }
             }
         },
-        ast::ExprVec(ref es, _) => es.len(),
-        ast::ExprRepeat(_, count_expr, _) => {
+        ast::ExprVec(ref es) => es.len(),
+        ast::ExprRepeat(_, count_expr) => {
             ty::eval_repeat_count(bcx.tcx(), count_expr)
         }
         _ => bcx.tcx().sess.span_bug(content_expr.span,
@@ -693,19 +676,6 @@ pub fn iter_vec_raw<'r,
     }
 }
 
-pub fn iter_vec_uniq<'r,
-                     'b>(
-                     bcx: &'b Block<'b>,
-                     vptr: ValueRef,
-                     vec_ty: ty::t,
-                     fill: ValueRef,
-                     f: iter_vec_block<'r,'b>)
-                     -> &'b Block<'b> {
-    let _icx = push_ctxt("tvec::iter_vec_uniq");
-    let data_ptr = get_dataptr(bcx, vptr);
-    iter_vec_raw(bcx, data_ptr, vec_ty, fill, f)
-}
-
 pub fn iter_vec_unboxed<'r,
                         'b>(
                         bcx: &'b Block<'b>,
diff --git a/src/librustc/middle/trans/type_.rs b/src/librustc/middle/trans/type_.rs
index 7155c73c002..55ffa951cf2 100644
--- a/src/librustc/middle/trans/type_.rs
+++ b/src/librustc/middle/trans/type_.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_uppercase_pattern_statics)];
+#![allow(non_uppercase_pattern_statics)]
 
 use lib::llvm::{llvm, TypeRef, Bool, False, True, TypeKind};
 use lib::llvm::{Float, Double, X86_FP80, PPC_FP128, FP128};
@@ -20,13 +20,12 @@ use syntax::abi::{X86, X86_64, Arm, Mips};
 
 use std::c_str::ToCStr;
 use std::cast;
-use std::slice;
 
 use std::libc::{c_uint};
 
 #[deriving(Clone, Eq, Show)]
 pub struct Type {
-    priv rf: TypeRef
+    rf: TypeRef
 }
 
 macro_rules! ty (
@@ -135,10 +134,6 @@ impl Type {
         }
     }
 
-    pub fn size_t(ccx: &CrateContext) -> Type {
-        Type::int(ccx)
-    }
-
     pub fn func(args: &[Type], ret: &Type) -> Type {
         let vec : &[TypeRef] = unsafe { cast::transmute(args) };
         ty!(llvm::LLVMFunctionType(ret.to_ref(), vec.as_ptr(),
@@ -151,10 +146,6 @@ impl Type {
                                    args.len() as c_uint, True))
     }
 
-    pub fn ptr(ty: Type) -> Type {
-        ty!(llvm::LLVMPointerType(ty.to_ref(), 0 as c_uint))
-    }
-
     pub fn struct_(ccx: &CrateContext, els: &[Type], packed: bool) -> Type {
         let els : &[TypeRef] = unsafe { cast::transmute(els) };
         ty!(llvm::LLVMStructTypeInContext(ccx.llcx, els.as_ptr(),
@@ -259,17 +250,6 @@ impl Type {
         ty!(llvm::LLVMPointerType(self.to_ref(), 0))
     }
 
-    pub fn get_field(&self, idx: uint) -> Type {
-        unsafe {
-            let num_fields = llvm::LLVMCountStructElementTypes(self.to_ref()) as uint;
-            let mut elems = slice::from_elem(num_fields, 0 as TypeRef);
-
-            llvm::LLVMGetStructElementTypes(self.to_ref(), elems.as_mut_ptr());
-
-            Type::from_ref(elems[idx])
-        }
-    }
-
     pub fn is_packed(&self) -> bool {
         unsafe {
             llvm::LLVMIsPackedStruct(self.to_ref()) == True
diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs
index 684a6624c5e..f45ef457204 100644
--- a/src/librustc/middle/trans/type_of.rs
+++ b/src/librustc/middle/trans/type_of.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use middle::trans::adt;
 use middle::trans::common::*;
@@ -19,6 +19,7 @@ use util::ppaux::Repr;
 
 use middle::trans::type_::Type;
 
+use syntax::abi;
 use syntax::ast;
 use syntax::owned_slice::OwnedSlice;
 
@@ -75,7 +76,7 @@ pub fn type_of_fn_from_ty(cx: &CrateContext, fty: ty::t) -> Type {
             type_of_rust_fn(cx, true, f.sig.inputs.as_slice(), f.sig.output)
         }
         ty::ty_bare_fn(ref f) => {
-            if f.abis.is_rust() || f.abis.is_intrinsic() {
+            if f.abi == abi::Rust || f.abi == abi::RustIntrinsic {
                 type_of_rust_fn(cx,
                                 false,
                                 f.sig.inputs.as_slice(),
diff --git a/src/librustc/middle/trans/value.rs b/src/librustc/middle/trans/value.rs
index 1930b4fa8b9..1efb47ad42f 100644
--- a/src/librustc/middle/trans/value.rs
+++ b/src/librustc/middle/trans/value.rs
@@ -13,7 +13,7 @@ use middle::trans::basic_block::BasicBlock;
 use middle::trans::common::Block;
 use std::libc::c_uint;
 
-pub struct Value(ValueRef);
+pub struct Value(pub ValueRef);
 
 macro_rules! opt_val ( ($e:expr) => (
     unsafe {
@@ -152,7 +152,7 @@ impl Use {
 
 /// Iterator for the users of a value
 pub struct Users {
-    priv next: Option<Use>
+    next: Option<Use>
 }
 
 impl Iterator<Value> for Users {
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 425ac4f85e1..4aefa3b9edc 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use back::svh::Svh;
 use driver::session::Session;
@@ -40,7 +40,6 @@ use std::fmt;
 use std::hash::{Hash, sip};
 use std::ops;
 use std::rc::Rc;
-use std::vec;
 use collections::{HashMap, HashSet};
 use syntax::ast::*;
 use syntax::ast_util::{is_local, lit_is_str};
@@ -52,7 +51,7 @@ use syntax::parse::token;
 use syntax::parse::token::InternedString;
 use syntax::{ast, ast_map};
 use syntax::owned_slice::OwnedSlice;
-use syntax::abi::AbiSet;
+use syntax::abi;
 use syntax;
 use collections::enum_set::{EnumSet, CLike};
 
@@ -64,8 +63,8 @@ pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0;
 
 #[deriving(Eq, TotalEq, Hash)]
 pub struct field {
-    ident: ast::Ident,
-    mt: mt
+    pub ident: ast::Ident,
+    pub mt: mt
 }
 
 #[deriving(Clone)]
@@ -76,16 +75,16 @@ pub enum MethodContainer {
 
 #[deriving(Clone)]
 pub struct Method {
-    ident: ast::Ident,
-    generics: ty::Generics,
-    fty: BareFnTy,
-    explicit_self: ast::ExplicitSelf_,
-    vis: ast::Visibility,
-    def_id: ast::DefId,
-    container: MethodContainer,
+    pub ident: ast::Ident,
+    pub generics: ty::Generics,
+    pub fty: BareFnTy,
+    pub explicit_self: ast::ExplicitSelf_,
+    pub vis: ast::Visibility,
+    pub def_id: ast::DefId,
+    pub container: MethodContainer,
 
     // If this method is provided, we need to know where it came from
-    provided_source: Option<ast::DefId>
+    pub provided_source: Option<ast::DefId>
 }
 
 impl Method {
@@ -119,14 +118,15 @@ impl Method {
 }
 
 pub struct Impl {
-    did: DefId,
-    ident: Ident,
-    methods: Vec<@Method> }
+    pub did: DefId,
+    pub ident: Ident,
+    pub methods: Vec<@Method>,
+}
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
 pub struct mt {
-    ty: t,
-    mutbl: ast::Mutability,
+    pub ty: t,
+    pub mutbl: ast::Mutability,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash, Show)]
@@ -143,18 +143,18 @@ pub enum TraitStore {
 }
 
 pub struct field_ty {
-    name: Name,
-    id: DefId,
-    vis: ast::Visibility,
+    pub name: Name,
+    pub id: DefId,
+    pub vis: ast::Visibility,
 }
 
 // Contains information needed to resolve types and (in the future) look up
 // the types of AST nodes.
 #[deriving(Eq, TotalEq, Hash)]
 pub struct creader_cache_key {
-    cnum: CrateNum,
-    pos: uint,
-    len: uint
+    pub cnum: CrateNum,
+    pub pos: uint,
+    pub len: uint
 }
 
 pub type creader_cache = RefCell<HashMap<creader_cache_key, t>>;
@@ -192,9 +192,9 @@ pub enum ast_ty_to_ty_cache_entry {
 
 #[deriving(Clone, Eq, Decodable, Encodable)]
 pub struct ItemVariances {
-    self_param: Option<Variance>,
-    type_params: OwnedSlice<Variance>,
-    region_params: OwnedSlice<Variance>
+    pub self_param: Option<Variance>,
+    pub type_params: OwnedSlice<Variance>,
+    pub region_params: OwnedSlice<Variance>
 }
 
 #[deriving(Clone, Eq, Decodable, Encodable, Show)]
@@ -217,8 +217,8 @@ pub enum AutoAdjustment {
 
 #[deriving(Decodable, Encodable)]
 pub struct AutoDerefRef {
-    autoderefs: uint,
-    autoref: Option<AutoRef>
+    pub autoderefs: uint,
+    pub autoref: Option<AutoRef>
 }
 
 #[deriving(Decodable, Encodable, Eq, Show)]
@@ -248,112 +248,112 @@ pub enum AutoRef {
 pub struct ctxt {
     // Specifically use a speedy hash algorithm for this hash map, it's used
     // quite often.
-    interner: RefCell<FnvHashMap<intern_key, ~t_box_>>,
-    next_id: Cell<uint>,
-    sess: Session,
-    def_map: resolve::DefMap,
+    pub interner: RefCell<FnvHashMap<intern_key, ~t_box_>>,
+    pub next_id: Cell<uint>,
+    pub sess: Session,
+    pub def_map: resolve::DefMap,
 
-    named_region_map: resolve_lifetime::NamedRegionMap,
+    pub named_region_map: resolve_lifetime::NamedRegionMap,
 
-    region_maps: middle::region::RegionMaps,
+    pub region_maps: middle::region::RegionMaps,
 
     // Stores the types for various nodes in the AST.  Note that this table
     // is not guaranteed to be populated until after typeck.  See
     // typeck::check::fn_ctxt for details.
-    node_types: node_type_table,
+    pub node_types: node_type_table,
 
     // Stores the type parameters which were substituted to obtain the type
     // of this node.  This only applies to nodes that refer to entities
     // parameterized by type parameters, such as generic fns, types, or
     // other items.
-    node_type_substs: RefCell<NodeMap<Vec<t>>>,
+    pub node_type_substs: RefCell<NodeMap<Vec<t>>>,
 
     // Maps from a method to the method "descriptor"
-    methods: RefCell<DefIdMap<@Method>>,
+    pub methods: RefCell<DefIdMap<@Method>>,
 
     // Maps from a trait def-id to a list of the def-ids of its methods
-    trait_method_def_ids: RefCell<DefIdMap<@Vec<DefId> >>,
+    pub trait_method_def_ids: RefCell<DefIdMap<@Vec<DefId> >>,
 
     // A cache for the trait_methods() routine
-    trait_methods_cache: RefCell<DefIdMap<@Vec<@Method> >>,
-
-    impl_trait_cache: RefCell<DefIdMap<Option<@ty::TraitRef>>>,
-
-    trait_refs: RefCell<NodeMap<@TraitRef>>,
-    trait_defs: RefCell<DefIdMap<@TraitDef>>,
-
-    map: ast_map::Map,
-    intrinsic_defs: RefCell<DefIdMap<t>>,
-    freevars: RefCell<freevars::freevar_map>,
-    tcache: type_cache,
-    rcache: creader_cache,
-    short_names_cache: RefCell<HashMap<t, ~str>>,
-    needs_unwind_cleanup_cache: RefCell<HashMap<t, bool>>,
-    tc_cache: RefCell<HashMap<uint, TypeContents>>,
-    ast_ty_to_ty_cache: RefCell<NodeMap<ast_ty_to_ty_cache_entry>>,
-    enum_var_cache: RefCell<DefIdMap<@Vec<@VariantInfo> >>,
-    ty_param_defs: RefCell<NodeMap<TypeParameterDef>>,
-    adjustments: RefCell<NodeMap<@AutoAdjustment>>,
-    normalized_cache: RefCell<HashMap<t, t>>,
-    lang_items: @middle::lang_items::LanguageItems,
+    pub trait_methods_cache: RefCell<DefIdMap<@Vec<@Method> >>,
+
+    pub impl_trait_cache: RefCell<DefIdMap<Option<@ty::TraitRef>>>,
+
+    pub trait_refs: RefCell<NodeMap<@TraitRef>>,
+    pub trait_defs: RefCell<DefIdMap<@TraitDef>>,
+
+    pub map: ast_map::Map,
+    pub intrinsic_defs: RefCell<DefIdMap<t>>,
+    pub freevars: RefCell<freevars::freevar_map>,
+    pub tcache: type_cache,
+    pub rcache: creader_cache,
+    pub short_names_cache: RefCell<HashMap<t, ~str>>,
+    pub needs_unwind_cleanup_cache: RefCell<HashMap<t, bool>>,
+    pub tc_cache: RefCell<HashMap<uint, TypeContents>>,
+    pub ast_ty_to_ty_cache: RefCell<NodeMap<ast_ty_to_ty_cache_entry>>,
+    pub enum_var_cache: RefCell<DefIdMap<@Vec<@VariantInfo> >>,
+    pub ty_param_defs: RefCell<NodeMap<TypeParameterDef>>,
+    pub adjustments: RefCell<NodeMap<@AutoAdjustment>>,
+    pub normalized_cache: RefCell<HashMap<t, t>>,
+    pub lang_items: @middle::lang_items::LanguageItems,
     // A mapping of fake provided method def_ids to the default implementation
-    provided_method_sources: RefCell<DefIdMap<ast::DefId>>,
-    supertraits: RefCell<DefIdMap<@Vec<@TraitRef> >>,
+    pub provided_method_sources: RefCell<DefIdMap<ast::DefId>>,
+    pub supertraits: RefCell<DefIdMap<@Vec<@TraitRef> >>,
 
     // Maps from def-id of a type or region parameter to its
     // (inferred) variance.
-    item_variance_map: RefCell<DefIdMap<@ItemVariances>>,
+    pub item_variance_map: RefCell<DefIdMap<@ItemVariances>>,
 
     // A mapping from the def ID of an enum or struct type to the def ID
     // of the method that implements its destructor. If the type is not
     // present in this map, it does not have a destructor. This map is
     // populated during the coherence phase of typechecking.
-    destructor_for_type: RefCell<DefIdMap<ast::DefId>>,
+    pub destructor_for_type: RefCell<DefIdMap<ast::DefId>>,
 
     // A method will be in this list if and only if it is a destructor.
-    destructors: RefCell<DefIdSet>,
+    pub destructors: RefCell<DefIdSet>,
 
     // Maps a trait onto a list of impls of that trait.
-    trait_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
+    pub trait_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
 
     // Maps a def_id of a type to a list of its inherent impls.
     // Contains implementations of methods that are inherent to a type.
     // Methods in these implementations don't need to be exported.
-    inherent_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
+    pub inherent_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
 
     // Maps a def_id of an impl to an Impl structure.
     // Note that this contains all of the impls that we know about,
     // including ones in other crates. It's not clear that this is the best
     // way to do it.
-    impls: RefCell<DefIdMap<@Impl>>,
+    pub impls: RefCell<DefIdMap<@Impl>>,
 
     // Set of used unsafe nodes (functions or blocks). Unsafe nodes not
     // present in this set can be warned about.
-    used_unsafe: RefCell<NodeSet>,
+    pub used_unsafe: RefCell<NodeSet>,
 
     // Set of nodes which mark locals as mutable which end up getting used at
     // some point. Local variable definitions not in this set can be warned
     // about.
-    used_mut_nodes: RefCell<NodeSet>,
+    pub used_mut_nodes: RefCell<NodeSet>,
 
     // vtable resolution information for impl declarations
-    impl_vtables: typeck::impl_vtable_map,
+    pub impl_vtables: typeck::impl_vtable_map,
 
     // The set of external nominal types whose implementations have been read.
     // This is used for lazy resolution of methods.
-    populated_external_types: RefCell<DefIdSet>,
+    pub populated_external_types: RefCell<DefIdSet>,
 
     // The set of external traits whose implementations have been read. This
     // is used for lazy resolution of traits.
-    populated_external_traits: RefCell<DefIdSet>,
+    pub populated_external_traits: RefCell<DefIdSet>,
 
     // Borrows
-    upvar_borrow_map: RefCell<UpvarBorrowMap>,
+    pub upvar_borrow_map: RefCell<UpvarBorrowMap>,
 
     // These two caches are used by const_eval when decoding external statics
     // and variants that are found.
-    extern_const_statics: RefCell<DefIdMap<Option<@ast::Expr>>>,
-    extern_const_variants: RefCell<DefIdMap<Option<@ast::Expr>>>,
+    pub extern_const_statics: RefCell<DefIdMap<Option<@ast::Expr>>>,
+    pub extern_const_variants: RefCell<DefIdMap<Option<@ast::Expr>>>,
 }
 
 pub enum tbox_flag {
@@ -364,7 +364,7 @@ pub enum tbox_flag {
     has_ty_err = 16,
     has_ty_bot = 32,
 
-    // a meta-flag: subst may be required if the type has parameters, a self
+    // a meta-pub flag: subst may be required if the type has parameters, a self
     // type, or references bound regions
     needs_subst = 1 | 2 | 8
 }
@@ -372,9 +372,9 @@ pub enum tbox_flag {
 pub type t_box = &'static t_box_;
 
 pub struct t_box_ {
-    sty: sty,
-    id: uint,
-    flags: uint,
+    pub sty: sty,
+    pub id: uint,
+    pub flags: uint,
 }
 
 // To reduce refcounting cost, we're representing types as unsafe pointers
@@ -384,8 +384,9 @@ pub struct t_box_ {
 // alive, and using ty::get is unsafe when the ctxt is no longer alive.
 enum t_opaque {}
 
+#[allow(raw_pointer_deriving)]
 #[deriving(Clone, Eq, TotalEq, Hash)]
-pub struct t { priv inner: *t_opaque }
+pub struct t { inner: *t_opaque }
 
 impl fmt::Show for t {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -410,26 +411,23 @@ pub fn type_has_self(t: t) -> bool { tbox_has_flag(get(t), has_self) }
 pub fn type_needs_infer(t: t) -> bool {
     tbox_has_flag(get(t), needs_infer)
 }
-pub fn type_has_regions(t: t) -> bool {
-    tbox_has_flag(get(t), has_regions)
-}
 pub fn type_id(t: t) -> uint { get(t).id }
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
 pub struct BareFnTy {
-    purity: ast::Purity,
-    abis: AbiSet,
-    sig: FnSig
+    pub purity: ast::Purity,
+    pub abi: abi::Abi,
+    pub sig: FnSig,
 }
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
 pub struct ClosureTy {
-    purity: ast::Purity,
-    sigil: ast::Sigil,
-    onceness: ast::Onceness,
-    region: Region,
-    bounds: BuiltinBounds,
-    sig: FnSig,
+    pub purity: ast::Purity,
+    pub sigil: ast::Sigil,
+    pub onceness: ast::Onceness,
+    pub region: Region,
+    pub bounds: BuiltinBounds,
+    pub sig: FnSig,
 }
 
 /**
@@ -446,16 +444,16 @@ pub struct ClosureTy {
  */
 #[deriving(Clone, Eq, TotalEq, Hash)]
 pub struct FnSig {
-    binder_id: ast::NodeId,
-    inputs: Vec<t>,
-    output: t,
-    variadic: bool
+    pub binder_id: ast::NodeId,
+    pub inputs: Vec<t>,
+    pub output: t,
+    pub variadic: bool
 }
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
 pub struct param_ty {
-    idx: uint,
-    def_id: DefId
+    pub idx: uint,
+    pub def_id: DefId
 }
 
 /// Representation of regions:
@@ -502,8 +500,8 @@ pub enum Region {
  */
 #[deriving(Clone, Eq, TotalEq, Hash)]
 pub struct UpvarId {
-    var_id: ast::NodeId,
-    closure_expr_id: ast::NodeId,
+    pub var_id: ast::NodeId,
+    pub closure_expr_id: ast::NodeId,
 }
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
@@ -603,8 +601,8 @@ pub enum BorrowKind {
  */
 #[deriving(Eq, Clone)]
 pub struct UpvarBorrow {
-    kind: BorrowKind,
-    region: ty::Region,
+    pub kind: BorrowKind,
+    pub region: ty::Region,
 }
 
 pub type UpvarBorrowMap = HashMap<UpvarId, UpvarBorrow>;
@@ -621,8 +619,8 @@ impl Region {
 
 #[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
 pub struct FreeRegion {
-    scope_id: NodeId,
-    bound_region: BoundRegion
+    pub scope_id: NodeId,
+    pub bound_region: BoundRegion
 }
 
 #[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
@@ -669,9 +667,9 @@ pub enum RegionSubsts {
  *   always substituted away to the implementing type for a trait. */
 #[deriving(Clone, Eq, TotalEq, Hash)]
 pub struct substs {
-    self_ty: Option<ty::t>,
-    tps: Vec<t>,
-    regions: RegionSubsts,
+    pub self_ty: Option<ty::t>,
+    pub tps: Vec<t>,
+    pub regions: RegionSubsts,
 }
 
 mod primitives {
@@ -759,17 +757,17 @@ pub enum sty {
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
 pub struct TyTrait {
-    def_id: DefId,
-    substs: substs,
-    store: TraitStore,
-    mutability: ast::Mutability,
-    bounds: BuiltinBounds
+    pub def_id: DefId,
+    pub substs: substs,
+    pub store: TraitStore,
+    pub mutability: ast::Mutability,
+    pub bounds: BuiltinBounds
 }
 
 #[deriving(Eq, TotalEq, Hash)]
 pub struct TraitRef {
-    def_id: DefId,
-    substs: substs
+    pub def_id: DefId,
+    pub substs: substs
 }
 
 #[deriving(Clone, Eq)]
@@ -788,8 +786,8 @@ pub enum terr_vstore_kind {
 
 #[deriving(Clone, Show)]
 pub struct expected_found<T> {
-    expected: T,
-    found: T
+    pub expected: T,
+    pub found: T
 }
 
 // Data structures used in type unification
@@ -798,7 +796,7 @@ pub enum type_err {
     terr_mismatch,
     terr_purity_mismatch(expected_found<Purity>),
     terr_onceness_mismatch(expected_found<Onceness>),
-    terr_abi_mismatch(expected_found<AbiSet>),
+    terr_abi_mismatch(expected_found<abi::Abi>),
     terr_mutability,
     terr_sigil_mismatch(expected_found<ast::Sigil>),
     terr_box_mutability,
@@ -830,8 +828,8 @@ pub enum type_err {
 
 #[deriving(Eq, TotalEq, Hash)]
 pub struct ParamBounds {
-    builtin_bounds: BuiltinBounds,
-    trait_bounds: Vec<@TraitRef> }
+    pub builtin_bounds: BuiltinBounds,
+    pub trait_bounds: Vec<@TraitRef> }
 
 pub type BuiltinBounds = EnumSet<BuiltinBound>;
 
@@ -841,7 +839,7 @@ pub enum BuiltinBound {
     BoundStatic,
     BoundSend,
     BoundSized,
-    BoundPod,
+    BoundCopy,
     BoundShare,
 }
 
@@ -868,17 +866,17 @@ impl CLike for BuiltinBound {
 }
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
-pub struct TyVid(uint);
+pub struct TyVid(pub uint);
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
-pub struct IntVid(uint);
+pub struct IntVid(pub uint);
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
-pub struct FloatVid(uint);
+pub struct FloatVid(pub uint);
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct RegionVid {
-    id: uint
+    pub id: uint
 }
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
@@ -983,16 +981,16 @@ impl fmt::Show for IntVarValue {
 
 #[deriving(Clone)]
 pub struct TypeParameterDef {
-    ident: ast::Ident,
-    def_id: ast::DefId,
-    bounds: @ParamBounds,
-    default: Option<ty::t>
+    pub ident: ast::Ident,
+    pub def_id: ast::DefId,
+    pub bounds: @ParamBounds,
+    pub default: Option<ty::t>
 }
 
 #[deriving(Encodable, Decodable, Clone)]
 pub struct RegionParameterDef {
-    name: ast::Name,
-    def_id: ast::DefId,
+    pub name: ast::Name,
+    pub def_id: ast::DefId,
 }
 
 /// Information about the type/lifetime parameters associated with an item.
@@ -1000,11 +998,11 @@ pub struct RegionParameterDef {
 #[deriving(Clone)]
 pub struct Generics {
     /// List of type parameters declared on the item.
-    type_param_defs: Rc<Vec<TypeParameterDef> >,
+    pub type_param_defs: Rc<Vec<TypeParameterDef>>,
 
     /// List of region parameters declared on the item.
     /// For a fn or method, only includes *early-bound* lifetimes.
-    region_param_defs: Rc<Vec<RegionParameterDef> >,
+    pub region_param_defs: Rc<Vec<RegionParameterDef>>,
 }
 
 impl Generics {
@@ -1037,13 +1035,13 @@ pub struct ParameterEnvironment {
     /// In general, this means converting from bound parameters to
     /// free parameters. Since we currently represent bound/free type
     /// parameters in the same way, this only has an affect on regions.
-    free_substs: ty::substs,
+    pub free_substs: ty::substs,
 
     /// Bound on the Self parameter
-    self_param_bound: Option<@TraitRef>,
+    pub self_param_bound: Option<@TraitRef>,
 
     /// Bounds on each numbered type parameter
-    type_param_bounds: Vec<ParamBounds> ,
+    pub type_param_bounds: Vec<ParamBounds> ,
 }
 
 /// A polytype.
@@ -1058,20 +1056,20 @@ pub struct ParameterEnvironment {
 ///   region `&self` or to (unsubstituted) ty_param types
 #[deriving(Clone)]
 pub struct ty_param_bounds_and_ty {
-    generics: Generics,
-    ty: t
+    pub generics: Generics,
+    pub ty: t
 }
 
 /// As `ty_param_bounds_and_ty` but for a trait ref.
 pub struct TraitDef {
-    generics: Generics,
-    bounds: BuiltinBounds,
-    trait_ref: @ty::TraitRef,
+    pub generics: Generics,
+    pub bounds: BuiltinBounds,
+    pub trait_ref: @ty::TraitRef,
 }
 
 pub struct ty_param_substs_and_ty {
-    substs: ty::substs,
-    ty: ty::t
+    pub substs: ty::substs,
+    pub ty: ty::t
 }
 
 pub type type_cache = RefCell<DefIdMap<ty_param_bounds_and_ty>>;
@@ -1407,14 +1405,14 @@ pub fn mk_ctor_fn(cx: &ctxt,
                   binder_id: ast::NodeId,
                   input_tys: &[ty::t],
                   output: ty::t) -> t {
-    let input_args = input_tys.map(|t| *t);
+    let input_args = input_tys.iter().map(|t| *t).collect();
     mk_bare_fn(cx,
                BareFnTy {
                    purity: ast::ImpureFn,
-                   abis: AbiSet::Rust(),
+                   abi: abi::Rust,
                    sig: FnSig {
                     binder_id: binder_id,
-                    inputs: Vec::from_slice(input_args),
+                    inputs: input_args,
                     output: output,
                     variadic: false
                    }
@@ -1505,10 +1503,6 @@ pub fn walk_regions_and_ty(cx: &ctxt, ty: t, fldr: |r: Region|, fldt: |t: t|)
                                    |t| { fldt(t); t }).fold_ty(ty)
 }
 
-pub fn fold_regions(cx: &ctxt, ty: t, fldr: |r: Region| -> Region) -> t {
-    ty_fold::RegionFolder::regions(cx, fldr).fold_ty(ty)
-}
-
 // Substitute *only* type parameters.  Used in trans where regions are erased.
 pub fn subst_tps(tcx: &ctxt, tps: &[t], self_ty_opt: Option<t>, typ: t) -> t {
     let mut subst = TpsSubst { tcx: tcx, self_ty_opt: self_ty_opt, tps: tps };
@@ -1622,13 +1616,6 @@ pub fn type_is_structural(ty: t) -> bool {
     }
 }
 
-pub fn type_is_sequence(ty: t) -> bool {
-    match get(ty).sty {
-      ty_str(_) | ty_vec(_, _) => true,
-      _ => false
-    }
-}
-
 pub fn type_is_simd(cx: &ctxt, ty: t) -> bool {
     match get(ty).sty {
         ty_struct(did, _) => lookup_simd(cx, did),
@@ -1636,13 +1623,6 @@ pub fn type_is_simd(cx: &ctxt, ty: t) -> bool {
     }
 }
 
-pub fn type_is_str(ty: t) -> bool {
-    match get(ty).sty {
-      ty_str(_) => true,
-      _ => false
-    }
-}
-
 pub fn sequence_element_type(cx: &ctxt, ty: t) -> t {
     match get(ty).sty {
       ty_str(_) => return mk_mach_uint(ast::TyU8),
@@ -1671,20 +1651,6 @@ pub fn simd_size(cx: &ctxt, ty: t) -> uint {
     }
 }
 
-pub fn get_element_type(ty: t, i: uint) -> t {
-    match get(ty).sty {
-      ty_tup(ref ts) => return *ts.get(i),
-      _ => fail!("get_element_type called on invalid type")
-    }
-}
-
-pub fn type_is_box(ty: t) -> bool {
-    match get(ty).sty {
-      ty_box(_) => return true,
-      _ => return false
-    }
-}
-
 pub fn type_is_boxed(ty: t) -> bool {
     match get(ty).sty {
       ty_box(_) => true,
@@ -1699,20 +1665,6 @@ pub fn type_is_region_ptr(ty: t) -> bool {
     }
 }
 
-pub fn type_is_slice(ty: t) -> bool {
-    match get(ty).sty {
-      ty_vec(_, vstore_slice(_)) | ty_str(vstore_slice(_)) => true,
-      _ => return false
-    }
-}
-
-pub fn type_is_unique_box(ty: t) -> bool {
-    match get(ty).sty {
-      ty_uniq(_) => return true,
-      _ => return false
-    }
-}
-
 pub fn type_is_unsafe_ptr(ty: t) -> bool {
     match get(ty).sty {
       ty_ptr(_) => return true,
@@ -1720,14 +1672,6 @@ pub fn type_is_unsafe_ptr(ty: t) -> bool {
     }
 }
 
-pub fn type_is_vec(ty: t) -> bool {
-    return match get(ty).sty {
-          ty_vec(_, _) | ty_unboxed_vec(_) => true,
-          ty_str(_) => true,
-          _ => false
-        };
-}
-
 pub fn type_is_unique(ty: t) -> bool {
     match get(ty).sty {
         ty_uniq(_) | ty_vec(_, vstore_uniq) | ty_str(vstore_uniq) => true,
@@ -1841,7 +1785,7 @@ fn type_needs_unwind_cleanup_(cx: &ctxt, ty: t,
  * a type than to think about what is *not* contained within a type.
  */
 pub struct TypeContents {
-    bits: u64
+    pub bits: u64
 }
 
 macro_rules! def_type_content_sets(
@@ -1904,7 +1848,7 @@ def_type_content_sets!(
         // Things that make values considered not POD (would be same
         // as `Moves`, but for the fact that managed data `@` is
         // not considered POD)
-        Nonpod                              = 0b0000_0000__0000_1111__0000,
+        Noncopy                              = 0b0000_0000__0000_1111__0000,
 
         // Bits to set when a managed value is encountered
         //
@@ -1919,16 +1863,12 @@ def_type_content_sets!(
 )
 
 impl TypeContents {
-    pub fn meets_bounds(&self, cx: &ctxt, bbs: BuiltinBounds) -> bool {
-        bbs.iter().all(|bb| self.meets_bound(cx, bb))
-    }
-
     pub fn meets_bound(&self, cx: &ctxt, bb: BuiltinBound) -> bool {
         match bb {
             BoundStatic => self.is_static(cx),
             BoundSend => self.is_sendable(cx),
             BoundSized => self.is_sized(cx),
-            BoundPod => self.is_pod(cx),
+            BoundCopy => self.is_copy(cx),
             BoundShare => self.is_sharable(cx),
         }
     }
@@ -1965,8 +1905,8 @@ impl TypeContents {
         !self.intersects(TC::Nonsized)
     }
 
-    pub fn is_pod(&self, _: &ctxt) -> bool {
-        !self.intersects(TC::Nonpod)
+    pub fn is_copy(&self, _: &ctxt) -> bool {
+        !self.intersects(TC::Noncopy)
     }
 
     pub fn interior_unsafe(&self) -> bool {
@@ -2020,10 +1960,6 @@ impl TypeContents {
         v.iter().fold(TC::None, |tc, t| tc | f(t))
     }
 
-    pub fn inverse(&self) -> TypeContents {
-        TypeContents { bits: !self.bits }
-    }
-
     pub fn has_dtor(&self) -> bool {
         self.intersects(TC::OwnsDtor)
     }
@@ -2053,10 +1989,6 @@ impl fmt::Show for TypeContents {
     }
 }
 
-pub fn type_has_dtor(cx: &ctxt, t: ty::t) -> bool {
-    type_contents(cx, t).has_dtor()
-}
-
 pub fn type_is_static(cx: &ctxt, t: ty::t) -> bool {
     type_contents(cx, t).is_static(cx)
 }
@@ -2262,7 +2194,7 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
             tc | TC::ReachesNonsendAnnot
         } else if Some(did) == cx.lang_items.managed_bound() {
             tc | TC::Managed
-        } else if Some(did) == cx.lang_items.no_pod_bound() {
+        } else if Some(did) == cx.lang_items.no_copy_bound() {
             tc | TC::OwnsAffine
         } else if Some(did) == cx.lang_items.no_share_bound() {
             tc | TC::ReachesNoShare
@@ -2344,7 +2276,7 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
                 BoundStatic => TC::Nonstatic,
                 BoundSend => TC::Nonsendable,
                 BoundSized => TC::Nonsized,
-                BoundPod => TC::Nonpod,
+                BoundCopy => TC::Noncopy,
                 BoundShare => TC::Nonsharable,
             };
         });
@@ -2601,6 +2533,13 @@ pub fn type_is_integral(ty: t) -> bool {
     }
 }
 
+pub fn type_is_uint(ty: t) -> bool {
+    match get(ty).sty {
+      ty_infer(IntVar(_)) | ty_uint(ast::TyU) => true,
+      _ => false
+    }
+}
+
 pub fn type_is_char(ty: t) -> bool {
     match get(ty).sty {
         ty_char => true,
@@ -2641,14 +2580,8 @@ pub fn type_is_machine(ty: t) -> bool {
     }
 }
 
-pub fn type_is_enum(ty: t) -> bool {
-    match get(ty).sty {
-      ty_enum(_, _) => return true,
-      _ => return false
-    }
-}
-
 // Is the type's representation size known at compile time?
+#[allow(dead_code)] // leaving in for DST
 pub fn type_is_sized(cx: &ctxt, ty: ty::t) -> bool {
     match get(ty).sty {
         // FIXME(#6308) add trait, vec, str, etc here.
@@ -2680,14 +2613,6 @@ pub fn type_is_c_like_enum(cx: &ctxt, ty: t) -> bool {
     }
 }
 
-pub fn type_param(ty: t) -> Option<uint> {
-    match get(ty).sty {
-      ty_param(p) => return Some(p.idx),
-      _ => {/* fall through */ }
-    }
-    return None;
-}
-
 // Returns the type and mutability of *t.
 //
 // The parameter `explicit` indicates if this is an *explicit* dereference.
@@ -2750,10 +2675,6 @@ pub fn node_id_to_type_params(cx: &ctxt, id: ast::NodeId) -> Vec<t> {
     }
 }
 
-fn node_id_has_type_params(cx: &ctxt, id: ast::NodeId) -> bool {
-    cx.node_type_substs.borrow().contains_key(&id)
-}
-
 pub fn fn_is_variadic(fty: t) -> bool {
     match get(fty).sty {
         ty_bare_fn(ref f) => f.sig.variadic,
@@ -2794,16 +2715,6 @@ pub fn ty_closure_sigil(fty: t) -> Sigil {
     }
 }
 
-pub fn ty_fn_purity(fty: t) -> ast::Purity {
-    match get(fty).sty {
-        ty_bare_fn(ref f) => f.purity,
-        ty_closure(ref f) => f.purity,
-        ref s => {
-            fail!("ty_fn_purity() called on non-fn type: {:?}", s)
-        }
-    }
-}
-
 pub fn ty_fn_ret(fty: t) -> t {
     match get(fty).sty {
         ty_bare_fn(ref f) => f.sig.output,
@@ -2822,14 +2733,6 @@ pub fn is_fn_ty(fty: t) -> bool {
     }
 }
 
-pub fn ty_vstore(ty: t) -> vstore {
-    match get(ty).sty {
-        ty_vec(_, vstore) => vstore,
-        ty_str(vstore) => vstore,
-        ref s => fail!("ty_vstore() called on invalid sty: {:?}", s)
-    }
-}
-
 pub fn ty_region(tcx: &ctxt,
                  span: Span,
                  ty: t) -> Region {
@@ -2845,49 +2748,6 @@ pub fn ty_region(tcx: &ctxt,
     }
 }
 
-pub fn replace_fn_sig(cx: &ctxt, fsty: &sty, new_sig: FnSig) -> t {
-    match *fsty {
-        ty_bare_fn(ref f) => mk_bare_fn(cx, BareFnTy {sig: new_sig, ..*f}),
-        ty_closure(ref f) => mk_closure(cx, ClosureTy {sig: new_sig, ..**f}),
-        ref s => {
-            cx.sess.bug(
-                format!("ty_fn_sig() called on non-fn type: {:?}", s));
-        }
-    }
-}
-
-pub fn replace_closure_return_type(tcx: &ctxt, fn_type: t, ret_type: t) -> t {
-    /*!
-     *
-     * Returns a new function type based on `fn_type` but returning a value of
-     * type `ret_type` instead. */
-
-    match ty::get(fn_type).sty {
-        ty::ty_closure(ref fty) => {
-            ty::mk_closure(tcx, ClosureTy {
-                sig: FnSig {output: ret_type, ..fty.sig.clone()},
-                ..(**fty).clone()
-            })
-        }
-        _ => {
-            tcx.sess.bug(format!(
-                "replace_fn_ret() invoked with non-fn-type: {}",
-                ty_to_str(tcx, fn_type)));
-        }
-    }
-}
-
-// Returns a vec of all the input and output types of fty.
-pub fn tys_in_fn_sig(sig: &FnSig) -> Vec<t> {
-    vec::append_one(sig.inputs.map(|a| *a), sig.output)
-}
-
-// Type accessors for AST nodes
-pub fn block_ty(cx: &ctxt, b: &ast::Block) -> t {
-    return node_id_to_type(cx, b.id);
-}
-
-
 // Returns the type of a pattern as a monotype. Like @expr_ty, this function
 // doesn't provide type parameter substitutions.
 pub fn pat_ty(cx: &ctxt, pat: &ast::Pat) -> t {
@@ -3175,10 +3035,11 @@ impl AutoRef {
 }
 
 pub struct ParamsTy {
-    params: Vec<t>,
-    ty: t
+    pub params: Vec<t>,
+    pub ty: t
 }
 
+#[allow(dead_code)] // this may be useful?
 pub fn expr_ty_params_and_ty(cx: &ctxt,
                              expr: &ast::Expr)
                           -> ParamsTy {
@@ -3188,10 +3049,6 @@ pub fn expr_ty_params_and_ty(cx: &ctxt,
     }
 }
 
-pub fn expr_has_ty_params(cx: &ctxt, expr: &ast::Expr) -> bool {
-    return node_id_has_type_params(cx, expr.id);
-}
-
 pub fn method_call_type_param_defs(tcx: &ctxt, origin: typeck::MethodOrigin)
                                    -> Rc<Vec<TypeParameterDef>> {
     match origin {
@@ -3212,11 +3069,8 @@ pub fn method_call_type_param_defs(tcx: &ctxt, origin: typeck::MethodOrigin)
             // trait itself.  This ought to be harmonized.
             let trait_type_param_defs =
                 lookup_trait_def(tcx, trt_id).generics.type_param_defs();
-            Rc::new(vec::append(
-                Vec::from_slice(trait_type_param_defs),
-                ty::trait_method(tcx,
-                                 trt_id,
-                                 n_mth).generics.type_param_defs()))
+            Rc::new(Vec::from_slice(trait_type_param_defs).append(
+                        ty::trait_method(tcx, trt_id, n_mth).generics.type_param_defs()))
         }
     }
 }
@@ -3418,12 +3272,6 @@ pub fn stmt_node_id(s: &ast::Stmt) -> ast::NodeId {
     }
 }
 
-pub fn field_idx(name: ast::Name, fields: &[field]) -> Option<uint> {
-    let mut i = 0u;
-    for f in fields.iter() { if f.ident.name == name { return Some(i); } i += 1u; }
-    return None;
-}
-
 pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field])
                      -> uint {
     let mut i = 0u;
@@ -3431,7 +3279,7 @@ pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field])
     tcx.sess.bug(format!(
         "no field named `{}` found in the list of fields `{:?}`",
         token::get_name(name),
-        fields.map(|f| token::get_ident(f.ident).get().to_str())));
+        fields.iter().map(|f| token::get_ident(f.ident).get().to_str()).collect::<Vec<~str>>()));
 }
 
 pub fn method_idx(id: ast::Ident, meths: &[@Method]) -> Option<uint> {
@@ -3659,14 +3507,6 @@ pub fn note_and_explain_type_err(cx: &ctxt, err: &type_err) {
     }
 }
 
-pub fn def_has_ty_params(def: ast::Def) -> bool {
-    match def {
-      ast::DefFn(_, _) | ast::DefVariant(_, _, _) | ast::DefStruct(_)
-        => true,
-      _ => false
-    }
-}
-
 pub fn provided_source(cx: &ctxt, id: ast::DefId) -> Option<ast::DefId> {
     cx.provided_method_sources.borrow().find(&id).map(|x| *x)
 }
@@ -3723,8 +3563,8 @@ pub fn trait_supertraits(cx: &ctxt, id: ast::DefId) -> @Vec<@TraitRef> {
 
 pub fn trait_ref_supertraits(cx: &ctxt, trait_ref: &ty::TraitRef) -> Vec<@TraitRef> {
     let supertrait_refs = trait_supertraits(cx, trait_ref.def_id);
-    supertrait_refs.map(
-        |supertrait_ref| supertrait_ref.subst(cx, &trait_ref.substs))
+    supertrait_refs.iter().map(
+        |supertrait_ref| supertrait_ref.subst(cx, &trait_ref.substs)).collect()
 }
 
 fn lookup_locally_or_in_crate_store<V:Clone>(
@@ -3767,7 +3607,7 @@ pub fn trait_methods(cx: &ctxt, trait_did: ast::DefId) -> @Vec<@Method> {
         Some(&methods) => methods,
         None => {
             let def_ids = ty::trait_method_def_ids(cx, trait_did);
-            let methods = @def_ids.map(|d| ty::method(cx, *d));
+            let methods = @def_ids.iter().map(|d| ty::method(cx, *d)).collect();
             trait_methods.insert(trait_did, methods);
             methods
         }
@@ -3845,21 +3685,21 @@ pub fn try_add_builtin_trait(tcx: &ctxt,
 
 pub fn ty_to_def_id(ty: t) -> Option<ast::DefId> {
     match get(ty).sty {
-      ty_trait(~TyTrait { def_id: id, .. }) | ty_struct(id, _) | ty_enum(id, _) => Some(id),
-      _ => None
+        ty_trait(~TyTrait { def_id: id, .. }) | ty_struct(id, _) | ty_enum(id, _) => Some(id),
+        _ => None
     }
 }
 
 // Enum information
 #[deriving(Clone)]
 pub struct VariantInfo {
-    args: Vec<t>,
-    arg_names: Option<Vec<ast::Ident> >,
-    ctor_ty: t,
-    name: ast::Ident,
-    id: ast::DefId,
-    disr_val: Disr,
-    vis: Visibility
+    pub args: Vec<t>,
+    pub arg_names: Option<Vec<ast::Ident> >,
+    pub ctor_ty: t,
+    pub name: ast::Ident,
+    pub id: ast::DefId,
+    pub disr_val: Disr,
+    pub vis: Visibility
 }
 
 impl VariantInfo {
@@ -3875,7 +3715,7 @@ impl VariantInfo {
         match ast_variant.node.kind {
             ast::TupleVariantKind(ref args) => {
                 let arg_tys = if args.len() > 0 {
-                    ty_fn_args(ctor_ty).map(|a| *a)
+                    ty_fn_args(ctor_ty).iter().map(|a| *a).collect()
                 } else {
                     Vec::new()
                 };
@@ -3896,11 +3736,11 @@ impl VariantInfo {
 
                 assert!(fields.len() > 0);
 
-                let arg_tys = ty_fn_args(ctor_ty).map(|a| *a);
+                let arg_tys = ty_fn_args(ctor_ty).iter().map(|a| *a).collect();
                 let arg_names = fields.iter().map(|field| {
                     match field.node.kind {
                         NamedField(ident, _) => ident,
-                        UnnamedField => cx.sess.bug(
+                        UnnamedField(..) => cx.sess.bug(
                             "enum_variants: all fields in struct must have a name")
                     }
                 }).collect();
@@ -4242,18 +4082,6 @@ pub fn lookup_struct_fields(cx: &ctxt, did: ast::DefId) -> Vec<field_ty> {
     }
 }
 
-pub fn lookup_struct_field(cx: &ctxt,
-                           parent: ast::DefId,
-                           field_id: ast::DefId)
-                        -> field_ty {
-    let r = lookup_struct_fields(cx, parent);
-    match r.iter().find(
-                 |f| f.id.node == field_id.node) {
-        Some(t) => *t,
-        None => cx.sess.bug("struct ID not found in parent's fields")
-    }
-}
-
 fn struct_field_tys(fields: &[StructField]) -> Vec<field_ty> {
     fields.iter().map(|field| {
         match field.node.kind {
@@ -4264,11 +4092,11 @@ fn struct_field_tys(fields: &[StructField]) -> Vec<field_ty> {
                     vis: visibility,
                 }
             }
-            UnnamedField => {
+            UnnamedField(visibility) => {
                 field_ty {
                     name: syntax::parse::token::special_idents::unnamed_field.name,
                     id: ast_util::local_def(field.node.id),
-                    vis: ast::Public,
+                    vis: visibility,
                 }
             }
         }
@@ -4279,7 +4107,7 @@ fn struct_field_tys(fields: &[StructField]) -> Vec<field_ty> {
 // this. Takes a list of substs with which to instantiate field types.
 pub fn struct_fields(cx: &ctxt, did: ast::DefId, substs: &substs)
                      -> Vec<field> {
-    lookup_struct_fields(cx, did).map(|f| {
+    lookup_struct_fields(cx, did).iter().map(|f| {
        field {
             // FIXME #6993: change type of field to Name and get rid of new()
             ident: ast::Ident::new(f.name),
@@ -4288,7 +4116,7 @@ pub fn struct_fields(cx: &ctxt, did: ast::DefId, substs: &substs)
                 mutbl: MutImmutable
             }
         }
-    })
+    }).collect()
 }
 
 pub fn is_binopable(cx: &ctxt, ty: t, op: ast::BinOp) -> bool {
@@ -4360,14 +4188,7 @@ pub fn is_binopable(cx: &ctxt, ty: t, op: ast::BinOp) -> bool {
     /*bot*/     [t, t, t, t,     t,   t,  t,   t],
     /*raw ptr*/ [f, f, f, f,     t,   t,  f,   f]];
 
-    return tbl[tycat(cx, ty)][opcat(op)];
-}
-
-pub fn ty_params_to_tys(tcx: &ctxt, generics: &ast::Generics) -> Vec<t> {
-    Vec::from_fn(generics.ty_params.len(), |i| {
-        let id = generics.ty_params.get(i).id;
-        ty::mk_param(tcx, i, ast_util::local_def(id))
-    })
+    return tbl[tycat(cx, ty) as uint ][opcat(op) as uint];
 }
 
 /// Returns an equivalent type with all the typedefs and self regions removed.
@@ -4549,19 +4370,6 @@ pub fn each_bound_trait_and_supertraits(tcx: &ctxt,
     return true;
 }
 
-pub fn count_traits_and_supertraits(tcx: &ctxt,
-                                    type_param_defs: &[TypeParameterDef]) -> uint {
-    let mut total = 0;
-    for type_param_def in type_param_defs.iter() {
-        each_bound_trait_and_supertraits(
-            tcx, type_param_def.bounds.trait_bounds.as_slice(), |_| {
-            total += 1;
-            true
-        });
-    }
-    return total;
-}
-
 pub fn get_tydesc_ty(tcx: &ctxt) -> Result<t, ~str> {
     tcx.lang_items.require(TyDescStructLangItem).map(|tydesc_lang_item| {
         tcx.intrinsic_defs.borrow().find_copy(&tydesc_lang_item)
@@ -4869,7 +4677,7 @@ pub fn hash_crate_independent(tcx: &ctxt, t: t, svh: &Svh) -> u64 {
             ty_bare_fn(ref b) => {
                 byte!(14);
                 hash!(b.purity);
-                hash!(b.abis);
+                hash!(b.abi);
             }
             ty_closure(ref c) => {
                 byte!(15);
@@ -5045,12 +4853,4 @@ impl BorrowKind {
             UniqueImmBorrow => "uniquely immutable",
         }
     }
-
-    pub fn to_short_str(&self) -> &'static str {
-        match *self {
-            MutBorrow => "mut",
-            ImmBorrow => "imm",
-            UniqueImmBorrow => "own",
-        }
-    }
 }
diff --git a/src/librustc/middle/ty_fold.rs b/src/librustc/middle/ty_fold.rs
index 88262e8ee73..02c4ffe68c1 100644
--- a/src/librustc/middle/ty_fold.rs
+++ b/src/librustc/middle/ty_fold.rs
@@ -48,7 +48,7 @@ pub trait TypeFolder {
                        fty: &ty::BareFnTy)
                        -> ty::BareFnTy {
         ty::BareFnTy { sig: self.fold_sig(&fty.sig),
-                       abis: fty.abis,
+                       abi: fty.abi,
                        purity: fty.purity }
     }
 
@@ -219,8 +219,8 @@ pub fn super_fold_trait_store<T:TypeFolder>(this: &mut T,
 // Some sample folders
 
 pub struct BottomUpFolder<'a> {
-    tcx: &'a ty::ctxt,
-    fldop: 'a |ty::t| -> ty::t,
+    pub tcx: &'a ty::ctxt,
+    pub fldop: 'a |ty::t| -> ty::t,
 }
 
 impl<'a> TypeFolder for BottomUpFolder<'a> {
diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs
index 93962b3e410..82be7836168 100644
--- a/src/librustc/middle/typeck/astconv.rs
+++ b/src/librustc/middle/typeck/astconv.rs
@@ -60,7 +60,7 @@ use middle::typeck::rscope::{RegionScope};
 use middle::typeck::lookup_def_tcx;
 use util::ppaux::Repr;
 
-use syntax::abi::AbiSet;
+use syntax::abi;
 use syntax::{ast, ast_util};
 use syntax::codemap::Span;
 use syntax::owned_slice::OwnedSlice;
@@ -167,8 +167,8 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>(
     let expected_num_region_params = decl_generics.region_param_defs().len();
     let supplied_num_region_params = path.segments.last().unwrap().lifetimes.len();
     let regions = if expected_num_region_params == supplied_num_region_params {
-        path.segments.last().unwrap().lifetimes.map(
-            |l| ast_region_to_region(this.tcx(), l))
+        path.segments.last().unwrap().lifetimes.iter().map(
+            |l| ast_region_to_region(this.tcx(), l)).collect::<Vec<_>>()
     } else {
         let anon_regions =
             rscope.anon_regions(path.span, expected_num_region_params);
@@ -519,12 +519,12 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope>(
                 ty::mk_tup(tcx, flds)
             }
             ast::TyBareFn(ref bf) => {
-                if bf.decl.variadic && !bf.abis.is_c() {
+                if bf.decl.variadic && bf.abi != abi::C {
                     tcx.sess.span_err(ast_ty.span,
                                       "variadic function must have C calling convention");
                 }
                 ty::mk_bare_fn(tcx, ty_of_bare_fn(this, ast_ty.id, bf.purity,
-                                                  bf.abis, bf.decl))
+                                                  bf.abi, bf.decl))
             }
             ast::TyClosure(ref f) => {
                 if f.sigil == ast::ManagedSigil {
@@ -666,20 +666,20 @@ pub fn ty_of_method<AC:AstConv>(
     untransformed_self_ty: ty::t,
     explicit_self: ast::ExplicitSelf,
     decl: &ast::FnDecl) -> ty::BareFnTy {
-    ty_of_method_or_bare_fn(this, id, purity, AbiSet::Rust(), Some(SelfInfo {
+    ty_of_method_or_bare_fn(this, id, purity, abi::Rust, Some(SelfInfo {
         untransformed_self_ty: untransformed_self_ty,
         explicit_self: explicit_self
     }), decl)
 }
 
 pub fn ty_of_bare_fn<AC:AstConv>(this: &AC, id: ast::NodeId,
-                                 purity: ast::Purity, abi: AbiSet,
+                                 purity: ast::Purity, abi: abi::Abi,
                                  decl: &ast::FnDecl) -> ty::BareFnTy {
     ty_of_method_or_bare_fn(this, id, purity, abi, None, decl)
 }
 
 fn ty_of_method_or_bare_fn<AC:AstConv>(this: &AC, id: ast::NodeId,
-                                       purity: ast::Purity, abi: AbiSet,
+                                       purity: ast::Purity, abi: abi::Abi,
                                        opt_self_info: Option<SelfInfo>,
                                        decl: &ast::FnDecl) -> ty::BareFnTy {
     debug!("ty_of_method_or_bare_fn");
@@ -726,7 +726,7 @@ fn ty_of_method_or_bare_fn<AC:AstConv>(this: &AC, id: ast::NodeId,
 
     return ty::BareFnTy {
         purity: purity,
-        abis: abi,
+        abi: abi,
         sig: ty::FnSig {
             binder_id: id,
             inputs: self_and_input_tys,
@@ -850,15 +850,12 @@ fn conv_builtin_bounds(tcx: &ty::ctxt, ast_bounds: &Option<OwnedSlice<ast::TyPar
             }
             builtin_bounds
         },
-        // ~Trait is sugar for ~Trait:Send.
-        (&None, ty::UniqTraitStore) => {
-            let mut set = ty::EmptyBuiltinBounds(); set.add(ty::BoundSend); set
-        }
         // &'static Trait is sugar for &'static Trait:'static.
         (&None, ty::RegionTraitStore(ty::ReStatic)) => {
             let mut set = ty::EmptyBuiltinBounds(); set.add(ty::BoundStatic); set
         }
-        // &'r Trait is sugar for &'r Trait:<no-bounds>.
-        (&None, ty::RegionTraitStore(..)) => ty::EmptyBuiltinBounds(),
+        // No bounds are automatically applied for &'r Trait or ~Trait
+        (&None, ty::RegionTraitStore(..)) |
+        (&None, ty::UniqTraitStore) => ty::EmptyBuiltinBounds(),
     }
 }
diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs
index 9518e16d269..b6f81d94418 100644
--- a/src/librustc/middle/typeck/check/_match.rs
+++ b/src/librustc/middle/typeck/check/_match.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use middle::pat_util::{PatIdMap, pat_id_map, pat_is_binding, pat_is_const};
 use middle::ty;
@@ -103,8 +103,8 @@ pub fn check_match(fcx: &FnCtxt,
 }
 
 pub struct pat_ctxt<'a> {
-    fcx: &'a FnCtxt<'a>,
-    map: PatIdMap,
+    pub fcx: &'a FnCtxt<'a>,
+    pub map: PatIdMap,
 }
 
 pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path,
@@ -147,7 +147,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path,
                         let vinfo =
                             ty::enum_variant_with_id(tcx, enm, var);
                         let var_tpt = ty::lookup_item_type(tcx, var);
-                        vinfo.args.map(|t| {
+                        vinfo.args.iter().map(|t| {
                             if var_tpt.generics.type_param_defs().len() ==
                                 expected_substs.tps.len()
                             {
@@ -157,7 +157,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path,
                                 *t // In this case, an error was already signaled
                                     // anyway
                             }
-                        })
+                        }).collect()
                     };
 
                     kind_name = "variant";
@@ -209,7 +209,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path,
             // Get the expected types of the arguments.
             let class_fields = ty::struct_fields(
                 tcx, struct_def_id, expected_substs);
-            arg_types = class_fields.map(|field| field.mt.ty);
+            arg_types = class_fields.iter().map(|field| field.mt.ty).collect();
 
             kind_name = "structure";
         }
diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs
index 9b623f1e78e..dce4e7fb06b 100644
--- a/src/librustc/middle/typeck/check/method.rs
+++ b/src/librustc/middle/typeck/check/method.rs
@@ -97,7 +97,6 @@ use util::ppaux::Repr;
 
 use collections::HashSet;
 use std::result;
-use std::vec;
 use syntax::ast::{DefId, SelfValue, SelfRegion};
 use syntax::ast::{SelfUniq, SelfStatic};
 use syntax::ast::{MutMutable, MutImmutable};
@@ -263,6 +262,7 @@ fn construct_transformed_self_ty_for_object(
             let transformed_self_ty = *method_ty.fty.sig.inputs.get(0);
             match ty::get(transformed_self_ty).sty {
                 ty::ty_rptr(r, mt) => { // must be SelfRegion
+                    let r = r.subst(tcx, &substs); // handle Early-Bound lifetime
                     ty::mk_trait(tcx, trait_def_id, substs,
                                  RegionTraitStore(r), mt.mutbl,
                                  ty::EmptyBuiltinBounds())
@@ -658,7 +658,10 @@ impl<'a> LookupContext<'a> {
         debug!("push_candidates_from_impl: {} {} {}",
                token::get_name(self.m_name),
                impl_info.ident.repr(self.tcx()),
-               impl_info.methods.map(|m| m.ident).repr(self.tcx()));
+               impl_info.methods.iter()
+                                .map(|m| m.ident)
+                                .collect::<Vec<ast::Ident>>()
+                                .repr(self.tcx()));
 
         let idx = {
             match impl_info.methods
@@ -1118,8 +1121,7 @@ impl<'a> LookupContext<'a> {
         // Construct the full set of type parameters for the method,
         // which is equal to the class tps + the method tps.
         let all_substs = substs {
-            tps: vec::append(candidate.rcvr_substs.tps.clone(),
-                                m_substs.as_slice()),
+            tps: candidate.rcvr_substs.tps.clone().append(m_substs.as_slice()),
             regions: NonerasedRegions(OwnedSlice::from_vec(all_regions)),
             self_ty: candidate.rcvr_substs.self_ty,
         };
@@ -1162,7 +1164,7 @@ impl<'a> LookupContext<'a> {
         let fty = ty::mk_bare_fn(tcx, ty::BareFnTy {
             sig: fn_sig,
             purity: bare_fn_ty.purity,
-            abis: bare_fn_ty.abis.clone(),
+            abi: bare_fn_ty.abi.clone(),
         });
         debug!("after replacing bound regions, fty={}", self.ty_to_str(fty));
 
@@ -1435,9 +1437,10 @@ impl<'a> LookupContext<'a> {
 
 impl Repr for Candidate {
     fn repr(&self, tcx: &ty::ctxt) -> ~str {
-        format!("Candidate(rcvr_ty={}, rcvr_substs={}, origin={:?})",
+        format!("Candidate(rcvr_ty={}, rcvr_substs={}, method_ty={}, origin={:?})",
                 self.rcvr_match_condition.repr(tcx),
                 self.rcvr_substs.repr(tcx),
+                self.method_ty.repr(tcx),
                 self.origin)
     }
 }
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index 2410390b5e7..9e0f3c9faa5 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -120,8 +120,7 @@ use std::mem::replace;
 use std::result;
 use std::slice;
 use std::vec::Vec;
-use std::vec;
-use syntax::abi::AbiSet;
+use syntax::abi;
 use syntax::ast::{Provided, Required};
 use syntax::ast;
 use syntax::ast_util::local_def;
@@ -179,9 +178,9 @@ pub enum FnKind {
 
 #[deriving(Clone)]
 pub struct PurityState {
-    def: ast::NodeId,
-    purity: ast::Purity,
-    priv from_fn: bool
+    pub def: ast::NodeId,
+    pub purity: ast::Purity,
+    from_fn: bool
 }
 
 impl PurityState {
@@ -329,6 +328,10 @@ fn check_bare_fn(ccx: &CrateCtxt,
                  id: ast::NodeId,
                  fty: ty::t,
                  param_env: ty::ParameterEnvironment) {
+    // Compute the fty from point of view of inside fn
+    // (replace any type-scheme with a type)
+    let fty = fty.subst(ccx.tcx, &param_env.free_substs);
+
     match ty::get(fty).sty {
         ty::ty_bare_fn(ref fn_ty) => {
             let inh = Inherited::new(ccx.tcx, param_env);
@@ -445,7 +448,7 @@ fn check_fn<'a>(ccx: &'a CrateCtxt<'a>,
     let ret_ty = fn_sig.output;
 
     debug!("check_fn(arg_tys={:?}, ret_ty={:?})",
-           arg_tys.map(|&a| ppaux::ty_to_str(tcx, a)),
+           arg_tys.iter().map(|&a| ppaux::ty_to_str(tcx, a)).collect::<Vec<~str>>(),
            ppaux::ty_to_str(tcx, ret_ty));
 
     // Create the function context.  This is either derived from scratch or,
@@ -507,27 +510,6 @@ fn check_fn<'a>(ccx: &'a CrateCtxt<'a>,
     fcx
 }
 
-pub fn check_no_duplicate_fields(tcx: &ty::ctxt,
-                                 fields: Vec<(ast::Ident, Span)>) {
-    let mut field_names = HashMap::new();
-
-    for p in fields.iter() {
-        let (id, sp) = *p;
-        let orig_sp = field_names.find(&id).map(|x| *x);
-        match orig_sp {
-            Some(orig_sp) => {
-                tcx.sess.span_err(sp, format!("duplicate field name {} in record type declaration",
-                                              token::get_ident(id)));
-                tcx.sess.span_note(orig_sp, "first declaration of this field occurred here");
-                break;
-            }
-            None => {
-                field_names.insert(id, sp);
-            }
-        }
-    }
-}
-
 pub fn check_struct(ccx: &CrateCtxt, id: ast::NodeId, span: Span) {
     let tcx = ccx.tcx;
 
@@ -617,7 +599,7 @@ pub fn check_item(ccx: &CrateCtxt, it: &ast::Item) {
         check_bounds_are_used(ccx, t.span, &generics.ty_params, tpt_ty);
       }
       ast::ItemForeignMod(ref m) => {
-        if m.abis.is_intrinsic() {
+        if m.abi == abi::RustIntrinsic {
             for item in m.items.iter() {
                 check_intrinsic_type(ccx, *item);
             }
@@ -630,7 +612,7 @@ pub fn check_item(ccx: &CrateCtxt, it: &ast::Item) {
 
                 match item.node {
                     ast::ForeignItemFn(ref fn_decl, _) => {
-                        if fn_decl.variadic && !m.abis.is_c() {
+                        if fn_decl.variadic && m.abi != abi::C {
                             ccx.tcx.sess.span_err(
                                 item.span, "variadic function must have C calling convention");
                         }
@@ -678,9 +660,7 @@ fn check_method_body(ccx: &CrateCtxt,
             method_generics.region_param_defs(),
             method.body.id);
 
-    // Compute the fty from point of view of inside fn
     let fty = ty::node_id_to_type(ccx.tcx, method.id);
-    let fty = fty.subst(ccx.tcx, &param_env.free_substs);
 
     check_bare_fn(ccx, method.decl, method.body, method.id, fty, param_env);
 }
@@ -901,7 +881,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
                 bound_region: ty::BrNamed(l.def_id, l.name)})).
         collect();
     let dummy_substs = ty::substs {
-        tps: vec::append(dummy_impl_tps, dummy_method_tps.as_slice()),
+        tps: dummy_impl_tps.append(dummy_method_tps.as_slice()),
         regions: ty::NonerasedRegions(dummy_impl_regions),
         self_ty: None };
 
@@ -928,7 +908,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
                      self_ty: self_ty } = trait_substs.subst(tcx, &dummy_substs);
         let substs = substs {
             regions: trait_regions,
-            tps: vec::append(trait_tps, dummy_method_tps.as_slice()),
+            tps: trait_tps.append(dummy_method_tps.as_slice()),
             self_ty: self_ty,
         };
         debug!("trait_fty (pre-subst): {} substs={}",
@@ -943,7 +923,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
         result::Err(ref terr) => {
             tcx.sess.span_err(
                 impl_m_span,
-                format!("method `{}` has an incompatible type: {}",
+                format!("method `{}` has an incompatible type for trait: {}",
                         token::get_ident(trait_m.ident),
                         ty::type_err_to_str(tcx, terr)));
             ty::note_and_explain_type_err(tcx, terr);
@@ -1009,10 +989,6 @@ impl<'a> FnCtxt<'a> {
         }
     }
 
-    pub fn block_region(&self) -> ty::Region {
-        ty::ReScope(self.region_lb.get())
-    }
-
     #[inline]
     pub fn write_ty(&self, node_id: ast::NodeId, ty: ty::t) {
         debug!("write_ty({}, {}) in fcx {}",
@@ -1099,18 +1075,6 @@ impl<'a> FnCtxt<'a> {
         }
     }
 
-    pub fn node_ty_substs(&self, id: ast::NodeId) -> ty::substs {
-        match self.inh.node_type_substs.borrow().find(&id) {
-            Some(ts) => (*ts).clone(),
-            None => {
-                self.tcx().sess.bug(
-                    format!("no type substs for node {}: {} in fcx {}",
-                            id, self.tcx().map.node_to_str(id),
-                            self.tag()));
-            }
-        }
-    }
-
     pub fn method_ty_substs(&self, id: ast::NodeId) -> ty::substs {
         match self.inh.method_map.borrow().find(&MethodCall::expr(id)) {
             Some(method) => method.substs.clone(),
@@ -1166,11 +1130,6 @@ impl<'a> FnCtxt<'a> {
         }
     }
 
-    pub fn can_mk_assignty(&self, sub: ty::t, sup: ty::t)
-                           -> Result<(), ty::type_err> {
-        infer::can_mk_coercety(self.infcx(), sub, sup)
-    }
-
     pub fn mk_eqty(&self,
                    a_is_expected: bool,
                    origin: infer::TypeOrigin,
@@ -1715,7 +1674,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
         };
 
         debug!("check_argument_types: formal_tys={:?}",
-               formal_tys.map(|t| fcx.infcx().ty_to_str(*t)));
+               formal_tys.iter().map(|t| fcx.infcx().ty_to_str(*t)).collect::<Vec<~str>>());
 
         // Check the arguments.
         // We do this in a pretty awful way: first we typecheck any arguments
@@ -1884,10 +1843,10 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
                                                 expr.span,
                                                 fcx.expr_ty(rcvr));
 
-        let tps = tps.map(|&ast_ty| fcx.to_ty(ast_ty));
+        let tps = tps.iter().map(|&ast_ty| fcx.to_ty(ast_ty)).collect::<Vec<_>>();
         let fn_ty = match method::lookup(fcx, expr, rcvr,
                                          method_name.name,
-                                         expr_t, tps,
+                                         expr_t, tps.as_slice(),
                                          DontDerefArgs,
                                          CheckTraitsAndInherentMethods,
                                          AutoderefReceiver) {
@@ -2233,7 +2192,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
         let fty = if error_happened {
             fty_sig = FnSig {
                 binder_id: ast::CRATE_NODE_ID,
-                inputs: fn_ty.sig.inputs.map(|_| ty::mk_err()),
+                inputs: fn_ty.sig.inputs.iter().map(|_| ty::mk_err()).collect(),
                 output: ty::mk_err(),
                 variadic: false
             };
@@ -2250,8 +2209,8 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
         fcx.write_ty(expr.id, fty);
 
         let (inherited_purity, id) =
-            ty::determine_inherited_purity((fcx.ps.get().purity,
-                                            fcx.ps.get().def),
+            ty::determine_inherited_purity((fcx.ps.borrow().purity,
+                                            fcx.ps.borrow().def),
                                            (purity, expr.id),
                                            sigil);
 
@@ -2523,13 +2482,13 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
             let tt = ast_expr_vstore_to_vstore(fcx, ev, vst);
             ty::mk_str(tcx, tt)
           }
-          ast::ExprVec(ref args, mutbl) => {
+          ast::ExprVec(ref args) => {
             let tt = ast_expr_vstore_to_vstore(fcx, ev, vst);
             let mut any_error = false;
             let mut any_bot = false;
             let mutability = match vst {
                 ast::ExprVstoreMutSlice => ast::MutMutable,
-                _ => mutbl,
+                _ => ast::MutImmutable,
             };
             let t: ty::t = fcx.infcx().next_ty_var();
             for e in args.iter() {
@@ -2550,13 +2509,13 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
                 ty::mk_vec(tcx, ty::mt {ty: t, mutbl: mutability}, tt)
             }
           }
-          ast::ExprRepeat(element, count_expr, mutbl) => {
+          ast::ExprRepeat(element, count_expr) => {
             check_expr_with_hint(fcx, count_expr, ty::mk_uint());
             let _ = ty::eval_repeat_count(fcx, count_expr);
             let tt = ast_expr_vstore_to_vstore(fcx, ev, vst);
             let mutability = match vst {
                 ast::ExprVstoreMutSlice => ast::MutMutable,
-                _ => mutbl,
+                _ => ast::MutImmutable,
             };
             let t: ty::t = fcx.infcx().next_ty_var();
             check_expr_has_type(fcx, element, t);
@@ -2936,11 +2895,11 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
       }
       ast::ExprMethodCall(ident, ref tps, ref args) => {
         check_method_call(fcx, expr, ident, args.as_slice(), tps.as_slice());
-        let arg_tys = args.map(|a| fcx.expr_ty(*a));
-        let (args_bot, args_err) = arg_tys.iter().fold((false, false),
+        let mut arg_tys = args.iter().map(|a| fcx.expr_ty(*a));
+        let (args_bot, args_err) = arg_tys.fold((false, false),
              |(rest_bot, rest_err), a| {
-              (rest_bot || ty::type_is_bot(*a),
-               rest_err || ty::type_is_error(*a))});
+              (rest_bot || ty::type_is_bot(a),
+               rest_err || ty::type_is_error(a))});
         if args_err {
             fcx.write_error(id);
         } else if args_bot {
@@ -3058,16 +3017,16 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
             fcx.write_ty(id, t_1);
         }
       }
-      ast::ExprVec(ref args, mutbl) => {
+      ast::ExprVec(ref args) => {
         let t: ty::t = fcx.infcx().next_ty_var();
         for e in args.iter() {
             check_expr_has_type(fcx, *e, t);
         }
-        let typ = ty::mk_vec(tcx, ty::mt {ty: t, mutbl: mutbl},
+        let typ = ty::mk_vec(tcx, ty::mt {ty: t, mutbl: ast::MutImmutable},
                              ty::vstore_fixed(args.len()));
         fcx.write_ty(id, typ);
       }
-      ast::ExprRepeat(element, count_expr, mutbl) => {
+      ast::ExprRepeat(element, count_expr) => {
         check_expr_with_hint(fcx, count_expr, ty::mk_uint());
         let count = ty::eval_repeat_count(fcx, count_expr);
         let t: ty::t = fcx.infcx().next_ty_var();
@@ -3080,7 +3039,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
             fcx.write_bot(id);
         }
         else {
-            let t = ty::mk_vec(tcx, ty::mt {ty: t, mutbl: mutbl},
+            let t = ty::mk_vec(tcx, ty::mt {ty: t, mutbl: ast::MutImmutable},
                                ty::vstore_fixed(count));
             fcx.write_ty(id, t);
         }
@@ -3150,7 +3109,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
                           lvalue_pref, |base_t, _| ty::index(base_t));
               match field_ty {
                   Some(mt) => {
-                      require_integral(fcx, idx.span, idx_t);
+                      check_expr_has_type(fcx, idx, ty::mk_uint());
                       fcx.write_ty(id, mt.ty);
                       fcx.write_autoderef_adjustment(base.id, autoderefs);
                   }
@@ -3194,6 +3153,15 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
     unifier();
 }
 
+pub fn require_uint(fcx: &FnCtxt, sp: Span, t: ty::t) {
+    if !type_is_uint(fcx, sp, t) {
+        fcx.type_error_message(sp, |actual| {
+            format!("mismatched types: expected `uint` type but found `{}`",
+                 actual)
+        }, t, None);
+    }
+}
+
 pub fn require_integral(fcx: &FnCtxt, sp: Span, t: ty::t) {
     if !type_is_integral(fcx, sp, t) {
         fcx.type_error_message(sp, |actual| {
@@ -3299,10 +3267,6 @@ pub fn check_block_no_value(fcx: &FnCtxt, blk: &ast::Block)  {
     }
 }
 
-pub fn check_block(fcx0: &FnCtxt, blk: &ast::Block)  {
-    check_block_with_expected(fcx0, blk, None)
-}
-
 pub fn check_block_with_expected(fcx: &FnCtxt,
                                  blk: &ast::Block,
                                  expected: Option<ty::t>) {
@@ -3369,7 +3333,7 @@ pub fn check_block_with_expected(fcx: &FnCtxt,
         };
     });
 
-    fcx.ps.set(prev);
+    *fcx.ps.borrow_mut() = prev;
 }
 
 pub fn check_const(ccx: &CrateCtxt,
@@ -3684,8 +3648,8 @@ pub fn instantiate_path(fcx: &FnCtxt,
     let num_expected_regions = tpt.generics.region_param_defs().len();
     let num_supplied_regions = pth.segments.last().unwrap().lifetimes.len();
     let regions = if num_expected_regions == num_supplied_regions {
-        OwnedSlice::from_vec(pth.segments.last().unwrap().lifetimes.map(
-            |l| ast_region_to_region(fcx.tcx(), l)))
+        OwnedSlice::from_vec(pth.segments.last().unwrap().lifetimes.iter().map(
+            |l| ast_region_to_region(fcx.tcx(), l)).collect())
     } else {
         if num_supplied_regions != 0 {
             fcx.ccx.tcx.sess.span_err(
@@ -3853,6 +3817,11 @@ pub fn type_is_integral(fcx: &FnCtxt, sp: Span, typ: ty::t) -> bool {
     return ty::type_is_integral(typ_s);
 }
 
+pub fn type_is_uint(fcx: &FnCtxt, sp: Span, typ: ty::t) -> bool {
+    let typ_s = structurally_resolved_type(fcx, sp, typ);
+    return ty::type_is_uint(typ_s);
+}
+
 pub fn type_is_scalar(fcx: &FnCtxt, sp: Span, typ: ty::t) -> bool {
     let typ_s = structurally_resolved_type(fcx, sp, typ);
     return ty::type_is_scalar(typ_s);
@@ -3895,7 +3864,7 @@ pub fn ast_expr_vstore_to_vstore(fcx: &FnCtxt,
                     // string literals and *empty slices* live in static memory
                     ty::vstore_slice(ty::ReStatic)
                 }
-                ast::ExprVec(ref elements, _) if elements.len() == 0 => {
+                ast::ExprVec(ref elements) if elements.len() == 0 => {
                     // string literals and *empty slices* live in static memory
                     ty::vstore_slice(ty::ReStatic)
                 }
@@ -4255,7 +4224,7 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &ast::ForeignItem) {
     };
     let fty = ty::mk_bare_fn(tcx, ty::BareFnTy {
         purity: ast::UnsafeFn,
-        abis: AbiSet::Intrinsic(),
+        abi: abi::RustIntrinsic,
         sig: FnSig {binder_id: it.id,
                     inputs: inputs,
                     output: output,
diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs
index e67a83cd926..c8613fd7065 100644
--- a/src/librustc/middle/typeck/check/regionck.rs
+++ b/src/librustc/middle/typeck/check/regionck.rs
@@ -398,7 +398,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
            expr.repr(rcx.fcx.tcx()), rcx.repeating_scope);
 
     let method_call = MethodCall::expr(expr.id);
-    let has_method_map = rcx.fcx.inh.method_map.get().contains_key(&method_call);
+    let has_method_map = rcx.fcx.inh.method_map.borrow().contains_key(&method_call);
 
     // Check any autoderefs or autorefs that appear.
     for &adjustment in rcx.fcx.inh.adjustments.borrow().find(&expr.id).iter() {
@@ -498,7 +498,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
         ast::ExprUnary(ast::UnDeref, base) => {
             // For *a, the lifetime of a must enclose the deref
             let method_call = MethodCall::expr(expr.id);
-            let base_ty = match rcx.fcx.inh.method_map.get().find(&method_call) {
+            let base_ty = match rcx.fcx.inh.method_map.borrow().find(&method_call) {
                 Some(method) => {
                     constrain_call(rcx, None, expr, Some(base), [], true);
                     ty::ty_fn_ret(method.ty)
@@ -852,7 +852,7 @@ fn constrain_autoderefs(rcx: &mut Rcx,
                i, derefs);
 
         let method_call = MethodCall::autoderef(deref_expr.id, i as u32);
-        derefd_ty = match rcx.fcx.inh.method_map.get().find(&method_call) {
+        derefd_ty = match rcx.fcx.inh.method_map.borrow().find(&method_call) {
             Some(method) => {
                 // Treat overloaded autoderefs as if an AutoRef adjustment
                 // was applied on the base type, as that is always the case.
diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs
index 15de3bf2b5f..67cf14050ed 100644
--- a/src/librustc/middle/typeck/check/vtable.rs
+++ b/src/librustc/middle/typeck/check/vtable.rs
@@ -65,8 +65,8 @@ use syntax::visit::Visitor;
 /// A vtable context includes an inference context, a crate context, and a
 /// callback function to call in case of type error.
 pub struct VtableContext<'a> {
-    infcx: &'a infer::InferCtxt<'a>,
-    param_env: &'a ty::ParameterEnvironment,
+    pub infcx: &'a infer::InferCtxt<'a>,
+    pub param_env: &'a ty::ParameterEnvironment,
 }
 
 impl<'a> VtableContext<'a> {
diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs
index 31d74a1e938..7159febc7f1 100644
--- a/src/librustc/middle/typeck/check/writeback.rs
+++ b/src/librustc/middle/typeck/check/writeback.rs
@@ -113,7 +113,7 @@ fn resolve_vtable_map_entry(fcx: &FnCtxt, sp: Span, vtable_key: MethodCall) {
 
     fn resolve_origins(fcx: &FnCtxt, sp: Span,
                        vtbls: vtable_res) -> vtable_res {
-        @vtbls.map(|os| @os.map(|origin| {
+        @vtbls.iter().map(|os| @os.iter().map(|origin| {
             match origin {
                 &vtable_static(def_id, ref tys, origins) => {
                     let r_tys = resolve_type_vars_in_types(fcx,
@@ -126,7 +126,7 @@ fn resolve_vtable_map_entry(fcx: &FnCtxt, sp: Span, vtable_key: MethodCall) {
                     vtable_param(n, b)
                 }
             }
-        }))
+        }).collect()).collect()
     }
 }
 
diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs
index 321de8925ac..284e0108a6b 100644
--- a/src/librustc/middle/typeck/coherence.rs
+++ b/src/librustc/middle/typeck/coherence.rs
@@ -48,7 +48,6 @@ use syntax::visit;
 use collections::HashSet;
 use std::cell::RefCell;
 use std::rc::Rc;
-use std::vec;
 
 struct UniversalQuantificationResult {
     monotype: t,
@@ -345,9 +344,7 @@ impl<'a> CoherenceChecker<'a> {
             // construct the polytype for the method based on the method_ty
             let new_generics = ty::Generics {
                 type_param_defs:
-                    Rc::new(vec::append(
-                        Vec::from_slice(impl_poly_type.generics
-                                                      .type_param_defs()),
+                    Rc::new(Vec::from_slice(impl_poly_type.generics.type_param_defs()).append(
                             new_method_ty.generics.type_param_defs())),
                 region_param_defs:
                     impl_poly_type.generics.region_param_defs.clone()
diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs
index 9ed59bd19b9..274f88ad4c3 100644
--- a/src/librustc/middle/typeck/collect.rs
+++ b/src/librustc/middle/typeck/collect.rs
@@ -46,10 +46,9 @@ use util::ppaux;
 use util::ppaux::Repr;
 
 use std::rc::Rc;
-use std::vec;
 use collections::HashSet;
 
-use syntax::abi::AbiSet;
+use syntax::abi;
 use syntax::ast::{RegionTyParamBound, TraitTyParamBound};
 use syntax::ast;
 use syntax::ast_map;
@@ -117,8 +116,8 @@ impl<'a> AstConv for CrateCtxt<'a> {
         match self.tcx.map.find(id.node) {
             Some(ast_map::NodeItem(item)) => ty_of_item(self, item),
             Some(ast_map::NodeForeignItem(foreign_item)) => {
-                let abis = self.tcx.map.get_foreign_abis(id.node);
-                ty_of_foreign_item(self, foreign_item, abis)
+                let abi = self.tcx.map.get_foreign_abi(id.node);
+                ty_of_foreign_item(self, foreign_item, abi)
             }
             x => {
                 self.tcx.sess.bug(format!("unexpected sort of node \
@@ -152,7 +151,7 @@ pub fn get_enum_variant_types(ccx: &CrateCtxt,
         let result_ty = match variant.node.kind {
             ast::TupleVariantKind(ref args) if args.len() > 0 => {
                 let rs = ExplicitRscope;
-                let input_tys = args.map(|va| ccx.to_ty(&rs, va.ty));
+                let input_tys: Vec<_> = args.iter().map(|va| ccx.to_ty(&rs, va.ty)).collect();
                 ty::mk_ctor_fn(tcx, scope, input_tys.as_slice(), enum_ty)
             }
 
@@ -168,8 +167,8 @@ pub fn get_enum_variant_types(ccx: &CrateCtxt,
 
                 convert_struct(ccx, struct_def, tpt, variant.node.id);
 
-                let input_tys = struct_def.fields.map(
-                    |f| ty::node_id_to_type(ccx.tcx, f.node.id));
+                let input_tys: Vec<_> = struct_def.fields.iter().map(
+                    |f| ty::node_id_to_type(ccx.tcx, f.node.id)).collect();
                 ty::mk_ctor_fn(tcx, scope, input_tys.as_slice(), enum_ty)
             }
         };
@@ -222,7 +221,7 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt, trait_id: ast::NodeId) {
                     }
 
                     // Add an entry mapping
-                    let method_def_ids = @ms.map(|m| {
+                    let method_def_ids = @ms.iter().map(|m| {
                         match m {
                             &ast::Required(ref ty_method) => {
                                 local_def(ty_method.id)
@@ -231,13 +230,11 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt, trait_id: ast::NodeId) {
                                 local_def(method.id)
                             }
                         }
-                    });
+                    }).collect();
 
                     let trait_def_id = local_def(trait_id);
                     tcx.trait_method_def_ids.borrow_mut()
-                        .insert(trait_def_id, @method_def_ids.iter()
-                                                             .map(|x| *x)
-                                                             .collect());
+                        .insert(trait_def_id, method_def_ids);
                 }
                 _ => {} // Ignore things that aren't traits.
             }
@@ -322,8 +319,7 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt, trait_id: ast::NodeId) {
         let substs = substs {
             regions: ty::NonerasedRegions(rps_from_trait),
             self_ty: Some(self_param),
-            tps: vec::append(non_shifted_trait_tps,
-                                shifted_method_tps.as_slice())
+            tps: non_shifted_trait_tps.append(shifted_method_tps.as_slice())
         };
 
         // create the type of `foo`, applying the substitution above
@@ -492,13 +488,10 @@ fn convert_methods(ccx: &CrateCtxt,
             // itself
             ty_param_bounds_and_ty {
                 generics: ty::Generics {
-                    type_param_defs: Rc::new(vec::append(
-                        Vec::from_slice(
-                            rcvr_ty_generics.type_param_defs()),
-                        m_ty_generics.type_param_defs())),
-                    region_param_defs: Rc::new(vec::append(
-                            Vec::from_slice(rcvr_ty_generics.region_param_defs()),
-                            m_ty_generics.region_param_defs())),
+                    type_param_defs: Rc::new(Vec::from_slice(rcvr_ty_generics.type_param_defs())
+                                             .append(m_ty_generics.type_param_defs())),
+                    region_param_defs: Rc::new(Vec::from_slice(rcvr_ty_generics.region_param_defs())
+                                               .append(m_ty_generics.region_param_defs())),
                 },
                 ty: fty
             });
@@ -557,10 +550,10 @@ pub fn ensure_no_ty_param_bounds(ccx: &CrateCtxt,
 
 fn ensure_generics_abi(ccx: &CrateCtxt,
                        span: Span,
-                       abis: AbiSet,
+                       abi: abi::Abi,
                        generics: &ast::Generics) {
     if generics.ty_params.len() > 0 &&
-       !(abis.is_rust() || abis.is_intrinsic()) {
+       !(abi == abi::Rust || abi == abi::RustIntrinsic) {
         ccx.tcx.sess.span_err(span,
                               "foreign functions may not use type parameters");
     }
@@ -695,12 +688,11 @@ pub fn convert_struct(ccx: &CrateCtxt,
                 write_ty_to_tcx(tcx, ctor_id, selfty);
 
                 tcx.tcache.borrow_mut().insert(local_def(ctor_id), tpt);
-            } else if struct_def.fields.get(0).node.kind ==
-                    ast::UnnamedField {
+            } else if struct_def.fields.get(0).node.kind.is_unnamed() {
                 // Tuple-like.
-                let inputs = struct_def.fields.map(
+                let inputs: Vec<_> = struct_def.fields.iter().map(
                         |field| tcx.tcache.borrow().get(
-                            &local_def(field.node.id)).ty);
+                            &local_def(field.node.id)).ty).collect();
                 let ctor_fn_ty = ty::mk_ctor_fn(tcx,
                                                 ctor_id,
                                                 inputs.as_slice(),
@@ -725,9 +717,9 @@ pub fn convert_foreign(ccx: &CrateCtxt, i: &ast::ForeignItem) {
     // map, and I regard each time that I use it as a personal and
     // moral failing, but at the moment it seems like the only
     // convenient way to extract the ABI. - ndm
-    let abis = ccx.tcx.map.get_foreign_abis(i.id);
+    let abi = ccx.tcx.map.get_foreign_abi(i.id);
 
-    let tpt = ty_of_foreign_item(ccx, i, abis);
+    let tpt = ty_of_foreign_item(ccx, i, abi);
     write_ty_to_tcx(ccx.tcx, i.id, tpt.ty);
 
     ccx.tcx.tcache.borrow_mut().insert(local_def(i.id), tpt);
@@ -899,7 +891,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::Item)
 
 pub fn ty_of_foreign_item(ccx: &CrateCtxt,
                           it: &ast::ForeignItem,
-                          abis: AbiSet) -> ty::ty_param_bounds_and_ty
+                          abi: abi::Abi) -> ty::ty_param_bounds_and_ty
 {
     match it.node {
         ast::ForeignItemFn(fn_decl, ref generics) => {
@@ -907,7 +899,7 @@ pub fn ty_of_foreign_item(ccx: &CrateCtxt,
                                   fn_decl,
                                   local_def(it.id),
                                   generics,
-                                  abis)
+                                  abi)
         }
         ast::ForeignItemStatic(t, _) => {
             ty::ty_param_bounds_and_ty {
@@ -1011,7 +1003,7 @@ pub fn ty_of_foreign_fn_decl(ccx: &CrateCtxt,
                              decl: &ast::FnDecl,
                              def_id: ast::DefId,
                              ast_generics: &ast::Generics,
-                             abis: AbiSet)
+                             abi: abi::Abi)
                           -> ty::ty_param_bounds_and_ty {
 
     for i in decl.inputs.iter() {
@@ -1036,7 +1028,7 @@ pub fn ty_of_foreign_fn_decl(ccx: &CrateCtxt,
     let t_fn = ty::mk_bare_fn(
         ccx.tcx,
         ty::BareFnTy {
-            abis: abis,
+            abi: abi,
             purity: ast::UnsafeFn,
             sig: ty::FnSig {binder_id: def_id.node,
                             inputs: input_tys,
diff --git a/src/librustc/middle/typeck/infer/coercion.rs b/src/librustc/middle/typeck/infer/coercion.rs
index 5dc55ab4b5c..8a1662ca701 100644
--- a/src/librustc/middle/typeck/infer/coercion.rs
+++ b/src/librustc/middle/typeck/infer/coercion.rs
@@ -77,13 +77,14 @@ use middle::typeck::infer::to_str::InferStr;
 use middle::typeck::infer::resolve::try_resolve_tvar_shallow;
 use util::common::indenter;
 
+use syntax::abi;
 use syntax::ast::MutImmutable;
 use syntax::ast;
 
 // Note: Coerce is not actually a combiner, in that it does not
 // conform to the same interface, though it performs a similar
 // function.
-pub struct Coerce<'f>(CombineFields<'f>);
+pub struct Coerce<'f>(pub CombineFields<'f>);
 
 impl<'f> Coerce<'f> {
     pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> {
@@ -384,7 +385,7 @@ impl<'f> Coerce<'f> {
             debug!("coerce_from_bare_fn(a={}, b={})",
                    a.inf_str(self.get_ref().infcx), b.inf_str(self.get_ref().infcx));
 
-            if !fn_ty_a.abis.is_rust() || fn_ty_a.purity != ast::ImpureFn {
+            if fn_ty_a.abi != abi::Rust || fn_ty_a.purity != ast::ImpureFn {
                 return self.subtype(a, b);
             }
 
diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs
index 1516a7bec34..749c1ee6938 100644
--- a/src/librustc/middle/typeck/infer/combine.rs
+++ b/src/librustc/middle/typeck/infer/combine.rs
@@ -67,7 +67,7 @@ use std::result;
 use syntax::ast::{Onceness, Purity};
 use syntax::ast;
 use syntax::owned_slice::OwnedSlice;
-use syntax::abi::AbiSet;
+use syntax::abi;
 
 pub trait Combine {
     fn infcx<'a>(&'a self) -> &'a InferCtxt<'a>;
@@ -195,10 +195,10 @@ pub trait Combine {
     fn bare_fn_tys(&self, a: &ty::BareFnTy,
                    b: &ty::BareFnTy) -> cres<ty::BareFnTy> {
         let purity = if_ok!(self.purities(a.purity, b.purity));
-        let abi = if_ok!(self.abis(a.abis, b.abis));
+        let abi = if_ok!(self.abi(a.abi, b.abi));
         let sig = if_ok!(self.fn_sigs(&a.sig, &b.sig));
         Ok(ty::BareFnTy {purity: purity,
-                abis: abi,
+                abi: abi,
                 sig: sig})
     }
 
@@ -248,7 +248,7 @@ pub trait Combine {
 
     fn purities(&self, a: Purity, b: Purity) -> cres<Purity>;
 
-    fn abis(&self, a: AbiSet, b: AbiSet) -> cres<AbiSet> {
+    fn abi(&self, a: abi::Abi, b: abi::Abi) -> cres<abi::Abi> {
         if a == b {
             Ok(a)
         } else {
@@ -331,9 +331,9 @@ pub trait Combine {
 }
 
 pub struct CombineFields<'a> {
-    infcx: &'a InferCtxt<'a>,
-    a_is_expected: bool,
-    trace: TypeTrace,
+    pub infcx: &'a InferCtxt<'a>,
+    pub a_is_expected: bool,
+    pub trace: TypeTrace,
 }
 
 pub fn expected_found<C:Combine,T>(
@@ -373,28 +373,6 @@ pub fn eq_regions<C:Combine>(this: &C, a: ty::Region, b: ty::Region)
     })
 }
 
-pub fn eq_opt_regions<C:Combine>(
-    this: &C,
-    a: Option<ty::Region>,
-    b: Option<ty::Region>) -> cres<Option<ty::Region>> {
-
-    match (a, b) {
-        (None, None) => Ok(None),
-        (Some(a), Some(b)) => eq_regions(this, a, b).then(|| Ok(Some(a))),
-        (_, _) => {
-            // If these two substitutions are for the same type (and
-            // they should be), then the type should either
-            // consistently have a region parameter or not have a
-            // region parameter.
-            this.infcx().tcx.sess.bug(
-                format!("substitution a had opt_region {} and \
-                      b had opt_region {}",
-                     a.inf_str(this.infcx()),
-                     b.inf_str(this.infcx())));
-        }
-    }
-}
-
 pub fn super_fn_sigs<C:Combine>(this: &C, a: &ty::FnSig, b: &ty::FnSig) -> cres<ty::FnSig> {
 
     fn argvecs<C:Combine>(this: &C, a_args: &[ty::t], b_args: &[ty::t]) -> cres<Vec<ty::t> > {
diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs
index 25465cc2d65..db66c93086a 100644
--- a/src/librustc/middle/typeck/infer/error_reporting.rs
+++ b/src/librustc/middle/typeck/infer/error_reporting.rs
@@ -1372,6 +1372,6 @@ impl LifeGiver {
     }
 
     fn get_generated_lifetimes(&self) -> Vec<ast::Lifetime> {
-        self.generated.get()
+        self.generated.borrow().clone()
     }
 }
diff --git a/src/librustc/middle/typeck/infer/glb.rs b/src/librustc/middle/typeck/infer/glb.rs
index e846e3621bd..83fc315bceb 100644
--- a/src/librustc/middle/typeck/infer/glb.rs
+++ b/src/librustc/middle/typeck/infer/glb.rs
@@ -28,7 +28,7 @@ use collections::HashMap;
 use util::common::{indenter};
 use util::ppaux::mt_to_str;
 
-pub struct Glb<'f>(CombineFields<'f>);  // "greatest lower bound" (common subtype)
+pub struct Glb<'f>(pub CombineFields<'f>);  // "greatest lower bound" (common subtype)
 
 impl<'f> Glb<'f> {
     pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Glb(ref v) = *self; v }
diff --git a/src/librustc/middle/typeck/infer/lub.rs b/src/librustc/middle/typeck/infer/lub.rs
index e63ad7322b9..7f48e233367 100644
--- a/src/librustc/middle/typeck/infer/lub.rs
+++ b/src/librustc/middle/typeck/infer/lub.rs
@@ -27,14 +27,10 @@ use syntax::ast::{ExternFn, ImpureFn, UnsafeFn};
 use syntax::ast::{Onceness, Purity};
 use util::ppaux::mt_to_str;
 
-pub struct Lub<'f>(CombineFields<'f>);  // least-upper-bound: common supertype
+pub struct Lub<'f>(pub CombineFields<'f>);  // least-upper-bound: common supertype
 
 impl<'f> Lub<'f> {
     pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Lub(ref v) = *self; v }
-    pub fn bot_ty(&self, b: ty::t) -> cres<ty::t> { Ok(b) }
-    pub fn ty_bot(&self, b: ty::t) -> cres<ty::t> {
-        self.bot_ty(b) // commutative
-    }
 }
 
 impl<'f> Combine for Lub<'f> {
diff --git a/src/librustc/middle/typeck/infer/macros.rs b/src/librustc/middle/typeck/infer/macros.rs
index 306f124be3c..d3e81f07f7d 100644
--- a/src/librustc/middle/typeck/infer/macros.rs
+++ b/src/librustc/middle/typeck/infer/macros.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[macro_escape];
+#![macro_escape]
 
 macro_rules! if_ok(
     ($inp: expr) => (
diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs
index a6baf9ef7bf..e01e34a0e5a 100644
--- a/src/librustc/middle/typeck/infer/mod.rs
+++ b/src/librustc/middle/typeck/infer/mod.rs
@@ -10,7 +10,7 @@
 
 /*! See doc.rs for documentation */
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 pub use middle::ty::IntVarValue;
 pub use middle::typeck::infer::resolve::resolve_and_force_all_but_regions;
@@ -75,26 +75,26 @@ pub type fres<T> = Result<T, fixup_err>; // "fixup result"
 pub type CoerceResult = cres<Option<@ty::AutoAdjustment>>;
 
 pub struct InferCtxt<'a> {
-    tcx: &'a ty::ctxt,
+    pub tcx: &'a ty::ctxt,
 
     // We instantiate ValsAndBindings with bounds<ty::t> because the
     // types that might instantiate a general type variable have an
     // order, represented by its upper and lower bounds.
-    ty_var_bindings: RefCell<ValsAndBindings<ty::TyVid, Bounds<ty::t>>>,
-    ty_var_counter: Cell<uint>,
+    pub ty_var_bindings: RefCell<ValsAndBindings<ty::TyVid, Bounds<ty::t>>>,
+    pub ty_var_counter: Cell<uint>,
 
     // Map from integral variable to the kind of integer it represents
-    int_var_bindings: RefCell<ValsAndBindings<ty::IntVid,
+    pub int_var_bindings: RefCell<ValsAndBindings<ty::IntVid,
                                               Option<IntVarValue>>>,
-    int_var_counter: Cell<uint>,
+    pub int_var_counter: Cell<uint>,
 
     // Map from floating variable to the kind of float it represents
-    float_var_bindings: RefCell<ValsAndBindings<ty::FloatVid,
+    pub float_var_bindings: RefCell<ValsAndBindings<ty::FloatVid,
                                                 Option<ast::FloatTy>>>,
-    float_var_counter: Cell<uint>,
+    pub float_var_counter: Cell<uint>,
 
     // For region variables.
-    region_vars: RegionVarBindings<'a>,
+    pub region_vars: RegionVarBindings<'a>,
 }
 
 /// Why did we require that the two types be related?
@@ -421,19 +421,6 @@ pub fn mk_coercety(cx: &InferCtxt,
     })
 }
 
-pub fn can_mk_coercety(cx: &InferCtxt, a: ty::t, b: ty::t) -> ures {
-    debug!("can_mk_coercety({} -> {})", a.inf_str(cx), b.inf_str(cx));
-    indent(|| {
-        cx.probe(|| {
-            let trace = TypeTrace {
-                origin: Misc(codemap::DUMMY_SP),
-                values: Types(expected_found(true, a, b))
-            };
-            Coerce(cx.combine_fields(true, trace)).tys(a, b)
-        })
-    }).to_ures()
-}
-
 // See comment on the type `resolve_state` below
 pub fn resolve_type(cx: &InferCtxt,
                     a: ty::t,
@@ -631,10 +618,6 @@ impl<'a> InferCtxt<'a> {
         result
     }
 
-    pub fn next_int_var(&self) -> ty::t {
-        ty::mk_int_var(self.tcx, self.next_int_var_id())
-    }
-
     pub fn next_float_var_id(&self) -> FloatVid {
         let mut float_var_counter = self.float_var_counter.get();
         let mut float_var_bindings = self.float_var_bindings.borrow_mut();
@@ -644,21 +627,10 @@ impl<'a> InferCtxt<'a> {
         result
     }
 
-    pub fn next_float_var(&self) -> ty::t {
-        ty::mk_float_var(self.tcx, self.next_float_var_id())
-    }
-
     pub fn next_region_var(&self, origin: RegionVariableOrigin) -> ty::Region {
         ty::ReInfer(ty::ReVar(self.region_vars.new_region_var(origin)))
     }
 
-    pub fn next_region_vars(&self,
-                            origin: RegionVariableOrigin,
-                            count: uint)
-                            -> Vec<ty::Region> {
-        Vec::from_fn(count, |_| self.next_region_var(origin))
-    }
-
     pub fn region_vars_for_defs(&self,
                                 span: Span,
                                 defs: &[ty::RegionParameterDef])
@@ -683,7 +655,7 @@ impl<'a> InferCtxt<'a> {
     }
 
     pub fn tys_to_str(&self, ts: &[ty::t]) -> ~str {
-        let tstrs = ts.map(|t| self.ty_to_str(*t));
+        let tstrs: Vec<~str> = ts.iter().map(|t| self.ty_to_str(*t)).collect();
         format!("({})", tstrs.connect(", "))
     }
 
diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/typeck/infer/region_inference/mod.rs
index 927b6be2a04..03b2ebcc245 100644
--- a/src/librustc/middle/typeck/infer/region_inference/mod.rs
+++ b/src/librustc/middle/typeck/infer/region_inference/mod.rs
@@ -104,8 +104,8 @@ pub enum RegionResolutionError {
 /// 'a and 'b together inside a SameRegions struct
 #[deriving(Clone)]
 pub struct SameRegions {
-    scope_id: ast::NodeId,
-    regions: Vec<BoundRegion>
+    pub scope_id: ast::NodeId,
+    pub regions: Vec<BoundRegion>
 }
 
 impl SameRegions {
@@ -1164,8 +1164,14 @@ impl<'a> RegionVarBindings<'a> {
             format!("collect_error_for_expanding_node() could not find error \
                   for var {:?}, lower_bounds={}, upper_bounds={}",
                  node_idx,
-                 lower_bounds.map(|x| x.region).repr(self.tcx),
-                 upper_bounds.map(|x| x.region).repr(self.tcx)));
+                 lower_bounds.iter()
+                             .map(|x| x.region)
+                             .collect::<Vec<ty::Region>>()
+                             .repr(self.tcx),
+                 upper_bounds.iter()
+                             .map(|x| x.region)
+                             .collect::<Vec<ty::Region>>()
+                             .repr(self.tcx)));
     }
 
     fn collect_error_for_contracting_node(
@@ -1209,7 +1215,10 @@ impl<'a> RegionVarBindings<'a> {
             format!("collect_error_for_contracting_node() could not find error \
                   for var {:?}, upper_bounds={}",
                  node_idx,
-                 upper_bounds.map(|x| x.region).repr(self.tcx)));
+                 upper_bounds.iter()
+                             .map(|x| x.region)
+                             .collect::<Vec<ty::Region>>()
+                             .repr(self.tcx)));
     }
 
     fn collect_concrete_regions(&self,
diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs
index 4bc0e765af5..5348a623d86 100644
--- a/src/librustc/middle/typeck/infer/resolve.rs
+++ b/src/librustc/middle/typeck/infer/resolve.rs
@@ -52,7 +52,7 @@ use middle::ty::{type_is_bot, IntType, UintType};
 use middle::ty;
 use middle::ty_fold;
 use middle::typeck::infer::{Bounds, cyclic_ty, fixup_err, fres, InferCtxt};
-use middle::typeck::infer::{region_var_bound_by_region_var, unresolved_ty};
+use middle::typeck::infer::unresolved_ty;
 use middle::typeck::infer::to_str::InferStr;
 use middle::typeck::infer::unify::{Root, UnifyInferCtxtMethods};
 use util::common::{indent, indenter};
@@ -64,14 +64,12 @@ pub static resolve_nested_tvar: uint = 0b0000000001;
 pub static resolve_rvar: uint        = 0b0000000010;
 pub static resolve_ivar: uint        = 0b0000000100;
 pub static resolve_fvar: uint        = 0b0000001000;
-pub static resolve_fnvar: uint       = 0b0000010000;
-pub static resolve_all: uint         = 0b0000011111;
+pub static resolve_all: uint         = 0b0000001111;
 pub static force_tvar: uint          = 0b0000100000;
 pub static force_rvar: uint          = 0b0001000000;
 pub static force_ivar: uint          = 0b0010000000;
 pub static force_fvar: uint          = 0b0100000000;
-pub static force_fnvar: uint         = 0b1000000000;
-pub static force_all: uint           = 0b1111100000;
+pub static force_all: uint           = 0b0111100000;
 
 pub static not_regions: uint         = !(force_rvar | resolve_rvar);
 
@@ -204,15 +202,6 @@ impl<'a> ResolveState<'a> {
         self.infcx.region_vars.resolve_var(rid)
     }
 
-    pub fn assert_not_rvar(&mut self, rid: RegionVid, r: ty::Region) {
-        match r {
-          ty::ReInfer(ty::ReVar(rid2)) => {
-            self.err = Some(region_var_bound_by_region_var(rid, rid2));
-          }
-          _ => { }
-        }
-    }
-
     pub fn resolve_ty_var(&mut self, vid: TyVid) -> ty::t {
         if self.v_seen.contains(&vid) {
             self.err = Some(cyclic_ty(vid));
diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/typeck/infer/sub.rs
index ef17a593654..b22e6f4677b 100644
--- a/src/librustc/middle/typeck/infer/sub.rs
+++ b/src/librustc/middle/typeck/infer/sub.rs
@@ -27,7 +27,7 @@ use util::ppaux::bound_region_to_str;
 
 use syntax::ast::{Onceness, Purity};
 
-pub struct Sub<'f>(CombineFields<'f>);  // "subtype", "subregion" etc
+pub struct Sub<'f>(pub CombineFields<'f>);  // "subtype", "subregion" etc
 
 impl<'f> Sub<'f> {
     pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Sub(ref v) = *self; v }
diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs
index aa3e3a23182..aa0b777a0c0 100644
--- a/src/librustc/middle/typeck/infer/to_str.rs
+++ b/src/librustc/middle/typeck/infer/to_str.rs
@@ -32,7 +32,7 @@ impl InferStr for ty::t {
 impl InferStr for FnSig {
     fn inf_str(&self, cx: &InferCtxt) -> ~str {
         format!("({}) -> {}",
-             self.inputs.map(|a| a.inf_str(cx)).connect(", "),
+             self.inputs.iter().map(|a| a.inf_str(cx)).collect::<Vec<~str>>().connect(", "),
              self.output.inf_str(cx))
     }
 }
diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs
index 20d268bca6c..2ee4f8fedd2 100644
--- a/src/librustc/middle/typeck/infer/unify.rs
+++ b/src/librustc/middle/typeck/infer/unify.rs
@@ -26,14 +26,14 @@ pub enum VarValue<V, T> {
 }
 
 pub struct ValsAndBindings<V, T> {
-    vals: SmallIntMap<VarValue<V, T>>,
-    bindings: Vec<(V, VarValue<V, T>)> ,
+    pub vals: SmallIntMap<VarValue<V, T>>,
+    pub bindings: Vec<(V, VarValue<V, T>)> ,
 }
 
 pub struct Node<V, T> {
-    root: V,
-    possible_types: T,
-    rank: uint,
+    pub root: V,
+    pub possible_types: T,
+    pub rank: uint,
 }
 
 pub trait UnifyVid<T> {
diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs
index 67db5b7f396..446d2ff055c 100644
--- a/src/librustc/middle/typeck/mod.rs
+++ b/src/librustc/middle/typeck/mod.rs
@@ -59,7 +59,7 @@ independently:
 
 */
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use driver::session;
 
@@ -72,7 +72,6 @@ use util::nodemap::{DefIdMap, FnvHashMap};
 
 use std::cell::RefCell;
 use std::rc::Rc;
-use collections::List;
 use syntax::codemap::Span;
 use syntax::print::pprust::*;
 use syntax::{ast, ast_map, abi};
@@ -109,49 +108,49 @@ pub enum MethodOrigin {
 #[deriving(Clone, Encodable, Decodable)]
 pub struct MethodParam {
     // the trait containing the method to be invoked
-    trait_id: ast::DefId,
+    pub trait_id: ast::DefId,
 
     // index of the method to be invoked amongst the trait's methods
-    method_num: uint,
+    pub method_num: uint,
 
     // index of the type parameter (from those that are in scope) that is
     // the type of the receiver
-    param_num: param_index,
+    pub param_num: param_index,
 
     // index of the bound for this type parameter which specifies the trait
-    bound_num: uint,
+    pub bound_num: uint,
 }
 
 // details for a method invoked with a receiver whose type is an object
 #[deriving(Clone, Encodable, Decodable)]
 pub struct MethodObject {
     // the (super)trait containing the method to be invoked
-    trait_id: ast::DefId,
+    pub trait_id: ast::DefId,
 
     // the actual base trait id of the object
-    object_trait_id: ast::DefId,
+    pub object_trait_id: ast::DefId,
 
     // index of the method to be invoked amongst the trait's methods
-    method_num: uint,
+    pub method_num: uint,
 
     // index into the actual runtime vtable.
     // the vtable is formed by concatenating together the method lists of
     // the base object trait and all supertraits;  this is the index into
     // that vtable
-    real_index: uint,
+    pub real_index: uint,
 }
 
 #[deriving(Clone)]
 pub struct MethodCallee {
-    origin: MethodOrigin,
-    ty: ty::t,
-    substs: ty::substs
+    pub origin: MethodOrigin,
+    pub ty: ty::t,
+    pub substs: ty::substs
 }
 
 #[deriving(Clone, Eq, TotalEq, Hash, Show)]
 pub struct MethodCall {
-    expr_id: ast::NodeId,
-    autoderef: u32
+    pub expr_id: ast::NodeId,
+    pub autoderef: u32
 }
 
 impl MethodCall {
@@ -225,9 +224,9 @@ pub type vtable_map = @RefCell<FnvHashMap<MethodCall, vtable_res>>;
 #[deriving(Clone)]
 pub struct impl_res {
     // resolutions for any bounded params on the trait definition
-    trait_vtables: vtable_res,
+    pub trait_vtables: vtable_res,
     // resolutions for the trait /itself/ (and for supertraits)
-    self_vtables: vtable_param_res
+    pub self_vtables: vtable_param_res
 }
 
 impl Repr for impl_res {
@@ -259,21 +258,12 @@ pub fn write_substs_to_tcx(tcx: &ty::ctxt,
                            substs: Vec<ty::t> ) {
     if substs.len() > 0u {
         debug!("write_substs_to_tcx({}, {:?})", node_id,
-               substs.map(|t| ppaux::ty_to_str(tcx, *t)));
+               substs.iter().map(|t| ppaux::ty_to_str(tcx, *t)).collect::<Vec<~str>>());
         assert!(substs.iter().all(|t| !ty::type_needs_infer(*t)));
 
         tcx.node_type_substs.borrow_mut().insert(node_id, substs);
     }
 }
-pub fn write_tpt_to_tcx(tcx: &ty::ctxt,
-                        node_id: ast::NodeId,
-                        tpt: &ty::ty_param_substs_and_ty) {
-    write_ty_to_tcx(tcx, node_id, tpt.ty);
-    if !tpt.substs.tps.is_empty() {
-        write_substs_to_tcx(tcx, node_id, tpt.substs.tps.clone());
-    }
-}
-
 pub fn lookup_def_tcx(tcx:&ty::ctxt, sp: Span, id: ast::NodeId) -> ast::Def {
     match tcx.def_map.borrow().find(&id) {
         Some(&x) => x,
@@ -327,7 +317,7 @@ pub fn require_same_types(tcx: &ty::ctxt,
 
 // a list of mapping from in-scope-region-names ("isr") to the
 // corresponding ty::Region
-pub type isr_alist = @List<(ty::BoundRegion, ty::Region)>;
+pub type isr_alist = @Vec<(ty::BoundRegion, ty::Region)>;
 
 trait get_region<'a, T:'static> {
     fn get(&'a self, br: ty::BoundRegion) -> ty::Region;
@@ -368,7 +358,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
             }
             let se_ty = ty::mk_bare_fn(tcx, ty::BareFnTy {
                 purity: ast::ImpureFn,
-                abis: abi::AbiSet::Rust(),
+                abi: abi::Rust,
                 sig: ty::FnSig {
                     binder_id: main_id,
                     inputs: Vec::new(),
@@ -414,7 +404,7 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
 
             let se_ty = ty::mk_bare_fn(tcx, ty::BareFnTy {
                 purity: ast::ImpureFn,
-                abis: abi::AbiSet::Rust(),
+                abi: abi::Rust,
                 sig: ty::FnSig {
                     binder_id: start_id,
                     inputs: vec!(
@@ -441,7 +431,7 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
 fn check_for_entry_fn(ccx: &CrateCtxt) {
     let tcx = ccx.tcx;
     if !tcx.sess.building_library.get() {
-        match tcx.sess.entry_fn.get() {
+        match *tcx.sess.entry_fn.borrow() {
           Some((id, sp)) => match tcx.sess.entry_type.get() {
               Some(session::EntryMain) => check_main_fn_ty(ccx, id, sp),
               Some(session::EntryStart) => check_start_fn_ty(ccx, id, sp),
diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs
index cef047fae5d..2abbd916d76 100644
--- a/src/librustc/middle/typeck/rscope.rs
+++ b/src/librustc/middle/typeck/rscope.rs
@@ -14,7 +14,6 @@ use middle::ty;
 use std::cell::Cell;
 use syntax::ast;
 use syntax::codemap::Span;
-use syntax::owned_slice::OwnedSlice;
 
 /// Defines strategies for handling regions that are omitted.  For
 /// example, if one writes the type `&Foo`, then the lifetime of
@@ -72,10 +71,3 @@ impl RegionScope for BindingRscope {
                                                    ty::BrAnon(idx + i))))
     }
 }
-
-pub fn bound_type_regions(defs: &[ty::RegionParameterDef])
-                          -> OwnedSlice<ty::Region> {
-    assert!(defs.iter().all(|def| def.def_id.krate == ast::LOCAL_CRATE));
-    defs.iter().enumerate().map(
-        |(i, def)| ty::ReEarlyBound(def.def_id.node, i, def.name)).collect()
-}
diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs
index 732723fec9c..ce8a34c4c23 100644
--- a/src/librustc/util/common.rs
+++ b/src/librustc/util/common.rs
@@ -8,10 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use syntax::ast;
-use syntax::codemap::{Span};
 use syntax::visit;
 use syntax::visit::Visitor;
 
@@ -64,12 +63,6 @@ pub fn indenter() -> _indenter {
     _indenter(())
 }
 
-pub fn field_expr(f: ast::Field) -> @ast::Expr { return f.expr; }
-
-pub fn field_exprs(fields: Vec<ast::Field> ) -> Vec<@ast::Expr> {
-    fields.map(|f| f.expr)
-}
-
 struct LoopQueryVisitor<'a> {
     p: 'a |&ast::Expr_| -> bool,
     flag: bool,
@@ -120,16 +113,3 @@ pub fn block_query(b: ast::P<ast::Block>, p: |&ast::Expr| -> bool) -> bool {
     visit::walk_block(&mut v, b, ());
     return v.flag;
 }
-
-pub fn local_rhs_span(l: &ast::Local, def: Span) -> Span {
-    match l.init {
-      Some(i) => return i.span,
-      _ => return def
-    }
-}
-
-pub fn pluralize(n: uint, s: ~str) -> ~str {
-    if n == 1 { s }
-    else { format!("{}s", s) }
-}
-
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index 1a017340c95..4a1be783d9d 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -23,7 +23,7 @@ use middle::ty::{ty_uniq, ty_trait, ty_int, ty_uint, ty_unboxed_vec, ty_infer};
 use middle::ty;
 use middle::typeck;
 
-use syntax::abi::AbiSet;
+use syntax::abi;
 use syntax::ast_map;
 use syntax::codemap::{Span, Pos};
 use syntax::parse::token;
@@ -58,14 +58,6 @@ pub fn note_and_explain_region(cx: &ctxt,
     }
 }
 
-/// Returns a string like "the block at 27:31" that attempts to explain a
-/// lifetime in a way it might plausibly be understood.
-pub fn explain_region(cx: &ctxt, region: ty::Region) -> ~str {
-  let (res, _) = explain_region_and_span(cx, region);
-  return res;
-}
-
-
 pub fn explain_region_and_span(cx: &ctxt, region: ty::Region)
                             -> (~str, Option<Span>) {
     return match region {
@@ -165,42 +157,6 @@ pub fn bound_region_to_str(cx: &ctxt,
     }
 }
 
-pub fn ReScope_id_to_str(cx: &ctxt, node_id: ast::NodeId) -> ~str {
-    match cx.map.find(node_id) {
-      Some(ast_map::NodeBlock(ref blk)) => {
-        format!("<block at {}>",
-             cx.sess.codemap().span_to_str(blk.span))
-      }
-      Some(ast_map::NodeExpr(expr)) => {
-        match expr.node {
-          ast::ExprCall(..) => {
-            format!("<call at {}>",
-                 cx.sess.codemap().span_to_str(expr.span))
-          }
-          ast::ExprMatch(..) => {
-            format!("<match at {}>",
-                 cx.sess.codemap().span_to_str(expr.span))
-          }
-          ast::ExprAssignOp(..) |
-          ast::ExprUnary(..) |
-          ast::ExprBinary(..) |
-          ast::ExprIndex(..) => {
-            format!("<method at {}>",
-                 cx.sess.codemap().span_to_str(expr.span))
-          }
-          _ => {
-            format!("<expression at {}>",
-                 cx.sess.codemap().span_to_str(expr.span))
-          }
-        }
-      }
-      None => {
-        format!("<unknown-{}>", node_id)
-      }
-      _ => cx.sess.bug(format!("ReScope refers to {}", cx.map.node_to_str(node_id)))
-    }
-}
-
 // In general, if you are giving a region error message,
 // you should use `explain_region()` or, better yet,
 // `note_and_explain_region()`
@@ -276,14 +232,10 @@ pub fn vstore_ty_to_str(cx: &ctxt, mt: &mt, vs: ty::vstore) -> ~str {
 }
 
 pub fn vec_map_to_str<T>(ts: &[T], f: |t: &T| -> ~str) -> ~str {
-    let tstrs = ts.map(f);
+    let tstrs = ts.iter().map(f).collect::<Vec<~str>>();
     format!("[{}]", tstrs.connect(", "))
 }
 
-pub fn tys_to_str(cx: &ctxt, ts: &[t]) -> ~str {
-    vec_map_to_str(ts, |t| ty_to_str(cx, *t))
-}
-
 pub fn fn_sig_to_str(cx: &ctxt, typ: &ty::FnSig) -> ~str {
     format!("fn{}{} -> {}",
             typ.binder_id,
@@ -301,14 +253,14 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> ~str {
     }
     fn bare_fn_to_str(cx: &ctxt,
                       purity: ast::Purity,
-                      abis: AbiSet,
+                      abi: abi::Abi,
                       ident: Option<ast::Ident>,
                       sig: &ty::FnSig)
                       -> ~str {
-        let mut s = if abis.is_rust() {
+        let mut s = if abi == abi::Rust {
             ~""
         } else {
-            format!("extern {} ", abis.to_str())
+            format!("extern {} ", abi.to_str())
         };
 
         match purity {
@@ -405,7 +357,7 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> ~str {
                        ket: char,
                        sig: &ty::FnSig) {
         s.push_char(bra);
-        let strs = sig.inputs.map(|a| fn_input_to_str(cx, *a));
+        let strs: Vec<~str> = sig.inputs.iter().map(|a| fn_input_to_str(cx, *a)).collect();
         s.push_str(strs.connect(", "));
         if sig.variadic {
             s.push_str(", ...");
@@ -447,14 +399,14 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> ~str {
       }
       ty_unboxed_vec(ref tm) => { format!("unboxed_vec<{}>", mt_to_str(cx, tm)) }
       ty_tup(ref elems) => {
-        let strs = elems.map(|elem| ty_to_str(cx, *elem));
+        let strs: Vec<~str> = elems.iter().map(|elem| ty_to_str(cx, *elem)).collect();
         ~"(" + strs.connect(",") + ")"
       }
       ty_closure(ref f) => {
           closure_to_str(cx, *f)
       }
       ty_bare_fn(ref f) => {
-          bare_fn_to_str(cx, f.purity, f.abis, None, &f.sig)
+          bare_fn_to_str(cx, f.purity, f.abi, None, &f.sig)
       }
       ty_infer(infer_ty) => infer_ty.to_str(),
       ty_err => ~"[type error]",
@@ -665,7 +617,7 @@ impl Repr for ty::ParamBounds {
                 ty::BoundStatic => ~"'static",
                 ty::BoundSend => ~"Send",
                 ty::BoundSized => ~"Sized",
-                ty::BoundPod => ~"Pod",
+                ty::BoundCopy => ~"Pod",
                 ty::BoundShare => ~"Share",
             });
         }
@@ -861,9 +813,9 @@ impl Repr for ast::Visibility {
 
 impl Repr for ty::BareFnTy {
     fn repr(&self, tcx: &ctxt) -> ~str {
-        format!("BareFnTy \\{purity: {:?}, abis: {}, sig: {}\\}",
+        format!("BareFnTy \\{purity: {:?}, abi: {}, sig: {}\\}",
              self.purity,
-             self.abis.to_str(),
+             self.abi.to_str(),
              self.sig.repr(tcx))
     }
 }
@@ -952,7 +904,7 @@ impl UserString for ty::BuiltinBound {
             ty::BoundStatic => ~"'static",
             ty::BoundSend => ~"Send",
             ty::BoundSized => ~"Sized",
-            ty::BoundPod => ~"Pod",
+            ty::BoundCopy => ~"Pod",
             ty::BoundShare => ~"Share",
         }
     }
@@ -1016,13 +968,13 @@ impl UserString for ast::Ident {
     }
 }
 
-impl Repr for AbiSet {
+impl Repr for abi::Abi {
     fn repr(&self, _tcx: &ctxt) -> ~str {
         self.to_str()
     }
 }
 
-impl UserString for AbiSet {
+impl UserString for abi::Abi {
     fn user_string(&self, _tcx: &ctxt) -> ~str {
         self.to_str()
     }
diff --git a/src/librustc/util/sha2.rs b/src/librustc/util/sha2.rs
index 75d6f1f5cd1..944b1e237f9 100644
--- a/src/librustc/util/sha2.rs
+++ b/src/librustc/util/sha2.rs
@@ -473,7 +473,7 @@ impl Engine256 {
 
 /// The SHA-256 hash algorithm
 pub struct Sha256 {
-    priv engine: Engine256
+    engine: Engine256
 }
 
 impl Sha256 {
diff --git a/src/librustdoc/clean.rs b/src/librustdoc/clean.rs
index 0bc3da15462..e92aec8e25c 100644
--- a/src/librustdoc/clean.rs
+++ b/src/librustdoc/clean.rs
@@ -64,9 +64,9 @@ impl<T: Clean<U>, U> Clean<Vec<U>> for syntax::owned_slice::OwnedSlice<T> {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Crate {
-    name: ~str,
-    module: Option<Item>,
-    externs: Vec<(ast::CrateNum, ExternalCrate)> ,
+    pub name: ~str,
+    pub module: Option<Item>,
+    pub externs: Vec<(ast::CrateNum, ExternalCrate)>,
 }
 
 impl<'a> Clean<Crate> for visit_ast::RustdocVisitor<'a> {
@@ -92,8 +92,8 @@ impl<'a> Clean<Crate> for visit_ast::RustdocVisitor<'a> {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct ExternalCrate {
-    name: ~str,
-    attrs: Vec<Attribute> ,
+    pub name: ~str,
+    pub attrs: Vec<Attribute>,
 }
 
 impl Clean<ExternalCrate> for cstore::crate_metadata {
@@ -113,13 +113,13 @@ impl Clean<ExternalCrate> for cstore::crate_metadata {
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Item {
     /// Stringified span
-    source: Span,
+    pub source: Span,
     /// Not everything has a name. E.g., impls
-    name: Option<~str>,
-    attrs: Vec<Attribute> ,
-    inner: ItemEnum,
-    visibility: Option<Visibility>,
-    id: ast::NodeId,
+    pub name: Option<~str>,
+    pub attrs: Vec<Attribute> ,
+    pub inner: ItemEnum,
+    pub visibility: Option<Visibility>,
+    pub id: ast::NodeId,
 }
 
 impl Item {
@@ -192,8 +192,8 @@ pub enum ItemEnum {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Module {
-    items: Vec<Item> ,
-    is_crate: bool,
+    pub items: Vec<Item>,
+    pub is_crate: bool,
 }
 
 impl Clean<Item> for doctree::Module {
@@ -289,9 +289,10 @@ impl<'a> attr::AttrMetaMethods for &'a Attribute {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct TyParam {
-    name: ~str,
-    id: ast::NodeId,
-    bounds: Vec<TyParamBound> }
+    pub name: ~str,
+    pub id: ast::NodeId,
+    pub bounds: Vec<TyParamBound>,
+}
 
 impl Clean<TyParam> for ast::TyParam {
     fn clean(&self) -> TyParam {
@@ -338,8 +339,9 @@ impl Clean<Lifetime> for ast::Lifetime {
 // maybe use a Generic enum and use ~[Generic]?
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Generics {
-    lifetimes: Vec<Lifetime> ,
-    type_params: Vec<TyParam> }
+    pub lifetimes: Vec<Lifetime>,
+    pub type_params: Vec<TyParam>,
+}
 
 impl Clean<Generics> for ast::Generics {
     fn clean(&self) -> Generics {
@@ -352,10 +354,10 @@ impl Clean<Generics> for ast::Generics {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Method {
-    generics: Generics,
-    self_: SelfTy,
-    purity: ast::Purity,
-    decl: FnDecl,
+    pub generics: Generics,
+    pub self_: SelfTy,
+    pub purity: ast::Purity,
+    pub decl: FnDecl,
 }
 
 impl Clean<Item> for ast::Method {
@@ -390,10 +392,10 @@ impl Clean<Item> for ast::Method {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct TyMethod {
-    purity: ast::Purity,
-    decl: FnDecl,
-    generics: Generics,
-    self_: SelfTy,
+    pub purity: ast::Purity,
+    pub decl: FnDecl,
+    pub generics: Generics,
+    pub self_: SelfTy,
 }
 
 impl Clean<Item> for ast::TypeMethod {
@@ -447,9 +449,9 @@ impl Clean<SelfTy> for ast::ExplicitSelf {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Function {
-    decl: FnDecl,
-    generics: Generics,
-    purity: ast::Purity,
+    pub decl: FnDecl,
+    pub generics: Generics,
+    pub purity: ast::Purity,
 }
 
 impl Clean<Item> for doctree::Function {
@@ -471,13 +473,14 @@ impl Clean<Item> for doctree::Function {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct ClosureDecl {
-    sigil: ast::Sigil,
-    region: Option<Lifetime>,
-    lifetimes: Vec<Lifetime> ,
-    decl: FnDecl,
-    onceness: ast::Onceness,
-    purity: ast::Purity,
-    bounds: Vec<TyParamBound> }
+    pub sigil: ast::Sigil,
+    pub region: Option<Lifetime>,
+    pub lifetimes: Vec<Lifetime>,
+    pub decl: FnDecl,
+    pub onceness: ast::Onceness,
+    pub purity: ast::Purity,
+    pub bounds: Vec<TyParamBound>,
+}
 
 impl Clean<ClosureDecl> for ast::ClosureTy {
     fn clean(&self) -> ClosureDecl {
@@ -498,14 +501,15 @@ impl Clean<ClosureDecl> for ast::ClosureTy {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct FnDecl {
-    inputs: Arguments,
-    output: Type,
-    cf: RetStyle,
-    attrs: Vec<Attribute> }
+    pub inputs: Arguments,
+    pub output: Type,
+    pub cf: RetStyle,
+    pub attrs: Vec<Attribute>,
+}
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Arguments {
-    values: Vec<Argument> ,
+    pub values: Vec<Argument>,
 }
 
 impl Clean<FnDecl> for ast::FnDecl {
@@ -523,9 +527,9 @@ impl Clean<FnDecl> for ast::FnDecl {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Argument {
-    type_: Type,
-    name: ~str,
-    id: ast::NodeId
+    pub type_: Type,
+    pub name: ~str,
+    pub id: ast::NodeId,
 }
 
 impl Clean<Argument> for ast::Arg {
@@ -555,9 +559,9 @@ impl Clean<RetStyle> for ast::RetStyle {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Trait {
-    methods: Vec<TraitMethod> ,
-    generics: Generics,
-    parents: Vec<Type> ,
+    pub methods: Vec<TraitMethod>,
+    pub generics: Generics,
+    pub parents: Vec<Type>,
 }
 
 impl Clean<Item> for doctree::Trait {
@@ -626,17 +630,17 @@ impl Clean<TraitMethod> for ast::TraitMethod {
 pub enum Type {
     /// structs/enums/traits (anything that'd be an ast::TyPath)
     ResolvedPath {
-        path: Path,
-        typarams: Option<Vec<TyParamBound> >,
-        id: ast::NodeId,
+        pub path: Path,
+        pub typarams: Option<Vec<TyParamBound>>,
+        pub id: ast::NodeId,
     },
     /// Same as above, but only external variants
     ExternalPath {
-        path: Path,
-        typarams: Option<Vec<TyParamBound> >,
-        fqn: Vec<~str> ,
-        kind: TypeKind,
-        krate: ast::CrateNum,
+        pub path: Path,
+        pub typarams: Option<Vec<TyParamBound>>,
+        pub fqn: Vec<~str>,
+        pub kind: TypeKind,
+        pub krate: ast::CrateNum,
     },
     // I have no idea how to usefully use this.
     TyParamBinder(ast::NodeId),
@@ -662,7 +666,11 @@ pub enum Type {
     Unique(~Type),
     Managed(~Type),
     RawPointer(Mutability, ~Type),
-    BorrowedRef { lifetime: Option<Lifetime>, mutability: Mutability, type_: ~Type},
+    BorrowedRef {
+        pub lifetime: Option<Lifetime>,
+        pub mutability: Mutability,
+        pub type_: ~Type,
+    },
     // region, raw, other boxes, mutable
 }
 
@@ -707,7 +715,7 @@ impl Clean<Type> for ast::Ty {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct StructField {
-    type_: Type,
+    pub type_: Type,
 }
 
 impl Clean<Item> for ast::StructField {
@@ -739,10 +747,10 @@ impl Clean<Option<Visibility>> for ast::Visibility {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Struct {
-    struct_type: doctree::StructType,
-    generics: Generics,
-    fields: Vec<Item> ,
-    fields_stripped: bool,
+    pub struct_type: doctree::StructType,
+    pub generics: Generics,
+    pub fields: Vec<Item>,
+    pub fields_stripped: bool,
 }
 
 impl Clean<Item> for doctree::Struct {
@@ -768,9 +776,9 @@ impl Clean<Item> for doctree::Struct {
 /// only as a variant in an enum.
 #[deriving(Clone, Encodable, Decodable)]
 pub struct VariantStruct {
-    struct_type: doctree::StructType,
-    fields: Vec<Item> ,
-    fields_stripped: bool,
+    pub struct_type: doctree::StructType,
+    pub fields: Vec<Item>,
+    pub fields_stripped: bool,
 }
 
 impl Clean<VariantStruct> for syntax::ast::StructDef {
@@ -785,9 +793,9 @@ impl Clean<VariantStruct> for syntax::ast::StructDef {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Enum {
-    variants: Vec<Item> ,
-    generics: Generics,
-    variants_stripped: bool,
+    pub variants: Vec<Item>,
+    pub generics: Generics,
+    pub variants_stripped: bool,
 }
 
 impl Clean<Item> for doctree::Enum {
@@ -809,7 +817,7 @@ impl Clean<Item> for doctree::Enum {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Variant {
-    kind: VariantKind,
+    pub kind: VariantKind,
 }
 
 impl Clean<Item> for doctree::Variant {
@@ -851,11 +859,11 @@ impl Clean<VariantKind> for ast::VariantKind {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Span {
-    filename: ~str,
-    loline: uint,
-    locol: uint,
-    hiline: uint,
-    hicol: uint,
+    pub filename: ~str,
+    pub loline: uint,
+    pub locol: uint,
+    pub hiline: uint,
+    pub hicol: uint,
 }
 
 impl Clean<Span> for syntax::codemap::Span {
@@ -876,8 +884,8 @@ impl Clean<Span> for syntax::codemap::Span {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Path {
-    global: bool,
-    segments: Vec<PathSegment> ,
+    pub global: bool,
+    pub segments: Vec<PathSegment>,
 }
 
 impl Clean<Path> for ast::Path {
@@ -891,9 +899,9 @@ impl Clean<Path> for ast::Path {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct PathSegment {
-    name: ~str,
-    lifetimes: Vec<Lifetime> ,
-    types: Vec<Type> ,
+    pub name: ~str,
+    pub lifetimes: Vec<Lifetime>,
+    pub types: Vec<Type>,
 }
 
 impl Clean<PathSegment> for ast::PathSegment {
@@ -930,8 +938,8 @@ impl Clean<~str> for ast::Ident {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Typedef {
-    type_: Type,
-    generics: Generics,
+    pub type_: Type,
+    pub generics: Generics,
 }
 
 impl Clean<Item> for doctree::Typedef {
@@ -952,10 +960,10 @@ impl Clean<Item> for doctree::Typedef {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct BareFunctionDecl {
-    purity: ast::Purity,
-    generics: Generics,
-    decl: FnDecl,
-    abi: ~str
+    pub purity: ast::Purity,
+    pub generics: Generics,
+    pub decl: FnDecl,
+    pub abi: ~str,
 }
 
 impl Clean<BareFunctionDecl> for ast::BareFnTy {
@@ -967,19 +975,19 @@ impl Clean<BareFunctionDecl> for ast::BareFnTy {
                 type_params: Vec::new(),
             },
             decl: self.decl.clean(),
-            abi: self.abis.to_str(),
+            abi: self.abi.to_str(),
         }
     }
 }
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Static {
-    type_: Type,
-    mutability: Mutability,
+    pub type_: Type,
+    pub mutability: Mutability,
     /// It's useful to have the value of a static documented, but I have no
     /// desire to represent expressions (that'd basically be all of the AST,
     /// which is huge!). So, have a string.
-    expr: ~str,
+    pub expr: ~str,
 }
 
 impl Clean<Item> for doctree::Static {
@@ -1017,11 +1025,11 @@ impl Clean<Mutability> for ast::Mutability {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Impl {
-    generics: Generics,
-    trait_: Option<Type>,
-    for_: Type,
-    methods: Vec<Item>,
-    derived: bool,
+    pub generics: Generics,
+    pub trait_: Option<Type>,
+    pub for_: Type,
+    pub methods: Vec<Item>,
+    pub derived: bool,
 }
 
 impl Clean<Item> for doctree::Impl {
@@ -1056,7 +1064,7 @@ impl Clean<Item> for doctree::Impl {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct ViewItem {
-    inner: ViewItemInner
+    pub inner: ViewItemInner,
 }
 
 impl Clean<Item> for ast::ViewItem {
@@ -1109,8 +1117,8 @@ pub enum ViewPath {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct ImportSource {
-    path: Path,
-    did: Option<ast::DefId>,
+    pub path: Path,
+    pub did: Option<ast::DefId>,
 }
 
 impl Clean<ViewPath> for ast::ViewPath {
@@ -1130,8 +1138,8 @@ impl Clean<ViewPath> for ast::ViewPath {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct ViewListIdent {
-    name: ~str,
-    source: Option<ast::DefId>,
+    pub name: ~str,
+    pub source: Option<ast::DefId>,
 }
 
 impl Clean<ViewListIdent> for ast::PathListIdent {
@@ -1311,7 +1319,7 @@ fn resolve_def(id: ast::NodeId) -> Option<ast::DefId> {
 
 #[deriving(Clone, Encodable, Decodable)]
 pub struct Macro {
-    source: ~str,
+    pub source: ~str,
 }
 
 impl Clean<Item> for doctree::Macro {
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 7fb40a09693..027d14babaf 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -32,8 +32,8 @@ pub enum MaybeTyped {
 }
 
 pub struct DocContext {
-    krate: ast::Crate,
-    maybe_typed: MaybeTyped
+    pub krate: ast::Crate,
+    pub maybe_typed: MaybeTyped
 }
 
 impl DocContext {
@@ -46,8 +46,8 @@ impl DocContext {
 }
 
 pub struct CrateAnalysis {
-    exported_items: privacy::ExportedItems,
-    public_items: privacy::PublicItems,
+    pub exported_items: privacy::ExportedItems,
+    pub public_items: privacy::PublicItems,
 }
 
 /// Parses, resolves, and typechecks the given crate
diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs
index 2bd2e7a8e5c..78b1a1388f8 100644
--- a/src/librustdoc/doctree.rs
+++ b/src/librustdoc/doctree.rs
@@ -17,23 +17,23 @@ use syntax::ast;
 use syntax::ast::{Ident, NodeId};
 
 pub struct Module {
-    name: Option<Ident>,
-    attrs: Vec<ast::Attribute> ,
-    where: Span,
-    structs: Vec<Struct> ,
-    enums: Vec<Enum> ,
-    fns: Vec<Function> ,
-    mods: Vec<Module> ,
-    id: NodeId,
-    typedefs: Vec<Typedef> ,
-    statics: Vec<Static> ,
-    traits: Vec<Trait> ,
-    vis: ast::Visibility,
-    impls: Vec<Impl> ,
-    foreigns: Vec<ast::ForeignMod> ,
-    view_items: Vec<ast::ViewItem> ,
-    macros: Vec<Macro> ,
-    is_crate: bool,
+    pub name: Option<Ident>,
+    pub attrs: Vec<ast::Attribute>,
+    pub where: Span,
+    pub structs: Vec<Struct>,
+    pub enums: Vec<Enum>,
+    pub fns: Vec<Function>,
+    pub mods: Vec<Module>,
+    pub id: NodeId,
+    pub typedefs: Vec<Typedef>,
+    pub statics: Vec<Static>,
+    pub traits: Vec<Trait>,
+    pub vis: ast::Visibility,
+    pub impls: Vec<Impl>,
+    pub foreigns: Vec<ast::ForeignMod>,
+    pub view_items: Vec<ast::ViewItem>,
+    pub macros: Vec<Macro>,
+    pub is_crate: bool,
 }
 
 impl Module {
@@ -78,94 +78,94 @@ pub enum TypeBound {
 }
 
 pub struct Struct {
-    vis: ast::Visibility,
-    id: NodeId,
-    struct_type: StructType,
-    name: Ident,
-    generics: ast::Generics,
-    attrs: Vec<ast::Attribute> ,
-    fields: Vec<ast::StructField> ,
-    where: Span,
+    pub vis: ast::Visibility,
+    pub id: NodeId,
+    pub struct_type: StructType,
+    pub name: Ident,
+    pub generics: ast::Generics,
+    pub attrs: Vec<ast::Attribute>,
+    pub fields: Vec<ast::StructField>,
+    pub where: Span,
 }
 
 pub struct Enum {
-    vis: ast::Visibility,
-    variants: Vec<Variant> ,
-    generics: ast::Generics,
-    attrs: Vec<ast::Attribute> ,
-    id: NodeId,
-    where: Span,
-    name: Ident,
+    pub vis: ast::Visibility,
+    pub variants: Vec<Variant>,
+    pub generics: ast::Generics,
+    pub attrs: Vec<ast::Attribute>,
+    pub id: NodeId,
+    pub where: Span,
+    pub name: Ident,
 }
 
 pub struct Variant {
-    name: Ident,
-    attrs: Vec<ast::Attribute> ,
-    kind: ast::VariantKind,
-    id: ast::NodeId,
-    vis: ast::Visibility,
-    where: Span,
+    pub name: Ident,
+    pub attrs: Vec<ast::Attribute>,
+    pub kind: ast::VariantKind,
+    pub id: ast::NodeId,
+    pub vis: ast::Visibility,
+    pub where: Span,
 }
 
 pub struct Function {
-    decl: ast::FnDecl,
-    attrs: Vec<ast::Attribute> ,
-    id: NodeId,
-    name: Ident,
-    vis: ast::Visibility,
-    purity: ast::Purity,
-    where: Span,
-    generics: ast::Generics,
+    pub decl: ast::FnDecl,
+    pub attrs: Vec<ast::Attribute>,
+    pub id: NodeId,
+    pub name: Ident,
+    pub vis: ast::Visibility,
+    pub purity: ast::Purity,
+    pub where: Span,
+    pub generics: ast::Generics,
 }
 
 pub struct Typedef {
-    ty: ast::P<ast::Ty>,
-    gen: ast::Generics,
-    name: Ident,
-    id: ast::NodeId,
-    attrs: Vec<ast::Attribute> ,
-    where: Span,
-    vis: ast::Visibility,
+    pub ty: ast::P<ast::Ty>,
+    pub gen: ast::Generics,
+    pub name: Ident,
+    pub id: ast::NodeId,
+    pub attrs: Vec<ast::Attribute>,
+    pub where: Span,
+    pub vis: ast::Visibility,
 }
 
 pub struct Static {
-    type_: ast::P<ast::Ty>,
-    mutability: ast::Mutability,
-    expr: @ast::Expr,
-    name: Ident,
-    attrs: Vec<ast::Attribute> ,
-    vis: ast::Visibility,
-    id: ast::NodeId,
-    where: Span,
+    pub type_: ast::P<ast::Ty>,
+    pub mutability: ast::Mutability,
+    pub expr: @ast::Expr,
+    pub name: Ident,
+    pub attrs: Vec<ast::Attribute>,
+    pub vis: ast::Visibility,
+    pub id: ast::NodeId,
+    pub where: Span,
 }
 
 pub struct Trait {
-    name: Ident,
-    methods: Vec<ast::TraitMethod> , //should be TraitMethod
-    generics: ast::Generics,
-    parents: Vec<ast::TraitRef> ,
-    attrs: Vec<ast::Attribute> ,
-    id: ast::NodeId,
-    where: Span,
-    vis: ast::Visibility,
+    pub name: Ident,
+    pub methods: Vec<ast::TraitMethod>, //should be TraitMethod
+    pub generics: ast::Generics,
+    pub parents: Vec<ast::TraitRef>,
+    pub attrs: Vec<ast::Attribute>,
+    pub id: ast::NodeId,
+    pub where: Span,
+    pub vis: ast::Visibility,
 }
 
 pub struct Impl {
-    generics: ast::Generics,
-    trait_: Option<ast::TraitRef>,
-    for_: ast::P<ast::Ty>,
-    methods: Vec<@ast::Method> ,
-    attrs: Vec<ast::Attribute> ,
-    where: Span,
-    vis: ast::Visibility,
-    id: ast::NodeId,
+    pub generics: ast::Generics,
+    pub trait_: Option<ast::TraitRef>,
+    pub for_: ast::P<ast::Ty>,
+    pub methods: Vec<@ast::Method>,
+    pub attrs: Vec<ast::Attribute>,
+    pub where: Span,
+    pub vis: ast::Visibility,
+    pub id: ast::NodeId,
 }
 
 pub struct Macro {
-    name: Ident,
-    id: ast::NodeId,
-    attrs: Vec<ast::Attribute> ,
-    where: Span,
+    pub name: Ident,
+    pub id: ast::NodeId,
+    pub attrs: Vec<ast::Attribute>,
+    pub where: Span,
 }
 
 pub fn struct_type_from_def(sd: &ast::StructDef) -> StructType {
diff --git a/src/librustdoc/flock.rs b/src/librustdoc/flock.rs
index c1e5d66b1d2..9030caed6cd 100644
--- a/src/librustdoc/flock.rs
+++ b/src/librustdoc/flock.rs
@@ -14,7 +14,7 @@
 //! green/native threading. This is just a bare-bones enough solution for
 //! librustdoc, it is not production quality at all.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 pub use self::imp::Lock;
 
@@ -27,14 +27,14 @@ mod imp {
         use std::libc;
 
         pub struct flock {
-            l_type: libc::c_short,
-            l_whence: libc::c_short,
-            l_start: libc::off_t,
-            l_len: libc::off_t,
-            l_pid: libc::pid_t,
+            pub l_type: libc::c_short,
+            pub l_whence: libc::c_short,
+            pub l_start: libc::off_t,
+            pub l_len: libc::off_t,
+            pub l_pid: libc::pid_t,
 
             // not actually here, but brings in line with freebsd
-            l_sysid: libc::c_int,
+            pub l_sysid: libc::c_int,
         }
 
         pub static F_WRLCK: libc::c_short = 1;
@@ -48,12 +48,12 @@ mod imp {
         use std::libc;
 
         pub struct flock {
-            l_start: libc::off_t,
-            l_len: libc::off_t,
-            l_pid: libc::pid_t,
-            l_type: libc::c_short,
-            l_whence: libc::c_short,
-            l_sysid: libc::c_int,
+            pub l_start: libc::off_t,
+            pub l_len: libc::off_t,
+            pub l_pid: libc::pid_t,
+            pub l_type: libc::c_short,
+            pub l_whence: libc::c_short,
+            pub l_sysid: libc::c_int,
         }
 
         pub static F_UNLCK: libc::c_short = 2;
@@ -67,14 +67,14 @@ mod imp {
         use std::libc;
 
         pub struct flock {
-            l_start: libc::off_t,
-            l_len: libc::off_t,
-            l_pid: libc::pid_t,
-            l_type: libc::c_short,
-            l_whence: libc::c_short,
+            pub l_start: libc::off_t,
+            pub l_len: libc::off_t,
+            pub l_pid: libc::pid_t,
+            pub l_type: libc::c_short,
+            pub l_whence: libc::c_short,
 
             // not actually here, but brings in line with freebsd
-            l_sysid: libc::c_int,
+            pub l_sysid: libc::c_int,
         }
 
         pub static F_UNLCK: libc::c_short = 2;
@@ -84,7 +84,7 @@ mod imp {
     }
 
     pub struct Lock {
-        priv fd: libc::c_int,
+        fd: libc::c_int,
     }
 
     impl Lock {
@@ -155,7 +155,7 @@ mod imp {
     }
 
     pub struct Lock {
-        priv handle: libc::HANDLE,
+        handle: libc::HANDLE,
     }
 
     impl Lock {
diff --git a/src/librustdoc/html/escape.rs b/src/librustdoc/html/escape.rs
index bb6b1eeaedd..60fcbe33a1b 100644
--- a/src/librustdoc/html/escape.rs
+++ b/src/librustdoc/html/escape.rs
@@ -17,7 +17,7 @@ use std::fmt;
 
 /// Wrapper struct which will emit the HTML-escaped version of the contained
 /// string when passed to a format string.
-pub struct Escape<'a>(&'a str);
+pub struct Escape<'a>(pub &'a str);
 
 impl<'a> fmt::Show for Escape<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index acf6446a191..10c155262c3 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -28,12 +28,12 @@ use html::render::{cache_key, current_location_key};
 
 /// Helper to render an optional visibility with a space after it (if the
 /// visibility is preset)
-pub struct VisSpace(Option<ast::Visibility>);
+pub struct VisSpace(pub Option<ast::Visibility>);
 /// Similarly to VisSpace, this structure is used to render a purity with a
 /// space after it.
-pub struct PuritySpace(ast::Purity);
+pub struct PuritySpace(pub ast::Purity);
 /// Wrapper struct for properly emitting a method declaration.
-pub struct Method<'a>(&'a clean::SelfTy, &'a clean::FnDecl);
+pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl);
 
 impl VisSpace {
     pub fn get(&self) -> Option<ast::Visibility> {
diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs
index d67c7ea6505..58fc92bf345 100644
--- a/src/librustdoc/html/highlight.rs
+++ b/src/librustdoc/html/highlight.rs
@@ -44,7 +44,7 @@ pub fn highlight(src: &str, class: Option<&str>) -> ~str {
 /// it's used. All source code emission is done as slices from the source map,
 /// not from the tokens themselves, in order to stay true to the original
 /// source.
-fn doit(sess: &parse::ParseSess, lexer: lexer::StringReader, class: Option<&str>,
+fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader, class: Option<&str>,
         out: &mut Writer) -> io::IoResult<()> {
     use syntax::parse::lexer::Reader;
 
@@ -55,7 +55,7 @@ fn doit(sess: &parse::ParseSess, lexer: lexer::StringReader, class: Option<&str>
     let mut is_macro_nonterminal = false;
     loop {
         let next = lexer.next_token();
-        let test = if next.tok == t::EOF {lexer.pos.get()} else {next.sp.lo};
+        let test = if next.tok == t::EOF {lexer.pos} else {next.sp.lo};
 
         // The lexer consumes all whitespace and non-doc-comments when iterating
         // between tokens. If this token isn't directly adjacent to our last
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index 095f27d25b3..399dcf6991c 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -13,15 +13,15 @@ use std::io;
 
 #[deriving(Clone)]
 pub struct Layout {
-    logo: ~str,
-    favicon: ~str,
-    krate: ~str,
+    pub logo: ~str,
+    pub favicon: ~str,
+    pub krate: ~str,
 }
 
 pub struct Page<'a> {
-    title: &'a str,
-    ty: &'a str,
-    root_path: &'a str,
+    pub title: &'a str,
+    pub ty: &'a str,
+    pub root_path: &'a str,
 }
 
 pub fn render<T: fmt::Show, S: fmt::Show>(
@@ -39,7 +39,7 @@ r##"<!DOCTYPE html>
           rel='stylesheet' type='text/css'>
     <link rel="stylesheet" type="text/css" href="{root_path}main.css">
 
-    {favicon, select, none{} other{<link rel="shortcut icon" href="\#" />}}
+    {favicon, select, none{} other{<link rel="shortcut icon" href="#" />}}
 </head>
 <body>
     <!--[if lte IE 8]>
@@ -51,7 +51,7 @@ r##"<!DOCTYPE html>
 
     <section class="sidebar">
         {logo, select, none{} other{
-            <a href='{root_path}{krate}/index.html'><img src='\#' alt=''/></a>
+            <a href='{root_path}{krate}/index.html'><img src='#' alt=''/></a>
         }}
 
         {sidebar}
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index b162d9d4b78..e6fb5629eaf 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -24,7 +24,7 @@
 //! // ... something using html
 //! ```
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use std::cast;
 use std::fmt;
@@ -42,10 +42,10 @@ use html::highlight;
 /// A unit struct which has the `fmt::Show` trait implemented. When
 /// formatted, this struct will emit the HTML corresponding to the rendered
 /// version of the contained markdown string.
-pub struct Markdown<'a>(&'a str);
+pub struct Markdown<'a>(pub &'a str);
 /// A unit struct like `Markdown`, that renders the markdown with a
 /// table of contents.
-pub struct MarkdownWithToc<'a>(&'a str);
+pub struct MarkdownWithToc<'a>(pub &'a str);
 
 static OUTPUT_UNIT: libc::size_t = 64;
 static MKDEXT_NO_INTRA_EMPHASIS: libc::c_uint = 1 << 0;
@@ -268,24 +268,25 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
     extern fn block(_ob: *buf, text: *buf, lang: *buf, opaque: *libc::c_void) {
         unsafe {
             if text.is_null() { return }
-            let (should_fail, no_run, ignore) = if lang.is_null() {
-                (false, false, false)
+            let (should_fail, no_run, ignore, notrust) = if lang.is_null() {
+                (false, false, false, false)
             } else {
                 slice::raw::buf_as_slice((*lang).data,
                                        (*lang).size as uint, |lang| {
                     let s = str::from_utf8(lang).unwrap();
                     (s.contains("should_fail"),
                      s.contains("no_run"),
-                     s.contains("ignore") || s.contains("notrust"))
+                     s.contains("ignore"),
+                     s.contains("notrust"))
                 })
             };
-            if ignore { return }
+            if notrust { return }
             slice::raw::buf_as_slice((*text).data, (*text).size as uint, |text| {
                 let tests = &mut *(opaque as *mut ::test::Collector);
                 let text = str::from_utf8(text).unwrap();
                 let mut lines = text.lines().map(|l| stripped_filtered_line(l).unwrap_or(l));
                 let text = lines.collect::<~[&str]>().connect("\n");
-                tests.add_test(text, should_fail, no_run);
+                tests.add_test(text, should_fail, no_run, ignore);
             })
         }
     }
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 3629692e5b0..94b0b21dc9e 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -68,26 +68,26 @@ use html::highlight;
 pub struct Context {
     /// Current hierarchy of components leading down to what's currently being
     /// rendered
-    current: Vec<~str> ,
+    pub current: Vec<~str> ,
     /// String representation of how to get back to the root path of the 'doc/'
     /// folder in terms of a relative URL.
-    root_path: ~str,
+    pub root_path: ~str,
     /// The current destination folder of where HTML artifacts should be placed.
     /// This changes as the context descends into the module hierarchy.
-    dst: Path,
+    pub dst: Path,
     /// This describes the layout of each page, and is not modified after
     /// creation of the context (contains info like the favicon)
-    layout: layout::Layout,
+    pub layout: layout::Layout,
     /// This map is a list of what should be displayed on the sidebar of the
     /// current page. The key is the section header (traits, modules,
     /// functions), and the value is the list of containers belonging to this
     /// header. This map will change depending on the surrounding context of the
     /// page.
-    sidebar: HashMap<~str, Vec<~str> >,
+    pub sidebar: HashMap<~str, Vec<~str> >,
     /// This flag indicates whether [src] links should be generated or not. If
     /// the source files are present in the html rendering, then this will be
     /// `true`.
-    include_sources: bool,
+    pub include_sources: bool,
 }
 
 /// Indicates where an external crate can be found.
@@ -122,7 +122,7 @@ pub struct Cache {
     /// Mapping of typaram ids to the name of the type parameter. This is used
     /// when pretty-printing a type (so pretty printing doesn't have to
     /// painfully maintain a context like this)
-    typarams: HashMap<ast::NodeId, ~str>,
+    pub typarams: HashMap<ast::NodeId, ~str>,
 
     /// Maps a type id to all known implementations for that type. This is only
     /// recognized for intra-crate `ResolvedPath` types, and is used to print
@@ -130,43 +130,43 @@ pub struct Cache {
     ///
     /// The values of the map are a list of implementations and documentation
     /// found on that implementation.
-    impls: HashMap<ast::NodeId, Vec<(clean::Impl, Option<~str>)> >,
+    pub impls: HashMap<ast::NodeId, Vec<(clean::Impl, Option<~str>)> >,
 
     /// Maintains a mapping of local crate node ids to the fully qualified name
     /// and "short type description" of that node. This is used when generating
     /// URLs when a type is being linked to. External paths are not located in
     /// this map because the `External` type itself has all the information
     /// necessary.
-    paths: HashMap<ast::NodeId, (Vec<~str> , &'static str)>,
+    pub paths: HashMap<ast::NodeId, (Vec<~str> , &'static str)>,
 
     /// This map contains information about all known traits of this crate.
     /// Implementations of a crate should inherit the documentation of the
     /// parent trait if no extra documentation is specified, and default methods
     /// should show up in documentation about trait implementations.
-    traits: HashMap<ast::NodeId, clean::Trait>,
+    pub traits: HashMap<ast::NodeId, clean::Trait>,
 
     /// When rendering traits, it's often useful to be able to list all
     /// implementors of the trait, and this mapping is exactly, that: a mapping
     /// of trait ids to the list of known implementors of the trait
-    implementors: HashMap<ast::NodeId, Vec<Implementor> >,
+    pub implementors: HashMap<ast::NodeId, Vec<Implementor> >,
 
     /// Cache of where external crate documentation can be found.
-    extern_locations: HashMap<ast::CrateNum, ExternalLocation>,
+    pub extern_locations: HashMap<ast::CrateNum, ExternalLocation>,
 
     // Private fields only used when initially crawling a crate to build a cache
 
-    priv stack: Vec<~str> ,
-    priv parent_stack: Vec<ast::NodeId> ,
-    priv search_index: Vec<IndexItem> ,
-    priv privmod: bool,
-    priv public_items: NodeSet,
+    stack: Vec<~str> ,
+    parent_stack: Vec<ast::NodeId> ,
+    search_index: Vec<IndexItem> ,
+    privmod: bool,
+    public_items: NodeSet,
 
     // In rare case where a structure is defined in one module but implemented
     // in another, if the implementing module is parsed before defining module,
     // then the fully qualified name of the structure isn't presented in `paths`
     // yet when its implementation methods are being indexed. Caches such methods
     // and their parent id here and indexes them at the end of crate parsing.
-    priv orphan_methods: Vec<(ast::NodeId, clean::Item)>,
+    orphan_methods: Vec<(ast::NodeId, clean::Item)>,
 }
 
 /// Helper struct to render all source code to HTML pages
diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs
index f8d91fffb1f..afb7f559a80 100644
--- a/src/librustdoc/html/toc.rs
+++ b/src/librustdoc/html/toc.rs
@@ -26,7 +26,7 @@ pub struct Toc {
     /// # Main
     /// ### A
     /// ## B
-    priv entries: Vec<TocEntry>
+    entries: Vec<TocEntry>
 }
 
 impl Toc {
@@ -37,17 +37,17 @@ impl Toc {
 
 #[deriving(Eq)]
 pub struct TocEntry {
-    priv level: u32,
-    priv sec_number: ~str,
-    priv name: ~str,
-    priv id: ~str,
-    priv children: Toc,
+    level: u32,
+    sec_number: ~str,
+    name: ~str,
+    id: ~str,
+    children: Toc,
 }
 
 /// Progressive construction of a table of contents.
 #[deriving(Eq)]
 pub struct TocBuilder {
-    priv top_level: Toc,
+    top_level: Toc,
     /// The current heirachy of parent headings, the levels are
     /// strictly increasing (i.e. chain[0].level < chain[1].level <
     /// ...) with each entry being the most recent occurance of a
@@ -56,7 +56,7 @@ pub struct TocBuilder {
     /// the most recent one).
     ///
     /// We also have `chain[0].level <= top_level.entries[last]`.
-    priv chain: Vec<TocEntry>
+    chain: Vec<TocEntry>
 }
 
 impl TocBuilder {
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 6fcd1f83cf4..5e53632dbba 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[crate_id = "rustdoc#0.10-pre"];
-#[desc = "rustdoc, the Rust documentation extractor"];
-#[license = "MIT/ASL2"];
-#[crate_type = "dylib"];
-#[crate_type = "rlib"];
+#![crate_id = "rustdoc#0.11-pre"]
+#![desc = "rustdoc, the Rust documentation extractor"]
+#![license = "MIT/ASL2"]
+#![crate_type = "dylib"]
+#![crate_type = "rlib"]
 
-#[feature(globs, struct_variant, managed_boxes, macro_rules, phase)];
+#![feature(globs, struct_variant, managed_boxes, macro_rules, phase)]
 
 extern crate syntax;
 extern crate rustc;
@@ -168,6 +168,7 @@ pub fn main_args(args: &[~str]) -> int {
     let markdown_input = input.ends_with(".md") || input.ends_with(".markdown");
 
     let output = matches.opt_str("o").map(|s| Path::new(s));
+    let cfgs = matches.opt_strs("cfg");
 
     match (should_test, markdown_input) {
         (true, true) => {
@@ -175,7 +176,8 @@ pub fn main_args(args: &[~str]) -> int {
                                   libs,
                                   test_args.move_iter().collect())
         }
-        (true, false) => return test::run(input, libs, test_args),
+        (true, false) => return test::run(input, cfgs.move_iter().collect(),
+                                          libs, test_args),
 
         (false, true) => return markdown::render(input, output.unwrap_or(Path::new("doc")),
                                                  &matches),
@@ -352,7 +354,7 @@ fn json_input(input: &str) -> Result<Output, ~str> {
             let krate = match obj.pop(&~"crate") {
                 Some(json) => {
                     let mut d = json::Decoder::new(json);
-                    Decodable::decode(&mut d)
+                    Decodable::decode(&mut d).unwrap()
                 }
                 None => return Err(~"malformed json"),
             };
@@ -384,7 +386,7 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
         let mut w = MemWriter::new();
         {
             let mut encoder = json::Encoder::new(&mut w as &mut io::Writer);
-            krate.encode(&mut encoder);
+            krate.encode(&mut encoder).unwrap();
         }
         str::from_utf8_owned(w.unwrap()).unwrap()
     };
diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs
index d9dd73e6956..a08776946bc 100644
--- a/src/librustdoc/passes.rs
+++ b/src/librustdoc/passes.rs
@@ -128,8 +128,7 @@ impl<'a> fold::DocFolder for Stripper<'a> {
                 }
             }
 
-            clean::ViewItemItem(..) |
-            clean::ModuleItem(..) => {
+            clean::ViewItemItem(..) => {
                 if i.visibility != Some(ast::Public) {
                     return None
                 }
@@ -141,6 +140,9 @@ impl<'a> fold::DocFolder for Stripper<'a> {
                 }
             }
 
+            // handled below
+            clean::ModuleItem(..) => {}
+
             // trait impls for private items should be stripped
             clean::ImplItem(clean::Impl{ for_: clean::ResolvedPath{ id: ref for_id, .. }, .. }) => {
                 if !self.exported_items.contains(for_id) {
@@ -312,14 +314,14 @@ pub fn unindent(s: &str) -> ~str {
 
     if lines.len() >= 1 {
         let mut unindented = vec!( lines.get(0).trim() );
-        unindented.push_all(lines.tail().map(|&line| {
+        unindented.push_all(lines.tail().iter().map(|&line| {
             if line.is_whitespace() {
                 line
             } else {
                 assert!(line.len() >= min_indent);
                 line.slice_from(min_indent)
             }
-        }));
+        }).collect::<Vec<_>>().as_slice());
         unindented.connect("\n")
     } else {
         s.to_owned()
diff --git a/src/librustdoc/plugins.rs b/src/librustdoc/plugins.rs
index 6e0e9f87900..f3a82fead5a 100644
--- a/src/librustdoc/plugins.rs
+++ b/src/librustdoc/plugins.rs
@@ -19,10 +19,10 @@ pub type PluginCallback = fn (clean::Crate) -> PluginResult;
 
 /// Manages loading and running of plugins
 pub struct PluginManager {
-    priv dylibs: Vec<dl::DynamicLibrary> ,
-    priv callbacks: Vec<PluginCallback> ,
+    dylibs: Vec<dl::DynamicLibrary> ,
+    callbacks: Vec<PluginCallback> ,
     /// The directory plugins will be loaded from
-    prefix: Path,
+    pub prefix: Path,
 }
 
 impl PluginManager {
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 09a1b1fc81a..3ede325997d 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -22,8 +22,10 @@ use rustc::back::link;
 use rustc::driver::driver;
 use rustc::driver::session;
 use rustc::metadata::creader::Loader;
+use syntax::ast;
+use syntax::codemap::{CodeMap, dummy_spanned};
 use syntax::diagnostic;
-use syntax::codemap::CodeMap;
+use syntax::parse::token;
 
 use core;
 use clean;
@@ -33,7 +35,8 @@ use html::markdown;
 use passes;
 use visit_ast::RustdocVisitor;
 
-pub fn run(input: &str, libs: HashSet<Path>, mut test_args: Vec<~str>) -> int {
+pub fn run(input: &str, cfgs: Vec<~str>,
+           libs: HashSet<Path>, mut test_args: Vec<~str>) -> int {
     let input_path = Path::new(input);
     let input = driver::FileInput(input_path.clone());
 
@@ -54,7 +57,11 @@ pub fn run(input: &str, libs: HashSet<Path>, mut test_args: Vec<~str>) -> int {
                                       Some(input_path),
                                       span_diagnostic_handler);
 
-    let cfg = driver::build_configuration(&sess);
+    let mut cfg = driver::build_configuration(&sess);
+    cfg.extend(cfgs.move_iter().map(|cfg_| {
+        let cfg_ = token::intern_and_get_ident(cfg_);
+        @dummy_spanned(ast::MetaWord(cfg_))
+    }));
     let krate = driver::phase_1_parse_input(&sess, cfg, &input);
     let (krate, _) = driver::phase_2_configure_and_expand(&sess, &mut Loader::new(&sess), krate,
                                                           &from_str("rustdoc-test").unwrap());
@@ -118,7 +125,7 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool,
     let old = io::stdio::set_stderr(~w1);
     spawn(proc() {
         let mut p = io::ChanReader::new(rx);
-        let mut err = old.unwrap_or(~io::stderr() as ~Writer);
+        let mut err = old.unwrap_or(~io::stderr() as ~Writer:Send);
         io::util::copy(&mut p, &mut err).unwrap();
     });
     let emitter = diagnostic::EmitterWriter::new(~w2);
@@ -160,17 +167,14 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool,
 
 fn maketest(s: &str, cratename: &str, loose_feature_gating: bool) -> ~str {
     let mut prog = ~r"
-#[deny(warnings)];
-#[allow(unused_variable, dead_assignment, unused_mut, attribute_usage, dead_code)];
-
-// FIXME: remove when ~[] disappears from tests.
-#[allow(deprecated_owned_vector)];
+#![deny(warnings)]
+#![allow(unused_variable, dead_assignment, unused_mut, attribute_usage, dead_code)]
 ";
 
     if loose_feature_gating {
         // FIXME #12773: avoid inserting these when the tutorial & manual
         // etc. have been updated to not use them so prolifically.
-        prog.push_str("#[ feature(macro_rules, globs, struct_variant, managed_boxes) ];\n");
+        prog.push_str("#![feature(macro_rules, globs, struct_variant, managed_boxes) ]\n");
     }
 
     if !s.contains("extern crate") {
@@ -190,15 +194,15 @@ fn maketest(s: &str, cratename: &str, loose_feature_gating: bool) -> ~str {
 }
 
 pub struct Collector {
-    tests: Vec<testing::TestDescAndFn>,
-    priv names: Vec<~str>,
-    priv libs: HashSet<Path>,
-    priv cnt: uint,
-    priv use_headers: bool,
-    priv current_header: Option<~str>,
-    priv cratename: ~str,
-
-    priv loose_feature_gating: bool
+    pub tests: Vec<testing::TestDescAndFn>,
+    names: Vec<~str>,
+    libs: HashSet<Path>,
+    cnt: uint,
+    use_headers: bool,
+    current_header: Option<~str>,
+    cratename: ~str,
+
+    loose_feature_gating: bool
 }
 
 impl Collector {
@@ -217,7 +221,7 @@ impl Collector {
         }
     }
 
-    pub fn add_test(&mut self, test: ~str, should_fail: bool, no_run: bool) {
+    pub fn add_test(&mut self, test: ~str, should_fail: bool, no_run: bool, should_ignore: bool) {
         let name = if self.use_headers {
             let s = self.current_header.as_ref().map(|s| s.as_slice()).unwrap_or("");
             format!("{}_{}", s, self.cnt)
@@ -232,7 +236,7 @@ impl Collector {
         self.tests.push(testing::TestDescAndFn {
             desc: testing::TestDesc {
                 name: testing::DynTestName(name),
-                ignore: false,
+                ignore: should_ignore,
                 should_fail: false, // compiler failures are test failures
             },
             testfn: testing::DynTestFn(proc() {
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index 8be3535b3ec..a6c1ece6400 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -11,7 +11,7 @@
 //! Rust AST Visitor. Extracts useful information and massages it into a form
 //! usable for clean
 
-use syntax::abi::AbiSet;
+use syntax::abi;
 use syntax::ast;
 use syntax::ast_util;
 use syntax::ast_map;
@@ -21,10 +21,10 @@ use core;
 use doctree::*;
 
 pub struct RustdocVisitor<'a> {
-    module: Module,
-    attrs: Vec<ast::Attribute> ,
-    cx: &'a core::DocContext,
-    analysis: Option<&'a core::CrateAnalysis>,
+    pub module: Module,
+    pub attrs: Vec<ast::Attribute>,
+    pub cx: &'a core::DocContext,
+    pub analysis: Option<&'a core::CrateAnalysis>,
 }
 
 impl<'a> RustdocVisitor<'a> {
@@ -95,7 +95,7 @@ impl<'a> RustdocVisitor<'a> {
     }
 
     pub fn visit_fn(&mut self, item: &ast::Item, fd: &ast::FnDecl,
-                    purity: &ast::Purity, _abi: &AbiSet,
+                    purity: &ast::Purity, _abi: &abi::Abi,
                     gen: &ast::Generics) -> Function {
         debug!("Visiting fn");
         Function {
diff --git a/src/librustuv/access.rs b/src/librustuv/access.rs
index 9d06593a6ea..0d2550d4ebd 100644
--- a/src/librustuv/access.rs
+++ b/src/librustuv/access.rs
@@ -22,12 +22,12 @@ use std::rt::local::Local;
 use homing::HomingMissile;
 
 pub struct Access {
-    priv inner: UnsafeArc<Inner>,
+    inner: UnsafeArc<Inner>,
 }
 
 pub struct Guard<'a> {
-    priv access: &'a mut Access,
-    priv missile: Option<HomingMissile>,
+    access: &'a mut Access,
+    missile: Option<HomingMissile>,
 }
 
 struct Inner {
diff --git a/src/librustuv/async.rs b/src/librustuv/async.rs
index bda859afc0b..5caccb348cc 100644
--- a/src/librustuv/async.rs
+++ b/src/librustuv/async.rs
@@ -27,12 +27,12 @@ pub struct AsyncWatcher {
 }
 
 struct Payload {
-    callback: ~Callback,
+    callback: ~Callback:Send,
     exit_flag: Exclusive<bool>,
 }
 
 impl AsyncWatcher {
-    pub fn new(loop_: &mut Loop, cb: ~Callback) -> AsyncWatcher {
+    pub fn new(loop_: &mut Loop, cb: ~Callback:Send) -> AsyncWatcher {
         let handle = UvHandle::alloc(None::<AsyncWatcher>, uvll::UV_ASYNC);
         assert_eq!(unsafe {
             uvll::uv_async_init(loop_.handle, handle, async_cb)
@@ -149,8 +149,7 @@ mod test_remote {
 
         let (tx, rx) = channel();
         let cb = ~MyCallback(Some(tx));
-        let watcher = AsyncWatcher::new(&mut local_loop().loop_,
-                                        cb as ~Callback);
+        let watcher = AsyncWatcher::new(&mut local_loop().loop_, cb);
 
         let thread = Thread::start(proc() {
             let mut watcher = watcher;
diff --git a/src/librustuv/file.rs b/src/librustuv/file.rs
index d5235a9fe56..93cc1d8d54f 100644
--- a/src/librustuv/file.rs
+++ b/src/librustuv/file.rs
@@ -26,14 +26,14 @@ use uvll;
 
 pub struct FsRequest {
     req: *uvll::uv_fs_t,
-    priv fired: bool,
+    fired: bool,
 }
 
 pub struct FileWatcher {
-    priv loop_: Loop,
-    priv fd: c_int,
-    priv close: rtio::CloseBehavior,
-    priv home: HomeHandle,
+    loop_: Loop,
+    fd: c_int,
+    close: rtio::CloseBehavior,
+    home: HomeHandle,
 }
 
 impl FsRequest {
diff --git a/src/librustuv/homing.rs b/src/librustuv/homing.rs
index 3ece7662dd5..89b68917c94 100644
--- a/src/librustuv/homing.rs
+++ b/src/librustuv/homing.rs
@@ -31,7 +31,7 @@
 //! This enqueueing is done with a concurrent queue from libstd, and the
 //! signalling is achieved with an async handle.
 
-#[allow(dead_code)];
+#![allow(dead_code)]
 
 use std::cast;
 use std::rt::local::Local;
@@ -48,8 +48,8 @@ use queue::{Queue, QueuePool};
 /// Handles are clone-able in order to derive new handles from existing handles
 /// (very useful for when accepting a socket from a server).
 pub struct HomeHandle {
-    priv queue: Queue,
-    priv id: uint,
+    queue: Queue,
+    id: uint,
 }
 
 impl HomeHandle {
@@ -126,7 +126,7 @@ pub trait HomingIO {
 /// task back to its appropriate home (if applicable). The field is used to
 /// assert that we are where we think we are.
 pub struct HomingMissile {
-    priv io_home: uint,
+    io_home: uint,
 }
 
 impl HomingMissile {
diff --git a/src/librustuv/idle.rs b/src/librustuv/idle.rs
index 1f059ca9fb9..bbfacf87096 100644
--- a/src/librustuv/idle.rs
+++ b/src/librustuv/idle.rs
@@ -19,11 +19,11 @@ pub struct IdleWatcher {
     handle: *uvll::uv_idle_t,
     idle_flag: bool,
     closed: bool,
-    callback: ~Callback,
+    callback: ~Callback:Send,
 }
 
 impl IdleWatcher {
-    pub fn new(loop_: &mut Loop, cb: ~Callback) -> ~IdleWatcher {
+    pub fn new(loop_: &mut Loop, cb: ~Callback:Send) -> ~IdleWatcher {
         let handle = UvHandle::alloc(None::<IdleWatcher>, uvll::UV_IDLE);
         assert_eq!(unsafe {
             uvll::uv_idle_init(loop_.handle, handle)
diff --git a/src/librustuv/lib.rs b/src/librustuv/lib.rs
index cf1d95588bb..22cb8292637 100644
--- a/src/librustuv/lib.rs
+++ b/src/librustuv/lib.rs
@@ -34,14 +34,14 @@ via `close` and `delete` methods.
 
 */
 
-#[crate_id = "rustuv#0.10-pre"];
-#[license = "MIT/ASL2"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
+#![crate_id = "rustuv#0.11-pre"]
+#![license = "MIT/ASL2"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
 
-#[feature(macro_rules)];
-#[deny(unused_result, unused_must_use)];
-#[allow(visible_private_types)];
+#![feature(macro_rules)]
+#![deny(unused_result, unused_must_use)]
+#![allow(visible_private_types)]
 
 #[cfg(test)] extern crate green;
 #[cfg(test)] extern crate realrustuv = "rustuv";
@@ -126,8 +126,8 @@ pub mod stream;
 ///     // this code is running inside of a green task powered by libuv
 /// }
 /// ```
-pub fn event_loop() -> ~rtio::EventLoop {
-    ~uvio::UvEventLoop::new() as ~rtio::EventLoop
+pub fn event_loop() -> ~rtio::EventLoop:Send {
+    ~uvio::UvEventLoop::new() as ~rtio::EventLoop:Send
 }
 
 /// A type that wraps a uv handle
@@ -197,8 +197,8 @@ pub trait UvHandle<T> {
 }
 
 pub struct ForbidSwitch {
-    priv msg: &'static str,
-    priv io: uint,
+    msg: &'static str,
+    io: uint,
 }
 
 impl ForbidSwitch {
@@ -261,8 +261,8 @@ fn wakeup(slot: &mut Option<BlockedTask>) {
 }
 
 pub struct Request {
-    handle: *uvll::uv_req_t,
-    priv defused: bool,
+    pub handle: *uvll::uv_req_t,
+    defused: bool,
 }
 
 impl Request {
@@ -313,7 +313,7 @@ impl Drop for Request {
 /// with dtors may not be destructured, but tuple structs can,
 /// but the results are not correct.
 pub struct Loop {
-    priv handle: *uvll::uv_loop_t
+    handle: *uvll::uv_loop_t
 }
 
 impl Loop {
diff --git a/src/librustuv/macros.rs b/src/librustuv/macros.rs
index 75b68e3a528..a51b842f139 100644
--- a/src/librustuv/macros.rs
+++ b/src/librustuv/macros.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[macro_escape];
+#![macro_escape]
 
 use std::fmt;
 
diff --git a/src/librustuv/net.rs b/src/librustuv/net.rs
index 08d66e72703..a6d1e1a6efd 100644
--- a/src/librustuv/net.rs
+++ b/src/librustuv/net.rs
@@ -153,22 +153,22 @@ pub struct TcpWatcher {
     handle: *uvll::uv_tcp_t,
     stream: StreamWatcher,
     home: HomeHandle,
-    priv refcount: Refcount,
+    refcount: Refcount,
 
     // libuv can't support concurrent reads and concurrent writes of the same
     // stream object, so we use these access guards in order to arbitrate among
     // multiple concurrent reads and writes. Note that libuv *can* read and
     // write simultaneously, it just can't read and read simultaneously.
-    priv read_access: Access,
-    priv write_access: Access,
+    read_access: Access,
+    write_access: Access,
 }
 
 pub struct TcpListener {
     home: HomeHandle,
     handle: *uvll::uv_pipe_t,
-    priv closing_task: Option<BlockedTask>,
-    priv outgoing: Sender<Result<~rtio::RtioTcpStream, IoError>>,
-    priv incoming: Receiver<Result<~rtio::RtioTcpStream, IoError>>,
+    closing_task: Option<BlockedTask>,
+    outgoing: Sender<Result<~rtio::RtioTcpStream:Send, IoError>>,
+    incoming: Receiver<Result<~rtio::RtioTcpStream:Send, IoError>>,
 }
 
 pub struct TcpAcceptor {
@@ -295,7 +295,7 @@ impl rtio::RtioTcpStream for TcpWatcher {
         })
     }
 
-    fn clone(&self) -> ~rtio::RtioTcpStream {
+    fn clone(&self) -> ~rtio::RtioTcpStream:Send {
         ~TcpWatcher {
             handle: self.handle,
             stream: StreamWatcher::new(self.handle),
@@ -303,7 +303,7 @@ impl rtio::RtioTcpStream for TcpWatcher {
             refcount: self.refcount.clone(),
             write_access: self.write_access.clone(),
             read_access: self.read_access.clone(),
-        } as ~rtio::RtioTcpStream
+        } as ~rtio::RtioTcpStream:Send
     }
 
     fn close_write(&mut self) -> Result<(), IoError> {
@@ -397,14 +397,14 @@ impl rtio::RtioSocket for TcpListener {
 }
 
 impl rtio::RtioTcpListener for TcpListener {
-    fn listen(~self) -> Result<~rtio::RtioTcpAcceptor, IoError> {
+    fn listen(~self) -> Result<~rtio::RtioTcpAcceptor:Send, IoError> {
         // create the acceptor object from ourselves
         let mut acceptor = ~TcpAcceptor { listener: self };
 
         let _m = acceptor.fire_homing_missile();
         // FIXME: the 128 backlog should be configurable
         match unsafe { uvll::uv_listen(acceptor.listener.handle, 128, listen_cb) } {
-            0 => Ok(acceptor as ~rtio::RtioTcpAcceptor),
+            0 => Ok(acceptor as ~rtio::RtioTcpAcceptor:Send),
             n => Err(uv_error_to_io_error(UvError(n))),
         }
     }
@@ -420,7 +420,7 @@ extern fn listen_cb(server: *uvll::uv_stream_t, status: c_int) {
             });
             let client = TcpWatcher::new_home(&loop_, tcp.home().clone());
             assert_eq!(unsafe { uvll::uv_accept(server, client.handle) }, 0);
-            Ok(~client as ~rtio::RtioTcpStream)
+            Ok(~client as ~rtio::RtioTcpStream:Send)
         }
         n => Err(uv_error_to_io_error(UvError(n)))
     };
@@ -448,7 +448,7 @@ impl rtio::RtioSocket for TcpAcceptor {
 }
 
 impl rtio::RtioTcpAcceptor for TcpAcceptor {
-    fn accept(&mut self) -> Result<~rtio::RtioTcpStream, IoError> {
+    fn accept(&mut self) -> Result<~rtio::RtioTcpStream:Send, IoError> {
         self.listener.incoming.recv()
     }
 
@@ -476,9 +476,9 @@ pub struct UdpWatcher {
     home: HomeHandle,
 
     // See above for what these fields are
-    priv refcount: Refcount,
-    priv read_access: Access,
-    priv write_access: Access,
+    refcount: Refcount,
+    read_access: Access,
+    write_access: Access,
 }
 
 impl UdpWatcher {
@@ -709,14 +709,14 @@ impl rtio::RtioUdpSocket for UdpWatcher {
         })
     }
 
-    fn clone(&self) -> ~rtio::RtioUdpSocket {
+    fn clone(&self) -> ~rtio::RtioUdpSocket:Send {
         ~UdpWatcher {
             handle: self.handle,
             home: self.home.clone(),
             refcount: self.refcount.clone(),
             write_access: self.write_access.clone(),
             read_access: self.read_access.clone(),
-        } as ~rtio::RtioUdpSocket
+        } as ~rtio::RtioUdpSocket:Send
     }
 }
 
@@ -791,7 +791,7 @@ mod test {
                         Ok(10) => {} e => fail!("{:?}", e),
                     }
                     for i in range(0, 10u8) {
-                        assert_eq!(buf[i], i + 1);
+                        assert_eq!(buf[i as uint], i + 1);
                     }
                 }
                 Err(e) => fail!("{:?}", e)
@@ -827,7 +827,7 @@ mod test {
                         Ok(10) => {} e => fail!("{:?}", e),
                     }
                     for i in range(0, 10u8) {
-                        assert_eq!(buf[i], i + 1);
+                        assert_eq!(buf[i as uint], i + 1);
                     }
                 }
                 Err(e) => fail!("{:?}", e)
@@ -859,7 +859,7 @@ mod test {
                         e => fail!("{:?}", e),
                     }
                     for i in range(0, 10u8) {
-                        assert_eq!(buf[i], i + 1);
+                        assert_eq!(buf[i as uint], i + 1);
                     }
                 }
                 Err(e) => fail!("{:?}", e)
@@ -891,7 +891,7 @@ mod test {
                         e => fail!("{:?}", e),
                     }
                     for i in range(0, 10u8) {
-                        assert_eq!(buf[i], i + 1);
+                        assert_eq!(buf[i as uint], i + 1);
                     }
                 }
                 Err(e) => fail!("{:?}", e)
diff --git a/src/librustuv/pipe.rs b/src/librustuv/pipe.rs
index 8d5e7c6f522..ea46c3a1296 100644
--- a/src/librustuv/pipe.rs
+++ b/src/librustuv/pipe.rs
@@ -26,19 +26,19 @@ use uvll;
 pub struct PipeWatcher {
     stream: StreamWatcher,
     home: HomeHandle,
-    priv defused: bool,
-    priv refcount: Refcount,
+    defused: bool,
+    refcount: Refcount,
 
     // see comments in TcpWatcher for why these exist
-    priv write_access: Access,
-    priv read_access: Access,
+    write_access: Access,
+    read_access: Access,
 }
 
 pub struct PipeListener {
     home: HomeHandle,
     pipe: *uvll::uv_pipe_t,
-    priv outgoing: Sender<Result<~RtioPipe, IoError>>,
-    priv incoming: Receiver<Result<~RtioPipe, IoError>>,
+    outgoing: Sender<Result<~RtioPipe:Send, IoError>>,
+    incoming: Receiver<Result<~RtioPipe:Send, IoError>>,
 }
 
 pub struct PipeAcceptor {
@@ -139,7 +139,7 @@ impl RtioPipe for PipeWatcher {
         self.stream.write(buf).map_err(uv_error_to_io_error)
     }
 
-    fn clone(&self) -> ~RtioPipe {
+    fn clone(&self) -> ~RtioPipe:Send {
         ~PipeWatcher {
             stream: StreamWatcher::new(self.stream.handle),
             defused: false,
@@ -147,7 +147,7 @@ impl RtioPipe for PipeWatcher {
             refcount: self.refcount.clone(),
             read_access: self.read_access.clone(),
             write_access: self.write_access.clone(),
-        } as ~RtioPipe
+        } as ~RtioPipe:Send
     }
 }
 
@@ -197,14 +197,14 @@ impl PipeListener {
 }
 
 impl RtioUnixListener for PipeListener {
-    fn listen(~self) -> Result<~RtioUnixAcceptor, IoError> {
+    fn listen(~self) -> Result<~RtioUnixAcceptor:Send, IoError> {
         // create the acceptor object from ourselves
         let mut acceptor = ~PipeAcceptor { listener: self };
 
         let _m = acceptor.fire_homing_missile();
         // FIXME: the 128 backlog should be configurable
         match unsafe { uvll::uv_listen(acceptor.listener.pipe, 128, listen_cb) } {
-            0 => Ok(acceptor as ~RtioUnixAcceptor),
+            0 => Ok(acceptor as ~RtioUnixAcceptor:Send),
             n => Err(uv_error_to_io_error(UvError(n))),
         }
     }
@@ -229,7 +229,7 @@ extern fn listen_cb(server: *uvll::uv_stream_t, status: libc::c_int) {
             });
             let client = PipeWatcher::new_home(&loop_, pipe.home().clone(), false);
             assert_eq!(unsafe { uvll::uv_accept(server, client.handle()) }, 0);
-            Ok(~client as ~RtioPipe)
+            Ok(~client as ~RtioPipe:Send)
         }
         n => Err(uv_error_to_io_error(UvError(n)))
     };
@@ -246,7 +246,7 @@ impl Drop for PipeListener {
 // PipeAcceptor implementation and traits
 
 impl RtioUnixAcceptor for PipeAcceptor {
-    fn accept(&mut self) -> Result<~RtioPipe, IoError> {
+    fn accept(&mut self) -> Result<~RtioPipe:Send, IoError> {
         self.listener.incoming.recv()
     }
 }
diff --git a/src/librustuv/queue.rs b/src/librustuv/queue.rs
index e998b5ca20b..f5643e80f4a 100644
--- a/src/librustuv/queue.rs
+++ b/src/librustuv/queue.rs
@@ -18,7 +18,7 @@
 //! event loop alive we use uv_ref and uv_unref in order to control when the
 //! async handle is active or not.
 
-#[allow(dead_code)];
+#![allow(dead_code)]
 
 use std::cast;
 use std::libc::{c_void, c_int};
@@ -46,13 +46,13 @@ struct State {
 /// This structure is intended to be stored next to the event loop, and it is
 /// used to create new `Queue` structures.
 pub struct QueuePool {
-    priv queue: UnsafeArc<State>,
-    priv refcnt: uint,
+    queue: UnsafeArc<State>,
+    refcnt: uint,
 }
 
 /// This type is used to send messages back to the original event loop.
 pub struct Queue {
-    priv queue: UnsafeArc<State>,
+    queue: UnsafeArc<State>,
 }
 
 extern fn async_cb(handle: *uvll::uv_async_t, status: c_int) {
diff --git a/src/librustuv/rc.rs b/src/librustuv/rc.rs
index f43cf722361..86c6c44238c 100644
--- a/src/librustuv/rc.rs
+++ b/src/librustuv/rc.rs
@@ -19,7 +19,7 @@
 use std::sync::arc::UnsafeArc;
 
 pub struct Refcount {
-    priv rc: UnsafeArc<uint>,
+    rc: UnsafeArc<uint>,
 }
 
 impl Refcount {
diff --git a/src/librustuv/stream.rs b/src/librustuv/stream.rs
index f7bf2f051eb..10d62a5aeae 100644
--- a/src/librustuv/stream.rs
+++ b/src/librustuv/stream.rs
@@ -23,13 +23,13 @@ use uvll;
 // uv_stream_t instance, and all I/O operations assume that it's already located
 // on the appropriate scheduler.
 pub struct StreamWatcher {
-    handle: *uvll::uv_stream_t,
+    pub handle: *uvll::uv_stream_t,
 
     // Cache the last used uv_write_t so we don't have to allocate a new one on
     // every call to uv_write(). Ideally this would be a stack-allocated
     // structure, but currently we don't have mappings for all the structures
     // defined in libuv, so we're foced to malloc this.
-    priv last_write_req: Option<Request>,
+    last_write_req: Option<Request>,
 }
 
 struct ReadContext {
diff --git a/src/librustuv/uvio.rs b/src/librustuv/uvio.rs
index 15de0408795..d8365cf677c 100644
--- a/src/librustuv/uvio.rs
+++ b/src/librustuv/uvio.rs
@@ -46,7 +46,7 @@ use uvll;
 
 // Obviously an Event Loop is always home.
 pub struct UvEventLoop {
-    priv uvio: UvIoFactory
+    uvio: UvIoFactory
 }
 
 impl UvEventLoop {
@@ -85,14 +85,17 @@ impl rtio::EventLoop for UvEventLoop {
         IdleWatcher::onetime(&mut self.uvio.loop_, f);
     }
 
-    fn pausable_idle_callback(&mut self, cb: ~rtio::Callback)
-        -> ~rtio::PausableIdleCallback
+    fn pausable_idle_callback(&mut self, cb: ~rtio::Callback:Send)
+        -> ~rtio::PausableIdleCallback:Send
     {
-        IdleWatcher::new(&mut self.uvio.loop_, cb) as ~rtio::PausableIdleCallback
+        IdleWatcher::new(&mut self.uvio.loop_,
+                         cb) as ~rtio::PausableIdleCallback:Send
     }
 
-    fn remote_callback(&mut self, f: ~rtio::Callback) -> ~rtio::RemoteCallback {
-        ~AsyncWatcher::new(&mut self.uvio.loop_, f) as ~rtio::RemoteCallback
+    fn remote_callback(&mut self, f: ~rtio::Callback:Send)
+        -> ~rtio::RemoteCallback:Send
+    {
+        ~AsyncWatcher::new(&mut self.uvio.loop_, f) as ~rtio::RemoteCallback:Send
     }
 
     fn io<'a>(&'a mut self) -> Option<&'a mut rtio::IoFactory> {
@@ -121,8 +124,8 @@ fn test_callback_run_once() {
 }
 
 pub struct UvIoFactory {
-    loop_: Loop,
-    priv handle_pool: Option<~QueuePool>,
+    pub loop_: Loop,
+    handle_pool: Option<~QueuePool>,
 }
 
 impl UvIoFactory {
@@ -141,30 +144,30 @@ impl IoFactory for UvIoFactory {
     // NB: This blocks the task waiting on the connection.
     // It would probably be better to return a future
     fn tcp_connect(&mut self, addr: SocketAddr)
-        -> Result<~rtio::RtioTcpStream, IoError>
+        -> Result<~rtio::RtioTcpStream:Send, IoError>
     {
         match TcpWatcher::connect(self, addr) {
-            Ok(t) => Ok(~t as ~rtio::RtioTcpStream),
+            Ok(t) => Ok(~t as ~rtio::RtioTcpStream:Send),
             Err(e) => Err(uv_error_to_io_error(e)),
         }
     }
 
-    fn tcp_bind(&mut self, addr: SocketAddr) -> Result<~rtio::RtioTcpListener, IoError> {
+    fn tcp_bind(&mut self, addr: SocketAddr) -> Result<~rtio::RtioTcpListener:Send, IoError> {
         match TcpListener::bind(self, addr) {
-            Ok(t) => Ok(t as ~rtio::RtioTcpListener),
+            Ok(t) => Ok(t as ~rtio::RtioTcpListener:Send),
             Err(e) => Err(uv_error_to_io_error(e)),
         }
     }
 
-    fn udp_bind(&mut self, addr: SocketAddr) -> Result<~rtio::RtioUdpSocket, IoError> {
+    fn udp_bind(&mut self, addr: SocketAddr) -> Result<~rtio::RtioUdpSocket:Send, IoError> {
         match UdpWatcher::bind(self, addr) {
-            Ok(u) => Ok(~u as ~rtio::RtioUdpSocket),
+            Ok(u) => Ok(~u as ~rtio::RtioUdpSocket:Send),
             Err(e) => Err(uv_error_to_io_error(e)),
         }
     }
 
-    fn timer_init(&mut self) -> Result<~rtio::RtioTimer, IoError> {
-        Ok(TimerWatcher::new(self) as ~rtio::RtioTimer)
+    fn timer_init(&mut self) -> Result<~rtio::RtioTimer:Send, IoError> {
+        Ok(TimerWatcher::new(self) as ~rtio::RtioTimer:Send)
     }
 
     fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
@@ -174,12 +177,12 @@ impl IoFactory for UvIoFactory {
     }
 
     fn fs_from_raw_fd(&mut self, fd: c_int,
-                      close: rtio::CloseBehavior) -> ~rtio::RtioFileStream {
-        ~FileWatcher::new(self, fd, close) as ~rtio::RtioFileStream
+                      close: rtio::CloseBehavior) -> ~rtio::RtioFileStream:Send {
+        ~FileWatcher::new(self, fd, close) as ~rtio::RtioFileStream:Send
     }
 
     fn fs_open(&mut self, path: &CString, fm: FileMode, fa: FileAccess)
-        -> Result<~rtio::RtioFileStream, IoError> {
+        -> Result<~rtio::RtioFileStream:Send, IoError> {
         let flags = match fm {
             io::Open => 0,
             io::Append => libc::O_APPEND,
@@ -195,7 +198,7 @@ impl IoFactory for UvIoFactory {
         };
 
         match FsRequest::open(self, path, flags as int, mode as int) {
-            Ok(fs) => Ok(~fs as ~rtio::RtioFileStream),
+            Ok(fs) => Ok(~fs as ~rtio::RtioFileStream:Send),
             Err(e) => Err(uv_error_to_io_error(e))
         }
     }
@@ -260,12 +263,12 @@ impl IoFactory for UvIoFactory {
     }
 
     fn spawn(&mut self, config: ProcessConfig)
-            -> Result<(~rtio::RtioProcess, ~[Option<~rtio::RtioPipe>]), IoError>
+            -> Result<(~rtio::RtioProcess:Send, ~[Option<~rtio::RtioPipe:Send>]), IoError>
     {
         match Process::spawn(self, config) {
             Ok((p, io)) => {
-                Ok((p as ~rtio::RtioProcess,
-                    io.move_iter().map(|i| i.map(|p| ~p as ~rtio::RtioPipe)).collect()))
+                Ok((p as ~rtio::RtioProcess:Send,
+                    io.move_iter().map(|i| i.map(|p| ~p as ~rtio::RtioPipe:Send)).collect()))
             }
             Err(e) => Err(uv_error_to_io_error(e)),
         }
@@ -275,40 +278,40 @@ impl IoFactory for UvIoFactory {
         Process::kill(pid, signum).map_err(uv_error_to_io_error)
     }
 
-    fn unix_bind(&mut self, path: &CString) -> Result<~rtio::RtioUnixListener, IoError>
+    fn unix_bind(&mut self, path: &CString) -> Result<~rtio::RtioUnixListener:Send, IoError>
     {
         match PipeListener::bind(self, path) {
-            Ok(p) => Ok(p as ~rtio::RtioUnixListener),
+            Ok(p) => Ok(p as ~rtio::RtioUnixListener:Send),
             Err(e) => Err(uv_error_to_io_error(e)),
         }
     }
 
-    fn unix_connect(&mut self, path: &CString) -> Result<~rtio::RtioPipe, IoError> {
+    fn unix_connect(&mut self, path: &CString) -> Result<~rtio::RtioPipe:Send, IoError> {
         match PipeWatcher::connect(self, path) {
-            Ok(p) => Ok(~p as ~rtio::RtioPipe),
+            Ok(p) => Ok(~p as ~rtio::RtioPipe:Send),
             Err(e) => Err(uv_error_to_io_error(e)),
         }
     }
 
     fn tty_open(&mut self, fd: c_int, readable: bool)
-            -> Result<~rtio::RtioTTY, IoError> {
+            -> Result<~rtio::RtioTTY:Send, IoError> {
         match TtyWatcher::new(self, fd, readable) {
-            Ok(tty) => Ok(~tty as ~rtio::RtioTTY),
+            Ok(tty) => Ok(~tty as ~rtio::RtioTTY:Send),
             Err(e) => Err(uv_error_to_io_error(e))
         }
     }
 
-    fn pipe_open(&mut self, fd: c_int) -> Result<~rtio::RtioPipe, IoError> {
+    fn pipe_open(&mut self, fd: c_int) -> Result<~rtio::RtioPipe:Send, IoError> {
         match PipeWatcher::open(self, fd) {
-            Ok(s) => Ok(~s as ~rtio::RtioPipe),
+            Ok(s) => Ok(~s as ~rtio::RtioPipe:Send),
             Err(e) => Err(uv_error_to_io_error(e))
         }
     }
 
     fn signal(&mut self, signum: Signum, channel: Sender<Signum>)
-        -> Result<~rtio::RtioSignal, IoError> {
+        -> Result<~rtio::RtioSignal:Send, IoError> {
         match SignalWatcher::new(self, signum, channel) {
-            Ok(s) => Ok(s as ~rtio::RtioSignal),
+            Ok(s) => Ok(s as ~rtio::RtioSignal:Send),
             Err(e) => Err(uv_error_to_io_error(e)),
         }
     }
diff --git a/src/librustuv/uvll.rs b/src/librustuv/uvll.rs
index 25f4fb0edf8..62f1dbd73e3 100644
--- a/src/librustuv/uvll.rs
+++ b/src/librustuv/uvll.rs
@@ -27,7 +27,7 @@
  * the mappings should be added in this module.
  */
 
-#[allow(non_camel_case_types)]; // C types
+#![allow(non_camel_case_types)] // C types
 
 use std::libc::{size_t, c_int, c_uint, c_void, c_char, c_double};
 use std::libc::{ssize_t, sockaddr, free, addrinfo};
@@ -100,15 +100,15 @@ pub type uv_buf_len_t = libc::c_ulong;
 // see libuv/include/uv-unix.h
 #[cfg(unix)]
 pub struct uv_buf_t {
-    base: *u8,
-    len: uv_buf_len_t,
+    pub base: *u8,
+    pub len: uv_buf_len_t,
 }
 
 // see libuv/include/uv-win.h
 #[cfg(windows)]
 pub struct uv_buf_t {
-    len: uv_buf_len_t,
-    base: *u8,
+    pub len: uv_buf_len_t,
+    pub base: *u8,
 }
 
 #[repr(C)]
@@ -119,23 +119,23 @@ pub enum uv_run_mode {
 }
 
 pub struct uv_process_options_t {
-    exit_cb: uv_exit_cb,
-    file: *libc::c_char,
-    args: **libc::c_char,
-    env: **libc::c_char,
-    cwd: *libc::c_char,
-    flags: libc::c_uint,
-    stdio_count: libc::c_int,
-    stdio: *uv_stdio_container_t,
-    uid: uv_uid_t,
-    gid: uv_gid_t,
+    pub exit_cb: uv_exit_cb,
+    pub file: *libc::c_char,
+    pub args: **libc::c_char,
+    pub env: **libc::c_char,
+    pub cwd: *libc::c_char,
+    pub flags: libc::c_uint,
+    pub stdio_count: libc::c_int,
+    pub stdio: *uv_stdio_container_t,
+    pub uid: uv_uid_t,
+    pub gid: uv_gid_t,
 }
 
 // These fields are private because they must be interfaced with through the
 // functions below.
 pub struct uv_stdio_container_t {
-    priv flags: libc::c_int,
-    priv stream: *uv_stream_t,
+    flags: libc::c_int,
+    stream: *uv_stream_t,
 }
 
 pub type uv_handle_t = c_void;
@@ -160,27 +160,27 @@ pub type uv_signal_t = c_void;
 pub type uv_shutdown_t = c_void;
 
 pub struct uv_timespec_t {
-    tv_sec: libc::c_long,
-    tv_nsec: libc::c_long
+    pub tv_sec: libc::c_long,
+    pub tv_nsec: libc::c_long
 }
 
 pub struct uv_stat_t {
-    st_dev: libc::uint64_t,
-    st_mode: libc::uint64_t,
-    st_nlink: libc::uint64_t,
-    st_uid: libc::uint64_t,
-    st_gid: libc::uint64_t,
-    st_rdev: libc::uint64_t,
-    st_ino: libc::uint64_t,
-    st_size: libc::uint64_t,
-    st_blksize: libc::uint64_t,
-    st_blocks: libc::uint64_t,
-    st_flags: libc::uint64_t,
-    st_gen: libc::uint64_t,
-    st_atim: uv_timespec_t,
-    st_mtim: uv_timespec_t,
-    st_ctim: uv_timespec_t,
-    st_birthtim: uv_timespec_t
+    pub st_dev: libc::uint64_t,
+    pub st_mode: libc::uint64_t,
+    pub st_nlink: libc::uint64_t,
+    pub st_uid: libc::uint64_t,
+    pub st_gid: libc::uint64_t,
+    pub st_rdev: libc::uint64_t,
+    pub st_ino: libc::uint64_t,
+    pub st_size: libc::uint64_t,
+    pub st_blksize: libc::uint64_t,
+    pub st_blocks: libc::uint64_t,
+    pub st_flags: libc::uint64_t,
+    pub st_gen: libc::uint64_t,
+    pub st_atim: uv_timespec_t,
+    pub st_mtim: uv_timespec_t,
+    pub st_ctim: uv_timespec_t,
+    pub st_birthtim: uv_timespec_t
 }
 
 impl uv_stat_t {
diff --git a/src/libsemver/lib.rs b/src/libsemver/lib.rs
index 42205207357..2663d627e51 100644
--- a/src/libsemver/lib.rs
+++ b/src/libsemver/lib.rs
@@ -28,14 +28,14 @@
 //! An example version number with all five components is
 //! `0.8.1-rc.3.0+20130922.linux`.
 
-#[crate_id = "semver#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-#[deny(deprecated_owned_vector)];
+#![crate_id = "semver#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+#![deny(deprecated_owned_vector)]
 
 use std::char;
 use std::cmp;
@@ -79,17 +79,17 @@ impl fmt::Show for Identifier {
 #[deriving(Clone)]
 pub struct Version {
     /// The major version, to be incremented on incompatible changes.
-    major: uint,
+    pub major: uint,
     /// The minor version, to be incremented when functionality is added in a
     /// backwards-compatible manner.
-    minor: uint,
+    pub minor: uint,
     /// The patch version, to be incremented when backwards-compatible bug
     /// fixes are made.
-    patch: uint,
+    pub patch: uint,
     /// The pre-release version identifier, if one exists.
-    pre: Vec<Identifier>,
+    pub pre: Vec<Identifier>,
     /// The build metadata, ignored when determining version precedence.
-    build: Vec<Identifier>,
+    pub build: Vec<Identifier>,
 }
 
 impl fmt::Show for Version {
diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs
index 62e078e26c1..13e4a010a5e 100644
--- a/src/libserialize/base64.rs
+++ b/src/libserialize/base64.rs
@@ -23,11 +23,11 @@ pub enum CharacterSet {
 /// Contains configuration parameters for `to_base64`.
 pub struct Config {
     /// Character set to use
-    char_set: CharacterSet,
+    pub char_set: CharacterSet,
     /// True to pad output with `=` characters
-    pad: bool,
+    pub pad: bool,
     /// `Some(len)` to wrap lines at `len`, `None` to disable line wrapping
-    line_length: Option<uint>
+    pub line_length: Option<uint>
 }
 
 /// Configuration for RFC 4648 standard base64 encoding
@@ -99,10 +99,10 @@ impl<'a> ToBase64 for &'a [u8] {
                     (self[i + 2] as u32);
 
             // This 24-bit number gets separated into four 6-bit numbers.
-            v.push(bytes[(n >> 18) & 63]);
-            v.push(bytes[(n >> 12) & 63]);
-            v.push(bytes[(n >> 6 ) & 63]);
-            v.push(bytes[n & 63]);
+            v.push(bytes[((n >> 18) & 63) as uint]);
+            v.push(bytes[((n >> 12) & 63) as uint]);
+            v.push(bytes[((n >> 6 ) & 63) as uint]);
+            v.push(bytes[(n & 63) as uint]);
 
             cur_length += 4;
             i += 3;
@@ -125,8 +125,8 @@ impl<'a> ToBase64 for &'a [u8] {
             0 => (),
             1 => {
                 let n = (self[i] as u32) << 16;
-                v.push(bytes[(n >> 18) & 63]);
-                v.push(bytes[(n >> 12) & 63]);
+                v.push(bytes[((n >> 18) & 63) as uint]);
+                v.push(bytes[((n >> 12) & 63) as uint]);
                 if config.pad {
                     v.push('=' as u8);
                     v.push('=' as u8);
@@ -135,9 +135,9 @@ impl<'a> ToBase64 for &'a [u8] {
             2 => {
                 let n = (self[i] as u32) << 16 |
                     (self[i + 1u] as u32) << 8;
-                v.push(bytes[(n >> 18) & 63]);
-                v.push(bytes[(n >> 12) & 63]);
-                v.push(bytes[(n >> 6 ) & 63]);
+                v.push(bytes[((n >> 18) & 63) as uint]);
+                v.push(bytes[((n >> 12) & 63) as uint]);
+                v.push(bytes[((n >> 6 ) & 63) as uint]);
                 if config.pad {
                     v.push('=' as u8);
                 }
diff --git a/src/libserialize/collection_impls.rs b/src/libserialize/collection_impls.rs
index bb823c2d8ca..8631fef5168 100644
--- a/src/libserialize/collection_impls.rs
+++ b/src/libserialize/collection_impls.rs
@@ -20,272 +20,294 @@ use collections::{DList, RingBuf, TreeMap, TreeSet, Deque, HashMap, HashSet,
 use collections::enum_set::{EnumSet, CLike};
 
 impl<
-    S: Encoder,
-    T: Encodable<S>
-> Encodable<S> for DList<T> {
-    fn encode(&self, s: &mut S) {
+    E,
+    S: Encoder<E>,
+    T: Encodable<S, E>
+> Encodable<S, E> for DList<T> {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_seq(self.len(), |s| {
             for (i, e) in self.iter().enumerate() {
-                s.emit_seq_elt(i, |s| e.encode(s));
+                try!(s.emit_seq_elt(i, |s| e.encode(s)));
             }
+            Ok(())
         })
     }
 }
 
-impl<D:Decoder,T:Decodable<D>> Decodable<D> for DList<T> {
-    fn decode(d: &mut D) -> DList<T> {
-        let mut list = DList::new();
+impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for DList<T> {
+    fn decode(d: &mut D) -> Result<DList<T>, E> {
         d.read_seq(|d, len| {
+            let mut list = DList::new();
             for i in range(0u, len) {
-                list.push_back(d.read_seq_elt(i, |d| Decodable::decode(d)));
+                list.push_back(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
             }
-        });
-        list
+            Ok(list)
+        })
     }
 }
 
 impl<
-    S: Encoder,
-    T: Encodable<S>
-> Encodable<S> for RingBuf<T> {
-    fn encode(&self, s: &mut S) {
+    E,
+    S: Encoder<E>,
+    T: Encodable<S, E>
+> Encodable<S, E> for RingBuf<T> {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_seq(self.len(), |s| {
             for (i, e) in self.iter().enumerate() {
-                s.emit_seq_elt(i, |s| e.encode(s));
+                try!(s.emit_seq_elt(i, |s| e.encode(s)));
             }
+            Ok(())
         })
     }
 }
 
-impl<D:Decoder,T:Decodable<D>> Decodable<D> for RingBuf<T> {
-    fn decode(d: &mut D) -> RingBuf<T> {
-        let mut deque = RingBuf::new();
+impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for RingBuf<T> {
+    fn decode(d: &mut D) -> Result<RingBuf<T>, E> {
         d.read_seq(|d, len| {
+            let mut deque: RingBuf<T> = RingBuf::new();
             for i in range(0u, len) {
-                deque.push_back(d.read_seq_elt(i, |d| Decodable::decode(d)));
+                deque.push_back(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
             }
-        });
-        deque
+            Ok(deque)
+        })
     }
 }
 
 impl<
-    E: Encoder,
-    K: Encodable<E> + Eq + TotalOrd,
-    V: Encodable<E> + Eq
-> Encodable<E> for TreeMap<K, V> {
-    fn encode(&self, e: &mut E) {
+    E,
+    S: Encoder<E>,
+    K: Encodable<S, E> + Eq + TotalOrd,
+    V: Encodable<S, E> + Eq
+> Encodable<S, E> for TreeMap<K, V> {
+    fn encode(&self, e: &mut S) -> Result<(), E> {
         e.emit_map(self.len(), |e| {
             let mut i = 0;
             for (key, val) in self.iter() {
-                e.emit_map_elt_key(i, |e| key.encode(e));
-                e.emit_map_elt_val(i, |e| val.encode(e));
+                try!(e.emit_map_elt_key(i, |e| key.encode(e)));
+                try!(e.emit_map_elt_val(i, |e| val.encode(e)));
                 i += 1;
             }
+            Ok(())
         })
     }
 }
 
 impl<
-    D: Decoder,
-    K: Decodable<D> + Eq + TotalOrd,
-    V: Decodable<D> + Eq
-> Decodable<D> for TreeMap<K, V> {
-    fn decode(d: &mut D) -> TreeMap<K, V> {
+    E,
+    D: Decoder<E>,
+    K: Decodable<D, E> + Eq + TotalOrd,
+    V: Decodable<D, E> + Eq
+> Decodable<D, E> for TreeMap<K, V> {
+    fn decode(d: &mut D) -> Result<TreeMap<K, V>, E> {
         d.read_map(|d, len| {
             let mut map = TreeMap::new();
             for i in range(0u, len) {
-                let key = d.read_map_elt_key(i, |d| Decodable::decode(d));
-                let val = d.read_map_elt_val(i, |d| Decodable::decode(d));
+                let key = try!(d.read_map_elt_key(i, |d| Decodable::decode(d)));
+                let val = try!(d.read_map_elt_val(i, |d| Decodable::decode(d)));
                 map.insert(key, val);
             }
-            map
+            Ok(map)
         })
     }
 }
 
 impl<
-    S: Encoder,
-    T: Encodable<S> + Eq + TotalOrd
-> Encodable<S> for TreeSet<T> {
-    fn encode(&self, s: &mut S) {
+    E,
+    S: Encoder<E>,
+    T: Encodable<S, E> + Eq + TotalOrd
+> Encodable<S, E> for TreeSet<T> {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_seq(self.len(), |s| {
             let mut i = 0;
             for e in self.iter() {
-                s.emit_seq_elt(i, |s| e.encode(s));
+                try!(s.emit_seq_elt(i, |s| e.encode(s)));
                 i += 1;
             }
+            Ok(())
         })
     }
 }
 
 impl<
-    D: Decoder,
-    T: Decodable<D> + Eq + TotalOrd
-> Decodable<D> for TreeSet<T> {
-    fn decode(d: &mut D) -> TreeSet<T> {
+    E,
+    D: Decoder<E>,
+    T: Decodable<D, E> + Eq + TotalOrd
+> Decodable<D, E> for TreeSet<T> {
+    fn decode(d: &mut D) -> Result<TreeSet<T>, E> {
         d.read_seq(|d, len| {
             let mut set = TreeSet::new();
             for i in range(0u, len) {
-                set.insert(d.read_seq_elt(i, |d| Decodable::decode(d)));
+                set.insert(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
             }
-            set
+            Ok(set)
         })
     }
 }
 
 impl<
-    S: Encoder,
-    T: Encodable<S> + CLike
-> Encodable<S> for EnumSet<T> {
-    fn encode(&self, s: &mut S) {
+    E,
+    S: Encoder<E>,
+    T: Encodable<S, E> + CLike
+> Encodable<S, E> for EnumSet<T> {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         let mut bits = 0;
         for item in self.iter() {
             bits |= item.to_uint();
         }
-        s.emit_uint(bits);
+        s.emit_uint(bits)
     }
 }
 
 impl<
-    D: Decoder,
-    T: Decodable<D> + CLike
-> Decodable<D> for EnumSet<T> {
-    fn decode(d: &mut D) -> EnumSet<T> {
-        let bits = d.read_uint();
+    E,
+    D: Decoder<E>,
+    T: Decodable<D, E> + CLike
+> Decodable<D, E> for EnumSet<T> {
+    fn decode(d: &mut D) -> Result<EnumSet<T>, E> {
+        let bits = try!(d.read_uint());
         let mut set = EnumSet::empty();
         for bit in range(0, uint::BITS) {
             if bits & (1 << bit) != 0 {
                 set.add(CLike::from_uint(1 << bit));
             }
         }
-        set
+        Ok(set)
     }
 }
 
 impl<
-    E: Encoder,
-    K: Encodable<E> + Hash<S> + TotalEq,
-    V: Encodable<E>,
-    S,
-    H: Hasher<S>
-> Encodable<E> for HashMap<K, V, H> {
-    fn encode(&self, e: &mut E) {
+    E,
+    S: Encoder<E>,
+    K: Encodable<S, E> + Hash<X> + TotalEq,
+    V: Encodable<S, E>,
+    X,
+    H: Hasher<X>
+> Encodable<S, E> for HashMap<K, V, H> {
+    fn encode(&self, e: &mut S) -> Result<(), E> {
         e.emit_map(self.len(), |e| {
             let mut i = 0;
             for (key, val) in self.iter() {
-                e.emit_map_elt_key(i, |e| key.encode(e));
-                e.emit_map_elt_val(i, |e| val.encode(e));
+                try!(e.emit_map_elt_key(i, |e| key.encode(e)));
+                try!(e.emit_map_elt_val(i, |e| val.encode(e)));
                 i += 1;
             }
+            Ok(())
         })
     }
 }
 
 impl<
-    D: Decoder,
-    K: Decodable<D> + Hash<S> + TotalEq,
-    V: Decodable<D>,
+    E,
+    D: Decoder<E>,
+    K: Decodable<D, E> + Hash<S> + TotalEq,
+    V: Decodable<D, E>,
     S,
     H: Hasher<S> + Default
-> Decodable<D> for HashMap<K, V, H> {
-    fn decode(d: &mut D) -> HashMap<K, V, H> {
+> Decodable<D, E> for HashMap<K, V, H> {
+    fn decode(d: &mut D) -> Result<HashMap<K, V, H>, E> {
         d.read_map(|d, len| {
             let hasher = Default::default();
             let mut map = HashMap::with_capacity_and_hasher(len, hasher);
             for i in range(0u, len) {
-                let key = d.read_map_elt_key(i, |d| Decodable::decode(d));
-                let val = d.read_map_elt_val(i, |d| Decodable::decode(d));
+                let key = try!(d.read_map_elt_key(i, |d| Decodable::decode(d)));
+                let val = try!(d.read_map_elt_val(i, |d| Decodable::decode(d)));
                 map.insert(key, val);
             }
-            map
+            Ok(map)
         })
     }
 }
 
 impl<
-    E: Encoder,
-    T: Encodable<E> + Hash<S> + TotalEq,
-    S,
-    H: Hasher<S>
-> Encodable<E> for HashSet<T, H> {
-    fn encode(&self, s: &mut E) {
+    E,
+    S: Encoder<E>,
+    T: Encodable<S, E> + Hash<X> + TotalEq,
+    X,
+    H: Hasher<X>
+> Encodable<S, E> for HashSet<T, H> {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_seq(self.len(), |s| {
             let mut i = 0;
             for e in self.iter() {
-                s.emit_seq_elt(i, |s| e.encode(s));
+                try!(s.emit_seq_elt(i, |s| e.encode(s)));
                 i += 1;
             }
+            Ok(())
         })
     }
 }
 
 impl<
-    D: Decoder,
-    T: Decodable<D> + Hash<S> + TotalEq,
+    E,
+    D: Decoder<E>,
+    T: Decodable<D, E> + Hash<S> + TotalEq,
     S,
     H: Hasher<S> + Default
-> Decodable<D> for HashSet<T, H> {
-    fn decode(d: &mut D) -> HashSet<T, H> {
+> Decodable<D, E> for HashSet<T, H> {
+    fn decode(d: &mut D) -> Result<HashSet<T, H>, E> {
         d.read_seq(|d, len| {
             let mut set = HashSet::with_capacity_and_hasher(len, Default::default());
             for i in range(0u, len) {
-                set.insert(d.read_seq_elt(i, |d| Decodable::decode(d)));
+                set.insert(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
             }
-            set
+            Ok(set)
         })
     }
 }
 
 impl<
-    E: Encoder,
-    V: Encodable<E>
-> Encodable<E> for TrieMap<V> {
-    fn encode(&self, e: &mut E) {
+    E,
+    S: Encoder<E>,
+    V: Encodable<S, E>
+> Encodable<S, E> for TrieMap<V> {
+    fn encode(&self, e: &mut S) -> Result<(), E> {
         e.emit_map(self.len(), |e| {
                 for (i, (key, val)) in self.iter().enumerate() {
-                    e.emit_map_elt_key(i, |e| key.encode(e));
-                    e.emit_map_elt_val(i, |e| val.encode(e));
+                    try!(e.emit_map_elt_key(i, |e| key.encode(e)));
+                    try!(e.emit_map_elt_val(i, |e| val.encode(e)));
                 }
-            });
+                Ok(())
+            })
     }
 }
 
 impl<
-    D: Decoder,
-    V: Decodable<D>
-> Decodable<D> for TrieMap<V> {
-    fn decode(d: &mut D) -> TrieMap<V> {
+    E,
+    D: Decoder<E>,
+    V: Decodable<D, E>
+> Decodable<D, E> for TrieMap<V> {
+    fn decode(d: &mut D) -> Result<TrieMap<V>, E> {
         d.read_map(|d, len| {
             let mut map = TrieMap::new();
             for i in range(0u, len) {
-                let key = d.read_map_elt_key(i, |d| Decodable::decode(d));
-                let val = d.read_map_elt_val(i, |d| Decodable::decode(d));
+                let key = try!(d.read_map_elt_key(i, |d| Decodable::decode(d)));
+                let val = try!(d.read_map_elt_val(i, |d| Decodable::decode(d)));
                 map.insert(key, val);
             }
-            map
+            Ok(map)
         })
     }
 }
 
-impl<S: Encoder> Encodable<S> for TrieSet {
-    fn encode(&self, s: &mut S) {
+impl<E, S: Encoder<E>> Encodable<S, E> for TrieSet {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_seq(self.len(), |s| {
                 for (i, e) in self.iter().enumerate() {
-                    s.emit_seq_elt(i, |s| e.encode(s));
+                    try!(s.emit_seq_elt(i, |s| e.encode(s)));
                 }
+                Ok(())
             })
     }
 }
 
-impl<D: Decoder> Decodable<D> for TrieSet {
-    fn decode(d: &mut D) -> TrieSet {
+impl<E, D: Decoder<E>> Decodable<D, E> for TrieSet {
+    fn decode(d: &mut D) -> Result<TrieSet, E> {
         d.read_seq(|d, len| {
             let mut set = TrieSet::new();
             for i in range(0u, len) {
-                set.insert(d.read_seq_elt(i, |d| Decodable::decode(d)));
+                set.insert(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
             }
-            set
+            Ok(set)
         })
     }
 }
diff --git a/src/libserialize/ebml.rs b/src/libserialize/ebml.rs
index 2b416f263c2..a6356e34af3 100644
--- a/src/libserialize/ebml.rs
+++ b/src/libserialize/ebml.rs
@@ -8,14 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
+use std::io;
 use std::str;
 
-macro_rules! try( ($e:expr) => (
-    match $e { Ok(e) => e, Err(e) => { self.last_error = Err(e); return } }
-) )
-
 // Simple Extensible Binary Markup Language (ebml) reader and writer on a
 // cursor model. See the specification here:
 //     http://www.matroska.org/technical/specs/rfc/index.html
@@ -23,9 +20,9 @@ macro_rules! try( ($e:expr) => (
 // Common data structures
 #[deriving(Clone)]
 pub struct Doc<'a> {
-    data: &'a [u8],
-    start: uint,
-    end: uint,
+    pub data: &'a [u8],
+    pub start: uint,
+    pub end: uint,
 }
 
 impl<'doc> Doc<'doc> {
@@ -43,8 +40,8 @@ impl<'doc> Doc<'doc> {
 }
 
 pub struct TaggedDoc<'a> {
-    priv tag: uint,
-    doc: Doc<'a>,
+    tag: uint,
+    pub doc: Doc<'a>,
 }
 
 pub enum EbmlEncoderTag {
@@ -79,6 +76,13 @@ pub enum EbmlEncoderTag {
 
     EsLabel, // Used only when debugging
 }
+
+#[deriving(Show)]
+pub enum Error {
+    IntTooBig(uint),
+    Expected(~str),
+    IoError(io::IoError)
+}
 // --------------------------------------
 
 pub mod reader {
@@ -94,43 +98,57 @@ pub mod reader {
     use super::{ EsVec, EsMap, EsEnum, EsVecLen, EsVecElt, EsMapLen, EsMapKey,
         EsEnumVid, EsU64, EsU32, EsU16, EsU8, EsInt, EsI64, EsI32, EsI16, EsI8,
         EsBool, EsF64, EsF32, EsChar, EsStr, EsMapVal, EsEnumBody, EsUint,
-        EsOpaque, EsLabel, EbmlEncoderTag, Doc, TaggedDoc };
+        EsOpaque, EsLabel, EbmlEncoderTag, Doc, TaggedDoc, Error, IntTooBig,
+        Expected };
 
+    pub type DecodeResult<T> = Result<T, Error>;
     // ebml reading
 
+    macro_rules! try_or(
+        ($e:expr, $r:expr) => (
+            match $e {
+                Ok(e) => e,
+                Err(e) => {
+                    debug!("ignored error: {}", e);
+                    return $r
+                }
+            }
+        )
+    )
+
     pub struct Res {
-        val: uint,
-        next: uint
+        pub val: uint,
+        pub next: uint
     }
 
     #[inline(never)]
-    fn vuint_at_slow(data: &[u8], start: uint) -> Res {
+    fn vuint_at_slow(data: &[u8], start: uint) -> DecodeResult<Res> {
         let a = data[start];
         if a & 0x80u8 != 0u8 {
-            return Res {val: (a & 0x7fu8) as uint, next: start + 1u};
+            return Ok(Res {val: (a & 0x7fu8) as uint, next: start + 1u});
         }
         if a & 0x40u8 != 0u8 {
-            return Res {val: ((a & 0x3fu8) as uint) << 8u |
+            return Ok(Res {val: ((a & 0x3fu8) as uint) << 8u |
                         (data[start + 1u] as uint),
-                    next: start + 2u};
+                    next: start + 2u});
         }
         if a & 0x20u8 != 0u8 {
-            return Res {val: ((a & 0x1fu8) as uint) << 16u |
+            return Ok(Res {val: ((a & 0x1fu8) as uint) << 16u |
                         (data[start + 1u] as uint) << 8u |
                         (data[start + 2u] as uint),
-                    next: start + 3u};
+                    next: start + 3u});
         }
         if a & 0x10u8 != 0u8 {
-            return Res {val: ((a & 0x0fu8) as uint) << 24u |
+            return Ok(Res {val: ((a & 0x0fu8) as uint) << 24u |
                         (data[start + 1u] as uint) << 16u |
                         (data[start + 2u] as uint) << 8u |
                         (data[start + 3u] as uint),
-                    next: start + 4u};
+                    next: start + 4u});
         }
-        fail!("vint too big");
+        Err(IntTooBig(a as uint))
     }
 
-    pub fn vuint_at(data: &[u8], start: uint) -> Res {
+    pub fn vuint_at(data: &[u8], start: uint) -> DecodeResult<Res> {
         use std::mem::from_be32;
 
         if data.len() - start < 4 {
@@ -166,10 +184,10 @@ pub mod reader {
 
             let i = (val >> 28u) as uint;
             let (shift, mask) = SHIFT_MASK_TABLE[i];
-            Res {
+            Ok(Res {
                 val: ((val >> shift) & mask) as uint,
                 next: start + (((32 - shift) >> 3) as uint)
-            }
+            })
         }
     }
 
@@ -177,21 +195,21 @@ pub mod reader {
         Doc { data: data, start: 0u, end: data.len() }
     }
 
-    pub fn doc_at<'a>(data: &'a [u8], start: uint) -> TaggedDoc<'a> {
-        let elt_tag = vuint_at(data, start);
-        let elt_size = vuint_at(data, elt_tag.next);
+    pub fn doc_at<'a>(data: &'a [u8], start: uint) -> DecodeResult<TaggedDoc<'a>> {
+        let elt_tag = try!(vuint_at(data, start));
+        let elt_size = try!(vuint_at(data, elt_tag.next));
         let end = elt_size.next + elt_size.val;
-        TaggedDoc {
+        Ok(TaggedDoc {
             tag: elt_tag.val,
             doc: Doc { data: data, start: elt_size.next, end: end }
-        }
+        })
     }
 
     pub fn maybe_get_doc<'a>(d: Doc<'a>, tg: uint) -> Option<Doc<'a>> {
         let mut pos = d.start;
         while pos < d.end {
-            let elt_tag = vuint_at(d.data, pos);
-            let elt_size = vuint_at(d.data, elt_tag.next);
+            let elt_tag = try_or!(vuint_at(d.data, pos), None);
+            let elt_size = try_or!(vuint_at(d.data, elt_tag.next), None);
             pos = elt_size.next + elt_size.val;
             if elt_tag.val == tg {
                 return Some(Doc { data: d.data, start: elt_size.next,
@@ -214,8 +232,8 @@ pub mod reader {
     pub fn docs<'a>(d: Doc<'a>, it: |uint, Doc<'a>| -> bool) -> bool {
         let mut pos = d.start;
         while pos < d.end {
-            let elt_tag = vuint_at(d.data, pos);
-            let elt_size = vuint_at(d.data, elt_tag.next);
+            let elt_tag = try_or!(vuint_at(d.data, pos), false);
+            let elt_size = try_or!(vuint_at(d.data, elt_tag.next), false);
             pos = elt_size.next + elt_size.val;
             let doc = Doc { data: d.data, start: elt_size.next, end: pos };
             if !it(elt_tag.val, doc) {
@@ -228,8 +246,8 @@ pub mod reader {
     pub fn tagged_docs<'a>(d: Doc<'a>, tg: uint, it: |Doc<'a>| -> bool) -> bool {
         let mut pos = d.start;
         while pos < d.end {
-            let elt_tag = vuint_at(d.data, pos);
-            let elt_size = vuint_at(d.data, elt_tag.next);
+            let elt_tag = try_or!(vuint_at(d.data, pos), false);
+            let elt_size = try_or!(vuint_at(d.data, elt_tag.next), false);
             pos = elt_size.next + elt_size.val;
             if elt_tag.val == tg {
                 let doc = Doc { data: d.data, start: elt_size.next,
@@ -273,8 +291,8 @@ pub mod reader {
     pub fn doc_as_i64(d: Doc) -> i64 { doc_as_u64(d) as i64 }
 
     pub struct Decoder<'a> {
-        priv parent: Doc<'a>,
-        priv pos: uint,
+        parent: Doc<'a>,
+        pos: uint,
     }
 
     pub fn Decoder<'a>(d: Doc<'a>) -> Decoder<'a> {
@@ -285,28 +303,29 @@ pub mod reader {
     }
 
     impl<'doc> Decoder<'doc> {
-        fn _check_label(&mut self, lbl: &str) {
+        fn _check_label(&mut self, lbl: &str) -> DecodeResult<()> {
             if self.pos < self.parent.end {
                 let TaggedDoc { tag: r_tag, doc: r_doc } =
-                    doc_at(self.parent.data, self.pos);
+                    try!(doc_at(self.parent.data, self.pos));
 
                 if r_tag == (EsLabel as uint) {
                     self.pos = r_doc.end;
                     let str = r_doc.as_str_slice();
                     if lbl != str {
-                        fail!("Expected label {} but found {}", lbl, str);
+                        return Err(Expected(format!("Expected label {} but found {}", lbl, str)));
                     }
                 }
             }
+            Ok(())
         }
 
-        fn next_doc(&mut self, exp_tag: EbmlEncoderTag) -> Doc<'doc> {
+        fn next_doc(&mut self, exp_tag: EbmlEncoderTag) -> DecodeResult<Doc<'doc>> {
             debug!(". next_doc(exp_tag={:?})", exp_tag);
             if self.pos >= self.parent.end {
-                fail!("no more documents in current node!");
+                return Err(Expected(format!("no more documents in current node!")));
             }
             let TaggedDoc { tag: r_tag, doc: r_doc } =
-                doc_at(self.parent.data, self.pos);
+                try!(doc_at(self.parent.data, self.pos));
             debug!("self.parent={}-{} self.pos={} r_tag={} r_doc={}-{}",
                    self.parent.start,
                    self.parent.end,
@@ -315,178 +334,183 @@ pub mod reader {
                    r_doc.start,
                    r_doc.end);
             if r_tag != (exp_tag as uint) {
-                fail!("expected EBML doc with tag {:?} but found tag {:?}",
-                       exp_tag, r_tag);
+                return Err(Expected(format!("expected EBML doc with tag {:?} but found tag {:?}",
+                       exp_tag, r_tag)));
             }
             if r_doc.end > self.parent.end {
-                fail!("invalid EBML, child extends to {:#x}, parent to {:#x}",
-                      r_doc.end, self.parent.end);
+                return Err(Expected(format!("invalid EBML, child extends to {:#x}, parent to {:#x}",
+                      r_doc.end, self.parent.end)));
             }
             self.pos = r_doc.end;
-            r_doc
+            Ok(r_doc)
         }
 
         fn push_doc<T>(&mut self, exp_tag: EbmlEncoderTag,
-                       f: |&mut Decoder<'doc>| -> T) -> T {
-            let d = self.next_doc(exp_tag);
+                       f: |&mut Decoder<'doc>| -> DecodeResult<T>) -> DecodeResult<T> {
+            let d = try!(self.next_doc(exp_tag));
             let old_parent = self.parent;
             let old_pos = self.pos;
             self.parent = d;
             self.pos = d.start;
-            let r = f(self);
+            let r = try!(f(self));
             self.parent = old_parent;
             self.pos = old_pos;
-            r
+            Ok(r)
         }
 
-        fn _next_uint(&mut self, exp_tag: EbmlEncoderTag) -> uint {
-            let r = doc_as_u32(self.next_doc(exp_tag));
+        fn _next_uint(&mut self, exp_tag: EbmlEncoderTag) -> DecodeResult<uint> {
+            let r = doc_as_u32(try!(self.next_doc(exp_tag)));
             debug!("_next_uint exp_tag={:?} result={}", exp_tag, r);
-            r as uint
+            Ok(r as uint)
         }
 
-        pub fn read_opaque<R>(&mut self, op: |&mut Decoder<'doc>, Doc| -> R) -> R {
-            let doc = self.next_doc(EsOpaque);
+        pub fn read_opaque<R>(&mut self,
+                              op: |&mut Decoder<'doc>, Doc| -> DecodeResult<R>) -> DecodeResult<R> {
+            let doc = try!(self.next_doc(EsOpaque));
 
             let (old_parent, old_pos) = (self.parent, self.pos);
             self.parent = doc;
             self.pos = doc.start;
 
-            let result = op(self, doc);
+            let result = try!(op(self, doc));
 
             self.parent = old_parent;
             self.pos = old_pos;
-            result
+            Ok(result)
         }
     }
 
-    impl<'doc> serialize::Decoder for Decoder<'doc> {
-        fn read_nil(&mut self) -> () { () }
+    impl<'doc> serialize::Decoder<Error> for Decoder<'doc> {
+        fn read_nil(&mut self) -> DecodeResult<()> { Ok(()) }
 
-        fn read_u64(&mut self) -> u64 { doc_as_u64(self.next_doc(EsU64)) }
-        fn read_u32(&mut self) -> u32 { doc_as_u32(self.next_doc(EsU32)) }
-        fn read_u16(&mut self) -> u16 { doc_as_u16(self.next_doc(EsU16)) }
-        fn read_u8 (&mut self) -> u8  { doc_as_u8 (self.next_doc(EsU8 )) }
-        fn read_uint(&mut self) -> uint {
-            let v = doc_as_u64(self.next_doc(EsUint));
+        fn read_u64(&mut self) -> DecodeResult<u64> { Ok(doc_as_u64(try!(self.next_doc(EsU64)))) }
+        fn read_u32(&mut self) -> DecodeResult<u32> { Ok(doc_as_u32(try!(self.next_doc(EsU32)))) }
+        fn read_u16(&mut self) -> DecodeResult<u16> { Ok(doc_as_u16(try!(self.next_doc(EsU16)))) }
+        fn read_u8 (&mut self) -> DecodeResult<u8 > { Ok(doc_as_u8 (try!(self.next_doc(EsU8 )))) }
+        fn read_uint(&mut self) -> DecodeResult<uint> {
+            let v = doc_as_u64(try!(self.next_doc(EsUint)));
             if v > (::std::uint::MAX as u64) {
-                fail!("uint {} too large for this architecture", v);
+                Err(IntTooBig(v as uint))
+            } else {
+                Ok(v as uint)
             }
-            v as uint
         }
 
-        fn read_i64(&mut self) -> i64 {
-            doc_as_u64(self.next_doc(EsI64)) as i64
+        fn read_i64(&mut self) -> DecodeResult<i64> {
+            Ok(doc_as_u64(try!(self.next_doc(EsI64))) as i64)
         }
-        fn read_i32(&mut self) -> i32 {
-            doc_as_u32(self.next_doc(EsI32)) as i32
+        fn read_i32(&mut self) -> DecodeResult<i32> {
+            Ok(doc_as_u32(try!(self.next_doc(EsI32))) as i32)
         }
-        fn read_i16(&mut self) -> i16 {
-            doc_as_u16(self.next_doc(EsI16)) as i16
+        fn read_i16(&mut self) -> DecodeResult<i16> {
+            Ok(doc_as_u16(try!(self.next_doc(EsI16))) as i16)
         }
-        fn read_i8 (&mut self) -> i8 {
-            doc_as_u8(self.next_doc(EsI8 )) as i8
+        fn read_i8 (&mut self) -> DecodeResult<i8> {
+            Ok(doc_as_u8(try!(self.next_doc(EsI8 ))) as i8)
         }
-        fn read_int(&mut self) -> int {
-            let v = doc_as_u64(self.next_doc(EsInt)) as i64;
+        fn read_int(&mut self) -> DecodeResult<int> {
+            let v = doc_as_u64(try!(self.next_doc(EsInt))) as i64;
             if v > (int::MAX as i64) || v < (int::MIN as i64) {
                 debug!("FIXME \\#6122: Removing this makes this function miscompile");
-                fail!("int {} out of range for this architecture", v);
+                Err(IntTooBig(v as uint))
+            } else {
+                Ok(v as int)
             }
-            v as int
         }
 
-        fn read_bool(&mut self) -> bool {
-            doc_as_u8(self.next_doc(EsBool)) != 0
+        fn read_bool(&mut self) -> DecodeResult<bool> {
+            Ok(doc_as_u8(try!(self.next_doc(EsBool))) != 0)
         }
 
-        fn read_f64(&mut self) -> f64 {
-            let bits = doc_as_u64(self.next_doc(EsF64));
-            unsafe { transmute(bits) }
+        fn read_f64(&mut self) -> DecodeResult<f64> {
+            let bits = doc_as_u64(try!(self.next_doc(EsF64)));
+            Ok(unsafe { transmute(bits) })
         }
-        fn read_f32(&mut self) -> f32 {
-            let bits = doc_as_u32(self.next_doc(EsF32));
-            unsafe { transmute(bits) }
+        fn read_f32(&mut self) -> DecodeResult<f32> {
+            let bits = doc_as_u32(try!(self.next_doc(EsF32)));
+            Ok(unsafe { transmute(bits) })
         }
-        fn read_char(&mut self) -> char {
-            char::from_u32(doc_as_u32(self.next_doc(EsChar))).unwrap()
+        fn read_char(&mut self) -> DecodeResult<char> {
+            Ok(char::from_u32(doc_as_u32(try!(self.next_doc(EsChar)))).unwrap())
         }
-        fn read_str(&mut self) -> ~str {
-            self.next_doc(EsStr).as_str()
+        fn read_str(&mut self) -> DecodeResult<~str> {
+            Ok(try!(self.next_doc(EsStr)).as_str())
         }
 
         // Compound types:
-        fn read_enum<T>(&mut self, name: &str, f: |&mut Decoder<'doc>| -> T) -> T {
+        fn read_enum<T>(&mut self,
+                        name: &str,
+                        f: |&mut Decoder<'doc>| -> DecodeResult<T>) -> DecodeResult<T> {
             debug!("read_enum({})", name);
-            self._check_label(name);
+            try!(self._check_label(name));
 
-            let doc = self.next_doc(EsEnum);
+            let doc = try!(self.next_doc(EsEnum));
 
             let (old_parent, old_pos) = (self.parent, self.pos);
             self.parent = doc;
             self.pos = self.parent.start;
 
-            let result = f(self);
+            let result = try!(f(self));
 
             self.parent = old_parent;
             self.pos = old_pos;
-            result
+            Ok(result)
         }
 
         fn read_enum_variant<T>(&mut self,
                                 _: &[&str],
-                                f: |&mut Decoder<'doc>, uint| -> T)
-                                -> T {
+                                f: |&mut Decoder<'doc>, uint| -> DecodeResult<T>)
+                                -> DecodeResult<T> {
             debug!("read_enum_variant()");
-            let idx = self._next_uint(EsEnumVid);
+            let idx = try!(self._next_uint(EsEnumVid));
             debug!("  idx={}", idx);
 
-            let doc = self.next_doc(EsEnumBody);
+            let doc = try!(self.next_doc(EsEnumBody));
 
             let (old_parent, old_pos) = (self.parent, self.pos);
             self.parent = doc;
             self.pos = self.parent.start;
 
-            let result = f(self, idx);
+            let result = try!(f(self, idx));
 
             self.parent = old_parent;
             self.pos = old_pos;
-            result
+            Ok(result)
         }
 
         fn read_enum_variant_arg<T>(&mut self,
                                     idx: uint,
-                                    f: |&mut Decoder<'doc>| -> T) -> T {
+                                    f: |&mut Decoder<'doc>| -> DecodeResult<T>) -> DecodeResult<T> {
             debug!("read_enum_variant_arg(idx={})", idx);
             f(self)
         }
 
         fn read_enum_struct_variant<T>(&mut self,
                                        _: &[&str],
-                                       f: |&mut Decoder<'doc>, uint| -> T)
-                                       -> T {
+                                       f: |&mut Decoder<'doc>, uint| -> DecodeResult<T>)
+                                       -> DecodeResult<T> {
             debug!("read_enum_struct_variant()");
-            let idx = self._next_uint(EsEnumVid);
+            let idx = try!(self._next_uint(EsEnumVid));
             debug!("  idx={}", idx);
 
-            let doc = self.next_doc(EsEnumBody);
+            let doc = try!(self.next_doc(EsEnumBody));
 
             let (old_parent, old_pos) = (self.parent, self.pos);
             self.parent = doc;
             self.pos = self.parent.start;
 
-            let result = f(self, idx);
+            let result = try!(f(self, idx));
 
             self.parent = old_parent;
             self.pos = old_pos;
-            result
+            Ok(result)
         }
 
         fn read_enum_struct_variant_field<T>(&mut self,
                                              name: &str,
                                              idx: uint,
-                                             f: |&mut Decoder<'doc>| -> T)
-                                             -> T {
+                                             f: |&mut Decoder<'doc>| -> DecodeResult<T>)
+                                             -> DecodeResult<T> {
             debug!("read_enum_struct_variant_arg(name={}, idx={})", name, idx);
             f(self)
         }
@@ -494,8 +518,8 @@ pub mod reader {
         fn read_struct<T>(&mut self,
                           name: &str,
                           _: uint,
-                          f: |&mut Decoder<'doc>| -> T)
-                          -> T {
+                          f: |&mut Decoder<'doc>| -> DecodeResult<T>)
+                          -> DecodeResult<T> {
             debug!("read_struct(name={})", name);
             f(self)
         }
@@ -503,85 +527,89 @@ pub mod reader {
         fn read_struct_field<T>(&mut self,
                                 name: &str,
                                 idx: uint,
-                                f: |&mut Decoder<'doc>| -> T)
-                                -> T {
+                                f: |&mut Decoder<'doc>| -> DecodeResult<T>)
+                                -> DecodeResult<T> {
             debug!("read_struct_field(name={}, idx={})", name, idx);
-            self._check_label(name);
+            try!(self._check_label(name));
             f(self)
         }
 
-        fn read_tuple<T>(&mut self, f: |&mut Decoder<'doc>, uint| -> T) -> T {
+        fn read_tuple<T>(&mut self,
+                         f: |&mut Decoder<'doc>, uint| -> DecodeResult<T>) -> DecodeResult<T> {
             debug!("read_tuple()");
             self.read_seq(f)
         }
 
-        fn read_tuple_arg<T>(&mut self, idx: uint, f: |&mut Decoder<'doc>| -> T)
-                             -> T {
+        fn read_tuple_arg<T>(&mut self, idx: uint, f: |&mut Decoder<'doc>| -> DecodeResult<T>)
+                             -> DecodeResult<T> {
             debug!("read_tuple_arg(idx={})", idx);
             self.read_seq_elt(idx, f)
         }
 
         fn read_tuple_struct<T>(&mut self,
                                 name: &str,
-                                f: |&mut Decoder<'doc>, uint| -> T)
-                                -> T {
+                                f: |&mut Decoder<'doc>, uint| -> DecodeResult<T>)
+                                -> DecodeResult<T> {
             debug!("read_tuple_struct(name={})", name);
             self.read_tuple(f)
         }
 
         fn read_tuple_struct_arg<T>(&mut self,
                                     idx: uint,
-                                    f: |&mut Decoder<'doc>| -> T)
-                                    -> T {
+                                    f: |&mut Decoder<'doc>| -> DecodeResult<T>)
+                                    -> DecodeResult<T> {
             debug!("read_tuple_struct_arg(idx={})", idx);
             self.read_tuple_arg(idx, f)
         }
 
-        fn read_option<T>(&mut self, f: |&mut Decoder<'doc>, bool| -> T) -> T {
+        fn read_option<T>(&mut self,
+                          f: |&mut Decoder<'doc>, bool| -> DecodeResult<T>) -> DecodeResult<T> {
             debug!("read_option()");
             self.read_enum("Option", |this| {
                 this.read_enum_variant(["None", "Some"], |this, idx| {
                     match idx {
                         0 => f(this, false),
                         1 => f(this, true),
-                        _ => fail!(),
+                        _ => Err(Expected(format!("Expected None or Some"))),
                     }
                 })
             })
         }
 
-        fn read_seq<T>(&mut self, f: |&mut Decoder<'doc>, uint| -> T) -> T {
+        fn read_seq<T>(&mut self,
+                       f: |&mut Decoder<'doc>, uint| -> DecodeResult<T>) -> DecodeResult<T> {
             debug!("read_seq()");
             self.push_doc(EsVec, |d| {
-                let len = d._next_uint(EsVecLen);
+                let len = try!(d._next_uint(EsVecLen));
                 debug!("  len={}", len);
                 f(d, len)
             })
         }
 
-        fn read_seq_elt<T>(&mut self, idx: uint, f: |&mut Decoder<'doc>| -> T)
-                           -> T {
+        fn read_seq_elt<T>(&mut self, idx: uint, f: |&mut Decoder<'doc>| -> DecodeResult<T>)
+                           -> DecodeResult<T> {
             debug!("read_seq_elt(idx={})", idx);
             self.push_doc(EsVecElt, f)
         }
 
-        fn read_map<T>(&mut self, f: |&mut Decoder<'doc>, uint| -> T) -> T {
+        fn read_map<T>(&mut self,
+                       f: |&mut Decoder<'doc>, uint| -> DecodeResult<T>) -> DecodeResult<T> {
             debug!("read_map()");
             self.push_doc(EsMap, |d| {
-                let len = d._next_uint(EsMapLen);
+                let len = try!(d._next_uint(EsMapLen));
                 debug!("  len={}", len);
                 f(d, len)
             })
         }
 
-        fn read_map_elt_key<T>(&mut self, idx: uint, f: |&mut Decoder<'doc>| -> T)
-                               -> T {
+        fn read_map_elt_key<T>(&mut self, idx: uint, f: |&mut Decoder<'doc>| -> DecodeResult<T>)
+                               -> DecodeResult<T> {
             debug!("read_map_elt_key(idx={})", idx);
             self.push_doc(EsMapKey, f)
         }
 
-        fn read_map_elt_val<T>(&mut self, idx: uint, f: |&mut Decoder<'doc>| -> T)
-                               -> T {
+        fn read_map_elt_val<T>(&mut self, idx: uint, f: |&mut Decoder<'doc>| -> DecodeResult<T>)
+                               -> DecodeResult<T> {
             debug!("read_map_elt_val(idx={})", idx);
             self.push_doc(EsMapVal, f)
         }
@@ -593,7 +621,6 @@ pub mod writer {
     use std::clone::Clone;
     use std::io;
     use std::io::{Writer, Seek};
-    use std::io::MemWriter;
     use std::io::extensions::u64_to_be_bytes;
 
     use super::{ EsVec, EsMap, EsEnum, EsVecLen, EsVecElt, EsMapLen, EsMapKey,
@@ -603,20 +630,16 @@ pub mod writer {
 
     use serialize;
 
+
+    pub type EncodeResult = io::IoResult<()>;
+
     // ebml writing
-    pub struct Encoder<'a> {
-        // FIXME(#5665): this should take a trait object. Note that if you
-        //               delete this comment you should consider removing the
-        //               unwrap()'s below of the results of the calls to
-        //               write(). We're guaranteed that writing into a MemWriter
-        //               won't fail, but this is not true for all I/O streams in
-        //               general.
-        writer: &'a mut MemWriter,
-        priv size_positions: ~[uint],
-        last_error: io::IoResult<()>,
+    pub struct Encoder<'a, W> {
+        pub writer: &'a mut W,
+        size_positions: ~[uint],
     }
 
-    fn write_sized_vuint(w: &mut MemWriter, n: uint, size: uint) {
+    fn write_sized_vuint<W: Writer>(w: &mut W, n: uint, size: uint) -> EncodeResult {
         match size {
             1u => w.write(&[0x80u8 | (n as u8)]),
             2u => w.write(&[0x40u8 | ((n >> 8_u) as u8), n as u8]),
@@ -624,129 +647,136 @@ pub mod writer {
                             n as u8]),
             4u => w.write(&[0x10u8 | ((n >> 24_u) as u8), (n >> 16_u) as u8,
                             (n >> 8_u) as u8, n as u8]),
-            _ => fail!("vint to write too big: {}", n)
-        }.unwrap()
+            _ => Err(io::IoError {
+                kind: io::OtherIoError,
+                desc: "int too big",
+                detail: Some(format!("{}", n))
+            })
+        }
     }
 
-    fn write_vuint(w: &mut MemWriter, n: uint) {
-        if n < 0x7f_u { write_sized_vuint(w, n, 1u); return; }
-        if n < 0x4000_u { write_sized_vuint(w, n, 2u); return; }
-        if n < 0x200000_u { write_sized_vuint(w, n, 3u); return; }
-        if n < 0x10000000_u { write_sized_vuint(w, n, 4u); return; }
-        fail!("vint to write too big: {}", n);
+    fn write_vuint<W: Writer>(w: &mut W, n: uint) -> EncodeResult {
+        if n < 0x7f_u { return write_sized_vuint(w, n, 1u); }
+        if n < 0x4000_u { return write_sized_vuint(w, n, 2u); }
+        if n < 0x200000_u { return write_sized_vuint(w, n, 3u); }
+        if n < 0x10000000_u { return write_sized_vuint(w, n, 4u); }
+        Err(io::IoError {
+            kind: io::OtherIoError,
+            desc: "int too big",
+            detail: Some(format!("{}", n))
+        })
     }
 
-    pub fn Encoder<'a>(w: &'a mut MemWriter) -> Encoder<'a> {
+    pub fn Encoder<'a, W: Writer + Seek>(w: &'a mut W) -> Encoder<'a, W> {
         let size_positions: ~[uint] = ~[];
         Encoder {
             writer: w,
             size_positions: size_positions,
-            last_error: Ok(()),
         }
     }
 
     // FIXME (#2741): Provide a function to write the standard ebml header.
-    impl<'a> Encoder<'a> {
+    impl<'a, W: Writer + Seek> Encoder<'a, W> {
         /// FIXME(pcwalton): Workaround for badness in trans. DO NOT USE ME.
-        pub unsafe fn unsafe_clone(&self) -> Encoder<'a> {
+        pub unsafe fn unsafe_clone(&self) -> Encoder<'a, W> {
             Encoder {
                 writer: cast::transmute_copy(&self.writer),
                 size_positions: self.size_positions.clone(),
-                last_error: Ok(()),
             }
         }
 
-        pub fn start_tag(&mut self, tag_id: uint) {
+        pub fn start_tag(&mut self, tag_id: uint) -> EncodeResult {
             debug!("Start tag {}", tag_id);
 
             // Write the enum ID:
-            write_vuint(self.writer, tag_id);
+            try!(write_vuint(self.writer, tag_id));
 
             // Write a placeholder four-byte size.
             self.size_positions.push(try!(self.writer.tell()) as uint);
             let zeroes: &[u8] = &[0u8, 0u8, 0u8, 0u8];
-            try!(self.writer.write(zeroes));
+            self.writer.write(zeroes)
         }
 
-        pub fn end_tag(&mut self) {
+        pub fn end_tag(&mut self) -> EncodeResult {
             let last_size_pos = self.size_positions.pop().unwrap();
             let cur_pos = try!(self.writer.tell());
             try!(self.writer.seek(last_size_pos as i64, io::SeekSet));
             let size = cur_pos as uint - last_size_pos - 4;
-            write_sized_vuint(self.writer, size, 4u);
-            try!(self.writer.seek(cur_pos as i64, io::SeekSet));
+            try!(write_sized_vuint(self.writer, size, 4u));
+            let r = try!(self.writer.seek(cur_pos as i64, io::SeekSet));
 
             debug!("End tag (size = {})", size);
+            Ok(r)
         }
 
-        pub fn wr_tag(&mut self, tag_id: uint, blk: ||) {
-            self.start_tag(tag_id);
-            blk();
-            self.end_tag();
+        pub fn wr_tag(&mut self, tag_id: uint, blk: || -> EncodeResult) -> EncodeResult {
+            try!(self.start_tag(tag_id));
+            try!(blk());
+            self.end_tag()
         }
 
-        pub fn wr_tagged_bytes(&mut self, tag_id: uint, b: &[u8]) {
-            write_vuint(self.writer, tag_id);
-            write_vuint(self.writer, b.len());
-            self.writer.write(b).unwrap();
+        pub fn wr_tagged_bytes(&mut self, tag_id: uint, b: &[u8]) -> EncodeResult {
+            try!(write_vuint(self.writer, tag_id));
+            try!(write_vuint(self.writer, b.len()));
+            self.writer.write(b)
         }
 
-        pub fn wr_tagged_u64(&mut self, tag_id: uint, v: u64) {
+        pub fn wr_tagged_u64(&mut self, tag_id: uint, v: u64) -> EncodeResult {
             u64_to_be_bytes(v, 8u, |v| {
-                self.wr_tagged_bytes(tag_id, v);
+                self.wr_tagged_bytes(tag_id, v)
             })
         }
 
-        pub fn wr_tagged_u32(&mut self, tag_id: uint, v: u32) {
+        pub fn wr_tagged_u32(&mut self, tag_id: uint, v: u32)  -> EncodeResult{
             u64_to_be_bytes(v as u64, 4u, |v| {
-                self.wr_tagged_bytes(tag_id, v);
+                self.wr_tagged_bytes(tag_id, v)
             })
         }
 
-        pub fn wr_tagged_u16(&mut self, tag_id: uint, v: u16) {
+        pub fn wr_tagged_u16(&mut self, tag_id: uint, v: u16) -> EncodeResult {
             u64_to_be_bytes(v as u64, 2u, |v| {
-                self.wr_tagged_bytes(tag_id, v);
+                self.wr_tagged_bytes(tag_id, v)
             })
         }
 
-        pub fn wr_tagged_u8(&mut self, tag_id: uint, v: u8) {
-            self.wr_tagged_bytes(tag_id, &[v]);
+        pub fn wr_tagged_u8(&mut self, tag_id: uint, v: u8) -> EncodeResult {
+            self.wr_tagged_bytes(tag_id, &[v])
         }
 
-        pub fn wr_tagged_i64(&mut self, tag_id: uint, v: i64) {
+        pub fn wr_tagged_i64(&mut self, tag_id: uint, v: i64) -> EncodeResult {
             u64_to_be_bytes(v as u64, 8u, |v| {
-                self.wr_tagged_bytes(tag_id, v);
+                self.wr_tagged_bytes(tag_id, v)
             })
         }
 
-        pub fn wr_tagged_i32(&mut self, tag_id: uint, v: i32) {
+        pub fn wr_tagged_i32(&mut self, tag_id: uint, v: i32) -> EncodeResult {
             u64_to_be_bytes(v as u64, 4u, |v| {
-                self.wr_tagged_bytes(tag_id, v);
+                self.wr_tagged_bytes(tag_id, v)
             })
         }
 
-        pub fn wr_tagged_i16(&mut self, tag_id: uint, v: i16) {
+        pub fn wr_tagged_i16(&mut self, tag_id: uint, v: i16) -> EncodeResult {
             u64_to_be_bytes(v as u64, 2u, |v| {
-                self.wr_tagged_bytes(tag_id, v);
+                self.wr_tagged_bytes(tag_id, v)
             })
         }
 
-        pub fn wr_tagged_i8(&mut self, tag_id: uint, v: i8) {
-            self.wr_tagged_bytes(tag_id, &[v as u8]);
+        pub fn wr_tagged_i8(&mut self, tag_id: uint, v: i8) -> EncodeResult {
+            self.wr_tagged_bytes(tag_id, &[v as u8])
         }
 
-        pub fn wr_tagged_str(&mut self, tag_id: uint, v: &str) {
-            self.wr_tagged_bytes(tag_id, v.as_bytes());
+        pub fn wr_tagged_str(&mut self, tag_id: uint, v: &str) -> EncodeResult {
+            self.wr_tagged_bytes(tag_id, v.as_bytes())
         }
 
-        pub fn wr_bytes(&mut self, b: &[u8]) {
+        pub fn wr_bytes(&mut self, b: &[u8]) -> EncodeResult {
             debug!("Write {} bytes", b.len());
-            self.writer.write(b).unwrap();
+            self.writer.write(b)
         }
 
-        pub fn wr_str(&mut self, s: &str) {
+        pub fn wr_str(&mut self, s: &str) -> EncodeResult {
             debug!("Write str: {}", s);
-            self.writer.write(s.as_bytes()).unwrap();
+            self.writer.write(s.as_bytes())
         }
     }
 
@@ -757,14 +787,14 @@ pub mod writer {
     // Totally lame approach.
     static DEBUG: bool = true;
 
-    impl<'a> Encoder<'a> {
+    impl<'a, W: Writer + Seek> Encoder<'a, W> {
         // used internally to emit things like the vector length and so on
-        fn _emit_tagged_uint(&mut self, t: EbmlEncoderTag, v: uint) {
+        fn _emit_tagged_uint(&mut self, t: EbmlEncoderTag, v: uint) -> EncodeResult {
             assert!(v <= 0xFFFF_FFFF_u);
-            self.wr_tagged_u32(t as uint, v as u32);
+            self.wr_tagged_u32(t as uint, v as u32)
         }
 
-        fn _emit_label(&mut self, label: &str) {
+        fn _emit_label(&mut self, label: &str) -> EncodeResult {
             // There are various strings that we have access to, such as
             // the name of a record field, which do not actually appear in
             // the encoded EBML (normally).  This is just for
@@ -772,89 +802,96 @@ pub mod writer {
             // labels and then they will be checked by decoder to
             // try and check failures more quickly.
             if DEBUG { self.wr_tagged_str(EsLabel as uint, label) }
+            else { Ok(()) }
         }
 
-        pub fn emit_opaque(&mut self, f: |&mut Encoder|) {
-            self.start_tag(EsOpaque as uint);
-            f(self);
-            self.end_tag();
+        pub fn emit_opaque(&mut self, f: |&mut Encoder<W>| -> EncodeResult) -> EncodeResult {
+            try!(self.start_tag(EsOpaque as uint));
+            try!(f(self));
+            self.end_tag()
         }
     }
 
-    impl<'a> serialize::Encoder for Encoder<'a> {
-        fn emit_nil(&mut self) {}
+    impl<'a, W: Writer + Seek> serialize::Encoder<io::IoError> for Encoder<'a, W> {
+        fn emit_nil(&mut self) -> EncodeResult {
+            Ok(())
+        }
 
-        fn emit_uint(&mut self, v: uint) {
-            self.wr_tagged_u64(EsUint as uint, v as u64);
+        fn emit_uint(&mut self, v: uint) -> EncodeResult {
+            self.wr_tagged_u64(EsUint as uint, v as u64)
         }
-        fn emit_u64(&mut self, v: u64) {
-            self.wr_tagged_u64(EsU64 as uint, v);
+        fn emit_u64(&mut self, v: u64) -> EncodeResult {
+            self.wr_tagged_u64(EsU64 as uint, v)
         }
-        fn emit_u32(&mut self, v: u32) {
-            self.wr_tagged_u32(EsU32 as uint, v);
+        fn emit_u32(&mut self, v: u32) -> EncodeResult {
+            self.wr_tagged_u32(EsU32 as uint, v)
         }
-        fn emit_u16(&mut self, v: u16) {
-            self.wr_tagged_u16(EsU16 as uint, v);
+        fn emit_u16(&mut self, v: u16) -> EncodeResult {
+            self.wr_tagged_u16(EsU16 as uint, v)
         }
-        fn emit_u8(&mut self, v: u8) {
-            self.wr_tagged_u8(EsU8 as uint, v);
+        fn emit_u8(&mut self, v: u8) -> EncodeResult {
+            self.wr_tagged_u8(EsU8 as uint, v)
         }
 
-        fn emit_int(&mut self, v: int) {
-            self.wr_tagged_i64(EsInt as uint, v as i64);
+        fn emit_int(&mut self, v: int) -> EncodeResult {
+            self.wr_tagged_i64(EsInt as uint, v as i64)
         }
-        fn emit_i64(&mut self, v: i64) {
-            self.wr_tagged_i64(EsI64 as uint, v);
+        fn emit_i64(&mut self, v: i64) -> EncodeResult {
+            self.wr_tagged_i64(EsI64 as uint, v)
         }
-        fn emit_i32(&mut self, v: i32) {
-            self.wr_tagged_i32(EsI32 as uint, v);
+        fn emit_i32(&mut self, v: i32) -> EncodeResult {
+            self.wr_tagged_i32(EsI32 as uint, v)
         }
-        fn emit_i16(&mut self, v: i16) {
-            self.wr_tagged_i16(EsI16 as uint, v);
+        fn emit_i16(&mut self, v: i16) -> EncodeResult {
+            self.wr_tagged_i16(EsI16 as uint, v)
         }
-        fn emit_i8(&mut self, v: i8) {
-            self.wr_tagged_i8(EsI8 as uint, v);
+        fn emit_i8(&mut self, v: i8) -> EncodeResult {
+            self.wr_tagged_i8(EsI8 as uint, v)
         }
 
-        fn emit_bool(&mut self, v: bool) {
+        fn emit_bool(&mut self, v: bool) -> EncodeResult {
             self.wr_tagged_u8(EsBool as uint, v as u8)
         }
 
-        fn emit_f64(&mut self, v: f64) {
+        fn emit_f64(&mut self, v: f64) -> EncodeResult {
             let bits = unsafe { cast::transmute(v) };
-            self.wr_tagged_u64(EsF64 as uint, bits);
+            self.wr_tagged_u64(EsF64 as uint, bits)
         }
-        fn emit_f32(&mut self, v: f32) {
+        fn emit_f32(&mut self, v: f32) -> EncodeResult {
             let bits = unsafe { cast::transmute(v) };
-            self.wr_tagged_u32(EsF32 as uint, bits);
+            self.wr_tagged_u32(EsF32 as uint, bits)
         }
-        fn emit_char(&mut self, v: char) {
-            self.wr_tagged_u32(EsChar as uint, v as u32);
+        fn emit_char(&mut self, v: char) -> EncodeResult {
+            self.wr_tagged_u32(EsChar as uint, v as u32)
         }
 
-        fn emit_str(&mut self, v: &str) {
+        fn emit_str(&mut self, v: &str) -> EncodeResult {
             self.wr_tagged_str(EsStr as uint, v)
         }
 
-        fn emit_enum(&mut self, name: &str, f: |&mut Encoder<'a>|) {
-            self._emit_label(name);
-            self.start_tag(EsEnum as uint);
-            f(self);
-            self.end_tag();
+        fn emit_enum(&mut self,
+                     name: &str,
+                     f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
+            try!(self._emit_label(name));
+            try!(self.start_tag(EsEnum as uint));
+            try!(f(self));
+            self.end_tag()
         }
 
         fn emit_enum_variant(&mut self,
                              _: &str,
                              v_id: uint,
                              _: uint,
-                             f: |&mut Encoder<'a>|) {
-            self._emit_tagged_uint(EsEnumVid, v_id);
-            self.start_tag(EsEnumBody as uint);
-            f(self);
-            self.end_tag();
+                             f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
+            try!(self._emit_tagged_uint(EsEnumVid, v_id));
+            try!(self.start_tag(EsEnumBody as uint));
+            try!(f(self));
+            self.end_tag()
         }
 
-        fn emit_enum_variant_arg(&mut self, _: uint, f: |&mut Encoder<'a>|) {
+        fn emit_enum_variant_arg(&mut self,
+                                 _: uint,
+                                 f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
             f(self)
         }
 
@@ -862,91 +899,113 @@ pub mod writer {
                                     v_name: &str,
                                     v_id: uint,
                                     cnt: uint,
-                                    f: |&mut Encoder<'a>|) {
+                                    f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
             self.emit_enum_variant(v_name, v_id, cnt, f)
         }
 
         fn emit_enum_struct_variant_field(&mut self,
                                           _: &str,
                                           idx: uint,
-                                          f: |&mut Encoder<'a>|) {
+                                          f: |&mut Encoder<'a, W>| -> EncodeResult)
+            -> EncodeResult {
             self.emit_enum_variant_arg(idx, f)
         }
 
         fn emit_struct(&mut self,
                        _: &str,
                        _len: uint,
-                       f: |&mut Encoder<'a>|) {
+                       f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
             f(self)
         }
 
         fn emit_struct_field(&mut self,
                              name: &str,
                              _: uint,
-                             f: |&mut Encoder<'a>|) {
-            self._emit_label(name);
+                             f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
+            try!(self._emit_label(name));
             f(self)
         }
 
-        fn emit_tuple(&mut self, len: uint, f: |&mut Encoder<'a>|) {
+        fn emit_tuple(&mut self,
+                      len: uint,
+                      f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
             self.emit_seq(len, f)
         }
-        fn emit_tuple_arg(&mut self, idx: uint, f: |&mut Encoder<'a>|) {
+        fn emit_tuple_arg(&mut self,
+                          idx: uint,
+                          f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
             self.emit_seq_elt(idx, f)
         }
 
         fn emit_tuple_struct(&mut self,
                              _: &str,
                              len: uint,
-                             f: |&mut Encoder<'a>|) {
+                             f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
             self.emit_seq(len, f)
         }
         fn emit_tuple_struct_arg(&mut self,
                                  idx: uint,
-                                 f: |&mut Encoder<'a>|) {
+                                 f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
             self.emit_seq_elt(idx, f)
         }
 
-        fn emit_option(&mut self, f: |&mut Encoder<'a>|) {
-            self.emit_enum("Option", f);
+        fn emit_option(&mut self,
+                       f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
+            self.emit_enum("Option", f)
         }
-        fn emit_option_none(&mut self) {
-            self.emit_enum_variant("None", 0, 0, |_| ())
+        fn emit_option_none(&mut self) -> EncodeResult {
+            self.emit_enum_variant("None", 0, 0, |_| Ok(()))
         }
-        fn emit_option_some(&mut self, f: |&mut Encoder<'a>|) {
+        fn emit_option_some(&mut self,
+                            f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
+
             self.emit_enum_variant("Some", 1, 1, f)
         }
 
-        fn emit_seq(&mut self, len: uint, f: |&mut Encoder<'a>|) {
-            self.start_tag(EsVec as uint);
-            self._emit_tagged_uint(EsVecLen, len);
-            f(self);
-            self.end_tag();
+        fn emit_seq(&mut self,
+                    len: uint,
+                    f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
+
+            try!(self.start_tag(EsVec as uint));
+            try!(self._emit_tagged_uint(EsVecLen, len));
+            try!(f(self));
+            self.end_tag()
         }
 
-        fn emit_seq_elt(&mut self, _idx: uint, f: |&mut Encoder<'a>|) {
-            self.start_tag(EsVecElt as uint);
-            f(self);
-            self.end_tag();
+        fn emit_seq_elt(&mut self,
+                        _idx: uint,
+                        f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
+
+            try!(self.start_tag(EsVecElt as uint));
+            try!(f(self));
+            self.end_tag()
         }
 
-        fn emit_map(&mut self, len: uint, f: |&mut Encoder<'a>|) {
-            self.start_tag(EsMap as uint);
-            self._emit_tagged_uint(EsMapLen, len);
-            f(self);
-            self.end_tag();
+        fn emit_map(&mut self,
+                    len: uint,
+                    f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
+
+            try!(self.start_tag(EsMap as uint));
+            try!(self._emit_tagged_uint(EsMapLen, len));
+            try!(f(self));
+            self.end_tag()
         }
 
-        fn emit_map_elt_key(&mut self, _idx: uint, f: |&mut Encoder<'a>|) {
-            self.start_tag(EsMapKey as uint);
-            f(self);
-            self.end_tag();
+        fn emit_map_elt_key(&mut self,
+                            _idx: uint,
+                            f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
+
+            try!(self.start_tag(EsMapKey as uint));
+            try!(f(self));
+            self.end_tag()
         }
 
-        fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut Encoder<'a>|) {
-            self.start_tag(EsMapVal as uint);
-            f(self);
-            self.end_tag();
+        fn emit_map_elt_val(&mut self,
+                            _idx: uint,
+                            f: |&mut Encoder<'a, W>| -> EncodeResult) -> EncodeResult {
+            try!(self.start_tag(EsMapVal as uint));
+            try!(f(self));
+            self.end_tag()
         }
     }
 }
@@ -979,34 +1038,34 @@ mod tests {
         let mut res: reader::Res;
 
         // Class A
-        res = reader::vuint_at(data, 0);
+        res = reader::vuint_at(data, 0).unwrap();
         assert_eq!(res.val, 0);
         assert_eq!(res.next, 1);
-        res = reader::vuint_at(data, res.next);
+        res = reader::vuint_at(data, res.next).unwrap();
         assert_eq!(res.val, (1 << 7) - 1);
         assert_eq!(res.next, 2);
 
         // Class B
-        res = reader::vuint_at(data, res.next);
+        res = reader::vuint_at(data, res.next).unwrap();
         assert_eq!(res.val, 0);
         assert_eq!(res.next, 4);
-        res = reader::vuint_at(data, res.next);
+        res = reader::vuint_at(data, res.next).unwrap();
         assert_eq!(res.val, (1 << 14) - 1);
         assert_eq!(res.next, 6);
 
         // Class C
-        res = reader::vuint_at(data, res.next);
+        res = reader::vuint_at(data, res.next).unwrap();
         assert_eq!(res.val, 0);
         assert_eq!(res.next, 9);
-        res = reader::vuint_at(data, res.next);
+        res = reader::vuint_at(data, res.next).unwrap();
         assert_eq!(res.val, (1 << 21) - 1);
         assert_eq!(res.next, 12);
 
         // Class D
-        res = reader::vuint_at(data, res.next);
+        res = reader::vuint_at(data, res.next).unwrap();
         assert_eq!(res.val, 0);
         assert_eq!(res.next, 16);
-        res = reader::vuint_at(data, res.next);
+        res = reader::vuint_at(data, res.next).unwrap();
         assert_eq!(res.val, (1 << 28) - 1);
         assert_eq!(res.next, 20);
     }
@@ -1018,11 +1077,11 @@ mod tests {
             let mut wr = MemWriter::new();
             {
                 let mut ebml_w = writer::Encoder(&mut wr);
-                v.encode(&mut ebml_w);
+                let _ = v.encode(&mut ebml_w);
             }
             let ebml_doc = reader::Doc(wr.get_ref());
             let mut deser = reader::Decoder(ebml_doc);
-            let v1 = Decodable::decode(&mut deser);
+            let v1 = Decodable::decode(&mut deser).unwrap();
             debug!("v1 == {:?}", v1);
             assert_eq!(v, v1);
         }
@@ -1052,7 +1111,7 @@ mod bench {
         bh.iter(|| {
             let mut i = 0;
             while i < data.len() {
-                sum += reader::vuint_at(data, i).val;
+                sum += reader::vuint_at(data, i).unwrap().val;
                 i += 4;
             }
         });
@@ -1071,7 +1130,7 @@ mod bench {
         bh.iter(|| {
             let mut i = 1;
             while i < data.len() {
-                sum += reader::vuint_at(data, i).val;
+                sum += reader::vuint_at(data, i).unwrap().val;
                 i += 4;
             }
         });
@@ -1091,7 +1150,7 @@ mod bench {
         bh.iter(|| {
             let mut i = 0;
             while i < data.len() {
-                sum += reader::vuint_at(data, i).val;
+                sum += reader::vuint_at(data, i).unwrap().val;
                 i += 4;
             }
         });
@@ -1111,7 +1170,7 @@ mod bench {
         bh.iter(|| {
             let mut i = 1;
             while i < data.len() {
-                sum += reader::vuint_at(data, i).val;
+                sum += reader::vuint_at(data, i).unwrap().val;
                 i += 4;
             }
         });
diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs
index a95c77c7c13..e6658f3b367 100644
--- a/src/libserialize/hex.rs
+++ b/src/libserialize/hex.rs
@@ -41,8 +41,8 @@ impl<'a> ToHex for &'a [u8] {
     fn to_hex(&self) -> ~str {
         let mut v = slice::with_capacity(self.len() * 2);
         for &byte in self.iter() {
-            v.push(CHARS[byte >> 4]);
-            v.push(CHARS[byte & 0xf]);
+            v.push(CHARS[(byte >> 4) as uint]);
+            v.push(CHARS[(byte & 0xf) as uint]);
         }
 
         unsafe {
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index 9b93a62304c..2d3e6bc86eb 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -11,8 +11,8 @@
 // Rust JSON serialization library
 // Copyright (c) 2011 Google Inc.
 
-#[forbid(non_camel_case_types)];
-#[allow(missing_doc)];
+#![forbid(non_camel_case_types)]
+#![allow(missing_doc)]
 
 /*!
 JSON parsing and serialization
@@ -72,7 +72,10 @@ fn main() {
     let mut m = io::MemWriter::new();
     {
         let mut encoder = json::Encoder::new(&mut m as &mut std::io::Writer);
-        to_encode_object.encode(&mut encoder);
+        match to_encode_object.encode(&mut encoder) {
+            Ok(()) => (),
+            Err(e) => fail!("json encoding error: {}", e)
+        };
     }
 }
 ```
@@ -141,7 +144,10 @@ fn main() {
             ~"{\"attr1\":1,\"attr2\":\"toto\"}";
     let json_object = json::from_str(json_str_to_decode);
     let mut decoder = json::Decoder::new(json_object.unwrap());
-    let decoded_object: MyStruct = Decodable::decode(&mut decoder); // create the final object
+    let decoded_object: MyStruct = match Decodable::decode(&mut decoder) {
+        Ok(v) => v,
+        Err(e) => fail!("Decoding error: {}", e)
+    }; // create the final object
 }
 ```
 
@@ -174,7 +180,7 @@ fn main() {
 
     let json_object = json::from_str(encoded_str);
     let mut decoder = json::Decoder::new(json_object.unwrap());
-    let decoded1: TestStruct1 = Decodable::decode(&mut decoder); // create the final object
+    let decoded1: TestStruct1 = Decodable::decode(&mut decoder).unwrap(); // create the final object
 }
 ```
 
@@ -219,7 +225,7 @@ fn main() {
 
     let mut decoder = json::Decoder::new(json::from_str(json_str).unwrap());
     // create the final object
-    let decoded2: TestStruct1 = Decodable::decode(&mut decoder);
+    let decoded2: TestStruct1 = Decodable::decode(&mut decoder).unwrap();
 }
 ```
 
@@ -237,10 +243,6 @@ use std::fmt;
 use Encodable;
 use collections::TreeMap;
 
-macro_rules! try( ($e:expr) => (
-    match $e { Ok(e) => e, Err(e) => { self.error = Err(e); return } }
-) )
-
 /// Represents a json value
 #[deriving(Clone, Eq)]
 pub enum Json {
@@ -255,25 +257,18 @@ pub enum Json {
 pub type List = ~[Json];
 pub type Object = TreeMap<~str, Json>;
 
-#[deriving(Eq)]
-/// If an error occurs while parsing some JSON, this is the structure which is
-/// returned
-pub struct Error {
-    /// The line number at which the error occurred
-    priv line: uint,
-    /// The column number at which the error occurred
-    priv col: uint,
-    /// A message describing the type of the error
-    priv msg: ~str,
+#[deriving(Eq, Show)]
+pub enum Error {
+    /// msg, line, col
+    ParseError(~str, uint, uint),
+    ExpectedError(~str, ~str),
+    MissingFieldError(~str),
+    UnknownVariantError(~str),
+    IoError(io::IoError)
 }
 
-fn io_error_to_error(io: io::IoError) -> Error {
-    Error {
-        line: 0,
-        col: 0,
-        msg: format!("io error: {}", io)
-    }
-}
+pub type EncodeResult = io::IoResult<()>;
+pub type DecodeResult<T> = Result<T, Error>;
 
 fn escape_str(s: &str) -> ~str {
     let mut escaped = ~"\"";
@@ -303,184 +298,204 @@ fn spaces(n: uint) -> ~str {
 
 /// A structure for implementing serialization to JSON.
 pub struct Encoder<'a> {
-    priv wr: &'a mut io::Writer,
-    priv error: io::IoResult<()>,
+    wr: &'a mut io::Writer,
 }
 
 impl<'a> Encoder<'a> {
     /// Creates a new JSON encoder whose output will be written to the writer
     /// specified.
     pub fn new<'a>(wr: &'a mut io::Writer) -> Encoder<'a> {
-        Encoder { wr: wr, error: Ok(()) }
+        Encoder { wr: wr }
     }
 
     /// Encode the specified struct into a json [u8]
-    pub fn buffer_encode<T:Encodable<Encoder<'a>>>(to_encode_object: &T) -> ~[u8]  {
+    pub fn buffer_encode<T:Encodable<Encoder<'a>, io::IoError>>(to_encode_object: &T) -> ~[u8]  {
        //Serialize the object in a string using a writer
         let mut m = MemWriter::new();
         {
             let mut encoder = Encoder::new(&mut m as &mut io::Writer);
-            to_encode_object.encode(&mut encoder);
+            // MemWriter never Errs
+            let _ = to_encode_object.encode(&mut encoder);
         }
         m.unwrap()
     }
 
     /// Encode the specified struct into a json str
-    pub fn str_encode<T:Encodable<Encoder<'a>>>(to_encode_object: &T) -> ~str  {
+    pub fn str_encode<T:Encodable<Encoder<'a>, io::IoError>>(to_encode_object: &T) -> ~str  {
         let buff:~[u8] = Encoder::buffer_encode(to_encode_object);
         str::from_utf8_owned(buff).unwrap()
     }
 }
 
-impl<'a> ::Encoder for Encoder<'a> {
-    fn emit_nil(&mut self) { try!(write!(self.wr, "null")) }
+impl<'a> ::Encoder<io::IoError> for Encoder<'a> {
+    fn emit_nil(&mut self) -> EncodeResult { write!(self.wr, "null") }
 
-    fn emit_uint(&mut self, v: uint) { self.emit_f64(v as f64); }
-    fn emit_u64(&mut self, v: u64) { self.emit_f64(v as f64); }
-    fn emit_u32(&mut self, v: u32) { self.emit_f64(v as f64); }
-    fn emit_u16(&mut self, v: u16) { self.emit_f64(v as f64); }
-    fn emit_u8(&mut self, v: u8)   { self.emit_f64(v as f64); }
+    fn emit_uint(&mut self, v: uint) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_u64(&mut self, v: u64) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_u32(&mut self, v: u32) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_u16(&mut self, v: u16) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_u8(&mut self, v: u8) -> EncodeResult  { self.emit_f64(v as f64) }
 
-    fn emit_int(&mut self, v: int) { self.emit_f64(v as f64); }
-    fn emit_i64(&mut self, v: i64) { self.emit_f64(v as f64); }
-    fn emit_i32(&mut self, v: i32) { self.emit_f64(v as f64); }
-    fn emit_i16(&mut self, v: i16) { self.emit_f64(v as f64); }
-    fn emit_i8(&mut self, v: i8)   { self.emit_f64(v as f64); }
+    fn emit_int(&mut self, v: int) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_i64(&mut self, v: i64) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_i32(&mut self, v: i32) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_i16(&mut self, v: i16) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_i8(&mut self, v: i8) -> EncodeResult  { self.emit_f64(v as f64) }
 
-    fn emit_bool(&mut self, v: bool) {
+    fn emit_bool(&mut self, v: bool) -> EncodeResult {
         if v {
-            try!(write!(self.wr, "true"));
+            write!(self.wr, "true")
         } else {
-            try!(write!(self.wr, "false"));
+            write!(self.wr, "false")
         }
     }
 
-    fn emit_f64(&mut self, v: f64) {
-        try!(write!(self.wr, "{}", f64::to_str_digits(v, 6u)))
+    fn emit_f64(&mut self, v: f64) -> EncodeResult {
+        write!(self.wr, "{}", f64::to_str_digits(v, 6u))
     }
-    fn emit_f32(&mut self, v: f32) { self.emit_f64(v as f64); }
+    fn emit_f32(&mut self, v: f32) -> EncodeResult { self.emit_f64(v as f64) }
 
-    fn emit_char(&mut self, v: char) { self.emit_str(str::from_char(v)) }
-    fn emit_str(&mut self, v: &str) {
-        try!(write!(self.wr, "{}", escape_str(v)))
+    fn emit_char(&mut self, v: char) -> EncodeResult { self.emit_str(str::from_char(v)) }
+    fn emit_str(&mut self, v: &str) -> EncodeResult {
+        write!(self.wr, "{}", escape_str(v))
     }
 
-    fn emit_enum(&mut self, _name: &str, f: |&mut Encoder<'a>|) { f(self) }
+    fn emit_enum(&mut self,
+                 _name: &str,
+                 f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult { f(self) }
 
     fn emit_enum_variant(&mut self,
                          name: &str,
                          _id: uint,
                          cnt: uint,
-                         f: |&mut Encoder<'a>|) {
+                         f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         // enums are encoded as strings or objects
         // Bunny => "Bunny"
         // Kangaroo(34,"William") => {"variant": "Kangaroo", "fields": [34,"William"]}
         if cnt == 0 {
-            try!(write!(self.wr, "{}", escape_str(name)));
+            write!(self.wr, "{}", escape_str(name))
         } else {
             try!(write!(self.wr, "\\{\"variant\":"));
             try!(write!(self.wr, "{}", escape_str(name)));
             try!(write!(self.wr, ",\"fields\":["));
-            f(self);
-            try!(write!(self.wr, "]\\}"));
+            try!(f(self));
+            write!(self.wr, "]\\}")
         }
     }
 
-    fn emit_enum_variant_arg(&mut self, idx: uint, f: |&mut Encoder<'a>|) {
+    fn emit_enum_variant_arg(&mut self,
+                             idx: uint,
+                             f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         if idx != 0 {
             try!(write!(self.wr, ","));
         }
-        f(self);
+        f(self)
     }
 
     fn emit_enum_struct_variant(&mut self,
                                 name: &str,
                                 id: uint,
                                 cnt: uint,
-                                f: |&mut Encoder<'a>|) {
+                                f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_enum_variant(name, id, cnt, f)
     }
 
     fn emit_enum_struct_variant_field(&mut self,
                                       _: &str,
                                       idx: uint,
-                                      f: |&mut Encoder<'a>|) {
+                                      f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_enum_variant_arg(idx, f)
     }
 
-    fn emit_struct(&mut self, _: &str, _: uint, f: |&mut Encoder<'a>|) {
+    fn emit_struct(&mut self,
+                   _: &str,
+                   _: uint,
+                   f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         try!(write!(self.wr, r"\{"));
-        f(self);
-        try!(write!(self.wr, r"\}"));
+        try!(f(self));
+        write!(self.wr, r"\}")
     }
 
     fn emit_struct_field(&mut self,
                          name: &str,
                          idx: uint,
-                         f: |&mut Encoder<'a>|) {
-        if idx != 0 { try!(write!(self.wr, ",")) }
+                         f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
+        if idx != 0 { try!(write!(self.wr, ",")); }
         try!(write!(self.wr, "{}:", escape_str(name)));
-        f(self);
+        f(self)
     }
 
-    fn emit_tuple(&mut self, len: uint, f: |&mut Encoder<'a>|) {
+    fn emit_tuple(&mut self, len: uint, f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_seq(len, f)
     }
-    fn emit_tuple_arg(&mut self, idx: uint, f: |&mut Encoder<'a>|) {
+    fn emit_tuple_arg(&mut self,
+                      idx: uint,
+                      f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_seq_elt(idx, f)
     }
 
     fn emit_tuple_struct(&mut self,
                          _name: &str,
                          len: uint,
-                         f: |&mut Encoder<'a>|) {
+                         f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_seq(len, f)
     }
-    fn emit_tuple_struct_arg(&mut self, idx: uint, f: |&mut Encoder<'a>|) {
+    fn emit_tuple_struct_arg(&mut self,
+                             idx: uint,
+                             f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_seq_elt(idx, f)
     }
 
-    fn emit_option(&mut self, f: |&mut Encoder<'a>|) { f(self); }
-    fn emit_option_none(&mut self) { self.emit_nil(); }
-    fn emit_option_some(&mut self, f: |&mut Encoder<'a>|) { f(self); }
+    fn emit_option(&mut self, f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
+        f(self)
+    }
+    fn emit_option_none(&mut self) -> EncodeResult { self.emit_nil() }
+    fn emit_option_some(&mut self, f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
+        f(self)
+    }
 
-    fn emit_seq(&mut self, _len: uint, f: |&mut Encoder<'a>|) {
+    fn emit_seq(&mut self, _len: uint, f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         try!(write!(self.wr, "["));
-        f(self);
-        try!(write!(self.wr, "]"));
+        try!(f(self));
+        write!(self.wr, "]")
     }
 
-    fn emit_seq_elt(&mut self, idx: uint, f: |&mut Encoder<'a>|) {
+    fn emit_seq_elt(&mut self, idx: uint, f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         if idx != 0 {
             try!(write!(self.wr, ","));
         }
         f(self)
     }
 
-    fn emit_map(&mut self, _len: uint, f: |&mut Encoder<'a>|) {
+    fn emit_map(&mut self, _len: uint, f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         try!(write!(self.wr, r"\{"));
-        f(self);
-        try!(write!(self.wr, r"\}"));
+        try!(f(self));
+        write!(self.wr, r"\}")
     }
 
-    fn emit_map_elt_key(&mut self, idx: uint, f: |&mut Encoder<'a>|) {
+    fn emit_map_elt_key(&mut self,
+                        idx: uint,
+                        f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         use std::str::from_utf8;
         if idx != 0 { try!(write!(self.wr, ",")) }
         // ref #12967, make sure to wrap a key in double quotes,
         // in the event that its of a type that omits them (eg numbers)
         let mut buf = MemWriter::new();
         let mut check_encoder = Encoder::new(&mut buf);
-        f(&mut check_encoder);
+        try!(f(&mut check_encoder));
         let buf = buf.unwrap();
         let out = from_utf8(buf).unwrap();
         let needs_wrapping = out.char_at(0) != '"' &&
             out.char_at_reverse(out.len()) != '"';
         if needs_wrapping { try!(write!(self.wr, "\"")); }
-        f(self);
+        try!(f(self));
         if needs_wrapping { try!(write!(self.wr, "\"")); }
+        Ok(())
     }
 
-    fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut Encoder<'a>|) {
+    fn emit_map_elt_val(&mut self,
+                        _idx: uint,
+                        f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
         try!(write!(self.wr, ":"));
         f(self)
     }
@@ -489,9 +504,8 @@ impl<'a> ::Encoder for Encoder<'a> {
 /// Another encoder for JSON, but prints out human-readable JSON instead of
 /// compact data
 pub struct PrettyEncoder<'a> {
-    priv wr: &'a mut io::Writer,
-    priv indent: uint,
-    priv error: io::IoResult<()>,
+    wr: &'a mut io::Writer,
+    indent: uint,
 }
 
 impl<'a> PrettyEncoder<'a> {
@@ -500,45 +514,46 @@ impl<'a> PrettyEncoder<'a> {
         PrettyEncoder {
             wr: wr,
             indent: 0,
-            error: Ok(())
         }
     }
 }
 
-impl<'a> ::Encoder for PrettyEncoder<'a> {
-    fn emit_nil(&mut self) { try!(write!(self.wr, "null")); }
+impl<'a> ::Encoder<io::IoError> for PrettyEncoder<'a> {
+    fn emit_nil(&mut self) -> EncodeResult { write!(self.wr, "null") }
 
-    fn emit_uint(&mut self, v: uint) { self.emit_f64(v as f64); }
-    fn emit_u64(&mut self, v: u64) { self.emit_f64(v as f64); }
-    fn emit_u32(&mut self, v: u32) { self.emit_f64(v as f64); }
-    fn emit_u16(&mut self, v: u16) { self.emit_f64(v as f64); }
-    fn emit_u8(&mut self, v: u8)   { self.emit_f64(v as f64); }
+    fn emit_uint(&mut self, v: uint) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_u64(&mut self, v: u64) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_u32(&mut self, v: u32) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_u16(&mut self, v: u16) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_u8(&mut self, v: u8) -> EncodeResult { self.emit_f64(v as f64) }
 
-    fn emit_int(&mut self, v: int) { self.emit_f64(v as f64); }
-    fn emit_i64(&mut self, v: i64) { self.emit_f64(v as f64); }
-    fn emit_i32(&mut self, v: i32) { self.emit_f64(v as f64); }
-    fn emit_i16(&mut self, v: i16) { self.emit_f64(v as f64); }
-    fn emit_i8(&mut self, v: i8)   { self.emit_f64(v as f64); }
+    fn emit_int(&mut self, v: int) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_i64(&mut self, v: i64) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_i32(&mut self, v: i32) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_i16(&mut self, v: i16) -> EncodeResult { self.emit_f64(v as f64) }
+    fn emit_i8(&mut self, v: i8) -> EncodeResult { self.emit_f64(v as f64) }
 
-    fn emit_bool(&mut self, v: bool) {
+    fn emit_bool(&mut self, v: bool) -> EncodeResult {
         if v {
-            try!(write!(self.wr, "true"));
+            write!(self.wr, "true")
         } else {
-            try!(write!(self.wr, "false"));
+            write!(self.wr, "false")
         }
     }
 
-    fn emit_f64(&mut self, v: f64) {
-        try!(write!(self.wr, "{}", f64::to_str_digits(v, 6u)));
+    fn emit_f64(&mut self, v: f64) -> EncodeResult {
+        write!(self.wr, "{}", f64::to_str_digits(v, 6u))
     }
-    fn emit_f32(&mut self, v: f32) { self.emit_f64(v as f64); }
+    fn emit_f32(&mut self, v: f32) -> EncodeResult { self.emit_f64(v as f64) }
 
-    fn emit_char(&mut self, v: char) { self.emit_str(str::from_char(v)) }
-    fn emit_str(&mut self, v: &str) {
-        try!(write!(self.wr, "{}", escape_str(v)));
+    fn emit_char(&mut self, v: char) -> EncodeResult { self.emit_str(str::from_char(v)) }
+    fn emit_str(&mut self, v: &str) -> EncodeResult {
+        write!(self.wr, "{}", escape_str(v))
     }
 
-    fn emit_enum(&mut self, _name: &str, f: |&mut PrettyEncoder<'a>|) {
+    fn emit_enum(&mut self,
+                 _name: &str,
+                 f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         f(self)
     }
 
@@ -546,22 +561,22 @@ impl<'a> ::Encoder for PrettyEncoder<'a> {
                          name: &str,
                          _: uint,
                          cnt: uint,
-                         f: |&mut PrettyEncoder<'a>|) {
+                         f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         if cnt == 0 {
-            try!(write!(self.wr, "{}", escape_str(name)));
+            write!(self.wr, "{}", escape_str(name))
         } else {
             self.indent += 2;
             try!(write!(self.wr, "[\n{}{},\n", spaces(self.indent),
                           escape_str(name)));
-            f(self);
+            try!(f(self));
             self.indent -= 2;
-            try!(write!(self.wr, "\n{}]", spaces(self.indent)));
+            write!(self.wr, "\n{}]", spaces(self.indent))
         }
     }
 
     fn emit_enum_variant_arg(&mut self,
                              idx: uint,
-                             f: |&mut PrettyEncoder<'a>|) {
+                             f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         if idx != 0 {
             try!(write!(self.wr, ",\n"));
         }
@@ -573,14 +588,14 @@ impl<'a> ::Encoder for PrettyEncoder<'a> {
                                 name: &str,
                                 id: uint,
                                 cnt: uint,
-                                f: |&mut PrettyEncoder<'a>|) {
+                                f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_enum_variant(name, id, cnt, f)
     }
 
     fn emit_enum_struct_variant_field(&mut self,
                                       _: &str,
                                       idx: uint,
-                                      f: |&mut PrettyEncoder<'a>|) {
+                                      f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_enum_variant_arg(idx, f)
     }
 
@@ -588,67 +603,79 @@ impl<'a> ::Encoder for PrettyEncoder<'a> {
     fn emit_struct(&mut self,
                    _: &str,
                    len: uint,
-                   f: |&mut PrettyEncoder<'a>|) {
+                   f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         if len == 0 {
-            try!(write!(self.wr, "\\{\\}"));
+            write!(self.wr, "\\{\\}")
         } else {
             try!(write!(self.wr, "\\{"));
             self.indent += 2;
-            f(self);
+            try!(f(self));
             self.indent -= 2;
-            try!(write!(self.wr, "\n{}\\}", spaces(self.indent)));
+            write!(self.wr, "\n{}\\}", spaces(self.indent))
         }
     }
 
     fn emit_struct_field(&mut self,
                          name: &str,
                          idx: uint,
-                         f: |&mut PrettyEncoder<'a>|) {
+                         f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         if idx == 0 {
             try!(write!(self.wr, "\n"));
         } else {
             try!(write!(self.wr, ",\n"));
         }
         try!(write!(self.wr, "{}{}: ", spaces(self.indent), escape_str(name)));
-        f(self);
+        f(self)
     }
 
-    fn emit_tuple(&mut self, len: uint, f: |&mut PrettyEncoder<'a>|) {
+    fn emit_tuple(&mut self,
+                  len: uint,
+                  f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_seq(len, f)
     }
-    fn emit_tuple_arg(&mut self, idx: uint, f: |&mut PrettyEncoder<'a>|) {
+    fn emit_tuple_arg(&mut self,
+                      idx: uint,
+                      f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_seq_elt(idx, f)
     }
 
     fn emit_tuple_struct(&mut self,
                          _: &str,
                          len: uint,
-                         f: |&mut PrettyEncoder<'a>|) {
+                         f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_seq(len, f)
     }
     fn emit_tuple_struct_arg(&mut self,
                              idx: uint,
-                             f: |&mut PrettyEncoder<'a>|) {
+                             f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         self.emit_seq_elt(idx, f)
     }
 
-    fn emit_option(&mut self, f: |&mut PrettyEncoder<'a>|) { f(self); }
-    fn emit_option_none(&mut self) { self.emit_nil(); }
-    fn emit_option_some(&mut self, f: |&mut PrettyEncoder<'a>|) { f(self); }
+    fn emit_option(&mut self, f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
+        f(self)
+    }
+    fn emit_option_none(&mut self) -> EncodeResult { self.emit_nil() }
+    fn emit_option_some(&mut self, f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
+        f(self)
+    }
 
-    fn emit_seq(&mut self, len: uint, f: |&mut PrettyEncoder<'a>|) {
+    fn emit_seq(&mut self,
+                len: uint,
+                f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         if len == 0 {
-            try!(write!(self.wr, "[]"));
+            write!(self.wr, "[]")
         } else {
             try!(write!(self.wr, "["));
             self.indent += 2;
-            f(self);
+            try!(f(self));
             self.indent -= 2;
-            try!(write!(self.wr, "\n{}]", spaces(self.indent)));
+            write!(self.wr, "\n{}]", spaces(self.indent))
         }
     }
 
-    fn emit_seq_elt(&mut self, idx: uint, f: |&mut PrettyEncoder<'a>|) {
+    fn emit_seq_elt(&mut self,
+                    idx: uint,
+                    f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         if idx == 0 {
             try!(write!(self.wr, "\n"));
         } else {
@@ -658,19 +685,23 @@ impl<'a> ::Encoder for PrettyEncoder<'a> {
         f(self)
     }
 
-    fn emit_map(&mut self, len: uint, f: |&mut PrettyEncoder<'a>|) {
+    fn emit_map(&mut self,
+                len: uint,
+                f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         if len == 0 {
-            try!(write!(self.wr, "\\{\\}"));
+            write!(self.wr, "\\{\\}")
         } else {
             try!(write!(self.wr, "\\{"));
             self.indent += 2;
-            f(self);
+            try!(f(self));
             self.indent -= 2;
-            try!(write!(self.wr, "\n{}\\}", spaces(self.indent)));
+            write!(self.wr, "\n{}\\}", spaces(self.indent))
         }
     }
 
-    fn emit_map_elt_key(&mut self, idx: uint, f: |&mut PrettyEncoder<'a>|) {
+    fn emit_map_elt_key(&mut self,
+                        idx: uint,
+                        f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         use std::str::from_utf8;
         if idx == 0 {
             try!(write!(self.wr, "\n"));
@@ -682,24 +713,27 @@ impl<'a> ::Encoder for PrettyEncoder<'a> {
         // in the event that its of a type that omits them (eg numbers)
         let mut buf = MemWriter::new();
         let mut check_encoder = PrettyEncoder::new(&mut buf);
-        f(&mut check_encoder);
+        try!(f(&mut check_encoder));
         let buf = buf.unwrap();
         let out = from_utf8(buf).unwrap();
         let needs_wrapping = out.char_at(0) != '"' &&
             out.char_at_reverse(out.len()) != '"';
         if needs_wrapping { try!(write!(self.wr, "\"")); }
-        f(self);
+        try!(f(self));
         if needs_wrapping { try!(write!(self.wr, "\"")); }
+        Ok(())
     }
 
-    fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut PrettyEncoder<'a>|) {
+    fn emit_map_elt_val(&mut self,
+                        _idx: uint,
+                        f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
         try!(write!(self.wr, ": "));
-        f(self);
+        f(self)
     }
 }
 
-impl<E: ::Encoder> Encodable<E> for Json {
-    fn encode(&self, e: &mut E) {
+impl<E: ::Encoder<S>, S> Encodable<E, S> for Json {
+    fn encode(&self, e: &mut E) -> Result<(), S> {
         match *self {
             Number(v) => v.encode(e),
             String(ref v) => v.encode(e),
@@ -713,18 +747,16 @@ impl<E: ::Encoder> Encodable<E> for Json {
 
 impl Json {
     /// Encodes a json value into a io::writer.  Uses a single line.
-    pub fn to_writer(&self, wr: &mut io::Writer) -> io::IoResult<()> {
+    pub fn to_writer(&self, wr: &mut io::Writer) -> EncodeResult {
         let mut encoder = Encoder::new(wr);
-        self.encode(&mut encoder);
-        encoder.error
+        self.encode(&mut encoder)
     }
 
     /// Encodes a json value into a io::writer.
     /// Pretty-prints in a more readable format.
-    pub fn to_pretty_writer(&self, wr: &mut io::Writer) -> io::IoResult<()> {
+    pub fn to_pretty_writer(&self, wr: &mut io::Writer) -> EncodeResult {
         let mut encoder = PrettyEncoder::new(wr);
-        self.encode(&mut encoder);
-        encoder.error
+        self.encode(&mut encoder)
     }
 
     /// Encodes a json value into a string
@@ -867,10 +899,10 @@ impl Json {
 }
 
 pub struct Parser<T> {
-    priv rdr: T,
-    priv ch: Option<char>,
-    priv line: uint,
-    priv col: uint,
+    rdr: T,
+    ch: Option<char>,
+    line: uint,
+    col: uint,
 }
 
 impl<T: Iterator<char>> Parser<T> {
@@ -888,7 +920,7 @@ impl<T: Iterator<char>> Parser<T> {
 }
 
 impl<T: Iterator<char>> Parser<T> {
-    pub fn parse(&mut self) -> Result<Json, Error> {
+    pub fn parse(&mut self) -> DecodeResult<Json> {
         match self.parse_value() {
           Ok(value) => {
             // Skip trailing whitespaces.
@@ -927,11 +959,11 @@ impl<T : Iterator<char>> Parser<T> {
         self.ch == Some(c)
     }
 
-    fn error<T>(&self, msg: ~str) -> Result<T, Error> {
-        Err(Error { line: self.line, col: self.col, msg: msg })
+    fn error<T>(&self, msg: ~str) -> DecodeResult<T> {
+        Err(ParseError(msg, self.line, self.col))
     }
 
-    fn parse_value(&mut self) -> Result<Json, Error> {
+    fn parse_value(&mut self) -> DecodeResult<Json> {
         self.parse_whitespace();
 
         if self.eof() { return self.error(~"EOF while parsing value"); }
@@ -960,7 +992,7 @@ impl<T : Iterator<char>> Parser<T> {
               self.ch_is('\r') { self.bump(); }
     }
 
-    fn parse_ident(&mut self, ident: &str, value: Json) -> Result<Json, Error> {
+    fn parse_ident(&mut self, ident: &str, value: Json) -> DecodeResult<Json> {
         if ident.chars().all(|c| Some(c) == self.next_char()) {
             self.bump();
             Ok(value)
@@ -969,7 +1001,7 @@ impl<T : Iterator<char>> Parser<T> {
         }
     }
 
-    fn parse_number(&mut self) -> Result<Json, Error> {
+    fn parse_number(&mut self) -> DecodeResult<Json> {
         let mut neg = 1.0;
 
         if self.ch_is('-') {
@@ -999,7 +1031,7 @@ impl<T : Iterator<char>> Parser<T> {
         Ok(Number(neg * res))
     }
 
-    fn parse_integer(&mut self) -> Result<f64, Error> {
+    fn parse_integer(&mut self) -> DecodeResult<f64> {
         let mut res = 0.0;
 
         match self.ch_or_null() {
@@ -1030,7 +1062,7 @@ impl<T : Iterator<char>> Parser<T> {
         Ok(res)
     }
 
-    fn parse_decimal(&mut self, res: f64) -> Result<f64, Error> {
+    fn parse_decimal(&mut self, res: f64) -> DecodeResult<f64> {
         self.bump();
 
         // Make sure a digit follows the decimal place.
@@ -1056,7 +1088,7 @@ impl<T : Iterator<char>> Parser<T> {
         Ok(res)
     }
 
-    fn parse_exponent(&mut self, mut res: f64) -> Result<f64, Error> {
+    fn parse_exponent(&mut self, mut res: f64) -> DecodeResult<f64> {
         self.bump();
 
         let mut exp = 0u;
@@ -1096,7 +1128,7 @@ impl<T : Iterator<char>> Parser<T> {
         Ok(res)
     }
 
-    fn parse_str(&mut self) -> Result<~str, Error> {
+    fn parse_str(&mut self) -> DecodeResult<~str> {
         let mut escape = false;
         let mut res = ~"";
 
@@ -1160,7 +1192,7 @@ impl<T : Iterator<char>> Parser<T> {
         }
     }
 
-    fn parse_list(&mut self) -> Result<Json, Error> {
+    fn parse_list(&mut self) -> DecodeResult<Json> {
         self.bump();
         self.parse_whitespace();
 
@@ -1193,7 +1225,7 @@ impl<T : Iterator<char>> Parser<T> {
         };
     }
 
-    fn parse_object(&mut self) -> Result<Json, Error> {
+    fn parse_object(&mut self) -> DecodeResult<Json> {
         self.bump();
         self.parse_whitespace();
 
@@ -1245,28 +1277,28 @@ impl<T : Iterator<char>> Parser<T> {
 }
 
 /// Decodes a json value from an `&mut io::Reader`
-pub fn from_reader(rdr: &mut io::Reader) -> Result<Json, Error> {
+pub fn from_reader(rdr: &mut io::Reader) -> DecodeResult<Json> {
     let contents = match rdr.read_to_end() {
         Ok(c) => c,
-        Err(e) => return Err(io_error_to_error(e))
+        Err(e) => return Err(IoError(e))
     };
     let s = match str::from_utf8_owned(contents) {
         Some(s) => s,
-        None => return Err(Error { line: 0, col: 0, msg: ~"contents not utf-8" })
+        None => return Err(ParseError(~"contents not utf-8", 0, 0))
     };
     let mut parser = Parser::new(s.chars());
     parser.parse()
 }
 
 /// Decodes a json value from a string
-pub fn from_str(s: &str) -> Result<Json, Error> {
+pub fn from_str(s: &str) -> DecodeResult<Json> {
     let mut parser = Parser::new(s.chars());
     parser.parse()
 }
 
 /// A structure to decode JSON to values in rust.
 pub struct Decoder {
-    priv stack: ~[Json],
+    stack: ~[Json],
 }
 
 impl Decoder {
@@ -1279,110 +1311,103 @@ impl Decoder {
 }
 
 impl Decoder {
-    fn err(&self, msg: &str) -> ! {
-        fail!("JSON decode error: {}", msg);
-    }
-    fn missing_field(&self, field: &str, object: ~Object) -> ! {
-        self.err(format!("missing required '{}' field in object: {}",
-                         field, Object(object).to_str()))
-    }
-    fn expected(&self, expected: &str, found: &Json) -> ! {
-        let found_s = match *found {
-            Null => "null",
-            List(..) => "list",
-            Object(..) => "object",
-            Number(..) => "number",
-            String(..) => "string",
-            Boolean(..) => "boolean"
-        };
-        self.err(format!("expected {expct} but found {fnd}: {val}",
-                         expct=expected, fnd=found_s, val=found.to_str()))
+    fn pop(&mut self) -> Json {
+        self.stack.pop().unwrap()
     }
 }
 
-impl ::Decoder for Decoder {
-    fn read_nil(&mut self) -> () {
-        debug!("read_nil");
-        match self.stack.pop().unwrap() {
-            Null => (),
-            value => self.expected("null", &value)
+macro_rules! expect(
+    ($e:expr, Null) => ({
+        match $e {
+            Null => Ok(()),
+            other => Err(ExpectedError(~"Null", format!("{}", other)))
+        }
+    });
+    ($e:expr, $t:ident) => ({
+        match $e {
+            $t(v) => Ok(v),
+            other => Err(ExpectedError(stringify!($t).to_owned(), format!("{}", other)))
         }
+    })
+)
+
+impl ::Decoder<Error> for Decoder {
+    fn read_nil(&mut self) -> DecodeResult<()> {
+        debug!("read_nil");
+        try!(expect!(self.pop(), Null));
+        Ok(())
     }
 
-    fn read_u64(&mut self)  -> u64  { self.read_f64() as u64 }
-    fn read_u32(&mut self)  -> u32  { self.read_f64() as u32 }
-    fn read_u16(&mut self)  -> u16  { self.read_f64() as u16 }
-    fn read_u8 (&mut self)  -> u8   { self.read_f64() as u8 }
-    fn read_uint(&mut self) -> uint { self.read_f64() as uint }
+    fn read_u64(&mut self)  -> DecodeResult<u64 > { Ok(try!(self.read_f64()) as u64) }
+    fn read_u32(&mut self)  -> DecodeResult<u32 > { Ok(try!(self.read_f64()) as u32) }
+    fn read_u16(&mut self)  -> DecodeResult<u16 > { Ok(try!(self.read_f64()) as u16) }
+    fn read_u8 (&mut self)  -> DecodeResult<u8  > { Ok(try!(self.read_f64()) as u8) }
+    fn read_uint(&mut self) -> DecodeResult<uint> { Ok(try!(self.read_f64()) as uint) }
 
-    fn read_i64(&mut self) -> i64 { self.read_f64() as i64 }
-    fn read_i32(&mut self) -> i32 { self.read_f64() as i32 }
-    fn read_i16(&mut self) -> i16 { self.read_f64() as i16 }
-    fn read_i8 (&mut self) -> i8  { self.read_f64() as i8 }
-    fn read_int(&mut self) -> int { self.read_f64() as int }
+    fn read_i64(&mut self) -> DecodeResult<i64> { Ok(try!(self.read_f64()) as i64) }
+    fn read_i32(&mut self) -> DecodeResult<i32> { Ok(try!(self.read_f64()) as i32) }
+    fn read_i16(&mut self) -> DecodeResult<i16> { Ok(try!(self.read_f64()) as i16) }
+    fn read_i8 (&mut self) -> DecodeResult<i8 > { Ok(try!(self.read_f64()) as i8) }
+    fn read_int(&mut self) -> DecodeResult<int> { Ok(try!(self.read_f64()) as int) }
 
-    fn read_bool(&mut self) -> bool {
+    fn read_bool(&mut self) -> DecodeResult<bool> {
         debug!("read_bool");
-        match self.stack.pop().unwrap() {
-            Boolean(b) => b,
-            value => self.expected("boolean", &value)
-        }
+        Ok(try!(expect!(self.pop(), Boolean)))
     }
 
-    fn read_f64(&mut self) -> f64 {
+    fn read_f64(&mut self) -> DecodeResult<f64> {
         use std::from_str::FromStr;
         debug!("read_f64");
-        match self.stack.pop().unwrap() {
-            Number(f) => f,
+        match self.pop() {
+            Number(f) => Ok(f),
             String(s) => {
                 // re: #12967.. a type w/ numeric keys (ie HashMap<uint, V> etc)
                 // is going to have a string here, as per JSON spec..
-                FromStr::from_str(s).unwrap()
+                Ok(FromStr::from_str(s).unwrap())
             },
-            value => self.expected("number", &value)
+            value => Err(ExpectedError(~"Number", format!("{}", value)))
         }
     }
 
-    fn read_f32(&mut self) -> f32 { self.read_f64() as f32 }
+    fn read_f32(&mut self) -> DecodeResult<f32> { Ok(try!(self.read_f64()) as f32) }
 
-    fn read_char(&mut self) -> char {
-        let s = self.read_str();
+    fn read_char(&mut self) -> DecodeResult<char> {
+        let s = try!(self.read_str());
         {
             let mut it = s.chars();
             match (it.next(), it.next()) {
                 // exactly one character
-                (Some(c), None) => return c,
+                (Some(c), None) => return Ok(c),
                 _ => ()
             }
         }
-        self.expected("single character string", &String(s))
+        Err(ExpectedError(~"single character string", format!("{}", s)))
     }
 
-    fn read_str(&mut self) -> ~str {
+    fn read_str(&mut self) -> DecodeResult<~str> {
         debug!("read_str");
-        match self.stack.pop().unwrap() {
-            String(s) => s,
-            value => self.expected("string", &value)
-        }
+        Ok(try!(expect!(self.pop(), String)))
     }
 
-    fn read_enum<T>(&mut self, name: &str, f: |&mut Decoder| -> T) -> T {
+    fn read_enum<T>(&mut self,
+                    name: &str,
+                    f: |&mut Decoder| -> DecodeResult<T>) -> DecodeResult<T> {
         debug!("read_enum({})", name);
         f(self)
     }
 
     fn read_enum_variant<T>(&mut self,
                             names: &[&str],
-                            f: |&mut Decoder, uint| -> T)
-                            -> T {
+                            f: |&mut Decoder, uint| -> DecodeResult<T>)
+                            -> DecodeResult<T> {
         debug!("read_enum_variant(names={:?})", names);
-        let name = match self.stack.pop().unwrap() {
+        let name = match self.pop() {
             String(s) => s,
             Object(mut o) => {
                 let n = match o.pop(&~"variant") {
                     Some(String(s)) => s,
-                    Some(val) => self.expected("string", &val),
-                    None => self.missing_field("variant", o)
+                    Some(val) => return Err(ExpectedError(~"String", format!("{}", val))),
+                    None => return Err(MissingFieldError(~"variant"))
                 };
                 match o.pop(&~"fields") {
                     Some(List(l)) => {
@@ -1390,36 +1415,30 @@ impl ::Decoder for Decoder {
                             self.stack.push(field.clone());
                         }
                     },
-                    Some(val) => self.expected("list", &val),
-                    None => {
-                        // re-insert the variant field so we're
-                        // printing the "whole" struct in the error
-                        // message... ick.
-                        o.insert(~"variant", String(n));
-                        self.missing_field("fields", o);
-                    }
+                    Some(val) => return Err(ExpectedError(~"List", format!("{}", val))),
+                    None => return Err(MissingFieldError(~"fields"))
                 }
                 n
             }
-            json => self.expected("string or object", &json)
+            json => return Err(ExpectedError(~"String or Object", format!("{}", json)))
         };
         let idx = match names.iter().position(|n| str::eq_slice(*n, name)) {
             Some(idx) => idx,
-            None => self.err(format!("unknown variant name: {}", name))
+            None => return Err(UnknownVariantError(name))
         };
         f(self, idx)
     }
 
-    fn read_enum_variant_arg<T>(&mut self, idx: uint, f: |&mut Decoder| -> T)
-                                -> T {
+    fn read_enum_variant_arg<T>(&mut self, idx: uint, f: |&mut Decoder| -> DecodeResult<T>)
+                                -> DecodeResult<T> {
         debug!("read_enum_variant_arg(idx={})", idx);
         f(self)
     }
 
     fn read_enum_struct_variant<T>(&mut self,
                                    names: &[&str],
-                                   f: |&mut Decoder, uint| -> T)
-                                   -> T {
+                                   f: |&mut Decoder, uint| -> DecodeResult<T>)
+                                   -> DecodeResult<T> {
         debug!("read_enum_struct_variant(names={:?})", names);
         self.read_enum_variant(names, f)
     }
@@ -1428,8 +1447,8 @@ impl ::Decoder for Decoder {
     fn read_enum_struct_variant_field<T>(&mut self,
                                          name: &str,
                                          idx: uint,
-                                         f: |&mut Decoder| -> T)
-                                         -> T {
+                                         f: |&mut Decoder| -> DecodeResult<T>)
+                                         -> DecodeResult<T> {
         debug!("read_enum_struct_variant_field(name={}, idx={})", name, idx);
         self.read_enum_variant_arg(idx, f)
     }
@@ -1437,113 +1456,104 @@ impl ::Decoder for Decoder {
     fn read_struct<T>(&mut self,
                       name: &str,
                       len: uint,
-                      f: |&mut Decoder| -> T)
-                      -> T {
+                      f: |&mut Decoder| -> DecodeResult<T>)
+                      -> DecodeResult<T> {
         debug!("read_struct(name={}, len={})", name, len);
-        let value = f(self);
-        self.stack.pop().unwrap();
-        value
+        let value = try!(f(self));
+        self.pop();
+        Ok(value)
     }
 
     fn read_struct_field<T>(&mut self,
                             name: &str,
                             idx: uint,
-                            f: |&mut Decoder| -> T)
-                            -> T {
+                            f: |&mut Decoder| -> DecodeResult<T>)
+                            -> DecodeResult<T> {
         debug!("read_struct_field(name={}, idx={})", name, idx);
-        match self.stack.pop().unwrap() {
-            Object(mut obj) => {
-                let value = match obj.pop(&name.to_owned()) {
-                    None => self.missing_field(name, obj),
-                    Some(json) => {
-                        self.stack.push(json);
-                        f(self)
-                    }
-                };
-                self.stack.push(Object(obj));
-                value
+        let mut obj = try!(expect!(self.pop(), Object));
+
+        let value = match obj.pop(&name.to_owned()) {
+            None => return Err(MissingFieldError(name.to_owned())),
+            Some(json) => {
+                self.stack.push(json);
+                try!(f(self))
             }
-            value => self.expected("object", &value)
-        }
+        };
+        self.stack.push(Object(obj));
+        Ok(value)
     }
 
-    fn read_tuple<T>(&mut self, f: |&mut Decoder, uint| -> T) -> T {
+    fn read_tuple<T>(&mut self, f: |&mut Decoder, uint| -> DecodeResult<T>) -> DecodeResult<T> {
         debug!("read_tuple()");
         self.read_seq(f)
     }
 
-    fn read_tuple_arg<T>(&mut self, idx: uint, f: |&mut Decoder| -> T) -> T {
+    fn read_tuple_arg<T>(&mut self,
+                         idx: uint,
+                         f: |&mut Decoder| -> DecodeResult<T>) -> DecodeResult<T> {
         debug!("read_tuple_arg(idx={})", idx);
         self.read_seq_elt(idx, f)
     }
 
     fn read_tuple_struct<T>(&mut self,
                             name: &str,
-                            f: |&mut Decoder, uint| -> T)
-                            -> T {
+                            f: |&mut Decoder, uint| -> DecodeResult<T>)
+                            -> DecodeResult<T> {
         debug!("read_tuple_struct(name={})", name);
         self.read_tuple(f)
     }
 
     fn read_tuple_struct_arg<T>(&mut self,
                                 idx: uint,
-                                f: |&mut Decoder| -> T)
-                                -> T {
+                                f: |&mut Decoder| -> DecodeResult<T>)
+                                -> DecodeResult<T> {
         debug!("read_tuple_struct_arg(idx={})", idx);
         self.read_tuple_arg(idx, f)
     }
 
-    fn read_option<T>(&mut self, f: |&mut Decoder, bool| -> T) -> T {
-        match self.stack.pop().unwrap() {
+    fn read_option<T>(&mut self, f: |&mut Decoder, bool| -> DecodeResult<T>) -> DecodeResult<T> {
+        match self.pop() {
             Null => f(self, false),
             value => { self.stack.push(value); f(self, true) }
         }
     }
 
-    fn read_seq<T>(&mut self, f: |&mut Decoder, uint| -> T) -> T {
+    fn read_seq<T>(&mut self, f: |&mut Decoder, uint| -> DecodeResult<T>) -> DecodeResult<T> {
         debug!("read_seq()");
-        let len = match self.stack.pop().unwrap() {
-            List(list) => {
-                let len = list.len();
-                for v in list.move_rev_iter() {
-                    self.stack.push(v);
-                }
-                len
-            }
-            value => self.expected("list", &value)
-        };
+        let list = try!(expect!(self.pop(), List));
+        let len = list.len();
+        for v in list.move_rev_iter() {
+            self.stack.push(v);
+        }
         f(self, len)
     }
 
-    fn read_seq_elt<T>(&mut self, idx: uint, f: |&mut Decoder| -> T) -> T {
+    fn read_seq_elt<T>(&mut self,
+                       idx: uint,
+                       f: |&mut Decoder| -> DecodeResult<T>) -> DecodeResult<T> {
         debug!("read_seq_elt(idx={})", idx);
         f(self)
     }
 
-    fn read_map<T>(&mut self, f: |&mut Decoder, uint| -> T) -> T {
+    fn read_map<T>(&mut self, f: |&mut Decoder, uint| -> DecodeResult<T>) -> DecodeResult<T> {
         debug!("read_map()");
-        let len = match self.stack.pop().unwrap() {
-            Object(obj) => {
-                let len = obj.len();
-                for (key, value) in obj.move_iter() {
-                    self.stack.push(value);
-                    self.stack.push(String(key));
-                }
-                len
-            }
-            value => self.expected("object", &value)
-        };
+        let obj = try!(expect!(self.pop(), Object));
+        let len = obj.len();
+        for (key, value) in obj.move_iter() {
+            self.stack.push(value);
+            self.stack.push(String(key));
+        }
         f(self, len)
     }
 
-    fn read_map_elt_key<T>(&mut self, idx: uint, f: |&mut Decoder| -> T)
-                           -> T {
+    fn read_map_elt_key<T>(&mut self, idx: uint, f: |&mut Decoder| -> DecodeResult<T>)
+                           -> DecodeResult<T> {
         debug!("read_map_elt_key(idx={})", idx);
         f(self)
     }
 
-    fn read_map_elt_val<T>(&mut self, idx: uint, f: |&mut Decoder| -> T)
-                           -> T {
+    fn read_map_elt_val<T>(&mut self, idx: uint, f: |&mut Decoder| -> DecodeResult<T>)
+                           -> DecodeResult<T> {
         debug!("read_map_elt_val(idx={})", idx);
         f(self)
     }
@@ -1696,7 +1706,7 @@ impl<A:ToJson,B:ToJson,C:ToJson> ToJson for (A, B, C) {
 }
 
 impl<A:ToJson> ToJson for ~[A] {
-    fn to_json(&self) -> Json { List(self.map(|elt| elt.to_json())) }
+    fn to_json(&self) -> Json { List(self.iter().map(|elt| elt.to_json()).collect()) }
 }
 
 impl<A:ToJson> ToJson for TreeMap<~str, A> {
@@ -1735,17 +1745,12 @@ impl fmt::Show for Json {
     }
 }
 
-impl fmt::Show for Error {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}:{}: {}", self.line, self.col, self.msg)
-    }
-}
-
 #[cfg(test)]
 mod tests {
     use {Encodable, Decodable};
     use super::{Encoder, Decoder, Error, Boolean, Number, List, String, Null,
-                PrettyEncoder, Object, Json, from_str};
+                PrettyEncoder, Object, Json, from_str, ParseError, ExpectedError,
+                MissingFieldError, UnknownVariantError, DecodeResult };
     use std::io;
     use collections::TreeMap;
 
@@ -1931,14 +1936,14 @@ mod tests {
         assert_eq!(
             with_str_writer(|wr| {
                 let mut encoder = Encoder::new(wr);
-                animal.encode(&mut encoder);
+                animal.encode(&mut encoder).unwrap();
             }),
             ~"\"Dog\""
         );
         assert_eq!(
             with_str_writer(|wr| {
                 let mut encoder = PrettyEncoder::new(wr);
-                animal.encode(&mut encoder);
+                animal.encode(&mut encoder).unwrap();
             }),
             ~"\"Dog\""
         );
@@ -1947,14 +1952,14 @@ mod tests {
         assert_eq!(
             with_str_writer(|wr| {
                 let mut encoder = Encoder::new(wr);
-                animal.encode(&mut encoder);
+                animal.encode(&mut encoder).unwrap();
             }),
             ~"{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}"
         );
         assert_eq!(
             with_str_writer(|wr| {
                 let mut encoder = PrettyEncoder::new(wr);
-                animal.encode(&mut encoder);
+                animal.encode(&mut encoder).unwrap();
             }),
             ~"\
             [\n  \
@@ -1970,14 +1975,14 @@ mod tests {
         let value = Some(~"jodhpurs");
         let s = with_str_writer(|wr| {
             let mut encoder = Encoder::new(wr);
-            value.encode(&mut encoder);
+            value.encode(&mut encoder).unwrap();
         });
         assert_eq!(s, ~"\"jodhpurs\"");
 
         let value = Some(~"jodhpurs");
         let s = with_str_writer(|wr| {
             let mut encoder = PrettyEncoder::new(wr);
-            value.encode(&mut encoder);
+            value.encode(&mut encoder).unwrap();
         });
         assert_eq!(s, ~"\"jodhpurs\"");
     }
@@ -1987,13 +1992,13 @@ mod tests {
         let value: Option<~str> = None;
         let s = with_str_writer(|wr| {
             let mut encoder = Encoder::new(wr);
-            value.encode(&mut encoder);
+            value.encode(&mut encoder).unwrap();
         });
         assert_eq!(s, ~"null");
 
         let s = with_str_writer(|wr| {
             let mut encoder = Encoder::new(wr);
-            value.encode(&mut encoder);
+            value.encode(&mut encoder).unwrap();
         });
         assert_eq!(s, ~"null");
     }
@@ -2001,35 +2006,35 @@ mod tests {
     #[test]
     fn test_trailing_characters() {
         assert_eq!(from_str("nulla"),
-            Err(Error {line: 1u, col: 5u, msg: ~"trailing characters"}));
+            Err(ParseError(~"trailing characters", 1u, 5u)));
         assert_eq!(from_str("truea"),
-            Err(Error {line: 1u, col: 5u, msg: ~"trailing characters"}));
+            Err(ParseError(~"trailing characters", 1u, 5u)));
         assert_eq!(from_str("falsea"),
-            Err(Error {line: 1u, col: 6u, msg: ~"trailing characters"}));
+            Err(ParseError(~"trailing characters", 1u, 6u)));
         assert_eq!(from_str("1a"),
-            Err(Error {line: 1u, col: 2u, msg: ~"trailing characters"}));
+            Err(ParseError(~"trailing characters", 1u, 2u)));
         assert_eq!(from_str("[]a"),
-            Err(Error {line: 1u, col: 3u, msg: ~"trailing characters"}));
+            Err(ParseError(~"trailing characters", 1u, 3u)));
         assert_eq!(from_str("{}a"),
-            Err(Error {line: 1u, col: 3u, msg: ~"trailing characters"}));
+            Err(ParseError(~"trailing characters", 1u, 3u)));
     }
 
     #[test]
     fn test_read_identifiers() {
         assert_eq!(from_str("n"),
-            Err(Error {line: 1u, col: 2u, msg: ~"invalid syntax"}));
+            Err(ParseError(~"invalid syntax", 1u, 2u)));
         assert_eq!(from_str("nul"),
-            Err(Error {line: 1u, col: 4u, msg: ~"invalid syntax"}));
+            Err(ParseError(~"invalid syntax", 1u, 4u)));
 
         assert_eq!(from_str("t"),
-            Err(Error {line: 1u, col: 2u, msg: ~"invalid syntax"}));
+            Err(ParseError(~"invalid syntax", 1u, 2u)));
         assert_eq!(from_str("truz"),
-            Err(Error {line: 1u, col: 4u, msg: ~"invalid syntax"}));
+            Err(ParseError(~"invalid syntax", 1u, 4u)));
 
         assert_eq!(from_str("f"),
-            Err(Error {line: 1u, col: 2u, msg: ~"invalid syntax"}));
+            Err(ParseError(~"invalid syntax", 1u, 2u)));
         assert_eq!(from_str("faz"),
-            Err(Error {line: 1u, col: 3u, msg: ~"invalid syntax"}));
+            Err(ParseError(~"invalid syntax", 1u, 3u)));
 
         assert_eq!(from_str("null"), Ok(Null));
         assert_eq!(from_str("true"), Ok(Boolean(true)));
@@ -2042,35 +2047,35 @@ mod tests {
     #[test]
     fn test_decode_identifiers() {
         let mut decoder = Decoder::new(from_str("null").unwrap());
-        let v: () = Decodable::decode(&mut decoder);
+        let v: () = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ());
 
         let mut decoder = Decoder::new(from_str("true").unwrap());
-        let v: bool = Decodable::decode(&mut decoder);
+        let v: bool = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, true);
 
         let mut decoder = Decoder::new(from_str("false").unwrap());
-        let v: bool = Decodable::decode(&mut decoder);
+        let v: bool = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, false);
     }
 
     #[test]
     fn test_read_number() {
         assert_eq!(from_str("+"),
-            Err(Error {line: 1u, col: 1u, msg: ~"invalid syntax"}));
+            Err(ParseError(~"invalid syntax", 1u, 1u)));
         assert_eq!(from_str("."),
-            Err(Error {line: 1u, col: 1u, msg: ~"invalid syntax"}));
+            Err(ParseError(~"invalid syntax", 1u, 1u)));
 
         assert_eq!(from_str("-"),
-            Err(Error {line: 1u, col: 2u, msg: ~"invalid number"}));
+            Err(ParseError(~"invalid number", 1u, 2u)));
         assert_eq!(from_str("00"),
-            Err(Error {line: 1u, col: 2u, msg: ~"invalid number"}));
+            Err(ParseError(~"invalid number", 1u, 2u)));
         assert_eq!(from_str("1."),
-            Err(Error {line: 1u, col: 3u, msg: ~"invalid number"}));
+            Err(ParseError(~"invalid number", 1u, 3u)));
         assert_eq!(from_str("1e"),
-            Err(Error {line: 1u, col: 3u, msg: ~"invalid number"}));
+            Err(ParseError(~"invalid number", 1u, 3u)));
         assert_eq!(from_str("1e+"),
-            Err(Error {line: 1u, col: 4u, msg: ~"invalid number"}));
+            Err(ParseError(~"invalid number", 1u, 4u)));
 
         assert_eq!(from_str("3"), Ok(Number(3.0)));
         assert_eq!(from_str("3.1"), Ok(Number(3.1)));
@@ -2085,42 +2090,40 @@ mod tests {
     #[test]
     fn test_decode_numbers() {
         let mut decoder = Decoder::new(from_str("3").unwrap());
-        let v: f64 = Decodable::decode(&mut decoder);
+        let v: f64 = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, 3.0);
 
         let mut decoder = Decoder::new(from_str("3.1").unwrap());
-        let v: f64 = Decodable::decode(&mut decoder);
+        let v: f64 = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, 3.1);
 
         let mut decoder = Decoder::new(from_str("-1.2").unwrap());
-        let v: f64 = Decodable::decode(&mut decoder);
+        let v: f64 = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, -1.2);
 
         let mut decoder = Decoder::new(from_str("0.4").unwrap());
-        let v: f64 = Decodable::decode(&mut decoder);
+        let v: f64 = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, 0.4);
 
         let mut decoder = Decoder::new(from_str("0.4e5").unwrap());
-        let v: f64 = Decodable::decode(&mut decoder);
+        let v: f64 = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, 0.4e5);
 
         let mut decoder = Decoder::new(from_str("0.4e15").unwrap());
-        let v: f64 = Decodable::decode(&mut decoder);
+        let v: f64 = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, 0.4e15);
 
         let mut decoder = Decoder::new(from_str("0.4e-01").unwrap());
-        let v: f64 = Decodable::decode(&mut decoder);
+        let v: f64 = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, 0.4e-01);
     }
 
     #[test]
     fn test_read_str() {
         assert_eq!(from_str("\""),
-            Err(Error {line: 1u, col: 2u, msg: ~"EOF while parsing string"
-        }));
+            Err(ParseError(~"EOF while parsing string", 1u, 2u)));
         assert_eq!(from_str("\"lol"),
-            Err(Error {line: 1u, col: 5u, msg: ~"EOF while parsing string"
-        }));
+            Err(ParseError(~"EOF while parsing string", 1u, 5u)));
 
         assert_eq!(from_str("\"\""), Ok(String(~"")));
         assert_eq!(from_str("\"foo\""), Ok(String(~"foo")));
@@ -2137,54 +2140,54 @@ mod tests {
     #[test]
     fn test_decode_str() {
         let mut decoder = Decoder::new(from_str("\"\"").unwrap());
-        let v: ~str = Decodable::decode(&mut decoder);
+        let v: ~str = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~"");
 
         let mut decoder = Decoder::new(from_str("\"foo\"").unwrap());
-        let v: ~str = Decodable::decode(&mut decoder);
+        let v: ~str = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~"foo");
 
         let mut decoder = Decoder::new(from_str("\"\\\"\"").unwrap());
-        let v: ~str = Decodable::decode(&mut decoder);
+        let v: ~str = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~"\"");
 
         let mut decoder = Decoder::new(from_str("\"\\b\"").unwrap());
-        let v: ~str = Decodable::decode(&mut decoder);
+        let v: ~str = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~"\x08");
 
         let mut decoder = Decoder::new(from_str("\"\\n\"").unwrap());
-        let v: ~str = Decodable::decode(&mut decoder);
+        let v: ~str = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~"\n");
 
         let mut decoder = Decoder::new(from_str("\"\\r\"").unwrap());
-        let v: ~str = Decodable::decode(&mut decoder);
+        let v: ~str = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~"\r");
 
         let mut decoder = Decoder::new(from_str("\"\\t\"").unwrap());
-        let v: ~str = Decodable::decode(&mut decoder);
+        let v: ~str = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~"\t");
 
         let mut decoder = Decoder::new(from_str("\"\\u12ab\"").unwrap());
-        let v: ~str = Decodable::decode(&mut decoder);
+        let v: ~str = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~"\u12ab");
 
         let mut decoder = Decoder::new(from_str("\"\\uAB12\"").unwrap());
-        let v: ~str = Decodable::decode(&mut decoder);
+        let v: ~str = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~"\uAB12");
     }
 
     #[test]
     fn test_read_list() {
         assert_eq!(from_str("["),
-            Err(Error {line: 1u, col: 2u, msg: ~"EOF while parsing value"}));
+            Err(ParseError(~"EOF while parsing value", 1u, 2u)));
         assert_eq!(from_str("[1"),
-            Err(Error {line: 1u, col: 3u, msg: ~"EOF while parsing list"}));
+            Err(ParseError(~"EOF while parsing list", 1u, 3u)));
         assert_eq!(from_str("[1,"),
-            Err(Error {line: 1u, col: 4u, msg: ~"EOF while parsing value"}));
+            Err(ParseError(~"EOF while parsing value", 1u, 4u)));
         assert_eq!(from_str("[1,]"),
-            Err(Error {line: 1u, col: 4u, msg: ~"invalid syntax"}));
+            Err(ParseError(~"invalid syntax", 1u, 4u)));
         assert_eq!(from_str("[6 7]"),
-            Err(Error {line: 1u, col: 4u, msg: ~"expected `,` or `]`"}));
+            Err(ParseError(~"expected `,` or `]`", 1u, 4u)));
 
         assert_eq!(from_str("[]"), Ok(List(~[])));
         assert_eq!(from_str("[ ]"), Ok(List(~[])));
@@ -2202,79 +2205,55 @@ mod tests {
     #[test]
     fn test_decode_list() {
         let mut decoder = Decoder::new(from_str("[]").unwrap());
-        let v: ~[()] = Decodable::decode(&mut decoder);
+        let v: ~[()] = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~[]);
 
         let mut decoder = Decoder::new(from_str("[null]").unwrap());
-        let v: ~[()] = Decodable::decode(&mut decoder);
+        let v: ~[()] = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~[()]);
 
         let mut decoder = Decoder::new(from_str("[true]").unwrap());
-        let v: ~[bool] = Decodable::decode(&mut decoder);
+        let v: ~[bool] = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~[true]);
 
         let mut decoder = Decoder::new(from_str("[true]").unwrap());
-        let v: ~[bool] = Decodable::decode(&mut decoder);
+        let v: ~[bool] = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~[true]);
 
         let mut decoder = Decoder::new(from_str("[3, 1]").unwrap());
-        let v: ~[int] = Decodable::decode(&mut decoder);
+        let v: ~[int] = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~[3, 1]);
 
         let mut decoder = Decoder::new(from_str("[[3], [1, 2]]").unwrap());
-        let v: ~[~[uint]] = Decodable::decode(&mut decoder);
+        let v: ~[~[uint]] = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(v, ~[~[3], ~[1, 2]]);
     }
 
     #[test]
     fn test_read_object() {
         assert_eq!(from_str("{"),
-            Err(Error {
-                line: 1u,
-                col: 2u,
-                msg: ~"EOF while parsing object"}));
+            Err(ParseError(~"EOF while parsing object", 1u, 2u)));
         assert_eq!(from_str("{ "),
-            Err(Error {
-                line: 1u,
-                col: 3u,
-                msg: ~"EOF while parsing object"}));
+            Err(ParseError(~"EOF while parsing object", 1u, 3u)));
         assert_eq!(from_str("{1"),
-            Err(Error {
-                line: 1u,
-                col: 2u,
-                msg: ~"key must be a string"}));
+            Err(ParseError(~"key must be a string", 1u, 2u)));
         assert_eq!(from_str("{ \"a\""),
-            Err(Error {
-                line: 1u,
-                col: 6u,
-                msg: ~"EOF while parsing object"}));
+            Err(ParseError(~"EOF while parsing object", 1u, 6u)));
         assert_eq!(from_str("{\"a\""),
-            Err(Error {
-                line: 1u,
-                col: 5u,
-                msg: ~"EOF while parsing object"}));
+            Err(ParseError(~"EOF while parsing object", 1u, 5u)));
         assert_eq!(from_str("{\"a\" "),
-            Err(Error {
-                line: 1u,
-                col: 6u,
-                msg: ~"EOF while parsing object"}));
+            Err(ParseError(~"EOF while parsing object", 1u, 6u)));
 
         assert_eq!(from_str("{\"a\" 1"),
-            Err(Error {line: 1u, col: 6u, msg: ~"expected `:`"}));
+            Err(ParseError(~"expected `:`", 1u, 6u)));
         assert_eq!(from_str("{\"a\":"),
-            Err(Error {line: 1u, col: 6u, msg: ~"EOF while parsing value"}));
+            Err(ParseError(~"EOF while parsing value", 1u, 6u)));
         assert_eq!(from_str("{\"a\":1"),
-            Err(Error {
-                line: 1u,
-                col: 7u,
-                msg: ~"EOF while parsing object"}));
+            Err(ParseError(~"EOF while parsing object", 1u, 7u)));
         assert_eq!(from_str("{\"a\":1 1"),
-            Err(Error {line: 1u, col: 8u, msg: ~"expected `,` or `}`"}));
+            Err(ParseError(~"expected `,` or `}`", 1u, 8u)));
         assert_eq!(from_str("{\"a\":1,"),
-            Err(Error {
-                line: 1u,
-                col: 8u,
-                msg: ~"EOF while parsing object"}));
+            Err(ParseError(~"EOF while parsing object", 1u, 8u)));
 
         assert_eq!(from_str("{}").unwrap(), mk_object([]));
         assert_eq!(from_str("{\"a\": 3}").unwrap(),
@@ -2324,7 +2303,7 @@ mod tests {
             ]
         }";
         let mut decoder = Decoder::new(from_str(s).unwrap());
-        let v: Outer = Decodable::decode(&mut decoder);
+        let v: Outer = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(
             v,
             Outer {
@@ -2338,23 +2317,23 @@ mod tests {
     #[test]
     fn test_decode_option() {
         let mut decoder = Decoder::new(from_str("null").unwrap());
-        let value: Option<~str> = Decodable::decode(&mut decoder);
+        let value: Option<~str> = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(value, None);
 
         let mut decoder = Decoder::new(from_str("\"jodhpurs\"").unwrap());
-        let value: Option<~str> = Decodable::decode(&mut decoder);
+        let value: Option<~str> = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(value, Some(~"jodhpurs"));
     }
 
     #[test]
     fn test_decode_enum() {
         let mut decoder = Decoder::new(from_str("\"Dog\"").unwrap());
-        let value: Animal = Decodable::decode(&mut decoder);
+        let value: Animal = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(value, Dog);
 
         let s = "{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}";
         let mut decoder = Decoder::new(from_str(s).unwrap());
-        let value: Animal = Decodable::decode(&mut decoder);
+        let value: Animal = Decodable::decode(&mut decoder).unwrap();
         assert_eq!(value, Frog(~"Henry", 349));
     }
 
@@ -2362,7 +2341,7 @@ mod tests {
     fn test_decode_map() {
         let s = ~"{\"a\": \"Dog\", \"b\": {\"variant\":\"Frog\",\"fields\":[\"Henry\", 349]}}";
         let mut decoder = Decoder::new(from_str(s).unwrap());
-        let mut map: TreeMap<~str, Animal> = Decodable::decode(&mut decoder);
+        let mut map: TreeMap<~str, Animal> = Decodable::decode(&mut decoder).unwrap();
 
         assert_eq!(map.pop(&~"a"), Some(Dog));
         assert_eq!(map.pop(&~"b"), Some(Frog(~"Henry", 349)));
@@ -2371,10 +2350,7 @@ mod tests {
     #[test]
     fn test_multiline_errors() {
         assert_eq!(from_str("{\n  \"foo\":\n \"bar\""),
-            Err(Error {
-                line: 3u,
-                col: 8u,
-                msg: ~"EOF while parsing object"}));
+            Err(ParseError(~"EOF while parsing object", 3u, 8u)));
     }
 
     #[deriving(Decodable)]
@@ -2389,60 +2365,48 @@ mod tests {
         A(f64),
         B(~str)
     }
-    fn check_err<T: Decodable<Decoder>>(to_parse: &'static str, expected_error: &str) {
-        use std::any::AnyRefExt;
-        use std::task;
-        let res = task::try(proc() {
-            // either fails in `decode` (which is what we want), or
-            // returns Some(error_message)/None if the string was
-            // invalid or valid JSON.
-            match from_str(to_parse) {
-                Err(e) => Some(e.to_str()),
-                Ok(json) => {
-                    let _: T = Decodable::decode(&mut Decoder::new(json));
-                    None
-                }
-            }
-        });
+    fn check_err<T: Decodable<Decoder, Error>>(to_parse: &'static str, expected: Error) {
+        let res: DecodeResult<T> = match from_str(to_parse) {
+            Err(e) => Err(e),
+            Ok(json) => Decodable::decode(&mut Decoder::new(json))
+        };
         match res {
-            Ok(Some(parse_error)) => fail!("`{}` is not valid json: {}",
-                                           to_parse, parse_error),
-            Ok(None) => fail!("`{}` parsed & decoded ok, expecting error `{}`",
-                              to_parse, expected_error),
+            Ok(_) => fail!("`{}` parsed & decoded ok, expecting error `{}`",
+                              to_parse, expected),
+            Err(ParseError(e, _, _)) => fail!("`{}` is not valid json: {}",
+                                           to_parse, e),
             Err(e) => {
-                let err = e.as_ref::<~str>().unwrap();
-                assert!(err.contains(expected_error),
-                        "`{}` errored incorrectly, found `{}` expecting `{}`",
-                        to_parse, *err, expected_error);
+                assert_eq!(e, expected);
             }
+
         }
     }
     #[test]
     fn test_decode_errors_struct() {
-        check_err::<DecodeStruct>("[]", "object but found list");
+        check_err::<DecodeStruct>("[]", ExpectedError(~"Object", ~"[]"));
         check_err::<DecodeStruct>("{\"x\": true, \"y\": true, \"z\": \"\", \"w\": []}",
-                                  "number but found boolean");
+                                  ExpectedError(~"Number", ~"true"));
         check_err::<DecodeStruct>("{\"x\": 1, \"y\": [], \"z\": \"\", \"w\": []}",
-                                  "boolean but found list");
+                                  ExpectedError(~"Boolean", ~"[]"));
         check_err::<DecodeStruct>("{\"x\": 1, \"y\": true, \"z\": {}, \"w\": []}",
-                                  "string but found object");
+                                  ExpectedError(~"String", ~"{}"));
         check_err::<DecodeStruct>("{\"x\": 1, \"y\": true, \"z\": \"\", \"w\": null}",
-                                  "list but found null");
+                                  ExpectedError(~"List", ~"null"));
         check_err::<DecodeStruct>("{\"x\": 1, \"y\": true, \"z\": \"\"}",
-                                  "'w' field in object");
+                                  MissingFieldError(~"w"));
     }
     #[test]
     fn test_decode_errors_enum() {
         check_err::<DecodeEnum>("{}",
-                                "'variant' field in object");
+                                MissingFieldError(~"variant"));
         check_err::<DecodeEnum>("{\"variant\": 1}",
-                                "string but found number");
+                                ExpectedError(~"String", ~"1"));
         check_err::<DecodeEnum>("{\"variant\": \"A\"}",
-                                "'fields' field in object");
+                                MissingFieldError(~"fields"));
         check_err::<DecodeEnum>("{\"variant\": \"A\", \"fields\": null}",
-                                "list but found null");
+                                ExpectedError(~"List", ~"null"));
         check_err::<DecodeEnum>("{\"variant\": \"C\", \"fields\": []}",
-                                "unknown variant name");
+                                UnknownVariantError(~"C"));
     }
 
     #[test]
@@ -2561,7 +2525,7 @@ mod tests {
         let mut mem_buf = MemWriter::new();
         {
             let mut encoder = Encoder::new(&mut mem_buf as &mut io::Writer);
-            hm.encode(&mut encoder)
+            hm.encode(&mut encoder).unwrap();
         }
         let bytes = mem_buf.unwrap();
         let json_str = from_utf8(bytes).unwrap();
@@ -2581,7 +2545,7 @@ mod tests {
         let mut mem_buf = MemWriter::new();
         {
             let mut encoder = PrettyEncoder::new(&mut mem_buf as &mut io::Writer);
-            hm.encode(&mut encoder)
+            hm.encode(&mut encoder).unwrap();
         }
         let bytes = mem_buf.unwrap();
         let json_str = from_utf8(bytes).unwrap();
@@ -2600,6 +2564,6 @@ mod tests {
             Ok(o) => o
         };
         let mut decoder = Decoder::new(json_obj);
-        let hm: HashMap<uint, bool> = Decodable::decode(&mut decoder);
+        let _hm: HashMap<uint, bool> = Decodable::decode(&mut decoder).unwrap();
     }
 }
diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs
index 8a5829da9d6..7d50ad86aeb 100644
--- a/src/libserialize/lib.rs
+++ b/src/libserialize/lib.rs
@@ -14,14 +14,14 @@
 Core encoding and decoding interfaces.
 */
 
-#[crate_id = "serialize#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-#[feature(macro_rules, managed_boxes, default_type_params, phase)];
+#![crate_id = "serialize#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+#![feature(macro_rules, managed_boxes, default_type_params, phase)]
 
 // test harness access
 #[cfg(test)]
diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs
index a65443653cc..6cda8d9ffb5 100644
--- a/src/libserialize/serialize.rs
+++ b/src/libserialize/serialize.rs
@@ -18,444 +18,465 @@ use std::path;
 use std::rc::Rc;
 use std::slice;
 
-pub trait Encoder {
+pub trait Encoder<E> {
     // Primitive types:
-    fn emit_nil(&mut self);
-    fn emit_uint(&mut self, v: uint);
-    fn emit_u64(&mut self, v: u64);
-    fn emit_u32(&mut self, v: u32);
-    fn emit_u16(&mut self, v: u16);
-    fn emit_u8(&mut self, v: u8);
-    fn emit_int(&mut self, v: int);
-    fn emit_i64(&mut self, v: i64);
-    fn emit_i32(&mut self, v: i32);
-    fn emit_i16(&mut self, v: i16);
-    fn emit_i8(&mut self, v: i8);
-    fn emit_bool(&mut self, v: bool);
-    fn emit_f64(&mut self, v: f64);
-    fn emit_f32(&mut self, v: f32);
-    fn emit_char(&mut self, v: char);
-    fn emit_str(&mut self, v: &str);
+    fn emit_nil(&mut self) -> Result<(), E>;
+    fn emit_uint(&mut self, v: uint) -> Result<(), E>;
+    fn emit_u64(&mut self, v: u64) -> Result<(), E>;
+    fn emit_u32(&mut self, v: u32) -> Result<(), E>;
+    fn emit_u16(&mut self, v: u16) -> Result<(), E>;
+    fn emit_u8(&mut self, v: u8) -> Result<(), E>;
+    fn emit_int(&mut self, v: int) -> Result<(), E>;
+    fn emit_i64(&mut self, v: i64) -> Result<(), E>;
+    fn emit_i32(&mut self, v: i32) -> Result<(), E>;
+    fn emit_i16(&mut self, v: i16) -> Result<(), E>;
+    fn emit_i8(&mut self, v: i8) -> Result<(), E>;
+    fn emit_bool(&mut self, v: bool) -> Result<(), E>;
+    fn emit_f64(&mut self, v: f64) -> Result<(), E>;
+    fn emit_f32(&mut self, v: f32) -> Result<(), E>;
+    fn emit_char(&mut self, v: char) -> Result<(), E>;
+    fn emit_str(&mut self, v: &str) -> Result<(), E>;
 
     // Compound types:
-    fn emit_enum(&mut self, name: &str, f: |&mut Self|);
+    fn emit_enum(&mut self, name: &str, f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
 
     fn emit_enum_variant(&mut self,
                          v_name: &str,
                          v_id: uint,
                          len: uint,
-                         f: |&mut Self|);
-    fn emit_enum_variant_arg(&mut self, a_idx: uint, f: |&mut Self|);
+                         f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
+    fn emit_enum_variant_arg(&mut self,
+                             a_idx: uint,
+                             f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
 
     fn emit_enum_struct_variant(&mut self,
                                 v_name: &str,
                                 v_id: uint,
                                 len: uint,
-                                f: |&mut Self|);
+                                f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
     fn emit_enum_struct_variant_field(&mut self,
                                       f_name: &str,
                                       f_idx: uint,
-                                      f: |&mut Self|);
+                                      f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
 
-    fn emit_struct(&mut self, name: &str, len: uint, f: |&mut Self|);
+    fn emit_struct(&mut self,
+                   name: &str,
+                   len: uint,
+                   f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
     fn emit_struct_field(&mut self,
                          f_name: &str,
                          f_idx: uint,
-                         f: |&mut Self|);
+                         f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
 
-    fn emit_tuple(&mut self, len: uint, f: |&mut Self|);
-    fn emit_tuple_arg(&mut self, idx: uint, f: |&mut Self|);
+    fn emit_tuple(&mut self, len: uint, f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
+    fn emit_tuple_arg(&mut self, idx: uint, f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
 
-    fn emit_tuple_struct(&mut self, name: &str, len: uint, f: |&mut Self|);
-    fn emit_tuple_struct_arg(&mut self, f_idx: uint, f: |&mut Self|);
+    fn emit_tuple_struct(&mut self,
+                         name: &str,
+                         len: uint,
+                         f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
+    fn emit_tuple_struct_arg(&mut self,
+                             f_idx: uint,
+                             f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
 
     // Specialized types:
-    fn emit_option(&mut self, f: |&mut Self|);
-    fn emit_option_none(&mut self);
-    fn emit_option_some(&mut self, f: |&mut Self|);
+    fn emit_option(&mut self, f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
+    fn emit_option_none(&mut self) -> Result<(), E>;
+    fn emit_option_some(&mut self, f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
 
-    fn emit_seq(&mut self, len: uint, f: |this: &mut Self|);
-    fn emit_seq_elt(&mut self, idx: uint, f: |this: &mut Self|);
+    fn emit_seq(&mut self, len: uint, f: |this: &mut Self| -> Result<(), E>) -> Result<(), E>;
+    fn emit_seq_elt(&mut self, idx: uint, f: |this: &mut Self| -> Result<(), E>) -> Result<(), E>;
 
-    fn emit_map(&mut self, len: uint, f: |&mut Self|);
-    fn emit_map_elt_key(&mut self, idx: uint, f: |&mut Self|);
-    fn emit_map_elt_val(&mut self, idx: uint, f: |&mut Self|);
+    fn emit_map(&mut self, len: uint, f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
+    fn emit_map_elt_key(&mut self, idx: uint, f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
+    fn emit_map_elt_val(&mut self, idx: uint, f: |&mut Self| -> Result<(), E>) -> Result<(), E>;
 }
 
-pub trait Decoder {
+pub trait Decoder<E> {
     // Primitive types:
-    fn read_nil(&mut self) -> ();
-    fn read_uint(&mut self) -> uint;
-    fn read_u64(&mut self) -> u64;
-    fn read_u32(&mut self) -> u32;
-    fn read_u16(&mut self) -> u16;
-    fn read_u8(&mut self) -> u8;
-    fn read_int(&mut self) -> int;
-    fn read_i64(&mut self) -> i64;
-    fn read_i32(&mut self) -> i32;
-    fn read_i16(&mut self) -> i16;
-    fn read_i8(&mut self) -> i8;
-    fn read_bool(&mut self) -> bool;
-    fn read_f64(&mut self) -> f64;
-    fn read_f32(&mut self) -> f32;
-    fn read_char(&mut self) -> char;
-    fn read_str(&mut self) -> ~str;
+    fn read_nil(&mut self) -> Result<(), E>;
+    fn read_uint(&mut self) -> Result<uint, E>;
+    fn read_u64(&mut self) -> Result<u64, E>;
+    fn read_u32(&mut self) -> Result<u32, E>;
+    fn read_u16(&mut self) -> Result<u16, E>;
+    fn read_u8(&mut self) -> Result<u8, E>;
+    fn read_int(&mut self) -> Result<int, E>;
+    fn read_i64(&mut self) -> Result<i64, E>;
+    fn read_i32(&mut self) -> Result<i32, E>;
+    fn read_i16(&mut self) -> Result<i16, E>;
+    fn read_i8(&mut self) -> Result<i8, E>;
+    fn read_bool(&mut self) -> Result<bool, E>;
+    fn read_f64(&mut self) -> Result<f64, E>;
+    fn read_f32(&mut self) -> Result<f32, E>;
+    fn read_char(&mut self) -> Result<char, E>;
+    fn read_str(&mut self) -> Result<~str, E>;
 
     // Compound types:
-    fn read_enum<T>(&mut self, name: &str, f: |&mut Self| -> T) -> T;
+    fn read_enum<T>(&mut self, name: &str, f: |&mut Self| -> Result<T, E>) -> Result<T, E>;
 
     fn read_enum_variant<T>(&mut self,
                             names: &[&str],
-                            f: |&mut Self, uint| -> T)
-                            -> T;
+                            f: |&mut Self, uint| -> Result<T, E>)
+                            -> Result<T, E>;
     fn read_enum_variant_arg<T>(&mut self,
                                 a_idx: uint,
-                                f: |&mut Self| -> T)
-                                -> T;
+                                f: |&mut Self| -> Result<T, E>)
+                                -> Result<T, E>;
 
     fn read_enum_struct_variant<T>(&mut self,
                                    names: &[&str],
-                                   f: |&mut Self, uint| -> T)
-                                   -> T;
+                                   f: |&mut Self, uint| -> Result<T, E>)
+                                   -> Result<T, E>;
     fn read_enum_struct_variant_field<T>(&mut self,
                                          &f_name: &str,
                                          f_idx: uint,
-                                         f: |&mut Self| -> T)
-                                         -> T;
+                                         f: |&mut Self| -> Result<T, E>)
+                                         -> Result<T, E>;
 
-    fn read_struct<T>(&mut self, s_name: &str, len: uint, f: |&mut Self| -> T)
-                      -> T;
+    fn read_struct<T>(&mut self, s_name: &str, len: uint, f: |&mut Self| -> Result<T, E>)
+                      -> Result<T, E>;
     fn read_struct_field<T>(&mut self,
                             f_name: &str,
                             f_idx: uint,
-                            f: |&mut Self| -> T)
-                            -> T;
+                            f: |&mut Self| -> Result<T, E>)
+                            -> Result<T, E>;
 
-    fn read_tuple<T>(&mut self, f: |&mut Self, uint| -> T) -> T;
-    fn read_tuple_arg<T>(&mut self, a_idx: uint, f: |&mut Self| -> T) -> T;
+    fn read_tuple<T>(&mut self, f: |&mut Self, uint| -> Result<T, E>) -> Result<T, E>;
+    fn read_tuple_arg<T>(&mut self, a_idx: uint, f: |&mut Self| -> Result<T, E>) -> Result<T, E>;
 
     fn read_tuple_struct<T>(&mut self,
                             s_name: &str,
-                            f: |&mut Self, uint| -> T)
-                            -> T;
+                            f: |&mut Self, uint| -> Result<T, E>)
+                            -> Result<T, E>;
     fn read_tuple_struct_arg<T>(&mut self,
                                 a_idx: uint,
-                                f: |&mut Self| -> T)
-                                -> T;
+                                f: |&mut Self| -> Result<T, E>)
+                                -> Result<T, E>;
 
     // Specialized types:
-    fn read_option<T>(&mut self, f: |&mut Self, bool| -> T) -> T;
+    fn read_option<T>(&mut self, f: |&mut Self, bool| -> Result<T, E>) -> Result<T, E>;
 
-    fn read_seq<T>(&mut self, f: |&mut Self, uint| -> T) -> T;
-    fn read_seq_elt<T>(&mut self, idx: uint, f: |&mut Self| -> T) -> T;
+    fn read_seq<T>(&mut self, f: |&mut Self, uint| -> Result<T, E>) -> Result<T, E>;
+    fn read_seq_elt<T>(&mut self, idx: uint, f: |&mut Self| -> Result<T, E>) -> Result<T, E>;
 
-    fn read_map<T>(&mut self, f: |&mut Self, uint| -> T) -> T;
-    fn read_map_elt_key<T>(&mut self, idx: uint, f: |&mut Self| -> T) -> T;
-    fn read_map_elt_val<T>(&mut self, idx: uint, f: |&mut Self| -> T) -> T;
+    fn read_map<T>(&mut self, f: |&mut Self, uint| -> Result<T, E>) -> Result<T, E>;
+    fn read_map_elt_key<T>(&mut self, idx: uint, f: |&mut Self| -> Result<T, E>) -> Result<T, E>;
+    fn read_map_elt_val<T>(&mut self, idx: uint, f: |&mut Self| -> Result<T, E>) -> Result<T, E>;
 }
 
-pub trait Encodable<S:Encoder> {
-    fn encode(&self, s: &mut S);
+pub trait Encodable<S:Encoder<E>, E> {
+    fn encode(&self, s: &mut S) -> Result<(), E>;
 }
 
-pub trait Decodable<D:Decoder> {
-    fn decode(d: &mut D) -> Self;
+pub trait Decodable<D:Decoder<E>, E> {
+    fn decode(d: &mut D) -> Result<Self, E>;
 }
 
-impl<S:Encoder> Encodable<S> for uint {
-    fn encode(&self, s: &mut S) {
+macro_rules! try ( ($e:expr) => (
+    match $e { Ok(v) => v, Err(e) => return Err(e) }
+))
+
+impl<E, S:Encoder<E>> Encodable<S, E> for uint {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_uint(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for uint {
-    fn decode(d: &mut D) -> uint {
+impl<E, D:Decoder<E>> Decodable<D, E> for uint {
+    fn decode(d: &mut D) -> Result<uint, E> {
         d.read_uint()
     }
 }
 
-impl<S:Encoder> Encodable<S> for u8 {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for u8 {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_u8(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for u8 {
-    fn decode(d: &mut D) -> u8 {
+impl<E, D:Decoder<E>> Decodable<D, E> for u8 {
+    fn decode(d: &mut D) -> Result<u8, E> {
         d.read_u8()
     }
 }
 
-impl<S:Encoder> Encodable<S> for u16 {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for u16 {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_u16(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for u16 {
-    fn decode(d: &mut D) -> u16 {
+impl<E, D:Decoder<E>> Decodable<D, E> for u16 {
+    fn decode(d: &mut D) -> Result<u16, E> {
         d.read_u16()
     }
 }
 
-impl<S:Encoder> Encodable<S> for u32 {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for u32 {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_u32(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for u32 {
-    fn decode(d: &mut D) -> u32 {
+impl<E, D:Decoder<E>> Decodable<D, E> for u32 {
+    fn decode(d: &mut D) -> Result<u32, E> {
         d.read_u32()
     }
 }
 
-impl<S:Encoder> Encodable<S> for u64 {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for u64 {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_u64(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for u64 {
-    fn decode(d: &mut D) -> u64 {
+impl<E, D:Decoder<E>> Decodable<D, E> for u64 {
+    fn decode(d: &mut D) -> Result<u64, E> {
         d.read_u64()
     }
 }
 
-impl<S:Encoder> Encodable<S> for int {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for int {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_int(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for int {
-    fn decode(d: &mut D) -> int {
+impl<E, D:Decoder<E>> Decodable<D, E> for int {
+    fn decode(d: &mut D) -> Result<int, E> {
         d.read_int()
     }
 }
 
-impl<S:Encoder> Encodable<S> for i8 {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for i8 {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_i8(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for i8 {
-    fn decode(d: &mut D) -> i8 {
+impl<E, D:Decoder<E>> Decodable<D, E> for i8 {
+    fn decode(d: &mut D) -> Result<i8, E> {
         d.read_i8()
     }
 }
 
-impl<S:Encoder> Encodable<S> for i16 {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for i16 {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_i16(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for i16 {
-    fn decode(d: &mut D) -> i16 {
+impl<E, D:Decoder<E>> Decodable<D, E> for i16 {
+    fn decode(d: &mut D) -> Result<i16, E> {
         d.read_i16()
     }
 }
 
-impl<S:Encoder> Encodable<S> for i32 {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for i32 {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_i32(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for i32 {
-    fn decode(d: &mut D) -> i32 {
+impl<E, D:Decoder<E>> Decodable<D, E> for i32 {
+    fn decode(d: &mut D) -> Result<i32, E> {
         d.read_i32()
     }
 }
 
-impl<S:Encoder> Encodable<S> for i64 {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for i64 {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_i64(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for i64 {
-    fn decode(d: &mut D) -> i64 {
+impl<E, D:Decoder<E>> Decodable<D, E> for i64 {
+    fn decode(d: &mut D) -> Result<i64, E> {
         d.read_i64()
     }
 }
 
-impl<'a, S:Encoder> Encodable<S> for &'a str {
-    fn encode(&self, s: &mut S) {
+impl<'a, E, S:Encoder<E>> Encodable<S, E> for &'a str {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_str(*self)
     }
 }
 
-impl<S:Encoder> Encodable<S> for ~str {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for ~str {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_str(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for ~str {
-    fn decode(d: &mut D) -> ~str {
+impl<E, D:Decoder<E>> Decodable<D, E> for ~str {
+    fn decode(d: &mut D) -> Result<~str, E> {
         d.read_str()
     }
 }
 
-impl<S:Encoder> Encodable<S> for f32 {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for f32 {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_f32(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for f32 {
-    fn decode(d: &mut D) -> f32 {
+impl<E, D:Decoder<E>> Decodable<D, E> for f32 {
+    fn decode(d: &mut D) -> Result<f32, E> {
         d.read_f32()
     }
 }
 
-impl<S:Encoder> Encodable<S> for f64 {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for f64 {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_f64(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for f64 {
-    fn decode(d: &mut D) -> f64 {
+impl<E, D:Decoder<E>> Decodable<D, E> for f64 {
+    fn decode(d: &mut D) -> Result<f64, E> {
         d.read_f64()
     }
 }
 
-impl<S:Encoder> Encodable<S> for bool {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for bool {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_bool(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for bool {
-    fn decode(d: &mut D) -> bool {
+impl<E, D:Decoder<E>> Decodable<D, E> for bool {
+    fn decode(d: &mut D) -> Result<bool, E> {
         d.read_bool()
     }
 }
 
-impl<S:Encoder> Encodable<S> for char {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for char {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_char(*self)
     }
 }
 
-impl<D:Decoder> Decodable<D> for char {
-    fn decode(d: &mut D) -> char {
+impl<E, D:Decoder<E>> Decodable<D, E> for char {
+    fn decode(d: &mut D) -> Result<char, E> {
         d.read_char()
     }
 }
 
-impl<S:Encoder> Encodable<S> for () {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>> Encodable<S, E> for () {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_nil()
     }
 }
 
-impl<D:Decoder> Decodable<D> for () {
-    fn decode(d: &mut D) -> () {
+impl<E, D:Decoder<E>> Decodable<D, E> for () {
+    fn decode(d: &mut D) -> Result<(), E> {
         d.read_nil()
     }
 }
 
-impl<'a, S:Encoder,T:Encodable<S>> Encodable<S> for &'a T {
-    fn encode(&self, s: &mut S) {
+impl<'a, E, S:Encoder<E>,T:Encodable<S, E>> Encodable<S, E> for &'a T {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         (**self).encode(s)
     }
 }
 
-impl<S:Encoder,T:Encodable<S>> Encodable<S> for ~T {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>,T:Encodable<S, E>> Encodable<S, E> for ~T {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         (**self).encode(s)
     }
 }
 
-impl<D:Decoder,T:Decodable<D>> Decodable<D> for ~T {
-    fn decode(d: &mut D) -> ~T {
-        ~Decodable::decode(d)
+impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for ~T {
+    fn decode(d: &mut D) -> Result<~T, E> {
+        Ok(~try!(Decodable::decode(d)))
     }
 }
 
-impl<S:Encoder,T:Encodable<S>> Encodable<S> for @T {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>,T:Encodable<S, E>> Encodable<S, E> for @T {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         (**self).encode(s)
     }
 }
 
-impl<S:Encoder,T:Encodable<S>> Encodable<S> for Rc<T> {
+impl<E, S:Encoder<E>,T:Encodable<S, E>> Encodable<S, E> for Rc<T> {
     #[inline]
-    fn encode(&self, s: &mut S) {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         (**self).encode(s)
     }
 }
 
-impl<D:Decoder,T:Decodable<D>> Decodable<D> for Rc<T> {
+impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for Rc<T> {
     #[inline]
-    fn decode(d: &mut D) -> Rc<T> {
-        Rc::new(Decodable::decode(d))
+    fn decode(d: &mut D) -> Result<Rc<T>, E> {
+        Ok(Rc::new(try!(Decodable::decode(d))))
     }
 }
 
-impl<D:Decoder,T:Decodable<D> + 'static> Decodable<D> for @T {
-    fn decode(d: &mut D) -> @T {
-        @Decodable::decode(d)
+impl<E, D:Decoder<E>,T:Decodable<D, E> + 'static> Decodable<D, E> for @T {
+    fn decode(d: &mut D) -> Result<@T, E> {
+        Ok(@try!(Decodable::decode(d)))
     }
 }
 
-impl<'a, S:Encoder,T:Encodable<S>> Encodable<S> for &'a [T] {
-    fn encode(&self, s: &mut S) {
+impl<'a, E, S:Encoder<E>,T:Encodable<S, E>> Encodable<S, E> for &'a [T] {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_seq(self.len(), |s| {
             for (i, e) in self.iter().enumerate() {
-                s.emit_seq_elt(i, |s| e.encode(s))
+                try!(s.emit_seq_elt(i, |s| e.encode(s)))
             }
+            Ok(())
         })
     }
 }
 
-impl<S:Encoder,T:Encodable<S>> Encodable<S> for ~[T] {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>,T:Encodable<S, E>> Encodable<S, E> for ~[T] {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_seq(self.len(), |s| {
             for (i, e) in self.iter().enumerate() {
-                s.emit_seq_elt(i, |s| e.encode(s))
+                try!(s.emit_seq_elt(i, |s| e.encode(s)))
             }
+            Ok(())
         })
     }
 }
 
-impl<D:Decoder,T:Decodable<D>> Decodable<D> for ~[T] {
-    fn decode(d: &mut D) -> ~[T] {
+impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for ~[T] {
+    fn decode(d: &mut D) -> Result<~[T], E> {
         d.read_seq(|d, len| {
-            slice::from_fn(len, |i| {
-                d.read_seq_elt(i, |d| Decodable::decode(d))
-            })
+            let mut v: ~[T] = slice::with_capacity(len);
+            for i in range(0, len) {
+                v.push(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
+            }
+            Ok(v)
         })
     }
 }
 
-impl<S:Encoder,T:Encodable<S>> Encodable<S> for Vec<T> {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>,T:Encodable<S, E>> Encodable<S, E> for Vec<T> {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_seq(self.len(), |s| {
             for (i, e) in self.iter().enumerate() {
-                s.emit_seq_elt(i, |s| e.encode(s))
+                try!(s.emit_seq_elt(i, |s| e.encode(s)))
             }
+            Ok(())
         })
     }
 }
 
-impl<D:Decoder,T:Decodable<D>> Decodable<D> for Vec<T> {
-    fn decode(d: &mut D) -> Vec<T> {
+impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for Vec<T> {
+    fn decode(d: &mut D) -> Result<Vec<T>, E> {
         d.read_seq(|d, len| {
-            Vec::from_fn(len, |i| {
-                d.read_seq_elt(i, |d| Decodable::decode(d))
-            })
+            let mut v = Vec::with_capacity(len);
+            for i in range(0, len) {
+                v.push(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
+            }
+            Ok(v)
         })
     }
 }
 
-impl<S:Encoder,T:Encodable<S>> Encodable<S> for Option<T> {
-    fn encode(&self, s: &mut S) {
+impl<E, S:Encoder<E>,T:Encodable<S, E>> Encodable<S, E> for Option<T> {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_option(|s| {
             match *self {
                 None => s.emit_option_none(),
@@ -465,13 +486,13 @@ impl<S:Encoder,T:Encodable<S>> Encodable<S> for Option<T> {
     }
 }
 
-impl<D:Decoder,T:Decodable<D>> Decodable<D> for Option<T> {
-    fn decode(d: &mut D) -> Option<T> {
+impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for Option<T> {
+    fn decode(d: &mut D) -> Result<Option<T>, E> {
         d.read_option(|d, b| {
             if b {
-                Some(Decodable::decode(d))
+                Ok(Some(try!(Decodable::decode(d))))
             } else {
-                None
+                Ok(None)
             }
         })
     }
@@ -482,30 +503,31 @@ macro_rules! peel(($name:ident, $($other:ident,)*) => (tuple!($($other,)*)))
 macro_rules! tuple (
     () => ();
     ( $($name:ident,)+ ) => (
-        impl<D:Decoder,$($name:Decodable<D>),*> Decodable<D> for ($($name,)*) {
+        impl<E, D:Decoder<E>,$($name:Decodable<D, E>),*> Decodable<D,E> for ($($name,)*) {
             #[allow(uppercase_variables)]
-            fn decode(d: &mut D) -> ($($name,)*) {
+            fn decode(d: &mut D) -> Result<($($name,)*), E> {
                 d.read_tuple(|d, amt| {
                     let mut i = 0;
-                    let ret = ($(d.read_tuple_arg({ i+=1; i-1 }, |d| -> $name {
+                    let ret = ($(try!(d.read_tuple_arg({ i+=1; i-1 }, |d| -> Result<$name,E> {
                         Decodable::decode(d)
-                    }),)*);
+                    })),)*);
                     assert!(amt == i,
                             "expected tuple of length `{}`, found tuple \
                              of length `{}`", i, amt);
-                    return ret;
+                    return Ok(ret);
                 })
             }
         }
-        impl<S:Encoder,$($name:Encodable<S>),*> Encodable<S> for ($($name,)*) {
+        impl<E, S:Encoder<E>,$($name:Encodable<S, E>),*> Encodable<S, E> for ($($name,)*) {
             #[allow(uppercase_variables)]
-            fn encode(&self, s: &mut S) {
+            fn encode(&self, s: &mut S) -> Result<(), E> {
                 let ($(ref $name,)*) = *self;
                 let mut n = 0;
                 $(let $name = $name; n += 1;)*
                 s.emit_tuple(n, |s| {
                     let mut i = 0;
-                    $(s.emit_seq_elt({ i+=1; i-1 }, |s| $name.encode(s));)*
+                    $(try!(s.emit_seq_elt({ i+=1; i-1 }, |s| $name.encode(s)));)*
+                    Ok(())
                 })
             }
         }
@@ -515,29 +537,29 @@ macro_rules! tuple (
 
 tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
 
-impl<E: Encoder> Encodable<E> for path::posix::Path {
-    fn encode(&self, e: &mut E) {
+impl<E, S: Encoder<E>> Encodable<S, E> for path::posix::Path {
+    fn encode(&self, e: &mut S) -> Result<(), E> {
         self.as_vec().encode(e)
     }
 }
 
-impl<D: Decoder> Decodable<D> for path::posix::Path {
-    fn decode(d: &mut D) -> path::posix::Path {
-        let bytes: ~[u8] = Decodable::decode(d);
-        path::posix::Path::new(bytes)
+impl<E, D: Decoder<E>> Decodable<D, E> for path::posix::Path {
+    fn decode(d: &mut D) -> Result<path::posix::Path, E> {
+        let bytes: ~[u8] = try!(Decodable::decode(d));
+        Ok(path::posix::Path::new(bytes))
     }
 }
 
-impl<E: Encoder> Encodable<E> for path::windows::Path {
-    fn encode(&self, e: &mut E) {
+impl<E, S: Encoder<E>> Encodable<S, E> for path::windows::Path {
+    fn encode(&self, e: &mut S) -> Result<(), E> {
         self.as_vec().encode(e)
     }
 }
 
-impl<D: Decoder> Decodable<D> for path::windows::Path {
-    fn decode(d: &mut D) -> path::windows::Path {
-        let bytes: ~[u8] = Decodable::decode(d);
-        path::windows::Path::new(bytes)
+impl<E, D: Decoder<E>> Decodable<D, E> for path::windows::Path {
+    fn decode(d: &mut D) -> Result<path::windows::Path, E> {
+        let bytes: ~[u8] = try!(Decodable::decode(d));
+        Ok(path::windows::Path::new(bytes))
     }
 }
 
@@ -546,32 +568,37 @@ impl<D: Decoder> Decodable<D> for path::windows::Path {
 //
 // In some cases, these should eventually be coded as traits.
 
-pub trait EncoderHelpers {
-    fn emit_from_vec<T>(&mut self, v: &[T], f: |&mut Self, v: &T|);
+pub trait EncoderHelpers<E> {
+    fn emit_from_vec<T>(&mut self,
+                        v: &[T],
+                        f: |&mut Self, v: &T| -> Result<(), E>) -> Result<(), E>;
 }
 
-impl<S:Encoder> EncoderHelpers for S {
-    fn emit_from_vec<T>(&mut self, v: &[T], f: |&mut S, &T|) {
+impl<E, S:Encoder<E>> EncoderHelpers<E> for S {
+    fn emit_from_vec<T>(&mut self, v: &[T], f: |&mut S, &T| -> Result<(), E>) -> Result<(), E> {
         self.emit_seq(v.len(), |this| {
             for (i, e) in v.iter().enumerate() {
-                this.emit_seq_elt(i, |this| {
+                try!(this.emit_seq_elt(i, |this| {
                     f(this, e)
-                })
+                }));
             }
+            Ok(())
         })
     }
 }
 
-pub trait DecoderHelpers {
-    fn read_to_vec<T>(&mut self, f: |&mut Self| -> T) -> ~[T];
+pub trait DecoderHelpers<E> {
+    fn read_to_vec<T>(&mut self, f: |&mut Self| -> Result<T, E>) -> Result<~[T], E>;
 }
 
-impl<D:Decoder> DecoderHelpers for D {
-    fn read_to_vec<T>(&mut self, f: |&mut D| -> T) -> ~[T] {
+impl<E, D:Decoder<E>> DecoderHelpers<E> for D {
+    fn read_to_vec<T>(&mut self, f: |&mut D| -> Result<T, E>) -> Result<~[T], E> {
         self.read_seq(|this, len| {
-            slice::from_fn(len, |i| {
-                this.read_seq_elt(i, |this| f(this))
-            })
+            let mut v = slice::with_capacity(len);
+            for i in range(0, len) {
+                v.push(try!(this.read_seq_elt(i, |this| f(this))));
+            }
+            Ok(v)
         })
     }
 }
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs
index 85df875dc1d..a52658da209 100644
--- a/src/libstd/ascii.rs
+++ b/src/libstd/ascii.rs
@@ -25,7 +25,7 @@ use option::{Option, Some, None};
 
 /// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.
 #[deriving(Clone, Eq, Ord, TotalOrd, TotalEq, Hash)]
-pub struct Ascii { priv chr: u8 }
+pub struct Ascii { chr: u8 }
 
 impl Ascii {
     /// Converts an ascii character into a `u8`.
@@ -43,19 +43,19 @@ impl Ascii {
     /// Convert to lowercase.
     #[inline]
     pub fn to_lower(self) -> Ascii {
-        Ascii{chr: ASCII_LOWER_MAP[self.chr]}
+        Ascii{chr: ASCII_LOWER_MAP[self.chr as uint]}
     }
 
     /// Convert to uppercase.
     #[inline]
     pub fn to_upper(self) -> Ascii {
-        Ascii{chr: ASCII_UPPER_MAP[self.chr]}
+        Ascii{chr: ASCII_UPPER_MAP[self.chr as uint]}
     }
 
     /// Compares two ascii characters of equality, ignoring case.
     #[inline]
     pub fn eq_ignore_case(self, other: Ascii) -> bool {
-        ASCII_LOWER_MAP[self.chr] == ASCII_LOWER_MAP[other.chr]
+        ASCII_LOWER_MAP[self.chr as uint] == ASCII_LOWER_MAP[other.chr as uint]
     }
 
     // the following methods are like ctype, and the implementation is inspired by musl
@@ -285,12 +285,12 @@ impl<'a> AsciiStr for &'a [Ascii] {
 
     #[inline]
     fn to_lower(&self) -> ~[Ascii] {
-        self.map(|a| a.to_lower())
+        self.iter().map(|a| a.to_lower()).collect()
     }
 
     #[inline]
     fn to_upper(&self) -> ~[Ascii] {
-        self.map(|a| a.to_upper())
+        self.iter().map(|a| a.to_upper()).collect()
     }
 
     #[inline]
@@ -370,8 +370,12 @@ impl<'a> StrAsciiExt for &'a str {
 
     #[inline]
     fn eq_ignore_ascii_case(&self, other: &str) -> bool {
-        self.len() == other.len() && self.as_bytes().iter().zip(other.as_bytes().iter()).all(
-            |(byte_self, byte_other)| ASCII_LOWER_MAP[*byte_self] == ASCII_LOWER_MAP[*byte_other])
+        self.len() == other.len() &&
+            self.as_bytes().iter().zip(other.as_bytes().iter()).all(
+            |(byte_self, byte_other)| {
+                ASCII_LOWER_MAP[*byte_self as uint] ==
+                    ASCII_LOWER_MAP[*byte_other as uint]
+            })
     }
 }
 
@@ -392,7 +396,7 @@ unsafe fn str_map_bytes(string: ~str, map: &'static [u8]) -> ~str {
     let mut bytes = string.into_bytes();
 
     for b in bytes.mut_iter() {
-        *b = map[*b];
+        *b = map[*b as uint];
     }
 
     str::raw::from_utf8_owned(bytes)
@@ -400,7 +404,7 @@ unsafe fn str_map_bytes(string: ~str, map: &'static [u8]) -> ~str {
 
 #[inline]
 unsafe fn str_copy_map_bytes(string: &str, map: &'static [u8]) -> ~str {
-    let bytes = string.bytes().map(|b| map[b]).collect::<~[_]>();
+    let bytes = string.bytes().map(|b| map[b as uint]).collect::<~[_]>();
 
     str::raw::from_utf8_owned(bytes)
 }
diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs
index 96c7c218127..ca1a05a2647 100644
--- a/src/libstd/c_str.rs
+++ b/src/libstd/c_str.rs
@@ -86,8 +86,8 @@ use raw::Slice;
 /// This structure wraps a `*libc::c_char`, and will automatically free the
 /// memory it is pointing to when it goes out of scope.
 pub struct CString {
-    priv buf: *libc::c_char,
-    priv owns_buffer_: bool,
+    buf: *libc::c_char,
+    owns_buffer_: bool,
 }
 
 impl Clone for CString {
@@ -373,8 +373,8 @@ fn check_for_null(v: &[u8], buf: *mut libc::c_char) {
 ///
 /// Use with the `std::iter` module.
 pub struct CChars<'a> {
-    priv ptr: *libc::c_char,
-    priv marker: marker::ContravariantLifetime<'a>,
+    ptr: *libc::c_char,
+    marker: marker::ContravariantLifetime<'a>,
 }
 
 impl<'a> Iterator<libc::c_char> for CChars<'a> {
diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs
index 00d250a5fc7..3b6b914cf14 100644
--- a/src/libstd/c_vec.rs
+++ b/src/libstd/c_vec.rs
@@ -35,17 +35,18 @@
 
 use cast;
 use container::Container;
-use ptr;
+use kinds::Send;
+use ops::Drop;
+use option::{Option, Some, None};
 use ptr::RawPtr;
+use ptr;
 use raw;
-use option::{Option, Some, None};
-use ops::Drop;
 
 /// The type representing a foreign chunk of memory
 pub struct CVec<T> {
-    priv base: *mut T,
-    priv len: uint,
-    priv dtor: Option<proc()>,
+    base: *mut T,
+    len: uint,
+    dtor: Option<proc:Send()>,
 }
 
 #[unsafe_destructor]
@@ -89,7 +90,7 @@ impl<T> CVec<T> {
     /// * dtor - A proc to run when the value is destructed, useful
     ///          for freeing the buffer, etc.
     pub unsafe fn new_with_dtor(base: *mut T, len: uint,
-                                dtor: proc()) -> CVec<T> {
+                                dtor: proc:Send()) -> CVec<T> {
         assert!(base != ptr::mut_null());
         CVec {
             base: base,
diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs
index e0912b826cd..40c6c3ebccf 100644
--- a/src/libstd/cell.rs
+++ b/src/libstd/cell.rs
@@ -14,18 +14,18 @@ use cast;
 use clone::Clone;
 use cmp::Eq;
 use fmt;
-use kinds::{marker, Pod};
+use kinds::{marker, Copy};
 use ops::{Deref, DerefMut, Drop};
 use option::{None, Option, Some};
 use ty::Unsafe;
 
-/// A mutable memory location that admits only `Pod` data.
+/// A mutable memory location that admits only `Copy` data.
 pub struct Cell<T> {
-    priv value: Unsafe<T>,
-    priv noshare: marker::NoShare,
+    value: Unsafe<T>,
+    noshare: marker::NoShare,
 }
 
-impl<T:Pod> Cell<T> {
+impl<T:Copy> Cell<T> {
     /// Creates a new `Cell` containing the given value.
     pub fn new(value: T) -> Cell<T> {
         Cell {
@@ -49,30 +49,30 @@ impl<T:Pod> Cell<T> {
     }
 }
 
-impl<T:Pod> Clone for Cell<T> {
+impl<T:Copy> Clone for Cell<T> {
     fn clone(&self) -> Cell<T> {
         Cell::new(self.get())
     }
 }
 
-impl<T:Eq + Pod> Eq for Cell<T> {
+impl<T:Eq + Copy> Eq for Cell<T> {
     fn eq(&self, other: &Cell<T>) -> bool {
         self.get() == other.get()
     }
 }
 
-impl<T: fmt::Show> fmt::Show for Cell<T> {
+impl<T: Copy + fmt::Show> fmt::Show for Cell<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, r"Cell \{ value: {} \}", unsafe{*&self.value.get()})
+        write!(f.buf, r"Cell \{ value: {} \}", self.get())
     }
 }
 
 /// A mutable memory location with dynamically checked borrow rules
 pub struct RefCell<T> {
-    priv value: Unsafe<T>,
-    priv borrow: BorrowFlag,
-    priv nopod: marker::NoPod,
-    priv noshare: marker::NoShare,
+    value: Unsafe<T>,
+    borrow: BorrowFlag,
+    nocopy: marker::NoCopy,
+    noshare: marker::NoShare,
 }
 
 // Values [1, MAX-1] represent the number of `Ref` active
@@ -86,7 +86,7 @@ impl<T> RefCell<T> {
     pub fn new(value: T) -> RefCell<T> {
         RefCell {
             value: Unsafe::new(value),
-            nopod: marker::NoPod,
+            nocopy: marker::NoCopy,
             noshare: marker::NoShare,
             borrow: UNUSED,
         }
@@ -164,33 +164,11 @@ impl<T> RefCell<T> {
             None => fail!("RefCell<T> already borrowed")
         }
     }
-
-    /// Sets the value, replacing what was there.
-    ///
-    /// # Failure
-    ///
-    /// Fails if the value is currently borrowed.
-    #[inline]
-    pub fn set(&self, value: T) {
-        *self.borrow_mut() = value;
-    }
-}
-
-impl<T:Clone> RefCell<T> {
-    /// Returns a copy of the contained value.
-    ///
-    /// # Failure
-    ///
-    /// Fails if the value is currently mutably borrowed.
-    #[inline]
-    pub fn get(&self) -> T {
-        (*self.borrow()).clone()
-    }
 }
 
 impl<T: Clone> Clone for RefCell<T> {
     fn clone(&self) -> RefCell<T> {
-        RefCell::new(self.get())
+        RefCell::new(self.borrow().clone())
     }
 }
 
@@ -202,7 +180,7 @@ impl<T: Eq> Eq for RefCell<T> {
 
 /// Wraps a borrowed reference to a value in a `RefCell` box.
 pub struct Ref<'b, T> {
-    priv parent: &'b RefCell<T>
+    parent: &'b RefCell<T>
 }
 
 #[unsafe_destructor]
@@ -216,13 +194,13 @@ impl<'b, T> Drop for Ref<'b, T> {
 impl<'b, T> Deref<T> for Ref<'b, T> {
     #[inline]
     fn deref<'a>(&'a self) -> &'a T {
-        unsafe{ &*self.parent.value.get() }
+        unsafe { &*self.parent.value.get() }
     }
 }
 
 /// Wraps a mutable borrowed reference to a value in a `RefCell` box.
 pub struct RefMut<'b, T> {
-    priv parent: &'b mut RefCell<T>
+    parent: &'b mut RefCell<T>
 }
 
 #[unsafe_destructor]
@@ -236,14 +214,14 @@ impl<'b, T> Drop for RefMut<'b, T> {
 impl<'b, T> Deref<T> for RefMut<'b, T> {
     #[inline]
     fn deref<'a>(&'a self) -> &'a T {
-        unsafe{ &*self.parent.value.get() }
+        unsafe { &*self.parent.value.get() }
     }
 }
 
 impl<'b, T> DerefMut<T> for RefMut<'b, T> {
     #[inline]
     fn deref_mut<'a>(&'a mut self) -> &'a mut T {
-        unsafe{ &mut *self.parent.value.get() }
+        unsafe { &mut *self.parent.value.get() }
     }
 }
 
@@ -266,6 +244,17 @@ mod test {
     }
 
     #[test]
+    fn cell_has_sensible_show() {
+        use str::StrSlice;
+
+        let x = Cell::new("foo bar");
+        assert!(format!("{}", x).contains(x.get()));
+
+        x.set("baz qux");
+        assert!(format!("{}", x).contains(x.get()));
+    }
+
+    #[test]
     fn double_imm_borrow() {
         let x = RefCell::new(0);
         let _b1 = x.borrow();
diff --git a/src/libstd/cleanup.rs b/src/libstd/cleanup.rs
index 243f7b2055f..2e51931f15a 100644
--- a/src/libstd/cleanup.rs
+++ b/src/libstd/cleanup.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[doc(hidden)];
+#![doc(hidden)]
 
 use ptr;
 use raw;
diff --git a/src/libstd/cmp.rs b/src/libstd/cmp.rs
index e956a1cdf1d..6e62cd42e2c 100644
--- a/src/libstd/cmp.rs
+++ b/src/libstd/cmp.rs
@@ -10,17 +10,36 @@
 
 /*!
 
-The `Ord` and `Eq` comparison traits
+Defines the `Ord` and `Eq` comparison traits.
 
-This module contains the definition of both `Ord` and `Eq` which define
-the common interfaces for doing comparison. Both are language items
-that the compiler uses to implement the comparison operators. Rust code
-may implement `Ord` to overload the `<`, `<=`, `>`, and `>=` operators,
-and `Eq` to overload the `==` and `!=` operators.
+This module defines both `Ord` and `Eq` traits which are used by the compiler
+to implement comparison operators.
+Rust programs may implement `Ord` to overload the `<`, `<=`, `>`, and `>=` operators,
+and may implement `Eq` to overload the `==` and `!=` operators.
 
-*/
+For example, to define a type with a customized definition for the Eq operators,
+you could do the following:
+
+```rust
+// Our type.
+struct SketchyNum {
+    num : int
+}
+
+// Our implementation of `Eq` to support `==` and `!=`.
+impl Eq for SketchyNum {
+    // Our custom eq allows numbers which are near eachother to be equal! :D
+    fn eq(&self, other: &SketchyNum) -> bool {
+        (self.num - other.num).abs() < 5
+    }
+}
 
-#[allow(missing_doc)];
+// Now these binary operators will work when applied!
+assert!(SketchyNum {num: 37} == SketchyNum {num: 34});
+assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
+```
+
+*/
 
 /**
 * Trait for values that can be compared for equality and inequality.
@@ -35,14 +54,15 @@ and `Eq` to overload the `==` and `!=` operators.
 */
 #[lang="eq"]
 pub trait Eq {
+    /// This method tests for `self` and `other` values to be equal, and is used by `==`.
     fn eq(&self, other: &Self) -> bool;
 
+    /// This method tests for `!=`.
     #[inline]
     fn ne(&self, other: &Self) -> bool { !self.eq(other) }
 }
 
 /// Trait for equality comparisons where `a == b` and `a != b` are strict inverses.
-#[cfg(not(stage0))]
 pub trait TotalEq: Eq {
     // FIXME #13101: this method is used solely by #[deriving] to
     // assert that every component of a type implements #[deriving]
@@ -56,15 +76,7 @@ pub trait TotalEq: Eq {
     fn assert_receiver_is_total_eq(&self) {}
 }
 
-#[cfg(stage0)]
-pub trait TotalEq: Eq {
-    /// This method must return the same value as `eq`. It exists to prevent
-    /// deriving `TotalEq` from fields not implementing the `TotalEq` trait.
-    fn equals(&self, other: &Self) -> bool {
-        self.eq(other)
-    }
-}
-
+/// A macro which defines an implementation of TotalEq for a given type.
 macro_rules! totaleq_impl(
     ($t:ty) => {
         impl TotalEq for $t {}
@@ -88,11 +100,29 @@ totaleq_impl!(uint)
 
 totaleq_impl!(char)
 
+/// An ordering is, e.g, a result of a comparison between two values.
 #[deriving(Clone, Eq, Show)]
-pub enum Ordering { Less = -1, Equal = 0, Greater = 1 }
+pub enum Ordering {
+   /// An ordering where a compared value is less [than another].
+   Less = -1,
+   /// An ordering where a compared value is equal [to another].
+   Equal = 0,
+   /// An ordering where a compared value is greater [than another].
+   Greater = 1
+}
 
-/// Trait for types that form a total order
+/// Trait for types that form a total order.
 pub trait TotalOrd: TotalEq + Ord {
+    /// This method returns an ordering between `self` and `other` values.
+    ///
+    /// By convention, `self.cmp(&other)` returns the ordering matching
+    /// the expression `self <operator> other` if true.  For example:
+    ///
+    /// ```
+    /// assert_eq!( 5u.cmp(&10), Less);     // because 5 < 10
+    /// assert_eq!(10u.cmp(&5),  Greater);  // because 10 > 5
+    /// assert_eq!( 5u.cmp(&5),  Equal);    // because 5 == 5
+    /// ```
     fn cmp(&self, other: &Self) -> Ordering;
 }
 
@@ -109,6 +139,7 @@ impl Ord for Ordering {
     fn lt(&self, other: &Ordering) -> bool { (*self as int) < (*other as int) }
 }
 
+/// A macro which defines an implementation of TotalOrd for a given type.
 macro_rules! totalord_impl(
     ($t:ty) => {
         impl TotalOrd for $t {
@@ -138,8 +169,11 @@ totalord_impl!(uint)
 totalord_impl!(char)
 
 /**
-Return `o1` if it is not `Equal`, otherwise `o2`. Simulates the
-lexical ordering on a type `(int, int)`.
+ * Combine orderings, lexically.
+ *
+ * For example for a type `(int, int)`, two comparisons could be done.
+ * If the first ordering is different, the first ordering is all that must be returned.
+ * If the first ordering is equal, then second ordering is returned.
 */
 #[inline]
 pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering {
@@ -161,11 +195,18 @@ pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering {
 */
 #[lang="ord"]
 pub trait Ord: Eq {
+    /// This method tests less than (for `self` and `other`) and is used by the `<` operator.
     fn lt(&self, other: &Self) -> bool;
+
+    /// This method tests less than or equal to (`<=`).
     #[inline]
     fn le(&self, other: &Self) -> bool { !other.lt(self) }
+
+    /// This method tests greater than (`>`).
     #[inline]
     fn gt(&self, other: &Self) -> bool {  other.lt(self) }
+
+    /// This method tests greater than or equal to (`>=`).
     #[inline]
     fn ge(&self, other: &Self) -> bool { !self.lt(other) }
 }
@@ -175,14 +216,17 @@ pub trait Ord: Eq {
 /// container types; e.g. it is often desirable to be able to use `&str`
 /// values to look up entries in a container with `~str` keys.
 pub trait Equiv<T> {
+    /// Implement this function to decide equivalent values.
     fn equiv(&self, other: &T) -> bool;
 }
 
+/// Compare and return the minimum of two values.
 #[inline]
 pub fn min<T: TotalOrd>(v1: T, v2: T) -> T {
     if v1 < v2 { v1 } else { v2 }
 }
 
+/// Compare and return the maximum of two values.
 #[inline]
 pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
     if v1 > v2 { v1 } else { v2 }
@@ -194,11 +238,11 @@ mod test {
 
     #[test]
     fn test_int_totalord() {
-        assert_eq!(5.cmp(&10), Less);
-        assert_eq!(10.cmp(&5), Greater);
-        assert_eq!(5.cmp(&5), Equal);
-        assert_eq!((-5).cmp(&12), Less);
-        assert_eq!(12.cmp(-5), Greater);
+        assert_eq!(5u.cmp(&10), Less);
+        assert_eq!(10u.cmp(&5), Greater);
+        assert_eq!(5u.cmp(&5), Equal);
+        assert_eq!((-5u).cmp(&12), Less);
+        assert_eq!(12u.cmp(-5), Greater);
     }
 
     #[test]
@@ -220,4 +264,24 @@ mod test {
             t(Greater, o, Greater);
          }
     }
+
+    #[test]
+    fn test_user_defined_eq() {
+        // Our type.
+        struct SketchyNum {
+            num : int
+        }
+
+        // Our implementation of `Eq` to support `==` and `!=`.
+        impl Eq for SketchyNum {
+            // Our custom eq allows numbers which are near eachother to be equal! :D
+            fn eq(&self, other: &SketchyNum) -> bool {
+                (self.num - other.num).abs() < 5
+            }
+        }
+
+        // Now these binary operators will work when applied!
+        assert!(SketchyNum {num: 37} == SketchyNum {num: 34});
+        assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
+    }
 }
diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs
index 94e3d5ce2d3..d01c4913b32 100644
--- a/src/libstd/comm/mod.rs
+++ b/src/libstd/comm/mod.rs
@@ -252,9 +252,9 @@ use sync::arc::UnsafeArc;
 pub use comm::select::{Select, Handle};
 
 macro_rules! test (
-    { fn $name:ident() $b:block $($a:attr)*} => (
+    { fn $name:ident() $b:block $(#[$a:meta])*} => (
         mod $name {
-            #[allow(unused_imports)];
+            #![allow(unused_imports)]
 
             use native;
             use comm::*;
@@ -265,8 +265,8 @@ macro_rules! test (
 
             fn f() $b
 
-            $($a)* #[test] fn uv() { f() }
-            $($a)* #[test] fn native() {
+            $(#[$a])* #[test] fn uv() { f() }
+            $(#[$a])* #[test] fn native() {
                 use native;
                 let (tx, rx) = channel();
                 native::task::spawn(proc() { tx.send(f()) });
@@ -289,34 +289,34 @@ static RESCHED_FREQ: int = 256;
 /// The receiving-half of Rust's channel type. This half can only be owned by
 /// one task
 pub struct Receiver<T> {
-    priv inner: Flavor<T>,
-    priv receives: Cell<uint>,
+    inner: Flavor<T>,
+    receives: Cell<uint>,
     // can't share in an arc
-    priv marker: marker::NoShare,
+    marker: marker::NoShare,
 }
 
 /// An iterator over messages on a receiver, this iterator will block
 /// whenever `next` is called, waiting for a new message, and `None` will be
 /// returned when the corresponding channel has hung up.
 pub struct Messages<'a, T> {
-    priv rx: &'a Receiver<T>
+    rx: &'a Receiver<T>
 }
 
 /// The sending-half of Rust's asynchronous channel type. This half can only be
 /// owned by one task, but it can be cloned to send to other tasks.
 pub struct Sender<T> {
-    priv inner: Flavor<T>,
-    priv sends: Cell<uint>,
+    inner: Flavor<T>,
+    sends: Cell<uint>,
     // can't share in an arc
-    priv marker: marker::NoShare,
+    marker: marker::NoShare,
 }
 
 /// The sending-half of Rust's synchronous channel type. This half can only be
 /// owned by one task, but it can be cloned to send to other tasks.
 pub struct SyncSender<T> {
-    priv inner: UnsafeArc<sync::Packet<T>>,
+    inner: UnsafeArc<sync::Packet<T>>,
     // can't share in an arc
-    priv marker: marker::NoShare,
+    marker: marker::NoShare,
 }
 
 /// This enumeration is the list of the possible reasons that try_recv could not
diff --git a/src/libstd/comm/select.rs b/src/libstd/comm/select.rs
index 1b2e79e02b4..84191ed6b28 100644
--- a/src/libstd/comm/select.rs
+++ b/src/libstd/comm/select.rs
@@ -43,7 +43,7 @@
 //! }
 //! ```
 
-#[allow(dead_code)];
+#![allow(dead_code)]
 
 use cast;
 use cell::Cell;
@@ -62,10 +62,10 @@ use uint;
 /// The "receiver set" of the select interface. This structure is used to manage
 /// a set of receivers which are being selected over.
 pub struct Select {
-    priv head: *mut Handle<'static, ()>,
-    priv tail: *mut Handle<'static, ()>,
-    priv next_id: Cell<uint>,
-    priv marker1: marker::NoSend,
+    head: *mut Handle<'static, ()>,
+    tail: *mut Handle<'static, ()>,
+    next_id: Cell<uint>,
+    marker1: marker::NoSend,
 }
 
 /// A handle to a receiver which is currently a member of a `Select` set of
@@ -74,16 +74,16 @@ pub struct Select {
 pub struct Handle<'rx, T> {
     /// The ID of this handle, used to compare against the return value of
     /// `Select::wait()`
-    priv id: uint,
-    priv selector: &'rx Select,
-    priv next: *mut Handle<'static, ()>,
-    priv prev: *mut Handle<'static, ()>,
-    priv added: bool,
-    priv packet: &'rx Packet,
+    id: uint,
+    selector: &'rx Select,
+    next: *mut Handle<'static, ()>,
+    prev: *mut Handle<'static, ()>,
+    added: bool,
+    packet: &'rx Packet,
 
     // due to our fun transmutes, we be sure to place this at the end. (nothing
     // previous relies on T)
-    priv rx: &'rx Receiver<T>,
+    rx: &'rx Receiver<T>,
 }
 
 struct Packets { cur: *mut Handle<'static, ()> }
diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs
index c2a6510d656..5f8a043b830 100644
--- a/src/libstd/fmt/mod.rs
+++ b/src/libstd/fmt/mod.rs
@@ -508,20 +508,20 @@ pub type Result = io::IoResult<()>;
 /// traits.
 pub struct Formatter<'a> {
     /// Flags for formatting (packed version of rt::Flag)
-    flags: uint,
+    pub flags: uint,
     /// Character used as 'fill' whenever there is alignment
-    fill: char,
+    pub fill: char,
     /// Boolean indication of whether the output should be left-aligned
-    align: parse::Alignment,
+    pub align: parse::Alignment,
     /// Optionally specified integer width that the output should be
-    width: Option<uint>,
+    pub width: Option<uint>,
     /// Optionally specified precision for numeric types
-    precision: Option<uint>,
+    pub precision: Option<uint>,
 
     /// Output buffer.
-    buf: &'a mut io::Writer,
-    priv curarg: slice::Items<'a, Argument<'a>>,
-    priv args: &'a [Argument<'a>],
+    pub buf: &'a mut io::Writer,
+    curarg: slice::Items<'a, Argument<'a>>,
+    args: &'a [Argument<'a>],
 }
 
 /// This struct represents the generic "argument" which is taken by the Xprintf
@@ -529,8 +529,8 @@ pub struct Formatter<'a> {
 /// compile time it is ensured that the function and the value have the correct
 /// types, and then this struct is used to canonicalize arguments to one type.
 pub struct Argument<'a> {
-    priv formatter: extern "Rust" fn(&any::Void, &mut Formatter) -> Result,
-    priv value: &'a any::Void,
+    formatter: extern "Rust" fn(&any::Void, &mut Formatter) -> Result,
+    value: &'a any::Void,
 }
 
 impl<'a> Arguments<'a> {
@@ -555,8 +555,8 @@ impl<'a> Arguments<'a> {
 /// string at compile-time so usage of the `write` and `format` functions can
 /// be safely performed.
 pub struct Arguments<'a> {
-    priv fmt: &'a [rt::Piece<'a>],
-    priv args: &'a [Argument<'a>],
+    fmt: &'a [rt::Piece<'a>],
+    args: &'a [Argument<'a>],
 }
 
 /// When a format is not otherwise specified, types are formatted by ascribing
diff --git a/src/libstd/fmt/num.rs b/src/libstd/fmt/num.rs
index 4b35a7596c9..4d1d08551a6 100644
--- a/src/libstd/fmt/num.rs
+++ b/src/libstd/fmt/num.rs
@@ -108,7 +108,7 @@ radix!(UpperHex, 16, "0x", x @  0 .. 9 => '0' as u8 + x,
 /// A radix with in the range of `2..36`.
 #[deriving(Clone, Eq)]
 pub struct Radix {
-    priv base: u8,
+    base: u8,
 }
 
 impl Radix {
@@ -400,31 +400,31 @@ mod bench {
 
         #[bench]
         fn format_bin(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { format!("{:t}", rng.gen::<uint>()); })
         }
 
         #[bench]
         fn format_oct(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { format!("{:o}", rng.gen::<uint>()); })
         }
 
         #[bench]
         fn format_dec(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { format!("{:u}", rng.gen::<uint>()); })
         }
 
         #[bench]
         fn format_hex(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { format!("{:x}", rng.gen::<uint>()); })
         }
 
         #[bench]
         fn format_base_36(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { format!("{}", radix(rng.gen::<uint>(), 36)); })
         }
     }
@@ -436,31 +436,31 @@ mod bench {
 
         #[bench]
         fn format_bin(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { format!("{:t}", rng.gen::<int>()); })
         }
 
         #[bench]
         fn format_oct(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { format!("{:o}", rng.gen::<int>()); })
         }
 
         #[bench]
         fn format_dec(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { format!("{:d}", rng.gen::<int>()); })
         }
 
         #[bench]
         fn format_hex(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { format!("{:x}", rng.gen::<int>()); })
         }
 
         #[bench]
         fn format_base_36(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { format!("{}", radix(rng.gen::<int>(), 36)); })
         }
     }
diff --git a/src/libstd/fmt/parse.rs b/src/libstd/fmt/parse.rs
index 384e2ff2380..4752f3a75f4 100644
--- a/src/libstd/fmt/parse.rs
+++ b/src/libstd/fmt/parse.rs
@@ -37,30 +37,30 @@ pub enum Piece<'a> {
 #[deriving(Eq)]
 pub struct Argument<'a> {
     /// Where to find this argument
-    position: Position<'a>,
+    pub position: Position<'a>,
     /// How to format the argument
-    format: FormatSpec<'a>,
+    pub format: FormatSpec<'a>,
     /// If not `None`, what method to invoke on the argument
-    method: Option<~Method<'a>>
+    pub method: Option<~Method<'a>>
 }
 
 /// Specification for the formatting of an argument in the format string.
 #[deriving(Eq)]
 pub struct FormatSpec<'a> {
     /// Optionally specified character to fill alignment with
-    fill: Option<char>,
+    pub fill: Option<char>,
     /// Optionally specified alignment
-    align: Alignment,
+    pub align: Alignment,
     /// Packed version of various flags provided
-    flags: uint,
+    pub flags: uint,
     /// The integer precision to use
-    precision: Count<'a>,
+    pub precision: Count<'a>,
     /// The string width requested for the resulting format
-    width: Count<'a>,
+    pub width: Count<'a>,
     /// The descriptor string representing the name of the format desired for
     /// this argument, this can be empty or any number of characters, although
     /// it is required to be one word.
-    ty: &'a str
+    pub ty: &'a str
 }
 
 /// Enum describing where an argument for a format can be located.
@@ -154,9 +154,9 @@ pub enum PluralSelector {
 pub struct PluralArm<'a> {
     /// A selector can either be specified by a keyword or with an integer
     /// literal.
-    selector: PluralSelector,
+    pub selector: PluralSelector,
     /// Array of pieces which are the format of this arm
-    result: ~[Piece<'a>],
+    pub result: ~[Piece<'a>],
 }
 
 /// Enum of the 5 CLDR plural keywords. There is one more, "other", but that
@@ -182,9 +182,9 @@ pub enum PluralKeyword {
 #[deriving(Eq)]
 pub struct SelectArm<'a> {
     /// String selector which guards this arm
-    selector: &'a str,
+    pub selector: &'a str,
     /// Array of pieces which are the format of this arm
-    result: ~[Piece<'a>],
+    pub result: ~[Piece<'a>],
 }
 
 /// The parser structure for interpreting the input format string. This is
@@ -194,11 +194,11 @@ pub struct SelectArm<'a> {
 /// This is a recursive-descent parser for the sake of simplicity, and if
 /// necessary there's probably lots of room for improvement performance-wise.
 pub struct Parser<'a> {
-    priv input: &'a str,
-    priv cur: str::CharOffsets<'a>,
-    priv depth: uint,
+    input: &'a str,
+    cur: str::CharOffsets<'a>,
+    depth: uint,
     /// Error messages accumulated during parsing
-    errors: ~[~str],
+    pub errors: ~[~str],
 }
 
 impl<'a> Iterator<Piece<'a>> for Parser<'a> {
diff --git a/src/libstd/fmt/rt.rs b/src/libstd/fmt/rt.rs
index 89895f30585..01c2c06c3fb 100644
--- a/src/libstd/fmt/rt.rs
+++ b/src/libstd/fmt/rt.rs
@@ -14,8 +14,8 @@
 //! These definitions are similar to their `ct` equivalents, but differ in that
 //! these can be statically allocated and are slightly optimized for the runtime
 
-#[allow(missing_doc)];
-#[doc(hidden)];
+#![allow(missing_doc)]
+#![doc(hidden)]
 
 use fmt::parse;
 use option::Option;
@@ -28,17 +28,17 @@ pub enum Piece<'a> {
 }
 
 pub struct Argument<'a> {
-    position: Position,
-    format: FormatSpec,
-    method: Option<&'a Method<'a>>
+    pub position: Position,
+    pub format: FormatSpec,
+    pub method: Option<&'a Method<'a>>
 }
 
 pub struct FormatSpec {
-    fill: char,
-    align: parse::Alignment,
-    flags: uint,
-    precision: Count,
-    width: Count,
+    pub fill: char,
+    pub align: parse::Alignment,
+    pub flags: uint,
+    pub precision: Count,
+    pub width: Count,
 }
 
 pub enum Count {
@@ -60,11 +60,11 @@ pub enum PluralSelector {
 }
 
 pub struct PluralArm<'a> {
-    selector: PluralSelector,
-    result: &'a [Piece<'a>],
+    pub selector: PluralSelector,
+    pub result: &'a [Piece<'a>],
 }
 
 pub struct SelectArm<'a> {
-    selector: &'a str,
-    result: &'a [Piece<'a>],
+    pub selector: &'a str,
+    pub result: &'a [Piece<'a>],
 }
diff --git a/src/libstd/gc.rs b/src/libstd/gc.rs
index 7fb23d77f3c..bd383218ba1 100644
--- a/src/libstd/gc.rs
+++ b/src/libstd/gc.rs
@@ -16,7 +16,7 @@ collector is task-local so `Gc<T>` is not sendable.
 
 */
 
-#[allow(experimental)];
+#![allow(experimental)]
 
 use kinds::marker;
 use clone::Clone;
@@ -29,14 +29,14 @@ use managed;
                   task annihilation. For now, cycles need to be broken manually by using `Rc<T>` \
                   with a non-owning `Weak<T>` pointer. A tracing garbage collector is planned."]
 pub struct Gc<T> {
-    priv ptr: @T,
-    priv marker: marker::NoSend,
+    ptr: @T,
+    marker: marker::NoSend,
 }
 
 #[cfg(test)]
 pub struct Gc<T> {
-    priv ptr: @T,
-    priv marker: marker::NoSend,
+    ptr: @T,
+    marker: marker::NoSend,
 }
 
 impl<T: 'static> Gc<T> {
diff --git a/src/libstd/hash/mod.rs b/src/libstd/hash/mod.rs
index dc7d5c5b9c7..5e63f59f761 100644
--- a/src/libstd/hash/mod.rs
+++ b/src/libstd/hash/mod.rs
@@ -61,7 +61,7 @@
  * ```
  */
 
-#[allow(unused_must_use)];
+#![allow(unused_must_use)]
 
 use container::Container;
 use io::Writer;
diff --git a/src/libstd/hash/sip.rs b/src/libstd/hash/sip.rs
index d448f4eeb37..6217ff0f58c 100644
--- a/src/libstd/hash/sip.rs
+++ b/src/libstd/hash/sip.rs
@@ -36,15 +36,15 @@ use super::{Hash, Hasher};
 
 /// `SipState` computes a SipHash 2-4 hash over a stream of bytes.
 pub struct SipState {
-    priv k0: u64,
-    priv k1: u64,
-    priv length: uint, // how many bytes we've processed
-    priv v0: u64,      // hash state
-    priv v1: u64,
-    priv v2: u64,
-    priv v3: u64,
-    priv tail: [u8, ..8], // unprocessed bytes
-    priv ntail: uint,  // how many bytes in tail are valid
+    k0: u64,
+    k1: u64,
+    length: uint, // how many bytes we've processed
+    v0: u64,      // hash state
+    v1: u64,
+    v2: u64,
+    v3: u64,
+    tail: [u8, ..8], // unprocessed bytes
+    ntail: uint,  // how many bytes in tail are valid
 }
 
 // sadly, these macro definitions can't appear later,
@@ -231,8 +231,8 @@ impl Default for SipState {
 /// `SipHasher` computes the SipHash algorithm from a stream of bytes.
 #[deriving(Clone)]
 pub struct SipHasher {
-    priv k0: u64,
-    priv k1: u64,
+    k0: u64,
+    k1: u64,
 }
 
 impl SipHasher {
@@ -432,7 +432,7 @@ mod tests {
             assert!(f == i && f == v);
 
             buf.push(t as u8);
-            state_inc.write_u8(t);
+            state_inc.write_u8(t as u8);
 
             t += 1;
         }
diff --git a/src/libstd/intrinsics.rs b/src/libstd/intrinsics.rs
index 55e7746a44d..6fe6b3c3639 100644
--- a/src/libstd/intrinsics.rs
+++ b/src/libstd/intrinsics.rs
@@ -41,7 +41,7 @@ A quick refresher on memory ordering:
 
 */
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 // This is needed to prevent duplicate lang item definitions.
 #[cfg(test)]
@@ -53,19 +53,19 @@ pub type GlueFn = extern "Rust" fn(*i8);
 #[cfg(not(test))]
 pub struct TyDesc {
     // sizeof(T)
-    size: uint,
+    pub size: uint,
 
     // alignof(T)
-    align: uint,
+    pub align: uint,
 
     // Called when a value of type `T` is no longer needed
-    drop_glue: GlueFn,
+    pub drop_glue: GlueFn,
 
     // Called by reflection visitor to visit a value of type `T`
-    visit_glue: GlueFn,
+    pub visit_glue: GlueFn,
 
     // Name corresponding to the type
-    name: &'static str
+    pub name: &'static str,
 }
 
 #[lang="opaque"]
@@ -296,7 +296,7 @@ extern "rust-intrinsic" {
     /// Create a value initialized to zero.
     ///
     /// `init` is unsafe because it returns a zeroed-out datum,
-    /// which is unsafe unless T is Pod.
+    /// which is unsafe unless T is Copy.
     pub fn init<T>() -> T;
 
     /// Create an uninitialized value.
@@ -451,10 +451,10 @@ extern "rust-intrinsic" {
 /// `TypeId` represents a globally unique identifier for a type
 #[lang="type_id"] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and
                   // middle/lang_items.rs
-#[deriving(Eq, Hash, Show)]
+#[deriving(Eq, Hash, Show, TotalEq)]
 #[cfg(not(test))]
 pub struct TypeId {
-    priv t: u64,
+    t: u64,
 }
 
 #[cfg(not(test))]
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index fed47dfcff3..4da297a25fd 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -43,10 +43,10 @@ use vec::Vec;
 /// }
 /// ```
 pub struct BufferedReader<R> {
-    priv inner: R,
-    priv buf: Vec<u8>,
-    priv pos: uint,
-    priv cap: uint,
+    inner: R,
+    buf: Vec<u8>,
+    pos: uint,
+    cap: uint,
 }
 
 impl<R: Reader> BufferedReader<R> {
@@ -135,9 +135,9 @@ impl<R: Reader> Reader for BufferedReader<R> {
 /// writer.flush();
 /// ```
 pub struct BufferedWriter<W> {
-    priv inner: Option<W>,
-    priv buf: Vec<u8>,
-    priv pos: uint
+    inner: Option<W>,
+    buf: Vec<u8>,
+    pos: uint
 }
 
 impl<W: Writer> BufferedWriter<W> {
@@ -220,7 +220,7 @@ impl<W: Writer> Drop for BufferedWriter<W> {
 ///
 /// This writer will be flushed when it is dropped.
 pub struct LineBufferedWriter<W> {
-    priv inner: BufferedWriter<W>,
+    inner: BufferedWriter<W>,
 }
 
 impl<W: Writer> LineBufferedWriter<W> {
@@ -303,7 +303,7 @@ impl<W: Reader> Reader for InternalBufferedWriter<W> {
 /// }
 /// ```
 pub struct BufferedStream<S> {
-    priv inner: BufferedReader<InternalBufferedWriter<S>>
+    inner: BufferedReader<InternalBufferedWriter<S>>
 }
 
 impl<S: Stream> BufferedStream<S> {
@@ -391,7 +391,7 @@ mod test {
 
     /// A dummy reader intended at testing short-reads propagation.
     pub struct ShortReader {
-        priv lengths: ~[uint],
+        lengths: ~[uint],
     }
 
     impl Reader for ShortReader {
diff --git a/src/libstd/io/comm_adapters.rs b/src/libstd/io/comm_adapters.rs
index 075c65e04be..06e02072135 100644
--- a/src/libstd/io/comm_adapters.rs
+++ b/src/libstd/io/comm_adapters.rs
@@ -36,10 +36,10 @@ use slice::{bytes, CloneableVector, MutableVector, ImmutableVector};
 /// }
 /// ```
 pub struct ChanReader {
-    priv buf: Option<~[u8]>,  // A buffer of bytes received but not consumed.
-    priv pos: uint,           // How many of the buffered bytes have already be consumed.
-    priv rx: Receiver<~[u8]>,   // The rx to pull data from.
-    priv closed: bool,        // Whether the pipe this rx connects to has been closed.
+    buf: Option<~[u8]>,  // A buffer of bytes received but not consumed.
+    pos: uint,           // How many of the buffered bytes have already be consumed.
+    rx: Receiver<~[u8]>,   // The rx to pull data from.
+    closed: bool,        // Whether the pipe this rx connects to has been closed.
 }
 
 impl ChanReader {
@@ -98,7 +98,7 @@ impl Reader for ChanReader {
 /// writer.write("hello, world".as_bytes());
 /// ```
 pub struct ChanWriter {
-    priv tx: Sender<~[u8]>,
+    tx: Sender<~[u8]>,
 }
 
 impl ChanWriter {
diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs
index b9e933d0b14..a9fe3be585c 100644
--- a/src/libstd/io/extensions.rs
+++ b/src/libstd/io/extensions.rs
@@ -10,7 +10,7 @@
 
 //! Utility mixins that apply to all Readers and Writers
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 // FIXME: Not sure how this should be structured
 // FIXME: Iteration should probably be considered separately
@@ -38,7 +38,7 @@ use ptr::RawPtr;
 /// Any error other than `EndOfFile` that is produced by the underlying Reader
 /// is returned by the iterator and should be handled by the caller.
 pub struct Bytes<'r, T> {
-    priv reader: &'r mut T,
+    reader: &'r mut T,
 }
 
 impl<'r, R: Reader> Bytes<'r, R> {
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs
index e66aa8c0046..410b841545e 100644
--- a/src/libstd/io/fs.rs
+++ b/src/libstd/io/fs.rs
@@ -53,6 +53,7 @@ use c_str::ToCStr;
 use clone::Clone;
 use container::Container;
 use iter::Iterator;
+use kinds::Send;
 use super::{Reader, Writer, Seek};
 use super::{SeekStyle, Read, Write, Open, IoError, Truncate,
             FileMode, FileAccess, FileStat, IoResult, FilePermission};
@@ -77,9 +78,9 @@ use vec::Vec;
 /// configured at creation time, via the `FileAccess` parameter to
 /// `File::open_mode()`.
 pub struct File {
-    priv fd: ~RtioFileStream,
-    priv path: Path,
-    priv last_nread: int,
+    fd: ~RtioFileStream:Send,
+    path: Path,
+    last_nread: int,
 }
 
 impl File {
@@ -497,7 +498,7 @@ pub fn walk_dir(path: &Path) -> IoResult<Directories> {
 
 /// An iterator which walks over a directory
 pub struct Directories {
-    priv stack: ~[Path],
+    stack: ~[Path],
 }
 
 impl Iterator<Path> for Directories {
@@ -1285,7 +1286,7 @@ mod test {
         use rand::{StdRng, Rng};
 
         let mut bytes = [0, ..1024];
-        StdRng::new().fill_bytes(bytes);
+        StdRng::new().unwrap().fill_bytes(bytes);
 
         let tmpdir = tmpdir();
 
diff --git a/src/libstd/io/mem.rs b/src/libstd/io/mem.rs
index 7ae717cfccf..e9c6b5b01da 100644
--- a/src/libstd/io/mem.rs
+++ b/src/libstd/io/mem.rs
@@ -52,8 +52,8 @@ fn combine(seek: SeekStyle, cur: uint, end: uint, offset: i64) -> IoResult<u64>
 /// assert_eq!(w.unwrap(), ~[0, 1, 2]);
 /// ```
 pub struct MemWriter {
-    priv buf: ~[u8],
-    priv pos: uint,
+    buf: ~[u8],
+    pos: uint,
 }
 
 impl MemWriter {
@@ -132,8 +132,8 @@ impl Seek for MemWriter {
 /// assert_eq!(r.read_to_end().unwrap(), ~[0, 1, 2]);
 /// ```
 pub struct MemReader {
-    priv buf: ~[u8],
-    priv pos: uint
+    buf: ~[u8],
+    pos: uint
 }
 
 impl MemReader {
@@ -219,8 +219,8 @@ impl Buffer for MemReader {
 /// assert!(buf == [0, 1, 2, 0]);
 /// ```
 pub struct BufWriter<'a> {
-    priv buf: &'a mut [u8],
-    priv pos: uint
+    buf: &'a mut [u8],
+    pos: uint
 }
 
 impl<'a> BufWriter<'a> {
@@ -275,8 +275,8 @@ impl<'a> Seek for BufWriter<'a> {
 /// assert_eq!(r.read_to_end().unwrap(), ~[0, 1, 2, 3]);
 /// ```
 pub struct BufReader<'a> {
-    priv buf: &'a [u8],
-    priv pos: uint
+    buf: &'a [u8],
+    pos: uint
 }
 
 impl<'a> BufReader<'a> {
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 3e193f246a8..403e0e48fd5 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -208,7 +208,7 @@ responding to errors that may occur while attempting to read the numbers.
 
 */
 
-#[deny(unused_must_use)];
+#![deny(unused_must_use)]
 
 use cast;
 use char::Char;
@@ -216,6 +216,8 @@ use container::Container;
 use fmt;
 use int;
 use iter::Iterator;
+use libc;
+use os;
 use option::{Option, Some, None};
 use path::Path;
 use result::{Ok, Err, Result};
@@ -283,11 +285,93 @@ pub type IoResult<T> = Result<T, IoError>;
 pub struct IoError {
     /// An enumeration which can be matched against for determining the flavor
     /// of error.
-    kind: IoErrorKind,
+    pub kind: IoErrorKind,
     /// A human-readable description about the error
-    desc: &'static str,
+    pub desc: &'static str,
     /// Detailed information about this error, not always available
-    detail: Option<~str>
+    pub detail: Option<~str>
+}
+
+impl IoError {
+    /// Convert an `errno` value into an `IoError`.
+    ///
+    /// If `detail` is `true`, the `detail` field of the `IoError`
+    /// struct is filled with an allocated string describing the error
+    /// in more detail, retrieved from the operating system.
+    pub fn from_errno(errno: uint, detail: bool) -> IoError {
+        #[cfg(windows)]
+        fn get_err(errno: i32) -> (IoErrorKind, &'static str) {
+            match errno {
+                libc::EOF => (EndOfFile, "end of file"),
+                libc::ERROR_NO_DATA => (BrokenPipe, "the pipe is being closed"),
+                libc::ERROR_FILE_NOT_FOUND => (FileNotFound, "file not found"),
+                libc::ERROR_INVALID_NAME => (InvalidInput, "invalid file name"),
+                libc::WSAECONNREFUSED => (ConnectionRefused, "connection refused"),
+                libc::WSAECONNRESET => (ConnectionReset, "connection reset"),
+                libc::WSAEACCES => (PermissionDenied, "permission denied"),
+                libc::WSAEWOULDBLOCK => {
+                    (ResourceUnavailable, "resource temporarily unavailable")
+                }
+                libc::WSAENOTCONN => (NotConnected, "not connected"),
+                libc::WSAECONNABORTED => (ConnectionAborted, "connection aborted"),
+                libc::WSAEADDRNOTAVAIL => (ConnectionRefused, "address not available"),
+                libc::WSAEADDRINUSE => (ConnectionRefused, "address in use"),
+                libc::ERROR_BROKEN_PIPE => (EndOfFile, "the pipe has ended"),
+
+                // libuv maps this error code to EISDIR. we do too. if it is found
+                // to be incorrect, we can add in some more machinery to only
+                // return this message when ERROR_INVALID_FUNCTION after certain
+                // win32 calls.
+                libc::ERROR_INVALID_FUNCTION => (InvalidInput,
+                                                 "illegal operation on a directory"),
+
+                _ => (OtherIoError, "unknown error")
+            }
+        }
+
+        #[cfg(not(windows))]
+        fn get_err(errno: i32) -> (IoErrorKind, &'static str) {
+            // FIXME: this should probably be a bit more descriptive...
+            match errno {
+                libc::EOF => (EndOfFile, "end of file"),
+                libc::ECONNREFUSED => (ConnectionRefused, "connection refused"),
+                libc::ECONNRESET => (ConnectionReset, "connection reset"),
+                libc::EPERM | libc::EACCES =>
+                    (PermissionDenied, "permission denied"),
+                libc::EPIPE => (BrokenPipe, "broken pipe"),
+                libc::ENOTCONN => (NotConnected, "not connected"),
+                libc::ECONNABORTED => (ConnectionAborted, "connection aborted"),
+                libc::EADDRNOTAVAIL => (ConnectionRefused, "address not available"),
+                libc::EADDRINUSE => (ConnectionRefused, "address in use"),
+                libc::ENOENT => (FileNotFound, "no such file or directory"),
+                libc::EISDIR => (InvalidInput, "illegal operation on a directory"),
+
+                // These two constants can have the same value on some systems, but
+                // different values on others, so we can't use a match clause
+                x if x == libc::EAGAIN || x == libc::EWOULDBLOCK =>
+                    (ResourceUnavailable, "resource temporarily unavailable"),
+
+                _ => (OtherIoError, "unknown error")
+            }
+        }
+
+        let (kind, desc) = get_err(errno as i32);
+        IoError {
+            kind: kind,
+            desc: desc,
+            detail: if detail {Some(os::error_string(errno))} else {None},
+        }
+    }
+
+    /// Retrieve the last error to occur as a (detailed) IoError.
+    ///
+    /// This uses the OS `errno`, and so there should not be any task
+    /// descheduling or migration (other than that performed by the
+    /// operating system) between the call(s) for which errors are
+    /// being checked and the call of this function.
+    pub fn last_error() -> IoError {
+        IoError::from_errno(os::errno() as uint, true)
+    }
 }
 
 impl fmt::Show for IoError {
@@ -1023,7 +1107,7 @@ impl<T: Reader + Writer> Stream for T {}
 /// Any error other than `EndOfFile` that is produced by the underlying Reader
 /// is returned by the iterator and should be handled by the caller.
 pub struct Lines<'r, T> {
-    priv buffer: &'r mut T,
+    buffer: &'r mut T,
 }
 
 impl<'r, T: Buffer> Iterator<IoResult<~str>> for Lines<'r, T> {
@@ -1050,7 +1134,7 @@ impl<'r, T: Buffer> Iterator<IoResult<~str>> for Lines<'r, T> {
 /// Any error other than `EndOfFile` that is produced by the underlying Reader
 /// is returned by the iterator and should be handled by the caller.
 pub struct Chars<'r, T> {
-    priv buffer: &'r mut T
+    buffer: &'r mut T
 }
 
 impl<'r, T: Buffer> Iterator<IoResult<char>> for Chars<'r, T> {
@@ -1290,7 +1374,7 @@ pub trait Acceptor<T> {
 /// connection attempt was successful.  A successful connection will be wrapped
 /// in `Ok`. A failed connection is represented as an `Err`.
 pub struct IncomingConnections<'a, A> {
-    priv inc: &'a mut A,
+    inc: &'a mut A,
 }
 
 impl<'a, T, A: Acceptor<T>> Iterator<IoResult<T>> for IncomingConnections<'a, A> {
@@ -1389,13 +1473,13 @@ pub enum FileType {
 #[deriving(Hash)]
 pub struct FileStat {
     /// The path that this stat structure is describing
-    path: Path,
+    pub path: Path,
     /// The size of the file, in bytes
-    size: u64,
+    pub size: u64,
     /// The kind of file this path points to (directory, file, pipe, etc.)
-    kind: FileType,
+    pub kind: FileType,
     /// The file permissions currently on the file
-    perm: FilePermission,
+    pub perm: FilePermission,
 
     // FIXME(#10301): These time fields are pretty useless without an actual
     //                time representation, what are the milliseconds relative
@@ -1403,13 +1487,13 @@ pub struct FileStat {
 
     /// The time that the file was created at, in platform-dependent
     /// milliseconds
-    created: u64,
+    pub created: u64,
     /// The time that this file was last modified, in platform-dependent
     /// milliseconds
-    modified: u64,
+    pub modified: u64,
     /// The time that this file was last accessed, in platform-dependent
     /// milliseconds
-    accessed: u64,
+    pub accessed: u64,
 
     /// Information returned by stat() which is not guaranteed to be
     /// platform-independent. This information may be useful on some platforms,
@@ -1419,7 +1503,7 @@ pub struct FileStat {
     /// Usage of this field is discouraged, but if access is desired then the
     /// fields are located here.
     #[unstable]
-    unstable: UnstableFileStat,
+    pub unstable: UnstableFileStat,
 }
 
 /// This structure represents all of the possible information which can be
@@ -1430,25 +1514,25 @@ pub struct FileStat {
 #[deriving(Hash)]
 pub struct UnstableFileStat {
     /// The ID of the device containing the file.
-    device: u64,
+    pub device: u64,
     /// The file serial number.
-    inode: u64,
+    pub inode: u64,
     /// The device ID.
-    rdev: u64,
+    pub rdev: u64,
     /// The number of hard links to this file.
-    nlink: u64,
+    pub nlink: u64,
     /// The user ID of the file.
-    uid: u64,
+    pub uid: u64,
     /// The group ID of the file.
-    gid: u64,
+    pub gid: u64,
     /// The optimal block size for I/O.
-    blksize: u64,
+    pub blksize: u64,
     /// The blocks allocated for this file.
-    blocks: u64,
+    pub blocks: u64,
     /// User-defined flags for the file.
-    flags: u64,
+    pub flags: u64,
     /// The file generation number.
-    gen: u64,
+    pub gen: u64,
 }
 
 /// A set of permissions for a file or directory is represented by a set of
diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs
index 6e0b766a587..4006665e886 100644
--- a/src/libstd/io/net/addrinfo.rs
+++ b/src/libstd/io/net/addrinfo.rs
@@ -17,13 +17,14 @@ getaddrinfo()
 
 */
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
+use iter::Iterator;
 use io::IoResult;
 use io::net::ip::{SocketAddr, IpAddr};
 use option::{Option, Some, None};
 use rt::rtio::{IoFactory, LocalIo};
-use slice::ImmutableVector;
+use slice::OwnedVector;
 
 /// Hints to the types of sockets that are desired when looking up hosts
 pub enum SocketType {
@@ -56,24 +57,24 @@ pub enum Protocol {
 /// For details on these fields, see their corresponding definitions via
 /// `man -s 3 getaddrinfo`
 pub struct Hint {
-    family: uint,
-    socktype: Option<SocketType>,
-    protocol: Option<Protocol>,
-    flags: uint,
+    pub family: uint,
+    pub socktype: Option<SocketType>,
+    pub protocol: Option<Protocol>,
+    pub flags: uint,
 }
 
 pub struct Info {
-    address: SocketAddr,
-    family: uint,
-    socktype: Option<SocketType>,
-    protocol: Option<Protocol>,
-    flags: uint,
+    pub address: SocketAddr,
+    pub family: uint,
+    pub socktype: Option<SocketType>,
+    pub protocol: Option<Protocol>,
+    pub flags: uint,
 }
 
 /// Easy name resolution. Given a hostname, returns the list of IP addresses for
 /// that hostname.
 pub fn get_host_addresses(host: &str) -> IoResult<~[IpAddr]> {
-    lookup(Some(host), None, None).map(|a| a.map(|i| i.address.ip))
+    lookup(Some(host), None, None).map(|a| a.move_iter().map(|i| i.address.ip).collect())
 }
 
 /// Full-fleged resolution. This function will perform a synchronous call to
diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs
index fef4dd380e8..10e1ffacd95 100644
--- a/src/libstd/io/net/ip.rs
+++ b/src/libstd/io/net/ip.rs
@@ -13,7 +13,7 @@
 //! This module contains functions useful for parsing, formatting, and
 //! manipulating IP addresses.
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use container::Container;
 use fmt;
@@ -58,8 +58,8 @@ impl fmt::Show for IpAddr {
 
 #[deriving(Eq, TotalEq, Clone, Hash)]
 pub struct SocketAddr {
-    ip: IpAddr,
-    port: Port,
+    pub ip: IpAddr,
+    pub port: Port,
 }
 
 impl fmt::Show for SocketAddr {
diff --git a/src/libstd/io/net/tcp.rs b/src/libstd/io/net/tcp.rs
index 7b1dd114d34..b4dcd204479 100644
--- a/src/libstd/io/net/tcp.rs
+++ b/src/libstd/io/net/tcp.rs
@@ -17,12 +17,11 @@
 //! A TCP connection implements the `Reader` and `Writer` traits, while the TCP
 //! listener (socket server) implements the `Listener` and `Acceptor` traits.
 
-#[deny(missing_doc)];
-
 use clone::Clone;
+use io::IoResult;
 use io::net::ip::SocketAddr;
 use io::{Reader, Writer, Listener, Acceptor};
-use io::IoResult;
+use kinds::Send;
 use rt::rtio::{IoFactory, LocalIo, RtioSocket, RtioTcpListener};
 use rt::rtio::{RtioTcpAcceptor, RtioTcpStream};
 
@@ -45,11 +44,11 @@ use rt::rtio::{RtioTcpAcceptor, RtioTcpStream};
 /// drop(stream); // close the connection
 /// ```
 pub struct TcpStream {
-    priv obj: ~RtioTcpStream
+    obj: ~RtioTcpStream:Send
 }
 
 impl TcpStream {
-    fn new(s: ~RtioTcpStream) -> TcpStream {
+    fn new(s: ~RtioTcpStream:Send) -> TcpStream {
         TcpStream { obj: s }
     }
 
@@ -127,7 +126,7 @@ impl Writer for TcpStream {
 /// # }
 /// ```
 pub struct TcpListener {
-    priv obj: ~RtioTcpListener
+    obj: ~RtioTcpListener:Send
 }
 
 impl TcpListener {
@@ -160,7 +159,7 @@ impl Listener<TcpStream, TcpAcceptor> for TcpListener {
 /// a `TcpListener`'s `listen` method, and this object can be used to accept new
 /// `TcpStream` instances.
 pub struct TcpAcceptor {
-    priv obj: ~RtioTcpAcceptor
+    obj: ~RtioTcpAcceptor:Send
 }
 
 impl Acceptor<TcpStream> for TcpAcceptor {
diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs
index 95241813257..8dd59e859b8 100644
--- a/src/libstd/io/net/udp.rs
+++ b/src/libstd/io/net/udp.rs
@@ -16,9 +16,10 @@
 //! datagram protocol.
 
 use clone::Clone;
-use result::{Ok, Err};
 use io::net::ip::SocketAddr;
 use io::{Reader, Writer, IoResult};
+use kinds::Send;
+use result::{Ok, Err};
 use rt::rtio::{RtioSocket, RtioUdpSocket, IoFactory, LocalIo};
 
 /// A User Datagram Protocol socket.
@@ -53,7 +54,7 @@ use rt::rtio::{RtioSocket, RtioUdpSocket, IoFactory, LocalIo};
 /// drop(socket); // close the socket
 /// ```
 pub struct UdpSocket {
-    priv obj: ~RtioUdpSocket
+    obj: ~RtioUdpSocket:Send
 }
 
 impl UdpSocket {
@@ -114,8 +115,8 @@ impl Clone for UdpSocket {
 /// A type that allows convenient usage of a UDP stream connected to one
 /// address via the `Reader` and `Writer` traits.
 pub struct UdpStream {
-    priv socket: UdpSocket,
-    priv connected_to: SocketAddr
+    socket: UdpSocket,
+    connected_to: SocketAddr
 }
 
 impl UdpStream {
diff --git a/src/libstd/io/net/unix.rs b/src/libstd/io/net/unix.rs
index 9f04317a5c8..0d64a7b141e 100644
--- a/src/libstd/io/net/unix.rs
+++ b/src/libstd/io/net/unix.rs
@@ -22,24 +22,25 @@ instances as clients.
 
 */
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use prelude::*;
 
 use c_str::ToCStr;
 use clone::Clone;
-use rt::rtio::{IoFactory, LocalIo, RtioUnixListener};
-use rt::rtio::{RtioUnixAcceptor, RtioPipe};
 use io::pipe::PipeStream;
 use io::{Listener, Acceptor, Reader, Writer, IoResult};
+use kinds::Send;
+use rt::rtio::{IoFactory, LocalIo, RtioUnixListener};
+use rt::rtio::{RtioUnixAcceptor, RtioPipe};
 
 /// A stream which communicates over a named pipe.
 pub struct UnixStream {
-    priv obj: PipeStream,
+    obj: PipeStream,
 }
 
 impl UnixStream {
-    fn new(obj: ~RtioPipe) -> UnixStream {
+    fn new(obj: ~RtioPipe:Send) -> UnixStream {
         UnixStream { obj: PipeStream::new(obj) }
     }
 
@@ -82,7 +83,7 @@ impl Writer for UnixStream {
 /// A value that can listen for incoming named pipe connection requests.
 pub struct UnixListener {
     /// The internal, opaque runtime Unix listener.
-    priv obj: ~RtioUnixListener,
+    obj: ~RtioUnixListener:Send,
 }
 
 impl UnixListener {
@@ -124,7 +125,7 @@ impl Listener<UnixStream, UnixAcceptor> for UnixListener {
 /// A value that can accept named pipe connections, returned from `listen()`.
 pub struct UnixAcceptor {
     /// The internal, opaque runtime Unix acceptor.
-    priv obj: ~RtioUnixAcceptor,
+    obj: ~RtioUnixAcceptor:Send,
 }
 
 impl Acceptor<UnixStream> for UnixAcceptor {
@@ -140,7 +141,7 @@ mod tests {
     use io::*;
     use io::test::*;
 
-    pub fn smalltest(server: proc(UnixStream), client: proc(UnixStream)) {
+    pub fn smalltest(server: proc:Send(UnixStream), client: proc:Send(UnixStream)) {
         let path1 = next_test_unix();
         let path2 = path1.clone();
 
diff --git a/src/libstd/io/pipe.rs b/src/libstd/io/pipe.rs
index 9984a3e5cdf..75ec3d8614e 100644
--- a/src/libstd/io/pipe.rs
+++ b/src/libstd/io/pipe.rs
@@ -13,7 +13,7 @@
 //! Currently these aren't particularly useful, there only exists bindings
 //! enough so that pipes can be created to child processes.
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use prelude::*;
 use io::IoResult;
@@ -23,7 +23,7 @@ use rt::rtio::{RtioPipe, LocalIo};
 /// A synchronous, in-memory pipe.
 pub struct PipeStream {
     /// The internal, opaque runtime pipe object.
-    priv obj: ~RtioPipe,
+    obj: ~RtioPipe:Send,
 }
 
 impl PipeStream {
@@ -51,7 +51,7 @@ impl PipeStream {
     }
 
     #[doc(hidden)]
-    pub fn new(inner: ~RtioPipe) -> PipeStream {
+    pub fn new(inner: ~RtioPipe:Send) -> PipeStream {
         PipeStream { obj: inner }
     }
 }
diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs
index de7b26d5ff4..1f067021825 100644
--- a/src/libstd/io/process.rs
+++ b/src/libstd/io/process.rs
@@ -10,8 +10,6 @@
 
 //! Bindings for executing child processes
 
-#[deny(missing_doc)];
-
 use prelude::*;
 
 use fmt;
@@ -53,23 +51,23 @@ use rt::rtio::{RtioProcess, IoFactory, LocalIo};
 /// assert!(child.wait().success());
 /// ```
 pub struct Process {
-    priv handle: ~RtioProcess,
+    handle: ~RtioProcess:Send,
 
     /// Handle to the child's stdin, if the `stdin` field of this process's
     /// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`.
-    stdin: Option<io::PipeStream>,
+    pub stdin: Option<io::PipeStream>,
 
     /// Handle to the child's stdout, if the `stdout` field of this process's
     /// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`.
-    stdout: Option<io::PipeStream>,
+    pub stdout: Option<io::PipeStream>,
 
     /// Handle to the child's stderr, if the `stderr` field of this process's
     /// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`.
-    stderr: Option<io::PipeStream>,
+    pub stderr: Option<io::PipeStream>,
 
     /// Extra I/O handles as configured by the original `ProcessConfig` when
     /// this process was created. This is by default empty.
-    extra_io: ~[Option<io::PipeStream>],
+    pub extra_io: ~[Option<io::PipeStream>],
 }
 
 /// This configuration describes how a new process should be spawned. A blank
@@ -88,33 +86,33 @@ pub struct Process {
 /// ```
 pub struct ProcessConfig<'a> {
     /// Path to the program to run
-    program: &'a str,
+    pub program: &'a str,
 
     /// Arguments to pass to the program (doesn't include the program itself)
-    args: &'a [~str],
+    pub args: &'a [~str],
 
     /// Optional environment to specify for the program. If this is None, then
     /// it will inherit the current process's environment.
-    env: Option<&'a [(~str, ~str)]>,
+    pub env: Option<&'a [(~str, ~str)]>,
 
     /// Optional working directory for the new process. If this is None, then
     /// the current directory of the running process is inherited.
-    cwd: Option<&'a Path>,
+    pub cwd: Option<&'a Path>,
 
     /// Configuration for the child process's stdin handle (file descriptor 0).
     /// This field defaults to `CreatePipe(true, false)` so the input can be
     /// written to.
-    stdin: StdioContainer,
+    pub stdin: StdioContainer,
 
     /// Configuration for the child process's stdout handle (file descriptor 1).
     /// This field defaults to `CreatePipe(false, true)` so the output can be
     /// collected.
-    stdout: StdioContainer,
+    pub stdout: StdioContainer,
 
     /// Configuration for the child process's stdout handle (file descriptor 2).
     /// This field defaults to `CreatePipe(false, true)` so the output can be
     /// collected.
-    stderr: StdioContainer,
+    pub stderr: StdioContainer,
 
     /// Any number of streams/file descriptors/pipes may be attached to this
     /// process. This list enumerates the file descriptors and such for the
@@ -122,31 +120,31 @@ pub struct ProcessConfig<'a> {
     /// 3 and go to the length of this array. The first three file descriptors
     /// (stdin/stdout/stderr) are configured with the `stdin`, `stdout`, and
     /// `stderr` fields.
-    extra_io: &'a [StdioContainer],
+    pub extra_io: &'a [StdioContainer],
 
     /// Sets the child process's user id. This translates to a `setuid` call in
     /// the child process. Setting this value on windows will cause the spawn to
     /// fail. Failure in the `setuid` call on unix will also cause the spawn to
     /// fail.
-    uid: Option<uint>,
+    pub uid: Option<uint>,
 
     /// Similar to `uid`, but sets the group id of the child process. This has
     /// the same semantics as the `uid` field.
-    gid: Option<uint>,
+    pub gid: Option<uint>,
 
     /// If true, the child process is spawned in a detached state. On unix, this
     /// means that the child is the leader of a new process group.
-    detach: bool,
+    pub detach: bool,
 }
 
 /// The output of a finished process.
 pub struct ProcessOutput {
     /// The status (exit code) of the process.
-    status: ProcessExit,
+    pub status: ProcessExit,
     /// The data that the process wrote to stdout.
-    output: ~[u8],
+    pub output: ~[u8],
     /// The data that the process wrote to stderr.
-    error: ~[u8],
+    pub error: ~[u8],
 }
 
 /// Describes what to do with a standard io stream for a child process.
@@ -331,7 +329,9 @@ impl Process {
     /// signals (SIGTERM/SIGKILL/SIGINT) are translated to `TerminateProcess`.
     ///
     /// Additionally, a signal number of 0 can check for existence of the target
-    /// process.
+    /// process. Note, though, that on some platforms signals will continue to
+    /// be successfully delivered if the child has exited, but not yet been
+    /// reaped.
     pub fn kill(id: libc::pid_t, signal: int) -> IoResult<()> {
         LocalIo::maybe_raise(|io| io.kill(id, signal))
     }
@@ -342,8 +342,16 @@ impl Process {
     /// Sends the specified signal to the child process, returning whether the
     /// signal could be delivered or not.
     ///
-    /// Note that this is purely a wrapper around libuv's `uv_process_kill`
-    /// function.
+    /// Note that signal 0 is interpreted as a poll to check whether the child
+    /// process is still alive or not. If an error is returned, then the child
+    /// process has exited.
+    ///
+    /// On some unix platforms signals will continue to be received after a
+    /// child has exited but not yet been reaped. In order to report the status
+    /// of signal delivery correctly, unix implementations may invoke
+    /// `waitpid()` with `WNOHANG` in order to reap the child as necessary.
+    ///
+    /// # Errors
     ///
     /// If the signal delivery fails, the corresponding error is returned.
     pub fn signal(&mut self, signal: int) -> IoResult<()> {
@@ -833,4 +841,17 @@ mod tests {
         p.signal_kill().unwrap();
         assert!(!p.wait().success());
     })
+
+    iotest!(fn test_zero() {
+        let mut p = sleeper();
+        p.signal_kill().unwrap();
+        for _ in range(0, 20) {
+            if p.signal(0).is_err() {
+                assert!(!p.wait().success());
+                return
+            }
+            timer::sleep(100);
+        }
+        fail!("never saw the child go away");
+    })
 }
diff --git a/src/libstd/io/signal.rs b/src/libstd/io/signal.rs
index d6700fda23d..494cc6f6b02 100644
--- a/src/libstd/io/signal.rs
+++ b/src/libstd/io/signal.rs
@@ -81,15 +81,15 @@ pub enum Signum {
 /// ```
 pub struct Listener {
     /// A map from signums to handles to keep the handles in memory
-    priv handles: ~[(Signum, ~RtioSignal)],
+    handles: ~[(Signum, ~RtioSignal)],
     /// This is where all the handles send signums, which are received by
     /// the clients from the receiver.
-    priv tx: Sender<Signum>,
+    tx: Sender<Signum>,
 
     /// Clients of Listener can `recv()` on this receiver. This is exposed to
     /// allow selection over it as well as manipulation of the receiver
     /// directly.
-    rx: Receiver<Signum>,
+    pub rx: Receiver<Signum>,
 }
 
 impl Listener {
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs
index 2f6cdcb5825..ae98333ca96 100644
--- a/src/libstd/io/stdio.rs
+++ b/src/libstd/io/stdio.rs
@@ -32,6 +32,7 @@ use fmt;
 use io::{Reader, Writer, IoResult, IoError, OtherIoError,
          standard_error, EndOfFile, LineBufferedWriter, BufferedReader};
 use libc;
+use kinds::Send;
 use mem::replace;
 use option::{Option, Some, None};
 use prelude::drop;
@@ -71,8 +72,8 @@ use slice::ImmutableVector;
 // tl;dr; TTY works on everything but when windows stdout is redirected, in that
 //        case pipe also doesn't work, but magically file does!
 enum StdSource {
-    TTY(~RtioTTY),
-    File(~RtioFileStream),
+    TTY(~RtioTTY:Send),
+    File(~RtioFileStream:Send),
 }
 
 fn src<T>(fd: libc::c_int, readable: bool, f: |StdSource| -> T) -> T {
@@ -145,8 +146,10 @@ pub fn stderr_raw() -> StdWriter {
     src(libc::STDERR_FILENO, false, |src| StdWriter { inner: src })
 }
 
-fn reset_helper(w: ~Writer,
-                f: |&mut Task, ~Writer| -> Option<~Writer>) -> Option<~Writer> {
+fn reset_helper(w: ~Writer:Send,
+                f: |&mut Task, ~Writer:Send| -> Option<~Writer:Send>)
+    -> Option<~Writer:Send>
+{
     let mut t = Local::borrow(None::<Task>);
     // Be sure to flush any pending output from the writer
     match f(t.get(), w) {
@@ -168,7 +171,7 @@ fn reset_helper(w: ~Writer,
 ///
 /// Note that this does not need to be called for all new tasks; the default
 /// output handle is to the process's stdout stream.
-pub fn set_stdout(stdout: ~Writer) -> Option<~Writer> {
+pub fn set_stdout(stdout: ~Writer:Send) -> Option<~Writer:Send> {
     reset_helper(stdout, |t, w| replace(&mut t.stdout, Some(w)))
 }
 
@@ -180,7 +183,7 @@ pub fn set_stdout(stdout: ~Writer) -> Option<~Writer> {
 ///
 /// Note that this does not need to be called for all new tasks; the default
 /// output handle is to the process's stderr stream.
-pub fn set_stderr(stderr: ~Writer) -> Option<~Writer> {
+pub fn set_stderr(stderr: ~Writer:Send) -> Option<~Writer:Send> {
     reset_helper(stderr, |t, w| replace(&mut t.stderr, Some(w)))
 }
 
@@ -206,7 +209,7 @@ fn with_task_stdout(f: |&mut Writer| -> IoResult<()> ) {
             Local::put(task);
 
             if my_stdout.is_none() {
-                my_stdout = Some(~stdout() as ~Writer);
+                my_stdout = Some(~stdout() as ~Writer:Send);
             }
             let ret = f(*my_stdout.get_mut_ref());
 
@@ -290,7 +293,7 @@ pub fn println_args(fmt: &fmt::Arguments) {
 
 /// Representation of a reader of a standard input stream
 pub struct StdReader {
-    priv inner: StdSource
+    inner: StdSource
 }
 
 impl Reader for StdReader {
@@ -319,7 +322,7 @@ impl Reader for StdReader {
 
 /// Representation of a writer to a standard output stream
 pub struct StdWriter {
-    priv inner: StdSource
+    inner: StdSource
 }
 
 impl StdWriter {
@@ -399,7 +402,7 @@ mod tests {
         let (tx, rx) = channel();
         let (mut r, w) = (ChanReader::new(rx), ChanWriter::new(tx));
         spawn(proc() {
-            set_stdout(~w as ~Writer);
+            set_stdout(~w);
             println!("hello!");
         });
         assert_eq!(r.read_to_str().unwrap(), ~"hello!\n");
@@ -411,7 +414,7 @@ mod tests {
         let (tx, rx) = channel();
         let (mut r, w) = (ChanReader::new(rx), ChanWriter::new(tx));
         spawn(proc() {
-            set_stderr(~w as ~Writer);
+            set_stderr(~w);
             fail!("my special message");
         });
         let s = r.read_to_str().unwrap();
diff --git a/src/libstd/io/tempfile.rs b/src/libstd/io/tempfile.rs
index 34d6b19199a..4ff1c7faaec 100644
--- a/src/libstd/io/tempfile.rs
+++ b/src/libstd/io/tempfile.rs
@@ -24,7 +24,7 @@ use sync::atomics;
 /// A wrapper for a path to temporary directory implementing automatic
 /// scope-based deletion.
 pub struct TempDir {
-    priv path: Option<Path>
+    path: Option<Path>
 }
 
 impl TempDir {
diff --git a/src/libstd/io/test.rs b/src/libstd/io/test.rs
index 9eeaf4635a4..14b9b5c1e06 100644
--- a/src/libstd/io/test.rs
+++ b/src/libstd/io/test.rs
@@ -10,7 +10,7 @@
 
 /*! Various utility functions useful for writing I/O tests */
 
-#[macro_escape];
+#![macro_escape]
 
 use libc;
 use os;
@@ -19,9 +19,9 @@ use std::io::net::ip::*;
 use sync::atomics::{AtomicUint, INIT_ATOMIC_UINT, Relaxed};
 
 macro_rules! iotest (
-    { fn $name:ident() $b:block $($a:attr)* } => (
+    { fn $name:ident() $b:block $(#[$a:meta])* } => (
         mod $name {
-            #[allow(unused_imports)];
+            #![allow(unused_imports)]
 
             use super::super::*;
             use super::*;
@@ -43,8 +43,8 @@ macro_rules! iotest (
 
             fn f() $b
 
-            $($a)* #[test] fn green() { f() }
-            $($a)* #[test] fn native() {
+            $(#[$a])* #[test] fn green() { f() }
+            $(#[$a])* #[test] fn native() {
                 use native;
                 let (tx, rx) = channel();
                 native::task::spawn(proc() { tx.send(f()) });
diff --git a/src/libstd/io/timer.rs b/src/libstd/io/timer.rs
index f64c36c611c..839fcab8f86 100644
--- a/src/libstd/io/timer.rs
+++ b/src/libstd/io/timer.rs
@@ -18,8 +18,9 @@ and create receivers which will receive notifications after a period of time.
 */
 
 use comm::Receiver;
-use rt::rtio::{IoFactory, LocalIo, RtioTimer};
 use io::IoResult;
+use kinds::Send;
+use rt::rtio::{IoFactory, LocalIo, RtioTimer};
 
 /// A synchronous timer object
 ///
@@ -62,7 +63,7 @@ use io::IoResult;
 /// # }
 /// ```
 pub struct Timer {
-    priv obj: ~RtioTimer
+    obj: ~RtioTimer:Send,
 }
 
 /// Sleep the current task for `msecs` milliseconds.
diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs
index 2df0dec2d13..a294ba17289 100644
--- a/src/libstd/io/util.rs
+++ b/src/libstd/io/util.rs
@@ -17,8 +17,8 @@ use slice::bytes::MutableByteVector;
 
 /// Wraps a `Reader`, limiting the number of bytes that can be read from it.
 pub struct LimitReader<R> {
-    priv limit: uint,
-    priv inner: R
+    limit: uint,
+    inner: R
 }
 
 impl<R: Reader> LimitReader<R> {
@@ -85,7 +85,7 @@ impl Reader for NullReader {
 
 /// A `Writer` which multiplexes writes to a set of `Writers`.
 pub struct MultiWriter {
-    priv writers: ~[~Writer]
+    writers: ~[~Writer]
 }
 
 impl MultiWriter {
@@ -118,8 +118,8 @@ impl Writer for MultiWriter {
 /// A `Reader` which chains input from multiple `Readers`, reading each to
 /// completion before moving onto the next.
 pub struct ChainedReader<I, R> {
-    priv readers: I,
-    priv cur_reader: Option<R>,
+    readers: I,
+    cur_reader: Option<R>,
 }
 
 impl<R: Reader, I: Iterator<R>> ChainedReader<I, R> {
@@ -156,8 +156,8 @@ impl<R: Reader, I: Iterator<R>> Reader for ChainedReader<I, R> {
 /// A `Reader` which forwards input from another `Reader`, passing it along to
 /// a `Writer` as well. Similar to the `tee(1)` command.
 pub struct TeeReader<R, W> {
-    priv reader: R,
-    priv writer: W
+    reader: R,
+    writer: W,
 }
 
 impl<R: Reader, W: Writer> TeeReader<R, W> {
diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs
index 0a19bc43b28..d7424fc9f61 100644
--- a/src/libstd/iter.rs
+++ b/src/libstd/iter.rs
@@ -76,7 +76,7 @@ use mem;
 /// Conversion from an `Iterator`
 pub trait FromIterator<A> {
     /// Build a container with elements from an external iterator.
-    fn from_iterator<T: Iterator<A>>(iterator: T) -> Self;
+    fn from_iter<T: Iterator<A>>(iterator: T) -> Self;
 }
 
 /// A type growable from an `Iterator` implementation
@@ -460,7 +460,7 @@ pub trait Iterator<A> {
     /// ```
     #[inline]
     fn collect<B: FromIterator<A>>(&mut self) -> B {
-        FromIterator::from_iterator(self.by_ref())
+        FromIterator::from_iter(self.by_ref())
     }
 
     /// Loops through `n` iterations, returning the `n`th element of the
@@ -751,7 +751,7 @@ impl<A, B, T: ExactSize<A>, U: ExactSize<B>> ExactSize<(A, B)> for Zip<T, U> {}
 /// An double-ended iterator with the direction inverted
 #[deriving(Clone)]
 pub struct Rev<T> {
-    priv iter: T
+    iter: T
 }
 
 impl<A, T: DoubleEndedIterator<A>> Iterator<A> for Rev<T> {
@@ -778,7 +778,7 @@ impl<A, T: DoubleEndedIterator<A> + RandomAccessIterator<A>> RandomAccessIterato
 
 /// A mutable reference to an iterator
 pub struct ByRef<'a, T> {
-    priv iter: &'a mut T
+    iter: &'a mut T
 }
 
 impl<'a, A, T: Iterator<A>> Iterator<A> for ByRef<'a, T> {
@@ -1036,8 +1036,8 @@ impl<A, T: Clone + Iterator<A>> CloneableIterator for T {
 /// An iterator that repeats endlessly
 #[deriving(Clone)]
 pub struct Cycle<T> {
-    priv orig: T,
-    priv iter: T,
+    orig: T,
+    iter: T,
 }
 
 impl<A, T: Clone + Iterator<A>> Iterator<A> for Cycle<T> {
@@ -1087,9 +1087,9 @@ impl<A, T: Clone + RandomAccessIterator<A>> RandomAccessIterator<A> for Cycle<T>
 /// An iterator which strings two iterators together
 #[deriving(Clone)]
 pub struct Chain<T, U> {
-    priv a: T,
-    priv b: U,
-    priv flag: bool
+    a: T,
+    b: U,
+    flag: bool
 }
 
 impl<A, T: Iterator<A>, U: Iterator<A>> Iterator<A> for Chain<T, U> {
@@ -1156,8 +1156,8 @@ for Chain<T, U> {
 /// An iterator which iterates two other iterators simultaneously
 #[deriving(Clone)]
 pub struct Zip<T, U> {
-    priv a: T,
-    priv b: U
+    a: T,
+    b: U
 }
 
 impl<A, B, T: Iterator<A>, U: Iterator<B>> Iterator<(A, B)> for Zip<T, U> {
@@ -1234,8 +1234,8 @@ RandomAccessIterator<(A, B)> for Zip<T, U> {
 
 /// An iterator which maps the values of `iter` with `f`
 pub struct Map<'a, A, B, T> {
-    priv iter: T,
-    priv f: 'a |A| -> B
+    iter: T,
+    f: 'a |A| -> B
 }
 
 impl<'a, A, B, T> Map<'a, A, B, T> {
@@ -1283,8 +1283,8 @@ impl<'a, A, B, T: RandomAccessIterator<A>> RandomAccessIterator<B> for Map<'a, A
 
 /// An iterator which filters the elements of `iter` with `predicate`
 pub struct Filter<'a, A, T> {
-    priv iter: T,
-    priv predicate: 'a |&A| -> bool
+    iter: T,
+    predicate: 'a |&A| -> bool
 }
 
 impl<'a, A, T: Iterator<A>> Iterator<A> for Filter<'a, A, T> {
@@ -1327,8 +1327,8 @@ impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Filter<'a, A,
 
 /// An iterator which uses `f` to both filter and map elements from `iter`
 pub struct FilterMap<'a, A, B, T> {
-    priv iter: T,
-    priv f: 'a |A| -> Option<B>
+    iter: T,
+    f: 'a |A| -> Option<B>
 }
 
 impl<'a, A, B, T: Iterator<A>> Iterator<B> for FilterMap<'a, A, B, T> {
@@ -1371,8 +1371,8 @@ for FilterMap<'a, A, B, T> {
 /// An iterator which yields the current count and the element during iteration
 #[deriving(Clone)]
 pub struct Enumerate<T> {
-    priv iter: T,
-    priv count: uint
+    iter: T,
+    count: uint
 }
 
 impl<A, T: Iterator<A>> Iterator<(uint, A)> for Enumerate<T> {
@@ -1425,8 +1425,8 @@ impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<(uint, A)> for Enumerat
 
 /// An iterator with a `peek()` that returns an optional reference to the next element.
 pub struct Peekable<A, T> {
-    priv iter: T,
-    priv peeked: Option<A>,
+    iter: T,
+    peeked: Option<A>,
 }
 
 impl<A, T: Iterator<A>> Iterator<A> for Peekable<A, T> {
@@ -1475,9 +1475,9 @@ impl<'a, A, T: Iterator<A>> Peekable<A, T> {
 
 /// An iterator which rejects elements while `predicate` is true
 pub struct SkipWhile<'a, A, T> {
-    priv iter: T,
-    priv flag: bool,
-    priv predicate: 'a |&A| -> bool
+    iter: T,
+    flag: bool,
+    predicate: 'a |&A| -> bool
 }
 
 impl<'a, A, T: Iterator<A>> Iterator<A> for SkipWhile<'a, A, T> {
@@ -1513,9 +1513,9 @@ impl<'a, A, T: Iterator<A>> Iterator<A> for SkipWhile<'a, A, T> {
 
 /// An iterator which only accepts elements while `predicate` is true
 pub struct TakeWhile<'a, A, T> {
-    priv iter: T,
-    priv flag: bool,
-    priv predicate: 'a |&A| -> bool
+    iter: T,
+    flag: bool,
+    predicate: 'a |&A| -> bool
 }
 
 impl<'a, A, T: Iterator<A>> Iterator<A> for TakeWhile<'a, A, T> {
@@ -1548,8 +1548,8 @@ impl<'a, A, T: Iterator<A>> Iterator<A> for TakeWhile<'a, A, T> {
 /// An iterator which skips over `n` elements of `iter`.
 #[deriving(Clone)]
 pub struct Skip<T> {
-    priv iter: T,
-    priv n: uint
+    iter: T,
+    n: uint
 }
 
 impl<A, T: Iterator<A>> Iterator<A> for Skip<T> {
@@ -1612,8 +1612,8 @@ impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Skip<T> {
 /// An iterator which only iterates over the first `n` iterations of `iter`.
 #[deriving(Clone)]
 pub struct Take<T> {
-    priv iter: T,
-    priv n: uint
+    iter: T,
+    n: uint
 }
 
 impl<A, T: Iterator<A>> Iterator<A> for Take<T> {
@@ -1661,11 +1661,11 @@ impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Take<T> {
 
 /// An iterator to maintain state while iterating another iterator
 pub struct Scan<'a, A, B, T, St> {
-    priv iter: T,
-    priv f: 'a |&mut St, A| -> Option<B>,
+    iter: T,
+    f: 'a |&mut St, A| -> Option<B>,
 
     /// The current internal state to be passed to the closure next.
-    state: St
+    pub state: St,
 }
 
 impl<'a, A, B, T: Iterator<A>, St> Iterator<B> for Scan<'a, A, B, T, St> {
@@ -1685,10 +1685,10 @@ impl<'a, A, B, T: Iterator<A>, St> Iterator<B> for Scan<'a, A, B, T, St> {
 /// and yields the elements of the produced iterators
 ///
 pub struct FlatMap<'a, A, T, U> {
-    priv iter: T,
-    priv f: 'a |A| -> U,
-    priv frontiter: Option<U>,
-    priv backiter: Option<U>,
+    iter: T,
+    f: 'a |A| -> U,
+    frontiter: Option<U>,
+    backiter: Option<U>,
 }
 
 impl<'a, A, T: Iterator<A>, B, U: Iterator<B>> Iterator<B> for FlatMap<'a, A, T, U> {
@@ -1744,8 +1744,8 @@ impl<'a,
 /// yields `None` once.
 #[deriving(Clone)]
 pub struct Fuse<T> {
-    priv iter: T,
-    priv done: bool
+    iter: T,
+    done: bool
 }
 
 impl<A, T: Iterator<A>> Iterator<A> for Fuse<T> {
@@ -1816,8 +1816,8 @@ impl<T> Fuse<T> {
 /// An iterator that calls a function with a reference to each
 /// element before yielding it.
 pub struct Inspect<'a, A, T> {
-    priv iter: T,
-    priv f: 'a |&A|
+    iter: T,
+    f: 'a |&A|
 }
 
 impl<'a, A, T> Inspect<'a, A, T> {
@@ -1869,9 +1869,9 @@ for Inspect<'a, A, T> {
 
 /// An iterator which just modifies the contained state throughout iteration.
 pub struct Unfold<'a, A, St> {
-    priv f: 'a |&mut St| -> Option<A>,
+    f: 'a |&mut St| -> Option<A>,
     /// Internal state that will be yielded on the next iteration
-    state: St
+    pub state: St,
 }
 
 impl<'a, A, St> Unfold<'a, A, St> {
@@ -1905,9 +1905,9 @@ impl<'a, A, St> Iterator<A> for Unfold<'a, A, St> {
 #[deriving(Clone)]
 pub struct Counter<A> {
     /// The current state the counter is at (next value to be yielded)
-    priv state: A,
+    state: A,
     /// The amount that this iterator is stepping by
-    priv step: A
+    step: A,
 }
 
 /// Creates a new counter with the specified start/step
@@ -1933,9 +1933,9 @@ impl<A: Add<A, A> + Clone> Iterator<A> for Counter<A> {
 /// An iterator over the range [start, stop)
 #[deriving(Clone)]
 pub struct Range<A> {
-    priv state: A,
-    priv stop: A,
-    priv one: A
+    state: A,
+    stop: A,
+    one: A
 }
 
 /// Return an iterator over the range [start, stop)
@@ -2007,8 +2007,8 @@ impl<A: Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A> for Range<A> {
 /// An iterator over the range [start, stop]
 #[deriving(Clone)]
 pub struct RangeInclusive<A> {
-    priv range: Range<A>,
-    priv done: bool
+    range: Range<A>,
+    done: bool,
 }
 
 /// Return an iterator over the range [start, stop]
@@ -2070,10 +2070,10 @@ impl<A: Sub<A, A> + Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A>
 /// An iterator over the range [start, stop) by `step`. It handles overflow by stopping.
 #[deriving(Clone)]
 pub struct RangeStep<A> {
-    priv state: A,
-    priv stop: A,
-    priv step: A,
-    priv rev: bool
+    state: A,
+    stop: A,
+    step: A,
+    rev: bool,
 }
 
 /// Return an iterator over the range [start, stop) by `step`. It handles overflow by stopping.
@@ -2102,11 +2102,11 @@ impl<A: CheckedAdd + Ord + Clone> Iterator<A> for RangeStep<A> {
 /// An iterator over the range [start, stop] by `step`. It handles overflow by stopping.
 #[deriving(Clone)]
 pub struct RangeStepInclusive<A> {
-    priv state: A,
-    priv stop: A,
-    priv step: A,
-    priv rev: bool,
-    priv done: bool
+    state: A,
+    stop: A,
+    step: A,
+    rev: bool,
+    done: bool,
 }
 
 /// Return an iterator over the range [start, stop] by `step`. It handles overflow by stopping.
@@ -2137,7 +2137,7 @@ impl<A: CheckedAdd + Ord + Clone + Eq> Iterator<A> for RangeStepInclusive<A> {
 /// An iterator that repeats an element endlessly
 #[deriving(Clone)]
 pub struct Repeat<A> {
-    priv element: A
+    element: A
 }
 
 impl<A: Clone> Repeat<A> {
@@ -2335,8 +2335,8 @@ mod tests {
 
     #[test]
     fn test_counter_from_iter() {
-        let mut it = count(0, 5).take(10);
-        let xs: ~[int] = FromIterator::from_iterator(it);
+        let it = count(0, 5).take(10);
+        let xs: ~[int] = FromIterator::from_iter(it);
         assert_eq!(xs, ~[0, 5, 10, 15, 20, 25, 30, 35, 40, 45]);
     }
 
diff --git a/src/libstd/kinds.rs b/src/libstd/kinds.rs
index f116f61509e..f9827d7fa59 100644
--- a/src/libstd/kinds.rs
+++ b/src/libstd/kinds.rs
@@ -33,10 +33,8 @@ pub trait Sized {
 }
 
 /// Types that can be copied by simply copying bits (i.e. `memcpy`).
-///
-/// The name "POD" stands for "Plain Old Data" and is borrowed from C++.
-#[lang="pod"]
-pub trait Pod {
+#[lang="copy"]
+pub trait Copy {
     // Empty.
 }
 
@@ -195,7 +193,7 @@ pub mod marker {
     /// "interior" mutability:
     ///
     /// ```
-    /// pub struct Cell<T> { priv value: T }
+    /// pub struct Cell<T> { value: T }
     /// # fn main() {}
     /// ```
     ///
@@ -264,9 +262,9 @@ pub mod marker {
     /// A type which is considered "not POD", meaning that it is not
     /// implicitly copyable. This is typically embedded in other types to
     /// ensure that they are never copied, even if they lack a destructor.
-    #[lang="no_pod_bound"]
+    #[lang="no_copy_bound"]
     #[deriving(Eq,Clone)]
-    pub struct NoPod;
+    pub struct NoCopy;
 
     /// A type which is considered "not sharable", meaning that
     /// its contents are not threadsafe, hence they cannot be
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 9e13d70b0ce..42d35b60896 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -43,21 +43,22 @@
 //!
 //!     use std::prelude::*;
 
-#[crate_id = "std#0.10-pre"];
-#[comment = "The Rust standard library"];
-#[license = "MIT/ASL2"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-#[feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args,
-          simd, linkage, default_type_params, phase)];
+#![crate_id = "std#0.11-pre"]
+#![comment = "The Rust standard library"]
+#![license = "MIT/ASL2"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+#![feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args,
+           simd, linkage, default_type_params, phase, concat_idents)]
 
 // Don't link to std. We are std.
-#[no_std];
+#![no_std]
 
-#[deny(missing_doc)];
+#![deny(missing_doc)]
+#![allow(unknown_features)] // NOTE: remove after a stage0 snap
 
 // When testing libstd, bring in libuv as the I/O backend so tests can print
 // things and all of the std::io tests have an I/O interface to run on top
@@ -204,8 +205,6 @@ pub mod raw;
 /* For internal use, not exported */
 
 mod unicode;
-#[path = "num/cmath.rs"]
-mod cmath;
 
 // FIXME #7809: This shouldn't be pub, and it should be reexported under 'unstable'
 // but name resolution doesn't work without it being pub.
@@ -232,4 +231,5 @@ mod std {
     pub use to_str;
     pub use ty;
     pub use unstable;
+    pub use vec;
 }
diff --git a/src/libstd/libc.rs b/src/libstd/libc.rs
index 42221f07449..52e01f4dbfd 100644
--- a/src/libstd/libc.rs
+++ b/src/libstd/libc.rs
@@ -62,10 +62,10 @@
 * dissolved.
 */
 
-#[allow(non_camel_case_types)];
-#[allow(non_uppercase_statics)];
-#[allow(missing_doc)];
-#[allow(uppercase_variables)];
+#![allow(non_camel_case_types)]
+#![allow(non_uppercase_statics)]
+#![allow(missing_doc)]
+#![allow(uppercase_variables)]
 
 // Initial glob-exports mean that all the contents of all the modules
 // wind up exported, if you're interested in writing platform-specific code.
@@ -244,28 +244,30 @@ pub mod types {
                 pub type pthread_t = c_ulong;
 
                 pub struct glob_t {
-                    gl_pathc: size_t,
-                    gl_pathv: **c_char,
-                    gl_offs:  size_t,
-
-                    __unused1: *c_void,
-                    __unused2: *c_void,
-                    __unused3: *c_void,
-                    __unused4: *c_void,
-                    __unused5: *c_void,
+                    pub gl_pathc: size_t,
+                    pub gl_pathv: **c_char,
+                    pub gl_offs:  size_t,
+
+                    pub __unused1: *c_void,
+                    pub __unused2: *c_void,
+                    pub __unused3: *c_void,
+                    pub __unused4: *c_void,
+                    pub __unused5: *c_void,
                 }
 
                 pub struct timeval {
-                    tv_sec: time_t,
-                    tv_usec: suseconds_t,
+                    pub tv_sec: time_t,
+                    pub tv_usec: suseconds_t,
                 }
 
                 pub struct timespec {
-                    tv_sec: time_t,
-                    tv_nsec: c_long,
+                    pub tv_sec: time_t,
+                    pub tv_nsec: c_long,
                 }
 
                 pub enum timezone {}
+
+                pub type sighandler_t = size_t;
             }
             pub mod bsd44 {
                 use libc::types::os::arch::c95::{c_char, c_int, c_uint};
@@ -275,54 +277,54 @@ pub mod types {
                 pub type in_port_t = u16;
                 pub type in_addr_t = u32;
                 pub struct sockaddr {
-                    sa_family: sa_family_t,
-                    sa_data: [u8, ..14],
+                    pub sa_family: sa_family_t,
+                    pub sa_data: [u8, ..14],
                 }
                 pub struct sockaddr_storage {
-                    ss_family: sa_family_t,
-                    __ss_align: i64,
-                    __ss_pad2: [u8, ..112],
+                    pub ss_family: sa_family_t,
+                    pub __ss_align: i64,
+                    pub __ss_pad2: [u8, ..112],
                 }
                 pub struct sockaddr_in {
-                    sin_family: sa_family_t,
-                    sin_port: in_port_t,
-                    sin_addr: in_addr,
-                    sin_zero: [u8, ..8],
+                    pub sin_family: sa_family_t,
+                    pub sin_port: in_port_t,
+                    pub sin_addr: in_addr,
+                    pub sin_zero: [u8, ..8],
                 }
                 pub struct in_addr {
-                    s_addr: in_addr_t,
+                    pub s_addr: in_addr_t,
                 }
                 pub struct sockaddr_in6 {
-                    sin6_family: sa_family_t,
-                    sin6_port: in_port_t,
-                    sin6_flowinfo: u32,
-                    sin6_addr: in6_addr,
-                    sin6_scope_id: u32,
+                    pub sin6_family: sa_family_t,
+                    pub sin6_port: in_port_t,
+                    pub sin6_flowinfo: u32,
+                    pub sin6_addr: in6_addr,
+                    pub sin6_scope_id: u32,
                 }
                 pub struct in6_addr {
-                    s6_addr: [u16, ..8]
+                    pub s6_addr: [u16, ..8]
                 }
                 pub struct ip_mreq {
-                    imr_multiaddr: in_addr,
-                    imr_interface: in_addr,
+                    pub imr_multiaddr: in_addr,
+                    pub imr_interface: in_addr,
                 }
                 pub struct ip6_mreq {
-                    ipv6mr_multiaddr: in6_addr,
-                    ipv6mr_interface: c_uint,
+                    pub ipv6mr_multiaddr: in6_addr,
+                    pub ipv6mr_interface: c_uint,
                 }
                 pub struct addrinfo {
-                    ai_flags: c_int,
-                    ai_family: c_int,
-                    ai_socktype: c_int,
-                    ai_protocol: c_int,
-                    ai_addrlen: socklen_t,
-                    ai_addr: *sockaddr,
-                    ai_canonname: *c_char,
-                    ai_next: *addrinfo
+                    pub ai_flags: c_int,
+                    pub ai_family: c_int,
+                    pub ai_socktype: c_int,
+                    pub ai_protocol: c_int,
+                    pub ai_addrlen: socklen_t,
+                    pub ai_addr: *sockaddr,
+                    pub ai_canonname: *c_char,
+                    pub ai_next: *addrinfo,
                 }
                 pub struct sockaddr_un {
-                    sun_family: sa_family_t,
-                    sun_path: [c_char, ..108]
+                    pub sun_family: sa_family_t,
+                    pub sun_path: [c_char, ..108]
                 }
             }
         }
@@ -393,35 +395,35 @@ pub mod types {
                 pub type blkcnt_t = i32;
 
                 pub struct stat {
-                    st_dev: dev_t,
-                    __pad1: c_short,
-                    st_ino: ino_t,
-                    st_mode: mode_t,
-                    st_nlink: nlink_t,
-                    st_uid: uid_t,
-                    st_gid: gid_t,
-                    st_rdev: dev_t,
-                    __pad2: c_short,
-                    st_size: off_t,
-                    st_blksize: blksize_t,
-                    st_blocks: blkcnt_t,
-                    st_atime: time_t,
-                    st_atime_nsec: c_long,
-                    st_mtime: time_t,
-                    st_mtime_nsec: c_long,
-                    st_ctime: time_t,
-                    st_ctime_nsec: c_long,
-                    __unused4: c_long,
-                    __unused5: c_long,
+                    pub st_dev: dev_t,
+                    pub __pad1: c_short,
+                    pub st_ino: ino_t,
+                    pub st_mode: mode_t,
+                    pub st_nlink: nlink_t,
+                    pub st_uid: uid_t,
+                    pub st_gid: gid_t,
+                    pub st_rdev: dev_t,
+                    pub __pad2: c_short,
+                    pub st_size: off_t,
+                    pub st_blksize: blksize_t,
+                    pub st_blocks: blkcnt_t,
+                    pub st_atime: time_t,
+                    pub st_atime_nsec: c_long,
+                    pub st_mtime: time_t,
+                    pub st_mtime_nsec: c_long,
+                    pub st_ctime: time_t,
+                    pub st_ctime_nsec: c_long,
+                    pub __unused4: c_long,
+                    pub __unused5: c_long,
                 }
 
                 pub struct utimbuf {
-                    actime: time_t,
-                    modtime: time_t,
+                    pub actime: time_t,
+                    pub modtime: time_t,
                 }
 
                 pub struct pthread_attr_t {
-                    __size: [u32, ..9]
+                    pub __size: [u32, ..9]
                 }
             }
             #[cfg(target_arch = "arm")]
@@ -435,34 +437,34 @@ pub mod types {
                 pub type blkcnt_t = u32;
 
                 pub struct stat {
-                    st_dev: c_ulonglong,
-                    __pad0: [c_uchar, ..4],
-                    __st_ino: ino_t,
-                    st_mode: c_uint,
-                    st_nlink: c_uint,
-                    st_uid: uid_t,
-                    st_gid: gid_t,
-                    st_rdev: c_ulonglong,
-                    __pad3: [c_uchar, ..4],
-                    st_size: c_longlong,
-                    st_blksize: blksize_t,
-                    st_blocks: c_ulonglong,
-                    st_atime: time_t,
-                    st_atime_nsec: c_ulong,
-                    st_mtime: time_t,
-                    st_mtime_nsec: c_ulong,
-                    st_ctime: time_t,
-                    st_ctime_nsec: c_ulong,
-                    st_ino: c_ulonglong
+                    pub st_dev: c_ulonglong,
+                    pub __pad0: [c_uchar, ..4],
+                    pub __st_ino: ino_t,
+                    pub st_mode: c_uint,
+                    pub st_nlink: c_uint,
+                    pub st_uid: uid_t,
+                    pub st_gid: gid_t,
+                    pub st_rdev: c_ulonglong,
+                    pub __pad3: [c_uchar, ..4],
+                    pub st_size: c_longlong,
+                    pub st_blksize: blksize_t,
+                    pub st_blocks: c_ulonglong,
+                    pub st_atime: time_t,
+                    pub st_atime_nsec: c_ulong,
+                    pub st_mtime: time_t,
+                    pub st_mtime_nsec: c_ulong,
+                    pub st_ctime: time_t,
+                    pub st_ctime_nsec: c_ulong,
+                    pub st_ino: c_ulonglong,
                 }
 
                 pub struct utimbuf {
-                    actime: time_t,
-                    modtime: time_t,
+                    pub actime: time_t,
+                    pub modtime: time_t,
                 }
 
                 pub struct pthread_attr_t {
-                    __size: [u32, ..9]
+                    pub __size: [u32, ..9]
                 }
             }
             #[cfg(target_arch = "mips")]
@@ -477,35 +479,35 @@ pub mod types {
                 pub type blkcnt_t = i32;
 
                 pub struct stat {
-                    st_dev: c_ulong,
-                    st_pad1: [c_long, ..3],
-                    st_ino: ino_t,
-                    st_mode: mode_t,
-                    st_nlink: nlink_t,
-                    st_uid: uid_t,
-                    st_gid: gid_t,
-                    st_rdev: c_ulong,
-                    st_pad2: [c_long, ..2],
-                    st_size: off_t,
-                    st_pad3: c_long,
-                    st_atime: time_t,
-                    st_atime_nsec: c_long,
-                    st_mtime: time_t,
-                    st_mtime_nsec: c_long,
-                    st_ctime: time_t,
-                    st_ctime_nsec: c_long,
-                    st_blksize: blksize_t,
-                    st_blocks: blkcnt_t,
-                    st_pad5: [c_long, ..14],
+                    pub st_dev: c_ulong,
+                    pub st_pad1: [c_long, ..3],
+                    pub st_ino: ino_t,
+                    pub st_mode: mode_t,
+                    pub st_nlink: nlink_t,
+                    pub st_uid: uid_t,
+                    pub st_gid: gid_t,
+                    pub st_rdev: c_ulong,
+                    pub st_pad2: [c_long, ..2],
+                    pub st_size: off_t,
+                    pub st_pad3: c_long,
+                    pub st_atime: time_t,
+                    pub st_atime_nsec: c_long,
+                    pub st_mtime: time_t,
+                    pub st_mtime_nsec: c_long,
+                    pub st_ctime: time_t,
+                    pub st_ctime_nsec: c_long,
+                    pub st_blksize: blksize_t,
+                    pub st_blocks: blkcnt_t,
+                    pub st_pad5: [c_long, ..14],
                 }
 
                 pub struct utimbuf {
-                    actime: time_t,
-                    modtime: time_t,
+                    pub actime: time_t,
+                    pub modtime: time_t,
                 }
 
                 pub struct pthread_attr_t {
-                    __size: [u32, ..9]
+                    pub __size: [u32, ..9]
                 }
             }
             pub mod posix08 {}
@@ -561,33 +563,33 @@ pub mod types {
                 pub type blksize_t = i64;
                 pub type blkcnt_t = i64;
                 pub struct stat {
-                    st_dev: dev_t,
-                    st_ino: ino_t,
-                    st_nlink: nlink_t,
-                    st_mode: mode_t,
-                    st_uid: uid_t,
-                    st_gid: gid_t,
-                    __pad0: c_int,
-                    st_rdev: dev_t,
-                    st_size: off_t,
-                    st_blksize: blksize_t,
-                    st_blocks: blkcnt_t,
-                    st_atime: time_t,
-                    st_atime_nsec: c_long,
-                    st_mtime: time_t,
-                    st_mtime_nsec: c_long,
-                    st_ctime: time_t,
-                    st_ctime_nsec: c_long,
-                    __unused: [c_long, ..3],
+                    pub st_dev: dev_t,
+                    pub st_ino: ino_t,
+                    pub st_nlink: nlink_t,
+                    pub st_mode: mode_t,
+                    pub st_uid: uid_t,
+                    pub st_gid: gid_t,
+                    pub __pad0: c_int,
+                    pub st_rdev: dev_t,
+                    pub st_size: off_t,
+                    pub st_blksize: blksize_t,
+                    pub st_blocks: blkcnt_t,
+                    pub st_atime: time_t,
+                    pub st_atime_nsec: c_long,
+                    pub st_mtime: time_t,
+                    pub st_mtime_nsec: c_long,
+                    pub st_ctime: time_t,
+                    pub st_ctime_nsec: c_long,
+                    pub __unused: [c_long, ..3],
                 }
 
                 pub struct utimbuf {
-                    actime: time_t,
-                    modtime: time_t,
+                    pub actime: time_t,
+                    pub modtime: time_t,
                 }
 
                 pub struct pthread_attr_t {
-                    __size: [u64, ..7]
+                    pub __size: [u64, ..7]
                 }
             }
             pub mod posix08 {
@@ -611,32 +613,34 @@ pub mod types {
                 pub type pthread_t = uintptr_t;
 
                 pub struct glob_t {
-                    gl_pathc:  size_t,
-                    __unused1: size_t,
-                    gl_offs:   size_t,
-                    __unused2: c_int,
-                    gl_pathv:  **c_char,
-
-                    __unused3: *c_void,
-
-                    __unused4: *c_void,
-                    __unused5: *c_void,
-                    __unused6: *c_void,
-                    __unused7: *c_void,
-                    __unused8: *c_void,
+                    pub gl_pathc:  size_t,
+                    pub __unused1: size_t,
+                    pub gl_offs:   size_t,
+                    pub __unused2: c_int,
+                    pub gl_pathv:  **c_char,
+
+                    pub __unused3: *c_void,
+
+                    pub __unused4: *c_void,
+                    pub __unused5: *c_void,
+                    pub __unused6: *c_void,
+                    pub __unused7: *c_void,
+                    pub __unused8: *c_void,
                 }
 
                 pub struct timeval {
-                    tv_sec: time_t,
-                    tv_usec: suseconds_t,
+                    pub tv_sec: time_t,
+                    pub tv_usec: suseconds_t,
                 }
 
                 pub struct timespec {
-                    tv_sec: time_t,
-                    tv_nsec: c_long,
+                    pub tv_sec: time_t,
+                    pub tv_nsec: c_long,
                 }
 
                 pub enum timezone {}
+
+                pub type sighandler_t = size_t;
             }
             pub mod bsd44 {
                 use libc::types::os::arch::c95::{c_char, c_int, c_uint};
@@ -646,60 +650,60 @@ pub mod types {
                 pub type in_port_t = u16;
                 pub type in_addr_t = u32;
                 pub struct sockaddr {
-                    sa_len: u8,
-                    sa_family: sa_family_t,
-                    sa_data: [u8, ..14],
+                    pub sa_len: u8,
+                    pub sa_family: sa_family_t,
+                    pub sa_data: [u8, ..14],
                 }
                 pub struct sockaddr_storage {
-                    ss_len: u8,
-                    ss_family: sa_family_t,
-                    __ss_pad1: [u8, ..6],
-                    __ss_align: i64,
-                    __ss_pad2: [u8, ..112],
+                    pub ss_len: u8,
+                    pub ss_family: sa_family_t,
+                    pub __ss_pad1: [u8, ..6],
+                    pub __ss_align: i64,
+                    pub __ss_pad2: [u8, ..112],
                 }
                 pub struct sockaddr_in {
-                    sin_len: u8,
-                    sin_family: sa_family_t,
-                    sin_port: in_port_t,
-                    sin_addr: in_addr,
-                    sin_zero: [u8, ..8],
+                    pub sin_len: u8,
+                    pub sin_family: sa_family_t,
+                    pub sin_port: in_port_t,
+                    pub sin_addr: in_addr,
+                    pub sin_zero: [u8, ..8],
                 }
                 pub struct in_addr {
-                    s_addr: in_addr_t,
+                    pub s_addr: in_addr_t,
                 }
                 pub struct sockaddr_in6 {
-                    sin6_len: u8,
-                    sin6_family: sa_family_t,
-                    sin6_port: in_port_t,
-                    sin6_flowinfo: u32,
-                    sin6_addr: in6_addr,
-                    sin6_scope_id: u32,
+                    pub sin6_len: u8,
+                    pub sin6_family: sa_family_t,
+                    pub sin6_port: in_port_t,
+                    pub sin6_flowinfo: u32,
+                    pub sin6_addr: in6_addr,
+                    pub sin6_scope_id: u32,
                 }
                 pub struct in6_addr {
-                    s6_addr: [u16, ..8]
+                    pub s6_addr: [u16, ..8]
                 }
                 pub struct ip_mreq {
-                    imr_multiaddr: in_addr,
-                    imr_interface: in_addr,
+                    pub imr_multiaddr: in_addr,
+                    pub imr_interface: in_addr,
                 }
                 pub struct ip6_mreq {
-                    ipv6mr_multiaddr: in6_addr,
-                    ipv6mr_interface: c_uint,
+                    pub ipv6mr_multiaddr: in6_addr,
+                    pub ipv6mr_interface: c_uint,
                 }
                 pub struct addrinfo {
-                    ai_flags: c_int,
-                    ai_family: c_int,
-                    ai_socktype: c_int,
-                    ai_protocol: c_int,
-                    ai_addrlen: socklen_t,
-                    ai_canonname: *c_char,
-                    ai_addr: *sockaddr,
-                    ai_next: *addrinfo
+                    pub ai_flags: c_int,
+                    pub ai_family: c_int,
+                    pub ai_socktype: c_int,
+                    pub ai_protocol: c_int,
+                    pub ai_addrlen: socklen_t,
+                    pub ai_canonname: *c_char,
+                    pub ai_addr: *sockaddr,
+                    pub ai_next: *addrinfo,
                 }
                 pub struct sockaddr_un {
-                    sun_len: u8,
-                    sun_family: sa_family_t,
-                    sun_path: [c_char, ..104]
+                    pub sun_len: u8,
+                    pub sun_family: sa_family_t,
+                    pub sun_path: [c_char, ..104]
                 }
             }
         }
@@ -755,33 +759,33 @@ pub mod types {
                 pub type blkcnt_t = i64;
                 pub type fflags_t = u32;
                 pub struct stat {
-                    st_dev: dev_t,
-                    st_ino: ino_t,
-                    st_mode: mode_t,
-                    st_nlink: nlink_t,
-                    st_uid: uid_t,
-                    st_gid: gid_t,
-                    st_rdev: dev_t,
-                    st_atime: time_t,
-                    st_atime_nsec: c_long,
-                    st_mtime: time_t,
-                    st_mtime_nsec: c_long,
-                    st_ctime: time_t,
-                    st_ctime_nsec: c_long,
-                    st_size: off_t,
-                    st_blocks: blkcnt_t,
-                    st_blksize: blksize_t,
-                    st_flags: fflags_t,
-                    st_gen: uint32_t,
-                    st_lspare: int32_t,
-                    st_birthtime: time_t,
-                    st_birthtime_nsec: c_long,
-                    __unused: [uint8_t, ..2],
+                    pub st_dev: dev_t,
+                    pub st_ino: ino_t,
+                    pub st_mode: mode_t,
+                    pub st_nlink: nlink_t,
+                    pub st_uid: uid_t,
+                    pub st_gid: gid_t,
+                    pub st_rdev: dev_t,
+                    pub st_atime: time_t,
+                    pub st_atime_nsec: c_long,
+                    pub st_mtime: time_t,
+                    pub st_mtime_nsec: c_long,
+                    pub st_ctime: time_t,
+                    pub st_ctime_nsec: c_long,
+                    pub st_size: off_t,
+                    pub st_blocks: blkcnt_t,
+                    pub st_blksize: blksize_t,
+                    pub st_flags: fflags_t,
+                    pub st_gen: uint32_t,
+                    pub st_lspare: int32_t,
+                    pub st_birthtime: time_t,
+                    pub st_birthtime_nsec: c_long,
+                    pub __unused: [uint8_t, ..2],
                 }
 
                 pub struct utimbuf {
-                    actime: time_t,
-                    modtime: time_t,
+                    pub actime: time_t,
+                    pub modtime: time_t,
                 }
 
                 pub type pthread_attr_t = *c_void;
@@ -805,36 +809,36 @@ pub mod types {
                 use libc::types::os::arch::posix88::{dev_t, ino_t};
                 use libc::types::os::arch::posix88::mode_t;
 
-                // Note: this is the struct called stat64 in win32. Not stat,
+                // pub Note: this is the struct called stat64 in win32. Not stat,
                 // nor stati64.
                 pub struct stat {
-                    st_dev: dev_t,
-                    st_ino: ino_t,
-                    st_mode: mode_t,
-                    st_nlink: c_short,
-                    st_uid: c_short,
-                    st_gid: c_short,
-                    st_rdev: dev_t,
-                    st_size: int64,
-                    st_atime: time64_t,
-                    st_mtime: time64_t,
-                    st_ctime: time64_t,
+                    pub st_dev: dev_t,
+                    pub st_ino: ino_t,
+                    pub st_mode: mode_t,
+                    pub st_nlink: c_short,
+                    pub st_uid: c_short,
+                    pub st_gid: c_short,
+                    pub st_rdev: dev_t,
+                    pub st_size: int64,
+                    pub st_atime: time64_t,
+                    pub st_mtime: time64_t,
+                    pub st_ctime: time64_t,
                 }
 
                 // note that this is called utimbuf64 in win32
                 pub struct utimbuf {
-                    actime: time64_t,
-                    modtime: time64_t,
+                    pub actime: time64_t,
+                    pub modtime: time64_t,
                 }
 
                 pub struct timeval {
-                    tv_sec: time_t,
-                    tv_usec: suseconds_t,
+                    pub tv_sec: time_t,
+                    pub tv_usec: suseconds_t,
                 }
 
                 pub struct timespec {
-                    tv_sec: time_t,
-                    tv_nsec: c_long,
+                    pub tv_sec: time_t,
+                    pub tv_nsec: c_long,
                 }
 
                 pub enum timezone {}
@@ -849,54 +853,54 @@ pub mod types {
                 pub type in_port_t = u16;
                 pub type in_addr_t = u32;
                 pub struct sockaddr {
-                    sa_family: sa_family_t,
-                    sa_data: [u8, ..14],
+                    pub sa_family: sa_family_t,
+                    pub sa_data: [u8, ..14],
                 }
                 pub struct sockaddr_storage {
-                    ss_family: sa_family_t,
-                    __ss_align: i64,
-                    __ss_pad2: [u8, ..112],
+                    pub ss_family: sa_family_t,
+                    pub __ss_align: i64,
+                    pub __ss_pad2: [u8, ..112],
                 }
                 pub struct sockaddr_in {
-                    sin_family: sa_family_t,
-                    sin_port: in_port_t,
-                    sin_addr: in_addr,
-                    sin_zero: [u8, ..8],
+                    pub sin_family: sa_family_t,
+                    pub sin_port: in_port_t,
+                    pub sin_addr: in_addr,
+                    pub sin_zero: [u8, ..8],
                 }
                 pub struct in_addr {
-                    s_addr: in_addr_t,
+                    pub s_addr: in_addr_t,
                 }
                 pub struct sockaddr_in6 {
-                    sin6_family: sa_family_t,
-                    sin6_port: in_port_t,
-                    sin6_flowinfo: u32,
-                    sin6_addr: in6_addr,
-                    sin6_scope_id: u32,
+                    pub sin6_family: sa_family_t,
+                    pub sin6_port: in_port_t,
+                    pub sin6_flowinfo: u32,
+                    pub sin6_addr: in6_addr,
+                    pub sin6_scope_id: u32,
                 }
                 pub struct in6_addr {
-                    s6_addr: [u16, ..8]
+                    pub s6_addr: [u16, ..8]
                 }
                 pub struct ip_mreq {
-                    imr_multiaddr: in_addr,
-                    imr_interface: in_addr,
+                    pub imr_multiaddr: in_addr,
+                    pub imr_interface: in_addr,
                 }
                 pub struct ip6_mreq {
-                    ipv6mr_multiaddr: in6_addr,
-                    ipv6mr_interface: c_uint,
+                    pub ipv6mr_multiaddr: in6_addr,
+                    pub ipv6mr_interface: c_uint,
                 }
                 pub struct addrinfo {
-                    ai_flags: c_int,
-                    ai_family: c_int,
-                    ai_socktype: c_int,
-                    ai_protocol: c_int,
-                    ai_addrlen: size_t,
-                    ai_canonname: *c_char,
-                    ai_addr: *sockaddr,
-                    ai_next: *addrinfo
+                    pub ai_flags: c_int,
+                    pub ai_family: c_int,
+                    pub ai_socktype: c_int,
+                    pub ai_protocol: c_int,
+                    pub ai_addrlen: size_t,
+                    pub ai_canonname: *c_char,
+                    pub ai_addr: *sockaddr,
+                    pub ai_next: *addrinfo,
                 }
                 pub struct sockaddr_un {
-                    sun_family: sa_family_t,
-                    sun_path: [c_char, ..108]
+                    pub sun_family: sa_family_t,
+                    pub sun_path: [c_char, ..108]
                 }
             }
         }
@@ -1034,47 +1038,47 @@ pub mod types {
                 pub type int64 = i64;
 
                 pub struct STARTUPINFO {
-                    cb: DWORD,
-                    lpReserved: LPWSTR,
-                    lpDesktop: LPWSTR,
-                    lpTitle: LPWSTR,
-                    dwX: DWORD,
-                    dwY: DWORD,
-                    dwXSize: DWORD,
-                    dwYSize: DWORD,
-                    dwXCountChars: DWORD,
-                    dwYCountCharts: DWORD,
-                    dwFillAttribute: DWORD,
-                    dwFlags: DWORD,
-                    wShowWindow: WORD,
-                    cbReserved2: WORD,
-                    lpReserved2: LPBYTE,
-                    hStdInput: HANDLE,
-                    hStdOutput: HANDLE,
-                    hStdError: HANDLE
+                    pub cb: DWORD,
+                    pub lpReserved: LPWSTR,
+                    pub lpDesktop: LPWSTR,
+                    pub lpTitle: LPWSTR,
+                    pub dwX: DWORD,
+                    pub dwY: DWORD,
+                    pub dwXSize: DWORD,
+                    pub dwYSize: DWORD,
+                    pub dwXCountChars: DWORD,
+                    pub dwYCountCharts: DWORD,
+                    pub dwFillAttribute: DWORD,
+                    pub dwFlags: DWORD,
+                    pub wShowWindow: WORD,
+                    pub cbReserved2: WORD,
+                    pub lpReserved2: LPBYTE,
+                    pub hStdInput: HANDLE,
+                    pub hStdOutput: HANDLE,
+                    pub hStdError: HANDLE,
                 }
                 pub type LPSTARTUPINFO = *mut STARTUPINFO;
 
                 pub struct PROCESS_INFORMATION {
-                    hProcess: HANDLE,
-                    hThread: HANDLE,
-                    dwProcessId: DWORD,
-                    dwThreadId: DWORD
+                    pub hProcess: HANDLE,
+                    pub hThread: HANDLE,
+                    pub dwProcessId: DWORD,
+                    pub dwThreadId: DWORD,
                 }
                 pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
 
                 pub struct SYSTEM_INFO {
-                    wProcessorArchitecture: WORD,
-                    wReserved: WORD,
-                    dwPageSize: DWORD,
-                    lpMinimumApplicationAddress: LPVOID,
-                    lpMaximumApplicationAddress: LPVOID,
-                    dwActiveProcessorMask: DWORD,
-                    dwNumberOfProcessors: DWORD,
-                    dwProcessorType: DWORD,
-                    dwAllocationGranularity: DWORD,
-                    wProcessorLevel: WORD,
-                    wProcessorRevision: WORD
+                    pub wProcessorArchitecture: WORD,
+                    pub wReserved: WORD,
+                    pub dwPageSize: DWORD,
+                    pub lpMinimumApplicationAddress: LPVOID,
+                    pub lpMaximumApplicationAddress: LPVOID,
+                    pub dwActiveProcessorMask: DWORD,
+                    pub dwNumberOfProcessors: DWORD,
+                    pub dwProcessorType: DWORD,
+                    pub dwAllocationGranularity: DWORD,
+                    pub wProcessorLevel: WORD,
+                    pub wProcessorRevision: WORD,
                 }
                 pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
 
@@ -1097,68 +1101,68 @@ pub mod types {
                 }
 
                 pub struct MEMORY_BASIC_INFORMATION {
-                    BaseAddress: LPVOID,
-                    AllocationBase: LPVOID,
-                    AllocationProtect: DWORD,
-                    RegionSize: SIZE_T,
-                    State: DWORD,
-                    Protect: DWORD,
-                    Type: DWORD
+                    pub BaseAddress: LPVOID,
+                    pub AllocationBase: LPVOID,
+                    pub AllocationProtect: DWORD,
+                    pub RegionSize: SIZE_T,
+                    pub State: DWORD,
+                    pub Protect: DWORD,
+                    pub Type: DWORD,
                 }
                 pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
 
                 pub struct OVERLAPPED {
-                    Internal: *c_ulong,
-                    InternalHigh: *c_ulong,
-                    Offset: DWORD,
-                    OffsetHigh: DWORD,
-                    hEvent: HANDLE,
+                    pub Internal: *c_ulong,
+                    pub InternalHigh: *c_ulong,
+                    pub Offset: DWORD,
+                    pub OffsetHigh: DWORD,
+                    pub hEvent: HANDLE,
                 }
 
                 pub type LPOVERLAPPED = *mut OVERLAPPED;
 
                 pub struct FILETIME {
-                    dwLowDateTime: DWORD,
-                    dwHighDateTime: DWORD,
+                    pub dwLowDateTime: DWORD,
+                    pub dwHighDateTime: DWORD,
                 }
 
                 pub type LPFILETIME = *mut FILETIME;
 
                 pub struct GUID {
-                    Data1: DWORD,
-                    Data2: DWORD,
-                    Data3: DWORD,
-                    Data4: [BYTE, ..8],
+                    pub Data1: DWORD,
+                    pub Data2: DWORD,
+                    pub Data3: DWORD,
+                    pub Data4: [BYTE, ..8],
                 }
 
                 pub struct WSAPROTOCOLCHAIN {
-                    ChainLen: c_int,
-                    ChainEntries: [DWORD, ..MAX_PROTOCOL_CHAIN],
+                    pub ChainLen: c_int,
+                    pub ChainEntries: [DWORD, ..MAX_PROTOCOL_CHAIN],
                 }
 
                 pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
 
                 pub struct WSAPROTOCOL_INFO {
-                    dwServiceFlags1: DWORD,
-                    dwServiceFlags2: DWORD,
-                    dwServiceFlags3: DWORD,
-                    dwServiceFlags4: DWORD,
-                    dwProviderFlags: DWORD,
-                    ProviderId: GUID,
-                    dwCatalogEntryId: DWORD,
-                    ProtocolChain: WSAPROTOCOLCHAIN,
-                    iVersion: c_int,
-                    iAddressFamily: c_int,
-                    iMaxSockAddr: c_int,
-                    iMinSockAddr: c_int,
-                    iSocketType: c_int,
-                    iProtocol: c_int,
-                    iProtocolMaxOffset: c_int,
-                    iNetworkByteOrder: c_int,
-                    iSecurityScheme: c_int,
-                    dwMessageSize: DWORD,
-                    dwProviderReserved: DWORD,
-                    szProtocol: [u8, ..WSAPROTOCOL_LEN+1],
+                    pub dwServiceFlags1: DWORD,
+                    pub dwServiceFlags2: DWORD,
+                    pub dwServiceFlags3: DWORD,
+                    pub dwServiceFlags4: DWORD,
+                    pub dwProviderFlags: DWORD,
+                    pub ProviderId: GUID,
+                    pub dwCatalogEntryId: DWORD,
+                    pub ProtocolChain: WSAPROTOCOLCHAIN,
+                    pub iVersion: c_int,
+                    pub iAddressFamily: c_int,
+                    pub iMaxSockAddr: c_int,
+                    pub iMinSockAddr: c_int,
+                    pub iSocketType: c_int,
+                    pub iProtocol: c_int,
+                    pub iProtocolMaxOffset: c_int,
+                    pub iNetworkByteOrder: c_int,
+                    pub iSecurityScheme: c_int,
+                    pub dwMessageSize: DWORD,
+                    pub dwProviderReserved: DWORD,
+                    pub szProtocol: [u8, ..WSAPROTOCOL_LEN+1],
                 }
 
                 pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
@@ -1180,32 +1184,34 @@ pub mod types {
                 pub type pthread_t = uintptr_t;
 
                 pub struct glob_t {
-                    gl_pathc:  size_t,
-                    __unused1: c_int,
-                    gl_offs:   size_t,
-                    __unused2: c_int,
-                    gl_pathv:  **c_char,
-
-                    __unused3: *c_void,
-
-                    __unused4: *c_void,
-                    __unused5: *c_void,
-                    __unused6: *c_void,
-                    __unused7: *c_void,
-                    __unused8: *c_void,
+                    pub gl_pathc:  size_t,
+                    pub __unused1: c_int,
+                    pub gl_offs:   size_t,
+                    pub __unused2: c_int,
+                    pub gl_pathv:  **c_char,
+
+                    pub __unused3: *c_void,
+
+                    pub __unused4: *c_void,
+                    pub __unused5: *c_void,
+                    pub __unused6: *c_void,
+                    pub __unused7: *c_void,
+                    pub __unused8: *c_void,
                 }
 
                 pub struct timeval {
-                    tv_sec: time_t,
-                    tv_usec: suseconds_t,
+                    pub tv_sec: time_t,
+                    pub tv_usec: suseconds_t,
                 }
 
                 pub struct timespec {
-                    tv_sec: time_t,
-                    tv_nsec: c_long,
+                    pub tv_sec: time_t,
+                    pub tv_nsec: c_long,
                 }
 
                 pub enum timezone {}
+
+                pub type sighandler_t = size_t;
             }
 
             pub mod bsd44 {
@@ -1216,60 +1222,60 @@ pub mod types {
                 pub type in_port_t = u16;
                 pub type in_addr_t = u32;
                 pub struct sockaddr {
-                    sa_len: u8,
-                    sa_family: sa_family_t,
-                    sa_data: [u8, ..14],
+                    pub sa_len: u8,
+                    pub sa_family: sa_family_t,
+                    pub sa_data: [u8, ..14],
                 }
                 pub struct sockaddr_storage {
-                    ss_len: u8,
-                    ss_family: sa_family_t,
-                    __ss_pad1: [u8, ..6],
-                    __ss_align: i64,
-                    __ss_pad2: [u8, ..112],
+                    pub ss_len: u8,
+                    pub ss_family: sa_family_t,
+                    pub __ss_pad1: [u8, ..6],
+                    pub __ss_align: i64,
+                    pub __ss_pad2: [u8, ..112],
                 }
                 pub struct sockaddr_in {
-                    sin_len: u8,
-                    sin_family: sa_family_t,
-                    sin_port: in_port_t,
-                    sin_addr: in_addr,
-                    sin_zero: [u8, ..8],
+                    pub sin_len: u8,
+                    pub sin_family: sa_family_t,
+                    pub sin_port: in_port_t,
+                    pub sin_addr: in_addr,
+                    pub sin_zero: [u8, ..8],
                 }
                 pub struct in_addr {
-                    s_addr: in_addr_t,
+                    pub s_addr: in_addr_t,
                 }
                 pub struct sockaddr_in6 {
-                    sin6_len: u8,
-                    sin6_family: sa_family_t,
-                    sin6_port: in_port_t,
-                    sin6_flowinfo: u32,
-                    sin6_addr: in6_addr,
-                    sin6_scope_id: u32,
+                    pub sin6_len: u8,
+                    pub sin6_family: sa_family_t,
+                    pub sin6_port: in_port_t,
+                    pub sin6_flowinfo: u32,
+                    pub sin6_addr: in6_addr,
+                    pub sin6_scope_id: u32,
                 }
                 pub struct in6_addr {
-                    s6_addr: [u16, ..8]
+                    pub s6_addr: [u16, ..8]
                 }
                 pub struct ip_mreq {
-                    imr_multiaddr: in_addr,
-                    imr_interface: in_addr,
+                    pub imr_multiaddr: in_addr,
+                    pub imr_interface: in_addr,
                 }
                 pub struct ip6_mreq {
-                    ipv6mr_multiaddr: in6_addr,
-                    ipv6mr_interface: c_uint,
+                    pub ipv6mr_multiaddr: in6_addr,
+                    pub ipv6mr_interface: c_uint,
                 }
                 pub struct addrinfo {
-                    ai_flags: c_int,
-                    ai_family: c_int,
-                    ai_socktype: c_int,
-                    ai_protocol: c_int,
-                    ai_addrlen: socklen_t,
-                    ai_canonname: *c_char,
-                    ai_addr: *sockaddr,
-                    ai_next: *addrinfo
+                    pub ai_flags: c_int,
+                    pub ai_family: c_int,
+                    pub ai_socktype: c_int,
+                    pub ai_protocol: c_int,
+                    pub ai_addrlen: socklen_t,
+                    pub ai_canonname: *c_char,
+                    pub ai_addr: *sockaddr,
+                    pub ai_next: *addrinfo,
                 }
                 pub struct sockaddr_un {
-                    sun_len: u8,
-                    sun_family: sa_family_t,
-                    sun_path: [c_char, ..104]
+                    pub sun_len: u8,
+                    pub sun_family: sa_family_t,
+                    pub sun_path: [c_char, ..104]
                 }
             }
         }
@@ -1324,38 +1330,38 @@ pub mod types {
                 pub type blkcnt_t = i32;
 
                 pub struct stat {
-                    st_dev: dev_t,
-                    st_mode: mode_t,
-                    st_nlink: nlink_t,
-                    st_ino: ino_t,
-                    st_uid: uid_t,
-                    st_gid: gid_t,
-                    st_rdev: dev_t,
-                    st_atime: time_t,
-                    st_atime_nsec: c_long,
-                    st_mtime: time_t,
-                    st_mtime_nsec: c_long,
-                    st_ctime: time_t,
-                    st_ctime_nsec: c_long,
-                    st_birthtime: time_t,
-                    st_birthtime_nsec: c_long,
-                    st_size: off_t,
-                    st_blocks: blkcnt_t,
-                    st_blksize: blksize_t,
-                    st_flags: uint32_t,
-                    st_gen: uint32_t,
-                    st_lspare: int32_t,
-                    st_qspare: [int64_t, ..2],
+                    pub st_dev: dev_t,
+                    pub st_mode: mode_t,
+                    pub st_nlink: nlink_t,
+                    pub st_ino: ino_t,
+                    pub st_uid: uid_t,
+                    pub st_gid: gid_t,
+                    pub st_rdev: dev_t,
+                    pub st_atime: time_t,
+                    pub st_atime_nsec: c_long,
+                    pub st_mtime: time_t,
+                    pub st_mtime_nsec: c_long,
+                    pub st_ctime: time_t,
+                    pub st_ctime_nsec: c_long,
+                    pub st_birthtime: time_t,
+                    pub st_birthtime_nsec: c_long,
+                    pub st_size: off_t,
+                    pub st_blocks: blkcnt_t,
+                    pub st_blksize: blksize_t,
+                    pub st_flags: uint32_t,
+                    pub st_gen: uint32_t,
+                    pub st_lspare: int32_t,
+                    pub st_qspare: [int64_t, ..2],
                 }
 
                 pub struct utimbuf {
-                    actime: time_t,
-                    modtime: time_t,
+                    pub actime: time_t,
+                    pub modtime: time_t,
                 }
 
                 pub struct pthread_attr_t {
-                    __sig: c_long,
-                    __opaque: [c_char, ..36]
+                    pub __sig: c_long,
+                    pub __opaque: [c_char, ..36]
                 }
             }
             pub mod posix08 {
@@ -1364,8 +1370,8 @@ pub mod types {
             }
             pub mod extra {
                 pub struct mach_timebase_info {
-                    numer: u32,
-                    denom: u32,
+                    pub numer: u32,
+                    pub denom: u32,
                 }
 
                 pub type mach_timebase_info_data_t = mach_timebase_info;
@@ -1422,38 +1428,38 @@ pub mod types {
                 pub type blkcnt_t = i32;
 
                 pub struct stat {
-                    st_dev: dev_t,
-                    st_mode: mode_t,
-                    st_nlink: nlink_t,
-                    st_ino: ino_t,
-                    st_uid: uid_t,
-                    st_gid: gid_t,
-                    st_rdev: dev_t,
-                    st_atime: time_t,
-                    st_atime_nsec: c_long,
-                    st_mtime: time_t,
-                    st_mtime_nsec: c_long,
-                    st_ctime: time_t,
-                    st_ctime_nsec: c_long,
-                    st_birthtime: time_t,
-                    st_birthtime_nsec: c_long,
-                    st_size: off_t,
-                    st_blocks: blkcnt_t,
-                    st_blksize: blksize_t,
-                    st_flags: uint32_t,
-                    st_gen: uint32_t,
-                    st_lspare: int32_t,
-                    st_qspare: [int64_t, ..2],
+                    pub st_dev: dev_t,
+                    pub st_mode: mode_t,
+                    pub st_nlink: nlink_t,
+                    pub st_ino: ino_t,
+                    pub st_uid: uid_t,
+                    pub st_gid: gid_t,
+                    pub st_rdev: dev_t,
+                    pub st_atime: time_t,
+                    pub st_atime_nsec: c_long,
+                    pub st_mtime: time_t,
+                    pub st_mtime_nsec: c_long,
+                    pub st_ctime: time_t,
+                    pub st_ctime_nsec: c_long,
+                    pub st_birthtime: time_t,
+                    pub st_birthtime_nsec: c_long,
+                    pub st_size: off_t,
+                    pub st_blocks: blkcnt_t,
+                    pub st_blksize: blksize_t,
+                    pub st_flags: uint32_t,
+                    pub st_gen: uint32_t,
+                    pub st_lspare: int32_t,
+                    pub st_qspare: [int64_t, ..2],
                 }
 
                 pub struct utimbuf {
-                    actime: time_t,
-                    modtime: time_t,
+                    pub actime: time_t,
+                    pub modtime: time_t,
                 }
 
                 pub struct pthread_attr_t {
-                    __sig: c_long,
-                    __opaque: [c_char, ..56]
+                    pub __sig: c_long,
+                    pub __opaque: [c_char, ..56]
                 }
             }
             pub mod posix08 {
@@ -1462,8 +1468,8 @@ pub mod types {
             }
             pub mod extra {
                 pub struct mach_timebase_info {
-                    numer: u32,
-                    denom: u32,
+                    pub numer: u32,
+                    pub denom: u32,
                 }
 
                 pub type mach_timebase_info_data_t = mach_timebase_info;
@@ -2292,6 +2298,8 @@ pub mod consts {
             use libc::types::os::arch::c95::{c_int, size_t};
 
             pub static SIGTRAP : c_int = 5;
+            pub static SIGPIPE: c_int = 13;
+            pub static SIG_IGN: size_t = 1;
 
             pub static GLOB_ERR      : c_int = 1 << 0;
             pub static GLOB_MARK     : c_int = 1 << 1;
@@ -2356,6 +2364,8 @@ pub mod consts {
 
             pub static CLOCK_REALTIME: c_int = 0;
             pub static CLOCK_MONOTONIC: c_int = 1;
+
+            pub static WNOHANG: c_int = 1;
         }
         pub mod posix08 {
         }
@@ -2741,6 +2751,8 @@ pub mod consts {
             use libc::types::os::arch::c95::{c_int, size_t};
 
             pub static SIGTRAP : c_int = 5;
+            pub static SIGPIPE: c_int = 13;
+            pub static SIG_IGN: size_t = 1;
 
             pub static GLOB_APPEND   : c_int = 0x0001;
             pub static GLOB_DOOFFS   : c_int = 0x0002;
@@ -2802,6 +2814,8 @@ pub mod consts {
 
             pub static CLOCK_REALTIME: c_int = 0;
             pub static CLOCK_MONOTONIC: c_int = 4;
+
+            pub static WNOHANG: c_int = 1;
         }
         pub mod posix08 {
         }
@@ -3136,6 +3150,8 @@ pub mod consts {
             use libc::types::os::arch::c95::{c_int, size_t};
 
             pub static SIGTRAP : c_int = 5;
+            pub static SIGPIPE: c_int = 13;
+            pub static SIG_IGN: size_t = 1;
 
             pub static GLOB_APPEND   : c_int = 0x0001;
             pub static GLOB_DOOFFS   : c_int = 0x0002;
@@ -3187,6 +3203,8 @@ pub mod consts {
             pub static PTHREAD_CREATE_JOINABLE: c_int = 1;
             pub static PTHREAD_CREATE_DETACHED: c_int = 2;
             pub static PTHREAD_STACK_MIN: size_t = 8192;
+
+            pub static WNOHANG: c_int = 1;
         }
         pub mod posix08 {
         }
@@ -3838,6 +3856,24 @@ pub mod funcs {
             }
         }
 
+        pub mod signal {
+            use libc::types::os::arch::c95::c_int;
+            use libc::types::os::common::posix01::sighandler_t;
+
+            #[cfg(not(target_os = "android"))]
+            extern {
+                pub fn signal(signum: c_int,
+                              handler: sighandler_t) -> sighandler_t;
+            }
+
+            #[cfg(target_os = "android")]
+            extern {
+                #[link_name = "bsd_signal"]
+                pub fn signal(signum: c_int,
+                              handler: sighandler_t) -> sighandler_t;
+            }
+        }
+
         pub mod wait {
             use libc::types::os::arch::c95::{c_int};
             use libc::types::os::arch::posix88::{pid_t};
diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs
index f1f1977462f..c555fb58db8 100644
--- a/src/libstd/local_data.rs
+++ b/src/libstd/local_data.rs
@@ -41,11 +41,12 @@ local_data::get(key_vector, |opt| assert_eq!(*opt.unwrap(), ~[4]));
 // magic.
 
 use cast;
-use option::{None, Option, Some};
-use slice::{ImmutableVector, MutableVector, OwnedVector};
 use iter::{Iterator};
-use rt::task::{Task, LocalStorage};
+use kinds::Send;
 use mem::replace;
+use option::{None, Option, Some};
+use rt::task::{Task, LocalStorage};
+use slice::{ImmutableVector, MutableVector, OwnedVector};
 
 /**
  * Indexes a task-local data slot. This pointer is used for comparison to
@@ -89,7 +90,7 @@ impl<T: 'static> LocalData for T {}
 //      a proper map.
 #[doc(hidden)]
 pub type Map = ~[Option<(*u8, TLSValue, LoanState)>];
-type TLSValue = ~LocalData;
+type TLSValue = ~LocalData:Send;
 
 // Gets the map from the runtime. Lazily initialises if not done so already.
 unsafe fn get_local_map() -> &mut Map {
@@ -328,7 +329,7 @@ pub fn set<T: 'static>(key: Key<T>, data: T) {
     // transmute here to add the Send bound back on. This doesn't actually
     // matter because TLS will always own the data (until its moved out) and
     // we're not actually sending it to other schedulers or anything.
-    let data: ~LocalData = unsafe { cast::transmute(data) };
+    let data: ~LocalData:Send = unsafe { cast::transmute(data) };
     match insertion_position(map, keyval) {
         Some(i) => { map[i] = Some((keyval, data, NoLoan)); }
         None => { map.push(Some((keyval, data, NoLoan))); }
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index d183fae3ac6..1a35252f8ca 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -14,7 +14,7 @@
 //! library. Each macro is available for use when linking against the standard
 //! library.
 
-#[macro_escape];
+#![macro_escape]
 
 /// The entry point for failure of rust tasks.
 ///
@@ -332,3 +332,262 @@ macro_rules! log (
         if log_enabled!($lvl) { println!($($args)*) }
     )
 )
+
+/// Built-in macros to the compiler itself.
+///
+/// These macros do not have any corresponding definition with a `macro_rules!`
+/// macro, but are documented here. Their implementations can be found hardcoded
+/// into libsyntax itself.
+#[cfg(dox)]
+pub mod builtin {
+    /// The core macro for formatted string creation & output.
+    ///
+    /// This macro takes as its first argument a callable expression which will
+    /// receive as its first argument a value of type `&fmt::Arguments`. This
+    /// value can be passed to the functions in `std::fmt` for performing useful
+    /// functions. All other formatting macros (`format!`, `write!`,
+    /// `println!`, etc) are proxied through this one.
+    ///
+    /// For more information, see the documentation in `std::fmt`.
+    ///
+    /// # Example
+    ///
+    /// ```rust
+    /// use std::fmt;
+    ///
+    /// let s = format_args!(fmt::format, "hello {}", "world");
+    /// assert_eq!(s, format!("hello {}", "world"));
+    ///
+    /// format_args!(|args| {
+    ///     // pass `args` to another function, etc.
+    /// }, "hello {}", "world");
+    /// ```
+    #[macro_export]
+    macro_rules! format_args( ($closure:expr, $fmt:expr $($args:tt)*) => ({
+        /* compiler built-in */
+    }) )
+
+    /// Inspect an environment variable at compile time.
+    ///
+    /// This macro will expand to the value of the named environment variable at
+    /// compile time, yielding an expression of type `&'static str`.
+    ///
+    /// If the environment variable is not defined, then a compilation error
+    /// will be emitted.  To not emit a compile error, use the `option_env!`
+    /// macro instead.
+    ///
+    /// # Example
+    ///
+    /// ```rust
+    /// let user: &'static str = env!("USER");
+    /// println!("the user who compiled this code is: {}", user);
+    /// ```
+    #[macro_export]
+    macro_rules! env( ($name:expr) => ({ /* compiler built-in */ }) )
+
+    /// Optionally inspect an environment variable at compile time.
+    ///
+    /// If the named environment variable is present at compile time, this will
+    /// expand into an expression of type `Option<&'static str>` whose value is
+    /// `Some` of the value of the environment variable. If the environment
+    /// variable is not present, then this will expand to `None`.
+    ///
+    /// A compile time error is never emitted when using this macro regardless
+    /// of whether the environment variable is present or not.
+    ///
+    /// # Example
+    ///
+    /// ```rust
+    /// let key: Option<&'static str> = option_env!("SECRET_KEY");
+    /// println!("the secret key might be: {}", key);
+    /// ```
+    #[macro_export]
+    macro_rules! option_env( ($name:expr) => ({ /* compiler built-in */ }) )
+
+    /// Concatenate literals into a static byte slice.
+    ///
+    /// This macro takes any number of comma-separated literal expressions,
+    /// yielding an expression of type `&'static [u8]` which is the
+    /// concatenation (left to right) of all the literals in their byte format.
+    ///
+    /// This extension currently only supports string literals, character
+    /// literals, and integers less than 256. The byte slice returned is the
+    /// utf8-encoding of strings and characters.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// let rust = bytes!("r", 'u', "st");
+    /// assert_eq!(rust[1], 'u' as u8);
+    /// ```
+    #[macro_export]
+    macro_rules! bytes( ($($e:expr),*) => ({ /* compiler built-in */ }) )
+
+    /// Concatenate identifiers into one identifier.
+    ///
+    /// This macro takes any number of comma-separated identifiers, and
+    /// concatenates them all into one, yielding an expression which is a new
+    /// identifier. Note that hygiene makes it such that this macro cannot
+    /// capture local variables, and macros are only allowed in item,
+    /// statement or expression position, meaning this macro may be difficult to
+    /// use in some situations.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// fn foobar() -> int { 23 }
+    ///
+    /// let f = concat_idents!(foo, bar);
+    /// println!("{}", f());
+    /// ```
+    #[macro_export]
+    macro_rules! concat_idents( ($($e:ident),*) => ({ /* compiler built-in */ }) )
+
+    /// Concatenates literals into a static string slice.
+    ///
+    /// This macro takes any number of comma-separated literals, yielding an
+    /// expression of type `&'static str` which represents all of the literals
+    /// concatenated left-to-right.
+    ///
+    /// Integer and floating point literals are stringified in order to be
+    /// concatenated.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// let s = concat!("test", 10, 'b', true);
+    /// assert_eq!(s, "test10btrue");
+    /// ```
+    #[macro_export]
+    macro_rules! concat( ($($e:expr),*) => ({ /* compiler built-in */ }) )
+
+    /// A macro which expands to the line number on which it was invoked.
+    ///
+    /// The expanded expression has type `uint`, and the returned line is not
+    /// the invocation of the `line!()` macro itself, but rather the first macro
+    /// invocation leading up to the invocation of the `line!()` macro.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// let current_line = line!();
+    /// println!("defined on line: {}", current_line);
+    /// ```
+    #[macro_export]
+    macro_rules! line( () => ({ /* compiler built-in */ }) )
+
+    /// A macro which expands to the column number on which it was invoked.
+    ///
+    /// The expanded expression has type `uint`, and the returned column is not
+    /// the invocation of the `col!()` macro itself, but rather the first macro
+    /// invocation leading up to the invocation of the `col!()` macro.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// let current_col = col!();
+    /// println!("defined on column: {}", current_col);
+    /// ```
+    #[macro_export]
+    macro_rules! col( () => ({ /* compiler built-in */ }) )
+
+    /// A macro which expands to the file name from which it was invoked.
+    ///
+    /// The expanded expression has type `&'static str`, and the returned file
+    /// is not the invocation of the `file!()` macro itself, but rather the
+    /// first macro invocation leading up to the invocation of the `file!()`
+    /// macro.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// let this_file = file!();
+    /// println!("defined in file: {}", this_file);
+    /// ```
+    #[macro_export]
+    macro_rules! file( () => ({ /* compiler built-in */ }) )
+
+    /// A macro which stringifies its argument.
+    ///
+    /// This macro will yield an expression of type `&'static str` which is the
+    /// stringification of all the tokens passed to the macro. No restrictions
+    /// are placed on the syntax of the macro invocation itself.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// let one_plus_one = stringify!(1 + 1);
+    /// assert_eq!(one_plus_one, "1 + 1");
+    /// ```
+    #[macro_export]
+    macro_rules! stringify( ($t:tt) => ({ /* compiler built-in */ }) )
+
+    /// Includes a utf8-encoded file as a string.
+    ///
+    /// This macro will yield an expression of type `&'static str` which is the
+    /// contents of the filename specified. The file is located relative to the
+    /// current file (similarly to how modules are found),
+    ///
+    /// # Example
+    ///
+    /// ```rust,ignore
+    /// let secret_key = include_str!("secret-key.ascii");
+    /// ```
+    #[macro_export]
+    macro_rules! include_str( ($file:expr) => ({ /* compiler built-in */ }) )
+
+    /// Includes a file as a byte slice.
+    ///
+    /// This macro will yield an expression of type `&'static [u8]` which is
+    /// the contents of the filename specified. The file is located relative to
+    /// the current file (similarly to how modules are found),
+    ///
+    /// # Example
+    ///
+    /// ```rust,ignore
+    /// let secret_key = include_bin!("secret-key.bin");
+    /// ```
+    #[macro_export]
+    macro_rules! include_bin( ($file:expr) => ({ /* compiler built-in */ }) )
+
+    /// Expands to a string that represents the current module path.
+    ///
+    /// The current module path can be thought of as the hierarchy of modules
+    /// leading back up to the crate root. The first component of the path
+    /// returned is the name of the crate currently being compiled.
+    ///
+    /// # Example
+    ///
+    /// ```rust
+    /// mod test {
+    ///     pub fn foo() {
+    ///         assert!(module_path!().ends_with("test"));
+    ///     }
+    /// }
+    ///
+    /// test::foo();
+    /// ```
+    #[macro_export]
+    macro_rules! module_path( () => ({ /* compiler built-in */ }) )
+
+    /// Boolean evaluation of configuration flags.
+    ///
+    /// In addition to the `#[cfg]` attribute, this macro is provided to allow
+    /// boolean expression evaluation of configuration flags. This frequently
+    /// leads to less duplicated code.
+    ///
+    /// The syntax given to this macro is the same syntax as the `cfg`
+    /// attribute.
+    ///
+    /// # Example
+    ///
+    /// ```rust
+    /// let my_directory = if cfg!(windows) {
+    ///     "windows-specific-directory"
+    /// } else {
+    ///     "unix-directory"
+    /// };
+    /// ```
+    #[macro_export]
+    macro_rules! cfg( ($cfg:tt) => ({ /* compiler built-in */ }) )
+}
diff --git a/src/libstd/mem.rs b/src/libstd/mem.rs
index e124ada08c7..0e709445770 100644
--- a/src/libstd/mem.rs
+++ b/src/libstd/mem.rs
@@ -13,7 +13,7 @@
 //! This module contains functions for querying the size and alignment of
 //! types, initializing and manipulating memory.
 
-#[allow(missing_doc)]; // FIXME
+#![allow(missing_doc)] // FIXME
 
 use cast;
 use ptr;
@@ -79,7 +79,7 @@ pub fn pref_align_of_val<T>(_val: &T) -> uint {
 /// Create a value initialized to zero.
 ///
 /// `init` is unsafe because it returns a zeroed-out datum,
-/// which is unsafe unless T is Pod.
+/// which is unsafe unless T is Copy.
 #[inline]
 pub unsafe fn init<T>() -> T {
     intrinsics::init()
diff --git a/src/libstd/num/cmath.rs b/src/libstd/num/cmath.rs
deleted file mode 100644
index 13c4a812ec4..00000000000
--- a/src/libstd/num/cmath.rs
+++ /dev/null
@@ -1,151 +0,0 @@
-// 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.
-//
-// 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(missing_doc)];
-#[allow(dead_code)];
-
-//! Bindings for the C math library (for basic mathematic functions)
-
-// Function names are almost identical to C's libmath, a few have been
-// renamed, grep for "rename:"
-
-pub mod c_double {
-    use libc::{c_double, c_int};
-
-    #[link_name = "m"]
-    extern {
-        // Alphabetically sorted by link_name
-
-        pub fn acos(n: c_double) -> c_double;
-        pub fn asin(n: c_double) -> c_double;
-        pub fn atan(n: c_double) -> c_double;
-        pub fn atan2(a: c_double, b: c_double) -> c_double;
-        pub fn cbrt(n: c_double) -> c_double;
-        pub fn cosh(n: c_double) -> c_double;
-        pub fn erf(n: c_double) -> c_double;
-        pub fn erfc(n: c_double) -> c_double;
-        // rename: for consistency with underscore usage elsewhere
-        #[link_name="expm1"]
-        pub fn exp_m1(n: c_double) -> c_double;
-        // rename: for clarity and consistency with add/sub/mul/div
-        #[link_name="fdim"]
-        pub fn abs_sub(a: c_double, b: c_double) -> c_double;
-        #[link_name="fmax"]
-        pub fn fmax(a: c_double, b: c_double) -> c_double;
-        #[link_name="fmin"]
-        pub fn fmin(a: c_double, b: c_double) -> c_double;
-        #[link_name="nextafter"]
-        pub fn next_after(x: c_double, y: c_double) -> c_double;
-        pub fn frexp(n: c_double, value: &mut c_int) -> c_double;
-        pub fn hypot(x: c_double, y: c_double) -> c_double;
-        pub fn ldexp(x: c_double, n: c_int) -> c_double;
-        #[cfg(unix)]
-        #[link_name="lgamma_r"]
-        pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
-        #[cfg(windows)]
-        #[link_name="__lgamma_r"]
-        pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
-        // renamed: "logb" /often/ is confused for log2 by beginners
-        #[link_name="logb"]
-        pub fn log_radix(n: c_double) -> c_double;
-        // renamed: to be consitent with log as ln
-        #[link_name="log1p"]
-        pub fn ln_1p(n: c_double) -> c_double;
-        #[link_name="ilogb"]
-        pub fn ilog_radix(n: c_double) -> c_int;
-        pub fn modf(n: c_double, iptr: &mut c_double) -> c_double;
-        // rename: for consistency with logradix
-        #[link_name="scalbn"]
-        pub fn ldexp_radix(n: c_double, i: c_int) -> c_double;
-        pub fn sinh(n: c_double) -> c_double;
-        pub fn tan(n: c_double) -> c_double;
-        pub fn tanh(n: c_double) -> c_double;
-        pub fn tgamma(n: c_double) -> c_double;
-
-        // These are commonly only available for doubles
-
-        pub fn j0(n: c_double) -> c_double;
-        pub fn j1(n: c_double) -> c_double;
-        pub fn jn(i: c_int, n: c_double) -> c_double;
-
-        pub fn y0(n: c_double) -> c_double;
-        pub fn y1(n: c_double) -> c_double;
-        pub fn yn(i: c_int, n: c_double) -> c_double;
-    }
-}
-
-pub mod c_float {
-    use libc::{c_float, c_int};
-
-    #[link_name = "m"]
-    extern {
-        // Alphabetically sorted by link_name
-
-        #[link_name="acosf"]
-        pub fn acos(n: c_float) -> c_float;
-        #[link_name="asinf"]
-        pub fn asin(n: c_float) -> c_float;
-        #[link_name="atanf"]
-        pub fn atan(n: c_float) -> c_float;
-        #[link_name="atan2f"]
-        pub fn atan2(a: c_float, b: c_float) -> c_float;
-        #[link_name="cbrtf"]
-        pub fn cbrt(n: c_float) -> c_float;
-        #[link_name="coshf"]
-        pub fn cosh(n: c_float) -> c_float;
-        #[link_name="erff"]
-        pub fn erf(n: c_float) -> c_float;
-        #[link_name="erfcf"]
-        pub fn erfc(n: c_float) -> c_float;
-        #[link_name="expm1f"]
-        pub fn exp_m1(n: c_float) -> c_float;
-        #[link_name="fdimf"]
-        pub fn abs_sub(a: c_float, b: c_float) -> c_float;
-        #[link_name="frexpf"]
-        pub fn frexp(n: c_float, value: &mut c_int) -> c_float;
-        #[link_name="fmaxf"]
-        pub fn fmax(a: c_float, b: c_float) -> c_float;
-        #[link_name="fminf"]
-        pub fn fmin(a: c_float, b: c_float) -> c_float;
-        #[link_name="nextafterf"]
-        pub fn next_after(x: c_float, y: c_float) -> c_float;
-        #[link_name="hypotf"]
-        pub fn hypot(x: c_float, y: c_float) -> c_float;
-        #[link_name="ldexpf"]
-        pub fn ldexp(x: c_float, n: c_int) -> c_float;
-
-        #[cfg(unix)]
-        #[link_name="lgammaf_r"]
-        pub fn lgamma(n: c_float, sign: &mut c_int) -> c_float;
-
-        #[cfg(windows)]
-        #[link_name="__lgammaf_r"]
-        pub fn lgamma(n: c_float, sign: &mut c_int) -> c_float;
-
-        #[link_name="logbf"]
-        pub fn log_radix(n: c_float) -> c_float;
-        #[link_name="log1pf"]
-        pub fn ln_1p(n: c_float) -> c_float;
-        #[link_name="ilogbf"]
-        pub fn ilog_radix(n: c_float) -> c_int;
-        #[link_name="modff"]
-        pub fn modf(n: c_float, iptr: &mut c_float) -> c_float;
-        #[link_name="scalbnf"]
-        pub fn ldexp_radix(n: c_float, i: c_int) -> c_float;
-        #[link_name="sinhf"]
-        pub fn sinh(n: c_float) -> c_float;
-        #[link_name="tanf"]
-        pub fn tan(n: c_float) -> c_float;
-        #[link_name="tanhf"]
-        pub fn tanh(n: c_float) -> c_float;
-        #[link_name="tgammaf"]
-        pub fn tgamma(n: c_float) -> c_float;
-    }
-}
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index 323f24a52c3..7c5fe4ff274 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -10,86 +10,57 @@
 
 //! Operations and constants for 32-bits floats (`f32` type)
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use prelude::*;
 
-use cmath;
 use default::Default;
 use from_str::FromStr;
-use libc::{c_float, c_int};
+use libc::{c_int};
 use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
 use num::{Zero, One, Bounded, strconv};
 use num;
 use intrinsics;
 
-macro_rules! delegate(
-    (
-        $(
-            fn $name:ident(
-                $(
-                    $arg:ident : $arg_ty:ty
-                ),*
-            ) -> $rv:ty = $bound_name:path
-        ),*
-    ) => (
-        $(
-            #[inline]
-            pub fn $name($( $arg : $arg_ty ),*) -> $rv {
-                unsafe {
-                    $bound_name($( $arg ),*)
-                }
-            }
-        )*
-    )
-)
-
-delegate!(
-    // intrinsics
-    fn sqrt(n: f32) -> f32 = intrinsics::sqrtf32,
-    fn powi(n: f32, e: i32) -> f32 = intrinsics::powif32,
-    fn sin(n: f32) -> f32 = intrinsics::sinf32,
-    fn cos(n: f32) -> f32 = intrinsics::cosf32,
-    fn pow(n: f32, e: f32) -> f32 = intrinsics::powf32,
-    fn exp(n: f32) -> f32 = intrinsics::expf32,
-    fn exp2(n: f32) -> f32 = intrinsics::exp2f32,
-    fn ln(n: f32) -> f32 = intrinsics::logf32,
-    fn log10(n: f32) -> f32 = intrinsics::log10f32,
-    fn log2(n: f32) -> f32 = intrinsics::log2f32,
-    fn mul_add(a: f32, b: f32, c: f32) -> f32 = intrinsics::fmaf32,
-    fn abs(n: f32) -> f32 = intrinsics::fabsf32,
-    fn copysign(x: f32, y: f32) -> f32 = intrinsics::copysignf32,
-    fn floor(x: f32) -> f32 = intrinsics::floorf32,
-    fn ceil(n: f32) -> f32 = intrinsics::ceilf32,
-    fn trunc(n: f32) -> f32 = intrinsics::truncf32,
-    fn rint(n: f32) -> f32 = intrinsics::rintf32,
-    fn nearbyint(n: f32) -> f32 = intrinsics::nearbyintf32,
-    fn round(n: f32) -> f32 = intrinsics::roundf32,
-
-    // cmath
-    fn acos(n: c_float) -> c_float = cmath::c_float::acos,
-    fn asin(n: c_float) -> c_float = cmath::c_float::asin,
-    fn atan(n: c_float) -> c_float = cmath::c_float::atan,
-    fn atan2(a: c_float, b: c_float) -> c_float = cmath::c_float::atan2,
-    fn cbrt(n: c_float) -> c_float = cmath::c_float::cbrt,
-    fn cosh(n: c_float) -> c_float = cmath::c_float::cosh,
-    // fn erf(n: c_float) -> c_float = cmath::c_float::erf,
-    // fn erfc(n: c_float) -> c_float = cmath::c_float::erfc,
-    fn exp_m1(n: c_float) -> c_float = cmath::c_float::exp_m1,
-    fn abs_sub(a: c_float, b: c_float) -> c_float = cmath::c_float::abs_sub,
-    fn next_after(x: c_float, y: c_float) -> c_float = cmath::c_float::next_after,
-    fn frexp(n: c_float, value: &mut c_int) -> c_float = cmath::c_float::frexp,
-    fn hypot(x: c_float, y: c_float) -> c_float = cmath::c_float::hypot,
-    fn ldexp(x: c_float, n: c_int) -> c_float = cmath::c_float::ldexp,
-    // fn log_radix(n: c_float) -> c_float = cmath::c_float::log_radix,
-    fn ln_1p(n: c_float) -> c_float = cmath::c_float::ln_1p,
-    // fn ilog_radix(n: c_float) -> c_int = cmath::c_float::ilog_radix,
-    // fn modf(n: c_float, iptr: &mut c_float) -> c_float = cmath::c_float::modf,
-    // fn ldexp_radix(n: c_float, i: c_int) -> c_float = cmath::c_float::ldexp_radix,
-    fn sinh(n: c_float) -> c_float = cmath::c_float::sinh,
-    fn tan(n: c_float) -> c_float = cmath::c_float::tan,
-    fn tanh(n: c_float) -> c_float = cmath::c_float::tanh
-)
+#[allow(dead_code)]
+mod cmath {
+    use libc::{c_float, c_int};
+
+    #[link_name = "m"]
+    extern {
+        pub fn acosf(n: c_float) -> c_float;
+        pub fn asinf(n: c_float) -> c_float;
+        pub fn atanf(n: c_float) -> c_float;
+        pub fn atan2f(a: c_float, b: c_float) -> c_float;
+        pub fn cbrtf(n: c_float) -> c_float;
+        pub fn coshf(n: c_float) -> c_float;
+        pub fn erff(n: c_float) -> c_float;
+        pub fn erfcf(n: c_float) -> c_float;
+        pub fn expm1f(n: c_float) -> c_float;
+        pub fn fdimf(a: c_float, b: c_float) -> c_float;
+        pub fn frexpf(n: c_float, value: &mut c_int) -> c_float;
+        pub fn fmaxf(a: c_float, b: c_float) -> c_float;
+        pub fn fminf(a: c_float, b: c_float) -> c_float;
+        pub fn nextafterf(x: c_float, y: c_float) -> c_float;
+        pub fn hypotf(x: c_float, y: c_float) -> c_float;
+        pub fn ldexpf(x: c_float, n: c_int) -> c_float;
+        pub fn logbf(n: c_float) -> c_float;
+        pub fn log1pf(n: c_float) -> c_float;
+        pub fn ilogbf(n: c_float) -> c_int;
+        pub fn modff(n: c_float, iptr: &mut c_float) -> c_float;
+        pub fn sinhf(n: c_float) -> c_float;
+        pub fn tanf(n: c_float) -> c_float;
+        pub fn tanhf(n: c_float) -> c_float;
+        pub fn tgammaf(n: c_float) -> c_float;
+
+        #[cfg(unix)]
+        pub fn lgammaf_r(n: c_float, sign: &mut c_int) -> c_float;
+
+        #[cfg(windows)]
+        #[link_name="__lgammaf_r"]
+        pub fn lgammaf_r(n: c_float, sign: &mut c_int) -> c_float;
+    }
+}
 
 // FIXME(#11621): These constants should be deprecated once CTFE is implemented
 // in favour of calling their respective functions in `Bounded` and `Float`.
@@ -242,12 +213,12 @@ impl Neg<f32> for f32 {
 impl Signed for f32 {
     /// Computes the absolute value. Returns `NAN` if the number is `NAN`.
     #[inline]
-    fn abs(&self) -> f32 { abs(*self) }
+    fn abs(&self) -> f32 { unsafe{intrinsics::fabsf32(*self)} }
 
     /// The positive difference of two numbers. Returns `0.0` if the number is less than or
     /// equal to `other`, otherwise the difference between`self` and `other` is returned.
     #[inline]
-    fn abs_sub(&self, other: &f32) -> f32 { abs_sub(*self, *other) }
+    fn abs_sub(&self, other: &f32) -> f32 { unsafe{cmath::fdimf(*self, *other)} }
 
     /// # Returns
     ///
@@ -256,7 +227,7 @@ impl Signed for f32 {
     /// - `NAN` if the number is NaN
     #[inline]
     fn signum(&self) -> f32 {
-        if self.is_nan() { NAN } else { copysign(1.0, *self) }
+        if self.is_nan() { NAN } else { unsafe{intrinsics::copysignf32(1.0, *self)} }
     }
 
     /// Returns `true` if the number is positive, including `+0.0` and `INFINITY`
@@ -271,19 +242,19 @@ impl Signed for f32 {
 impl Round for f32 {
     /// Round half-way cases toward `NEG_INFINITY`
     #[inline]
-    fn floor(&self) -> f32 { floor(*self) }
+    fn floor(&self) -> f32 { unsafe{intrinsics::floorf32(*self)} }
 
     /// Round half-way cases toward `INFINITY`
     #[inline]
-    fn ceil(&self) -> f32 { ceil(*self) }
+    fn ceil(&self) -> f32 { unsafe{intrinsics::ceilf32(*self)} }
 
     /// Round half-way cases away from `0.0`
     #[inline]
-    fn round(&self) -> f32 { round(*self) }
+    fn round(&self) -> f32 { unsafe{intrinsics::roundf32(*self)} }
 
     /// The integer part of the number (rounds towards `0.0`)
     #[inline]
-    fn trunc(&self) -> f32 { trunc(*self) }
+    fn trunc(&self) -> f32 { unsafe{intrinsics::truncf32(*self)} }
 
     /// The fractional part of the number, satisfying:
     ///
@@ -306,14 +277,16 @@ impl Bounded for f32 {
 impl Primitive for f32 {}
 
 impl Float for f32 {
+    fn powi(&self, n: i32) -> f32 { unsafe{intrinsics::powif32(*self, n)} }
+
     #[inline]
     fn max(self, other: f32) -> f32 {
-        unsafe { cmath::c_float::fmax(self, other) }
+        unsafe { cmath::fmaxf(self, other) }
     }
 
     #[inline]
     fn min(self, other: f32) -> f32 {
-        unsafe { cmath::c_float::fmin(self, other) }
+        unsafe { cmath::fminf(self, other) }
     }
 
     #[inline]
@@ -389,9 +362,7 @@ impl Float for f32 {
 
     /// Constructs a floating point number by multiplying `x` by 2 raised to the power of `exp`
     #[inline]
-    fn ldexp(x: f32, exp: int) -> f32 {
-        ldexp(x, exp as c_int)
-    }
+    fn ldexp(x: f32, exp: int) -> f32 { unsafe{cmath::ldexpf(x, exp as c_int)} }
 
     /// Breaks the number into a normalized fraction and a base-2 exponent, satisfying:
     ///
@@ -399,34 +370,32 @@ impl Float for f32 {
     /// - `0.5 <= abs(x) < 1.0`
     #[inline]
     fn frexp(&self) -> (f32, int) {
-        let mut exp = 0;
-        let x = frexp(*self, &mut exp);
-        (x, exp as int)
+        unsafe {
+            let mut exp = 0;
+            let x = cmath::frexpf(*self, &mut exp);
+            (x, exp as int)
+        }
     }
 
     /// Returns the exponential of the number, minus `1`, in a way that is accurate
     /// even if the number is close to zero
     #[inline]
-    fn exp_m1(&self) -> f32 { exp_m1(*self) }
+    fn exp_m1(&self) -> f32 { unsafe{cmath::expm1f(*self)} }
 
     /// Returns the natural logarithm of the number plus `1` (`ln(1+n)`) more accurately
     /// than if the operations were performed separately
     #[inline]
-    fn ln_1p(&self) -> f32 { ln_1p(*self) }
+    fn ln_1p(&self) -> f32 { unsafe{cmath::log1pf(*self)} }
 
     /// Fused multiply-add. Computes `(self * a) + b` with only one rounding error. This
     /// produces a more accurate result with better performance than a separate multiplication
     /// operation followed by an add.
     #[inline]
-    fn mul_add(&self, a: f32, b: f32) -> f32 {
-        mul_add(*self, a, b)
-    }
+    fn mul_add(&self, a: f32, b: f32) -> f32 { unsafe{intrinsics::fmaf32(*self, a, b)} }
 
     /// Returns the next representable floating-point value in the direction of `other`
     #[inline]
-    fn next_after(&self, other: f32) -> f32 {
-        next_after(*self, other)
-    }
+    fn next_after(&self, other: f32) -> f32 { unsafe{cmath::nextafterf(*self, other)} }
 
     /// Returns the mantissa, exponent and sign as integers.
     fn integer_decode(&self) -> (u64, i16, i8) {
@@ -518,40 +487,40 @@ impl Float for f32 {
     fn recip(&self) -> f32 { 1.0 / *self }
 
     #[inline]
-    fn powf(&self, n: &f32) -> f32 { pow(*self, *n) }
+    fn powf(&self, n: &f32) -> f32 { unsafe{intrinsics::powf32(*self, *n)} }
 
     #[inline]
-    fn sqrt(&self) -> f32 { sqrt(*self) }
+    fn sqrt(&self) -> f32 { unsafe{intrinsics::sqrtf32(*self)} }
 
     #[inline]
     fn rsqrt(&self) -> f32 { self.sqrt().recip() }
 
     #[inline]
-    fn cbrt(&self) -> f32 { cbrt(*self) }
+    fn cbrt(&self) -> f32 { unsafe{cmath::cbrtf(*self)} }
 
     #[inline]
-    fn hypot(&self, other: &f32) -> f32 { hypot(*self, *other) }
+    fn hypot(&self, other: &f32) -> f32 { unsafe{cmath::hypotf(*self, *other)} }
 
     #[inline]
-    fn sin(&self) -> f32 { sin(*self) }
+    fn sin(&self) -> f32 { unsafe{intrinsics::sinf32(*self)} }
 
     #[inline]
-    fn cos(&self) -> f32 { cos(*self) }
+    fn cos(&self) -> f32 { unsafe{intrinsics::cosf32(*self)} }
 
     #[inline]
-    fn tan(&self) -> f32 { tan(*self) }
+    fn tan(&self) -> f32 { unsafe{cmath::tanf(*self)} }
 
     #[inline]
-    fn asin(&self) -> f32 { asin(*self) }
+    fn asin(&self) -> f32 { unsafe{cmath::asinf(*self)} }
 
     #[inline]
-    fn acos(&self) -> f32 { acos(*self) }
+    fn acos(&self) -> f32 { unsafe{cmath::acosf(*self)} }
 
     #[inline]
-    fn atan(&self) -> f32 { atan(*self) }
+    fn atan(&self) -> f32 { unsafe{cmath::atanf(*self)} }
 
     #[inline]
-    fn atan2(&self, other: &f32) -> f32 { atan2(*self, *other) }
+    fn atan2(&self, other: &f32) -> f32 { unsafe{cmath::atan2f(*self, *other)} }
 
     /// Simultaneously computes the sine and cosine of the number
     #[inline]
@@ -561,15 +530,15 @@ impl Float for f32 {
 
     /// Returns the exponential of the number
     #[inline]
-    fn exp(&self) -> f32 { exp(*self) }
+    fn exp(&self) -> f32 { unsafe{intrinsics::expf32(*self)} }
 
     /// Returns 2 raised to the power of the number
     #[inline]
-    fn exp2(&self) -> f32 { exp2(*self) }
+    fn exp2(&self) -> f32 { unsafe{intrinsics::exp2f32(*self)} }
 
     /// Returns the natural logarithm of the number
     #[inline]
-    fn ln(&self) -> f32 { ln(*self) }
+    fn ln(&self) -> f32 { unsafe{intrinsics::logf32(*self)} }
 
     /// Returns the logarithm of the number with respect to an arbitrary base
     #[inline]
@@ -577,20 +546,20 @@ impl Float for f32 {
 
     /// Returns the base 2 logarithm of the number
     #[inline]
-    fn log2(&self) -> f32 { log2(*self) }
+    fn log2(&self) -> f32 { unsafe{intrinsics::log2f32(*self)} }
 
     /// Returns the base 10 logarithm of the number
     #[inline]
-    fn log10(&self) -> f32 { log10(*self) }
+    fn log10(&self) -> f32 { unsafe{intrinsics::log10f32(*self)} }
 
     #[inline]
-    fn sinh(&self) -> f32 { sinh(*self) }
+    fn sinh(&self) -> f32 { unsafe{cmath::sinhf(*self)} }
 
     #[inline]
-    fn cosh(&self) -> f32 { cosh(*self) }
+    fn cosh(&self) -> f32 { unsafe{cmath::coshf(*self)} }
 
     #[inline]
-    fn tanh(&self) -> f32 { tanh(*self) }
+    fn tanh(&self) -> f32 { unsafe{cmath::tanhf(*self)} }
 
     /// Inverse hyperbolic sine
     ///
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index fc8c5f47073..69328a5ecdc 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -10,86 +10,66 @@
 
 //! Operations and constants for 64-bits floats (`f64` type)
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use prelude::*;
 
-use cmath;
 use default::Default;
 use from_str::FromStr;
-use libc::{c_double, c_int};
+use libc::{c_int};
 use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
 use num::{Zero, One, Bounded, strconv};
 use num;
 use intrinsics;
 
-macro_rules! delegate(
-    (
-        $(
-            fn $name:ident(
-                $(
-                    $arg:ident : $arg_ty:ty
-                ),*
-            ) -> $rv:ty = $bound_name:path
-        ),*
-    ) => (
-        $(
-            #[inline]
-            pub fn $name($( $arg : $arg_ty ),*) -> $rv {
-                unsafe {
-                    $bound_name($( $arg ),*)
-                }
-            }
-        )*
-    )
-)
-
-delegate!(
-    // intrinsics
-    fn sqrt(n: f64) -> f64 = intrinsics::sqrtf64,
-    fn powi(n: f64, e: i32) -> f64 = intrinsics::powif64,
-    fn sin(n: f64) -> f64 = intrinsics::sinf64,
-    fn cos(n: f64) -> f64 = intrinsics::cosf64,
-    fn pow(n: f64, e: f64) -> f64 = intrinsics::powf64,
-    fn exp(n: f64) -> f64 = intrinsics::expf64,
-    fn exp2(n: f64) -> f64 = intrinsics::exp2f64,
-    fn ln(n: f64) -> f64 = intrinsics::logf64,
-    fn log10(n: f64) -> f64 = intrinsics::log10f64,
-    fn log2(n: f64) -> f64 = intrinsics::log2f64,
-    fn mul_add(a: f64, b: f64, c: f64) -> f64 = intrinsics::fmaf64,
-    fn abs(n: f64) -> f64 = intrinsics::fabsf64,
-    fn copysign(x: f64, y: f64) -> f64 = intrinsics::copysignf64,
-    fn floor(x: f64) -> f64 = intrinsics::floorf64,
-    fn ceil(n: f64) -> f64 = intrinsics::ceilf64,
-    fn trunc(n: f64) -> f64 = intrinsics::truncf64,
-    fn rint(n: f64) -> f64 = intrinsics::rintf64,
-    fn nearbyint(n: f64) -> f64 = intrinsics::nearbyintf64,
-    fn round(n: f64) -> f64 = intrinsics::roundf64,
-
-    // cmath
-    fn acos(n: c_double) -> c_double = cmath::c_double::acos,
-    fn asin(n: c_double) -> c_double = cmath::c_double::asin,
-    fn atan(n: c_double) -> c_double = cmath::c_double::atan,
-    fn atan2(a: c_double, b: c_double) -> c_double = cmath::c_double::atan2,
-    fn cbrt(n: c_double) -> c_double = cmath::c_double::cbrt,
-    fn cosh(n: c_double) -> c_double = cmath::c_double::cosh,
-    // fn erf(n: c_double) -> c_double = cmath::c_double::erf,
-    // fn erfc(n: c_double) -> c_double = cmath::c_double::erfc,
-    fn exp_m1(n: c_double) -> c_double = cmath::c_double::exp_m1,
-    fn abs_sub(a: c_double, b: c_double) -> c_double = cmath::c_double::abs_sub,
-    fn next_after(x: c_double, y: c_double) -> c_double = cmath::c_double::next_after,
-    fn frexp(n: c_double, value: &mut c_int) -> c_double = cmath::c_double::frexp,
-    fn hypot(x: c_double, y: c_double) -> c_double = cmath::c_double::hypot,
-    fn ldexp(x: c_double, n: c_int) -> c_double = cmath::c_double::ldexp,
-    // fn log_radix(n: c_double) -> c_double = cmath::c_double::log_radix,
-    fn ln_1p(n: c_double) -> c_double = cmath::c_double::ln_1p,
-    // fn ilog_radix(n: c_double) -> c_int = cmath::c_double::ilog_radix,
-    // fn modf(n: c_double, iptr: &mut c_double) -> c_double = cmath::c_double::modf,
-    // fn ldexp_radix(n: c_double, i: c_int) -> c_double = cmath::c_double::ldexp_radix,
-    fn sinh(n: c_double) -> c_double = cmath::c_double::sinh,
-    fn tan(n: c_double) -> c_double = cmath::c_double::tan,
-    fn tanh(n: c_double) -> c_double = cmath::c_double::tanh
-)
+#[allow(dead_code)]
+mod cmath {
+    use libc::{c_double, c_int};
+
+    #[link_name = "m"]
+    extern {
+        pub fn acos(n: c_double) -> c_double;
+        pub fn asin(n: c_double) -> c_double;
+        pub fn atan(n: c_double) -> c_double;
+        pub fn atan2(a: c_double, b: c_double) -> c_double;
+        pub fn cbrt(n: c_double) -> c_double;
+        pub fn cosh(n: c_double) -> c_double;
+        pub fn erf(n: c_double) -> c_double;
+        pub fn erfc(n: c_double) -> c_double;
+        pub fn expm1(n: c_double) -> c_double;
+        pub fn fdim(a: c_double, b: c_double) -> c_double;
+        pub fn fmax(a: c_double, b: c_double) -> c_double;
+        pub fn fmin(a: c_double, b: c_double) -> c_double;
+        pub fn nextafter(x: c_double, y: c_double) -> c_double;
+        pub fn frexp(n: c_double, value: &mut c_int) -> c_double;
+        pub fn hypot(x: c_double, y: c_double) -> c_double;
+        pub fn ldexp(x: c_double, n: c_int) -> c_double;
+        pub fn logb(n: c_double) -> c_double;
+        pub fn log1p(n: c_double) -> c_double;
+        pub fn ilogb(n: c_double) -> c_int;
+        pub fn modf(n: c_double, iptr: &mut c_double) -> c_double;
+        pub fn sinh(n: c_double) -> c_double;
+        pub fn tan(n: c_double) -> c_double;
+        pub fn tanh(n: c_double) -> c_double;
+        pub fn tgamma(n: c_double) -> c_double;
+
+        // These are commonly only available for doubles
+
+        pub fn j0(n: c_double) -> c_double;
+        pub fn j1(n: c_double) -> c_double;
+        pub fn jn(i: c_int, n: c_double) -> c_double;
+
+        pub fn y0(n: c_double) -> c_double;
+        pub fn y1(n: c_double) -> c_double;
+        pub fn yn(i: c_int, n: c_double) -> c_double;
+
+        #[cfg(unix)]
+        pub fn lgamma_r(n: c_double, sign: &mut c_int) -> c_double;
+        #[cfg(windows)]
+        #[link_name="__lgamma_r"]
+        pub fn lgamma_r(n: c_double, sign: &mut c_int) -> c_double;
+    }
+}
 
 // FIXME (#1433): obtain these in a different way
 
@@ -241,12 +221,12 @@ impl Neg<f64> for f64 {
 impl Signed for f64 {
     /// Computes the absolute value. Returns `NAN` if the number is `NAN`.
     #[inline]
-    fn abs(&self) -> f64 { abs(*self) }
+    fn abs(&self) -> f64 { unsafe{intrinsics::fabsf64(*self)} }
 
     /// The positive difference of two numbers. Returns `0.0` if the number is less than or
     /// equal to `other`, otherwise the difference between`self` and `other` is returned.
     #[inline]
-    fn abs_sub(&self, other: &f64) -> f64 { abs_sub(*self, *other) }
+    fn abs_sub(&self, other: &f64) -> f64 { unsafe{cmath::fdim(*self, *other)} }
 
     /// # Returns
     ///
@@ -255,7 +235,7 @@ impl Signed for f64 {
     /// - `NAN` if the number is NaN
     #[inline]
     fn signum(&self) -> f64 {
-        if self.is_nan() { NAN } else { copysign(1.0, *self) }
+        if self.is_nan() { NAN } else { unsafe{intrinsics::copysignf64(1.0, *self)} }
     }
 
     /// Returns `true` if the number is positive, including `+0.0` and `INFINITY`
@@ -270,19 +250,19 @@ impl Signed for f64 {
 impl Round for f64 {
     /// Round half-way cases toward `NEG_INFINITY`
     #[inline]
-    fn floor(&self) -> f64 { floor(*self) }
+    fn floor(&self) -> f64 { unsafe{intrinsics::floorf64(*self)} }
 
     /// Round half-way cases toward `INFINITY`
     #[inline]
-    fn ceil(&self) -> f64 { ceil(*self) }
+    fn ceil(&self) -> f64 { unsafe{intrinsics::ceilf64(*self)} }
 
     /// Round half-way cases away from `0.0`
     #[inline]
-    fn round(&self) -> f64 { round(*self) }
+    fn round(&self) -> f64 { unsafe{intrinsics::roundf64(*self)} }
 
     /// The integer part of the number (rounds towards `0.0`)
     #[inline]
-    fn trunc(&self) -> f64 { trunc(*self) }
+    fn trunc(&self) -> f64 { unsafe{intrinsics::truncf64(*self)} }
 
     /// The fractional part of the number, satisfying:
     ///
@@ -307,12 +287,12 @@ impl Primitive for f64 {}
 impl Float for f64 {
     #[inline]
     fn max(self, other: f64) -> f64 {
-        unsafe { cmath::c_double::fmax(self, other) }
+        unsafe { cmath::fmax(self, other) }
     }
 
     #[inline]
     fn min(self, other: f64) -> f64 {
-        unsafe { cmath::c_double::fmin(self, other) }
+        unsafe { cmath::fmin(self, other) }
     }
 
     #[inline]
@@ -388,9 +368,7 @@ impl Float for f64 {
 
     /// Constructs a floating point number by multiplying `x` by 2 raised to the power of `exp`
     #[inline]
-    fn ldexp(x: f64, exp: int) -> f64 {
-        ldexp(x, exp as c_int)
-    }
+    fn ldexp(x: f64, exp: int) -> f64 { unsafe{cmath::ldexp(x, exp as c_int)} }
 
     /// Breaks the number into a normalized fraction and a base-2 exponent, satisfying:
     ///
@@ -398,34 +376,32 @@ impl Float for f64 {
     /// - `0.5 <= abs(x) < 1.0`
     #[inline]
     fn frexp(&self) -> (f64, int) {
-        let mut exp = 0;
-        let x = frexp(*self, &mut exp);
-        (x, exp as int)
+        unsafe {
+            let mut exp = 0;
+            let x = cmath::frexp(*self, &mut exp);
+            (x, exp as int)
+        }
     }
 
     /// Returns the exponential of the number, minus `1`, in a way that is accurate
     /// even if the number is close to zero
     #[inline]
-    fn exp_m1(&self) -> f64 { exp_m1(*self) }
+    fn exp_m1(&self) -> f64 { unsafe{cmath::expm1(*self)} }
 
     /// Returns the natural logarithm of the number plus `1` (`ln(1+n)`) more accurately
     /// than if the operations were performed separately
     #[inline]
-    fn ln_1p(&self) -> f64 { ln_1p(*self) }
+    fn ln_1p(&self) -> f64 { unsafe{cmath::log1p(*self)} }
 
     /// Fused multiply-add. Computes `(self * a) + b` with only one rounding error. This
     /// produces a more accurate result with better performance than a separate multiplication
     /// operation followed by an add.
     #[inline]
-    fn mul_add(&self, a: f64, b: f64) -> f64 {
-        mul_add(*self, a, b)
-    }
+    fn mul_add(&self, a: f64, b: f64) -> f64 { unsafe{intrinsics::fmaf64(*self, a, b)} }
 
     /// Returns the next representable floating-point value in the direction of `other`
     #[inline]
-    fn next_after(&self, other: f64) -> f64 {
-        next_after(*self, other)
-    }
+    fn next_after(&self, other: f64) -> f64 { unsafe{cmath::nextafter(*self, other)} }
 
     /// Returns the mantissa, exponent and sign as integers.
     fn integer_decode(&self) -> (u64, i16, i8) {
@@ -517,40 +493,43 @@ impl Float for f64 {
     fn recip(&self) -> f64 { 1.0 / *self }
 
     #[inline]
-    fn powf(&self, n: &f64) -> f64 { pow(*self, *n) }
+    fn powf(&self, n: &f64) -> f64 { unsafe{intrinsics::powf64(*self, *n)} }
+
+    #[inline]
+    fn powi(&self, n: i32) -> f64 { unsafe{intrinsics::powif64(*self, n)} }
 
     #[inline]
-    fn sqrt(&self) -> f64 { sqrt(*self) }
+    fn sqrt(&self) -> f64 { unsafe{intrinsics::sqrtf64(*self)} }
 
     #[inline]
     fn rsqrt(&self) -> f64 { self.sqrt().recip() }
 
     #[inline]
-    fn cbrt(&self) -> f64 { cbrt(*self) }
+    fn cbrt(&self) -> f64 { unsafe{cmath::cbrt(*self)} }
 
     #[inline]
-    fn hypot(&self, other: &f64) -> f64 { hypot(*self, *other) }
+    fn hypot(&self, other: &f64) -> f64 { unsafe{cmath::hypot(*self, *other)} }
 
     #[inline]
-    fn sin(&self) -> f64 { sin(*self) }
+    fn sin(&self) -> f64 { unsafe{intrinsics::sinf64(*self)} }
 
     #[inline]
-    fn cos(&self) -> f64 { cos(*self) }
+    fn cos(&self) -> f64 { unsafe{intrinsics::cosf64(*self)} }
 
     #[inline]
-    fn tan(&self) -> f64 { tan(*self) }
+    fn tan(&self) -> f64 { unsafe{cmath::tan(*self)} }
 
     #[inline]
-    fn asin(&self) -> f64 { asin(*self) }
+    fn asin(&self) -> f64 { unsafe{cmath::asin(*self)} }
 
     #[inline]
-    fn acos(&self) -> f64 { acos(*self) }
+    fn acos(&self) -> f64 { unsafe{cmath::acos(*self)} }
 
     #[inline]
-    fn atan(&self) -> f64 { atan(*self) }
+    fn atan(&self) -> f64 { unsafe{cmath::atan(*self)} }
 
     #[inline]
-    fn atan2(&self, other: &f64) -> f64 { atan2(*self, *other) }
+    fn atan2(&self, other: &f64) -> f64 { unsafe{cmath::atan2(*self, *other)} }
 
     /// Simultaneously computes the sine and cosine of the number
     #[inline]
@@ -560,15 +539,15 @@ impl Float for f64 {
 
     /// Returns the exponential of the number
     #[inline]
-    fn exp(&self) -> f64 { exp(*self) }
+    fn exp(&self) -> f64 { unsafe{intrinsics::expf64(*self)} }
 
     /// Returns 2 raised to the power of the number
     #[inline]
-    fn exp2(&self) -> f64 { exp2(*self) }
+    fn exp2(&self) -> f64 { unsafe{intrinsics::exp2f64(*self)} }
 
     /// Returns the natural logarithm of the number
     #[inline]
-    fn ln(&self) -> f64 { ln(*self) }
+    fn ln(&self) -> f64 { unsafe{intrinsics::logf64(*self)} }
 
     /// Returns the logarithm of the number with respect to an arbitrary base
     #[inline]
@@ -576,20 +555,20 @@ impl Float for f64 {
 
     /// Returns the base 2 logarithm of the number
     #[inline]
-    fn log2(&self) -> f64 { log2(*self) }
+    fn log2(&self) -> f64 { unsafe{intrinsics::log2f64(*self)} }
 
     /// Returns the base 10 logarithm of the number
     #[inline]
-    fn log10(&self) -> f64 { log10(*self) }
+    fn log10(&self) -> f64 { unsafe{intrinsics::log10f64(*self)} }
 
     #[inline]
-    fn sinh(&self) -> f64 { sinh(*self) }
+    fn sinh(&self) -> f64 { unsafe{cmath::sinh(*self)} }
 
     #[inline]
-    fn cosh(&self) -> f64 { cosh(*self) }
+    fn cosh(&self) -> f64 { unsafe{cmath::cosh(*self)} }
 
     #[inline]
-    fn tanh(&self) -> f64 { tanh(*self) }
+    fn tanh(&self) -> f64 { unsafe{cmath::tanh(*self)} }
 
     /// Inverse hyperbolic sine
     ///
diff --git a/src/libstd/num/float_macros.rs b/src/libstd/num/float_macros.rs
index 7c93602af11..3e403219a4f 100644
--- a/src/libstd/num/float_macros.rs
+++ b/src/libstd/num/float_macros.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[macro_escape];
-#[doc(hidden)];
+#![macro_escape]
+#![doc(hidden)]
 
 macro_rules! assert_approx_eq(
     ($a:expr, $b:expr) => ({
diff --git a/src/libstd/num/i16.rs b/src/libstd/num/i16.rs
index 0ecb55e5106..42710a8b459 100644
--- a/src/libstd/num/i16.rs
+++ b/src/libstd/num/i16.rs
@@ -10,7 +10,7 @@
 
 //! Operations and constants for signed 16-bits integers (`i16` type)
 
-#[allow(non_uppercase_statics)];
+#![allow(non_uppercase_statics)]
 
 use prelude::*;
 
diff --git a/src/libstd/num/i32.rs b/src/libstd/num/i32.rs
index 0526f2c488b..69d4b0639f7 100644
--- a/src/libstd/num/i32.rs
+++ b/src/libstd/num/i32.rs
@@ -10,7 +10,7 @@
 
 //! Operations and constants for signed 32-bits integers (`i32` type)
 
-#[allow(non_uppercase_statics)];
+#![allow(non_uppercase_statics)]
 
 use prelude::*;
 
diff --git a/src/libstd/num/i64.rs b/src/libstd/num/i64.rs
index 0c1c01dbf4a..1f7066c25db 100644
--- a/src/libstd/num/i64.rs
+++ b/src/libstd/num/i64.rs
@@ -10,7 +10,7 @@
 
 //! Operations and constants for signed 64-bits integers (`i64` type)
 
-#[allow(non_uppercase_statics)];
+#![allow(non_uppercase_statics)]
 
 use prelude::*;
 
diff --git a/src/libstd/num/i8.rs b/src/libstd/num/i8.rs
index 881cc46201e..061ffddf231 100644
--- a/src/libstd/num/i8.rs
+++ b/src/libstd/num/i8.rs
@@ -10,7 +10,7 @@
 
 //! Operations and constants for signed 8-bits integers (`i8` type)
 
-#[allow(non_uppercase_statics)];
+#![allow(non_uppercase_statics)]
 
 use prelude::*;
 
diff --git a/src/libstd/num/int.rs b/src/libstd/num/int.rs
index 83c9e8ea855..66b204ee8bd 100644
--- a/src/libstd/num/int.rs
+++ b/src/libstd/num/int.rs
@@ -10,7 +10,7 @@
 
 //! Operations and constants for architecture-sized signed integers (`int` type)
 
-#[allow(non_uppercase_statics)];
+#![allow(non_uppercase_statics)]
 
 use prelude::*;
 
diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs
index ea62a3ec374..1d2c38f22bb 100644
--- a/src/libstd/num/int_macros.rs
+++ b/src/libstd/num/int_macros.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[macro_escape];
-#[doc(hidden)];
+#![macro_escape]
+#![doc(hidden)]
 
 macro_rules! int_module (($T:ty, $bits:expr) => (
 
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index 202e26e2c93..9d0b53f945f 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -13,11 +13,11 @@
 //! These are implemented for the primitive numeric types in `std::{u8, u16,
 //! u32, u64, uint, i8, i16, i32, i64, int, f32, f64, float}`.
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use clone::Clone;
 use cmp::{Eq, Ord};
-use kinds::Pod;
+use kinds::Copy;
 use mem::size_of;
 use ops::{Add, Sub, Mul, Div, Rem, Neg};
 use ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr};
@@ -276,7 +276,7 @@ pub trait Bitwise: Bounded
 /// Specifies the available operations common to all of Rust's core numeric primitives.
 /// These may not always make sense from a purely mathematical point of view, but
 /// may be useful for systems programming.
-pub trait Primitive: Pod
+pub trait Primitive: Copy
                    + Clone
                    + Num
                    + NumCast
@@ -486,6 +486,11 @@ pub trait Float: Signed + Round + Primitive {
     /// Raise a number to a power.
     fn powf(&self, n: &Self) -> Self;
 
+    /// Raise a number to an integer power.
+    ///
+    /// Using this function is generally faster than using `powf`
+    fn powi(&self, n: i32) -> Self;
+
     /// Take the square root of a number.
     fn sqrt(&self) -> Self;
     /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
@@ -553,79 +558,6 @@ pub trait Float: Signed + Round + Primitive {
     fn to_radians(&self) -> Self;
 }
 
-/// Returns the exponential of the number, minus `1`, `exp(n) - 1`, in a way
-/// that is accurate even if the number is close to zero.
-#[inline(always)] pub fn exp_m1<T: Float>(value: T) -> T { value.exp_m1() }
-/// Returns the natural logarithm of the number plus `1`, `ln(n + 1)`, more
-/// accurately than if the operations were performed separately.
-#[inline(always)] pub fn ln_1p<T: Float>(value: T) -> T { value.ln_1p() }
-/// Fused multiply-add. Computes `(a * b) + c` with only one rounding error.
-///
-/// This produces a more accurate result with better performance (on some
-/// architectures) than a separate multiplication operation followed by an add.
-#[inline(always)] pub fn mul_add<T: Float>(a: T, b: T, c: T) -> T { a.mul_add(b, c) }
-
-/// Raise a number to a power.
-///
-/// # Example
-///
-/// ```rust
-/// use std::num;
-///
-/// let sixteen: f64 = num::powf(2.0, 4.0);
-/// assert_eq!(sixteen, 16.0);
-/// ```
-#[inline(always)] pub fn powf<T: Float>(value: T, n: T) -> T { value.powf(&n) }
-/// Take the square root of a number.
-#[inline(always)] pub fn sqrt<T: Float>(value: T) -> T { value.sqrt() }
-/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
-#[inline(always)] pub fn rsqrt<T: Float>(value: T) -> T { value.rsqrt() }
-/// Take the cubic root of a number.
-#[inline(always)] pub fn cbrt<T: Float>(value: T) -> T { value.cbrt() }
-/// Calculate the length of the hypotenuse of a right-angle triangle given legs
-/// of length `x` and `y`.
-#[inline(always)] pub fn hypot<T: Float>(x: T, y: T) -> T { x.hypot(&y) }
-/// Sine function.
-#[inline(always)] pub fn sin<T: Float>(value: T) -> T { value.sin() }
-/// Cosine function.
-#[inline(always)] pub fn cos<T: Float>(value: T) -> T { value.cos() }
-/// Tangent function.
-#[inline(always)] pub fn tan<T: Float>(value: T) -> T { value.tan() }
-/// Compute the arcsine of the number.
-#[inline(always)] pub fn asin<T: Float>(value: T) -> T { value.asin() }
-/// Compute the arccosine of the number.
-#[inline(always)] pub fn acos<T: Float>(value: T) -> T { value.acos() }
-/// Compute the arctangent of the number.
-#[inline(always)] pub fn atan<T: Float>(value: T) -> T { value.atan() }
-/// Compute the arctangent with 2 arguments.
-#[inline(always)] pub fn atan2<T: Float>(x: T, y: T) -> T { x.atan2(&y) }
-/// Simultaneously computes the sine and cosine of the number.
-#[inline(always)] pub fn sin_cos<T: Float>(value: T) -> (T, T) { value.sin_cos() }
-/// Returns `e^(value)`, (the exponential function).
-#[inline(always)] pub fn exp<T: Float>(value: T) -> T { value.exp() }
-/// Returns 2 raised to the power of the number, `2^(value)`.
-#[inline(always)] pub fn exp2<T: Float>(value: T) -> T { value.exp2() }
-/// Returns the natural logarithm of the number.
-#[inline(always)] pub fn ln<T: Float>(value: T) -> T { value.ln() }
-/// Returns the logarithm of the number with respect to an arbitrary base.
-#[inline(always)] pub fn log<T: Float>(value: T, base: T) -> T { value.log(&base) }
-/// Returns the base 2 logarithm of the number.
-#[inline(always)] pub fn log2<T: Float>(value: T) -> T { value.log2() }
-/// Returns the base 10 logarithm of the number.
-#[inline(always)] pub fn log10<T: Float>(value: T) -> T { value.log10() }
-/// Hyperbolic sine function.
-#[inline(always)] pub fn sinh<T: Float>(value: T) -> T { value.sinh() }
-/// Hyperbolic cosine function.
-#[inline(always)] pub fn cosh<T: Float>(value: T) -> T { value.cosh() }
-/// Hyperbolic tangent function.
-#[inline(always)] pub fn tanh<T: Float>(value: T) -> T { value.tanh() }
-/// Inverse hyperbolic sine function.
-#[inline(always)] pub fn asinh<T: Float>(value: T) -> T { value.asinh() }
-/// Inverse hyperbolic cosine function.
-#[inline(always)] pub fn acosh<T: Float>(value: T) -> T { value.acosh() }
-/// Inverse hyperbolic tangent function.
-#[inline(always)] pub fn atanh<T: Float>(value: T) -> T { value.atanh() }
-
 /// A generic trait for converting a value to a number.
 pub trait ToPrimitive {
     /// Converts the value of `self` to an `int`.
@@ -1728,7 +1660,7 @@ mod tests {
     macro_rules! test_next_power_of_two(
         ($test_name:ident, $T:ident) => (
             fn $test_name() {
-                #[test];
+                #![test]
                 assert_eq!(next_power_of_two::<$T>(0), 0);
                 let mut next_power = 1;
                 for i in range::<$T>(1, 40) {
@@ -1748,7 +1680,7 @@ mod tests {
     macro_rules! test_checked_next_power_of_two(
         ($test_name:ident, $T:ident) => (
             fn $test_name() {
-                #[test];
+                #![test]
                 assert_eq!(checked_next_power_of_two::<$T>(0), None);
                 let mut next_power = 1;
                 for i in range::<$T>(1, 40) {
diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs
index 9f9a9ec8e2e..b15b5872fc2 100644
--- a/src/libstd/num/strconv.rs
+++ b/src/libstd/num/strconv.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use clone::Clone;
 use container::Container;
@@ -411,23 +411,23 @@ pub fn float_to_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Float+Round+
                     // If reached left end of number, have to
                     // insert additional digit:
                     if i < 0
-                    || buf[i] == '-' as u8
-                    || buf[i] == '+' as u8 {
+                    || buf[i as uint] == '-' as u8
+                    || buf[i as uint] == '+' as u8 {
                         buf.insert((i + 1) as uint, value2ascii(1));
                         break;
                     }
 
                     // Skip the '.'
-                    if buf[i] == '.' as u8 { i -= 1; continue; }
+                    if buf[i as uint] == '.' as u8 { i -= 1; continue; }
 
                     // Either increment the digit,
                     // or set to 0 if max and carry the 1.
-                    let current_digit = ascii2value(buf[i]);
+                    let current_digit = ascii2value(buf[i as uint]);
                     if current_digit < (radix - 1) {
-                        buf[i] = value2ascii(current_digit+1);
+                        buf[i as uint] = value2ascii(current_digit+1);
                         break;
                     } else {
-                        buf[i] = value2ascii(0);
+                        buf[i as uint] = value2ascii(0);
                         i -= 1;
                     }
                 }
@@ -821,31 +821,31 @@ mod bench {
 
         #[bench]
         fn to_str_bin(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { rng.gen::<uint>().to_str_radix(2); })
         }
 
         #[bench]
         fn to_str_oct(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { rng.gen::<uint>().to_str_radix(8); })
         }
 
         #[bench]
         fn to_str_dec(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { rng.gen::<uint>().to_str_radix(10); })
         }
 
         #[bench]
         fn to_str_hex(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { rng.gen::<uint>().to_str_radix(16); })
         }
 
         #[bench]
         fn to_str_base_36(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { rng.gen::<uint>().to_str_radix(36); })
         }
     }
@@ -857,31 +857,31 @@ mod bench {
 
         #[bench]
         fn to_str_bin(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { rng.gen::<int>().to_str_radix(2); })
         }
 
         #[bench]
         fn to_str_oct(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { rng.gen::<int>().to_str_radix(8); })
         }
 
         #[bench]
         fn to_str_dec(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { rng.gen::<int>().to_str_radix(10); })
         }
 
         #[bench]
         fn to_str_hex(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { rng.gen::<int>().to_str_radix(16); })
         }
 
         #[bench]
         fn to_str_base_36(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { rng.gen::<int>().to_str_radix(36); })
         }
     }
@@ -893,7 +893,7 @@ mod bench {
 
         #[bench]
         fn float_to_str(bh: &mut BenchHarness) {
-            let mut rng = XorShiftRng::new();
+            let mut rng = XorShiftRng::new().unwrap();
             bh.iter(|| { f64::to_str(rng.gen()); })
         }
     }
diff --git a/src/libstd/num/u16.rs b/src/libstd/num/u16.rs
index d1de1ff0a72..ca473e9517e 100644
--- a/src/libstd/num/u16.rs
+++ b/src/libstd/num/u16.rs
@@ -10,7 +10,7 @@
 
 //! Operations and constants for unsigned 16-bits integers (`u16` type)
 
-#[allow(non_uppercase_statics)];
+#![allow(non_uppercase_statics)]
 
 use prelude::*;
 
diff --git a/src/libstd/num/u32.rs b/src/libstd/num/u32.rs
index 1caec678025..2a0b9aac667 100644
--- a/src/libstd/num/u32.rs
+++ b/src/libstd/num/u32.rs
@@ -10,7 +10,7 @@
 
 //! Operations and constants for unsigned 32-bits integers (`u32` type)
 
-#[allow(non_uppercase_statics)];
+#![allow(non_uppercase_statics)]
 
 use prelude::*;
 
diff --git a/src/libstd/num/u64.rs b/src/libstd/num/u64.rs
index ab495834eaa..2cfc5da95e8 100644
--- a/src/libstd/num/u64.rs
+++ b/src/libstd/num/u64.rs
@@ -10,7 +10,7 @@
 
 //! Operations and constants for unsigned 64-bits integer (`u64` type)
 
-#[allow(non_uppercase_statics)];
+#![allow(non_uppercase_statics)]
 
 use prelude::*;
 
diff --git a/src/libstd/num/u8.rs b/src/libstd/num/u8.rs
index a0ef574f6cf..30ed13a5952 100644
--- a/src/libstd/num/u8.rs
+++ b/src/libstd/num/u8.rs
@@ -10,7 +10,7 @@
 
 //! Operations and constants for unsigned 8-bits integers (`u8` type)
 
-#[allow(non_uppercase_statics)];
+#![allow(non_uppercase_statics)]
 
 use prelude::*;
 
diff --git a/src/libstd/num/uint.rs b/src/libstd/num/uint.rs
index 95d4a3a50be..6751fdb5d25 100644
--- a/src/libstd/num/uint.rs
+++ b/src/libstd/num/uint.rs
@@ -10,7 +10,7 @@
 
 //! Operations and constants for architecture-sized unsigned integers (`uint` type)
 
-#[allow(non_uppercase_statics)];
+#![allow(non_uppercase_statics)]
 
 use prelude::*;
 
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index 719afeb7878..ece30e72e06 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[macro_escape];
-#[doc(hidden)];
+#![macro_escape]
+#![doc(hidden)]
 
 macro_rules! uint_module (($T:ty, $T_SIGNED:ty, $bits:expr) => (
 
diff --git a/src/libstd/option.rs b/src/libstd/option.rs
index 14dc42195e1..ca1ea0169e6 100644
--- a/src/libstd/option.rs
+++ b/src/libstd/option.rs
@@ -535,7 +535,7 @@ impl<T> Default for Option<T> {
 /// methods on `Option`.
 #[deriving(Clone)]
 pub struct Item<A> {
-    priv opt: Option<A>
+    opt: Option<A>
 }
 
 impl<A> Iterator<A> for Item<A> {
@@ -593,7 +593,7 @@ pub fn collect<T, Iter: Iterator<Option<T>>, V: FromIterator<T>>(iter: Iter) ->
         }
     });
 
-    let v: V = FromIterator::from_iterator(iter.by_ref());
+    let v: V = FromIterator::from_iter(iter.by_ref());
 
     if iter.state {
         None
@@ -651,7 +651,8 @@ mod tests {
         impl ::ops::Drop for R {
            fn drop(&mut self) {
                 let ii = &*self.i;
-                ii.set(ii.get() + 1);
+                let i = ii.borrow().clone();
+                *ii.borrow_mut() = i + 1;
             }
         }
 
@@ -667,7 +668,7 @@ mod tests {
             let opt = Some(x);
             let _y = opt.unwrap();
         }
-        assert_eq!(i.get(), 1);
+        assert_eq!(*i.borrow(), 1);
     }
 
     #[test]
@@ -684,7 +685,7 @@ mod tests {
 
     #[test] #[should_fail]
     fn test_option_too_much_dance() {
-        let mut y = Some(marker::NoPod);
+        let mut y = Some(marker::NoCopy);
         let _y2 = y.take_unwrap();
         let _y3 = y.take_unwrap();
     }
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index eeebede6c58..a5583afb31d 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -26,7 +26,7 @@
  * to write OS-ignorant code by default.
  */
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 #[cfg(target_os = "macos")]
 #[cfg(windows)]
@@ -370,10 +370,10 @@ pub fn unsetenv(n: &str) {
 pub struct Pipe {
     /// A file descriptor representing the reading end of the pipe. Data written
     /// on the `out` file descriptor can be read from this file descriptor.
-    input: c_int,
+    pub input: c_int,
     /// A file descriptor representing the write end of the pipe. Data written
     /// to this file descriptor can be read from the `input` file descriptor.
-    out: c_int,
+    pub out: c_int,
 }
 
 /// Creates a new low-level OS in-memory pipe.
@@ -663,10 +663,12 @@ pub fn errno() -> uint {
     }
 }
 
-/// Get a string representing the platform-dependent last error
-pub fn last_os_error() -> ~str {
+/// Return the string corresponding to an `errno()` value of `errnum`.
+pub fn error_string(errnum: uint) -> ~str {
+    return strerror(errnum);
+
     #[cfg(unix)]
-    fn strerror() -> ~str {
+    fn strerror(errnum: uint) -> ~str {
         #[cfg(target_os = "macos")]
         #[cfg(target_os = "android")]
         #[cfg(target_os = "freebsd")]
@@ -702,7 +704,7 @@ pub fn last_os_error() -> ~str {
 
         let p = buf.as_mut_ptr();
         unsafe {
-            if strerror_r(errno() as c_int, p, buf.len() as libc::size_t) < 0 {
+            if strerror_r(errnum as c_int, p, buf.len() as libc::size_t) < 0 {
                 fail!("strerror_r failure");
             }
 
@@ -711,7 +713,7 @@ pub fn last_os_error() -> ~str {
     }
 
     #[cfg(windows)]
-    fn strerror() -> ~str {
+    fn strerror(errnum: uint) -> ~str {
         use libc::types::os::arch::extra::DWORD;
         use libc::types::os::arch::extra::LPWSTR;
         use libc::types::os::arch::extra::LPVOID;
@@ -735,7 +737,6 @@ pub fn last_os_error() -> ~str {
         // This value is calculated from the macro
         // MAKELANGID(LANG_SYSTEM_DEFAULT, SUBLANG_SYS_DEFAULT)
         let langId = 0x0800 as DWORD;
-        let err = errno() as DWORD;
 
         let mut buf = [0 as WCHAR, ..TMPBUF_SZ];
 
@@ -743,7 +744,7 @@ pub fn last_os_error() -> ~str {
             let res = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
                                      FORMAT_MESSAGE_IGNORE_INSERTS,
                                      ptr::mut_null(),
-                                     err,
+                                     errnum as DWORD,
                                      langId,
                                      buf.as_mut_ptr(),
                                      buf.len() as DWORD,
@@ -751,18 +752,21 @@ pub fn last_os_error() -> ~str {
             if res == 0 {
                 // Sometimes FormatMessageW can fail e.g. system doesn't like langId,
                 let fm_err = errno();
-                return format!("OS Error {} (FormatMessageW() returned error {})", err, fm_err);
+                return format!("OS Error {} (FormatMessageW() returned error {})", errnum, fm_err);
             }
 
             let msg = str::from_utf16(str::truncate_utf16_at_nul(buf));
             match msg {
-                Some(msg) => format!("OS Error {}: {}", err, msg),
-                None => format!("OS Error {} (FormatMessageW() returned invalid UTF-16)", err),
+                Some(msg) => format!("OS Error {}: {}", errnum, msg),
+                None => format!("OS Error {} (FormatMessageW() returned invalid UTF-16)", errnum),
             }
         }
     }
+}
 
-    strerror()
+/// Get a string representing the platform-dependent last error
+pub fn last_os_error() -> ~str {
+    error_string(errno() as uint)
 }
 
 static mut EXIT_STATUS: AtomicInt = INIT_ATOMIC_INT;
@@ -946,11 +950,11 @@ pub fn page_size() -> uint {
 /// let it leave scope by accident if you want it to stick around.
 pub struct MemoryMap {
     /// Pointer to the memory created or modified by this map.
-    data: *mut u8,
+    pub data: *mut u8,
     /// Number of bytes this map applies to
-    len: uint,
+    pub len: uint,
     /// Type of mapping
-    kind: MemoryMapKind
+    pub kind: MemoryMapKind,
 }
 
 /// Type of memory map
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs
index c8465eb039f..a0097469e56 100644
--- a/src/libstd/path/mod.rs
+++ b/src/libstd/path/mod.rs
@@ -488,8 +488,8 @@ pub trait GenericPathUnsafe {
 
 /// Helper struct for printing paths with format!()
 pub struct Display<'a, P> {
-    priv path: &'a P,
-    priv filename: bool
+    path: &'a P,
+    filename: bool
 }
 
 impl<'a, P: GenericPath> fmt::Show for Display<'a, P> {
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs
index cb4c830f380..098b3edb69d 100644
--- a/src/libstd/path/posix.rs
+++ b/src/libstd/path/posix.rs
@@ -40,8 +40,8 @@ pub type RevStrComponents<'a> = Map<'a, &'a [u8], Option<&'a str>,
 /// Represents a POSIX file path
 #[deriving(Clone)]
 pub struct Path {
-    priv repr: ~[u8], // assumed to never be empty or contain NULs
-    priv sepidx: Option<uint> // index of the final separator in repr
+    repr: ~[u8], // assumed to never be empty or contain NULs
+    sepidx: Option<uint> // index of the final separator in repr
 }
 
 /// The standard path separator character
diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs
index d488997b0c2..ca9b351210d 100644
--- a/src/libstd/path/windows.rs
+++ b/src/libstd/path/windows.rs
@@ -81,9 +81,9 @@ pub type RevComponents<'a> = Map<'a, Option<&'a str>, &'a [u8],
 // preserved by the data structure; let the Windows API error out on them.
 #[deriving(Clone)]
 pub struct Path {
-    priv repr: ~str, // assumed to never be empty
-    priv prefix: Option<PathPrefix>,
-    priv sepidx: Option<uint> // index of the final separator in the non-prefix portion of repr
+    repr: ~str, // assumed to never be empty
+    prefix: Option<PathPrefix>,
+    sepidx: Option<uint> // index of the final separator in the non-prefix portion of repr
 }
 
 impl Eq for Path {
@@ -637,7 +637,7 @@ impl Path {
     /// See str_components() for details.
     pub fn components<'a>(&'a self) -> Components<'a> {
         fn convert<'a>(x: Option<&'a str>) -> &'a [u8] {
-            #[inline];
+            #![inline]
             x.unwrap().as_bytes()
         }
         self.str_components().map(convert)
@@ -647,7 +647,7 @@ impl Path {
     /// See str_components() for details.
     pub fn rev_components<'a>(&'a self) -> RevComponents<'a> {
         fn convert<'a>(x: Option<&'a str>) -> &'a [u8] {
-            #[inline];
+            #![inline]
             x.unwrap().as_bytes()
         }
         self.rev_str_components().map(convert)
diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs
index a42ee80b53a..0a4b32f5a89 100644
--- a/src/libstd/prelude.rs
+++ b/src/libstd/prelude.rs
@@ -20,7 +20,7 @@ generally useful to many Rust programs.
 */
 
 // Reexported core operators
-pub use kinds::{Pod, Send, Sized, Share};
+pub use kinds::{Copy, Send, Sized, Share};
 pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not};
 pub use ops::{BitAnd, BitOr, BitXor};
 pub use ops::{Drop, Deref, DerefMut};
diff --git a/src/libstd/raw.rs b/src/libstd/raw.rs
index 94ad268f512..b285b42ee5e 100644
--- a/src/libstd/raw.rs
+++ b/src/libstd/raw.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 //! Contains struct definitions for the layout of compiler built-in types.
 //!
@@ -21,18 +21,18 @@ use cast;
 
 /// The representation of a Rust managed box
 pub struct Box<T> {
-    ref_count: uint,
-    drop_glue: fn(ptr: *mut u8),
-    prev: *mut Box<T>,
-    next: *mut Box<T>,
-    data: T
+    pub ref_count: uint,
+    pub drop_glue: fn(ptr: *mut u8),
+    pub prev: *mut Box<T>,
+    pub next: *mut Box<T>,
+    pub data: T,
 }
 
 /// The representation of a Rust vector
 pub struct Vec<T> {
-    fill: uint,
-    alloc: uint,
-    data: T
+    pub fill: uint,
+    pub alloc: uint,
+    pub data: T,
 }
 
 /// The representation of a Rust string
@@ -40,20 +40,20 @@ pub type String = Vec<u8>;
 
 /// The representation of a Rust slice
 pub struct Slice<T> {
-    data: *T,
-    len: uint
+    pub data: *T,
+    pub len: uint,
 }
 
 /// The representation of a Rust closure
 pub struct Closure {
-    code: *(),
-    env: *(),
+    pub code: *(),
+    pub env: *(),
 }
 
 /// The representation of a Rust procedure (`proc()`)
 pub struct Procedure {
-    code: *(),
-    env: *(),
+    pub code: *(),
+    pub env: *(),
 }
 
 /// The representation of a Rust trait object.
@@ -61,8 +61,8 @@ pub struct Procedure {
 /// This struct does not have a `Repr` implementation
 /// because there is no way to refer to all trait objects generically.
 pub struct TraitObject {
-    vtable: *(),
-    data: *(),
+    pub vtable: *(),
+    pub data: *(),
 }
 
 /// This trait is meant to map equivalences between raw structs and their
diff --git a/src/libstd/rc.rs b/src/libstd/rc.rs
index d26038f508f..ff6e494b948 100644
--- a/src/libstd/rc.rs
+++ b/src/libstd/rc.rs
@@ -43,9 +43,9 @@ struct RcBox<T> {
 /// Immutable reference counted pointer type
 #[unsafe_no_drop_flag]
 pub struct Rc<T> {
-    priv ptr: *mut RcBox<T>,
-    priv nosend: marker::NoSend,
-    priv noshare: marker::NoShare
+    ptr: *mut RcBox<T>,
+    nosend: marker::NoSend,
+    noshare: marker::NoShare
 }
 
 impl<T> Rc<T> {
@@ -151,9 +151,9 @@ impl<T: TotalOrd> TotalOrd for Rc<T> {
 /// Weak reference to a reference-counted box
 #[unsafe_no_drop_flag]
 pub struct Weak<T> {
-    priv ptr: *mut RcBox<T>,
-    priv nosend: marker::NoSend,
-    priv noshare: marker::NoShare
+    ptr: *mut RcBox<T>,
+    nosend: marker::NoSend,
+    noshare: marker::NoShare
 }
 
 impl<T> Weak<T> {
diff --git a/src/libstd/reflect.rs b/src/libstd/reflect.rs
index a9e70bd3c63..997b65c2e1f 100644
--- a/src/libstd/reflect.rs
+++ b/src/libstd/reflect.rs
@@ -14,7 +14,7 @@ Runtime type reflection
 
 */
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use intrinsics::{Disr, Opaque, TyDesc, TyVisitor};
 use mem;
@@ -40,7 +40,7 @@ pub fn align(size: uint, align: uint) -> uint {
 
 /// Adaptor to wrap around visitors implementing MovePtr.
 pub struct MovePtrAdaptor<V> {
-    priv inner: V
+    inner: V
 }
 pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
     MovePtrAdaptor { inner: v }
diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs
index f623dd472fd..9d1d406e803 100644
--- a/src/libstd/repr.rs
+++ b/src/libstd/repr.rs
@@ -14,7 +14,7 @@ More runtime type reflection
 
 */
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use cast::transmute;
 use char;
@@ -101,11 +101,11 @@ enum VariantState {
 }
 
 pub struct ReprVisitor<'a> {
-    priv ptr: *u8,
-    priv ptr_stk: ~[*u8],
-    priv var_stk: ~[VariantState],
-    priv writer: &'a mut io::Writer,
-    priv last_err: Option<io::IoError>,
+    ptr: *u8,
+    ptr_stk: ~[*u8],
+    var_stk: ~[VariantState],
+    writer: &'a mut io::Writer,
+    last_err: Option<io::IoError>,
 }
 
 pub fn ReprVisitor<'a>(ptr: *u8,
@@ -686,7 +686,7 @@ fn test_repr() {
     exact_test(&println, "fn(&str)");
     exact_test(&swap::<int>, "fn(&mut int, &mut int)");
     exact_test(&is_alphabetic, "fn(char) -> bool");
-    exact_test(&(~5 as ~ToStr), "~to_str::ToStr:Send");
+    exact_test(&(~5 as ~ToStr), "~to_str::ToStr<no-bounds>");
 
     struct Foo;
     exact_test(&(~[Foo, Foo]), "~[repr::test_repr::Foo, repr::test_repr::Foo]");
diff --git a/src/libstd/result.rs b/src/libstd/result.rs
index df1c4ae60ba..fa16b6f6eeb 100644
--- a/src/libstd/result.rs
+++ b/src/libstd/result.rs
@@ -230,7 +230,7 @@ pub fn collect<T, E, Iter: Iterator<Result<T, E>>, V: FromIterator<T>>(iter: Ite
         }
     });
 
-    let v: V = FromIterator::from_iterator(iter.by_ref());
+    let v: V = FromIterator::from_iter(iter.by_ref());
 
     match iter.state {
         Some(err) => Err(err),
diff --git a/src/libstd/rt/at_exit_imp.rs b/src/libstd/rt/at_exit_imp.rs
index 96dcc5244c0..a5bfaf190d9 100644
--- a/src/libstd/rt/at_exit_imp.rs
+++ b/src/libstd/rt/at_exit_imp.rs
@@ -14,13 +14,14 @@
 
 use cast;
 use iter::Iterator;
+use kinds::Send;
 use mem;
 use option::{Some, None};
 use ptr::RawPtr;
 use unstable::sync::Exclusive;
 use slice::OwnedVector;
 
-type Queue = Exclusive<~[proc()]>;
+type Queue = Exclusive<~[proc:Send()]>;
 
 // You'll note that these variables are *not* atomic, and this is done on
 // purpose. This module is designed to have init() called *once* in a
@@ -39,7 +40,7 @@ pub fn init() {
     }
 }
 
-pub fn push(f: proc()) {
+pub fn push(f: proc:Send()) {
     unsafe {
         rtassert!(!RUNNING);
         rtassert!(!QUEUE.is_null());
diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs
index 7ae2521c423..96f95622b92 100644
--- a/src/libstd/rt/backtrace.rs
+++ b/src/libstd/rt/backtrace.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use char::Char;
 use container::Container;
diff --git a/src/libstd/rt/bookkeeping.rs b/src/libstd/rt/bookkeeping.rs
index 932cd7af033..9e772d8ad23 100644
--- a/src/libstd/rt/bookkeeping.rs
+++ b/src/libstd/rt/bookkeeping.rs
@@ -18,8 +18,8 @@
 //! each respective runtime to make sure that they call increment() and
 //! decrement() manually.
 
-#[experimental]; // this is a massive code smell
-#[doc(hidden)];
+#![experimental] // this is a massive code smell
+#![doc(hidden)]
 
 use sync::atomics;
 use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
diff --git a/src/libstd/rt/global_heap.rs b/src/libstd/rt/global_heap.rs
index 23b23cf8af0..5c1b6cd4791 100644
--- a/src/libstd/rt/global_heap.rs
+++ b/src/libstd/rt/global_heap.rs
@@ -68,8 +68,17 @@ pub unsafe fn realloc_raw(ptr: *mut u8, size: uint) -> *mut u8 {
 #[cfg(not(test))]
 #[lang="exchange_malloc"]
 #[inline]
-pub unsafe fn exchange_malloc(size: uint) -> *u8 {
-    malloc_raw(size) as *u8
+pub unsafe fn exchange_malloc(size: uint) -> *mut u8 {
+    // The compiler never calls `exchange_free` on ~ZeroSizeType, so zero-size
+    // allocations can point to this `static`. It would be incorrect to use a null
+    // pointer, due to enums assuming types like unique pointers are never null.
+    static EMPTY: () = ();
+
+    if size == 0 {
+        &EMPTY as *() as *mut u8
+    } else {
+        malloc_raw(size)
+    }
 }
 
 // FIXME: #7496
diff --git a/src/libstd/rt/libunwind.rs b/src/libstd/rt/libunwind.rs
index fabfa2c8a7a..4fd610d7423 100644
--- a/src/libstd/rt/libunwind.rs
+++ b/src/libstd/rt/libunwind.rs
@@ -10,15 +10,14 @@
 
 //! Unwind library interface
 
-#[allow(non_camel_case_types)];
-#[allow(dead_code)]; // these are just bindings
+#![allow(non_camel_case_types)]
+#![allow(dead_code)] // these are just bindings
 
 use libc;
 
 #[cfg(not(target_arch = "arm"))]
 #[repr(C)]
-pub enum _Unwind_Action
-{
+pub enum _Unwind_Action {
     _UA_SEARCH_PHASE = 1,
     _UA_CLEANUP_PHASE = 2,
     _UA_HANDLER_FRAME = 4,
@@ -28,14 +27,13 @@ pub enum _Unwind_Action
 
 #[cfg(target_arch = "arm")]
 #[repr(C)]
-pub enum _Unwind_State
-{
-  _US_VIRTUAL_UNWIND_FRAME = 0,
-  _US_UNWIND_FRAME_STARTING = 1,
-  _US_UNWIND_FRAME_RESUME = 2,
-  _US_ACTION_MASK = 3,
-  _US_FORCE_UNWIND = 8,
-  _US_END_OF_STACK = 16
+pub enum _Unwind_State {
+    _US_VIRTUAL_UNWIND_FRAME = 0,
+    _US_UNWIND_FRAME_STARTING = 1,
+    _US_UNWIND_FRAME_RESUME = 2,
+    _US_ACTION_MASK = 3,
+    _US_FORCE_UNWIND = 8,
+    _US_END_OF_STACK = 16
 }
 
 #[repr(C)]
@@ -69,9 +67,9 @@ pub static unwinder_private_data_size: int = 20;
 pub static unwinder_private_data_size: int = 2;
 
 pub struct _Unwind_Exception {
-    exception_class: _Unwind_Exception_Class,
-    exception_cleanup: _Unwind_Exception_Cleanup_Fn,
-    private: [_Unwind_Word, ..unwinder_private_data_size],
+    pub exception_class: _Unwind_Exception_Class,
+    pub exception_cleanup: _Unwind_Exception_Cleanup_Fn,
+    pub private: [_Unwind_Word, ..unwinder_private_data_size],
 }
 
 pub enum _Unwind_Context {}
diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs
index 1b643e8dab2..163e69f9686 100644
--- a/src/libstd/rt/local_heap.rs
+++ b/src/libstd/rt/local_heap.rs
@@ -33,14 +33,14 @@ static MAGIC: u32 = 0xbadc0ffe;
 pub type Box = raw::Box<()>;
 
 pub struct MemoryRegion {
-    priv allocations: Vec<*AllocHeader>,
-    priv live_allocations: uint,
+    allocations: Vec<*AllocHeader>,
+    live_allocations: uint,
 }
 
 pub struct LocalHeap {
-    priv memory_region: MemoryRegion,
+    memory_region: MemoryRegion,
 
-    priv live_allocs: *mut raw::Box<()>,
+    live_allocs: *mut raw::Box<()>,
 }
 
 impl LocalHeap {
diff --git a/src/libstd/rt/local_ptr.rs b/src/libstd/rt/local_ptr.rs
index 898004c665d..e486932ac3c 100644
--- a/src/libstd/rt/local_ptr.rs
+++ b/src/libstd/rt/local_ptr.rs
@@ -15,7 +15,7 @@
 //! XXX: Add runtime checks for usage of inconsistent pointer types.
 //! and for overwriting an existing pointer.
 
-#[allow(dead_code)];
+#![allow(dead_code)]
 
 use cast;
 use ops::Drop;
@@ -31,7 +31,7 @@ pub use self::compiled::*;
 /// Encapsulates a borrowed value. When this value goes out of scope, the
 /// pointer is returned.
 pub struct Borrowed<T> {
-    priv val: *(),
+    val: *(),
 }
 
 #[unsafe_destructor]
diff --git a/src/libstd/rt/macros.rs b/src/libstd/rt/macros.rs
index 3ef57710344..74675c85b96 100644
--- a/src/libstd/rt/macros.rs
+++ b/src/libstd/rt/macros.rs
@@ -13,7 +13,7 @@
 //! These macros call functions which are only accessible in the `rt` module, so
 //! they aren't defined anywhere outside of the `rt` module.
 
-#[macro_escape];
+#![macro_escape]
 
 macro_rules! rterrln (
     ($($arg:tt)*) => ( {
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index 795281026a4..5e2f8efd2e3 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -52,9 +52,10 @@ Several modules in `core` are clients of `rt`:
 */
 
 // FIXME: this should not be here.
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use any::Any;
+use kinds::Send;
 use option::Option;
 use result::Result;
 use task::TaskOpts;
@@ -156,7 +157,7 @@ pub trait Runtime {
 
     // Miscellaneous calls which are very different depending on what context
     // you're in.
-    fn spawn_sibling(~self, cur_task: ~Task, opts: TaskOpts, f: proc());
+    fn spawn_sibling(~self, cur_task: ~Task, opts: TaskOpts, f: proc:Send());
     fn local_io<'a>(&'a mut self) -> Option<rtio::LocalIo<'a>>;
     /// The (low, high) edges of the current stack.
     fn stack_bounds(&self) -> (uint, uint); // (lo, hi)
@@ -195,7 +196,7 @@ pub fn init(argc: int, argv: **u8) {
 ///
 /// It is forbidden for procedures to register more `at_exit` handlers when they
 /// are running, and doing so will lead to a process abort.
-pub fn at_exit(f: proc()) {
+pub fn at_exit(f: proc:Send()) {
     at_exit_imp::push(f);
 }
 
diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs
index 60933aeb38b..54708d19a1b 100644
--- a/src/libstd/rt/rtio.rs
+++ b/src/libstd/rt/rtio.rs
@@ -13,16 +13,17 @@ use cast;
 use comm::{Sender, Receiver};
 use libc::c_int;
 use libc;
+use kinds::Send;
 use ops::Drop;
 use option::{Option, Some, None};
 use path::Path;
-use result::{Result, Err};
-use rt::task::Task;
+use result::Err;
 use rt::local::Local;
+use rt::task::Task;
 
 use ai = io::net::addrinfo;
 use io;
-use io::{IoError, IoResult};
+use io::IoResult;
 use io::net::ip::{IpAddr, SocketAddr};
 use io::process::{ProcessConfig, ProcessExit};
 use io::signal::Signum;
@@ -35,9 +36,10 @@ pub trait Callback {
 
 pub trait EventLoop {
     fn run(&mut self);
-    fn callback(&mut self, proc());
-    fn pausable_idle_callback(&mut self, ~Callback) -> ~PausableIdleCallback;
-    fn remote_callback(&mut self, ~Callback) -> ~RemoteCallback;
+    fn callback(&mut self, arg: proc:Send());
+    fn pausable_idle_callback(&mut self,
+                              ~Callback:Send) -> ~PausableIdleCallback:Send;
+    fn remote_callback(&mut self, ~Callback:Send) -> ~RemoteCallback:Send;
 
     /// The asynchronous I/O services. Not all event loops may provide one.
     fn io<'a>(&'a mut self) -> Option<&'a mut IoFactory>;
@@ -59,11 +61,11 @@ pub trait RemoteCallback {
 /// libuv (it does translation to windows under the hood).
 pub struct FileOpenConfig {
     /// Path to file to be opened
-    path: Path,
+    pub path: Path,
     /// Flags for file access mode (as per open(2))
-    flags: int,
+    pub flags: int,
     /// File creation mode, ignored unless O_CREAT is passed as part of flags
-    priv mode: int
+    pub mode: int
 }
 
 /// Description of what to do when a file handle is closed
@@ -81,7 +83,7 @@ pub enum CloseBehavior {
 }
 
 pub struct LocalIo<'a> {
-    priv factory: &'a mut IoFactory,
+    factory: &'a mut IoFactory,
 }
 
 #[unsafe_destructor]
@@ -143,93 +145,94 @@ impl<'a> LocalIo<'a> {
 
 pub trait IoFactory {
     // networking
-    fn tcp_connect(&mut self, addr: SocketAddr) -> Result<~RtioTcpStream, IoError>;
-    fn tcp_bind(&mut self, addr: SocketAddr) -> Result<~RtioTcpListener, IoError>;
-    fn udp_bind(&mut self, addr: SocketAddr) -> Result<~RtioUdpSocket, IoError>;
-    fn unix_bind(&mut self, path: &CString) ->
-        Result<~RtioUnixListener, IoError>;
-    fn unix_connect(&mut self, path: &CString) -> Result<~RtioPipe, IoError>;
+    fn tcp_connect(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpStream:Send>;
+    fn tcp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpListener:Send>;
+    fn udp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioUdpSocket:Send>;
+    fn unix_bind(&mut self, path: &CString)
+        -> IoResult<~RtioUnixListener:Send>;
+    fn unix_connect(&mut self, path: &CString) -> IoResult<~RtioPipe:Send>;
     fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
-                          hint: Option<ai::Hint>) -> Result<~[ai::Info], IoError>;
+                          hint: Option<ai::Hint>) -> IoResult<~[ai::Info]>;
 
     // filesystem operations
-    fn fs_from_raw_fd(&mut self, fd: c_int, close: CloseBehavior) -> ~RtioFileStream;
+    fn fs_from_raw_fd(&mut self, fd: c_int, close: CloseBehavior)
+        -> ~RtioFileStream:Send;
     fn fs_open(&mut self, path: &CString, fm: FileMode, fa: FileAccess)
-        -> Result<~RtioFileStream, IoError>;
-    fn fs_unlink(&mut self, path: &CString) -> Result<(), IoError>;
-    fn fs_stat(&mut self, path: &CString) -> Result<FileStat, IoError>;
+        -> IoResult<~RtioFileStream:Send>;
+    fn fs_unlink(&mut self, path: &CString) -> IoResult<()>;
+    fn fs_stat(&mut self, path: &CString) -> IoResult<FileStat>;
     fn fs_mkdir(&mut self, path: &CString,
-                mode: FilePermission) -> Result<(), IoError>;
+                mode: FilePermission) -> IoResult<()>;
     fn fs_chmod(&mut self, path: &CString,
-                mode: FilePermission) -> Result<(), IoError>;
-    fn fs_rmdir(&mut self, path: &CString) -> Result<(), IoError>;
-    fn fs_rename(&mut self, path: &CString, to: &CString) -> Result<(), IoError>;
+                mode: FilePermission) -> IoResult<()>;
+    fn fs_rmdir(&mut self, path: &CString) -> IoResult<()>;
+    fn fs_rename(&mut self, path: &CString, to: &CString) -> IoResult<()>;
     fn fs_readdir(&mut self, path: &CString, flags: c_int) ->
-        Result<~[Path], IoError>;
-    fn fs_lstat(&mut self, path: &CString) -> Result<FileStat, IoError>;
+        IoResult<~[Path]>;
+    fn fs_lstat(&mut self, path: &CString) -> IoResult<FileStat>;
     fn fs_chown(&mut self, path: &CString, uid: int, gid: int) ->
-        Result<(), IoError>;
-    fn fs_readlink(&mut self, path: &CString) -> Result<Path, IoError>;
-    fn fs_symlink(&mut self, src: &CString, dst: &CString) -> Result<(), IoError>;
-    fn fs_link(&mut self, src: &CString, dst: &CString) -> Result<(), IoError>;
+        IoResult<()>;
+    fn fs_readlink(&mut self, path: &CString) -> IoResult<Path>;
+    fn fs_symlink(&mut self, src: &CString, dst: &CString) -> IoResult<()>;
+    fn fs_link(&mut self, src: &CString, dst: &CString) -> IoResult<()>;
     fn fs_utime(&mut self, src: &CString, atime: u64, mtime: u64) ->
-        Result<(), IoError>;
+        IoResult<()>;
 
     // misc
-    fn timer_init(&mut self) -> Result<~RtioTimer, IoError>;
+    fn timer_init(&mut self) -> IoResult<~RtioTimer:Send>;
     fn spawn(&mut self, config: ProcessConfig)
-            -> Result<(~RtioProcess, ~[Option<~RtioPipe>]), IoError>;
-    fn kill(&mut self, pid: libc::pid_t, signal: int) -> Result<(), IoError>;
-    fn pipe_open(&mut self, fd: c_int) -> Result<~RtioPipe, IoError>;
+            -> IoResult<(~RtioProcess:Send, ~[Option<~RtioPipe:Send>])>;
+    fn kill(&mut self, pid: libc::pid_t, signal: int) -> IoResult<()>;
+    fn pipe_open(&mut self, fd: c_int) -> IoResult<~RtioPipe:Send>;
     fn tty_open(&mut self, fd: c_int, readable: bool)
-            -> Result<~RtioTTY, IoError>;
+            -> IoResult<~RtioTTY:Send>;
     fn signal(&mut self, signal: Signum, channel: Sender<Signum>)
-        -> Result<~RtioSignal, IoError>;
+        -> IoResult<~RtioSignal:Send>;
 }
 
 pub trait RtioTcpListener : RtioSocket {
-    fn listen(~self) -> Result<~RtioTcpAcceptor, IoError>;
+    fn listen(~self) -> IoResult<~RtioTcpAcceptor:Send>;
 }
 
 pub trait RtioTcpAcceptor : RtioSocket {
-    fn accept(&mut self) -> Result<~RtioTcpStream, IoError>;
-    fn accept_simultaneously(&mut self) -> Result<(), IoError>;
-    fn dont_accept_simultaneously(&mut self) -> Result<(), IoError>;
+    fn accept(&mut self) -> IoResult<~RtioTcpStream:Send>;
+    fn accept_simultaneously(&mut self) -> IoResult<()>;
+    fn dont_accept_simultaneously(&mut self) -> IoResult<()>;
 }
 
 pub trait RtioTcpStream : RtioSocket {
-    fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError>;
-    fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
-    fn peer_name(&mut self) -> Result<SocketAddr, IoError>;
-    fn control_congestion(&mut self) -> Result<(), IoError>;
-    fn nodelay(&mut self) -> Result<(), IoError>;
-    fn keepalive(&mut self, delay_in_seconds: uint) -> Result<(), IoError>;
-    fn letdie(&mut self) -> Result<(), IoError>;
-    fn clone(&self) -> ~RtioTcpStream;
-    fn close_write(&mut self) -> Result<(), IoError>;
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>;
+    fn write(&mut self, buf: &[u8]) -> IoResult<()>;
+    fn peer_name(&mut self) -> IoResult<SocketAddr>;
+    fn control_congestion(&mut self) -> IoResult<()>;
+    fn nodelay(&mut self) -> IoResult<()>;
+    fn keepalive(&mut self, delay_in_seconds: uint) -> IoResult<()>;
+    fn letdie(&mut self) -> IoResult<()>;
+    fn clone(&self) -> ~RtioTcpStream:Send;
+    fn close_write(&mut self) -> IoResult<()>;
 }
 
 pub trait RtioSocket {
-    fn socket_name(&mut self) -> Result<SocketAddr, IoError>;
+    fn socket_name(&mut self) -> IoResult<SocketAddr>;
 }
 
 pub trait RtioUdpSocket : RtioSocket {
-    fn recvfrom(&mut self, buf: &mut [u8]) -> Result<(uint, SocketAddr), IoError>;
-    fn sendto(&mut self, buf: &[u8], dst: SocketAddr) -> Result<(), IoError>;
+    fn recvfrom(&mut self, buf: &mut [u8]) -> IoResult<(uint, SocketAddr)>;
+    fn sendto(&mut self, buf: &[u8], dst: SocketAddr) -> IoResult<()>;
 
-    fn join_multicast(&mut self, multi: IpAddr) -> Result<(), IoError>;
-    fn leave_multicast(&mut self, multi: IpAddr) -> Result<(), IoError>;
+    fn join_multicast(&mut self, multi: IpAddr) -> IoResult<()>;
+    fn leave_multicast(&mut self, multi: IpAddr) -> IoResult<()>;
 
-    fn loop_multicast_locally(&mut self) -> Result<(), IoError>;
-    fn dont_loop_multicast_locally(&mut self) -> Result<(), IoError>;
+    fn loop_multicast_locally(&mut self) -> IoResult<()>;
+    fn dont_loop_multicast_locally(&mut self) -> IoResult<()>;
 
-    fn multicast_time_to_live(&mut self, ttl: int) -> Result<(), IoError>;
-    fn time_to_live(&mut self, ttl: int) -> Result<(), IoError>;
+    fn multicast_time_to_live(&mut self, ttl: int) -> IoResult<()>;
+    fn time_to_live(&mut self, ttl: int) -> IoResult<()>;
 
-    fn hear_broadcasts(&mut self) -> Result<(), IoError>;
-    fn ignore_broadcasts(&mut self) -> Result<(), IoError>;
+    fn hear_broadcasts(&mut self) -> IoResult<()>;
+    fn ignore_broadcasts(&mut self) -> IoResult<()>;
 
-    fn clone(&self) -> ~RtioUdpSocket;
+    fn clone(&self) -> ~RtioUdpSocket:Send;
 }
 
 pub trait RtioTimer {
@@ -239,42 +242,42 @@ pub trait RtioTimer {
 }
 
 pub trait RtioFileStream {
-    fn read(&mut self, buf: &mut [u8]) -> Result<int, IoError>;
-    fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
-    fn pread(&mut self, buf: &mut [u8], offset: u64) -> Result<int, IoError>;
-    fn pwrite(&mut self, buf: &[u8], offset: u64) -> Result<(), IoError>;
-    fn seek(&mut self, pos: i64, whence: SeekStyle) -> Result<u64, IoError>;
-    fn tell(&self) -> Result<u64, IoError>;
-    fn fsync(&mut self) -> Result<(), IoError>;
-    fn datasync(&mut self) -> Result<(), IoError>;
-    fn truncate(&mut self, offset: i64) -> Result<(), IoError>;
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<int>;
+    fn write(&mut self, buf: &[u8]) -> IoResult<()>;
+    fn pread(&mut self, buf: &mut [u8], offset: u64) -> IoResult<int>;
+    fn pwrite(&mut self, buf: &[u8], offset: u64) -> IoResult<()>;
+    fn seek(&mut self, pos: i64, whence: SeekStyle) -> IoResult<u64>;
+    fn tell(&self) -> IoResult<u64>;
+    fn fsync(&mut self) -> IoResult<()>;
+    fn datasync(&mut self) -> IoResult<()>;
+    fn truncate(&mut self, offset: i64) -> IoResult<()>;
 }
 
 pub trait RtioProcess {
     fn id(&self) -> libc::pid_t;
-    fn kill(&mut self, signal: int) -> Result<(), IoError>;
+    fn kill(&mut self, signal: int) -> IoResult<()>;
     fn wait(&mut self) -> ProcessExit;
 }
 
 pub trait RtioPipe {
-    fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError>;
-    fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
-    fn clone(&self) -> ~RtioPipe;
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>;
+    fn write(&mut self, buf: &[u8]) -> IoResult<()>;
+    fn clone(&self) -> ~RtioPipe:Send;
 }
 
 pub trait RtioUnixListener {
-    fn listen(~self) -> Result<~RtioUnixAcceptor, IoError>;
+    fn listen(~self) -> IoResult<~RtioUnixAcceptor:Send>;
 }
 
 pub trait RtioUnixAcceptor {
-    fn accept(&mut self) -> Result<~RtioPipe, IoError>;
+    fn accept(&mut self) -> IoResult<~RtioPipe:Send>;
 }
 
 pub trait RtioTTY {
-    fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError>;
-    fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
-    fn set_raw(&mut self, raw: bool) -> Result<(), IoError>;
-    fn get_winsize(&mut self) -> Result<(int, int), IoError>;
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>;
+    fn write(&mut self, buf: &[u8]) -> IoResult<()>;
+    fn set_raw(&mut self, raw: bool) -> IoResult<()>;
+    fn get_winsize(&mut self) -> IoResult<(int, int)>;
     fn isatty(&self) -> bool;
 }
 
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index ededc69c5a1..fc266df11e4 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -20,6 +20,7 @@ use clone::Clone;
 use comm::Sender;
 use io::Writer;
 use iter::{Iterator, Take};
+use kinds::Send;
 use local_data;
 use ops::Drop;
 use option::{Option, Some, None};
@@ -42,22 +43,22 @@ use unstable::finally::Finally;
 /// in the struct. This contains a pointer to another struct that holds
 /// the type-specific state.
 pub struct Task {
-    heap: LocalHeap,
-    gc: GarbageCollector,
-    storage: LocalStorage,
-    unwinder: Unwinder,
-    death: Death,
-    destroyed: bool,
-    name: Option<SendStr>,
-
-    stdout: Option<~Writer>,
-    stderr: Option<~Writer>,
-
-    priv imp: Option<~Runtime>,
+    pub heap: LocalHeap,
+    pub gc: GarbageCollector,
+    pub storage: LocalStorage,
+    pub unwinder: Unwinder,
+    pub death: Death,
+    pub destroyed: bool,
+    pub name: Option<SendStr>,
+
+    pub stdout: Option<~Writer:Send>,
+    pub stderr: Option<~Writer:Send>,
+
+    imp: Option<~Runtime:Send>,
 }
 
 pub struct GarbageCollector;
-pub struct LocalStorage(Option<local_data::Map>);
+pub struct LocalStorage(pub Option<local_data::Map>);
 
 /// A handle to a blocked task. Usually this means having the ~Task pointer by
 /// ownership, but if the task is killable, a killer can steal it at any time.
@@ -69,18 +70,18 @@ pub enum BlockedTask {
 pub enum DeathAction {
     /// Action to be done with the exit code. If set, also makes the task wait
     /// until all its watched children exit before collecting the status.
-    Execute(proc(TaskResult)),
+    Execute(proc:Send(TaskResult)),
     /// A channel to send the result of the task on when the task exits
     SendMessage(Sender<TaskResult>),
 }
 
 /// Per-task state related to task death, killing, failure, etc.
 pub struct Death {
-    on_exit: Option<DeathAction>,
+    pub on_exit: Option<DeathAction>,
 }
 
 pub struct BlockedTasks {
-    priv inner: UnsafeArc<AtomicUint>,
+    inner: UnsafeArc<AtomicUint>,
 }
 
 impl Task {
@@ -195,7 +196,7 @@ impl Task {
     /// Inserts a runtime object into this task, transferring ownership to the
     /// task. It is illegal to replace a previous runtime object in this task
     /// with this argument.
-    pub fn put_runtime(&mut self, ops: ~Runtime) {
+    pub fn put_runtime(&mut self, ops: ~Runtime:Send) {
         assert!(self.imp.is_none());
         self.imp = Some(ops);
     }
@@ -225,7 +226,7 @@ impl Task {
                 Ok(t) => Some(t),
                 Err(t) => {
                     let (_, obj): (uint, uint) = cast::transmute(t);
-                    let obj: ~Runtime = cast::transmute((vtable, obj));
+                    let obj: ~Runtime:Send = cast::transmute((vtable, obj));
                     self.put_runtime(obj);
                     None
                 }
@@ -235,7 +236,7 @@ impl Task {
 
     /// Spawns a sibling to this task. The newly spawned task is configured with
     /// the `opts` structure and will run `f` as the body of its code.
-    pub fn spawn_sibling(mut ~self, opts: TaskOpts, f: proc()) {
+    pub fn spawn_sibling(mut ~self, opts: TaskOpts, f: proc:Send()) {
         let ops = self.imp.take_unwrap();
         ops.spawn_sibling(self, opts, f)
     }
@@ -434,7 +435,7 @@ mod test {
     #[test]
     fn rng() {
         use rand::{StdRng, Rng};
-        let mut r = StdRng::new();
+        let mut r = StdRng::new().unwrap();
         let _ = r.next_u32();
     }
 
diff --git a/src/libstd/rt/thread.rs b/src/libstd/rt/thread.rs
index 0cbd67557de..c35ffac064c 100644
--- a/src/libstd/rt/thread.rs
+++ b/src/libstd/rt/thread.rs
@@ -14,7 +14,7 @@
 //! These functions operate outside of the rust runtime, creating threads
 //! which are not used for scheduling in any way.
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use cast;
 use kinds::Send;
@@ -28,9 +28,9 @@ type StartFn = extern "C" fn(*libc::c_void) -> imp::rust_thread_return;
 /// This struct represents a native thread's state. This is used to join on an
 /// existing thread created in the join-able state.
 pub struct Thread<T> {
-    priv native: imp::rust_thread,
-    priv joined: bool,
-    priv packet: ~Option<T>,
+    native: imp::rust_thread,
+    joined: bool,
+    packet: ~Option<T>,
 }
 
 static DEFAULT_STACK_SIZE: uint = 1024 * 1024;
@@ -68,13 +68,13 @@ impl Thread<()> {
     /// to finish executing. This means that even if `join` is not explicitly
     /// called, when the `Thread` falls out of scope its destructor will block
     /// waiting for the OS thread.
-    pub fn start<T: Send>(main: proc() -> T) -> Thread<T> {
+    pub fn start<T: Send>(main: proc:Send() -> T) -> Thread<T> {
         Thread::start_stack(DEFAULT_STACK_SIZE, main)
     }
 
     /// Performs the same functionality as `start`, but specifies an explicit
     /// stack size for the new thread.
-    pub fn start_stack<T: Send>(stack: uint, main: proc() -> T) -> Thread<T> {
+    pub fn start_stack<T: Send>(stack: uint, main: proc:Send() -> T) -> Thread<T> {
 
         // We need the address of the packet to fill in to be stable so when
         // `main` fills it in it's still valid, so allocate an extra ~ box to do
@@ -83,7 +83,7 @@ impl Thread<()> {
         let packet2: *mut Option<T> = unsafe {
             *cast::transmute::<&~Option<T>, **mut Option<T>>(&packet)
         };
-        let main: proc() = proc() unsafe { *packet2 = Some(main()); };
+        let main = proc() unsafe { *packet2 = Some(main()); };
         let native = unsafe { imp::create(stack, ~main) };
 
         Thread {
@@ -99,13 +99,13 @@ impl Thread<()> {
     /// This corresponds to creating threads in the 'detached' state on unix
     /// systems. Note that platforms may not keep the main program alive even if
     /// there are detached thread still running around.
-    pub fn spawn(main: proc()) {
+    pub fn spawn(main: proc:Send()) {
         Thread::spawn_stack(DEFAULT_STACK_SIZE, main)
     }
 
     /// Performs the same functionality as `spawn`, but explicitly specifies a
     /// stack size for the new thread.
-    pub fn spawn_stack(stack: uint, main: proc()) {
+    pub fn spawn_stack(stack: uint, main: proc:Send()) {
         unsafe {
             let handle = imp::create(stack, ~main);
             imp::detach(handle);
@@ -146,6 +146,7 @@ impl<T: Send> Drop for Thread<T> {
 mod imp {
     use cast;
     use cmp;
+    use kinds::Send;
     use libc;
     use libc::types::os::arch::extra::{LPSECURITY_ATTRIBUTES, SIZE_T, BOOL,
                                        LPVOID, DWORD, LPDWORD, HANDLE};
@@ -155,7 +156,7 @@ mod imp {
     pub type rust_thread = HANDLE;
     pub type rust_thread_return = DWORD;
 
-    pub unsafe fn create(stack: uint, p: ~proc()) -> rust_thread {
+    pub unsafe fn create(stack: uint, p: ~proc:Send()) -> rust_thread {
         let arg: *mut libc::c_void = cast::transmute(p);
         // FIXME On UNIX, we guard against stack sizes that are too small but
         // that's because pthreads enforces that stacks are at least
@@ -203,6 +204,7 @@ mod imp {
 mod imp {
     use cast;
     use cmp;
+    use kinds::Send;
     use libc::consts::os::posix01::{PTHREAD_CREATE_JOINABLE, PTHREAD_STACK_MIN};
     use libc;
     use mem;
@@ -213,7 +215,7 @@ mod imp {
     pub type rust_thread = libc::pthread_t;
     pub type rust_thread_return = *u8;
 
-    pub unsafe fn create(stack: uint, p: ~proc()) -> rust_thread {
+    pub unsafe fn create(stack: uint, p: ~proc:Send()) -> rust_thread {
         let mut native: libc::pthread_t = mem::uninit();
         let mut attr: libc::pthread_attr_t = mem::uninit();
         assert_eq!(pthread_attr_init(&mut attr), 0);
diff --git a/src/libstd/rt/thread_local_storage.rs b/src/libstd/rt/thread_local_storage.rs
index 40d9523cf3a..2f567e91b4c 100644
--- a/src/libstd/rt/thread_local_storage.rs
+++ b/src/libstd/rt/thread_local_storage.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(dead_code)];
+#![allow(dead_code)]
 
 #[cfg(unix)]
 use libc::c_int;
diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs
index 7f54b8b3320..68d63949ae6 100644
--- a/src/libstd/rt/unwind.rs
+++ b/src/libstd/rt/unwind.rs
@@ -75,8 +75,8 @@ use intrinsics;
 use uw = rt::libunwind;
 
 pub struct Unwinder {
-    priv unwinding: bool,
-    priv cause: Option<~Any>
+    unwinding: bool,
+    cause: Option<~Any:Send>
 }
 
 impl Unwinder {
@@ -126,7 +126,7 @@ impl Unwinder {
         }
     }
 
-    pub fn begin_unwind(&mut self, cause: ~Any) -> ! {
+    pub fn begin_unwind(&mut self, cause: ~Any:Send) -> ! {
         rtdebug!("begin_unwind()");
 
         self.unwinding = true;
@@ -372,7 +372,7 @@ pub fn begin_unwind<M: Any + Send>(msg: M, file: &'static str, line: uint) -> !
 /// Do this split took the LLVM IR line counts of `fn main() { fail!()
 /// }` from ~1900/3700 (-O/no opts) to 180/590.
 #[inline(never)] #[cold] // this is the slow path, please never inline this
-fn begin_unwind_inner(msg: ~Any, file: &'static str, line: uint) -> ! {
+fn begin_unwind_inner(msg: ~Any:Send, file: &'static str, line: uint) -> ! {
     let mut task;
     {
         let msg_s = match msg.as_ref::<&'static str>() {
diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs
index 8788a584f30..f15e3e61ca1 100644
--- a/src/libstd/slice.rs
+++ b/src/libstd/slice.rs
@@ -99,7 +99,7 @@ There are a number of free functions that create or take vectors, for example:
 
 */
 
-#[warn(non_camel_case_types)];
+#![warn(non_camel_case_types)]
 
 use cast;
 use cast::transmute;
@@ -233,10 +233,10 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
 /// An iterator over the slices of a vector separated by elements that
 /// match a predicate function.
 pub struct Splits<'a, T> {
-    priv v: &'a [T],
-    priv n: uint,
-    priv pred: 'a |t: &T| -> bool,
-    priv finished: bool
+    v: &'a [T],
+    n: uint,
+    pred: 'a |t: &T| -> bool,
+    finished: bool
 }
 
 impl<'a, T> Iterator<&'a [T]> for Splits<'a, T> {
@@ -282,10 +282,10 @@ impl<'a, T> Iterator<&'a [T]> for Splits<'a, T> {
 /// An iterator over the slices of a vector separated by elements that
 /// match a predicate function, from back to front.
 pub struct RevSplits<'a, T> {
-    priv v: &'a [T],
-    priv n: uint,
-    priv pred: 'a |t: &T| -> bool,
-    priv finished: bool
+    v: &'a [T],
+    n: uint,
+    pred: 'a |t: &T| -> bool,
+    finished: bool
 }
 
 impl<'a, T> Iterator<&'a [T]> for RevSplits<'a, T> {
@@ -348,16 +348,6 @@ pub fn append_one<T>(lhs: ~[T], x: T) -> ~[T] {
 
 // Functional utilities
 
-/**
- * Apply a function to each element of a vector and return a concatenation
- * of each result vector
- */
-pub fn flat_map<T, U>(v: &[T], f: |t: &T| -> ~[U]) -> ~[U] {
-    let mut result = ~[];
-    for elem in v.iter() { result.push_all_move(f(elem)); }
-    result
-}
-
 #[allow(missing_doc)]
 pub trait VectorVector<T> {
     // FIXME #5898: calling these .concat and .connect conflicts with
@@ -421,9 +411,9 @@ pub fn unzip<T, U, V: Iterator<(T, U)>>(mut iter: V) -> (~[T], ~[U]) {
 /// The last generated swap is always (0, 1), and it returns the
 /// sequence to its initial order.
 pub struct ElementSwaps {
-    priv sdir: ~[SizeDirection],
+    sdir: ~[SizeDirection],
     /// If true, emit the last swap that returns the sequence to initial state
-    priv emit_reset: bool,
+    emit_reset: bool,
 }
 
 impl ElementSwaps {
@@ -496,8 +486,8 @@ impl Iterator<(uint, uint)> for ElementSwaps {
 ///
 /// Generates even and odd permutations alternately.
 pub struct Permutations<T> {
-    priv swaps: ElementSwaps,
-    priv v: ~[T],
+    swaps: ElementSwaps,
+    v: ~[T],
 }
 
 impl<T: Clone> Iterator<~[T]> for Permutations<T> {
@@ -518,8 +508,8 @@ impl<T: Clone> Iterator<~[T]> for Permutations<T> {
 /// a vector.
 #[deriving(Clone)]
 pub struct Windows<'a, T> {
-    priv v: &'a [T],
-    priv size: uint
+    v: &'a [T],
+    size: uint
 }
 
 impl<'a, T> Iterator<&'a [T]> for Windows<'a, T> {
@@ -552,8 +542,8 @@ impl<'a, T> Iterator<&'a [T]> for Windows<'a, T> {
 /// the last slice of the iteration will be the remainder.
 #[deriving(Clone)]
 pub struct Chunks<'a, T> {
-    priv v: &'a [T],
-    priv size: uint
+    v: &'a [T],
+    size: uint
 }
 
 impl<'a, T> Iterator<&'a [T]> for Chunks<'a, T> {
@@ -902,11 +892,7 @@ pub trait ImmutableVector<'a, T> {
     fn initn(&self, n: uint) -> &'a [T];
     /// Returns the last element of a vector, or `None` if it is empty.
     fn last(&self) -> Option<&'a T>;
-    /**
-     * Apply a function to each element of a vector and return a concatenation
-     * of each result vector
-     */
-    fn flat_map<U>(&self, f: |t: &T| -> ~[U]) -> ~[U];
+
     /// Returns a pointer to the element at the given index, without doing
     /// bounds checking.
     unsafe fn unsafe_ref(self, index: uint) -> &'a T;
@@ -935,11 +921,6 @@ pub trait ImmutableVector<'a, T> {
      */
     fn bsearch(&self, f: |&T| -> Ordering) -> Option<uint>;
 
-    /// Deprecated, use iterators where possible
-    /// (`self.iter().map(f)`). Apply a function to each element
-    /// of a vector and return the results.
-    fn map<U>(&self, |t: &T| -> U) -> ~[U];
-
     /**
      * Returns a mutable reference to the first element in this slice
      * and adjusts the slice in place so that it no longer contains
@@ -1095,11 +1076,6 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] {
     }
 
     #[inline]
-    fn flat_map<U>(&self, f: |t: &T| -> ~[U]) -> ~[U] {
-        flat_map(*self, f)
-    }
-
-    #[inline]
     unsafe fn unsafe_ref(self, index: uint) -> &'a T {
         transmute(self.repr().data.offset(index as int))
     }
@@ -1129,10 +1105,6 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] {
         return None;
     }
 
-    fn map<U>(&self, f: |t: &T| -> U) -> ~[U] {
-        self.iter().map(f).collect()
-    }
-
     fn shift_ref(&mut self) -> Option<&'a T> {
         if self.len() == 0 { return None; }
         unsafe {
@@ -2304,12 +2276,12 @@ impl<'a,T> MutableVector<'a, T> for &'a mut [T] {
                 MutItems{ptr: p,
                          end: (p as uint + self.len()) as *mut T,
                          marker: marker::ContravariantLifetime::<'a>,
-                         marker2: marker::NoPod}
+                         marker2: marker::NoCopy}
             } else {
                 MutItems{ptr: p,
                          end: p.offset(self.len() as int),
                          marker: marker::ContravariantLifetime::<'a>,
-                         marker2: marker::NoPod}
+                         marker2: marker::NoCopy}
             }
         }
     }
@@ -2660,17 +2632,17 @@ impl<A> Default for ~[A] {
 
 /// Immutable slice iterator
 pub struct Items<'a, T> {
-    priv ptr: *T,
-    priv end: *T,
-    priv marker: marker::ContravariantLifetime<'a>
+    ptr: *T,
+    end: *T,
+    marker: marker::ContravariantLifetime<'a>
 }
 
 /// Mutable slice iterator
 pub struct MutItems<'a, T> {
-    priv ptr: *mut T,
-    priv end: *mut T,
-    priv marker: marker::ContravariantLifetime<'a>,
-    priv marker2: marker::NoPod
+    ptr: *mut T,
+    end: *mut T,
+    marker: marker::ContravariantLifetime<'a>,
+    marker2: marker::NoCopy
 }
 
 macro_rules! iterator {
@@ -2763,9 +2735,9 @@ pub type RevMutItems<'a, T> = Rev<MutItems<'a, T>>;
 /// An iterator over the subslices of the vector which are separated
 /// by elements that match `pred`.
 pub struct MutSplits<'a, T> {
-    priv v: &'a mut [T],
-    priv pred: 'a |t: &T| -> bool,
-    priv finished: bool
+    v: &'a mut [T],
+    pred: 'a |t: &T| -> bool,
+    finished: bool
 }
 
 impl<'a, T> Iterator<&'a mut [T]> for MutSplits<'a, T> {
@@ -2828,8 +2800,8 @@ impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutSplits<'a, T> {
 /// the vector len is not evenly divided by the chunk size, the last slice of the iteration will be
 /// the remainder.
 pub struct MutChunks<'a, T> {
-    priv v: &'a mut [T],
-    priv chunk_size: uint
+    v: &'a mut [T],
+    chunk_size: uint
 }
 
 impl<'a, T> Iterator<&'a mut [T]> for MutChunks<'a, T> {
@@ -2877,8 +2849,8 @@ impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutChunks<'a, T> {
 
 /// An iterator that moves out of a vector.
 pub struct MoveItems<T> {
-    priv allocation: *mut u8, // the block of memory allocated for the vector
-    priv iter: Items<'static, T>
+    allocation: *mut u8, // the block of memory allocated for the vector
+    iter: Items<'static, T>
 }
 
 impl<T> Iterator<T> for MoveItems<T> {
@@ -2919,7 +2891,7 @@ impl<T> Drop for MoveItems<T> {
 pub type RevMoveItems<T> = Rev<MoveItems<T>>;
 
 impl<A> FromIterator<A> for ~[A] {
-    fn from_iterator<T: Iterator<A>>(mut iterator: T) -> ~[A] {
+    fn from_iter<T: Iterator<A>>(mut iterator: T) -> ~[A] {
         let (lower, _) = iterator.size_hint();
         let mut xs = with_capacity(lower);
         for x in iterator {
@@ -2950,8 +2922,6 @@ mod tests {
 
     fn square(n: uint) -> uint { n * n }
 
-    fn square_ref(n: &uint) -> uint { square(*n) }
-
     fn is_odd(n: &uint) -> bool { *n % 2u == 1u }
 
     #[test]
@@ -3330,27 +3300,6 @@ mod tests {
     }
 
     #[test]
-    fn test_map() {
-        // Test on-stack map.
-        let v = &[1u, 2u, 3u];
-        let mut w = v.map(square_ref);
-        assert_eq!(w.len(), 3u);
-        assert_eq!(w[0], 1u);
-        assert_eq!(w[1], 4u);
-        assert_eq!(w[2], 9u);
-
-        // Test on-heap map.
-        let v = ~[1u, 2u, 3u, 4u, 5u];
-        w = v.map(square_ref);
-        assert_eq!(w.len(), 5u);
-        assert_eq!(w[0], 1u);
-        assert_eq!(w[1], 4u);
-        assert_eq!(w[2], 9u);
-        assert_eq!(w[3], 16u);
-        assert_eq!(w[4], 25u);
-    }
-
-    #[test]
     fn test_retain() {
         let mut v = ~[1, 2, 3, 4, 5];
         v.retain(is_odd);
@@ -3491,19 +3440,21 @@ mod tests {
 
     #[test]
     fn test_sort() {
+        use realstd::slice::Vector;
+        use realstd::clone::Clone;
         for len in range(4u, 25) {
             for _ in range(0, 100) {
                 let mut v = task_rng().gen_vec::<uint>(len);
                 let mut v1 = v.clone();
 
-                v.sort();
-                assert!(v.windows(2).all(|w| w[0] <= w[1]));
+                v.as_mut_slice().sort();
+                assert!(v.as_slice().windows(2).all(|w| w[0] <= w[1]));
 
-                v1.sort_by(|a, b| a.cmp(b));
-                assert!(v1.windows(2).all(|w| w[0] <= w[1]));
+                v1.as_mut_slice().sort_by(|a, b| a.cmp(b));
+                assert!(v1.as_slice().windows(2).all(|w| w[0] <= w[1]));
 
-                v1.sort_by(|a, b| b.cmp(a));
-                assert!(v1.windows(2).all(|w| w[0] >= w[1]));
+                v1.as_mut_slice().sort_by(|a, b| b.cmp(a));
+                assert!(v1.as_slice().windows(2).all(|w| w[0] >= w[1]));
             }
         }
 
@@ -3732,36 +3683,6 @@ mod tests {
 
     #[test]
     #[should_fail]
-    fn test_map_fail() {
-        use rc::Rc;
-        let v = [(~0, Rc::new(0)), (~0, Rc::new(0)), (~0, Rc::new(0)), (~0, Rc::new(0))];
-        let mut i = 0;
-        v.map(|_elt| {
-            if i == 2 {
-                fail!()
-            }
-            i += 1;
-            ~[(~0, Rc::new(0))]
-        });
-    }
-
-    #[test]
-    #[should_fail]
-    fn test_flat_map_fail() {
-        use rc::Rc;
-        let v = [(~0, Rc::new(0)), (~0, Rc::new(0)), (~0, Rc::new(0)), (~0, Rc::new(0))];
-        let mut i = 0;
-        flat_map(v, |_elt| {
-            if i == 2 {
-                fail!()
-            }
-            i += 1;
-            ~[(~0, Rc::new(0))]
-        });
-    }
-
-    #[test]
-    #[should_fail]
     fn test_permute_fail() {
         use rc::Rc;
         let v = [(~0, Rc::new(0)), (~0, Rc::new(0)), (~0, Rc::new(0)), (~0, Rc::new(0))];
@@ -4518,7 +4439,7 @@ mod bench {
             unsafe {
                 v.set_len(1024);
             }
-            for i in range(0, 1024) {
+            for i in range(0u, 1024) {
                 v[i] = 0;
             }
         });
@@ -4566,8 +4487,8 @@ mod bench {
     fn sort_random_small(bh: &mut BenchHarness) {
         let mut rng = weak_rng();
         bh.iter(|| {
-            let mut v: ~[u64] = rng.gen_vec(5);
-            v.sort();
+            let mut v = rng.gen_vec::<u64>(5);
+            v.as_mut_slice().sort();
         });
         bh.bytes = 5 * mem::size_of::<u64>() as u64;
     }
@@ -4576,8 +4497,8 @@ mod bench {
     fn sort_random_medium(bh: &mut BenchHarness) {
         let mut rng = weak_rng();
         bh.iter(|| {
-            let mut v: ~[u64] = rng.gen_vec(100);
-            v.sort();
+            let mut v = rng.gen_vec::<u64>(100);
+            v.as_mut_slice().sort();
         });
         bh.bytes = 100 * mem::size_of::<u64>() as u64;
     }
@@ -4586,8 +4507,8 @@ mod bench {
     fn sort_random_large(bh: &mut BenchHarness) {
         let mut rng = weak_rng();
         bh.iter(|| {
-            let mut v: ~[u64] = rng.gen_vec(10000);
-            v.sort();
+            let mut v = rng.gen_vec::<u64>(10000);
+            v.as_mut_slice().sort();
         });
         bh.bytes = 10000 * mem::size_of::<u64>() as u64;
     }
@@ -4607,7 +4528,7 @@ mod bench {
     fn sort_big_random_small(bh: &mut BenchHarness) {
         let mut rng = weak_rng();
         bh.iter(|| {
-            let mut v: ~[BigSortable] = rng.gen_vec(5);
+            let mut v = rng.gen_vec::<BigSortable>(5);
             v.sort();
         });
         bh.bytes = 5 * mem::size_of::<BigSortable>() as u64;
@@ -4617,7 +4538,7 @@ mod bench {
     fn sort_big_random_medium(bh: &mut BenchHarness) {
         let mut rng = weak_rng();
         bh.iter(|| {
-            let mut v: ~[BigSortable] = rng.gen_vec(100);
+            let mut v = rng.gen_vec::<BigSortable>(100);
             v.sort();
         });
         bh.bytes = 100 * mem::size_of::<BigSortable>() as u64;
@@ -4627,7 +4548,7 @@ mod bench {
     fn sort_big_random_large(bh: &mut BenchHarness) {
         let mut rng = weak_rng();
         bh.iter(|| {
-            let mut v: ~[BigSortable] = rng.gen_vec(10000);
+            let mut v = rng.gen_vec::<BigSortable>(10000);
             v.sort();
         });
         bh.bytes = 10000 * mem::size_of::<BigSortable>() as u64;
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index fac4202217f..1d80af70b97 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -275,7 +275,7 @@ Section: Iterators
 #[deriving(Clone)]
 pub struct Chars<'a> {
     /// The slice remaining to be iterated
-    priv string: &'a str,
+    string: &'a str,
 }
 
 impl<'a> Iterator<char> for Chars<'a> {
@@ -320,8 +320,8 @@ impl<'a> DoubleEndedIterator<char> for Chars<'a> {
 #[deriving(Clone)]
 pub struct CharOffsets<'a> {
     /// The original string to be iterated
-    priv string: &'a str,
-    priv iter: Chars<'a>,
+    string: &'a str,
+    iter: Chars<'a>,
 }
 
 impl<'a> Iterator<(uint, char)> for CharOffsets<'a> {
@@ -371,12 +371,12 @@ pub type RevBytes<'a> = Rev<Bytes<'a>>;
 #[deriving(Clone)]
 pub struct CharSplits<'a, Sep> {
     /// The slice remaining to be iterated
-    priv string: &'a str,
-    priv sep: Sep,
+    string: &'a str,
+    sep: Sep,
     /// Whether an empty string at the end is allowed
-    priv allow_trailing_empty: bool,
-    priv only_ascii: bool,
-    priv finished: bool,
+    allow_trailing_empty: bool,
+    only_ascii: bool,
+    finished: bool,
 }
 
 /// An iterator over the substrings of a string, separated by `sep`,
@@ -387,10 +387,10 @@ pub type RevCharSplits<'a, Sep> = Rev<CharSplits<'a, Sep>>;
 /// splitting at most `count` times.
 #[deriving(Clone)]
 pub struct CharSplitsN<'a, Sep> {
-    priv iter: CharSplits<'a, Sep>,
+    iter: CharSplits<'a, Sep>,
     /// The number of splits remaining
-    priv count: uint,
-    priv invert: bool,
+    count: uint,
+    invert: bool,
 }
 
 /// An iterator over the words of a string, separated by a sequence of whitespace
@@ -503,18 +503,18 @@ impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplitsN<'a, Sep> {
 /// substring within a larger string
 #[deriving(Clone)]
 pub struct MatchIndices<'a> {
-    priv haystack: &'a str,
-    priv needle: &'a str,
-    priv position: uint,
+    haystack: &'a str,
+    needle: &'a str,
+    position: uint,
 }
 
 /// An iterator over the substrings of a string separated by a given
 /// search string
 #[deriving(Clone)]
 pub struct StrSplits<'a> {
-    priv it: MatchIndices<'a>,
-    priv last_end: uint,
-    priv finished: bool
+    it: MatchIndices<'a>,
+    last_end: uint,
+    finished: bool
 }
 
 impl<'a> Iterator<(uint, uint)> for MatchIndices<'a> {
@@ -597,10 +597,10 @@ enum NormalizationForm {
 /// Use with the `std::iter` module.
 #[deriving(Clone)]
 pub struct Normalizations<'a> {
-    priv kind: NormalizationForm,
-    priv iter: Chars<'a>,
-    priv buffer: ~[(char, u8)],
-    priv sorted: bool
+    kind: NormalizationForm,
+    iter: Chars<'a>,
+    buffer: ~[(char, u8)],
+    sorted: bool
 }
 
 impl<'a> Iterator<char> for Normalizations<'a> {
@@ -856,7 +856,7 @@ pub fn is_utf16(v: &[u16]) -> bool {
 /// of `u16`s.
 #[deriving(Clone)]
 pub struct UTF16Items<'a> {
-    priv iter: slice::Items<'a, u16>
+    iter: slice::Items<'a, u16>
 }
 /// The possibilities for values decoded from a `u16` stream.
 #[deriving(Eq, TotalEq, Clone, Show)]
@@ -1053,7 +1053,7 @@ static UTF8_CHAR_WIDTH: [u8, ..256] = [
 /// Given a first byte, determine how many bytes are in this UTF-8 character
 #[inline]
 pub fn utf8_char_width(b: u8) -> uint {
-    return UTF8_CHAR_WIDTH[b] as uint;
+    return UTF8_CHAR_WIDTH[b as uint] as uint;
 }
 
 /// Struct that contains a `char` and the index of the first byte of
@@ -1061,9 +1061,9 @@ pub fn utf8_char_width(b: u8) -> uint {
 /// for iterating over the UTF-8 bytes of a string.
 pub struct CharRange {
     /// Current `char`
-    ch: char,
+    pub ch: char,
     /// Index of the first byte of the next `char`
-    next: uint
+    pub next: uint,
 }
 
 // Return the initial codepoint accumulator for the first byte.
@@ -2636,7 +2636,7 @@ impl<'a> StrSlice<'a> for &'a str {
         // Multibyte case is a fn to allow char_range_at to inline cleanly
         fn multibyte_char_range_at(s: &str, i: uint) -> CharRange {
             let mut val = s[i] as u32;
-            let w = UTF8_CHAR_WIDTH[val] as uint;
+            let w = UTF8_CHAR_WIDTH[val as uint] as uint;
             assert!((w != 0));
 
             val = utf8_first_byte!(val, w);
@@ -2665,7 +2665,7 @@ impl<'a> StrSlice<'a> for &'a str {
             }
 
             let mut val = s[i] as u32;
-            let w = UTF8_CHAR_WIDTH[val] as uint;
+            let w = UTF8_CHAR_WIDTH[val as uint] as uint;
             assert!((w != 0));
 
             val = utf8_first_byte!(val, w);
@@ -3019,7 +3019,7 @@ impl Clone for ~str {
 
 impl FromIterator<char> for ~str {
     #[inline]
-    fn from_iterator<T: Iterator<char>>(iterator: T) -> ~str {
+    fn from_iter<T: Iterator<char>>(iterator: T) -> ~str {
         let (lower, _) = iterator.size_hint();
         let mut buf = with_capacity(lower);
         buf.extend(iterator);
@@ -3218,7 +3218,7 @@ mod tests {
         let data = ~"ประเทศไทย中";
         let mut cpy = data.clone();
         let other = "abc";
-        let mut it = other.chars();
+        let it = other.chars();
         cpy.extend(it);
         assert_eq!(cpy, data + other);
     }
@@ -4008,7 +4008,7 @@ mod tests {
 
     #[test]
     fn test_add() {
-        #[allow(unnecessary_allocation)];
+        #![allow(unnecessary_allocation)]
         macro_rules! t (
             ($s1:expr, $s2:expr, $e:expr) => { {
                 let s1 = $s1;
diff --git a/src/libstd/sync/arc.rs b/src/libstd/sync/arc.rs
index 92974005305..0d0bd740e41 100644
--- a/src/libstd/sync/arc.rs
+++ b/src/libstd/sync/arc.rs
@@ -35,7 +35,7 @@ use ty::Unsafe;
 /// Enforces no shared-memory safety.
 #[unsafe_no_drop_flag]
 pub struct UnsafeArc<T> {
-    priv data: *mut ArcData<T>,
+    data: *mut ArcData<T>,
 }
 
 struct ArcData<T> {
diff --git a/src/libstd/sync/atomics.rs b/src/libstd/sync/atomics.rs
index d5f6fac2296..71e67971b45 100644
--- a/src/libstd/sync/atomics.rs
+++ b/src/libstd/sync/atomics.rs
@@ -1,4 +1,4 @@
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -105,7 +105,7 @@
 //! }
 //! ```
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use intrinsics;
 use cast;
@@ -116,26 +116,26 @@ use ty::Unsafe;
 
 /// An atomic boolean type.
 pub struct AtomicBool {
-    priv v: Unsafe<uint>,
-    priv nopod: marker::NoPod
+    v: Unsafe<uint>,
+    nocopy: marker::NoCopy
 }
 
 /// A signed atomic integer type, supporting basic atomic arithmetic operations
 pub struct AtomicInt {
-    priv v: Unsafe<int>,
-    priv nopod: marker::NoPod
+    v: Unsafe<int>,
+    nocopy: marker::NoCopy
 }
 
 /// An unsigned atomic integer type, supporting basic atomic arithmetic operations
 pub struct AtomicUint {
-    priv v: Unsafe<uint>,
-    priv nopod: marker::NoPod
+    v: Unsafe<uint>,
+    nocopy: marker::NoCopy
 }
 
 /// An unsafe atomic pointer. Only supports basic atomic operations
 pub struct AtomicPtr<T> {
-    priv p: Unsafe<uint>,
-    priv nopod: marker::NoPod
+    p: Unsafe<uint>,
+    nocopy: marker::NoCopy
 }
 
 /// An atomic, nullable unique pointer
@@ -144,7 +144,7 @@ pub struct AtomicPtr<T> {
 /// owned heap objects across tasks.
 #[unsafe_no_drop_flag]
 pub struct AtomicOption<T> {
-    priv p: Unsafe<uint>,
+    p: Unsafe<uint>,
 }
 
 /// Atomic memory orderings
@@ -180,15 +180,15 @@ pub enum Ordering {
 /// An `AtomicBool` initialized to `false`
 pub static INIT_ATOMIC_BOOL : AtomicBool = AtomicBool { v: Unsafe{value: 0,
                                                                   marker1: marker::InvariantType},
-                                                        nopod: marker::NoPod };
+                                                        nocopy: marker::NoCopy };
 /// An `AtomicInt` initialized to `0`
 pub static INIT_ATOMIC_INT  : AtomicInt  = AtomicInt  { v: Unsafe{value: 0,
                                                                   marker1: marker::InvariantType},
-                                                        nopod: marker::NoPod };
+                                                        nocopy: marker::NoCopy };
 /// An `AtomicUint` initialized to `0`
 pub static INIT_ATOMIC_UINT : AtomicUint = AtomicUint { v: Unsafe{value: 0,
                                                                   marker1: marker::InvariantType},
-                                                        nopod: marker::NoPod };
+                                                        nocopy: marker::NoCopy };
 
 // NB: Needs to be -1 (0b11111111...) to make fetch_nand work correctly
 static UINT_TRUE: uint = -1;
@@ -197,7 +197,7 @@ impl AtomicBool {
     /// Create a new `AtomicBool`
     pub fn new(v: bool) -> AtomicBool {
         let val = if v { UINT_TRUE } else { 0 };
-        AtomicBool { v: Unsafe::new(val), nopod: marker::NoPod }
+        AtomicBool { v: Unsafe::new(val), nocopy: marker::NoCopy }
     }
 
     /// Load the value
@@ -400,7 +400,7 @@ impl AtomicBool {
 impl AtomicInt {
     /// Create a new `AtomicInt`
     pub fn new(v: int) -> AtomicInt {
-        AtomicInt {v: Unsafe::new(v), nopod: marker::NoPod}
+        AtomicInt {v: Unsafe::new(v), nocopy: marker::NoCopy}
     }
 
     /// Load the value
@@ -462,12 +462,57 @@ impl AtomicInt {
     pub fn fetch_sub(&self, val: int, order: Ordering) -> int {
         unsafe { atomic_sub(self.v.get(), val, order) }
     }
+
+    /// Bitwise and with the current value, returning the previous
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::sync::atomics::{AtomicUint, SeqCst};
+    ///
+    /// let foo = AtomicUint::new(0b101101);
+    /// assert_eq!(0b101101, foo.fetch_and(0b110011, SeqCst));
+    /// assert_eq!(0b100001, foo.load(SeqCst));
+    #[inline]
+    pub fn fetch_and(&self, val: int, order: Ordering) -> int {
+        unsafe { atomic_and(self.v.get(), val, order) }
+    }
+
+    /// Bitwise or with the current value, returning the previous
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::sync::atomics::{AtomicUint, SeqCst};
+    ///
+    /// let foo = AtomicUint::new(0b101101);
+    /// assert_eq!(0b101101, foo.fetch_or(0b110011, SeqCst));
+    /// assert_eq!(0b111111, foo.load(SeqCst));
+    #[inline]
+    pub fn fetch_or(&self, val: int, order: Ordering) -> int {
+        unsafe { atomic_or(self.v.get(), val, order) }
+    }
+
+    /// Bitwise xor with the current value, returning the previous
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::sync::atomics::{AtomicUint, SeqCst};
+    ///
+    /// let foo = AtomicUint::new(0b101101);
+    /// assert_eq!(0b101101, foo.fetch_xor(0b110011, SeqCst));
+    /// assert_eq!(0b011110, foo.load(SeqCst));
+    #[inline]
+    pub fn fetch_xor(&self, val: int, order: Ordering) -> int {
+        unsafe { atomic_xor(self.v.get(), val, order) }
+    }
 }
 
 impl AtomicUint {
     /// Create a new `AtomicUint`
     pub fn new(v: uint) -> AtomicUint {
-        AtomicUint { v: Unsafe::new(v), nopod: marker::NoPod }
+        AtomicUint { v: Unsafe::new(v), nocopy: marker::NoCopy }
     }
 
     /// Load the value
@@ -529,12 +574,57 @@ impl AtomicUint {
     pub fn fetch_sub(&self, val: uint, order: Ordering) -> uint {
         unsafe { atomic_sub(self.v.get(), val, order) }
     }
+
+    /// Bitwise and with the current value, returning the previous
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::sync::atomics::{AtomicUint, SeqCst};
+    ///
+    /// let foo = AtomicUint::new(0b101101);
+    /// assert_eq!(0b101101, foo.fetch_and(0b110011, SeqCst));
+    /// assert_eq!(0b100001, foo.load(SeqCst));
+    #[inline]
+    pub fn fetch_and(&self, val: uint, order: Ordering) -> uint {
+        unsafe { atomic_and(self.v.get(), val, order) }
+    }
+
+    /// Bitwise or with the current value, returning the previous
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::sync::atomics::{AtomicUint, SeqCst};
+    ///
+    /// let foo = AtomicUint::new(0b101101);
+    /// assert_eq!(0b101101, foo.fetch_or(0b110011, SeqCst));
+    /// assert_eq!(0b111111, foo.load(SeqCst));
+    #[inline]
+    pub fn fetch_or(&self, val: uint, order: Ordering) -> uint {
+        unsafe { atomic_or(self.v.get(), val, order) }
+    }
+
+    /// Bitwise xor with the current value, returning the previous
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::sync::atomics::{AtomicUint, SeqCst};
+    ///
+    /// let foo = AtomicUint::new(0b101101);
+    /// assert_eq!(0b101101, foo.fetch_xor(0b110011, SeqCst));
+    /// assert_eq!(0b011110, foo.load(SeqCst));
+    #[inline]
+    pub fn fetch_xor(&self, val: uint, order: Ordering) -> uint {
+        unsafe { atomic_xor(self.v.get(), val, order) }
+    }
 }
 
 impl<T> AtomicPtr<T> {
     /// Create a new `AtomicPtr`
     pub fn new(p: *mut T) -> AtomicPtr<T> {
-        AtomicPtr { p: Unsafe::new(p as uint), nopod: marker::NoPod }
+        AtomicPtr { p: Unsafe::new(p as uint), nocopy: marker::NoCopy }
     }
 
     /// Load the value
@@ -843,6 +933,48 @@ mod test {
         assert_eq!(a.load(SeqCst),false);
     }
 
+    #[test]
+    fn uint_and() {
+        let x = AtomicUint::new(0xf731);
+        assert_eq!(x.fetch_and(0x137f, SeqCst), 0xf731);
+        assert_eq!(x.load(SeqCst), 0xf731 & 0x137f);
+    }
+
+    #[test]
+    fn uint_or() {
+        let x = AtomicUint::new(0xf731);
+        assert_eq!(x.fetch_or(0x137f, SeqCst), 0xf731);
+        assert_eq!(x.load(SeqCst), 0xf731 | 0x137f);
+    }
+
+    #[test]
+    fn uint_xor() {
+        let x = AtomicUint::new(0xf731);
+        assert_eq!(x.fetch_xor(0x137f, SeqCst), 0xf731);
+        assert_eq!(x.load(SeqCst), 0xf731 ^ 0x137f);
+    }
+
+    #[test]
+    fn int_and() {
+        let x = AtomicInt::new(0xf731);
+        assert_eq!(x.fetch_and(0x137f, SeqCst), 0xf731);
+        assert_eq!(x.load(SeqCst), 0xf731 & 0x137f);
+    }
+
+    #[test]
+    fn int_or() {
+        let x = AtomicInt::new(0xf731);
+        assert_eq!(x.fetch_or(0x137f, SeqCst), 0xf731);
+        assert_eq!(x.load(SeqCst), 0xf731 | 0x137f);
+    }
+
+    #[test]
+    fn int_xor() {
+        let x = AtomicInt::new(0xf731);
+        assert_eq!(x.fetch_xor(0x137f, SeqCst), 0xf731);
+        assert_eq!(x.load(SeqCst), 0xf731 ^ 0x137f);
+    }
+
     static mut S_BOOL : AtomicBool = INIT_ATOMIC_BOOL;
     static mut S_INT  : AtomicInt  = INIT_ATOMIC_INT;
     static mut S_UINT : AtomicUint = INIT_ATOMIC_UINT;
diff --git a/src/libstd/sync/deque.rs b/src/libstd/sync/deque.rs
index 80a5b9ce3bb..d01c89878de 100644
--- a/src/libstd/sync/deque.rs
+++ b/src/libstd/sync/deque.rs
@@ -86,14 +86,14 @@ struct Deque<T> {
 ///
 /// There may only be one worker per deque.
 pub struct Worker<T> {
-    priv deque: UnsafeArc<Deque<T>>,
+    deque: UnsafeArc<Deque<T>>,
 }
 
 /// The stealing half of the work-stealing deque. Stealers have access to the
 /// opposite end of the deque from the worker, and they only have access to the
 /// `steal` method.
 pub struct Stealer<T> {
-    priv deque: UnsafeArc<Deque<T>>,
+    deque: UnsafeArc<Deque<T>>,
 }
 
 /// When stealing some data, this is an enumeration of the possible outcomes.
@@ -116,7 +116,7 @@ pub enum Stolen<T> {
 /// will only use this structure when allocating a new buffer or deallocating a
 /// previous one.
 pub struct BufferPool<T> {
-    priv pool: Exclusive<~[~Buffer<T>]>,
+    pool: Exclusive<~[~Buffer<T>]>,
 }
 
 /// An internal buffer used by the chase-lev deque. This structure is actually
diff --git a/src/libstd/sync/mpmc_bounded_queue.rs b/src/libstd/sync/mpmc_bounded_queue.rs
index 95f592baff0..12c05c0d61c 100644
--- a/src/libstd/sync/mpmc_bounded_queue.rs
+++ b/src/libstd/sync/mpmc_bounded_queue.rs
@@ -25,7 +25,7 @@
  * policies, either expressed or implied, of Dmitry Vyukov.
  */
 
-#[allow(missing_doc, dead_code)];
+#![allow(missing_doc, dead_code)]
 
 // http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue
 
@@ -54,7 +54,7 @@ struct State<T> {
 }
 
 pub struct Queue<T> {
-    priv state: UnsafeArc<State<T>>,
+    state: UnsafeArc<State<T>>,
 }
 
 impl<T: Send> State<T> {
diff --git a/src/libstd/sync/mpsc_queue.rs b/src/libstd/sync/mpsc_queue.rs
index 9d69f2b3b08..142a6239df6 100644
--- a/src/libstd/sync/mpsc_queue.rs
+++ b/src/libstd/sync/mpsc_queue.rs
@@ -67,8 +67,8 @@ struct Node<T> {
 /// may be safely shared so long as it is guaranteed that there is only one
 /// popper at a time (many pushers are allowed).
 pub struct Queue<T> {
-    priv head: AtomicPtr<Node<T>>,
-    priv tail: *mut Node<T>,
+    head: AtomicPtr<Node<T>>,
+    tail: *mut Node<T>,
 }
 
 impl<T> Node<T> {
diff --git a/src/libstd/sync/spsc_queue.rs b/src/libstd/sync/spsc_queue.rs
index 9277587e587..4e043ecf171 100644
--- a/src/libstd/sync/spsc_queue.rs
+++ b/src/libstd/sync/spsc_queue.rs
@@ -55,19 +55,19 @@ struct Node<T> {
 /// time.
 pub struct Queue<T> {
     // consumer fields
-    priv tail: *mut Node<T>, // where to pop from
-    priv tail_prev: AtomicPtr<Node<T>>, // where to pop from
+    tail: *mut Node<T>, // where to pop from
+    tail_prev: AtomicPtr<Node<T>>, // where to pop from
 
     // producer fields
-    priv head: *mut Node<T>,      // where to push to
-    priv first: *mut Node<T>,     // where to get new nodes from
-    priv tail_copy: *mut Node<T>, // between first/tail
+    head: *mut Node<T>,      // where to push to
+    first: *mut Node<T>,     // where to get new nodes from
+    tail_copy: *mut Node<T>, // between first/tail
 
     // Cache maintenance fields. Additions and subtractions are stored
     // separately in order to allow them to use nonatomic addition/subtraction.
-    priv cache_bound: uint,
-    priv cache_additions: AtomicUint,
-    priv cache_subtractions: AtomicUint,
+    cache_bound: uint,
+    cache_additions: AtomicUint,
+    cache_subtractions: AtomicUint,
 }
 
 impl<T: Send> Node<T> {
diff --git a/src/libstd/task.rs b/src/libstd/task.rs
index 9c88db6beb5..a3d919921ae 100644
--- a/src/libstd/task.rs
+++ b/src/libstd/task.rs
@@ -55,20 +55,20 @@ use str::{Str, SendStr, IntoMaybeOwned};
 ///
 /// If you wish for this result's delivery to block until all
 /// children tasks complete, recommend using a result future.
-pub type TaskResult = Result<(), ~Any>;
+pub type TaskResult = Result<(), ~Any:Send>;
 
 /// Task configuration options
 pub struct TaskOpts {
     /// Enable lifecycle notifications on the given channel
-    notify_chan: Option<Sender<TaskResult>>,
+    pub notify_chan: Option<Sender<TaskResult>>,
     /// A name for the task-to-be, for identification in failure messages
-    name: Option<SendStr>,
+    pub name: Option<SendStr>,
     /// The size of the stack for the spawned task
-    stack_size: Option<uint>,
+    pub stack_size: Option<uint>,
     /// Task-local stdout
-    stdout: Option<~Writer>,
+    pub stdout: Option<~Writer:Send>,
     /// Task-local stderr
-    stderr: Option<~Writer>,
+    pub stderr: Option<~Writer:Send>,
 }
 
 /**
@@ -85,9 +85,9 @@ pub struct TaskOpts {
 // the run function move them in.
 pub struct TaskBuilder {
     /// Options to spawn the new task with
-    opts: TaskOpts,
-    priv gen_body: Option<proc(v: proc()) -> proc()>,
-    priv nopod: Option<marker::NoPod>,
+    pub opts: TaskOpts,
+    gen_body: Option<proc:Send(v: proc:Send()) -> proc:Send()>,
+    nocopy: Option<marker::NoCopy>,
 }
 
 /**
@@ -98,7 +98,7 @@ pub fn task() -> TaskBuilder {
     TaskBuilder {
         opts: TaskOpts::new(),
         gen_body: None,
-        nopod: None,
+        nocopy: None,
     }
 }
 
@@ -150,22 +150,14 @@ impl TaskBuilder {
      * generator by applying the task body which results from the
      * existing body generator to the new body generator.
      */
-    pub fn with_wrapper(mut self, wrapper: proc(v: proc()) -> proc()) -> TaskBuilder {
-        let prev_gen_body = self.gen_body.take();
-        let prev_gen_body = match prev_gen_body {
-            Some(gen) => gen,
-            None => {
-                let f: proc(proc()) -> proc() = proc(body) body;
-                f
-            }
-        };
-        let next_gen_body = {
-            let f: proc(proc()) -> proc() = proc(body) {
-                wrapper(prev_gen_body(body))
-            };
-            f
+    pub fn with_wrapper(mut self,
+                        wrapper: proc:Send(v: proc:Send()) -> proc:Send())
+        -> TaskBuilder
+    {
+        self.gen_body = match self.gen_body.take() {
+            Some(prev) => Some(proc(body) { wrapper(prev(body)) }),
+            None => Some(wrapper)
         };
-        self.gen_body = Some(next_gen_body);
         self
     }
 
@@ -176,7 +168,7 @@ impl TaskBuilder {
      * the provided unique closure. The task has the properties and behavior
      * specified by the task_builder.
      */
-    pub fn spawn(mut self, f: proc()) {
+    pub fn spawn(mut self, f: proc:Send()) {
         let gen_body = self.gen_body.take();
         let f = match gen_body {
             Some(gen) => gen(f),
@@ -199,7 +191,7 @@ impl TaskBuilder {
      * # Failure
      * Fails if a future_result was already set for this task.
      */
-    pub fn try<T:Send>(mut self, f: proc() -> T) -> Result<T, ~Any> {
+    pub fn try<T:Send>(mut self, f: proc:Send() -> T) -> Result<T, ~Any:Send> {
         let (tx, rx) = channel();
 
         let result = self.future_result();
@@ -241,12 +233,12 @@ impl TaskOpts {
 /// the provided unique closure.
 ///
 /// This function is equivalent to `task().spawn(f)`.
-pub fn spawn(f: proc()) {
+pub fn spawn(f: proc:Send()) {
     let task = task();
     task.spawn(f)
 }
 
-pub fn try<T:Send>(f: proc() -> T) -> Result<T, ~Any> {
+pub fn try<T:Send>(f: proc:Send() -> T) -> Result<T, ~Any:Send> {
     /*!
      * Execute a function in another task and return either the return value
      * of the function or result::err.
@@ -346,7 +338,7 @@ fn test_run_basic() {
 fn test_with_wrapper() {
     let (tx, rx) = channel();
     task().with_wrapper(proc(body) {
-        let result: proc() = proc() {
+        let result: proc:Send() = proc() {
             body();
             tx.send(());
         };
@@ -432,7 +424,7 @@ fn test_spawn_sched_childs_on_default_sched() {
 }
 
 #[cfg(test)]
-fn avoid_copying_the_body(spawnfn: |v: proc()|) {
+fn avoid_copying_the_body(spawnfn: |v: proc:Send()|) {
     let (tx, rx) = channel::<uint>();
 
     let x = ~1;
@@ -478,7 +470,7 @@ fn test_child_doesnt_ref_parent() {
     // (well, it would if the constant were 8000+ - I lowered it to be more
     // valgrind-friendly. try this at home, instead..!)
     static generations: uint = 16;
-    fn child_no(x: uint) -> proc() {
+    fn child_no(x: uint) -> proc:Send() {
         return proc() {
             if x < generations {
                 task().spawn(child_no(x+1));
@@ -524,10 +516,10 @@ fn test_try_fail_message_owned_str() {
 #[test]
 fn test_try_fail_message_any() {
     match try(proc() {
-        fail!(~413u16 as ~Any);
+        fail!(~413u16 as ~Any:Send);
     }) {
         Err(e) => {
-            type T = ~Any;
+            type T = ~Any:Send;
             assert!(e.is::<T>());
             let any = e.move::<T>().unwrap();
             assert!(any.is::<u16>());
diff --git a/src/libstd/tuple.rs b/src/libstd/tuple.rs
index c4ce6b5ae66..732b006b245 100644
--- a/src/libstd/tuple.rs
+++ b/src/libstd/tuple.rs
@@ -10,7 +10,7 @@
 
 //! Operations on tuples
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use clone::Clone;
 #[cfg(not(test))] use cmp::*;
diff --git a/src/libstd/ty.rs b/src/libstd/ty.rs
index ae8be25205d..0c9f0b02fdf 100644
--- a/src/libstd/ty.rs
+++ b/src/libstd/ty.rs
@@ -48,10 +48,10 @@ use kinds::marker;
 #[lang="unsafe"]
 pub struct Unsafe<T> {
     /// Wrapped value
-    value: T,
+    pub value: T,
 
     /// Invariance marker
-    marker1: marker::InvariantType<T>
+    pub marker1: marker::InvariantType<T>
 }
 
 impl<T> Unsafe<T> {
@@ -63,7 +63,7 @@ impl<T> Unsafe<T> {
 
     /// Gets a mutable pointer to the wrapped value
     #[inline]
-    pub unsafe fn get(&self) -> *mut T { cast::transmute(&self.value) }
+    pub unsafe fn get(&self) -> *mut T { cast::transmute_mut_unsafe(&self.value) }
 
     /// Unwraps the value
     #[inline]
diff --git a/src/libstd/unicode.rs b/src/libstd/unicode.rs
index 645db8e040b..c98861a0fe7 100644
--- a/src/libstd/unicode.rs
+++ b/src/libstd/unicode.rs
@@ -10,8 +10,8 @@
 
 // The following code was generated by "src/etc/unicode.py"
 
-#[allow(missing_doc)];
-#[allow(non_uppercase_statics)];
+#![allow(missing_doc)]
+#![allow(non_uppercase_statics)]
 
 fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
     use cmp::{Equal, Less, Greater};
diff --git a/src/libstd/unstable/dynamic_lib.rs b/src/libstd/unstable/dynamic_lib.rs
index 57dbc045a65..441a60a5186 100644
--- a/src/libstd/unstable/dynamic_lib.rs
+++ b/src/libstd/unstable/dynamic_lib.rs
@@ -22,7 +22,7 @@ use ops::*;
 use option::*;
 use result::*;
 
-pub struct DynamicLibrary { priv handle: *u8}
+pub struct DynamicLibrary { handle: *u8}
 
 impl Drop for DynamicLibrary {
     fn drop(&mut self) {
diff --git a/src/libstd/unstable/mod.rs b/src/libstd/unstable/mod.rs
index 7bee0cf48ee..ddbf650e64a 100644
--- a/src/libstd/unstable/mod.rs
+++ b/src/libstd/unstable/mod.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[doc(hidden)];
+#![doc(hidden)]
 
 use prelude::*;
 use libc::uintptr_t;
@@ -28,7 +28,7 @@ for it to terminate.
 The executing thread has no access to a task pointer and will be using
 a normal large stack.
 */
-pub fn run_in_bare_thread(f: proc()) {
+pub fn run_in_bare_thread(f: proc:Send()) {
     use rt::thread::Thread;
     Thread::start(f).join()
 }
diff --git a/src/libstd/unstable/mutex.rs b/src/libstd/unstable/mutex.rs
index 6f5ef067e89..c2db8ad9586 100644
--- a/src/libstd/unstable/mutex.rs
+++ b/src/libstd/unstable/mutex.rs
@@ -56,7 +56,7 @@
 //! } // `lock` is deallocated here
 //! ```
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 use option::{Option, None, Some};
 use ops::Drop;
@@ -67,7 +67,7 @@ use ops::Drop;
 /// Prefer the `NativeMutex` type where possible, since that does not
 /// require manual deallocation.
 pub struct StaticNativeMutex {
-    priv inner: imp::Mutex,
+    inner: imp::Mutex,
 }
 
 /// A native mutex with a destructor for clean-up.
@@ -75,7 +75,7 @@ pub struct StaticNativeMutex {
 /// See `StaticNativeMutex` for a version that is suitable for storing in
 /// statics.
 pub struct NativeMutex {
-    priv inner: StaticNativeMutex
+    inner: StaticNativeMutex
 }
 
 /// Automatically unlocks the mutex that it was created from on
@@ -86,7 +86,7 @@ pub struct NativeMutex {
 /// then.
 #[must_use]
 pub struct LockGuard<'a> {
-    priv lock: &'a StaticNativeMutex
+    lock: &'a StaticNativeMutex
 }
 
 pub static NATIVE_MUTEX_INIT: StaticNativeMutex = StaticNativeMutex {
@@ -372,8 +372,8 @@ mod imp {
     }
 
     pub struct Mutex {
-        priv lock: Unsafe<pthread_mutex_t>,
-        priv cond: Unsafe<pthread_cond_t>,
+        lock: Unsafe<pthread_mutex_t>,
+        cond: Unsafe<pthread_cond_t>,
     }
 
     pub static MUTEX_INIT: Mutex = Mutex {
@@ -447,8 +447,8 @@ mod imp {
 
     pub struct Mutex {
         // pointers for the lock/cond handles, atomically updated
-        priv lock: atomics::AtomicUint,
-        priv cond: atomics::AtomicUint,
+        lock: atomics::AtomicUint,
+        cond: atomics::AtomicUint,
     }
 
     pub static MUTEX_INIT: Mutex = Mutex {
@@ -621,7 +621,7 @@ mod test {
     #[test]
     fn destroy_immediately() {
         unsafe {
-            let mut m = StaticNativeMutex::new();
+            let m = StaticNativeMutex::new();
             m.destroy();
         }
     }
diff --git a/src/libstd/unstable/simd.rs b/src/libstd/unstable/simd.rs
index 1029e5fdbd3..a7a314d35e7 100644
--- a/src/libstd/unstable/simd.rs
+++ b/src/libstd/unstable/simd.rs
@@ -10,44 +10,52 @@
 
 //! SIMD vectors
 
-#[allow(non_camel_case_types)];
+#![allow(non_camel_case_types)]
 
 #[experimental]
 #[simd]
-pub struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8);
+pub struct i8x16(pub i8, pub i8, pub i8, pub i8,
+                 pub i8, pub i8, pub i8, pub i8,
+                 pub i8, pub i8, pub i8, pub i8,
+                 pub i8, pub i8, pub i8, pub i8);
 
 #[experimental]
 #[simd]
-pub struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
+pub struct i16x8(pub i16, pub i16, pub i16, pub i16,
+                 pub i16, pub i16, pub i16, pub i16);
 
 #[experimental]
 #[simd]
-pub struct i32x4(i32, i32, i32, i32);
+pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
 
 #[experimental]
 #[simd]
-pub struct i64x2(i64, i64);
+pub struct i64x2(pub i64, pub i64);
 
 #[experimental]
 #[simd]
-pub struct u8x16(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8);
+pub struct u8x16(pub u8, pub u8, pub u8, pub u8,
+                 pub u8, pub u8, pub u8, pub u8,
+                 pub u8, pub u8, pub u8, pub u8,
+                 pub u8, pub u8, pub u8, pub u8);
 
 #[experimental]
 #[simd]
-pub struct u16x8(u16, u16, u16, u16, u16, u16, u16, u16);
+pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
+                 pub u16, pub u16, pub u16, pub u16);
 
 #[experimental]
 #[simd]
-pub struct u32x4(u32, u32, u32, u32);
+pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
 
 #[experimental]
 #[simd]
-pub struct u64x2(u64, u64);
+pub struct u64x2(pub u64, pub u64);
 
 #[experimental]
 #[simd]
-pub struct f32x4(f32, f32, f32, f32);
+pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
 
 #[experimental]
 #[simd]
-pub struct f64x2(f64, f64);
+pub struct f64x2(pub f64, pub f64);
diff --git a/src/libstd/unstable/sync.rs b/src/libstd/unstable/sync.rs
index 367967b8e67..f1dd7aa150b 100644
--- a/src/libstd/unstable/sync.rs
+++ b/src/libstd/unstable/sync.rs
@@ -30,7 +30,7 @@ struct ExData<T> {
  * need to block or deschedule while accessing shared state, use extra::sync::RWArc.
  */
 pub struct Exclusive<T> {
-    priv x: UnsafeArc<ExData<T>>
+    x: UnsafeArc<ExData<T>>
 }
 
 impl<T:Send> Clone for Exclusive<T> {
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs
index 4454801c129..30416b28241 100644
--- a/src/libstd/vec.rs
+++ b/src/libstd/vec.rs
@@ -15,7 +15,7 @@ use cmp::{Ord, Eq, Ordering, TotalEq, TotalOrd};
 use container::{Container, Mutable};
 use default::Default;
 use fmt;
-use iter::{DoubleEndedIterator, FromIterator, Extendable, Iterator};
+use iter::{DoubleEndedIterator, FromIterator, Extendable, Iterator, range};
 use libc::{free, c_void};
 use mem::{size_of, move_val_init};
 use mem;
@@ -56,9 +56,9 @@ use slice::{MutableTotalOrdVector, Vector};
 /// ```
 #[unsafe_no_drop_flag]
 pub struct Vec<T> {
-    priv len: uint,
-    priv cap: uint,
-    priv ptr: *mut T
+    len: uint,
+    cap: uint,
+    ptr: *mut T
 }
 
 impl<T> Vec<T> {
@@ -166,6 +166,22 @@ impl<T> Vec<T> {
 }
 
 impl<T: Clone> Vec<T> {
+    /// Iterates over the `second` vector, copying each element and appending it to
+    /// the `first`. Afterwards, the `first` is then returned for use again.
+    ///
+    /// # Example
+    ///
+    /// ```rust
+    /// let vec = vec!(1, 2);
+    /// let vec = vec.append([3, 4]);
+    /// assert_eq!(vec, vec!(1, 2, 3, 4));
+    /// ```
+    #[inline]
+    pub fn append(mut self, second: &[T]) -> Vec<T> {
+        self.push_all(second);
+        self
+    }
+
     /// Constructs a `Vec` by cloning elements of a slice.
     ///
     /// # Example
@@ -214,9 +230,7 @@ impl<T: Clone> Vec<T> {
     /// ```
     #[inline]
     pub fn push_all(&mut self, other: &[T]) {
-        for element in other.iter() {
-            self.push((*element).clone())
-        }
+        self.extend(other.iter().map(|e| e.clone()));
     }
 
     /// Grows the `Vec` in-place.
@@ -296,16 +310,29 @@ impl<T: Clone> Vec<T> {
 
 impl<T:Clone> Clone for Vec<T> {
     fn clone(&self) -> Vec<T> {
-        let mut vector = Vec::with_capacity(self.len());
-        for element in self.iter() {
-            vector.push((*element).clone())
+        self.iter().map(|x| x.clone()).collect()
+    }
+
+    fn clone_from(&mut self, other: &Vec<T>) {
+        // drop anything in self that will not be overwritten
+        if self.len() > other.len() {
+            self.truncate(other.len())
         }
-        vector
+
+        // reuse the contained values' allocations/resources.
+        for (place, thing) in self.mut_iter().zip(other.iter()) {
+            place.clone_from(thing)
+        }
+
+        // self.len <= other.len due to the truncate above, so the
+        // slice here is always in-bounds.
+        let len = self.len();
+        self.extend(other.slice_from(len).iter().map(|x| x.clone()));
     }
 }
 
 impl<T> FromIterator<T> for Vec<T> {
-    fn from_iterator<I:Iterator<T>>(mut iterator: I) -> Vec<T> {
+    fn from_iter<I:Iterator<T>>(mut iterator: I) -> Vec<T> {
         let (lower, _) = iterator.size_hint();
         let mut vector = Vec::with_capacity(lower);
         for element in iterator {
@@ -431,7 +458,7 @@ impl<T> Vec<T> {
     /// assert_eq!(vec.capacity(), 11);
     /// ```
     pub fn reserve_exact(&mut self, capacity: uint) {
-        if capacity >= self.len {
+        if capacity > self.cap {
             let size = capacity.checked_mul(&size_of::<T>()).expect("capacity overflow");
             self.cap = capacity;
             unsafe {
@@ -518,6 +545,22 @@ impl<T> Vec<T> {
         }
     }
 
+    /// Appends one element to the vector provided. The vector itself is then
+    /// returned for use again.
+    ///
+    /// # Example
+    ///
+    /// ```rust
+    /// let vec = vec!(1, 2);
+    /// let vec = vec.append_one(3);
+    /// assert_eq!(vec, vec!(1, 2, 3));
+    /// ```
+    #[inline]
+    pub fn append_one(mut self, x: T) -> Vec<T> {
+        self.push(x);
+        self
+    }
+
     /// Shorten a vector, dropping excess elements.
     ///
     /// If `len` is greater than the vector's current length, this has no
@@ -902,13 +945,6 @@ impl<T> Vec<T> {
         }
     }
 
-    ///Apply a function to each element of a vector and return the results.
-    #[inline]
-    #[deprecated="Use `xs.iter().map(closure)` instead."]
-    pub fn map<U>(&self, f: |t: &T| -> U) -> Vec<U> {
-        self.iter().map(f).collect()
-    }
-
     /// Takes ownership of the vector `other`, moving all elements into
     /// the current vector. This does not copy any elements, and it is
     /// illegal to use the `other` vector after calling this method
@@ -922,9 +958,7 @@ impl<T> Vec<T> {
     /// assert_eq!(vec, vec!(~1, ~2, ~3, ~4));
     /// ```
     pub fn push_all_move(&mut self, other: Vec<T>) {
-        for element in other.move_iter() {
-            self.push(element)
-        }
+        self.extend(other.move_iter());
     }
 
     /// Returns a mutable slice of `self` between `start` and `end`.
@@ -1101,6 +1135,56 @@ impl<T> Vec<T> {
     pub fn as_mut_ptr(&mut self) -> *mut T {
         self.as_mut_slice().as_mut_ptr()
     }
+
+    /// Retains only the elements specified by the predicate.
+    ///
+    /// In other words, remove all elements `e` such that `f(&e)` returns false.
+    /// This method operates in place and preserves the order the retained elements.
+    ///
+    /// # Example
+    ///
+    /// ```rust
+    /// let mut vec = vec!(1i, 2, 3, 4);
+    /// vec.retain(|x| x%2 == 0);
+    /// assert_eq!(vec, vec!(2, 4));
+    /// ```
+    pub fn retain(&mut self, f: |&T| -> bool) {
+        let len = self.len();
+        let mut del = 0u;
+        {
+            let v = self.as_mut_slice();
+
+            for i in range(0u, len) {
+                if !f(&v[i]) {
+                    del += 1;
+                } else if del > 0 {
+                    v.swap(i-del, i);
+                }
+            }
+        }
+        if del > 0 {
+            self.truncate(len - del);
+        }
+    }
+
+    /// Expands a vector in place, initializing the new elements to the result of a function.
+    ///
+    /// The vector is grown by `n` elements. The i-th new element are initialized to the value
+    /// returned by `f(i)` where `i` is in the range [0, n).
+    ///
+    /// # Example
+    ///
+    /// ```rust
+    /// let mut vec = vec!(0u, 1);
+    /// vec.grow_fn(3, |i| i);
+    /// assert_eq!(vec, vec!(0, 1, 0, 1, 2));
+    /// ```
+    pub fn grow_fn(&mut self, n: uint, f: |uint| -> T) {
+        self.reserve_additional(n);
+        for i in range(0u, n) {
+            self.push(f(i));
+        }
+    }
 }
 
 impl<T:TotalOrd> Vec<T> {
@@ -1255,38 +1339,6 @@ impl<T> Vector<T> for Vec<T> {
     }
 }
 
-/// Iterates over the `second` vector, copying each element and appending it to
-/// the `first`. Afterwards, the `first` is then returned for use again.
-///
-/// # Example
-///
-/// ```rust
-/// let vec = vec!(1, 2);
-/// let vec = std::vec::append(vec, [3, 4]);
-/// assert_eq!(vec, vec!(1, 2, 3, 4));
-/// ```
-#[inline]
-pub fn append<T:Clone>(mut first: Vec<T>, second: &[T]) -> Vec<T> {
-    first.push_all(second);
-    first
-}
-
-/// Appends one element to the vector provided. The vector itself is then
-/// returned for use again.
-///
-/// # Example
-///
-/// ```rust
-/// let vec = vec!(1, 2);
-/// let vec = std::vec::append_one(vec, 3);
-/// assert_eq!(vec, vec!(1, 2, 3));
-/// ```
-#[inline]
-pub fn append_one<T>(mut lhs: Vec<T>, x: T) -> Vec<T> {
-    lhs.push(x);
-    lhs
-}
-
 #[unsafe_destructor]
 impl<T> Drop for Vec<T> {
     fn drop(&mut self) {
@@ -1315,8 +1367,8 @@ impl<T:fmt::Show> fmt::Show for Vec<T> {
 
 /// An iterator that moves out of a vector.
 pub struct MoveItems<T> {
-    priv allocation: *mut c_void, // the block of memory allocated for the vector
-    priv iter: Items<'static, T>
+    allocation: *mut c_void, // the block of memory allocated for the vector
+    iter: Items<'static, T>
 }
 
 impl<T> Iterator<T> for MoveItems<T> {
@@ -1486,4 +1538,52 @@ mod tests {
 
         assert!(values == Vec::from_slice([2u8, 3, 5, 6, 7]));
     }
+
+    #[test]
+    fn test_clone() {
+        let v: Vec<int> = vec!();
+        let w = vec!(1, 2, 3);
+
+        assert_eq!(v, v.clone());
+
+        let z = w.clone();
+        assert_eq!(w, z);
+        // they should be disjoint in memory.
+        assert!(w.as_ptr() != z.as_ptr())
+    }
+
+    #[test]
+    fn test_clone_from() {
+        let mut v = vec!();
+        let three = vec!(~1, ~2, ~3);
+        let two = vec!(~4, ~5);
+        // zero, long
+        v.clone_from(&three);
+        assert_eq!(v, three);
+
+        // equal
+        v.clone_from(&three);
+        assert_eq!(v, three);
+
+        // long, short
+        v.clone_from(&two);
+        assert_eq!(v, two);
+
+        // short, long
+        v.clone_from(&three);
+        assert_eq!(v, three)
+    }
+
+    fn test_grow_fn() {
+        let mut v = Vec::from_slice([0u, 1]);
+        v.grow_fn(3, |i| i);
+        assert!(v == Vec::from_slice([0u, 1, 0, 1, 2]));
+    }
+
+    #[test]
+    fn test_retain() {
+        let mut vec = Vec::from_slice([1u, 2, 3, 4]);
+        vec.retain(|x| x%2 == 0);
+        assert!(vec == Vec::from_slice([2u, 4]));
+    }
 }
diff --git a/src/libsync/arc.rs b/src/libsync/arc.rs
index 28841b780a4..ae76357a2be 100644
--- a/src/libsync/arc.rs
+++ b/src/libsync/arc.rs
@@ -46,7 +46,7 @@ use std::sync::atomics;
 /// ```
 #[unsafe_no_drop_flag]
 pub struct Arc<T> {
-    priv x: *mut ArcInner<T>,
+    x: *mut ArcInner<T>,
 }
 
 /// A weak pointer to an `Arc`.
@@ -55,7 +55,7 @@ pub struct Arc<T> {
 /// used to break cycles between `Arc` pointers.
 #[unsafe_no_drop_flag]
 pub struct Weak<T> {
-    priv x: *mut ArcInner<T>,
+    x: *mut ArcInner<T>,
 }
 
 struct ArcInner<T> {
@@ -165,7 +165,7 @@ impl<T: Share + Send> Drop for Arc<T> {
         // Because `fetch_sub` is already atomic, we do not need to synchronize
         // with other threads unless we are going to delete the object. This
         // same logic applies to the below `fetch_sub` to the `weak` count.
-        if self.inner().strong.fetch_sub(1, atomics::Release) != 0 { return }
+        if self.inner().strong.fetch_sub(1, atomics::Release) != 1 { return }
 
         // This fence is needed to prevent reordering of use of the data and
         // deletion of the data. Because it is marked `Release`, the
@@ -190,7 +190,7 @@ impl<T: Share + Send> Drop for Arc<T> {
         // allocation itself (there may still be weak pointers lying around).
         unsafe { drop(ptr::read(&self.inner().data)); }
 
-        if self.inner().weak.fetch_sub(1, atomics::Release) == 0 {
+        if self.inner().weak.fetch_sub(1, atomics::Release) == 1 {
             atomics::fence(atomics::Acquire);
             unsafe { global_heap::exchange_free(self.x as *u8) }
         }
@@ -240,7 +240,7 @@ impl<T: Share + Send> Drop for Weak<T> {
         // If we find out that we were the last weak pointer, then its time to
         // deallocate the data entirely. See the discussion in Arc::drop() about
         // the memory orderings
-        if self.inner().weak.fetch_sub(1, atomics::Release) == 0 {
+        if self.inner().weak.fetch_sub(1, atomics::Release) == 1 {
             atomics::fence(atomics::Acquire);
             unsafe { global_heap::exchange_free(self.x as *u8) }
         }
@@ -251,9 +251,24 @@ impl<T: Share + Send> Drop for Weak<T> {
 #[allow(experimental)]
 mod tests {
     use super::{Arc, Weak};
+    use std::sync::atomics;
+    use std::task;
     use Mutex;
 
-    use std::task;
+    struct Canary(*mut atomics::AtomicUint);
+
+    impl Drop for Canary
+    {
+        fn drop(&mut self) {
+            unsafe {
+                match *self {
+                    Canary(c) => {
+                        (*c).fetch_add(1, atomics::SeqCst);
+                    }
+                }
+            }
+        }
+    }
 
     #[test]
     fn manually_share_arc() {
@@ -349,4 +364,23 @@ mod tests {
 
         // hopefully we don't double-free (or leak)...
     }
+
+    #[test]
+    fn drop_arc() {
+        let mut canary = atomics::AtomicUint::new(0);
+        let x = Arc::new(Canary(&mut canary as *mut atomics::AtomicUint));
+        drop(x);
+        assert!(canary.load(atomics::Acquire) == 1);
+    }
+
+    #[test]
+    fn drop_arc_weak() {
+        let mut canary = atomics::AtomicUint::new(0);
+        let arc = Arc::new(Canary(&mut canary as *mut atomics::AtomicUint));
+        let arc_weak = arc.downgrade();
+        assert!(canary.load(atomics::Acquire) == 0);
+        drop(arc);
+        assert!(canary.load(atomics::Acquire) == 1);
+        drop(arc_weak);
+    }
 }
diff --git a/src/libsync/comm.rs b/src/libsync/comm.rs
index 628f6459bad..9e01b16ee9b 100644
--- a/src/libsync/comm.rs
+++ b/src/libsync/comm.rs
@@ -14,14 +14,14 @@ Higher level communication abstractions.
 
 */
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use std::comm;
 
 /// An extension of `pipes::stream` that allows both sending and receiving.
 pub struct DuplexStream<S, R> {
-    priv tx: Sender<S>,
-    priv rx: Receiver<R>,
+    tx: Sender<S>,
+    rx: Receiver<R>,
 }
 
 /// Creates a bidirectional stream.
diff --git a/src/libsync/future.rs b/src/libsync/future.rs
index 74a15dc9f0e..cfe942afc12 100644
--- a/src/libsync/future.rs
+++ b/src/libsync/future.rs
@@ -24,17 +24,17 @@
  * ```
  */
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use std::mem::replace;
 
 /// A type encapsulating the result of a computation which may not be complete
 pub struct Future<A> {
-    priv state: FutureState<A>,
+    state: FutureState<A>,
 }
 
 enum FutureState<A> {
-    Pending(proc() -> A),
+    Pending(proc:Send() -> A),
     Evaluating,
     Forced(A)
 }
@@ -90,7 +90,7 @@ impl<A> Future<A> {
         Future {state: Forced(val)}
     }
 
-    pub fn from_fn(f: proc() -> A) -> Future<A> {
+    pub fn from_fn(f: proc:Send() -> A) -> Future<A> {
         /*!
          * Create a future from a function.
          *
@@ -117,7 +117,7 @@ impl<A:Send> Future<A> {
         })
     }
 
-    pub fn spawn(blk: proc() -> A) -> Future<A> {
+    pub fn spawn(blk: proc:Send() -> A) -> Future<A> {
         /*!
          * Create a future from a unique closure.
          *
diff --git a/src/libsync/lib.rs b/src/libsync/lib.rs
index 4df644e3b23..58bd837104c 100644
--- a/src/libsync/lib.rs
+++ b/src/libsync/lib.rs
@@ -12,15 +12,17 @@
  * Concurrency-enabled mechanisms and primitives.
  */
 
-#[crate_id = "sync#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-#[feature(phase)];
-#[deny(missing_doc, deprecated_owned_vector)];
+#![crate_id = "sync#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+#![feature(phase)]
+#![deny(deprecated_owned_vector)]
+
+#![deny(missing_doc)]
 
 #[cfg(test)]
 #[phase(syntax, link)] extern crate log;
diff --git a/src/libsync/lock.rs b/src/libsync/lock.rs
index 6ddd0d400f2..67b725f040b 100644
--- a/src/libsync/lock.rs
+++ b/src/libsync/lock.rs
@@ -79,12 +79,12 @@ impl<'b> Inner<'b> {
 /// A condition variable, a mechanism for unlock-and-descheduling and
 /// signaling, for use with the lock types.
 pub struct Condvar<'a> {
-    priv name: &'static str,
+    name: &'static str,
     // n.b. Inner must be after PoisonOnFail because we must set the poison flag
     //      *inside* the mutex, and struct fields are destroyed top-to-bottom
     //      (destroy the lock guard last).
-    priv poison: PoisonOnFail<'a>,
-    priv inner: Inner<'a>,
+    poison: PoisonOnFail<'a>,
+    inner: Inner<'a>,
 }
 
 impl<'a> Condvar<'a> {
@@ -166,18 +166,18 @@ impl<'a> Condvar<'a> {
 /// }
 /// ```
 pub struct Mutex<T> {
-    priv lock: raw::Mutex,
-    priv failed: Unsafe<bool>,
-    priv data: Unsafe<T>,
+    lock: raw::Mutex,
+    failed: Unsafe<bool>,
+    data: Unsafe<T>,
 }
 
 /// An guard which is created by locking a mutex. Through this guard the
 /// underlying data can be accessed.
 pub struct MutexGuard<'a, T> {
-    priv data: &'a mut T,
+    data: &'a mut T,
     /// Inner condition variable connected to the locked mutex that this guard
     /// was created from. This can be used for atomic-unlock-and-deschedule.
-    cond: Condvar<'a>,
+    pub cond: Condvar<'a>,
 }
 
 impl<T: Send> Mutex<T> {
@@ -265,25 +265,25 @@ impl<'a, T> DerefMut<T> for MutexGuard<'a, T> {
 /// println!("{}", *val);
 /// ```
 pub struct RWLock<T> {
-    priv lock: raw::RWLock,
-    priv failed: Unsafe<bool>,
-    priv data: Unsafe<T>,
+    lock: raw::RWLock,
+    failed: Unsafe<bool>,
+    data: Unsafe<T>,
 }
 
 /// A guard which is created by locking an rwlock in write mode. Through this
 /// guard the underlying data can be accessed.
 pub struct RWLockWriteGuard<'a, T> {
-    priv data: &'a mut T,
+    data: &'a mut T,
     /// Inner condition variable that can be used to sleep on the write mode of
     /// this rwlock.
-    cond: Condvar<'a>,
+    pub cond: Condvar<'a>,
 }
 
 /// A guard which is created by locking an rwlock in read mode. Through this
 /// guard the underlying data can be accessed.
 pub struct RWLockReadGuard<'a, T> {
-    priv data: &'a T,
-    priv guard: raw::RWLockReadGuard<'a>,
+    data: &'a T,
+    guard: raw::RWLockReadGuard<'a>,
 }
 
 impl<T: Send + Share> RWLock<T> {
@@ -397,8 +397,8 @@ impl<'a, T> DerefMut<T> for RWLockWriteGuard<'a, T> {
 /// }
 /// ```
 pub struct Barrier {
-    priv lock: Mutex<BarrierState>,
-    priv num_tasks: uint,
+    lock: Mutex<BarrierState>,
+    num_tasks: uint,
 }
 
 // The inner state of a double barrier
diff --git a/src/libsync/mpsc_intrusive.rs b/src/libsync/mpsc_intrusive.rs
index 12e8ca48ba1..14dfa8417fa 100644
--- a/src/libsync/mpsc_intrusive.rs
+++ b/src/libsync/mpsc_intrusive.rs
@@ -41,18 +41,18 @@ use std::ty::Unsafe;
 // initialization.
 
 pub struct Node<T> {
-    next: atomics::AtomicUint,
-    data: T,
+    pub next: atomics::AtomicUint,
+    pub data: T,
 }
 
 pub struct DummyNode {
-    next: atomics::AtomicUint,
+    pub next: atomics::AtomicUint,
 }
 
 pub struct Queue<T> {
-    head: atomics::AtomicUint,
-    tail: Unsafe<*mut Node<T>>,
-    stub: DummyNode,
+    pub head: atomics::AtomicUint,
+    pub tail: Unsafe<*mut Node<T>>,
+    pub stub: DummyNode,
 }
 
 impl<T: Send> Queue<T> {
diff --git a/src/libsync/mutex.rs b/src/libsync/mutex.rs
index b01c82eb7ac..e41484c46bd 100644
--- a/src/libsync/mutex.rs
+++ b/src/libsync/mutex.rs
@@ -94,7 +94,7 @@ pub static NATIVE_BLOCKED: uint = 1 << 2;
 /// drop(guard); // unlock the lock
 /// ```
 pub struct Mutex {
-    priv lock: StaticMutex,
+    lock: StaticMutex,
 }
 
 #[deriving(Eq, Show)]
@@ -128,28 +128,28 @@ enum Flavor {
 /// ```
 pub struct StaticMutex {
     /// Current set of flags on this mutex
-    priv state: atomics::AtomicUint,
+    state: atomics::AtomicUint,
     /// an OS mutex used by native threads
-    priv lock: mutex::StaticNativeMutex,
+    lock: mutex::StaticNativeMutex,
 
     /// Type of locking operation currently on this mutex
-    priv flavor: Unsafe<Flavor>,
+    flavor: Unsafe<Flavor>,
     /// uint-cast of the green thread waiting for this mutex
-    priv green_blocker: Unsafe<uint>,
+    green_blocker: Unsafe<uint>,
     /// uint-cast of the native thread waiting for this mutex
-    priv native_blocker: Unsafe<uint>,
+    native_blocker: Unsafe<uint>,
 
     /// A concurrent mpsc queue used by green threads, along with a count used
     /// to figure out when to dequeue and enqueue.
-    priv q: q::Queue<uint>,
-    priv green_cnt: atomics::AtomicUint,
+    q: q::Queue<uint>,
+    green_cnt: atomics::AtomicUint,
 }
 
 /// An RAII implementation of a "scoped lock" of a mutex. When this structure is
 /// dropped (falls out of scope), the lock will be unlocked.
 #[must_use]
 pub struct Guard<'a> {
-    priv lock: &'a StaticMutex,
+    lock: &'a StaticMutex,
 }
 
 /// Static initialization of a mutex. This constant can be used to initialize
diff --git a/src/libsync/one.rs b/src/libsync/one.rs
index 161f759ca2d..7da6f39b840 100644
--- a/src/libsync/one.rs
+++ b/src/libsync/one.rs
@@ -41,9 +41,9 @@ use mutex::{StaticMutex, MUTEX_INIT};
 /// }
 /// ```
 pub struct Once {
-    priv mutex: StaticMutex,
-    priv cnt: atomics::AtomicInt,
-    priv lock_cnt: atomics::AtomicInt,
+    mutex: StaticMutex,
+    cnt: atomics::AtomicInt,
+    lock_cnt: atomics::AtomicInt,
 }
 
 /// Initialization value for static `Once` values.
diff --git a/src/libsync/raw.rs b/src/libsync/raw.rs
index 36f0748fe71..9bb7a81a2ff 100644
--- a/src/libsync/raw.rs
+++ b/src/libsync/raw.rs
@@ -192,7 +192,7 @@ impl Sem<Vec<WaitQueue>> {
     pub fn access_cond<'a>(&'a self) -> SemCondGuard<'a> {
         SemCondGuard {
             guard: self.access(),
-            cvar: Condvar { sem: self, order: Nothing, nopod: marker::NoPod },
+            cvar: Condvar { sem: self, order: Nothing, nocopy: marker::NoCopy },
         }
     }
 }
@@ -209,16 +209,16 @@ enum ReacquireOrderLock<'a> {
 pub struct Condvar<'a> {
     // The 'Sem' object associated with this condvar. This is the one that's
     // atomically-unlocked-and-descheduled upon and reacquired during wakeup.
-    priv sem: &'a Sem<Vec<WaitQueue> >,
+    sem: &'a Sem<Vec<WaitQueue> >,
     // This is (can be) an extra semaphore which is held around the reacquire
     // operation on the first one. This is only used in cvars associated with
     // rwlocks, and is needed to ensure that, when a downgrader is trying to
     // hand off the access lock (which would be the first field, here), a 2nd
     // writer waking up from a cvar wait can't race with a reader to steal it,
     // See the comment in write_cond for more detail.
-    priv order: ReacquireOrderLock<'a>,
+    order: ReacquireOrderLock<'a>,
     // Make sure condvars are non-copyable.
-    priv nopod: marker::NoPod,
+    nocopy: marker::NoCopy,
 }
 
 impl<'a> Condvar<'a> {
@@ -362,14 +362,14 @@ struct SemCondGuard<'a> {
 
 /// A counting, blocking, bounded-waiting semaphore.
 pub struct Semaphore {
-    priv sem: Sem<()>,
+    sem: Sem<()>,
 }
 
 /// An RAII guard used to represent an acquired resource to a semaphore. When
 /// dropped, this value will release the resource back to the semaphore.
 #[must_use]
 pub struct SemaphoreGuard<'a> {
-    priv guard: SemGuard<'a, ()>,
+    guard: SemGuard<'a, ()>,
 }
 
 impl Semaphore {
@@ -404,7 +404,7 @@ impl Semaphore {
 /// A task which fails while holding a mutex will unlock the mutex as it
 /// unwinds.
 pub struct Mutex {
-    priv sem: Sem<Vec<WaitQueue>>,
+    sem: Sem<Vec<WaitQueue>>,
 }
 
 /// An RAII structure which is used to gain access to a mutex's condition
@@ -412,10 +412,10 @@ pub struct Mutex {
 /// corresponding mutex is also unlocked.
 #[must_use]
 pub struct MutexGuard<'a> {
-    priv guard: SemGuard<'a, Vec<WaitQueue>>,
+    guard: SemGuard<'a, Vec<WaitQueue>>,
     /// Inner condition variable which is connected to the outer mutex, and can
     /// be used for atomic-unlock-and-deschedule.
-    cond: Condvar<'a>,
+    pub cond: Condvar<'a>,
 }
 
 impl Mutex {
@@ -452,8 +452,8 @@ impl Mutex {
 /// A task which fails while holding an rwlock will unlock the rwlock as it
 /// unwinds.
 pub struct RWLock {
-    priv order_lock:  Semaphore,
-    priv access_lock: Sem<Vec<WaitQueue>>,
+    order_lock:  Semaphore,
+    access_lock: Sem<Vec<WaitQueue>>,
 
     // The only way the count flag is ever accessed is with xadd. Since it is
     // a read-modify-write operation, multiple xadds on different cores will
@@ -462,14 +462,14 @@ pub struct RWLock {
     //
     // FIXME(#6598): The atomics module has no relaxed ordering flag, so I use
     // acquire/release orderings superfluously. Change these someday.
-    priv read_count: atomics::AtomicUint,
+    read_count: atomics::AtomicUint,
 }
 
 /// An RAII helper which is created by acquiring a read lock on an RWLock. When
 /// dropped, this will unlock the RWLock.
 #[must_use]
 pub struct RWLockReadGuard<'a> {
-    priv lock: &'a RWLock,
+    lock: &'a RWLock,
 }
 
 /// An RAII helper which is created by acquiring a write lock on an RWLock. When
@@ -478,10 +478,10 @@ pub struct RWLockReadGuard<'a> {
 /// A value of this type can also be consumed to downgrade to a read-only lock.
 #[must_use]
 pub struct RWLockWriteGuard<'a> {
-    priv lock: &'a RWLock,
+    lock: &'a RWLock,
     /// Inner condition variable that is connected to the write-mode of the
     /// outer rwlock.
-    cond: Condvar<'a>,
+    pub cond: Condvar<'a>,
 }
 
 impl RWLock {
@@ -565,7 +565,7 @@ impl RWLock {
             cond: Condvar {
                 sem: &self.access_lock,
                 order: Just(&self.order_lock),
-                nopod: marker::NoPod,
+                nocopy: marker::NoCopy,
             }
         }
     }
@@ -836,7 +836,7 @@ mod tests {
         let m = Arc::new(Mutex::new());
         let m2 = m.clone();
 
-        let result: result::Result<(), ~Any> = task::try(proc() {
+        let result: result::Result<(), ~Any:Send> = task::try(proc() {
             let _lock = m2.lock();
             fail!();
         });
@@ -1076,7 +1076,7 @@ mod tests {
         let x = Arc::new(RWLock::new());
         let x2 = x.clone();
 
-        let result: result::Result<(), ~Any> = task::try(proc() {
+        let result: result::Result<(), ~Any:Send> = task::try(proc() {
             lock_rwlock_in_mode(&x2, mode1, || {
                 fail!();
             })
diff --git a/src/libsync/task_pool.rs b/src/libsync/task_pool.rs
index 709dafd5b93..fc249996882 100644
--- a/src/libsync/task_pool.rs
+++ b/src/libsync/task_pool.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 /// A task pool abstraction. Useful for achieving predictable CPU
 /// parallelism.
@@ -16,13 +16,13 @@
 use std::task;
 
 enum Msg<T> {
-    Execute(proc(&T)),
+    Execute(proc:Send(&T)),
     Quit
 }
 
 pub struct TaskPool<T> {
-    priv channels: Vec<Sender<Msg<T>>>,
-    priv next_index: uint,
+    channels: Vec<Sender<Msg<T>>>,
+    next_index: uint,
 }
 
 #[unsafe_destructor]
@@ -41,7 +41,7 @@ impl<T> TaskPool<T> {
     /// returns a function which, given the index of the task, should return
     /// local data to be kept around in that task.
     pub fn new(n_tasks: uint,
-               init_fn_factory: || -> proc(uint) -> T)
+               init_fn_factory: || -> proc:Send(uint) -> T)
                -> TaskPool<T> {
         assert!(n_tasks >= 1);
 
@@ -49,7 +49,7 @@ impl<T> TaskPool<T> {
             let (tx, rx) = channel::<Msg<T>>();
             let init_fn = init_fn_factory();
 
-            let task_body: proc() = proc() {
+            let task_body = proc() {
                 let local_data = init_fn(i);
                 loop {
                     match rx.recv() {
@@ -73,7 +73,7 @@ impl<T> TaskPool<T> {
 
     /// Executes the function `f` on a task in the pool. The function
     /// receives a reference to the local data returned by the `init_fn`.
-    pub fn execute(&mut self, f: proc(&T)) {
+    pub fn execute(&mut self, f: proc:Send(&T)) {
         self.channels.get(self.next_index).send(Execute(f));
         self.next_index += 1;
         if self.next_index == self.channels.len() { self.next_index = 0; }
@@ -82,8 +82,8 @@ impl<T> TaskPool<T> {
 
 #[test]
 fn test_task_pool() {
-    let f: || -> proc(uint) -> uint = || {
-        let g: proc(uint) -> uint = proc(i) i;
+    let f: || -> proc:Send(uint) -> uint = || {
+        let g: proc:Send(uint) -> uint = proc(i) i;
         g
     };
     let mut pool = TaskPool::new(4, f);
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs
index b833eea6b56..17251d31351 100644
--- a/src/libsyntax/abi.rs
+++ b/src/libsyntax/abi.rs
@@ -9,12 +9,11 @@
 // except according to those terms.
 
 use std::fmt;
-use std::fmt::Show;
 
 #[deriving(Eq)]
 pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, }
 
-#[deriving(Eq, TotalEq, Hash)]
+#[deriving(Eq, TotalEq, Hash, Encodable, Decodable, Clone)]
 pub enum Abi {
     // NB: This ordering MUST match the AbiDatas array below.
     // (This is ensured by the test indices_are_correct().)
@@ -65,11 +64,6 @@ pub enum AbiArchitecture {
     Archs(u32)  // Multiple architectures (bitset)
 }
 
-#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
-pub struct AbiSet {
-    priv bits: u32   // each bit represents one of the abis below
-}
-
 static AbiDatas: &'static [AbiData] = &[
     // Platform-specific ABIs
     AbiData {abi: Cdecl, name: "cdecl", abi_arch: Archs(IntelBits)},
@@ -136,12 +130,20 @@ impl Abi {
         self.data().name
     }
 
-    pub fn for_target(&self, os: Os, arch: Architecture) -> Abi {
-        match (*self, os, arch) {
+    pub fn for_target(&self, os: Os, arch: Architecture) -> Option<Abi> {
+        // If this ABI isn't actually for the specified architecture, then we
+        // short circuit early
+        match self.data().abi_arch {
+            Archs(a) if a & arch.bit() == 0 => return None,
+            Archs(_) | RustArch | AllArch => {}
+        }
+        // Transform this ABI as appropriate for the requested os/arch
+        // combination.
+        Some(match (*self, os, arch) {
             (System, OsWin32, X86) => Stdcall,
             (System, _, _) => C,
             (me, _, _) => me,
-        }
+        })
     }
 }
 
@@ -151,138 +153,9 @@ impl Architecture {
     }
 }
 
-impl AbiSet {
-    pub fn from(abi: Abi) -> AbiSet {
-        AbiSet { bits: (1 << abi.index()) }
-    }
-
-    #[inline]
-    pub fn Rust() -> AbiSet {
-        AbiSet::from(Rust)
-    }
-
-    #[inline]
-    pub fn C() -> AbiSet {
-        AbiSet::from(C)
-    }
-
-    #[inline]
-    pub fn Intrinsic() -> AbiSet {
-        AbiSet::from(RustIntrinsic)
-    }
-
-    pub fn default() -> AbiSet {
-        AbiSet::C()
-    }
-
-    pub fn empty() -> AbiSet {
-        AbiSet { bits: 0 }
-    }
-
-    #[inline]
-    pub fn is_rust(&self) -> bool {
-        self.bits == 1 << Rust.index()
-    }
-
-    #[inline]
-    pub fn is_c(&self) -> bool {
-        self.bits == 1 << C.index()
-    }
-
-    #[inline]
-    pub fn is_intrinsic(&self) -> bool {
-        self.bits == 1 << RustIntrinsic.index()
-    }
-
-    pub fn contains(&self, abi: Abi) -> bool {
-        (self.bits & (1 << abi.index())) != 0
-    }
-
-    pub fn subset_of(&self, other_abi_set: AbiSet) -> bool {
-        (self.bits & other_abi_set.bits) == self.bits
-    }
-
-    pub fn add(&mut self, abi: Abi) {
-        self.bits |= 1 << abi.index();
-    }
-
-    pub fn each(&self, op: |abi: Abi| -> bool) -> bool {
-        each_abi(|abi| !self.contains(abi) || op(abi))
-    }
-
-    pub fn is_empty(&self) -> bool {
-        self.bits == 0
-    }
-
-    pub fn for_target(&self, os: Os, arch: Architecture) -> Option<Abi> {
-        // NB---Single platform ABIs come first
-
-        let mut res = None;
-
-        self.each(|abi| {
-            let data = abi.data();
-            match data.abi_arch {
-                Archs(a) if (a & arch.bit()) != 0 => { res = Some(abi); false }
-                Archs(_) => { true }
-                RustArch | AllArch => { res = Some(abi); false }
-            }
-        });
-
-        res.map(|r| r.for_target(os, arch))
-    }
-
-    pub fn check_valid(&self) -> Option<(Abi, Abi)> {
-        let mut abis = Vec::new();
-        self.each(|abi| { abis.push(abi); true });
-
-        for (i, abi) in abis.iter().enumerate() {
-            let data = abi.data();
-            for other_abi in abis.slice(0, i).iter() {
-                let other_data = other_abi.data();
-                debug!("abis=({:?},{:?}) datas=({:?},{:?})",
-                       abi, data.abi_arch,
-                       other_abi, other_data.abi_arch);
-                match (&data.abi_arch, &other_data.abi_arch) {
-                    (&AllArch, &AllArch) => {
-                        // Two cross-architecture ABIs
-                        return Some((*abi, *other_abi));
-                    }
-                    (_, &RustArch) |
-                    (&RustArch, _) => {
-                        // Cannot combine Rust or Rust-Intrinsic with
-                        // anything else.
-                        return Some((*abi, *other_abi));
-                    }
-                    (&Archs(is), &Archs(js)) if (is & js) != 0 => {
-                        // Two ABIs for same architecture
-                        return Some((*abi, *other_abi));
-                    }
-                    _ => {}
-                }
-            }
-        }
-
-        return None;
-    }
-}
-
 impl fmt::Show for Abi {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        self.data().name.fmt(f)
-    }
-}
-
-impl fmt::Show for AbiSet {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f.buf, "\""));
-        let mut first = true;
-        self.each(|abi| {
-            if first { first = false; }
-            else { let _ = write!(f.buf, " "); }
-            let _ = write!(f.buf, "{}", abi.data().name);
-            true
-        });
-        write!(f.buf, "\"")
+        write!(f.buf, "\"{}\"", self.name())
     }
 }
 
@@ -304,95 +177,6 @@ fn lookup_baz() {
     assert!(abi.is_none());
 }
 
-#[cfg(test)]
-fn cannot_combine(n: Abi, m: Abi) {
-    let mut set = AbiSet::empty();
-    set.add(n);
-    set.add(m);
-    match set.check_valid() {
-        Some((a, b)) => {
-            assert!((n == a && m == b) ||
-                         (m == a && n == b));
-        }
-        None => {
-            fail!("invalid match not detected");
-        }
-    }
-}
-
-#[cfg(test)]
-fn can_combine(n: Abi, m: Abi) {
-    let mut set = AbiSet::empty();
-    set.add(n);
-    set.add(m);
-    match set.check_valid() {
-        Some((_, _)) => {
-            fail!("valid match declared invalid");
-        }
-        None => {}
-    }
-}
-
-#[test]
-fn cannot_combine_cdecl_and_stdcall() {
-    cannot_combine(Cdecl, Stdcall);
-}
-
-#[test]
-fn cannot_combine_c_and_rust() {
-    cannot_combine(C, Rust);
-}
-
-#[test]
-fn cannot_combine_rust_and_cdecl() {
-    cannot_combine(Rust, Cdecl);
-}
-
-#[test]
-fn cannot_combine_rust_intrinsic_and_cdecl() {
-    cannot_combine(RustIntrinsic, Cdecl);
-}
-
-#[test]
-fn can_combine_system_and_cdecl() {
-    can_combine(System, Cdecl);
-}
-
-#[test]
-fn can_combine_c_and_stdcall() {
-    can_combine(C, Stdcall);
-}
-
-#[test]
-fn can_combine_aapcs_and_stdcall() {
-    can_combine(Aapcs, Stdcall);
-}
-
-#[test]
-fn abi_to_str_stdcall_aaps() {
-    let mut set = AbiSet::empty();
-    set.add(Aapcs);
-    set.add(Stdcall);
-    assert!(set.to_str() == ~"\"stdcall aapcs\"");
-}
-
-#[test]
-fn abi_to_str_c_aaps() {
-    let mut set = AbiSet::empty();
-    set.add(Aapcs);
-    set.add(C);
-    debug!("set = {}", set.to_str());
-    assert!(set.to_str() == ~"\"aapcs C\"");
-}
-
-#[test]
-fn abi_to_str_rust() {
-    let mut set = AbiSet::empty();
-    set.add(Rust);
-    debug!("set = {}", set.to_str());
-    assert!(set.to_str() == ~"\"Rust\"");
-}
-
 #[test]
 fn indices_are_correct() {
     for (i, abi_data) in AbiDatas.iter().enumerate() {
@@ -407,30 +191,14 @@ fn indices_are_correct() {
     assert_eq!(ArmBits, bits);
 }
 
-#[cfg(test)]
-fn get_arch(abis: &[Abi], os: Os, arch: Architecture) -> Option<Abi> {
-    let mut set = AbiSet::empty();
-    for &abi in abis.iter() {
-        set.add(abi);
-    }
-    set.for_target(os, arch)
-}
-
-#[test]
-fn pick_multiplatform() {
-    assert_eq!(get_arch([C, Cdecl], OsLinux, X86), Some(Cdecl));
-    assert_eq!(get_arch([C, Cdecl], OsLinux, X86_64), Some(Cdecl));
-    assert_eq!(get_arch([C, Cdecl], OsLinux, Arm), Some(C));
-}
-
 #[test]
 fn pick_uniplatform() {
-    assert_eq!(get_arch([Stdcall], OsLinux, X86), Some(Stdcall));
-    assert_eq!(get_arch([Stdcall], OsLinux, Arm), None);
-    assert_eq!(get_arch([System], OsLinux, X86), Some(C));
-    assert_eq!(get_arch([System], OsWin32, X86), Some(Stdcall));
-    assert_eq!(get_arch([System], OsWin32, X86_64), Some(C));
-    assert_eq!(get_arch([System], OsWin32, Arm), Some(C));
-    assert_eq!(get_arch([Stdcall], OsWin32, X86), Some(Stdcall));
-    assert_eq!(get_arch([Stdcall], OsWin32, X86_64), Some(Stdcall));
+    assert_eq!(Stdcall.for_target(OsLinux, X86), Some(Stdcall));
+    assert_eq!(Stdcall.for_target(OsLinux, Arm), None);
+    assert_eq!(System.for_target(OsLinux, X86), Some(C));
+    assert_eq!(System.for_target(OsWin32, X86), Some(Stdcall));
+    assert_eq!(System.for_target(OsWin32, X86_64), Some(C));
+    assert_eq!(System.for_target(OsWin32, Arm), Some(C));
+    assert_eq!(Stdcall.for_target(OsWin32, X86), Some(Stdcall));
+    assert_eq!(Stdcall.for_target(OsWin32, X86_64), Some(Stdcall));
 }
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 24b8a345776..6a5acff3fe0 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -11,7 +11,7 @@
 // The Rust abstract syntax tree.
 
 use codemap::{Span, Spanned, DUMMY_SP};
-use abi::AbiSet;
+use abi::Abi;
 use ast_util;
 use owned_slice::OwnedSlice;
 use parse::token::{InternedString, special_idents, str_to_ident};
@@ -40,8 +40,8 @@ pub fn P<T: 'static>(value: T) -> P<T> {
 // That Work Together"
 #[deriving(Clone, Hash, Ord, TotalEq, TotalOrd, Show)]
 pub struct Ident {
-    name: Name,
-    ctxt: SyntaxContext
+    pub name: Name,
+    pub ctxt: SyntaxContext
 }
 
 impl Ident {
@@ -98,15 +98,15 @@ pub type Name = u32;
 /// A mark represents a unique id associated with a macro expansion
 pub type Mrk = u32;
 
-impl<S: Encoder> Encodable<S> for Ident {
-    fn encode(&self, s: &mut S) {
-        s.emit_str(token::get_ident(*self).get());
+impl<S: Encoder<E>, E> Encodable<S, E> for Ident {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
+        s.emit_str(token::get_ident(*self).get())
     }
 }
 
-impl<D:Decoder> Decodable<D> for Ident {
-    fn decode(d: &mut D) -> Ident {
-        str_to_ident(d.read_str())
+impl<D:Decoder<E>, E> Decodable<D, E> for Ident {
+    fn decode(d: &mut D) -> Result<Ident, E> {
+        Ok(str_to_ident(try!(d.read_str())))
     }
 }
 
@@ -115,9 +115,9 @@ pub type FnIdent = Option<Ident>;
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Lifetime {
-    id: NodeId,
-    span: Span,
-    name: Name
+    pub id: NodeId,
+    pub span: Span,
+    pub name: Name
 }
 
 // a "Path" is essentially Rust's notion of a name;
@@ -126,12 +126,12 @@ pub struct Lifetime {
 // of supporting information.
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Path {
-    span: Span,
+    pub span: Span,
     /// A `::foo` path, is relative to the crate root rather than current
     /// module (like paths in an import).
-    global: bool,
+    pub global: bool,
     /// The segments in the path: the things separated by `::`.
-    segments: Vec<PathSegment> ,
+    pub segments: Vec<PathSegment> ,
 }
 
 /// A segment of a path: an identifier, an optional lifetime, and a set of
@@ -139,11 +139,11 @@ pub struct Path {
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct PathSegment {
     /// The identifier portion of this path segment.
-    identifier: Ident,
+    pub identifier: Ident,
     /// The lifetime parameters for this path segment.
-    lifetimes: Vec<Lifetime>,
+    pub lifetimes: Vec<Lifetime>,
     /// The type parameters for this path segment, if present.
-    types: OwnedSlice<P<Ty>>,
+    pub types: OwnedSlice<P<Ty>>,
 }
 
 pub type CrateNum = u32;
@@ -152,8 +152,8 @@ pub type NodeId = u32;
 
 #[deriving(Clone, TotalEq, TotalOrd, Ord, Eq, Encodable, Decodable, Hash, Show)]
 pub struct DefId {
-    krate: CrateNum,
-    node: NodeId,
+    pub krate: CrateNum,
+    pub node: NodeId,
 }
 
 /// Item definitions in the currently-compiled crate would have the CrateNum
@@ -178,16 +178,16 @@ pub enum TyParamBound {
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct TyParam {
-    ident: Ident,
-    id: NodeId,
-    bounds: OwnedSlice<TyParamBound>,
-    default: Option<P<Ty>>
+    pub ident: Ident,
+    pub id: NodeId,
+    pub bounds: OwnedSlice<TyParamBound>,
+    pub default: Option<P<Ty>>
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Generics {
-    lifetimes: Vec<Lifetime>,
-    ty_params: OwnedSlice<TyParam>,
+    pub lifetimes: Vec<Lifetime>,
+    pub ty_params: OwnedSlice<TyParam>,
 }
 
 impl Generics {
@@ -259,10 +259,10 @@ pub type CrateConfig = Vec<@MetaItem> ;
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Crate {
-    module: Mod,
-    attrs: Vec<Attribute> ,
-    config: CrateConfig,
-    span: Span,
+    pub module: Mod,
+    pub attrs: Vec<Attribute>,
+    pub config: CrateConfig,
+    pub span: Span,
 }
 
 pub type MetaItem = Spanned<MetaItem_>;
@@ -301,25 +301,25 @@ impl Eq for MetaItem_ {
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Block {
-    view_items: Vec<ViewItem> ,
-    stmts: Vec<@Stmt> ,
-    expr: Option<@Expr>,
-    id: NodeId,
-    rules: BlockCheckMode,
-    span: Span,
+    pub view_items: Vec<ViewItem>,
+    pub stmts: Vec<@Stmt>,
+    pub expr: Option<@Expr>,
+    pub id: NodeId,
+    pub rules: BlockCheckMode,
+    pub span: Span,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Pat {
-    id: NodeId,
-    node: Pat_,
-    span: Span,
+    pub id: NodeId,
+    pub node: Pat_,
+    pub span: Span,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct FieldPat {
-    ident: Ident,
-    pat: @Pat,
+    pub ident: Ident,
+    pub pat: @Pat,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@@ -436,11 +436,11 @@ pub enum Stmt_ {
 /// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Local {
-    ty: P<Ty>,
-    pat: @Pat,
-    init: Option<@Expr>,
-    id: NodeId,
-    span: Span,
+    pub ty: P<Ty>,
+    pub pat: @Pat,
+    pub init: Option<@Expr>,
+    pub id: NodeId,
+    pub span: Span,
 }
 
 pub type Decl = Spanned<Decl_>;
@@ -455,16 +455,16 @@ pub enum Decl_ {
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Arm {
-    pats: Vec<@Pat> ,
-    guard: Option<@Expr>,
-    body: @Expr,
+    pub pats: Vec<@Pat>,
+    pub guard: Option<@Expr>,
+    pub body: @Expr,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Field {
-    ident: SpannedIdent,
-    expr: @Expr,
-    span: Span,
+    pub ident: SpannedIdent,
+    pub expr: @Expr,
+    pub span: Span,
 }
 
 pub type SpannedIdent = Spanned<Ident>;
@@ -483,9 +483,9 @@ pub enum UnsafeSource {
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Expr {
-    id: NodeId,
-    node: Expr_,
-    span: Span,
+    pub id: NodeId,
+    pub node: Expr_,
+    pub span: Span,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@@ -493,10 +493,10 @@ pub enum Expr_ {
     ExprVstore(@Expr, ExprVstore),
     // First expr is the place; second expr is the value.
     ExprBox(@Expr, @Expr),
-    ExprVec(Vec<@Expr> , Mutability),
-    ExprCall(@Expr, Vec<@Expr> ),
-    ExprMethodCall(Ident, Vec<P<Ty>> , Vec<@Expr> ),
-    ExprTup(Vec<@Expr> ),
+    ExprVec(Vec<@Expr>),
+    ExprCall(@Expr, Vec<@Expr>),
+    ExprMethodCall(Ident, Vec<P<Ty>>, Vec<@Expr>),
+    ExprTup(Vec<@Expr>),
     ExprBinary(BinOp, @Expr, @Expr),
     ExprUnary(UnOp, @Expr),
     ExprLit(@Lit),
@@ -508,14 +508,14 @@ pub enum Expr_ {
     // Conditionless loop (can be exited with break, cont, or ret)
     // FIXME #6993: change to Option<Name>
     ExprLoop(P<Block>, Option<Ident>),
-    ExprMatch(@Expr, Vec<Arm> ),
+    ExprMatch(@Expr, Vec<Arm>),
     ExprFnBlock(P<FnDecl>, P<Block>),
     ExprProc(P<FnDecl>, P<Block>),
     ExprBlock(P<Block>),
 
     ExprAssign(@Expr, @Expr),
     ExprAssignOp(BinOp, @Expr, @Expr),
-    ExprField(@Expr, Ident, Vec<P<Ty>> ),
+    ExprField(@Expr, Ident, Vec<P<Ty>>),
     ExprIndex(@Expr, @Expr),
 
     /// Expression that looks like a "name". For example,
@@ -536,7 +536,7 @@ pub enum Expr_ {
     ExprStruct(Path, Vec<Field> , Option<@Expr> /* base */),
 
     // A vector literal constructed from one repeated element.
-    ExprRepeat(@Expr /* element */, @Expr /* count */, Mutability),
+    ExprRepeat(@Expr /* element */, @Expr /* count */),
 
     // No-op: used solely so we can pretty-print faithfully
     ExprParen(@Expr)
@@ -564,14 +564,16 @@ pub enum TokenTree {
     TTTok(Span, ::parse::token::Token),
     // a delimited sequence (the delimiters appear as the first
     // and last elements of the vector)
-    TTDelim(@Vec<TokenTree> ),
+    // FIXME(eddyb) #6308 Use Rc<[TokenTree]> after DST.
+    TTDelim(Rc<Vec<TokenTree>>),
 
     // These only make sense for right-hand-sides of MBE macros:
 
     // a kleene-style repetition sequence with a span, a TTForest,
     // an optional separator, and a boolean where true indicates
     // zero or more (..), and false indicates one or more (+).
-    TTSeq(Span, @Vec<TokenTree> , Option<::parse::token::Token>, bool),
+    // FIXME(eddyb) #6308 Use Rc<[TokenTree]> after DST.
+    TTSeq(Span, Rc<Vec<TokenTree>>, Option<::parse::token::Token>, bool),
 
     // a syntactic variable that will be filled in by macro expansion.
     TTNonterminal(Span, Ident)
@@ -679,27 +681,27 @@ pub enum Lit_ {
 // type structure in middle/ty.rs as well.
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct MutTy {
-    ty: P<Ty>,
-    mutbl: Mutability,
+    pub ty: P<Ty>,
+    pub mutbl: Mutability,
 }
 
 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct TypeField {
-    ident: Ident,
-    mt: MutTy,
-    span: Span,
+    pub ident: Ident,
+    pub mt: MutTy,
+    pub span: Span,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct TypeMethod {
-    ident: Ident,
-    attrs: Vec<Attribute> ,
-    purity: Purity,
-    decl: P<FnDecl>,
-    generics: Generics,
-    explicit_self: ExplicitSelf,
-    id: NodeId,
-    span: Span,
+    pub ident: Ident,
+    pub attrs: Vec<Attribute>,
+    pub purity: Purity,
+    pub decl: P<FnDecl>,
+    pub generics: Generics,
+    pub explicit_self: ExplicitSelf,
+    pub id: NodeId,
+    pub span: Span,
 }
 
 // A trait method is either required (meaning it doesn't have an
@@ -756,9 +758,9 @@ impl fmt::Show for FloatTy {
 // NB Eq method appears below.
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Ty {
-    id: NodeId,
-    node: Ty_,
-    span: Span,
+    pub id: NodeId,
+    pub node: Ty_,
+    pub span: Span,
 }
 
 // Not represented directly in the AST, referred to by name through a ty_path.
@@ -789,25 +791,25 @@ impl fmt::Show for Onceness {
 
 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct ClosureTy {
-    sigil: Sigil,
-    region: Option<Lifetime>,
-    lifetimes: Vec<Lifetime>,
-    purity: Purity,
-    onceness: Onceness,
-    decl: P<FnDecl>,
+    pub sigil: Sigil,
+    pub region: Option<Lifetime>,
+    pub lifetimes: Vec<Lifetime>,
+    pub purity: Purity,
+    pub onceness: Onceness,
+    pub decl: P<FnDecl>,
     // Optional optvec distinguishes between "fn()" and "fn:()" so we can
     // implement issue #7264. None means "fn()", which means infer a default
     // bound based on pointer sigil during typeck. Some(Empty) means "fn:()",
     // which means use no bounds (e.g., not even Owned on a ~fn()).
-    bounds: Option<OwnedSlice<TyParamBound>>,
+    pub bounds: Option<OwnedSlice<TyParamBound>>,
 }
 
 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct BareFnTy {
-    purity: Purity,
-    abis: AbiSet,
-    lifetimes: Vec<Lifetime>,
-    decl: P<FnDecl>
+    pub purity: Purity,
+    pub abi: Abi,
+    pub lifetimes: Vec<Lifetime>,
+    pub decl: P<FnDecl>
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@@ -838,21 +840,21 @@ pub enum AsmDialect {
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct InlineAsm {
-    asm: InternedString,
-    asm_str_style: StrStyle,
-    clobbers: InternedString,
-    inputs: Vec<(InternedString, @Expr)> ,
-    outputs: Vec<(InternedString, @Expr)> ,
-    volatile: bool,
-    alignstack: bool,
-    dialect: AsmDialect
+    pub asm: InternedString,
+    pub asm_str_style: StrStyle,
+    pub clobbers: InternedString,
+    pub inputs: Vec<(InternedString, @Expr)>,
+    pub outputs: Vec<(InternedString, @Expr)>,
+    pub volatile: bool,
+    pub alignstack: bool,
+    pub dialect: AsmDialect
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Arg {
-    ty: P<Ty>,
-    pat: @Pat,
-    id: NodeId,
+    pub ty: P<Ty>,
+    pub pat: @Pat,
+    pub id: NodeId,
 }
 
 impl Arg {
@@ -877,10 +879,10 @@ impl Arg {
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct FnDecl {
-    inputs: Vec<Arg> ,
-    output: P<Ty>,
-    cf: RetStyle,
-    variadic: bool
+    pub inputs: Vec<Arg>,
+    pub output: P<Ty>,
+    pub cf: RetStyle,
+    pub variadic: bool
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@@ -919,64 +921,64 @@ pub type ExplicitSelf = Spanned<ExplicitSelf_>;
 
 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Method {
-    ident: Ident,
-    attrs: Vec<Attribute> ,
-    generics: Generics,
-    explicit_self: ExplicitSelf,
-    purity: Purity,
-    decl: P<FnDecl>,
-    body: P<Block>,
-    id: NodeId,
-    span: Span,
-    vis: Visibility,
+    pub ident: Ident,
+    pub attrs: Vec<Attribute>,
+    pub generics: Generics,
+    pub explicit_self: ExplicitSelf,
+    pub purity: Purity,
+    pub decl: P<FnDecl>,
+    pub body: P<Block>,
+    pub id: NodeId,
+    pub span: Span,
+    pub vis: Visibility,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Mod {
-    view_items: Vec<ViewItem> ,
-    items: Vec<@Item> ,
+    pub view_items: Vec<ViewItem> ,
+    pub items: Vec<@Item> ,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct ForeignMod {
-    abis: AbiSet,
-    view_items: Vec<ViewItem> ,
-    items: Vec<@ForeignItem> ,
+    pub abi: Abi,
+    pub view_items: Vec<ViewItem>,
+    pub items: Vec<@ForeignItem>,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct VariantArg {
-    ty: P<Ty>,
-    id: NodeId,
+    pub ty: P<Ty>,
+    pub id: NodeId,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub enum VariantKind {
-    TupleVariantKind(Vec<VariantArg> ),
+    TupleVariantKind(Vec<VariantArg>),
     StructVariantKind(@StructDef),
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct EnumDef {
-    variants: Vec<P<Variant>> ,
+    pub variants: Vec<P<Variant>>,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Variant_ {
-    name: Ident,
-    attrs: Vec<Attribute> ,
-    kind: VariantKind,
-    id: NodeId,
-    disr_expr: Option<@Expr>,
-    vis: Visibility,
+    pub name: Ident,
+    pub attrs: Vec<Attribute>,
+    pub kind: VariantKind,
+    pub id: NodeId,
+    pub disr_expr: Option<@Expr>,
+    pub vis: Visibility,
 }
 
 pub type Variant = Spanned<Variant_>;
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct PathListIdent_ {
-    name: Ident,
-    id: NodeId,
+    pub name: Ident,
+    pub id: NodeId,
 }
 
 pub type PathListIdent = Spanned<PathListIdent_>;
@@ -1002,10 +1004,10 @@ pub enum ViewPath_ {
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct ViewItem {
-    node: ViewItem_,
-    attrs: Vec<Attribute> ,
-    vis: Visibility,
-    span: Span,
+    pub node: ViewItem_,
+    pub attrs: Vec<Attribute>,
+    pub vis: Visibility,
+    pub span: Span,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@@ -1033,9 +1035,9 @@ pub enum AttrStyle {
 // doc-comments are promoted to attributes that have is_sugared_doc = true
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Attribute_ {
-    style: AttrStyle,
-    value: @MetaItem,
-    is_sugared_doc: bool,
+    pub style: AttrStyle,
+    pub value: @MetaItem,
+    pub is_sugared_doc: bool,
 }
 
 /*
@@ -1047,8 +1049,8 @@ pub struct Attribute_ {
  */
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct TraitRef {
-    path: Path,
-    ref_id: NodeId,
+    pub path: Path,
+    pub ref_id: NodeId,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@@ -1069,10 +1071,10 @@ impl Visibility {
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct StructField_ {
-    kind: StructFieldKind,
-    id: NodeId,
-    ty: P<Ty>,
-    attrs: Vec<Attribute> ,
+    pub kind: StructFieldKind,
+    pub id: NodeId,
+    pub ty: P<Ty>,
+    pub attrs: Vec<Attribute>,
 }
 
 pub type StructField = Spanned<StructField_>;
@@ -1080,15 +1082,24 @@ pub type StructField = Spanned<StructField_>;
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub enum StructFieldKind {
     NamedField(Ident, Visibility),
-    UnnamedField // element of a tuple-like struct
+    UnnamedField(Visibility), // element of a tuple-like struct
+}
+
+impl StructFieldKind {
+    pub fn is_unnamed(&self) -> bool {
+        match *self {
+            UnnamedField(..) => true,
+            NamedField(..) => false,
+        }
+    }
 }
 
 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct StructDef {
-    fields: Vec<StructField> , /* fields, not including ctor */
+    pub fields: Vec<StructField>, /* fields, not including ctor */
     /* ID of the constructor. This is only used for tuple- or enum-like
      * structs. */
-    ctor_id: Option<NodeId>
+    pub ctor_id: Option<NodeId>
 }
 
 /*
@@ -1097,18 +1108,18 @@ pub struct StructDef {
  */
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Item {
-    ident: Ident,
-    attrs: Vec<Attribute> ,
-    id: NodeId,
-    node: Item_,
-    vis: Visibility,
-    span: Span,
+    pub ident: Ident,
+    pub attrs: Vec<Attribute>,
+    pub id: NodeId,
+    pub node: Item_,
+    pub vis: Visibility,
+    pub span: Span,
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub enum Item_ {
     ItemStatic(P<Ty>, Mutability, @Expr),
-    ItemFn(P<FnDecl>, Purity, AbiSet, Generics, P<Block>),
+    ItemFn(P<FnDecl>, Purity, Abi, Generics, P<Block>),
     ItemMod(Mod),
     ItemForeignMod(ForeignMod),
     ItemTy(P<Ty>, Generics),
@@ -1125,12 +1136,12 @@ pub enum Item_ {
 
 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct ForeignItem {
-    ident: Ident,
-    attrs: Vec<Attribute> ,
-    node: ForeignItem_,
-    id: NodeId,
-    span: Span,
-    vis: Visibility,
+    pub ident: Ident,
+    pub attrs: Vec<Attribute>,
+    pub node: ForeignItem_,
+    pub id: NodeId,
+    pub span: Span,
+    pub vis: Visibility,
 }
 
 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
@@ -1159,6 +1170,7 @@ mod test {
     // are ASTs encodable?
     #[test]
     fn check_asts_encodable() {
+        use std::io;
         let e = Crate {
             module: Mod {view_items: Vec::new(), items: Vec::new()},
             attrs: Vec::new(),
@@ -1170,6 +1182,6 @@ mod test {
             },
         };
         // doesn't matter which encoder we use....
-        let _f = &e as &serialize::Encodable<json::Encoder>;
+        let _f = &e as &serialize::Encodable<json::Encoder, io::IoError>;
     }
 }
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index 90c23a54426..cf584ff62ac 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use abi::AbiSet;
+use abi;
 use ast::*;
 use ast_util;
 use codemap::Span;
@@ -66,9 +66,9 @@ impl<'a> Iterator<PathElem> for LinkedPath<'a> {
 
 // HACK(eddyb) move this into libstd (value wrapper for slice::Items).
 #[deriving(Clone)]
-pub struct Values<'a, T>(slice::Items<'a, T>);
+pub struct Values<'a, T>(pub slice::Items<'a, T>);
 
-impl<'a, T: Pod> Iterator<T> for Values<'a, T> {
+impl<'a, T: Copy> Iterator<T> for Values<'a, T> {
     fn next(&mut self) -> Option<T> {
         let &Values(ref mut items) = self;
         items.next().map(|&x| x)
@@ -184,7 +184,7 @@ pub struct Map {
     ///
     /// Also, indexing is pretty quick when you've got a vector and
     /// plain old integers.
-    priv map: RefCell<Vec<MapEntry> >
+    map: RefCell<Vec<MapEntry> >
 }
 
 impl Map {
@@ -224,19 +224,19 @@ impl Map {
         }
     }
 
-    pub fn get_foreign_abis(&self, id: NodeId) -> AbiSet {
+    pub fn get_foreign_abi(&self, id: NodeId) -> abi::Abi {
         let parent = self.get_parent(id);
-        let abis = match self.find_entry(parent) {
+        let abi = match self.find_entry(parent) {
             Some(EntryItem(_, i)) => match i.node {
-                ItemForeignMod(ref nm) => Some(nm.abis),
+                ItemForeignMod(ref nm) => Some(nm.abi),
                 _ => None
             },
             // Wrong but OK, because the only inlined foreign items are intrinsics.
-            Some(RootInlinedParent(_)) => Some(AbiSet::Intrinsic()),
+            Some(RootInlinedParent(_)) => Some(abi::RustIntrinsic),
             _ => None
         };
-        match abis {
-            Some(abis) => abis,
+        match abi {
+            Some(abi) => abi,
             None => fail!("expected foreign mod or inlined parent, found {}",
                           self.node_to_str(parent))
         }
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 9d841255aa9..631489a65b2 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -25,9 +25,9 @@ use std::u32;
 
 pub fn path_name_i(idents: &[Ident]) -> ~str {
     // FIXME: Bad copies (#2543 -- same for everything else that says "bad")
-    idents.map(|i| {
+    idents.iter().map(|i| {
         token::get_ident(*i).get().to_str()
-    }).connect("::")
+    }).collect::<Vec<~str>>().connect("::")
 }
 
 // totally scary function: ignores all but the last element, should have
@@ -290,8 +290,7 @@ pub fn split_trait_methods(trait_methods: &[TraitMethod])
 
 pub fn struct_field_visibility(field: ast::StructField) -> Visibility {
     match field.node.kind {
-        ast::NamedField(_, visibility) => visibility,
-        ast::UnnamedField => ast::Public
+        ast::NamedField(_, v) | ast::UnnamedField(v) => v
     }
 }
 
@@ -326,8 +325,8 @@ pub fn empty_generics() -> Generics {
 
 #[deriving(Encodable, Decodable)]
 pub struct IdRange {
-    min: NodeId,
-    max: NodeId,
+    pub min: NodeId,
+    pub max: NodeId,
 }
 
 impl IdRange {
@@ -353,9 +352,9 @@ pub trait IdVisitingOperation {
 }
 
 pub struct IdVisitor<'a, O> {
-    operation: &'a O,
-    pass_through_items: bool,
-    visited_outermost: bool,
+    pub operation: &'a O,
+    pub pass_through_items: bool,
+    pub visited_outermost: bool,
 }
 
 impl<'a, O: IdVisitingOperation> IdVisitor<'a, O> {
@@ -718,13 +717,15 @@ mod test {
     }
 
     #[test] fn idents_name_eq_test() {
-        assert!(segments_name_eq([Ident{name:3,ctxt:4},
-                                   Ident{name:78,ctxt:82}].map(ident_to_segment),
-                                 [Ident{name:3,ctxt:104},
-                                   Ident{name:78,ctxt:182}].map(ident_to_segment)));
-        assert!(!segments_name_eq([Ident{name:3,ctxt:4},
-                                    Ident{name:78,ctxt:82}].map(ident_to_segment),
-                                  [Ident{name:3,ctxt:104},
-                                    Ident{name:77,ctxt:182}].map(ident_to_segment)));
+        assert!(segments_name_eq(
+            [Ident{name:3,ctxt:4}, Ident{name:78,ctxt:82}]
+                .iter().map(ident_to_segment).collect::<Vec<PathSegment>>().as_slice(),
+            [Ident{name:3,ctxt:104}, Ident{name:78,ctxt:182}]
+                .iter().map(ident_to_segment).collect::<Vec<PathSegment>>().as_slice()));
+        assert!(!segments_name_eq(
+            [Ident{name:3,ctxt:4}, Ident{name:78,ctxt:82}]
+                .iter().map(ident_to_segment).collect::<Vec<PathSegment>>().as_slice(),
+            [Ident{name:3,ctxt:104}, Ident{name:77,ctxt:182}]
+                .iter().map(ident_to_segment).collect::<Vec<PathSegment>>().as_slice()));
     }
 }
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index ff9f9dece95..0c0d7bbb535 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -337,8 +337,8 @@ pub fn test_cfg<AM: AttrMetaMethods, It: Iterator<AM>>
 
 /// Represents the #[deprecated="foo"] (etc) attributes.
 pub struct Stability {
-    level: StabilityLevel,
-    text: Option<InternedString>
+    pub level: StabilityLevel,
+    pub text: Option<InternedString>
 }
 
 /// The available stability levels.
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 4a9e53c63e7..7cadce54765 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -33,13 +33,13 @@ pub trait Pos {
 /// A byte offset. Keep this small (currently 32-bits), as AST contains
 /// a lot of them.
 #[deriving(Clone, Eq, TotalEq, Hash, Ord, Show)]
-pub struct BytePos(u32);
+pub struct BytePos(pub u32);
 
 /// A character offset. Because of multibyte utf8 characters, a byte offset
 /// is not equivalent to a character offset. The CodeMap will convert BytePos
 /// values to CharPos values as necessary.
 #[deriving(Eq, Hash, Ord, Show)]
-pub struct CharPos(uint);
+pub struct CharPos(pub uint);
 
 // FIXME: Lots of boilerplate in these impls, but so far my attempts to fix
 // have been unsuccessful
@@ -86,19 +86,19 @@ to the original source.
 */
 #[deriving(Clone, Show, Hash)]
 pub struct Span {
-    lo: BytePos,
-    hi: BytePos,
+    pub lo: BytePos,
+    pub hi: BytePos,
     /// Information about where the macro came from, if this piece of
     /// code was created by a macro expansion.
-    expn_info: Option<@ExpnInfo>
+    pub expn_info: Option<@ExpnInfo>
 }
 
 pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_info: None };
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct Spanned<T> {
-    node: T,
-    span: Span,
+    pub node: T,
+    pub span: Span,
 }
 
 impl Eq for Span {
@@ -110,16 +110,16 @@ impl Eq for Span {
 
 impl TotalEq for Span {}
 
-impl<S:Encoder> Encodable<S> for Span {
+impl<S:Encoder<E>, E> Encodable<S, E> for Span {
     /* Note #1972 -- spans are encoded but not decoded */
-    fn encode(&self, s: &mut S) {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_nil()
     }
 }
 
-impl<D:Decoder> Decodable<D> for Span {
-    fn decode(_d: &mut D) -> Span {
-        DUMMY_SP
+impl<D:Decoder<E>, E> Decodable<D, E> for Span {
+    fn decode(_d: &mut D) -> Result<Span, E> {
+        Ok(DUMMY_SP)
     }
 }
 
@@ -143,26 +143,26 @@ pub fn mk_sp(lo: BytePos, hi: BytePos) -> Span {
 /// A source code location used for error reporting
 pub struct Loc {
     /// Information about the original source
-    file: Rc<FileMap>,
+    pub file: Rc<FileMap>,
     /// The (1-based) line number
-    line: uint,
+    pub line: uint,
     /// The (0-based) column offset
-    col: CharPos
+    pub col: CharPos
 }
 
 /// A source code location used as the result of lookup_char_pos_adj
 // Actually, *none* of the clients use the filename *or* file field;
 // perhaps they should just be removed.
 pub struct LocWithOpt {
-    filename: FileName,
-    line: uint,
-    col: CharPos,
-    file: Option<Rc<FileMap>>,
+    pub filename: FileName,
+    pub line: uint,
+    pub col: CharPos,
+    pub file: Option<Rc<FileMap>>,
 }
 
 // used to be structural records. Better names, anyone?
-pub struct FileMapAndLine {fm: Rc<FileMap>, line: uint}
-pub struct FileMapAndBytePos {fm: Rc<FileMap>, pos: BytePos}
+pub struct FileMapAndLine { pub fm: Rc<FileMap>, pub line: uint }
+pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos }
 
 /// The syntax with which a macro was invoked.
 #[deriving(Clone, Hash, Show)]
@@ -177,13 +177,13 @@ pub enum MacroFormat {
 pub struct NameAndSpan {
     /// The name of the macro that was invoked to create the thing
     /// with this Span.
-    name: ~str,
+    pub name: ~str,
     /// The format with which the macro was invoked.
-    format: MacroFormat,
+    pub format: MacroFormat,
     /// The span of the macro definition itself. The macro may not
     /// have a sensible definition span (e.g. something defined
     /// completely inside libsyntax) in which case this is None.
-    span: Option<Span>
+    pub span: Option<Span>
 }
 
 /// Extra information for tracking macro expansion of spans
@@ -198,29 +198,29 @@ pub struct ExpnInfo {
     /// the expansion would point to the `bar!` invocation; that
     /// call_site span would have its own ExpnInfo, with the call_site
     /// pointing to the `foo!` invocation.
-    call_site: Span,
+    pub call_site: Span,
     /// Information about the macro and its definition.
     ///
     /// The `callee` of the inner expression in the `call_site`
     /// example would point to the `macro_rules! bar { ... }` and that
     /// of the `bar!()` invocation would point to the `macro_rules!
     /// foo { ... }`.
-    callee: NameAndSpan
+    pub callee: NameAndSpan
 }
 
 pub type FileName = ~str;
 
 pub struct FileLines {
-    file: Rc<FileMap>,
-    lines: Vec<uint>
+    pub file: Rc<FileMap>,
+    pub lines: Vec<uint>
 }
 
 /// Identifies an offset of a multi-byte character in a FileMap
 pub struct MultiByteChar {
     /// The absolute offset of the character in the CodeMap
-    pos: BytePos,
+    pub pos: BytePos,
     /// The number of bytes, >=2
-    bytes: uint,
+    pub bytes: uint,
 }
 
 /// A single source in the CodeMap
@@ -228,15 +228,15 @@ pub struct FileMap {
     /// The name of the file that the source came from, source that doesn't
     /// originate from files has names between angle brackets by convention,
     /// e.g. `<anon>`
-    name: FileName,
+    pub name: FileName,
     /// The complete source code
-    src: ~str,
+    pub src: ~str,
     /// The start position of this source in the CodeMap
-    start_pos: BytePos,
+    pub start_pos: BytePos,
     /// Locations of lines beginnings in the source code
-    lines: RefCell<Vec<BytePos> >,
+    pub lines: RefCell<Vec<BytePos> >,
     /// Locations of multi-byte characters in the source code
-    multibyte_chars: RefCell<Vec<MultiByteChar> >,
+    pub multibyte_chars: RefCell<Vec<MultiByteChar> >,
 }
 
 impl FileMap {
@@ -284,7 +284,7 @@ impl FileMap {
 }
 
 pub struct CodeMap {
-    files: RefCell<Vec<Rc<FileMap>>>
+    pub files: RefCell<Vec<Rc<FileMap>>>
 }
 
 impl CodeMap {
diff --git a/src/libsyntax/crateid.rs b/src/libsyntax/crateid.rs
index 96664fc39f6..353e1a23b5e 100644
--- a/src/libsyntax/crateid.rs
+++ b/src/libsyntax/crateid.rs
@@ -24,11 +24,11 @@ use std::from_str::FromStr;
 pub struct CrateId {
     /// A path which represents the codes origin. By convention this is the
     /// URL, without `http://` or `https://` prefix, to the crate's repository
-    path: ~str,
+    pub path: ~str,
     /// The name of the crate.
-    name: ~str,
+    pub name: ~str,
     /// The version of the crate.
-    version: Option<~str>,
+    pub version: Option<~str>,
 }
 
 impl fmt::Show for CrateId {
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index e19c4c3026a..e3514b6f3f3 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -20,11 +20,37 @@ use term;
 // maximum number of lines we will print for each error; arbitrary.
 static MAX_LINES: uint = 6u;
 
+#[deriving(Clone)]
+pub enum RenderSpan {
+    /// A FullSpan renders with both with an initial line for the
+    /// message, prefixed by file:linenum, followed by a summary of
+    /// the source code covered by the span.
+    FullSpan(Span),
+
+    /// A FileLine renders with just a line for the message prefixed
+    /// by file:linenum.
+    FileLine(Span),
+}
+
+impl RenderSpan {
+    fn span(self) -> Span {
+        match self {
+            FullSpan(s) | FileLine(s) => s
+        }
+    }
+    fn is_full_span(&self) -> bool {
+        match self {
+            &FullSpan(..) => true,
+            &FileLine(..) => false,
+        }
+    }
+}
+
 pub trait Emitter {
     fn emit(&mut self, cmsp: Option<(&codemap::CodeMap, Span)>,
             msg: &str, lvl: Level);
     fn custom_emit(&mut self, cm: &codemap::CodeMap,
-                   sp: Span, msg: &str, lvl: Level);
+                   sp: RenderSpan, msg: &str, lvl: Level);
 }
 
 /// This structure is used to signify that a task has failed with a fatal error
@@ -40,8 +66,8 @@ pub struct ExplicitBug;
 // accepts span information for source-location
 // reporting.
 pub struct SpanHandler {
-    handler: Handler,
-    cm: codemap::CodeMap,
+    pub handler: Handler,
+    pub cm: codemap::CodeMap,
 }
 
 impl SpanHandler {
@@ -60,7 +86,10 @@ impl SpanHandler {
         self.handler.emit(Some((&self.cm, sp)), msg, Note);
     }
     pub fn span_end_note(&self, sp: Span, msg: &str) {
-        self.handler.custom_emit(&self.cm, sp, msg, Note);
+        self.handler.custom_emit(&self.cm, FullSpan(sp), msg, Note);
+    }
+    pub fn fileline_note(&self, sp: Span, msg: &str) {
+        self.handler.custom_emit(&self.cm, FileLine(sp), msg, Note);
     }
     pub fn span_bug(&self, sp: Span, msg: &str) -> ! {
         self.handler.emit(Some((&self.cm, sp)), msg, Bug);
@@ -79,7 +108,7 @@ impl SpanHandler {
 // others log errors for later reporting.
 pub struct Handler {
     err_count: Cell<uint>,
-    emit: RefCell<~Emitter>,
+    emit: RefCell<~Emitter:Send>,
 }
 
 impl Handler {
@@ -132,7 +161,7 @@ impl Handler {
         self.emit.borrow_mut().emit(cmsp, msg, lvl);
     }
     pub fn custom_emit(&self, cm: &codemap::CodeMap,
-                       sp: Span, msg: &str, lvl: Level) {
+                       sp: RenderSpan, msg: &str, lvl: Level) {
         self.emit.borrow_mut().custom_emit(cm, sp, msg, lvl);
     }
 }
@@ -148,7 +177,7 @@ pub fn default_handler() -> Handler {
     mk_handler(~EmitterWriter::stderr())
 }
 
-pub fn mk_handler(e: ~Emitter) -> Handler {
+pub fn mk_handler(e: ~Emitter:Send) -> Handler {
     Handler {
         err_count: Cell::new(0),
         emit: RefCell::new(e),
@@ -216,12 +245,12 @@ fn print_diagnostic(dst: &mut EmitterWriter,
 }
 
 pub struct EmitterWriter {
-    priv dst: Destination,
+    dst: Destination,
 }
 
 enum Destination {
     Terminal(term::Terminal<io::stdio::StdWriter>),
-    Raw(~Writer),
+    Raw(~Writer:Send),
 }
 
 impl EmitterWriter {
@@ -238,7 +267,7 @@ impl EmitterWriter {
         }
     }
 
-    pub fn new(dst: ~Writer) -> EmitterWriter {
+    pub fn new(dst: ~Writer:Send) -> EmitterWriter {
         EmitterWriter { dst: Raw(dst) }
     }
 }
@@ -258,7 +287,7 @@ impl Emitter for EmitterWriter {
             msg: &str,
             lvl: Level) {
         let error = match cmsp {
-            Some((cm, sp)) => emit(self, cm, sp, msg, lvl, false),
+            Some((cm, sp)) => emit(self, cm, FullSpan(sp), msg, lvl, false),
             None => print_diagnostic(self, "", lvl, msg),
         };
 
@@ -269,7 +298,7 @@ impl Emitter for EmitterWriter {
     }
 
     fn custom_emit(&mut self, cm: &codemap::CodeMap,
-                   sp: Span, msg: &str, lvl: Level) {
+                   sp: RenderSpan, msg: &str, lvl: Level) {
         match emit(self, cm, sp, msg, lvl, true) {
             Ok(()) => {}
             Err(e) => fail!("failed to print diagnostics: {}", e),
@@ -277,8 +306,9 @@ impl Emitter for EmitterWriter {
     }
 }
 
-fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, sp: Span,
+fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan,
         msg: &str, lvl: Level, custom: bool) -> io::IoResult<()> {
+    let sp = rsp.span();
     let ss = cm.span_to_str(sp);
     let lines = cm.span_to_lines(sp);
     if custom {
@@ -288,10 +318,14 @@ fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, sp: Span,
         let span_end = Span { lo: sp.hi, hi: sp.hi, expn_info: sp.expn_info};
         let ses = cm.span_to_str(span_end);
         try!(print_diagnostic(dst, ses, lvl, msg));
-        try!(custom_highlight_lines(dst, cm, sp, lvl, lines));
+        if rsp.is_full_span() {
+            try!(custom_highlight_lines(dst, cm, sp, lvl, lines));
+        }
     } else {
         try!(print_diagnostic(dst, ss, lvl, msg));
-        try!(highlight_lines(dst, cm, sp, lvl, lines));
+        if rsp.is_full_span() {
+            try!(highlight_lines(dst, cm, sp, lvl, lines));
+        }
     }
     print_macro_backtrace(dst, cm, sp)
 }
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 2bcb9c4a229..7ff77923132 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -30,8 +30,8 @@ use collections::HashMap;
 // ast::MacInvocTT.
 
 pub struct MacroDef {
-    name: ~str,
-    ext: SyntaxExtension
+    pub name: ~str,
+    pub ext: SyntaxExtension
 }
 
 pub type ItemDecorator =
@@ -41,8 +41,8 @@ pub type ItemModifier =
     fn(&mut ExtCtxt, Span, @ast::MetaItem, @ast::Item) -> @ast::Item;
 
 pub struct BasicMacroExpander {
-    expander: MacroExpanderFn,
-    span: Option<Span>
+    pub expander: MacroExpanderFn,
+    pub span: Option<Span>
 }
 
 pub trait MacroExpander {
@@ -68,8 +68,8 @@ impl MacroExpander for BasicMacroExpander {
 }
 
 pub struct BasicIdentMacroExpander {
-    expander: IdentMacroExpanderFn,
-    span: Option<Span>
+    pub expander: IdentMacroExpanderFn,
+    pub span: Option<Span>
 }
 
 pub trait IdentMacroExpander {
@@ -172,9 +172,9 @@ pub enum SyntaxExtension {
 
 pub struct BlockInfo {
     // should macros escape from this scope?
-    macros_escape: bool,
+    pub macros_escape: bool,
     // what are the pending renames?
-    pending_renames: RenameList,
+    pub pending_renames: RenameList,
 }
 
 impl BlockInfo {
@@ -292,8 +292,8 @@ pub fn syntax_expander_table() -> SyntaxEnv {
 }
 
 pub struct MacroCrate {
-    lib: Option<Path>,
-    cnum: ast::CrateNum,
+    pub lib: Option<Path>,
+    pub cnum: ast::CrateNum,
 }
 
 pub trait CrateLoader {
@@ -306,13 +306,13 @@ pub trait CrateLoader {
 // when a macro expansion occurs, the resulting nodes have the backtrace()
 // -> expn_info of their expansion context stored into their span.
 pub struct ExtCtxt<'a> {
-    parse_sess: &'a parse::ParseSess,
-    cfg: ast::CrateConfig,
-    backtrace: Option<@ExpnInfo>,
-    ecfg: expand::ExpansionConfig<'a>,
+    pub parse_sess: &'a parse::ParseSess,
+    pub cfg: ast::CrateConfig,
+    pub backtrace: Option<@ExpnInfo>,
+    pub ecfg: expand::ExpansionConfig<'a>,
 
-    mod_path: Vec<ast::Ident> ,
-    trace_mac: bool
+    pub mod_path: Vec<ast::Ident> ,
+    pub trace_mac: bool,
 }
 
 impl<'a> ExtCtxt<'a> {
@@ -532,7 +532,7 @@ struct MapChainFrame {
 
 // Only generic to make it easy to test
 pub struct SyntaxEnv {
-    priv chain: Vec<MapChainFrame> ,
+    chain: Vec<MapChainFrame> ,
 }
 
 impl SyntaxEnv {
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index bdb16f176c0..b7c12cd4fdc 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use abi::AbiSet;
+use abi;
 use ast::{P, Ident};
 use ast;
 use ast_util;
@@ -142,6 +142,10 @@ pub trait AstBuilder {
     fn expr_fail(&self, span: Span, msg: InternedString) -> @ast::Expr;
     fn expr_unreachable(&self, span: Span) -> @ast::Expr;
 
+    fn expr_ok(&self, span: Span, expr: @ast::Expr) -> @ast::Expr;
+    fn expr_err(&self, span: Span, expr: @ast::Expr) -> @ast::Expr;
+    fn expr_try(&self, span: Span, head: @ast::Expr) -> @ast::Expr;
+
     fn pat(&self, span: Span, pat: ast::Pat_) -> @ast::Pat;
     fn pat_wild(&self, span: Span) -> @ast::Pat;
     fn pat_lit(&self, span: Span, expr: @ast::Expr) -> @ast::Pat;
@@ -575,7 +579,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
         self.expr(sp, ast::ExprVstore(expr, vst))
     }
     fn expr_vec(&self, sp: Span, exprs: Vec<@ast::Expr> ) -> @ast::Expr {
-        self.expr(sp, ast::ExprVec(exprs, ast::MutImmutable))
+        self.expr(sp, ast::ExprVec(exprs))
     }
     fn expr_vec_ng(&self, sp: Span) -> @ast::Expr {
         self.expr_call_global(sp,
@@ -638,6 +642,50 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
                            "internal error: entered unreachable code"))
     }
 
+    fn expr_ok(&self, sp: Span, expr: @ast::Expr) -> @ast::Expr {
+        let ok = vec!(
+            self.ident_of("std"),
+            self.ident_of("result"),
+            self.ident_of("Ok"));
+        self.expr_call_global(sp, ok, vec!(expr))
+    }
+
+    fn expr_err(&self, sp: Span, expr: @ast::Expr) -> @ast::Expr {
+        let err = vec!(
+            self.ident_of("std"),
+            self.ident_of("result"),
+            self.ident_of("Err"));
+        self.expr_call_global(sp, err, vec!(expr))
+    }
+
+    fn expr_try(&self, sp: Span, head: @ast::Expr) -> @ast::Expr {
+        let ok = self.ident_of("Ok");
+        let ok_path = self.path_ident(sp, ok);
+        let err = self.ident_of("Err");
+        let err_path = self.path_ident(sp, err);
+
+        let binding_variable = self.ident_of("__try_var");
+        let binding_pat = self.pat_ident(sp, binding_variable);
+        let binding_expr = self.expr_ident(sp, binding_variable);
+
+        // Ok(__try_var) pattern
+        let ok_pat = self.pat_enum(sp, ok_path, vec!(binding_pat));
+
+        // Err(__try_var)  (pattern and expression resp.)
+        let err_pat = self.pat_enum(sp, err_path, vec!(binding_pat));
+        let err_inner_expr = self.expr_call_ident(sp, err, vec!(binding_expr));
+        // return Err(__try_var)
+        let err_expr = self.expr(sp, ast::ExprRet(Some(err_inner_expr)));
+
+        // Ok(__try_var) => __try_var
+        let ok_arm = self.arm(sp, vec!(ok_pat), binding_expr);
+        // Err(__try_var) => return Err(__try_var)
+        let err_arm = self.arm(sp, vec!(err_pat), err_expr);
+
+        // match head { Ok() => ..., Err() => ... }
+        self.expr_match(sp, head, vec!(ok_arm, err_arm))
+    }
+
 
     fn pat(&self, span: Span, pat: ast::Pat_) -> @ast::Pat {
         @ast::Pat { id: ast::DUMMY_NODE_ID, node: pat, span: span }
@@ -698,7 +746,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
     }
     fn lambda(&self, span: Span, ids: Vec<ast::Ident> , blk: P<ast::Block>) -> @ast::Expr {
         let fn_decl = self.fn_decl(
-            ids.map(|id| self.arg(span, *id, self.ty_infer(span))),
+            ids.iter().map(|id| self.arg(span, *id, self.ty_infer(span))).collect(),
             self.ty_infer(span));
 
         self.expr(span, ast::ExprFnBlock(fn_decl, blk))
@@ -778,7 +826,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
                   Vec::new(),
                   ast::ItemFn(self.fn_decl(inputs, output),
                               ast::ImpureFn,
-                              AbiSet::Rust(),
+                              abi::Rust,
                               generics,
                               body))
     }
@@ -918,16 +966,14 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
 
     fn view_use_list(&self, sp: Span, vis: ast::Visibility,
                      path: Vec<ast::Ident> , imports: &[ast::Ident]) -> ast::ViewItem {
-        let imports = imports.map(|id| {
+        let imports = imports.iter().map(|id| {
             respan(sp, ast::PathListIdent_ { name: *id, id: ast::DUMMY_NODE_ID })
-        });
+        }).collect();
 
         self.view_use(sp, vis,
                       vec!(@respan(sp,
                                 ast::ViewPathList(self.path(sp, path),
-                                                  imports.iter()
-                                                         .map(|x| *x)
-                                                         .collect(),
+                                                  imports,
                                                   ast::DUMMY_NODE_ID))))
     }
 
diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs
index 3cbccae664b..367accb4b19 100644
--- a/src/libsyntax/ext/deriving/clone.rs
+++ b/src/libsyntax/ext/deriving/clone.rs
@@ -71,11 +71,11 @@ fn cs_clone(
 
     if all_fields.len() >= 1 && all_fields.get(0).name.is_none() {
         // enum-like
-        let subcalls = all_fields.map(subcall);
+        let subcalls = all_fields.iter().map(subcall).collect();
         cx.expr_call_ident(trait_span, ctor_ident, subcalls)
     } else {
         // struct-like
-        let fields = all_fields.map(|field| {
+        let fields = all_fields.iter().map(|field| {
             let ident = match field.name {
                 Some(i) => i,
                 None => cx.span_bug(trait_span,
@@ -83,7 +83,7 @@ fn cs_clone(
                                             name))
             };
             cx.field_imm(field.span, ident, subcall(field))
-        });
+        }).collect::<Vec<_>>();
 
         if fields.is_empty() {
             // no fields, so construct like `None`
diff --git a/src/libsyntax/ext/deriving/decodable.rs b/src/libsyntax/ext/deriving/decodable.rs
index 4c9a58c46f7..579de82c8db 100644
--- a/src/libsyntax/ext/deriving/decodable.rs
+++ b/src/libsyntax/ext/deriving/decodable.rs
@@ -30,11 +30,15 @@ pub fn expand_deriving_decodable(cx: &mut ExtCtxt,
         span: span,
         attributes: Vec::new(),
         path: Path::new_(vec!("serialize", "Decodable"), None,
-                         vec!(~Literal(Path::new_local("__D"))), true),
+                         vec!(~Literal(Path::new_local("__D")),
+                              ~Literal(Path::new_local("__E"))), true),
         additional_bounds: Vec::new(),
         generics: LifetimeBounds {
             lifetimes: Vec::new(),
-            bounds: vec!(("__D", vec!(Path::new(vec!("serialize", "Decoder"))))),
+            bounds: vec!(("__D", vec!(Path::new_(
+                            vec!("serialize", "Decoder"), None,
+                            vec!(~Literal(Path::new_local("__E"))), true))),
+                         ("__E", vec!()))
         },
         methods: vec!(
             MethodDef {
@@ -43,7 +47,8 @@ pub fn expand_deriving_decodable(cx: &mut ExtCtxt,
                 explicit_self: None,
                 args: vec!(Ptr(~Literal(Path::new_local("__D")),
                             Borrowed(None, MutMutable))),
-                ret_ty: Self,
+                ret_ty: Literal(Path::new_(vec!("std", "result", "Result"), None,
+                                          vec!(~Self, ~Literal(Path::new_local("__E"))), true)),
                 inline: false,
                 const_nonmatching: true,
                 combine_substructure: decodable_substructure,
@@ -78,11 +83,13 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                                               substr.type_ident,
                                               summary,
                                               |cx, span, name, field| {
-                cx.expr_method_call(span, blkdecoder, read_struct_field,
-                                    vec!(cx.expr_str(span, name),
-                                      cx.expr_uint(span, field),
-                                      lambdadecode))
+                cx.expr_try(span,
+                    cx.expr_method_call(span, blkdecoder, read_struct_field,
+                                        vec!(cx.expr_str(span, name),
+                                          cx.expr_uint(span, field),
+                                          lambdadecode)))
             });
+            let result = cx.expr_ok(trait_span, result);
             cx.expr_method_call(trait_span,
                                 decoder,
                                 cx.ident_of("read_struct"),
@@ -108,8 +115,9 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                                                    parts,
                                                    |cx, span, _, field| {
                     let idx = cx.expr_uint(span, field);
-                    cx.expr_method_call(span, blkdecoder, rvariant_arg,
-                                        vec!(idx, lambdadecode))
+                    cx.expr_try(span,
+                        cx.expr_method_call(span, blkdecoder, rvariant_arg,
+                                            vec!(idx, lambdadecode)))
                 });
 
                 arms.push(cx.arm(v_span,
@@ -119,7 +127,9 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
 
             arms.push(cx.arm_unreachable(trait_span));
 
-            let result = cx.expr_match(trait_span, cx.expr_ident(trait_span, variant), arms);
+            let result = cx.expr_ok(trait_span,
+                                    cx.expr_match(trait_span,
+                                                  cx.expr_ident(trait_span, variant), arms));
             let lambda = cx.lambda_expr(trait_span, vec!(blkarg, variant), result);
             let variant_vec = cx.expr_vec(trait_span, variants);
             let result = cx.expr_method_call(trait_span, blkdecoder,
diff --git a/src/libsyntax/ext/deriving/default.rs b/src/libsyntax/ext/deriving/default.rs
index 46e9dfb89ab..94675f91e9d 100644
--- a/src/libsyntax/ext/deriving/default.rs
+++ b/src/libsyntax/ext/deriving/default.rs
@@ -56,14 +56,14 @@ fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructur
                     if fields.is_empty() {
                         cx.expr_ident(trait_span, substr.type_ident)
                     } else {
-                        let exprs = fields.map(|sp| default_call(*sp));
+                        let exprs = fields.iter().map(|sp| default_call(*sp)).collect();
                         cx.expr_call_ident(trait_span, substr.type_ident, exprs)
                     }
                 }
                 Named(ref fields) => {
-                    let default_fields = fields.map(|&(ident, span)| {
+                    let default_fields = fields.iter().map(|&(ident, span)| {
                         cx.field_imm(span, ident, default_call(span))
-                    });
+                    }).collect();
                     cx.expr_struct_ident(trait_span, substr.type_ident, default_fields)
                 }
             }
diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs
index 2fa6ec6888b..90ea8701562 100644
--- a/src/libsyntax/ext/deriving/encodable.rs
+++ b/src/libsyntax/ext/deriving/encodable.rs
@@ -82,7 +82,7 @@ would yield functions like:
 ```
 */
 
-use ast::{MetaItem, Item, Expr, MutMutable};
+use ast::{MetaItem, Item, Expr, ExprRet, MutMutable, LitNil};
 use codemap::Span;
 use ext::base::ExtCtxt;
 use ext::build::AstBuilder;
@@ -98,20 +98,28 @@ pub fn expand_deriving_encodable(cx: &mut ExtCtxt,
         span: span,
         attributes: Vec::new(),
         path: Path::new_(vec!("serialize", "Encodable"), None,
-                         vec!(~Literal(Path::new_local("__E"))), true),
+                         vec!(~Literal(Path::new_local("__S")),
+                              ~Literal(Path::new_local("__E"))), true),
         additional_bounds: Vec::new(),
         generics: LifetimeBounds {
             lifetimes: Vec::new(),
-            bounds: vec!(("__E", vec!(Path::new(vec!("serialize", "Encoder"))))),
+            bounds: vec!(("__S", vec!(Path::new_(
+                            vec!("serialize", "Encoder"), None,
+                            vec!(~Literal(Path::new_local("__E"))), true))),
+                         ("__E", vec!()))
         },
         methods: vec!(
             MethodDef {
                 name: "encode",
                 generics: LifetimeBounds::empty(),
                 explicit_self: borrowed_explicit_self(),
-                args: vec!(Ptr(~Literal(Path::new_local("__E")),
+                args: vec!(Ptr(~Literal(Path::new_local("__S")),
                             Borrowed(None, MutMutable))),
-                ret_ty: nil_ty(),
+                ret_ty: Literal(Path::new_(vec!("std", "result", "Result"),
+                                           None,
+                                           vec!(~Tuple(Vec::new()),
+                                                ~Literal(Path::new_local("__E"))),
+                                           true)),
                 inline: false,
                 const_nonmatching: true,
                 combine_substructure: encodable_substructure,
@@ -133,6 +141,7 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
         Struct(ref fields) => {
             let emit_struct_field = cx.ident_of("emit_struct_field");
             let mut stmts = Vec::new();
+            let last = fields.len() - 1;
             for (i, &FieldInfo {
                     name,
                     self_,
@@ -152,6 +161,13 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                                                vec!(cx.expr_str(span, name),
                                                  cx.expr_uint(span, i),
                                                  lambda));
+
+                // last call doesn't need a try!
+                let call = if i != last {
+                    cx.expr_try(span, call)
+                } else {
+                    cx.expr(span, ExprRet(Some(call)))
+                };
                 stmts.push(cx.stmt_expr(call));
             }
 
@@ -175,6 +191,7 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
             let encoder = cx.expr_ident(trait_span, blkarg);
             let emit_variant_arg = cx.ident_of("emit_enum_variant_arg");
             let mut stmts = Vec::new();
+            let last = fields.len() - 1;
             for (i, &FieldInfo { self_, span, .. }) in fields.iter().enumerate() {
                 let enc = cx.expr_method_call(span, self_, encode, vec!(blkencoder));
                 let lambda = cx.lambda_expr_1(span, enc, blkarg);
@@ -182,9 +199,22 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                                                emit_variant_arg,
                                                vec!(cx.expr_uint(span, i),
                                                  lambda));
+                let call = if i != last {
+                    cx.expr_try(span, call)
+                } else {
+                    cx.expr(span, ExprRet(Some(call)))
+                };
                 stmts.push(cx.stmt_expr(call));
             }
 
+            // enums with no fields need to return Ok()
+            if stmts.len() == 0 {
+                let ret_ok = cx.expr(trait_span,
+                                     ExprRet(Some(cx.expr_ok(trait_span,
+                                                             cx.expr_lit(trait_span, LitNil)))));
+                stmts.push(cx.stmt_expr(ret_ok));
+            }
+
             let blk = cx.lambda_stmts_1(trait_span, stmts, blkarg);
             let name = cx.expr_str(trait_span, token::get_ident(variant.node.name));
             let call = cx.expr_method_call(trait_span, blkencoder,
diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs
index a959e388bcb..0d851647b3d 100644
--- a/src/libsyntax/ext/deriving/generic.rs
+++ b/src/libsyntax/ext/deriving/generic.rs
@@ -187,82 +187,82 @@ use codemap::Span;
 use owned_slice::OwnedSlice;
 use parse::token::InternedString;
 
-use std::vec;
-
 pub use self::ty::*;
 mod ty;
 
 pub struct TraitDef<'a> {
     /// The span for the current #[deriving(Foo)] header.
-    span: Span,
+    pub span: Span,
 
-    attributes: Vec<ast::Attribute> ,
+    pub attributes: Vec<ast::Attribute>,
 
     /// Path of the trait, including any type parameters
-    path: Path<'a>,
+    pub path: Path<'a>,
 
     /// Additional bounds required of any type parameters of the type,
     /// other than the current trait
-    additional_bounds: Vec<Ty<'a>> ,
+    pub additional_bounds: Vec<Ty<'a>>,
 
     /// Any extra lifetimes and/or bounds, e.g. `D: serialize::Decoder`
-    generics: LifetimeBounds<'a>,
+    pub generics: LifetimeBounds<'a>,
 
-    methods: Vec<MethodDef<'a>> }
+    pub methods: Vec<MethodDef<'a>>,
+}
 
 
 pub struct MethodDef<'a> {
     /// name of the method
-    name: &'a str,
+    pub name: &'a str,
     /// List of generics, e.g. `R: rand::Rng`
-    generics: LifetimeBounds<'a>,
+    pub generics: LifetimeBounds<'a>,
 
     /// Whether there is a self argument (outer Option) i.e. whether
     /// this is a static function, and whether it is a pointer (inner
     /// Option)
-    explicit_self: Option<Option<PtrTy<'a>>>,
+    pub explicit_self: Option<Option<PtrTy<'a>>>,
 
     /// Arguments other than the self argument
-    args: Vec<Ty<'a>> ,
+    pub args: Vec<Ty<'a>>,
 
     /// Return type
-    ret_ty: Ty<'a>,
+    pub ret_ty: Ty<'a>,
 
     /// Whether to mark this as #[inline]
-    inline: bool,
+    pub inline: bool,
 
     /// if the value of the nonmatching enums is independent of the
     /// actual enum variants, i.e. can use _ => .. match.
-    const_nonmatching: bool,
+    pub const_nonmatching: bool,
 
-    combine_substructure: CombineSubstructureFunc<'a>
+    pub combine_substructure: CombineSubstructureFunc<'a>,
 }
 
 /// All the data about the data structure/method being derived upon.
 pub struct Substructure<'a> {
     /// ident of self
-    type_ident: Ident,
+    pub type_ident: Ident,
     /// ident of the method
-    method_ident: Ident,
+    pub method_ident: Ident,
     /// dereferenced access to any Self or Ptr(Self, _) arguments
-    self_args: &'a [@Expr],
+    pub self_args: &'a [@Expr],
     /// verbatim access to any other arguments
-    nonself_args: &'a [@Expr],
-    fields: &'a SubstructureFields<'a>
+    pub nonself_args: &'a [@Expr],
+    pub fields: &'a SubstructureFields<'a>
 }
 
 /// Summary of the relevant parts of a struct/enum field.
 pub struct FieldInfo {
-    span: Span,
+    pub span: Span,
     /// None for tuple structs/normal enum variants, Some for normal
     /// structs/struct enum variants.
-    name: Option<Ident>,
+    pub name: Option<Ident>,
     /// The expression corresponding to this field of `self`
     /// (specifically, a reference to it).
-    self_: @Expr,
+    pub self_: @Expr,
     /// The expressions corresponding to references to this field in
     /// the other Self arguments.
-    other: Vec<@Expr> }
+    pub other: Vec<@Expr>,
+}
 
 /// Fields for a static method
 pub enum StaticFields {
@@ -371,12 +371,12 @@ impl<'a> TraitDef<'a> {
         ty_params.extend(generics.ty_params.iter().map(|ty_param| {
             // I don't think this can be moved out of the loop, since
             // a TyParamBound requires an ast id
-            let mut bounds =
+            let mut bounds: Vec<_> =
                 // extra restrictions on the generics parameters to the type being derived upon
-                self.additional_bounds.map(|p| {
+                self.additional_bounds.iter().map(|p| {
                     cx.typarambound(p.to_path(cx, self.span,
                                                   type_ident, generics))
-                });
+                }).collect();
             // require the current trait
             bounds.push(cx.typarambound(trait_path.clone()));
 
@@ -411,9 +411,9 @@ impl<'a> TraitDef<'a> {
         cx.item(
             self.span,
             ident,
-            vec::append(vec!(attr), self.attributes.as_slice()),
+            (vec!(attr)).append(self.attributes.as_slice()),
             ast::ItemImpl(trait_generics, opt_trait_ref,
-                          self_type, methods.map(|x| *x)))
+                          self_type, methods))
     }
 
     fn expand_struct_def(&self,
@@ -421,7 +421,7 @@ impl<'a> TraitDef<'a> {
                          struct_def: &StructDef,
                          type_ident: Ident,
                          generics: &Generics) -> @ast::Item {
-        let methods = self.methods.map(|method_def| {
+        let methods = self.methods.iter().map(|method_def| {
             let (explicit_self, self_args, nonself_args, tys) =
                 method_def.split_self_nonself_args(
                     cx, self, type_ident, generics);
@@ -447,7 +447,7 @@ impl<'a> TraitDef<'a> {
                                      type_ident, generics,
                                      explicit_self, tys,
                                      body)
-        });
+        }).collect();
 
         self.create_derived_impl(cx, type_ident, generics, methods)
     }
@@ -457,7 +457,7 @@ impl<'a> TraitDef<'a> {
                        enum_def: &EnumDef,
                        type_ident: Ident,
                        generics: &Generics) -> @ast::Item {
-        let methods = self.methods.map(|method_def| {
+        let methods = self.methods.iter().map(|method_def| {
             let (explicit_self, self_args, nonself_args, tys) =
                 method_def.split_self_nonself_args(cx, self,
                                                    type_ident, generics);
@@ -483,7 +483,7 @@ impl<'a> TraitDef<'a> {
                                      type_ident, generics,
                                      explicit_self, tys,
                                      body)
-        });
+        }).collect();
 
         self.create_derived_impl(cx, type_ident, generics, methods)
     }
@@ -955,18 +955,18 @@ impl<'a> MethodDef<'a> {
                                       self_args: &[@Expr],
                                       nonself_args: &[@Expr])
         -> @Expr {
-        let summary = enum_def.variants.map(|v| {
+        let summary = enum_def.variants.iter().map(|v| {
             let ident = v.node.name;
             let summary = match v.node.kind {
                 ast::TupleVariantKind(ref args) => {
-                    Unnamed(args.map(|va| trait_.set_expn_info(cx, va.ty.span)))
+                    Unnamed(args.iter().map(|va| trait_.set_expn_info(cx, va.ty.span)).collect())
                 }
                 ast::StructVariantKind(struct_def) => {
                     trait_.summarise_struct(cx, struct_def)
                 }
             };
             (ident, v.span, summary)
-        });
+        }).collect();
         self.call_substructure_method(cx, trait_, type_ident,
                                       self_args, nonself_args,
                                       &StaticEnum(enum_def, summary))
@@ -1007,7 +1007,7 @@ impl<'a> TraitDef<'a> {
             let sp = self.set_expn_info(cx, field.span);
             match field.node.kind {
                 ast::NamedField(ident, _) => named_idents.push((ident, sp)),
-                ast::UnnamedField => just_spans.push(sp),
+                ast::UnnamedField(..) => just_spans.push(sp),
             }
         }
 
@@ -1027,10 +1027,10 @@ impl<'a> TraitDef<'a> {
                           field_paths: Vec<ast::Path> ,
                           mutbl: ast::Mutability)
                           -> Vec<@ast::Pat> {
-        field_paths.map(|path| {
+        field_paths.iter().map(|path| {
             cx.pat(path.span,
                         ast::PatIdent(ast::BindByRef(mutbl), (*path).clone(), None))
-            })
+            }).collect()
     }
 
     fn create_struct_pattern(&self,
@@ -1061,8 +1061,8 @@ impl<'a> TraitDef<'a> {
                     struct_type = Record;
                     Some(ident)
                 }
-                ast::UnnamedField if (struct_type == Unknown ||
-                                      struct_type == Tuple) => {
+                ast::UnnamedField(..) if (struct_type == Unknown ||
+                                          struct_type == Tuple) => {
                     struct_type = Tuple;
                     None
                 }
@@ -1200,12 +1200,14 @@ pub fn cs_same_method(f: |&mut ExtCtxt, Span, Vec<@Expr> | -> @Expr,
     match *substructure.fields {
         EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => {
             // call self_n.method(other_1_n, other_2_n, ...)
-            let called = all_fields.map(|field| {
+            let called = all_fields.iter().map(|field| {
                 cx.expr_method_call(field.span,
                                     field.self_,
                                     substructure.method_ident,
-                                    field.other.map(|e| cx.expr_addr_of(field.span, *e)))
-            });
+                                    field.other.iter()
+                                               .map(|e| cx.expr_addr_of(field.span, *e))
+                                               .collect())
+            }).collect();
 
             f(cx, trait_span, called)
         },
diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs
index a31759065ae..6b824e52bb3 100644
--- a/src/libsyntax/ext/deriving/rand.rs
+++ b/src/libsyntax/ext/deriving/rand.rs
@@ -136,15 +136,15 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
                 if fields.is_empty() {
                     cx.expr_ident(trait_span, ctor_ident)
                 } else {
-                    let exprs = fields.map(|span| rand_call(cx, *span));
+                    let exprs = fields.iter().map(|span| rand_call(cx, *span)).collect();
                     cx.expr_call_ident(trait_span, ctor_ident, exprs)
                 }
             }
             Named(ref fields) => {
-                let rand_fields = fields.map(|&(ident, span)| {
+                let rand_fields = fields.iter().map(|&(ident, span)| {
                     let e = rand_call(cx, span);
                     cx.field_imm(span, ident, e)
-                });
+                }).collect();
                 cx.expr_struct_ident(trait_span, ctor_ident, rand_fields)
             }
         }
diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs
index bfdfba7ba78..c4ca2601f60 100644
--- a/src/libsyntax/ext/deriving/ty.rs
+++ b/src/libsyntax/ext/deriving/ty.rs
@@ -29,10 +29,10 @@ pub enum PtrTy<'a> {
 /// A path, e.g. `::std::option::Option::<int>` (global). Has support
 /// for type parameters and a lifetime.
 pub struct Path<'a> {
-    path: Vec<&'a str> ,
-    lifetime: Option<&'a str>,
-    params: Vec<~Ty<'a>> ,
-    global: bool
+    pub path: Vec<&'a str> ,
+    pub lifetime: Option<&'a str>,
+    pub params: Vec<~Ty<'a>> ,
+    pub global: bool,
 }
 
 impl<'a> Path<'a> {
@@ -69,9 +69,9 @@ impl<'a> Path<'a> {
                    self_ty: Ident,
                    self_generics: &Generics)
                    -> ast::Path {
-        let idents = self.path.map(|s| cx.ident_of(*s) );
+        let idents = self.path.iter().map(|s| cx.ident_of(*s)).collect();
         let lt = mk_lifetimes(cx, span, &self.lifetime);
-        let tys = self.params.map(|t| t.to_ty(cx, span, self_ty, self_generics));
+        let tys = self.params.iter().map(|t| t.to_ty(cx, span, self_ty, self_generics)).collect();
 
         cx.path_all(span, self.global, idents, lt, tys)
     }
@@ -150,7 +150,9 @@ impl<'a> Ty<'a> {
                 let ty = if fields.is_empty() {
                     ast::TyNil
                 } else {
-                    ast::TyTup(fields.map(|f| f.to_ty(cx, span, self_ty, self_generics)))
+                    ast::TyTup(fields.iter()
+                                     .map(|f| f.to_ty(cx, span, self_ty, self_generics))
+                                     .collect())
                 };
 
                 cx.ty(span, ty)
@@ -203,8 +205,8 @@ fn mk_generics(lifetimes: Vec<ast::Lifetime> ,  ty_params: Vec<ast::TyParam> ) -
 
 /// Lifetimes and bounds on type parameters
 pub struct LifetimeBounds<'a> {
-    lifetimes: Vec<&'a str>,
-    bounds: Vec<(&'a str, Vec<Path<'a>>)>,
+    pub lifetimes: Vec<&'a str>,
+    pub bounds: Vec<(&'a str, Vec<Path<'a>>)>,
 }
 
 impl<'a> LifetimeBounds<'a> {
@@ -219,10 +221,10 @@ impl<'a> LifetimeBounds<'a> {
                        self_ty: Ident,
                        self_generics: &Generics)
                        -> Generics {
-        let lifetimes = self.lifetimes.map(|lt| {
+        let lifetimes = self.lifetimes.iter().map(|lt| {
             cx.lifetime(span, cx.ident_of(*lt).name)
-        });
-        let ty_params = self.bounds.map(|t| {
+        }).collect();
+        let ty_params = self.bounds.iter().map(|t| {
             match t {
                 &(ref name, ref bounds) => {
                     mk_ty_param(cx,
@@ -233,7 +235,7 @@ impl<'a> LifetimeBounds<'a> {
                                 self_generics)
                 }
             }
-        });
+        }).collect();
         mk_generics(lifetimes, ty_params)
     }
 }
diff --git a/src/libsyntax/ext/deriving/zero.rs b/src/libsyntax/ext/deriving/zero.rs
index 9feae186894..10692bd7f93 100644
--- a/src/libsyntax/ext/deriving/zero.rs
+++ b/src/libsyntax/ext/deriving/zero.rs
@@ -73,14 +73,14 @@ fn zero_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
                     if fields.is_empty() {
                         cx.expr_ident(trait_span, substr.type_ident)
                     } else {
-                        let exprs = fields.map(|sp| zero_call(*sp));
+                        let exprs = fields.iter().map(|sp| zero_call(*sp)).collect();
                         cx.expr_call_ident(trait_span, substr.type_ident, exprs)
                     }
                 }
                 Named(ref fields) => {
-                    let zero_fields = fields.map(|&(ident, span)| {
+                    let zero_fields = fields.iter().map(|&(ident, span)| {
                         cx.field_imm(span, ident, zero_call(span))
-                    });
+                    }).collect();
                     cx.expr_struct_ident(trait_span, substr.type_ident, zero_fields)
                 }
             }
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index e6494bf1aca..747ab583e79 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -776,7 +776,7 @@ pub fn expand_block(blk: &Block, fld: &mut MacroExpander) -> P<Block> {
 
 // expand the elements of a block.
 pub fn expand_block_elts(b: &Block, fld: &mut MacroExpander) -> P<Block> {
-    let new_view_items = b.view_items.map(|x| fld.fold_view_item(x));
+    let new_view_items = b.view_items.iter().map(|x| fld.fold_view_item(x)).collect();
     let new_stmts =
         b.stmts.iter().flat_map(|x| {
             let renamed_stmt = {
@@ -838,8 +838,8 @@ pub fn new_span(cx: &ExtCtxt, sp: Span) -> Span {
 }
 
 pub struct MacroExpander<'a, 'b> {
-    extsbox: SyntaxEnv,
-    cx: &'a mut ExtCtxt<'b>,
+    pub extsbox: SyntaxEnv,
+    pub cx: &'a mut ExtCtxt<'b>,
 }
 
 impl<'a, 'b> Folder for MacroExpander<'a, 'b> {
@@ -869,9 +869,9 @@ impl<'a, 'b> Folder for MacroExpander<'a, 'b> {
 }
 
 pub struct ExpansionConfig<'a> {
-    loader: &'a mut CrateLoader,
-    deriving_hash_type_parameter: bool,
-    crate_id: CrateId,
+    pub loader: &'a mut CrateLoader,
+    pub deriving_hash_type_parameter: bool,
+    pub crate_id: CrateId,
 }
 
 pub fn expand_crate(parse_sess: &parse::ParseSess,
diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs
index 1ce08b8303e..c9e444a9b8c 100644
--- a/src/libsyntax/ext/log_syntax.rs
+++ b/src/libsyntax/ext/log_syntax.rs
@@ -13,6 +13,8 @@ use codemap;
 use ext::base;
 use print;
 
+use std::rc::Rc;
+
 pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
                          sp: codemap::Span,
                          tt: &[ast::TokenTree])
@@ -20,7 +22,7 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
 
     cx.print_backtrace();
     println!("{}", print::pprust::tt_to_str(&ast::TTDelim(
-                @tt.iter().map(|x| (*x).clone()).collect())));
+                Rc::new(tt.iter().map(|x| (*x).clone()).collect()))));
 
     // any so that `log_syntax` can be invoked as an expression and item.
     base::MacResult::dummy_any(sp)
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 14847aee8cf..6f8656f494d 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -83,7 +83,7 @@ pub mod rt {
 
     impl<'a> ToSource for &'a [@ast::Item] {
         fn to_source(&self) -> ~str {
-            self.map(|i| i.to_source()).connect("\n\n")
+            self.iter().map(|i| i.to_source()).collect::<Vec<~str>>().connect("\n\n")
         }
     }
 
@@ -95,7 +95,7 @@ pub mod rt {
 
     impl<'a> ToSource for &'a [ast::Ty] {
         fn to_source(&self) -> ~str {
-            self.map(|i| i.to_source()).connect(", ")
+            self.iter().map(|i| i.to_source()).collect::<Vec<~str>>().connect(", ")
         }
     }
 
@@ -339,7 +339,7 @@ pub fn expand_quote_stmt(cx: &mut ExtCtxt,
 }
 
 fn ids_ext(strs: Vec<~str> ) -> Vec<ast::Ident> {
-    strs.map(|str| str_to_ident(*str))
+    strs.iter().map(|str| str_to_ident(*str)).collect()
 }
 
 fn id_ext(str: &str) -> ast::Ident {
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 8931fb0f443..4d8d816d225 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -71,7 +71,9 @@ pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     -> base::MacResult {
     base::check_zero_tts(cx, sp, tts, "module_path!");
     let string = cx.mod_path()
+                   .iter()
                    .map(|x| token::get_ident(*x).get().to_str())
+                   .collect::<Vec<~str>>()
                    .connect("::");
     base::MRExpr(cx.expr_str(sp, token::intern_and_get_ident(string)))
 }
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index aa4f192f779..62999fb496a 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -21,6 +21,7 @@ use parse::parser::{LifetimeAndTypesWithoutColons, Parser};
 use parse::token::{Token, EOF, Nonterminal};
 use parse::token;
 
+use std::rc::Rc;
 use collections::HashMap;
 
 /* This is an Earley-like parser, without support for in-grammar nonterminals,
@@ -102,7 +103,7 @@ pub struct MatcherPos {
     sep: Option<Token>,
     idx: uint,
     up: Option<~MatcherPos>,
-    matches: Vec<Vec<@NamedMatch>>,
+    matches: Vec<Vec<Rc<NamedMatch>>>,
     match_lo: uint, match_hi: uint,
     sp_lo: BytePos,
 }
@@ -165,14 +166,14 @@ pub fn initial_matcher_pos(ms: Vec<Matcher> , sep: Option<Token>, lo: BytePos)
 // ast::Matcher it was derived from.
 
 pub enum NamedMatch {
-    MatchedSeq(Vec<@NamedMatch> , codemap::Span),
+    MatchedSeq(Vec<Rc<NamedMatch>>, codemap::Span),
     MatchedNonterminal(Nonterminal)
 }
 
-pub fn nameize(p_s: &ParseSess, ms: &[Matcher], res: &[@NamedMatch])
-            -> HashMap<Ident, @NamedMatch> {
-    fn n_rec(p_s: &ParseSess, m: &Matcher, res: &[@NamedMatch],
-             ret_val: &mut HashMap<Ident, @NamedMatch>) {
+pub fn nameize(p_s: &ParseSess, ms: &[Matcher], res: &[Rc<NamedMatch>])
+            -> HashMap<Ident, Rc<NamedMatch>> {
+    fn n_rec(p_s: &ParseSess, m: &Matcher, res: &[Rc<NamedMatch>],
+             ret_val: &mut HashMap<Ident, Rc<NamedMatch>>) {
         match *m {
           codemap::Spanned {node: MatchTok(_), .. } => (),
           codemap::Spanned {node: MatchSeq(ref more_ms, _, _, _, _), .. } => {
@@ -189,7 +190,7 @@ pub fn nameize(p_s: &ParseSess, ms: &[Matcher], res: &[@NamedMatch])
                 p_s.span_diagnostic
                    .span_fatal(span, "duplicated bind name: " + string.get())
             }
-            ret_val.insert(bind_name, res[idx]);
+            ret_val.insert(bind_name, res[idx].clone());
           }
         }
     }
@@ -199,16 +200,16 @@ pub fn nameize(p_s: &ParseSess, ms: &[Matcher], res: &[@NamedMatch])
 }
 
 pub enum ParseResult {
-    Success(HashMap<Ident, @NamedMatch>),
+    Success(HashMap<Ident, Rc<NamedMatch>>),
     Failure(codemap::Span, ~str),
     Error(codemap::Span, ~str)
 }
 
-pub fn parse_or_else<R: Reader>(sess: &ParseSess,
-                                cfg: ast::CrateConfig,
-                                rdr: R,
-                                ms: Vec<Matcher> )
-                                -> HashMap<Ident, @NamedMatch> {
+pub fn parse_or_else(sess: &ParseSess,
+                     cfg: ast::CrateConfig,
+                     rdr: TtReader,
+                     ms: Vec<Matcher> )
+                     -> HashMap<Ident, Rc<NamedMatch>> {
     match parse(sess, cfg, rdr, ms.as_slice()) {
         Success(m) => m,
         Failure(sp, str) => sess.span_diagnostic.span_fatal(sp, str),
@@ -226,11 +227,11 @@ pub fn token_name_eq(t1 : &Token, t2 : &Token) -> bool {
     }
 }
 
-pub fn parse<R: Reader>(sess: &ParseSess,
-                        cfg: ast::CrateConfig,
-                        rdr: R,
-                        ms: &[Matcher])
-                        -> ParseResult {
+pub fn parse(sess: &ParseSess,
+             cfg: ast::CrateConfig,
+             mut rdr: TtReader,
+             ms: &[Matcher])
+             -> ParseResult {
     let mut cur_eis = Vec::new();
     cur_eis.push(initial_matcher_pos(ms.iter()
                                        .map(|x| (*x).clone())
@@ -282,8 +283,8 @@ pub fn parse<R: Reader>(sess: &ParseSess,
                             let sub = (*ei.matches.get(idx)).clone();
                             new_pos.matches
                                    .get_mut(idx)
-                                   .push(@MatchedSeq(sub, mk_sp(ei.sp_lo,
-                                                                sp.hi)));
+                                   .push(Rc::new(MatchedSeq(sub, mk_sp(ei.sp_lo,
+                                                                       sp.hi))));
                         }
 
                         new_pos.idx += 1;
@@ -325,7 +326,7 @@ pub fn parse<R: Reader>(sess: &ParseSess,
                         for idx in range(match_idx_lo, match_idx_hi) {
                             new_ei.matches
                                   .get_mut(idx)
-                                  .push(@MatchedSeq(Vec::new(), sp));
+                                  .push(Rc::new(MatchedSeq(Vec::new(), sp)));
                         }
 
                         cur_eis.push(new_ei);
@@ -372,7 +373,7 @@ pub fn parse<R: Reader>(sess: &ParseSess,
         } else {
             if (bb_eis.len() > 0u && next_eis.len() > 0u)
                 || bb_eis.len() > 1u {
-                let nts = bb_eis.map(|ei| {
+                let nts = bb_eis.iter().map(|ei| {
                     match ei.elts.get(ei.idx).node {
                       MatchNonterminal(bind, name, _) => {
                         format!("{} ('{}')",
@@ -380,7 +381,7 @@ pub fn parse<R: Reader>(sess: &ParseSess,
                                 token::get_ident(bind))
                       }
                       _ => fail!()
-                    } }).connect(" or ");
+                    } }).collect::<Vec<~str>>().connect(" or ");
                 return Error(sp, format!(
                     "local ambiguity: multiple parsing options: \
                      built-in NTs {} or {} other options.",
@@ -395,14 +396,14 @@ pub fn parse<R: Reader>(sess: &ParseSess,
                 }
                 rdr.next_token();
             } else /* bb_eis.len() == 1 */ {
-                let mut rust_parser = Parser(sess, cfg.clone(), rdr.dup());
+                let mut rust_parser = Parser(sess, cfg.clone(), ~rdr.clone());
 
                 let mut ei = bb_eis.pop().unwrap();
                 match ei.elts.get(ei.idx).node {
                   MatchNonterminal(_, name, idx) => {
                     let name_string = token::get_ident(name);
-                    ei.matches.get_mut(idx).push(@MatchedNonterminal(
-                        parse_nt(&mut rust_parser, name_string.get())));
+                    ei.matches.get_mut(idx).push(Rc::new(MatchedNonterminal(
+                        parse_nt(&mut rust_parser, name_string.get()))));
                     ei.idx += 1u;
                   }
                   _ => fail!()
@@ -441,7 +442,7 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal {
       "path" => {
         token::NtPath(~p.parse_path(LifetimeAndTypesWithoutColons).path)
       }
-      "attr" => token::NtAttr(@p.parse_attribute(false)),
+      "meta" => token::NtMeta(p.parse_meta_item()),
       "tt" => {
         p.quote_depth += 1u; //but in theory, non-quoted tts might be useful
         let res = token::NtTT(@p.parse_token_tree());
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index b3e3023388b..d4a883a63eb 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -28,6 +28,7 @@ use print;
 use util::small_vector::SmallVector;
 
 use std::cell::RefCell;
+use std::rc::Rc;
 
 struct ParserAnyMacro<'a> {
     parser: RefCell<Parser<'a>>,
@@ -85,8 +86,8 @@ impl<'a> AnyMacro for ParserAnyMacro<'a> {
 
 struct MacroRulesMacroExpander {
     name: Ident,
-    lhses: @Vec<@NamedMatch> ,
-    rhses: @Vec<@NamedMatch> ,
+    lhses: Vec<Rc<NamedMatch>>,
+    rhses: Vec<Rc<NamedMatch>>,
 }
 
 impl MacroExpander for MacroRulesMacroExpander {
@@ -109,15 +110,15 @@ fn generic_extension(cx: &ExtCtxt,
                      sp: Span,
                      name: Ident,
                      arg: &[ast::TokenTree],
-                     lhses: &[@NamedMatch],
-                     rhses: &[@NamedMatch])
+                     lhses: &[Rc<NamedMatch>],
+                     rhses: &[Rc<NamedMatch>])
                      -> MacResult {
     if cx.trace_macros() {
         println!("{}! \\{ {} \\}",
                  token::get_ident(name),
-                 print::pprust::tt_to_str(&TTDelim(@arg.iter()
-                                                       .map(|x| (*x).clone())
-                                                       .collect())));
+                 print::pprust::tt_to_str(&TTDelim(Rc::new(arg.iter()
+                                                              .map(|x| (*x).clone())
+                                                              .collect()))));
     }
 
     // Which arm's failure should we report? (the one furthest along)
@@ -220,12 +221,12 @@ pub fn add_new_extension(cx: &mut ExtCtxt,
 
     // Extract the arguments:
     let lhses = match **argument_map.get(&lhs_nm) {
-        MatchedSeq(ref s, _) => /* FIXME (#2543) */ @(*s).clone(),
+        MatchedSeq(ref s, _) => /* FIXME (#2543) */ (*s).clone(),
         _ => cx.span_bug(sp, "wrong-structured lhs")
     };
 
     let rhses = match **argument_map.get(&rhs_nm) {
-        MatchedSeq(ref s, _) => /* FIXME (#2543) */ @(*s).clone(),
+        MatchedSeq(ref s, _) => /* FIXME (#2543) */ (*s).clone(),
         _ => cx.span_bug(sp, "wrong-structured rhs")
     };
 
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 933fbe3d566..8fa4857cab0 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -17,107 +17,79 @@ use parse::token::{EOF, INTERPOLATED, IDENT, Token, NtIdent};
 use parse::token;
 use parse::lexer::TokenAndSpan;
 
-use std::cell::{Cell, RefCell};
+use std::rc::Rc;
 use collections::HashMap;
 
 ///an unzipping of `TokenTree`s
+#[deriving(Clone)]
 struct TtFrame {
-    forest: @Vec<ast::TokenTree> ,
-    idx: Cell<uint>,
+    forest: Rc<Vec<ast::TokenTree>>,
+    idx: uint,
     dotdotdoted: bool,
     sep: Option<Token>,
-    up: Option<@TtFrame>,
 }
 
+#[deriving(Clone)]
 pub struct TtReader<'a> {
-    sp_diag: &'a SpanHandler,
+    pub sp_diag: &'a SpanHandler,
     // the unzipped tree:
-    priv stack: RefCell<@TtFrame>,
+    stack: Vec<TtFrame>,
     /* for MBE-style macro transcription */
-    priv interpolations: RefCell<HashMap<Ident, @NamedMatch>>,
-    priv repeat_idx: RefCell<Vec<uint> >,
-    priv repeat_len: RefCell<Vec<uint> >,
+    interpolations: HashMap<Ident, Rc<NamedMatch>>,
+    repeat_idx: Vec<uint>,
+    repeat_len: Vec<uint>,
     /* cached: */
-    cur_tok: RefCell<Token>,
-    cur_span: RefCell<Span>,
+    pub cur_tok: Token,
+    pub cur_span: Span,
 }
 
 /** This can do Macro-By-Example transcription. On the other hand, if
  *  `src` contains no `TTSeq`s and `TTNonterminal`s, `interp` can (and
  *  should) be none. */
 pub fn new_tt_reader<'a>(sp_diag: &'a SpanHandler,
-                         interp: Option<HashMap<Ident, @NamedMatch>>,
+                         interp: Option<HashMap<Ident, Rc<NamedMatch>>>,
                          src: Vec<ast::TokenTree> )
                          -> TtReader<'a> {
-    let r = TtReader {
+    let mut r = TtReader {
         sp_diag: sp_diag,
-        stack: RefCell::new(@TtFrame {
-            forest: @src,
-            idx: Cell::new(0u),
+        stack: vec!(TtFrame {
+            forest: Rc::new(src),
+            idx: 0,
             dotdotdoted: false,
             sep: None,
-            up: None
         }),
         interpolations: match interp { /* just a convienience */
-            None => RefCell::new(HashMap::new()),
-            Some(x) => RefCell::new(x),
+            None => HashMap::new(),
+            Some(x) => x,
         },
-        repeat_idx: RefCell::new(Vec::new()),
-        repeat_len: RefCell::new(Vec::new()),
+        repeat_idx: Vec::new(),
+        repeat_len: Vec::new(),
         /* dummy values, never read: */
-        cur_tok: RefCell::new(EOF),
-        cur_span: RefCell::new(DUMMY_SP),
+        cur_tok: EOF,
+        cur_span: DUMMY_SP,
     };
-    tt_next_token(&r); /* get cur_tok and cur_span set up */
+    tt_next_token(&mut r); /* get cur_tok and cur_span set up */
     r
 }
 
-fn dup_tt_frame(f: @TtFrame) -> @TtFrame {
-    @TtFrame {
-        forest: @(*f.forest).clone(),
-        idx: f.idx.clone(),
-        dotdotdoted: f.dotdotdoted,
-        sep: f.sep.clone(),
-        up: match f.up {
-            Some(up_frame) => Some(dup_tt_frame(up_frame)),
-            None => None
-        }
-    }
-}
-
-pub fn dup_tt_reader<'a>(r: &TtReader<'a>) -> TtReader<'a> {
-    TtReader {
-        sp_diag: r.sp_diag,
-        stack: RefCell::new(dup_tt_frame(r.stack.get())),
-        repeat_idx: r.repeat_idx.clone(),
-        repeat_len: r.repeat_len.clone(),
-        cur_tok: r.cur_tok.clone(),
-        cur_span: r.cur_span.clone(),
-        interpolations: r.interpolations.clone(),
-    }
-}
-
-
-fn lookup_cur_matched_by_matched(r: &TtReader, start: @NamedMatch)
-                                 -> @NamedMatch {
-    fn red(ad: @NamedMatch, idx: &uint) -> @NamedMatch {
+fn lookup_cur_matched_by_matched(r: &TtReader, start: Rc<NamedMatch>) -> Rc<NamedMatch> {
+    r.repeat_idx.iter().fold(start, |ad, idx| {
         match *ad {
             MatchedNonterminal(_) => {
                 // end of the line; duplicate henceforth
-                ad
+                ad.clone()
             }
-            MatchedSeq(ref ads, _) => *ads.get(*idx)
+            MatchedSeq(ref ads, _) => ads.get(*idx).clone()
         }
-    }
-    r.repeat_idx.borrow().iter().fold(start, red)
+    })
 }
 
-fn lookup_cur_matched(r: &TtReader, name: Ident) -> @NamedMatch {
-    let matched_opt = r.interpolations.borrow().find_copy(&name);
+fn lookup_cur_matched(r: &TtReader, name: Ident) -> Rc<NamedMatch> {
+    let matched_opt = r.interpolations.find_copy(&name);
     match matched_opt {
         Some(s) => lookup_cur_matched_by_matched(r, s),
         None => {
-            r.sp_diag.span_fatal(r.cur_span.get(),
+            r.sp_diag.span_fatal(r.cur_span,
                                  format!("unknown macro variable `{}`",
                                          token::get_ident(name)));
         }
@@ -167,143 +139,140 @@ fn lockstep_iter_size(t: &TokenTree, r: &TtReader) -> LockstepIterSize {
 
 // return the next token from the TtReader.
 // EFFECT: advances the reader's token field
-pub fn tt_next_token(r: &TtReader) -> TokenAndSpan {
+pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
     // FIXME(pcwalton): Bad copy?
     let ret_val = TokenAndSpan {
-        tok: r.cur_tok.get(),
-        sp: r.cur_span.get(),
+        tok: r.cur_tok.clone(),
+        sp: r.cur_span.clone(),
     };
     loop {
-        if r.stack.borrow().idx.get() < r.stack.borrow().forest.len() {
-            break;
-        }
-
-        /* done with this set; pop or repeat? */
-        if !r.stack.get().dotdotdoted || {
-                *r.repeat_idx.borrow().last().unwrap() ==
-                *r.repeat_len.borrow().last().unwrap() - 1
-            } {
-
-            match r.stack.get().up {
-              None => {
-                r.cur_tok.set(EOF);
+        let should_pop = match r.stack.last() {
+            None => {
+                assert_eq!(ret_val.tok, EOF);
                 return ret_val;
-              }
-              Some(tt_f) => {
-                if r.stack.get().dotdotdoted {
-                    r.repeat_idx.borrow_mut().pop().unwrap();
-                    r.repeat_len.borrow_mut().pop().unwrap();
+            }
+            Some(frame) => {
+                if frame.idx < frame.forest.len() {
+                    break;
                 }
-
-                r.stack.set(tt_f);
-                r.stack.get().idx.set(r.stack.get().idx.get() + 1u);
-              }
+                !frame.dotdotdoted ||
+                    *r.repeat_idx.last().unwrap() == *r.repeat_len.last().unwrap() - 1
             }
+        };
 
-        } else { /* repeat */
-            r.stack.get().idx.set(0u);
-            {
-                let mut repeat_idx = r.repeat_idx.borrow_mut();
-                let last_repeat_idx = repeat_idx.len() - 1u;
-                *repeat_idx.get_mut(last_repeat_idx) += 1u;
+        /* done with this set; pop or repeat? */
+        if should_pop {
+            let prev = r.stack.pop().unwrap();
+            match r.stack.mut_last() {
+                None => {
+                    r.cur_tok = EOF;
+                    return ret_val;
+                }
+                Some(frame) => {
+                    frame.idx += 1;
+                }
             }
-            match r.stack.get().sep.clone() {
-              Some(tk) => {
-                r.cur_tok.set(tk); /* repeat same span, I guess */
-                return ret_val;
-              }
-              None => ()
+            if prev.dotdotdoted {
+                r.repeat_idx.pop();
+                r.repeat_len.pop();
+            }
+        } else { /* repeat */
+            *r.repeat_idx.mut_last().unwrap() += 1u;
+            r.stack.mut_last().unwrap().idx = 0;
+            match r.stack.last().unwrap().sep.clone() {
+                Some(tk) => {
+                    r.cur_tok = tk; /* repeat same span, I guess */
+                    return ret_val;
+                }
+                None => {}
             }
         }
     }
     loop { /* because it's easiest, this handles `TTDelim` not starting
-    with a `TTTok`, even though it won't happen */
-        // FIXME(pcwalton): Bad copy.
-        match (*r.stack.get().forest.get(r.stack.get().idx.get())).clone() {
-          TTDelim(tts) => {
-            r.stack.set(@TtFrame {
-                forest: tts,
-                idx: Cell::new(0u),
-                dotdotdoted: false,
-                sep: None,
-                up: Some(r.stack.get())
-            });
-            // if this could be 0-length, we'd need to potentially recur here
-          }
-          TTTok(sp, tok) => {
-            r.cur_span.set(sp);
-            r.cur_tok.set(tok);
-            r.stack.get().idx.set(r.stack.get().idx.get() + 1u);
-            return ret_val;
-          }
-          TTSeq(sp, tts, sep, zerok) => {
+              with a `TTTok`, even though it won't happen */
+        let t = {
+            let frame = r.stack.last().unwrap();
             // FIXME(pcwalton): Bad copy.
-            let t = TTSeq(sp, tts, sep.clone(), zerok);
-            match lockstep_iter_size(&t, r) {
-              LisUnconstrained => {
-                r.sp_diag.span_fatal(
-                    sp, /* blame macro writer */
-                      "attempted to repeat an expression \
-                       containing no syntax \
-                       variables matched as repeating at this depth");
-                  }
-                  LisContradiction(ref msg) => {
-                      /* FIXME #2887 blame macro invoker instead*/
-                      r.sp_diag.span_fatal(sp, (*msg));
-                  }
-                  LisConstraint(len, _) => {
-                    if len == 0 {
-                      if !zerok {
-                        r.sp_diag.span_fatal(sp, /* FIXME #2887 blame invoker
-                        */
-                                             "this must repeat at least \
-                                              once");
-                          }
-
-                    r.stack.get().idx.set(r.stack.get().idx.get() + 1u);
-                    return tt_next_token(r);
-                } else {
-                    r.repeat_len.borrow_mut().push(len);
-                    r.repeat_idx.borrow_mut().push(0u);
-                    r.stack.set(@TtFrame {
-                        forest: tts,
-                        idx: Cell::new(0u),
-                        dotdotdoted: true,
-                        sep: sep,
-                        up: Some(r.stack.get())
-                    });
-                }
-              }
+            (*frame.forest.get(frame.idx)).clone()
+        };
+        match t {
+            TTDelim(tts) => {
+                r.stack.push(TtFrame {
+                    forest: tts,
+                    idx: 0,
+                    dotdotdoted: false,
+                    sep: None
+                });
+                // if this could be 0-length, we'd need to potentially recur here
             }
-          }
-          // FIXME #2887: think about span stuff here
-          TTNonterminal(sp, ident) => {
-            match *lookup_cur_matched(r, ident) {
-              /* sidestep the interpolation tricks for ident because
-              (a) idents can be in lots of places, so it'd be a pain
-              (b) we actually can, since it's a token. */
-              MatchedNonterminal(NtIdent(~sn,b)) => {
-                r.cur_span.set(sp);
-                r.cur_tok.set(IDENT(sn,b));
-                r.stack.get().idx.set(r.stack.get().idx.get() + 1u);
+            TTTok(sp, tok) => {
+                r.cur_span = sp;
+                r.cur_tok = tok;
+                r.stack.mut_last().unwrap().idx += 1;
                 return ret_val;
-              }
-              MatchedNonterminal(ref other_whole_nt) => {
+            }
+            TTSeq(sp, tts, sep, zerok) => {
                 // FIXME(pcwalton): Bad copy.
-                r.cur_span.set(sp);
-                r.cur_tok.set(INTERPOLATED((*other_whole_nt).clone()));
-                r.stack.get().idx.set(r.stack.get().idx.get() + 1u);
-                return ret_val;
-              }
-              MatchedSeq(..) => {
-                r.sp_diag.span_fatal(
-                    r.cur_span.get(), /* blame the macro writer */
-                    format!("variable '{}' is still repeating at this depth",
-                            token::get_ident(ident)));
-              }
+                match lockstep_iter_size(&TTSeq(sp, tts.clone(), sep.clone(), zerok), r) {
+                    LisUnconstrained => {
+                        r.sp_diag.span_fatal(
+                            sp.clone(), /* blame macro writer */
+                            "attempted to repeat an expression \
+                             containing no syntax \
+                             variables matched as repeating at this depth");
+                        }
+                        LisContradiction(ref msg) => {
+                            // FIXME #2887 blame macro invoker instead
+                            r.sp_diag.span_fatal(sp.clone(), *msg);
+                        }
+                    LisConstraint(len, _) => {
+                        if len == 0 {
+                            if !zerok {
+                                // FIXME #2887 blame invoker
+                                r.sp_diag.span_fatal(sp.clone(),
+                                                     "this must repeat at least once");
+                            }
+
+                            r.stack.mut_last().unwrap().idx += 1;
+                            return tt_next_token(r);
+                        }
+                        r.repeat_len.push(len);
+                        r.repeat_idx.push(0);
+                        r.stack.push(TtFrame {
+                            forest: tts,
+                            idx: 0,
+                            dotdotdoted: true,
+                            sep: sep.clone()
+                        });
+                    }
+                }
+            }
+            // FIXME #2887: think about span stuff here
+            TTNonterminal(sp, ident) => {
+                r.stack.mut_last().unwrap().idx += 1;
+                match *lookup_cur_matched(r, ident) {
+                    /* sidestep the interpolation tricks for ident because
+                       (a) idents can be in lots of places, so it'd be a pain
+                       (b) we actually can, since it's a token. */
+                    MatchedNonterminal(NtIdent(~sn,b)) => {
+                        r.cur_span = sp;
+                        r.cur_tok = IDENT(sn,b);
+                        return ret_val;
+                    }
+                    MatchedNonterminal(ref other_whole_nt) => {
+                        // FIXME(pcwalton): Bad copy.
+                        r.cur_span = sp;
+                        r.cur_tok = INTERPOLATED((*other_whole_nt).clone());
+                        return ret_val;
+                    }
+                    MatchedSeq(..) => {
+                        r.sp_diag.span_fatal(
+                            r.cur_span, /* blame the macro writer */
+                            format!("variable '{}' is still repeating at this depth",
+                                    token::get_ident(ident)));
+                    }
+                }
             }
-          }
         }
     }
-
 }
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 291502ff229..e21f14e4a96 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -16,6 +16,8 @@ use parse::token;
 use owned_slice::OwnedSlice;
 use util::small_vector::SmallVector;
 
+use std::rc::Rc;
+
 // We may eventually want to be able to fold over type parameters, too.
 pub trait Folder {
     fn fold_crate(&mut self, c: Crate) -> Crate {
@@ -39,7 +41,7 @@ pub trait Folder {
                 }
                 ViewPathList(ref path, ref path_list_idents, node_id) => {
                     ViewPathList(self.fold_path(path),
-                                 path_list_idents.map(|path_list_ident| {
+                                 path_list_idents.iter().map(|path_list_ident| {
                                     let id = self.new_id(path_list_ident.node
                                                                         .id);
                                     Spanned {
@@ -52,7 +54,7 @@ pub trait Folder {
                                         span: self.new_span(
                                             path_list_ident.span)
                                     }
-                                 }),
+                                 }).collect(),
                                  self.new_id(node_id))
                 }
             };
@@ -81,7 +83,7 @@ pub trait Folder {
                 kind: sf.node.kind,
                 id: self.new_id(sf.node.id),
                 ty: self.fold_ty(sf.node.ty),
-                attrs: sf.node.attrs.map(|e| fold_attribute_(*e, self))
+                attrs: sf.node.attrs.iter().map(|e| fold_attribute_(*e, self)).collect()
             },
             span: self.new_span(sf.span)
         }
@@ -113,7 +115,7 @@ pub trait Folder {
 
     fn fold_arm(&mut self, a: &Arm) -> Arm {
         Arm {
-            pats: a.pats.map(|x| self.fold_pat(*x)),
+            pats: a.pats.iter().map(|x| self.fold_pat(*x)).collect(),
             guard: a.guard.map(|x| self.fold_expr(x)),
             body: self.fold_expr(a.body),
         }
@@ -161,18 +163,18 @@ pub trait Folder {
                     onceness: f.onceness,
                     bounds: fold_opt_bounds(&f.bounds, self),
                     decl: self.fold_fn_decl(f.decl),
-                    lifetimes: f.lifetimes.map(|l| fold_lifetime(l, self)),
+                    lifetimes: f.lifetimes.iter().map(|l| fold_lifetime(l, self)).collect(),
                 })
             }
             TyBareFn(ref f) => {
                 TyBareFn(@BareFnTy {
-                    lifetimes: f.lifetimes.map(|l| fold_lifetime(l, self)),
+                    lifetimes: f.lifetimes.iter().map(|l| fold_lifetime(l, self)).collect(),
                     purity: f.purity,
-                    abis: f.abis,
+                    abi: f.abi,
                     decl: self.fold_fn_decl(f.decl)
                 })
             }
-            TyTup(ref tys) => TyTup(tys.map(|&ty| self.fold_ty(ty))),
+            TyTup(ref tys) => TyTup(tys.iter().map(|&ty| self.fold_ty(ty)).collect()),
             TyPath(ref path, ref bounds, id) => {
                 TyPath(self.fold_path(path),
                        fold_opt_bounds(bounds, self),
@@ -196,7 +198,7 @@ pub trait Folder {
 
     fn fold_foreign_mod(&mut self, nm: &ForeignMod) -> ForeignMod {
         ast::ForeignMod {
-            abis: nm.abis,
+            abi: nm.abi,
             view_items: nm.view_items
                           .iter()
                           .map(|x| self.fold_view_item(x))
@@ -212,8 +214,8 @@ pub trait Folder {
         let kind;
         match v.node.kind {
             TupleVariantKind(ref variant_args) => {
-                kind = TupleVariantKind(variant_args.map(|x|
-                    fold_variant_arg_(x, self)))
+                kind = TupleVariantKind(variant_args.iter().map(|x|
+                    fold_variant_arg_(x, self)).collect())
             }
             StructVariantKind(ref struct_def) => {
                 kind = StructVariantKind(@ast::StructDef {
@@ -224,7 +226,7 @@ pub trait Folder {
             }
         }
 
-        let attrs = v.node.attrs.map(|x| fold_attribute_(*x, self));
+        let attrs = v.node.attrs.iter().map(|x| fold_attribute_(*x, self)).collect();
 
         let de = match v.node.disr_expr {
           Some(e) => Some(self.fold_expr(e)),
@@ -252,11 +254,11 @@ pub trait Folder {
         ast::Path {
             span: self.new_span(p.span),
             global: p.global,
-            segments: p.segments.map(|segment| ast::PathSegment {
+            segments: p.segments.iter().map(|segment| ast::PathSegment {
                 identifier: self.fold_ident(segment.identifier),
-                lifetimes: segment.lifetimes.map(|l| fold_lifetime(l, self)),
-                types: segment.types.map(|&typ| self.fold_ty(typ)),
-            })
+                lifetimes: segment.lifetimes.iter().map(|l| fold_lifetime(l, self)).collect(),
+                types: segment.types.iter().map(|&typ| self.fold_ty(typ)).collect(),
+            }).collect()
         }
     }
 
@@ -321,7 +323,7 @@ fn fold_meta_item_<T: Folder>(mi: @MetaItem, fld: &mut T) -> @MetaItem {
             match mi.node {
                 MetaWord(ref id) => MetaWord((*id).clone()),
                 MetaList(ref id, ref mis) => {
-                    MetaList((*id).clone(), mis.map(|e| fold_meta_item_(*e, fld)))
+                    MetaList((*id).clone(), mis.iter().map(|e| fold_meta_item_(*e, fld)).collect())
                 }
                 MetaNameValue(ref id, ref s) => {
                     MetaNameValue((*id).clone(), (*s).clone())
@@ -375,10 +377,10 @@ pub fn fold_tts<T: Folder>(tts: &[TokenTree], fld: &mut T) -> Vec<TokenTree> {
         match *tt {
             TTTok(span, ref tok) =>
             TTTok(span,maybe_fold_ident(tok,fld)),
-            TTDelim(tts) => TTDelim(@fold_tts(tts.as_slice(), fld)),
-            TTSeq(span, pattern, ref sep, is_optional) =>
+            TTDelim(ref tts) => TTDelim(Rc::new(fold_tts(tts.as_slice(), fld))),
+            TTSeq(span, ref pattern, ref sep, is_optional) =>
             TTSeq(span,
-                  @fold_tts(pattern.as_slice(), fld),
+                  Rc::new(fold_tts(pattern.as_slice(), fld)),
                   sep.as_ref().map(|tok|maybe_fold_ident(tok,fld)),
                   is_optional),
             TTNonterminal(sp,ref ident) =>
@@ -400,7 +402,7 @@ fn maybe_fold_ident<T: Folder>(t: &token::Token, fld: &mut T) -> token::Token {
 
 pub fn noop_fold_fn_decl<T: Folder>(decl: &FnDecl, fld: &mut T) -> P<FnDecl> {
     P(FnDecl {
-        inputs: decl.inputs.map(|x| fold_arg_(x, fld)), // bad copy
+        inputs: decl.inputs.iter().map(|x| fold_arg_(x, fld)).collect(), // bad copy
         output: fld.fold_ty(decl.output),
         cf: decl.cf,
         variadic: decl.variadic
@@ -439,7 +441,7 @@ pub fn fold_lifetime<T: Folder>(l: &Lifetime, fld: &mut T) -> Lifetime {
 
 pub fn fold_lifetimes<T: Folder>(lts: &Vec<Lifetime>, fld: &mut T)
                                    -> Vec<Lifetime> {
-    lts.map(|l| fold_lifetime(l, fld))
+    lts.iter().map(|l| fold_lifetime(l, fld)).collect()
 }
 
 pub fn fold_opt_lifetime<T: Folder>(o_lt: &Option<Lifetime>, fld: &mut T)
@@ -454,7 +456,7 @@ pub fn fold_generics<T: Folder>(generics: &Generics, fld: &mut T) -> Generics {
 
 fn fold_struct_def<T: Folder>(struct_def: @StructDef, fld: &mut T) -> @StructDef {
     @ast::StructDef {
-        fields: struct_def.fields.map(|f| fold_struct_field(f, fld)),
+        fields: struct_def.fields.iter().map(|f| fold_struct_field(f, fld)).collect(),
         ctor_id: struct_def.ctor_id.map(|cid| fld.new_id(cid)),
     }
 }
@@ -472,7 +474,7 @@ fn fold_struct_field<T: Folder>(f: &StructField, fld: &mut T) -> StructField {
             kind: f.node.kind,
             id: fld.new_id(f.node.id),
             ty: fld.fold_ty(f.node.ty),
-            attrs: f.node.attrs.map(|a| fold_attribute_(*a, fld)),
+            attrs: f.node.attrs.iter().map(|a| fold_attribute_(*a, fld)).collect(),
         },
         span: fld.new_span(f.span),
     }
@@ -523,14 +525,14 @@ pub fn noop_fold_view_item<T: Folder>(vi: &ViewItem, folder: &mut T)
     };
     ViewItem {
         node: inner_view_item,
-        attrs: vi.attrs.map(|a| fold_attribute_(*a, folder)),
+        attrs: vi.attrs.iter().map(|a| fold_attribute_(*a, folder)).collect(),
         vis: vi.vis,
         span: folder.new_span(vi.span),
     }
 }
 
 pub fn noop_fold_block<T: Folder>(b: P<Block>, folder: &mut T) -> P<Block> {
-    let view_items = b.view_items.map(|x| folder.fold_view_item(x));
+    let view_items = b.view_items.iter().map(|x| folder.fold_view_item(x)).collect();
     let stmts = b.stmts.iter().flat_map(|s| folder.fold_stmt(*s).move_iter()).collect();
     P(Block {
         id: folder.new_id(b.id), // Needs to be first, for ast_map.
@@ -564,9 +566,9 @@ pub fn noop_fold_item_underscore<T: Folder>(i: &Item_, folder: &mut T) -> Item_
         ItemEnum(ref enum_definition, ref generics) => {
             ItemEnum(
                 ast::EnumDef {
-                    variants: enum_definition.variants.map(|&x| {
+                    variants: enum_definition.variants.iter().map(|&x| {
                         folder.fold_variant(x)
-                    }),
+                    }).collect(),
                 },
                 fold_generics(generics, folder))
         }
@@ -578,18 +580,18 @@ pub fn noop_fold_item_underscore<T: Folder>(i: &Item_, folder: &mut T) -> Item_
             ItemImpl(fold_generics(generics, folder),
                      ifce.as_ref().map(|p| fold_trait_ref(p, folder)),
                      folder.fold_ty(ty),
-                     methods.map(|x| folder.fold_method(*x))
+                     methods.iter().map(|x| folder.fold_method(*x)).collect()
             )
         }
         ItemTrait(ref generics, ref traits, ref methods) => {
-            let methods = methods.map(|method| {
+            let methods = methods.iter().map(|method| {
                 match *method {
                     Required(ref m) => Required(folder.fold_type_method(m)),
                     Provided(method) => Provided(folder.fold_method(method))
                 }
-            });
+            }).collect();
             ItemTrait(fold_generics(generics, folder),
-                      traits.map(|p| fold_trait_ref(p, folder)),
+                      traits.iter().map(|p| fold_trait_ref(p, folder)).collect(),
                       methods)
         }
         ItemMac(ref m) => ItemMac(folder.fold_mac(m)),
@@ -600,7 +602,7 @@ pub fn noop_fold_type_method<T: Folder>(m: &TypeMethod, fld: &mut T) -> TypeMeth
     TypeMethod {
         id: fld.new_id(m.id), // Needs to be first, for ast_map.
         ident: fld.fold_ident(m.ident),
-        attrs: m.attrs.map(|a| fold_attribute_(*a, fld)),
+        attrs: m.attrs.iter().map(|a| fold_attribute_(*a, fld)).collect(),
         purity: m.purity,
         decl: fld.fold_fn_decl(m.decl),
         generics: fold_generics(&m.generics, fld),
@@ -621,8 +623,8 @@ pub fn noop_fold_mod<T: Folder>(m: &Mod, folder: &mut T) -> Mod {
 pub fn noop_fold_crate<T: Folder>(c: Crate, folder: &mut T) -> Crate {
     Crate {
         module: folder.fold_mod(&c.module),
-        attrs: c.attrs.map(|x| fold_attribute_(*x, folder)),
-        config: c.config.map(|x| fold_meta_item_(*x, folder)),
+        attrs: c.attrs.iter().map(|x| fold_attribute_(*x, folder)).collect(),
+        config: c.config.iter().map(|x| fold_meta_item_(*x, folder)).collect(),
         span: folder.new_span(c.span),
     }
 }
@@ -641,7 +643,7 @@ pub fn noop_fold_item<T: Folder>(i: &Item, folder: &mut T) -> SmallVector<@Item>
     SmallVector::one(@Item {
         id: id,
         ident: folder.fold_ident(ident),
-        attrs: i.attrs.map(|e| fold_attribute_(*e, folder)),
+        attrs: i.attrs.iter().map(|e| fold_attribute_(*e, folder)).collect(),
         node: node,
         vis: i.vis,
         span: folder.new_span(i.span)
@@ -652,11 +654,11 @@ pub fn noop_fold_foreign_item<T: Folder>(ni: &ForeignItem, folder: &mut T) -> @F
     @ForeignItem {
         id: folder.new_id(ni.id), // Needs to be first, for ast_map.
         ident: folder.fold_ident(ni.ident),
-        attrs: ni.attrs.map(|x| fold_attribute_(*x, folder)),
+        attrs: ni.attrs.iter().map(|x| fold_attribute_(*x, folder)).collect(),
         node: match ni.node {
             ForeignItemFn(ref fdec, ref generics) => {
                 ForeignItemFn(P(FnDecl {
-                    inputs: fdec.inputs.map(|a| fold_arg_(a, folder)),
+                    inputs: fdec.inputs.iter().map(|a| fold_arg_(a, folder)).collect(),
                     output: folder.fold_ty(fdec.output),
                     cf: fdec.cf,
                     variadic: fdec.variadic
@@ -675,7 +677,7 @@ pub fn noop_fold_method<T: Folder>(m: &Method, folder: &mut T) -> @Method {
     @Method {
         id: folder.new_id(m.id), // Needs to be first, for ast_map.
         ident: folder.fold_ident(m.ident),
-        attrs: m.attrs.map(|a| fold_attribute_(*a, folder)),
+        attrs: m.attrs.iter().map(|a| fold_attribute_(*a, folder)).collect(),
         generics: fold_generics(&m.generics, folder),
         explicit_self: folder.fold_explicit_self(&m.explicit_self),
         purity: m.purity,
@@ -698,28 +700,28 @@ pub fn noop_fold_pat<T: Folder>(p: @Pat, folder: &mut T) -> @Pat {
         PatLit(e) => PatLit(folder.fold_expr(e)),
         PatEnum(ref pth, ref pats) => {
             PatEnum(folder.fold_path(pth),
-                    pats.as_ref().map(|pats| pats.map(|x| folder.fold_pat(*x))))
+                    pats.as_ref().map(|pats| pats.iter().map(|x| folder.fold_pat(*x)).collect()))
         }
         PatStruct(ref pth, ref fields, etc) => {
             let pth_ = folder.fold_path(pth);
-            let fs = fields.map(|f| {
+            let fs = fields.iter().map(|f| {
                 ast::FieldPat {
                     ident: f.ident,
                     pat: folder.fold_pat(f.pat)
                 }
-            });
+            }).collect();
             PatStruct(pth_, fs, etc)
         }
-        PatTup(ref elts) => PatTup(elts.map(|x| folder.fold_pat(*x))),
+        PatTup(ref elts) => PatTup(elts.iter().map(|x| folder.fold_pat(*x)).collect()),
         PatUniq(inner) => PatUniq(folder.fold_pat(inner)),
         PatRegion(inner) => PatRegion(folder.fold_pat(inner)),
         PatRange(e1, e2) => {
             PatRange(folder.fold_expr(e1), folder.fold_expr(e2))
         },
         PatVec(ref before, ref slice, ref after) => {
-            PatVec(before.map(|x| folder.fold_pat(*x)),
+            PatVec(before.iter().map(|x| folder.fold_pat(*x)).collect(),
                     slice.map(|x| folder.fold_pat(x)),
-                    after.map(|x| folder.fold_pat(*x)))
+                    after.iter().map(|x| folder.fold_pat(*x)).collect())
         }
     };
 
@@ -738,22 +740,22 @@ pub fn noop_fold_expr<T: Folder>(e: @Expr, folder: &mut T) -> @Expr {
         ExprBox(p, e) => {
             ExprBox(folder.fold_expr(p), folder.fold_expr(e))
         }
-        ExprVec(ref exprs, mutt) => {
-            ExprVec(exprs.map(|&x| folder.fold_expr(x)), mutt)
+        ExprVec(ref exprs) => {
+            ExprVec(exprs.iter().map(|&x| folder.fold_expr(x)).collect())
         }
-        ExprRepeat(expr, count, mutt) => {
-            ExprRepeat(folder.fold_expr(expr), folder.fold_expr(count), mutt)
+        ExprRepeat(expr, count) => {
+            ExprRepeat(folder.fold_expr(expr), folder.fold_expr(count))
         }
-        ExprTup(ref elts) => ExprTup(elts.map(|x| folder.fold_expr(*x))),
+        ExprTup(ref elts) => ExprTup(elts.iter().map(|x| folder.fold_expr(*x)).collect()),
         ExprCall(f, ref args) => {
             ExprCall(folder.fold_expr(f),
-                     args.map(|&x| folder.fold_expr(x)))
+                     args.iter().map(|&x| folder.fold_expr(x)).collect())
         }
         ExprMethodCall(i, ref tps, ref args) => {
             ExprMethodCall(
                 folder.fold_ident(i),
-                tps.map(|&x| folder.fold_ty(x)),
-                args.map(|&x| folder.fold_expr(x)))
+                tps.iter().map(|&x| folder.fold_ty(x)).collect(),
+                args.iter().map(|&x| folder.fold_expr(x)).collect())
         }
         ExprBinary(binop, lhs, rhs) => {
             ExprBinary(binop,
@@ -788,7 +790,7 @@ pub fn noop_fold_expr<T: Folder>(e: @Expr, folder: &mut T) -> @Expr {
         }
         ExprMatch(expr, ref arms) => {
             ExprMatch(folder.fold_expr(expr),
-                      arms.map(|x| folder.fold_arm(x)))
+                      arms.iter().map(|x| folder.fold_arm(x)).collect())
         }
         ExprFnBlock(decl, body) => {
             ExprFnBlock(folder.fold_fn_decl(decl), folder.fold_block(body))
@@ -808,7 +810,7 @@ pub fn noop_fold_expr<T: Folder>(e: @Expr, folder: &mut T) -> @Expr {
         ExprField(el, id, ref tys) => {
             ExprField(folder.fold_expr(el),
                       folder.fold_ident(id),
-                      tys.map(|&x| folder.fold_ty(x)))
+                      tys.iter().map(|&x| folder.fold_ty(x)).collect())
         }
         ExprIndex(el, er) => {
             ExprIndex(folder.fold_expr(el), folder.fold_expr(er))
@@ -821,19 +823,19 @@ pub fn noop_fold_expr<T: Folder>(e: @Expr, folder: &mut T) -> @Expr {
         }
         ExprInlineAsm(ref a) => {
             ExprInlineAsm(InlineAsm {
-                inputs: a.inputs.map(|&(ref c, input)| {
+                inputs: a.inputs.iter().map(|&(ref c, input)| {
                     ((*c).clone(), folder.fold_expr(input))
-                }),
-                outputs: a.outputs.map(|&(ref c, out)| {
+                }).collect(),
+                outputs: a.outputs.iter().map(|&(ref c, out)| {
                     ((*c).clone(), folder.fold_expr(out))
-                }),
+                }).collect(),
                 .. (*a).clone()
             })
         }
         ExprMac(ref mac) => ExprMac(folder.fold_mac(mac)),
         ExprStruct(ref path, ref fields, maybe_expr) => {
             ExprStruct(folder.fold_path(path),
-                       fields.map(|x| fold_field_(*x, folder)),
+                       fields.iter().map(|x| fold_field_(*x, folder)).collect(),
                        maybe_expr.map(|x| folder.fold_expr(x)))
         },
         ExprParen(ex) => ExprParen(folder.fold_expr(ex))
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index 4de17dc598b..012bc50ecab 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -18,17 +18,17 @@ This API is completely unstable and subject to change.
 
 */
 
-#[crate_id = "syntax#0.10-pre"];
-#[license = "MIT/ASL2"];
-#[crate_type = "dylib"];
-#[crate_type = "rlib"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-
-#[feature(macro_rules, globs, managed_boxes, default_type_params, phase,
-          quote)];
-#[allow(deprecated)];
+#![crate_id = "syntax#0.11-pre"]
+#![license = "MIT/ASL2"]
+#![crate_type = "dylib"]
+#![crate_type = "rlib"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+
+#![feature(macro_rules, globs, managed_boxes, default_type_params, phase,
+           quote)]
+#![allow(deprecated)]
 
 extern crate serialize;
 extern crate term;
diff --git a/src/libsyntax/owned_slice.rs b/src/libsyntax/owned_slice.rs
index 57051e78667..57529228b51 100644
--- a/src/libsyntax/owned_slice.rs
+++ b/src/libsyntax/owned_slice.rs
@@ -18,8 +18,8 @@ use serialize::{Encodable, Decodable, Encoder, Decoder};
 #[unsafe_no_drop_flag] // data is set to null on destruction
 pub struct OwnedSlice<T> {
     /// null iff len == 0
-    priv data: *mut T,
-    priv len: uint,
+    data: *mut T,
+    len: uint,
 }
 
 #[unsafe_destructor]
@@ -126,19 +126,22 @@ impl<T> Container for OwnedSlice<T> {
 }
 
 impl<T> FromIterator<T> for OwnedSlice<T> {
-    fn from_iterator<I: Iterator<T>>(mut iter: I) -> OwnedSlice<T> {
+    fn from_iter<I: Iterator<T>>(mut iter: I) -> OwnedSlice<T> {
         OwnedSlice::from_vec(iter.collect())
     }
 }
 
-impl<S: Encoder, T: Encodable<S>> Encodable<S> for OwnedSlice<T> {
-    fn encode(&self, s: &mut S) {
+impl<S: Encoder<E>, T: Encodable<S, E>, E> Encodable<S, E> for OwnedSlice<T> {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
        self.as_slice().encode(s)
     }
 }
 
-impl<D: Decoder, T: Decodable<D>> Decodable<D> for OwnedSlice<T> {
-    fn decode(d: &mut D) -> OwnedSlice<T> {
-        OwnedSlice::from_vec(Decodable::decode(d))
+impl<D: Decoder<E>, T: Decodable<D, E>, E> Decodable<D, E> for OwnedSlice<T> {
+    fn decode(d: &mut D) -> Result<OwnedSlice<T>, E> {
+        Ok(OwnedSlice::from_vec(match Decodable::decode(d) {
+            Ok(t) => t,
+            Err(e) => return Err(e)
+        }))
     }
 }
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index 8f7fb5749a1..ddb6ddb64b4 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -34,9 +34,6 @@ impl<'a> ParserAttr for Parser<'a> {
             debug!("parse_outer_attributes: self.token={:?}",
                    self.token);
             match self.token {
-              token::INTERPOLATED(token::NtAttr(..)) => {
-                attrs.push(self.parse_attribute(false));
-              }
               token::POUND => {
                 attrs.push(self.parse_attribute(false));
               }
@@ -66,11 +63,6 @@ impl<'a> ParserAttr for Parser<'a> {
         debug!("parse_attributes: permit_inner={:?} self.token={:?}",
                permit_inner, self.token);
         let (span, value, mut style) = match self.token {
-            INTERPOLATED(token::NtAttr(attr)) => {
-                assert!(attr.node.style == ast::AttrOuter);
-                self.bump();
-                (attr.span, attr.node.value, ast::AttrOuter)
-            }
             token::POUND => {
                 let lo = self.span.lo;
                 self.bump();
@@ -101,9 +93,8 @@ impl<'a> ParserAttr for Parser<'a> {
         };
 
         if permit_inner && self.eat(&token::SEMI) {
-            // NOTE: uncomment this after a stage0 snap
-            //self.warn("This uses the old attribute syntax. Semicolons
-            //  are not longer required.");
+            self.span_warn(span, "this inner attribute syntax is deprecated. \
+                           The new syntax is `#![foo]`, with a bang and no semicolon.");
             style = ast::AttrInner;
         }
 
@@ -133,9 +124,6 @@ impl<'a> ParserAttr for Parser<'a> {
         let mut next_outer_attrs: Vec<ast::Attribute> = Vec::new();
         loop {
             let attr = match self.token {
-                token::INTERPOLATED(token::NtAttr(..)) => {
-                    self.parse_attribute(true)
-                }
                 token::POUND => {
                     self.parse_attribute(true)
                 }
@@ -163,6 +151,14 @@ impl<'a> ParserAttr for Parser<'a> {
     // | IDENT = lit
     // | IDENT meta_seq
     fn parse_meta_item(&mut self) -> @ast::MetaItem {
+        match self.token {
+            token::INTERPOLATED(token::NtMeta(e)) => {
+                self.bump();
+                return e
+            }
+            _ => {}
+        }
+
         let lo = self.span.lo;
         let ident = self.parse_ident();
         let name = self.id_to_interned_str(ident);
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 43ae9b97350..3bf1474c461 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -31,9 +31,9 @@ pub enum CommentStyle {
 
 #[deriving(Clone)]
 pub struct Comment {
-    style: CommentStyle,
-    lines: Vec<~str> ,
-    pos: BytePos
+    pub style: CommentStyle,
+    pub lines: Vec<~str>,
+    pub pos: BytePos,
 }
 
 pub fn is_doc_comment(s: &str) -> bool {
@@ -104,7 +104,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str {
         }
 
         if can_trim {
-            lines.map(|line| line.slice(i + 1, line.len()).to_owned())
+            lines.iter().map(|line| line.slice(i + 1, line.len()).to_owned()).collect()
         } else {
             lines
         }
@@ -133,44 +133,42 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str {
     fail!("not a doc-comment: {}", comment);
 }
 
-fn read_to_eol(rdr: &StringReader) -> ~str {
+fn read_to_eol(rdr: &mut StringReader) -> ~str {
     let mut val = ~"";
     while !rdr.curr_is('\n') && !is_eof(rdr) {
-        val.push_char(rdr.curr.get().unwrap());
+        val.push_char(rdr.curr.unwrap());
         bump(rdr);
     }
     if rdr.curr_is('\n') { bump(rdr); }
     return val;
 }
 
-fn read_one_line_comment(rdr: &StringReader) -> ~str {
+fn read_one_line_comment(rdr: &mut StringReader) -> ~str {
     let val = read_to_eol(rdr);
     assert!((val[0] == '/' as u8 && val[1] == '/' as u8) ||
                  (val[0] == '#' as u8 && val[1] == '!' as u8));
     return val;
 }
 
-fn consume_non_eol_whitespace(rdr: &StringReader) {
-    while is_whitespace(rdr.curr.get()) && !rdr.curr_is('\n') &&
-            !is_eof(rdr) {
+fn consume_non_eol_whitespace(rdr: &mut StringReader) {
+    while is_whitespace(rdr.curr) && !rdr.curr_is('\n') && !is_eof(rdr) {
         bump(rdr);
     }
 }
 
-fn push_blank_line_comment(rdr: &StringReader, comments: &mut Vec<Comment> ) {
+fn push_blank_line_comment(rdr: &StringReader, comments: &mut Vec<Comment>) {
     debug!(">>> blank-line comment");
-    let v: Vec<~str> = Vec::new();
     comments.push(Comment {
         style: BlankLine,
-        lines: v,
-        pos: rdr.last_pos.get(),
+        lines: Vec::new(),
+        pos: rdr.last_pos,
     });
 }
 
-fn consume_whitespace_counting_blank_lines(rdr: &StringReader,
-                                           comments: &mut Vec<Comment> ) {
-    while is_whitespace(rdr.curr.get()) && !is_eof(rdr) {
-        if rdr.col.get() == CharPos(0u) && rdr.curr_is('\n') {
+fn consume_whitespace_counting_blank_lines(rdr: &mut StringReader,
+                                           comments: &mut Vec<Comment>) {
+    while is_whitespace(rdr.curr) && !is_eof(rdr) {
+        if rdr.col == CharPos(0u) && rdr.curr_is('\n') {
             push_blank_line_comment(rdr, &mut *comments);
         }
         bump(rdr);
@@ -178,10 +176,10 @@ fn consume_whitespace_counting_blank_lines(rdr: &StringReader,
 }
 
 
-fn read_shebang_comment(rdr: &StringReader, code_to_the_left: bool,
-                                            comments: &mut Vec<Comment> ) {
+fn read_shebang_comment(rdr: &mut StringReader, code_to_the_left: bool,
+                        comments: &mut Vec<Comment>) {
     debug!(">>> shebang comment");
-    let p = rdr.last_pos.get();
+    let p = rdr.last_pos;
     debug!("<<< shebang comment");
     comments.push(Comment {
         style: if code_to_the_left { Trailing } else { Isolated },
@@ -190,10 +188,10 @@ fn read_shebang_comment(rdr: &StringReader, code_to_the_left: bool,
     });
 }
 
-fn read_line_comments(rdr: &StringReader, code_to_the_left: bool,
-                                          comments: &mut Vec<Comment> ) {
+fn read_line_comments(rdr: &mut StringReader, code_to_the_left: bool,
+                      comments: &mut Vec<Comment>) {
     debug!(">>> line comments");
-    let p = rdr.last_pos.get();
+    let p = rdr.last_pos;
     let mut lines: Vec<~str> = Vec::new();
     while rdr.curr_is('/') && nextch_is(rdr, '/') {
         let line = read_one_line_comment(rdr);
@@ -247,13 +245,13 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<~str> ,
     lines.push(s1);
 }
 
-fn read_block_comment(rdr: &StringReader,
+fn read_block_comment(rdr: &mut StringReader,
                       code_to_the_left: bool,
                       comments: &mut Vec<Comment> ) {
     debug!(">>> block comment");
-    let p = rdr.last_pos.get();
+    let p = rdr.last_pos;
     let mut lines: Vec<~str> = Vec::new();
-    let col: CharPos = rdr.col.get();
+    let col = rdr.col;
     bump(rdr);
     bump(rdr);
 
@@ -262,7 +260,7 @@ fn read_block_comment(rdr: &StringReader,
     // doc-comments are not really comments, they are attributes
     if (rdr.curr_is('*') && !nextch_is(rdr, '*')) || rdr.curr_is('!') {
         while !(rdr.curr_is('*') && nextch_is(rdr, '/')) && !is_eof(rdr) {
-            curr_line.push_char(rdr.curr.get().unwrap());
+            curr_line.push_char(rdr.curr.unwrap());
             bump(rdr);
         }
         if !is_eof(rdr) {
@@ -286,7 +284,7 @@ fn read_block_comment(rdr: &StringReader,
                 curr_line = ~"";
                 bump(rdr);
             } else {
-                curr_line.push_char(rdr.curr.get().unwrap());
+                curr_line.push_char(rdr.curr.unwrap());
                 if rdr.curr_is('/') && nextch_is(rdr, '*') {
                     bump(rdr);
                     bump(rdr);
@@ -324,7 +322,7 @@ fn peeking_at_comment(rdr: &StringReader) -> bool {
           !lexer::nextnextch_is(rdr, '['));
 }
 
-fn consume_comment(rdr: &StringReader,
+fn consume_comment(rdr: &mut StringReader,
                    code_to_the_left: bool,
                    comments: &mut Vec<Comment> ) {
     debug!(">>> consume comment");
@@ -340,8 +338,8 @@ fn consume_comment(rdr: &StringReader,
 
 #[deriving(Clone)]
 pub struct Literal {
-    lit: ~str,
-    pos: BytePos
+    pub lit: ~str,
+    pub pos: BytePos,
 }
 
 // it appears this function is called only from pprust... that's
@@ -355,7 +353,7 @@ pub fn gather_comments_and_literals(span_diagnostic:
     let src = str::from_utf8_owned(src).unwrap();
     let cm = CodeMap::new();
     let filemap = cm.new_filemap(path, src);
-    let rdr = lexer::new_low_level_string_reader(span_diagnostic, filemap);
+    let mut rdr = lexer::new_low_level_string_reader(span_diagnostic, filemap);
 
     let mut comments: Vec<Comment> = Vec::new();
     let mut literals: Vec<Literal> = Vec::new();
@@ -363,20 +361,20 @@ pub fn gather_comments_and_literals(span_diagnostic:
     while !is_eof(&rdr) {
         loop {
             let mut code_to_the_left = !first_read;
-            consume_non_eol_whitespace(&rdr);
+            consume_non_eol_whitespace(&mut rdr);
             if rdr.curr_is('\n') {
                 code_to_the_left = false;
-                consume_whitespace_counting_blank_lines(&rdr, &mut comments);
+                consume_whitespace_counting_blank_lines(&mut rdr, &mut comments);
             }
             while peeking_at_comment(&rdr) {
-                consume_comment(&rdr, code_to_the_left, &mut comments);
-                consume_whitespace_counting_blank_lines(&rdr, &mut comments);
+                consume_comment(&mut rdr, code_to_the_left, &mut comments);
+                consume_whitespace_counting_blank_lines(&mut rdr, &mut comments);
             }
             break;
         }
 
 
-        let bstart = rdr.last_pos.get();
+        let bstart = rdr.last_pos;
         rdr.next_token();
         //discard, and look ahead; we're working with internal state
         let TokenAndSpan {tok: tok, sp: sp} = rdr.peek();
diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs
index 460ad76cffe..0d40638d3a7 100644
--- a/src/libsyntax/parse/common.rs
+++ b/src/libsyntax/parse/common.rs
@@ -13,8 +13,8 @@ use parse::token;
 // SeqSep : a sequence separator (token)
 // and whether a trailing separator is allowed.
 pub struct SeqSep {
-    sep: Option<token::Token>,
-    trailing_sep_allowed: bool
+    pub sep: Option<token::Token>,
+    pub trailing_sep_allowed: bool
 }
 
 pub fn seq_sep_trailing_disallowed(t: token::Token) -> SeqSep {
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index ccee21f6281..23d7cc0af97 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -12,11 +12,10 @@ use ast;
 use codemap::{BytePos, CharPos, CodeMap, Pos, Span};
 use codemap;
 use diagnostic::SpanHandler;
-use ext::tt::transcribe::{dup_tt_reader, tt_next_token};
+use ext::tt::transcribe::tt_next_token;
 use parse::token;
 use parse::token::{str_to_ident};
 
-use std::cell::{Cell, RefCell};
 use std::char;
 use std::mem::replace;
 use std::num::from_str_radix;
@@ -27,46 +26,45 @@ pub use ext::tt::transcribe::{TtReader, new_tt_reader};
 
 pub trait Reader {
     fn is_eof(&self) -> bool;
-    fn next_token(&self) -> TokenAndSpan;
+    fn next_token(&mut self) -> TokenAndSpan;
     fn fatal(&self, ~str) -> !;
     fn span_diag<'a>(&'a self) -> &'a SpanHandler;
     fn peek(&self) -> TokenAndSpan;
-    fn dup(&self) -> ~Reader:;
 }
 
 #[deriving(Clone, Eq, Show)]
 pub struct TokenAndSpan {
-    tok: token::Token,
-    sp: Span,
+    pub tok: token::Token,
+    pub sp: Span,
 }
 
 pub struct StringReader<'a> {
-    span_diagnostic: &'a SpanHandler,
+    pub span_diagnostic: &'a SpanHandler,
     // The absolute offset within the codemap of the next character to read
-    pos: Cell<BytePos>,
+    pub pos: BytePos,
     // The absolute offset within the codemap of the last character read(curr)
-    last_pos: Cell<BytePos>,
+    pub last_pos: BytePos,
     // The column of the next character to read
-    col: Cell<CharPos>,
+    pub col: CharPos,
     // The last character to be read
-    curr: Cell<Option<char>>,
-    filemap: Rc<codemap::FileMap>,
+    pub curr: Option<char>,
+    pub filemap: Rc<codemap::FileMap>,
     /* cached: */
-    peek_tok: RefCell<token::Token>,
-    peek_span: RefCell<Span>,
+    pub peek_tok: token::Token,
+    pub peek_span: Span,
 }
 
 impl<'a> StringReader<'a> {
     pub fn curr_is(&self, c: char) -> bool {
-        self.curr.get() == Some(c)
+        self.curr == Some(c)
     }
 }
 
 pub fn new_string_reader<'a>(span_diagnostic: &'a SpanHandler,
                              filemap: Rc<codemap::FileMap>)
                              -> StringReader<'a> {
-    let r = new_low_level_string_reader(span_diagnostic, filemap);
-    string_advance_token(&r); /* fill in peek_* */
+    let mut r = new_low_level_string_reader(span_diagnostic, filemap);
+    string_advance_token(&mut r); /* fill in peek_* */
     r
 }
 
@@ -76,97 +74,79 @@ pub fn new_low_level_string_reader<'a>(span_diagnostic: &'a SpanHandler,
                                        -> StringReader<'a> {
     // Force the initial reader bump to start on a fresh line
     let initial_char = '\n';
-    let r = StringReader {
+    let mut r = StringReader {
         span_diagnostic: span_diagnostic,
-        pos: Cell::new(filemap.start_pos),
-        last_pos: Cell::new(filemap.start_pos),
-        col: Cell::new(CharPos(0)),
-        curr: Cell::new(Some(initial_char)),
+        pos: filemap.start_pos,
+        last_pos: filemap.start_pos,
+        col: CharPos(0),
+        curr: Some(initial_char),
         filemap: filemap,
         /* dummy values; not read */
-        peek_tok: RefCell::new(token::EOF),
-        peek_span: RefCell::new(codemap::DUMMY_SP),
+        peek_tok: token::EOF,
+        peek_span: codemap::DUMMY_SP,
     };
-    bump(&r);
+    bump(&mut r);
     r
 }
 
-// duplicating the string reader is probably a bad idea, in
-// that using them will cause interleaved pushes of line
-// offsets to the underlying filemap...
-fn dup_string_reader<'a>(r: &StringReader<'a>) -> StringReader<'a> {
-    StringReader {
-        span_diagnostic: r.span_diagnostic,
-        pos: Cell::new(r.pos.get()),
-        last_pos: Cell::new(r.last_pos.get()),
-        col: Cell::new(r.col.get()),
-        curr: Cell::new(r.curr.get()),
-        filemap: r.filemap.clone(),
-        peek_tok: r.peek_tok.clone(),
-        peek_span: r.peek_span.clone(),
-    }
-}
-
 impl<'a> Reader for StringReader<'a> {
     fn is_eof(&self) -> bool { is_eof(self) }
     // return the next token. EFFECT: advances the string_reader.
-    fn next_token(&self) -> TokenAndSpan {
+    fn next_token(&mut self) -> TokenAndSpan {
         let ret_val = TokenAndSpan {
-            tok: replace(&mut *self.peek_tok.borrow_mut(), token::UNDERSCORE),
-            sp: self.peek_span.get(),
+            tok: replace(&mut self.peek_tok, token::UNDERSCORE),
+            sp: self.peek_span,
         };
         string_advance_token(self);
         ret_val
     }
     fn fatal(&self, m: ~str) -> ! {
-        self.span_diagnostic.span_fatal(self.peek_span.get(), m)
+        self.span_diagnostic.span_fatal(self.peek_span, m)
     }
     fn span_diag<'a>(&'a self) -> &'a SpanHandler { self.span_diagnostic }
     fn peek(&self) -> TokenAndSpan {
         // FIXME(pcwalton): Bad copy!
         TokenAndSpan {
-            tok: self.peek_tok.get(),
-            sp: self.peek_span.get(),
+            tok: self.peek_tok.clone(),
+            sp: self.peek_span.clone(),
         }
     }
-    fn dup(&self) -> ~Reader: { ~dup_string_reader(self) as ~Reader: }
 }
 
 impl<'a> Reader for TtReader<'a> {
     fn is_eof(&self) -> bool {
-        *self.cur_tok.borrow() == token::EOF
+        self.cur_tok == token::EOF
     }
-    fn next_token(&self) -> TokenAndSpan {
+    fn next_token(&mut self) -> TokenAndSpan {
         let r = tt_next_token(self);
         debug!("TtReader: r={:?}", r);
-        return r;
+        r
     }
     fn fatal(&self, m: ~str) -> ! {
-        self.sp_diag.span_fatal(self.cur_span.get(), m);
+        self.sp_diag.span_fatal(self.cur_span, m);
     }
     fn span_diag<'a>(&'a self) -> &'a SpanHandler { self.sp_diag }
     fn peek(&self) -> TokenAndSpan {
         TokenAndSpan {
-            tok: self.cur_tok.get(),
-            sp: self.cur_span.get(),
+            tok: self.cur_tok.clone(),
+            sp: self.cur_span.clone(),
         }
     }
-    fn dup(&self) -> ~Reader: { ~dup_tt_reader(self) as ~Reader: }
 }
 
 // report a lexical error spanning [`from_pos`, `to_pos`)
-fn fatal_span(rdr: &StringReader,
+fn fatal_span(rdr: &mut StringReader,
               from_pos: BytePos,
               to_pos: BytePos,
               m: ~str)
            -> ! {
-    rdr.peek_span.set(codemap::mk_sp(from_pos, to_pos));
+    rdr.peek_span = codemap::mk_sp(from_pos, to_pos);
     rdr.fatal(m);
 }
 
 // report a lexical error spanning [`from_pos`, `to_pos`), appending an
 // escaped character to the error message
-fn fatal_span_char(rdr: &StringReader,
+fn fatal_span_char(rdr: &mut StringReader,
                    from_pos: BytePos,
                    to_pos: BytePos,
                    m: ~str,
@@ -180,36 +160,35 @@ fn fatal_span_char(rdr: &StringReader,
 
 // report a lexical error spanning [`from_pos`, `to_pos`), appending the
 // offending string to the error message
-fn fatal_span_verbose(rdr: &StringReader,
+fn fatal_span_verbose(rdr: &mut StringReader,
                       from_pos: BytePos,
                       to_pos: BytePos,
                       m: ~str)
                    -> ! {
     let mut m = m;
     m.push_str(": ");
-    let s = rdr.filemap.src.slice(
-                  byte_offset(rdr, from_pos).to_uint(),
-                  byte_offset(rdr, to_pos).to_uint());
-    m.push_str(s);
+    let from = byte_offset(rdr, from_pos).to_uint();
+    let to = byte_offset(rdr, to_pos).to_uint();
+    m.push_str(rdr.filemap.src.slice(from, to));
     fatal_span(rdr, from_pos, to_pos, m);
 }
 
 // EFFECT: advance peek_tok and peek_span to refer to the next token.
 // EFFECT: update the interner, maybe.
-fn string_advance_token(r: &StringReader) {
+fn string_advance_token(r: &mut StringReader) {
     match consume_whitespace_and_comments(r) {
         Some(comment) => {
-            r.peek_span.set(comment.sp);
-            r.peek_tok.set(comment.tok);
+            r.peek_span = comment.sp;
+            r.peek_tok = comment.tok;
         },
         None => {
             if is_eof(r) {
-                r.peek_tok.set(token::EOF);
+                r.peek_tok = token::EOF;
             } else {
-                let start_bytepos = r.last_pos.get();
-                r.peek_tok.set(next_token_inner(r));
-                r.peek_span.set(codemap::mk_sp(start_bytepos,
-                                               r.last_pos.get()));
+                let start_bytepos = r.last_pos;
+                r.peek_tok = next_token_inner(r);
+                r.peek_span = codemap::mk_sp(start_bytepos,
+                                             r.last_pos);
             };
         }
     }
@@ -227,7 +206,7 @@ pub fn with_str_from<T>(
                      start: BytePos,
                      f: |s: &str| -> T)
                      -> T {
-    with_str_from_to(rdr, start, rdr.last_pos.get(), f)
+    with_str_from_to(rdr, start, rdr.last_pos, f)
 }
 
 /// Calls `f` with astring slice of the source text spanning from `start`
@@ -245,36 +224,36 @@ fn with_str_from_to<T>(
 
 // EFFECT: advance the StringReader by one character. If a newline is
 // discovered, add it to the FileMap's list of line start offsets.
-pub fn bump(rdr: &StringReader) {
-    rdr.last_pos.set(rdr.pos.get());
-    let current_byte_offset = byte_offset(rdr, rdr.pos.get()).to_uint();
+pub fn bump(rdr: &mut StringReader) {
+    rdr.last_pos = rdr.pos;
+    let current_byte_offset = byte_offset(rdr, rdr.pos).to_uint();
     if current_byte_offset < rdr.filemap.src.len() {
-        assert!(rdr.curr.get().is_some());
-        let last_char = rdr.curr.get().unwrap();
+        assert!(rdr.curr.is_some());
+        let last_char = rdr.curr.unwrap();
         let next = rdr.filemap.src.char_range_at(current_byte_offset);
         let byte_offset_diff = next.next - current_byte_offset;
-        rdr.pos.set(rdr.pos.get() + Pos::from_uint(byte_offset_diff));
-        rdr.curr.set(Some(next.ch));
-        rdr.col.set(rdr.col.get() + CharPos(1u));
+        rdr.pos = rdr.pos + Pos::from_uint(byte_offset_diff);
+        rdr.curr = Some(next.ch);
+        rdr.col = rdr.col + CharPos(1u);
         if last_char == '\n' {
-            rdr.filemap.next_line(rdr.last_pos.get());
-            rdr.col.set(CharPos(0u));
+            rdr.filemap.next_line(rdr.last_pos);
+            rdr.col = CharPos(0u);
         }
 
         if byte_offset_diff > 1 {
-            rdr.filemap.record_multibyte_char(rdr.last_pos.get(), byte_offset_diff);
+            rdr.filemap.record_multibyte_char(rdr.last_pos, byte_offset_diff);
         }
     } else {
-        rdr.curr.set(None);
+        rdr.curr = None;
     }
 }
 
 pub fn is_eof(rdr: &StringReader) -> bool {
-    rdr.curr.get().is_none()
+    rdr.curr.is_none()
 }
 
 pub fn nextch(rdr: &StringReader) -> Option<char> {
-    let offset = byte_offset(rdr, rdr.pos.get()).to_uint();
+    let offset = byte_offset(rdr, rdr.pos).to_uint();
     if offset < rdr.filemap.src.len() {
         Some(rdr.filemap.src.char_at(offset))
     } else {
@@ -286,7 +265,7 @@ pub fn nextch_is(rdr: &StringReader, c: char) -> bool {
 }
 
 pub fn nextnextch(rdr: &StringReader) -> Option<char> {
-    let offset = byte_offset(rdr, rdr.pos.get()).to_uint();
+    let offset = byte_offset(rdr, rdr.pos).to_uint();
     let s = rdr.filemap.deref().src.as_slice();
     if offset >= s.len() { return None }
     let str::CharRange { next, .. } = s.char_range_at(offset);
@@ -332,9 +311,9 @@ fn is_hex_digit(c: Option<char>) -> bool {
 
 // EFFECT: eats whitespace and comments.
 // returns a Some(sugared-doc-attr) if one exists, None otherwise.
-fn consume_whitespace_and_comments(rdr: &StringReader)
+fn consume_whitespace_and_comments(rdr: &mut StringReader)
                                 -> Option<TokenAndSpan> {
-    while is_whitespace(rdr.curr.get()) { bump(rdr); }
+    while is_whitespace(rdr.curr) { bump(rdr); }
     return consume_any_line_comment(rdr);
 }
 
@@ -345,7 +324,7 @@ pub fn is_line_non_doc_comment(s: &str) -> bool {
 // PRECONDITION: rdr.curr is not whitespace
 // EFFECT: eats any kind of comment.
 // returns a Some(sugared-doc-attr) if one exists, None otherwise
-fn consume_any_line_comment(rdr: &StringReader)
+fn consume_any_line_comment(rdr: &mut StringReader)
                          -> Option<TokenAndSpan> {
     if rdr.curr_is('/') {
         match nextch(rdr) {
@@ -354,7 +333,7 @@ fn consume_any_line_comment(rdr: &StringReader)
                 bump(rdr);
                 // line comments starting with "///" or "//!" are doc-comments
                 if rdr.curr_is('/') || rdr.curr_is('!') {
-                    let start_bpos = rdr.pos.get() - BytePos(3);
+                    let start_bpos = rdr.pos - BytePos(3);
                     while !rdr.curr_is('\n') && !is_eof(rdr) {
                         bump(rdr);
                     }
@@ -363,7 +342,7 @@ fn consume_any_line_comment(rdr: &StringReader)
                         if !is_line_non_doc_comment(string) {
                             Some(TokenAndSpan{
                                 tok: token::DOC_COMMENT(str_to_ident(string)),
-                                sp: codemap::mk_sp(start_bpos, rdr.pos.get())
+                                sp: codemap::mk_sp(start_bpos, rdr.pos)
                             })
                         } else {
                             None
@@ -394,7 +373,7 @@ fn consume_any_line_comment(rdr: &StringReader)
             // we're at the beginning of the file...
             let cmap = CodeMap::new();
             cmap.files.borrow_mut().push(rdr.filemap.clone());
-            let loc = cmap.lookup_char_pos_adj(rdr.last_pos.get());
+            let loc = cmap.lookup_char_pos_adj(rdr.last_pos);
             if loc.line == 1u && loc.col == CharPos(0u) {
                 while !rdr.curr_is('\n') && !is_eof(rdr) { bump(rdr); }
                 return consume_whitespace_and_comments(rdr);
@@ -411,10 +390,10 @@ pub fn is_block_non_doc_comment(s: &str) -> bool {
 }
 
 // might return a sugared-doc-attr
-fn consume_block_comment(rdr: &StringReader) -> Option<TokenAndSpan> {
+fn consume_block_comment(rdr: &mut StringReader) -> Option<TokenAndSpan> {
     // block comments starting with "/**" or "/*!" are doc-comments
     let is_doc_comment = rdr.curr_is('*') || rdr.curr_is('!');
-    let start_bpos = rdr.pos.get() - BytePos(if is_doc_comment {3} else {2});
+    let start_bpos = rdr.pos - BytePos(if is_doc_comment {3} else {2});
 
     let mut level: int = 1;
     while level > 0 {
@@ -424,7 +403,7 @@ fn consume_block_comment(rdr: &StringReader) -> Option<TokenAndSpan> {
             } else {
                 ~"unterminated block comment"
             };
-            fatal_span(rdr, start_bpos, rdr.last_pos.get(), msg);
+            fatal_span(rdr, start_bpos, rdr.last_pos, msg);
         } else if rdr.curr_is('/') && nextch_is(rdr, '*') {
             level += 1;
             bump(rdr);
@@ -444,7 +423,7 @@ fn consume_block_comment(rdr: &StringReader) -> Option<TokenAndSpan> {
             if !is_block_non_doc_comment(string) {
                 Some(TokenAndSpan{
                         tok: token::DOC_COMMENT(str_to_ident(string)),
-                        sp: codemap::mk_sp(start_bpos, rdr.pos.get())
+                        sp: codemap::mk_sp(start_bpos, rdr.pos)
                     })
             } else {
                 None
@@ -458,14 +437,14 @@ fn consume_block_comment(rdr: &StringReader) -> Option<TokenAndSpan> {
     if res.is_some() { res } else { consume_whitespace_and_comments(rdr) }
 }
 
-fn scan_exponent(rdr: &StringReader, start_bpos: BytePos) -> Option<~str> {
+fn scan_exponent(rdr: &mut StringReader, start_bpos: BytePos) -> Option<~str> {
     // \x00 hits the `return None` case immediately, so this is fine.
-    let mut c = rdr.curr.get().unwrap_or('\x00');
+    let mut c = rdr.curr.unwrap_or('\x00');
     let mut rslt = ~"";
     if c == 'e' || c == 'E' {
         rslt.push_char(c);
         bump(rdr);
-        c = rdr.curr.get().unwrap_or('\x00');
+        c = rdr.curr.unwrap_or('\x00');
         if c == '-' || c == '+' {
             rslt.push_char(c);
             bump(rdr);
@@ -474,16 +453,16 @@ fn scan_exponent(rdr: &StringReader, start_bpos: BytePos) -> Option<~str> {
         if exponent.len() > 0u {
             return Some(rslt + exponent);
         } else {
-            fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+            fatal_span(rdr, start_bpos, rdr.last_pos,
                        ~"scan_exponent: bad fp literal");
         }
     } else { return None::<~str>; }
 }
 
-fn scan_digits(rdr: &StringReader, radix: uint) -> ~str {
+fn scan_digits(rdr: &mut StringReader, radix: uint) -> ~str {
     let mut rslt = ~"";
     loop {
-        let c = rdr.curr.get();
+        let c = rdr.curr;
         if c == Some('_') { bump(rdr); continue; }
         match c.and_then(|cc| char::to_digit(cc, radix)) {
           Some(_) => {
@@ -495,7 +474,7 @@ fn scan_digits(rdr: &StringReader, radix: uint) -> ~str {
     };
 }
 
-fn check_float_base(rdr: &StringReader, start_bpos: BytePos, last_bpos: BytePos,
+fn check_float_base(rdr: &mut StringReader, start_bpos: BytePos, last_bpos: BytePos,
                     base: uint) {
     match base {
       16u => fatal_span(rdr, start_bpos, last_bpos,
@@ -508,12 +487,12 @@ fn check_float_base(rdr: &StringReader, start_bpos: BytePos, last_bpos: BytePos,
     }
 }
 
-fn scan_number(c: char, rdr: &StringReader) -> token::Token {
+fn scan_number(c: char, rdr: &mut StringReader) -> token::Token {
     let mut num_str;
     let mut base = 10u;
     let mut c = c;
     let mut n = nextch(rdr).unwrap_or('\x00');
-    let start_bpos = rdr.last_pos.get();
+    let start_bpos = rdr.last_pos;
     if c == '0' && n == 'x' {
         bump(rdr);
         bump(rdr);
@@ -528,7 +507,7 @@ fn scan_number(c: char, rdr: &StringReader) -> token::Token {
         base = 2u;
     }
     num_str = scan_digits(rdr, base);
-    c = rdr.curr.get().unwrap_or('\x00');
+    c = rdr.curr.unwrap_or('\x00');
     nextch(rdr);
     if c == 'u' || c == 'i' {
         enum Result { Signed(ast::IntTy), Unsigned(ast::UintTy) }
@@ -538,7 +517,7 @@ fn scan_number(c: char, rdr: &StringReader) -> token::Token {
             else { Unsigned(ast::TyU) }
         };
         bump(rdr);
-        c = rdr.curr.get().unwrap_or('\x00');
+        c = rdr.curr.unwrap_or('\x00');
         if c == '8' {
             bump(rdr);
             tp = if signed { Signed(ast::TyI8) }
@@ -562,12 +541,12 @@ fn scan_number(c: char, rdr: &StringReader) -> token::Token {
                       else { Unsigned(ast::TyU64) };
         }
         if num_str.len() == 0u {
-            fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+            fatal_span(rdr, start_bpos, rdr.last_pos,
                        ~"no valid digits found for number");
         }
         let parsed = match from_str_radix::<u64>(num_str, base as uint) {
             Some(p) => p,
-            None => fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+            None => fatal_span(rdr, start_bpos, rdr.last_pos,
                                ~"int literal is too large")
         };
 
@@ -594,37 +573,37 @@ fn scan_number(c: char, rdr: &StringReader) -> token::Token {
 
     if rdr.curr_is('f') {
         bump(rdr);
-        c = rdr.curr.get().unwrap_or('\x00');
+        c = rdr.curr.unwrap_or('\x00');
         n = nextch(rdr).unwrap_or('\x00');
         if c == '3' && n == '2' {
             bump(rdr);
             bump(rdr);
-            check_float_base(rdr, start_bpos, rdr.last_pos.get(), base);
+            check_float_base(rdr, start_bpos, rdr.last_pos, base);
             return token::LIT_FLOAT(str_to_ident(num_str), ast::TyF32);
         } else if c == '6' && n == '4' {
             bump(rdr);
             bump(rdr);
-            check_float_base(rdr, start_bpos, rdr.last_pos.get(), base);
+            check_float_base(rdr, start_bpos, rdr.last_pos, base);
             return token::LIT_FLOAT(str_to_ident(num_str), ast::TyF64);
             /* FIXME (#2252): if this is out of range for either a
             32-bit or 64-bit float, it won't be noticed till the
             back-end.  */
         } else {
-            fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+            fatal_span(rdr, start_bpos, rdr.last_pos,
                        ~"expected `f32` or `f64` suffix");
         }
     }
     if is_float {
-        check_float_base(rdr, start_bpos, rdr.last_pos.get(), base);
+        check_float_base(rdr, start_bpos, rdr.last_pos, base);
         return token::LIT_FLOAT_UNSUFFIXED(str_to_ident(num_str));
     } else {
         if num_str.len() == 0u {
-            fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+            fatal_span(rdr, start_bpos, rdr.last_pos,
                        ~"no valid digits found for number");
         }
         let parsed = match from_str_radix::<u64>(num_str, base as uint) {
             Some(p) => p,
-            None => fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+            None => fatal_span(rdr, start_bpos, rdr.last_pos,
                                ~"int literal is too large")
         };
 
@@ -633,14 +612,14 @@ fn scan_number(c: char, rdr: &StringReader) -> token::Token {
     }
 }
 
-fn scan_numeric_escape(rdr: &StringReader, n_hex_digits: uint) -> char {
+fn scan_numeric_escape(rdr: &mut StringReader, n_hex_digits: uint) -> char {
     let mut accum_int = 0;
     let mut i = n_hex_digits;
-    let start_bpos = rdr.last_pos.get();
+    let start_bpos = rdr.last_pos;
     while i != 0u && !is_eof(rdr) {
-        let n = rdr.curr.get();
+        let n = rdr.curr;
         if !is_hex_digit(n) {
-            fatal_span_char(rdr, rdr.last_pos.get(), rdr.pos.get(),
+            fatal_span_char(rdr, rdr.last_pos, rdr.pos,
                             ~"illegal character in numeric character escape",
                             n.unwrap());
         }
@@ -650,13 +629,13 @@ fn scan_numeric_escape(rdr: &StringReader, n_hex_digits: uint) -> char {
         i -= 1u;
     }
     if i != 0 && is_eof(rdr) {
-        fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+        fatal_span(rdr, start_bpos, rdr.last_pos,
                    ~"unterminated numeric character escape");
     }
 
     match char::from_u32(accum_int as u32) {
         Some(x) => x,
-        None => fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+        None => fatal_span(rdr, start_bpos, rdr.last_pos,
                            ~"illegal numeric character escape")
     }
 }
@@ -683,14 +662,14 @@ fn ident_continue(c: Option<char>) -> bool {
 // return the next token from the string
 // EFFECT: advances the input past that token
 // EFFECT: updates the interner
-fn next_token_inner(rdr: &StringReader) -> token::Token {
-    let c = rdr.curr.get();
+fn next_token_inner(rdr: &mut StringReader) -> token::Token {
+    let c = rdr.curr;
     if ident_start(c) && !nextch_is(rdr, '"') && !nextch_is(rdr, '#') {
         // Note: r as in r" or r#" is part of a raw string literal,
         // not an identifier, and is handled further down.
 
-        let start = rdr.last_pos.get();
-        while ident_continue(rdr.curr.get()) {
+        let start = rdr.last_pos;
+        while ident_continue(rdr.curr) {
             bump(rdr);
         }
 
@@ -708,7 +687,7 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
     if is_dec_digit(c) {
         return scan_number(c.unwrap(), rdr);
     }
-    fn binop(rdr: &StringReader, op: token::BinOp) -> token::Token {
+    fn binop(rdr: &mut StringReader, op: token::BinOp) -> token::Token {
         bump(rdr);
         if rdr.curr_is('=') {
             bump(rdr);
@@ -783,12 +762,12 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
       }
       '<' => {
         bump(rdr);
-        match rdr.curr.get().unwrap_or('\x00') {
+        match rdr.curr.unwrap_or('\x00') {
           '=' => { bump(rdr); return token::LE; }
           '<' => { return binop(rdr, token::SHL); }
           '-' => {
             bump(rdr);
-            match rdr.curr.get().unwrap_or('\x00') {
+            match rdr.curr.unwrap_or('\x00') {
               '>' => { bump(rdr); return token::DARROW; }
               _ => { return token::LARROW; }
             }
@@ -798,7 +777,7 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
       }
       '>' => {
         bump(rdr);
-        match rdr.curr.get().unwrap_or('\x00') {
+        match rdr.curr.unwrap_or('\x00') {
           '=' => { bump(rdr); return token::GE; }
           '>' => { return binop(rdr, token::SHR); }
           _ => { return token::GT; }
@@ -807,41 +786,41 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
       '\'' => {
         // Either a character constant 'a' OR a lifetime name 'abc
         bump(rdr);
-        let start = rdr.last_pos.get();
+        let start = rdr.last_pos;
 
         // the eof will be picked up by the final `'` check below
-        let mut c2 = rdr.curr.get().unwrap_or('\x00');
+        let mut c2 = rdr.curr.unwrap_or('\x00');
         bump(rdr);
 
         // If the character is an ident start not followed by another single
         // quote, then this is a lifetime name:
         if ident_start(Some(c2)) && !rdr.curr_is('\'') {
-            while ident_continue(rdr.curr.get()) {
+            while ident_continue(rdr.curr) {
                 bump(rdr);
             }
-            return with_str_from(rdr, start, |lifetime_name| {
-                let ident = str_to_ident(lifetime_name);
-                let tok = &token::IDENT(ident, false);
-
-                if token::is_keyword(token::keywords::Self, tok) {
-                    fatal_span(rdr, start, rdr.last_pos.get(),
-                               ~"invalid lifetime name: 'self is no longer a special lifetime");
-                } else if token::is_any_keyword(tok) &&
-                    !token::is_keyword(token::keywords::Static, tok) {
-                    fatal_span(rdr, start, rdr.last_pos.get(),
-                               ~"invalid lifetime name");
-                } else {
-                    token::LIFETIME(ident)
-                }
-            })
+            let ident = with_str_from(rdr, start, |lifetime_name| {
+                str_to_ident(lifetime_name)
+            });
+            let tok = &token::IDENT(ident, false);
+
+            if token::is_keyword(token::keywords::Self, tok) {
+                fatal_span(rdr, start, rdr.last_pos,
+                           ~"invalid lifetime name: 'self is no longer a special lifetime");
+            } else if token::is_any_keyword(tok) &&
+                !token::is_keyword(token::keywords::Static, tok) {
+                fatal_span(rdr, start, rdr.last_pos,
+                           ~"invalid lifetime name");
+            } else {
+                return token::LIFETIME(ident);
+            }
         }
 
         // Otherwise it is a character constant:
         match c2 {
             '\\' => {
                 // '\X' for some X must be a character constant:
-                let escaped = rdr.curr.get();
-                let escaped_pos = rdr.last_pos.get();
+                let escaped = rdr.curr;
+                let escaped_pos = rdr.last_pos;
                 bump(rdr);
                 match escaped {
                     None => {}
@@ -858,7 +837,7 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
                             'u' => scan_numeric_escape(rdr, 4u),
                             'U' => scan_numeric_escape(rdr, 8u),
                             c2 => {
-                                fatal_span_char(rdr, escaped_pos, rdr.last_pos.get(),
+                                fatal_span_char(rdr, escaped_pos, rdr.last_pos,
                                                 ~"unknown character escape", c2)
                             }
                         }
@@ -866,7 +845,7 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
                 }
             }
             '\t' | '\n' | '\r' | '\'' => {
-                fatal_span_char(rdr, start, rdr.last_pos.get(),
+                fatal_span_char(rdr, start, rdr.last_pos,
                                 ~"character constant must be escaped", c2);
             }
             _ => {}
@@ -877,7 +856,7 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
                                // character before position `start` is an
                                // ascii single quote.
                                start - BytePos(1),
-                               rdr.last_pos.get(),
+                               rdr.last_pos,
                                ~"unterminated character constant");
         }
         bump(rdr); // advance curr past token
@@ -885,25 +864,25 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
       }
       '"' => {
         let mut accum_str = ~"";
-        let start_bpos = rdr.last_pos.get();
+        let start_bpos = rdr.last_pos;
         bump(rdr);
         while !rdr.curr_is('"') {
             if is_eof(rdr) {
-                fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+                fatal_span(rdr, start_bpos, rdr.last_pos,
                            ~"unterminated double quote string");
             }
 
-            let ch = rdr.curr.get().unwrap();
+            let ch = rdr.curr.unwrap();
             bump(rdr);
             match ch {
               '\\' => {
                 if is_eof(rdr) {
-                    fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+                    fatal_span(rdr, start_bpos, rdr.last_pos,
                            ~"unterminated double quote string");
                 }
 
-                let escaped = rdr.curr.get().unwrap();
-                let escaped_pos = rdr.last_pos.get();
+                let escaped = rdr.curr.unwrap();
+                let escaped_pos = rdr.last_pos;
                 bump(rdr);
                 match escaped {
                   'n' => accum_str.push_char('\n'),
@@ -924,7 +903,7 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
                     accum_str.push_char(scan_numeric_escape(rdr, 8u));
                   }
                   c2 => {
-                    fatal_span_char(rdr, escaped_pos, rdr.last_pos.get(),
+                    fatal_span_char(rdr, escaped_pos, rdr.last_pos,
                                     ~"unknown string escape", c2);
                   }
                 }
@@ -936,7 +915,7 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
         return token::LIT_STR(str_to_ident(accum_str));
       }
       'r' => {
-        let start_bpos = rdr.last_pos.get();
+        let start_bpos = rdr.last_pos;
         bump(rdr);
         let mut hash_count = 0u;
         while rdr.curr_is('#') {
@@ -945,24 +924,24 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
         }
 
         if is_eof(rdr) {
-            fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+            fatal_span(rdr, start_bpos, rdr.last_pos,
                        ~"unterminated raw string");
         } else if !rdr.curr_is('"') {
-            fatal_span_char(rdr, start_bpos, rdr.last_pos.get(),
+            fatal_span_char(rdr, start_bpos, rdr.last_pos,
                             ~"only `#` is allowed in raw string delimitation; \
                               found illegal character",
-                            rdr.curr.get().unwrap());
+                            rdr.curr.unwrap());
         }
         bump(rdr);
-        let content_start_bpos = rdr.last_pos.get();
+        let content_start_bpos = rdr.last_pos;
         let mut content_end_bpos;
         'outer: loop {
             if is_eof(rdr) {
-                fatal_span(rdr, start_bpos, rdr.last_pos.get(),
+                fatal_span(rdr, start_bpos, rdr.last_pos,
                            ~"unterminated raw string");
             }
             if rdr.curr_is('"') {
-                content_end_bpos = rdr.last_pos.get();
+                content_end_bpos = rdr.last_pos;
                 for _ in range(0, hash_count) {
                     bump(rdr);
                     if !rdr.curr_is('#') {
@@ -1006,14 +985,14 @@ fn next_token_inner(rdr: &StringReader) -> token::Token {
       '^' => { return binop(rdr, token::CARET); }
       '%' => { return binop(rdr, token::PERCENT); }
       c => {
-          fatal_span_char(rdr, rdr.last_pos.get(), rdr.pos.get(),
+          fatal_span_char(rdr, rdr.last_pos, rdr.pos,
                           ~"unknown start of token", c);
       }
     }
 }
 
-fn consume_whitespace(rdr: &StringReader) {
-    while is_whitespace(rdr.curr.get()) && !is_eof(rdr) { bump(rdr); }
+fn consume_whitespace(rdr: &mut StringReader) {
+    while is_whitespace(rdr.curr) && !is_eof(rdr) { bump(rdr); }
 }
 
 #[cfg(test)]
@@ -1041,7 +1020,7 @@ mod test {
 
     #[test] fn t1 () {
         let span_handler = mk_sh();
-        let string_reader = setup(&span_handler,
+        let mut string_reader = setup(&span_handler,
             ~"/* my source file */ \
               fn main() { println!(\"zebra\"); }\n");
         let id = str_to_ident("fn");
@@ -1051,7 +1030,7 @@ mod test {
             sp:Span {lo:BytePos(21),hi:BytePos(23),expn_info: None}};
         assert_eq!(tok1,tok2);
         // the 'main' id is already read:
-        assert_eq!(string_reader.last_pos.get().clone(), BytePos(28));
+        assert_eq!(string_reader.last_pos.clone(), BytePos(28));
         // read another token:
         let tok3 = string_reader.next_token();
         let tok4 = TokenAndSpan{
@@ -1059,12 +1038,12 @@ mod test {
             sp:Span {lo:BytePos(24),hi:BytePos(28),expn_info: None}};
         assert_eq!(tok3,tok4);
         // the lparen is already read:
-        assert_eq!(string_reader.last_pos.get().clone(), BytePos(29))
+        assert_eq!(string_reader.last_pos.clone(), BytePos(29))
     }
 
     // check that the given reader produces the desired stream
     // of tokens (stop checking after exhausting the expected vec)
-    fn check_tokenization (string_reader: StringReader, expected: Vec<token::Token> ) {
+    fn check_tokenization (mut string_reader: StringReader, expected: Vec<token::Token> ) {
         for expected_tok in expected.iter() {
             assert_eq!(&string_reader.next_token().tok, expected_tok);
         }
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index eb6b462fb94..dbb85972774 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -39,7 +39,7 @@ pub mod obsolete;
 
 // info about a parsing session.
 pub struct ParseSess {
-    span_diagnostic: SpanHandler, // better be the same as the one in the reader!
+    pub span_diagnostic: SpanHandler, // better be the same as the one in the reader!
     /// Used to determine and report recursive mod inclusions
     included_mod_stack: RefCell<Vec<Path>>,
 }
@@ -288,11 +288,10 @@ mod test {
     use util::parser_testing::{string_to_expr, string_to_item};
     use util::parser_testing::string_to_stmt;
 
-    #[cfg(test)]
-    fn to_json_str<'a, E: Encodable<json::Encoder<'a>>>(val: &E) -> ~str {
+    fn to_json_str<'a, E: Encodable<json::Encoder<'a>, io::IoError>>(val: &E) -> ~str {
         let mut writer = MemWriter::new();
         let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer);
-        val.encode(&mut encoder);
+        let _ = val.encode(&mut encoder);
         str::from_utf8_owned(writer.unwrap()).unwrap()
     }
 
@@ -357,13 +356,13 @@ mod test {
             [ast::TTTok(_,_),
              ast::TTTok(_,token::NOT),
              ast::TTTok(_,_),
-             ast::TTDelim(delim_elts)] => {
+             ast::TTDelim(ref delim_elts)] => {
                 let delim_elts: &[ast::TokenTree] = delim_elts.as_slice();
                 match delim_elts {
                     [ast::TTTok(_,token::LPAREN),
-                     ast::TTDelim(first_set),
+                     ast::TTDelim(ref first_set),
                      ast::TTTok(_,token::FAT_ARROW),
-                     ast::TTDelim(second_set),
+                     ast::TTDelim(ref second_set),
                      ast::TTTok(_,token::RPAREN)] => {
                         let first_set: &[ast::TokenTree] =
                             first_set.as_slice();
@@ -658,7 +657,7 @@ mod test {
                                 variadic: false
                             }),
                                     ast::ImpureFn,
-                                    abi::AbiSet::Rust(),
+                                    abi::Rust,
                                     ast::Generics{ // no idea on either of these:
                                         lifetimes: Vec::new(),
                                         ty_params: OwnedSlice::empty(),
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index adf3ac0e17d..94f5458ba53 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -8,10 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[macro_escape];
+#![macro_escape]
 
 use abi;
-use abi::AbiSet;
 use ast::{Sigil, BorrowedSigil, ManagedSigil, OwnedSigil};
 use ast::{BareFnTy, ClosureTy};
 use ast::{RegionTyParamBound, TraitTyParamBound};
@@ -78,9 +77,8 @@ use parse::{new_sub_parser_from_file, ParseSess};
 use owned_slice::OwnedSlice;
 
 use collections::HashSet;
-use std::kinds::marker;
 use std::mem::replace;
-use std::vec;
+use std::rc::Rc;
 
 #[allow(non_camel_case_types)]
 #[deriving(Eq)]
@@ -111,17 +109,10 @@ pub enum PathParsingMode {
     LifetimeAndTypesAndBounds,
 }
 
-/// A pair of a path segment and group of type parameter bounds. (See `ast.rs`
-/// for the definition of a path segment.)
-struct PathSegmentAndBoundSet {
-    segment: ast::PathSegment,
-    bound_set: Option<OwnedSlice<TyParamBound>>,
-}
-
 /// A path paired with optional type bounds.
 pub struct PathAndBounds {
-    path: ast::Path,
-    bounds: Option<OwnedSlice<TyParamBound>>,
+    pub path: ast::Path,
+    pub bounds: Option<OwnedSlice<TyParamBound>>,
 }
 
 enum ItemOrViewItem {
@@ -268,7 +259,7 @@ fn maybe_append(lhs: Vec<Attribute> , rhs: Option<Vec<Attribute> >)
              -> Vec<Attribute> {
     match rhs {
         None => lhs,
-        Some(ref attrs) => vec::append(lhs, attrs.as_slice())
+        Some(ref attrs) => lhs.append(attrs.as_slice())
     }
 }
 
@@ -281,7 +272,7 @@ struct ParsedItemsAndViewItems {
 
 /* ident is handled by common.rs */
 
-pub fn Parser<'a>(sess: &'a ParseSess, cfg: ast::CrateConfig, rdr: ~Reader:)
+pub fn Parser<'a>(sess: &'a ParseSess, cfg: ast::CrateConfig, mut rdr: ~Reader:)
               -> Parser<'a> {
     let tok0 = rdr.next_token();
     let span = tok0.sp;
@@ -313,38 +304,35 @@ pub fn Parser<'a>(sess: &'a ParseSess, cfg: ast::CrateConfig, rdr: ~Reader:)
         obsolete_set: HashSet::new(),
         mod_path_stack: Vec::new(),
         open_braces: Vec::new(),
-        nopod: marker::NoPod
     }
 }
 
 pub struct Parser<'a> {
-    sess: &'a ParseSess,
-    cfg: CrateConfig,
+    pub sess: &'a ParseSess,
     // the current token:
-    token: token::Token,
+    pub token: token::Token,
     // the span of the current token:
-    span: Span,
+    pub span: Span,
     // the span of the prior token:
-    last_span: Span,
+    pub last_span: Span,
+    pub cfg: CrateConfig,
     // the previous token or None (only stashed sometimes).
-    last_token: Option<~token::Token>,
-    buffer: [TokenAndSpan, ..4],
-    buffer_start: int,
-    buffer_end: int,
-    tokens_consumed: uint,
-    restriction: restriction,
-    quote_depth: uint, // not (yet) related to the quasiquoter
-    reader: ~Reader:,
-    interner: @token::IdentInterner,
+    pub last_token: Option<~token::Token>,
+    pub buffer: [TokenAndSpan, ..4],
+    pub buffer_start: int,
+    pub buffer_end: int,
+    pub tokens_consumed: uint,
+    pub restriction: restriction,
+    pub quote_depth: uint, // not (yet) related to the quasiquoter
+    pub reader: ~Reader:,
+    pub interner: Rc<token::IdentInterner>,
     /// The set of seen errors about obsolete syntax. Used to suppress
     /// extra detail when the same error is seen twice
-    obsolete_set: HashSet<ObsoleteSyntax>,
+    pub obsolete_set: HashSet<ObsoleteSyntax>,
     /// Used to determine the path to externally loaded source files
-    mod_path_stack: Vec<InternedString> ,
+    pub mod_path_stack: Vec<InternedString>,
     /// Stack of spans of open delimiters. Used for error message.
-    open_braces: Vec<Span> ,
-    /* do not copy the parser; its state is tied to outside state */
-    priv nopod: marker::NoPod
+    pub open_braces: Vec<Span>,
 }
 
 fn is_plain_ident_or_underscore(t: &token::Token) -> bool {
@@ -404,10 +392,7 @@ impl<'a> Parser<'a> {
         } else if inedible.contains(&self.token) {
             // leave it in the input
         } else {
-            let expected = vec::append(edible.iter()
-                                                .map(|x| (*x).clone())
-                                                .collect(),
-                                          inedible);
+            let expected = edible.iter().map(|x| (*x).clone()).collect::<Vec<_>>().append(inedible);
             let expect = tokens_to_str(expected.as_slice());
             let actual = self.this_token_to_str();
             self.fatal(
@@ -446,10 +431,8 @@ impl<'a> Parser<'a> {
         match e.node {
             ExprPath(..) => {
                 // might be unit-struct construction; check for recoverableinput error.
-                let expected = vec::append(edible.iter()
-                                                    .map(|x| (*x).clone())
-                                                    .collect(),
-                                              inedible);
+                let expected = edible.iter().map(|x| (*x).clone()).collect::<Vec<_>>()
+                              .append(inedible);
                 self.check_for_erroneous_unit_struct_expecting(
                     expected.as_slice());
             }
@@ -469,10 +452,8 @@ impl<'a> Parser<'a> {
         debug!("commit_stmt {:?}", s);
         let _s = s; // unused, but future checks might want to inspect `s`.
         if self.last_token.as_ref().map_or(false, |t| is_ident_or_path(*t)) {
-            let expected = vec::append(edible.iter()
-                                                .map(|x| (*x).clone())
-                                                .collect(),
-                                          inedible.as_slice());
+            let expected = edible.iter().map(|x| (*x).clone()).collect::<Vec<_>>()
+                           .append(inedible.as_slice());
             self.check_for_erroneous_unit_struct_expecting(
                 expected.as_slice());
         }
@@ -798,10 +779,10 @@ impl<'a> Parser<'a> {
                       -> R {
         let dist = distance as int;
         while self.buffer_length() < dist {
-            self.buffer[self.buffer_end] = self.reader.next_token();
+            self.buffer[self.buffer_end as uint] = self.reader.next_token();
             self.buffer_end = (self.buffer_end + 1) & 3;
         }
-        f(&self.buffer[(self.buffer_start + dist - 1) & 3].tok)
+        f(&self.buffer[((self.buffer_start + dist - 1) & 3) as uint].tok)
     }
     pub fn fatal(&mut self, m: &str) -> ! {
         self.sess.span_diagnostic.span_fatal(self.span, m)
@@ -818,6 +799,9 @@ impl<'a> Parser<'a> {
     pub fn warn(&mut self, m: &str) {
         self.sess.span_diagnostic.span_warn(self.span, m)
     }
+    pub fn span_warn(&mut self, sp: Span, m: &str) {
+        self.sess.span_diagnostic.span_warn(sp, m)
+    }
     pub fn span_err(&mut self, sp: Span, m: &str) {
         self.sess.span_diagnostic.span_err(sp, m)
     }
@@ -888,17 +872,17 @@ impl<'a> Parser<'a> {
 
         */
 
-        let abis = if self.eat_keyword(keywords::Extern) {
-            self.parse_opt_abis().unwrap_or(AbiSet::C())
+        let abi = if self.eat_keyword(keywords::Extern) {
+            self.parse_opt_abi().unwrap_or(abi::C)
         } else {
-            AbiSet::Rust()
+            abi::Rust
         };
 
         let purity = self.parse_unsafety();
         self.expect_keyword(keywords::Fn);
         let (decl, lifetimes) = self.parse_ty_fn_decl(true);
         return TyBareFn(@BareFnTy {
-            abis: abis,
+            abi: abi,
             purity: purity,
             lifetimes: lifetimes,
             decl: decl
@@ -1110,7 +1094,7 @@ impl<'a> Parser<'a> {
                 debug!("parse_trait_methods(): parsing provided method");
                 let (inner_attrs, body) =
                     p.parse_inner_attrs_and_block();
-                let attrs = vec::append(attrs, inner_attrs.as_slice());
+                let attrs = attrs.append(inner_attrs.as_slice());
                 Provided(@ast::Method {
                     ident: ident,
                     attrs: attrs,
@@ -1514,24 +1498,14 @@ impl<'a> Parser<'a> {
             // First, parse an identifier.
             let identifier = self.parse_ident();
 
-            // Next, parse a colon and bounded type parameters, if applicable.
-            let bound_set = if mode == LifetimeAndTypesAndBounds {
-                self.parse_optional_ty_param_bounds()
-            } else {
-                None
-            };
-
             // Parse the '::' before type parameters if it's required. If
             // it is required and wasn't present, then we're done.
             if mode == LifetimeAndTypesWithColons &&
                     !self.eat(&token::MOD_SEP) {
-                segments.push(PathSegmentAndBoundSet {
-                    segment: ast::PathSegment {
-                        identifier: identifier,
-                        lifetimes: Vec::new(),
-                        types: OwnedSlice::empty(),
-                    },
-                    bound_set: bound_set
+                segments.push(ast::PathSegment {
+                    identifier: identifier,
+                    lifetimes: Vec::new(),
+                    types: OwnedSlice::empty(),
                 });
                 break
             }
@@ -1548,13 +1522,10 @@ impl<'a> Parser<'a> {
             };
 
             // Assemble and push the result.
-            segments.push(PathSegmentAndBoundSet {
-                segment: ast::PathSegment {
-                    identifier: identifier,
-                    lifetimes: lifetimes,
-                    types: types,
-                },
-                bound_set: bound_set
+            segments.push(ast::PathSegment {
+                identifier: identifier,
+                lifetimes: lifetimes,
+                types: types,
             });
 
             // We're done if we don't see a '::', unless the mode required
@@ -1567,42 +1538,25 @@ impl<'a> Parser<'a> {
             }
         }
 
+        // Next, parse a colon and bounded type parameters, if applicable.
+        let bounds = if mode == LifetimeAndTypesAndBounds {
+            self.parse_optional_ty_param_bounds()
+        } else {
+            None
+        };
+
         // Assemble the span.
         let span = mk_sp(lo, self.last_span.hi);
 
-        // Assemble the path segments.
-        let mut path_segments = Vec::new();
-        let mut bounds = None;
-        let last_segment_index = segments.len() - 1;
-        for (i, segment_and_bounds) in segments.move_iter().enumerate() {
-            let PathSegmentAndBoundSet {
-                segment: segment,
-                bound_set: bound_set
-            } = segment_and_bounds;
-            path_segments.push(segment);
-
-            if bound_set.is_some() {
-                if i != last_segment_index {
-                    self.span_err(span,
-                                  "type parameter bounds are allowed only \
-                                   before the last segment in a path")
-                }
-
-                bounds = bound_set
-            }
-        }
-
         // Assemble the result.
-        let path_and_bounds = PathAndBounds {
+        PathAndBounds {
             path: ast::Path {
                 span: span,
                 global: is_global,
-                segments: path_segments,
+                segments: segments,
             },
             bounds: bounds,
-        };
-
-        path_and_bounds
+        }
     }
 
     /// parses 0 or 1 lifetime
@@ -1865,12 +1819,11 @@ impl<'a> Parser<'a> {
             return self.parse_block_expr(lo, UnsafeBlock(ast::UserProvided));
         } else if self.token == token::LBRACKET {
             self.bump();
-            let mutbl = MutImmutable;
 
             if self.token == token::RBRACKET {
                 // Empty vector.
                 self.bump();
-                ex = ExprVec(Vec::new(), mutbl);
+                ex = ExprVec(Vec::new());
             } else {
                 // Nonempty vector.
                 let first_expr = self.parse_expr();
@@ -1881,7 +1834,7 @@ impl<'a> Parser<'a> {
                     self.bump();
                     let count = self.parse_expr();
                     self.expect(&token::RBRACKET);
-                    ex = ExprRepeat(first_expr, count, mutbl);
+                    ex = ExprRepeat(first_expr, count);
                 } else if self.token == token::COMMA {
                     // Vector with two or more elements.
                     self.bump();
@@ -1892,11 +1845,11 @@ impl<'a> Parser<'a> {
                     );
                     let mut exprs = vec!(first_expr);
                     exprs.push_all_move(remaining_exprs);
-                    ex = ExprVec(exprs, mutbl);
+                    ex = ExprVec(exprs);
                 } else {
                     // Vector with one element.
                     self.expect(&token::RBRACKET);
-                    ex = ExprVec(vec!(first_expr), mutbl);
+                    ex = ExprVec(vec!(first_expr));
                 }
             }
             hi = self.last_span.hi;
@@ -1926,12 +1879,9 @@ impl<'a> Parser<'a> {
             if self.token == token::NOT {
                 // MACRO INVOCATION expression
                 self.bump();
-                match self.token {
-                    token::LPAREN | token::LBRACE => {}
-                    _ => self.fatal("expected open delimiter")
-                };
 
-                let ket = token::flip_delimiter(&self.token);
+                let ket = token::close_delimiter_for(&self.token)
+                                .unwrap_or_else(|| self.fatal("expected open delimiter"));
                 self.bump();
 
                 let tts = self.parse_seq_to_end(&ket,
@@ -2138,7 +2088,7 @@ impl<'a> Parser<'a> {
                     let seq = match seq {
                         Spanned { node, .. } => node,
                     };
-                    TTSeq(mk_sp(sp.lo, p.span.hi), @seq, s, z)
+                    TTSeq(mk_sp(sp.lo, p.span.hi), Rc::new(seq), s, z)
                 } else {
                     TTNonterminal(sp, p.parse_ident())
                 }
@@ -2154,8 +2104,8 @@ impl<'a> Parser<'a> {
             TTTok(p.span, p.bump_and_get())
         }
 
-        match self.token {
-            token::EOF => {
+        match (&self.token, token::close_delimiter_for(&self.token)) {
+            (&token::EOF, _) => {
                 let open_braces = self.open_braces.clone();
                 for sp in open_braces.iter() {
                     self.span_note(*sp, "Did you mean to close this delimiter?");
@@ -2164,9 +2114,7 @@ impl<'a> Parser<'a> {
                 // if we give it one
                 self.fatal("this file contains an un-closed delimiter ");
             }
-            token::LPAREN | token::LBRACE | token::LBRACKET => {
-                let close_delim = token::flip_delimiter(&self.token);
-
+            (_, Some(close_delim)) => {
                 // Parse the open delimiter.
                 self.open_braces.push(self.span);
                 let mut result = vec!(parse_any_tt_tok(self));
@@ -2181,7 +2129,7 @@ impl<'a> Parser<'a> {
                 result.push(parse_any_tt_tok(self));
                 self.open_braces.pop().unwrap();
 
-                TTDelim(@result)
+                TTDelim(Rc::new(result))
             }
             _ => parse_non_delim_tt_tok(self)
         }
@@ -2202,13 +2150,12 @@ impl<'a> Parser<'a> {
         // the interpolation of Matcher's
         maybe_whole!(self, NtMatchers);
         let mut name_idx = 0u;
-        match self.token {
-            token::LBRACE | token::LPAREN | token::LBRACKET => {
-                let other_delimiter = token::flip_delimiter(&self.token);
+        match token::close_delimiter_for(&self.token) {
+            Some(other_delimiter) => {
                 self.bump();
                 self.parse_matcher_subseq_upto(&mut name_idx, &other_delimiter)
             }
-            _ => self.fatal("expected open delimiter")
+            None => self.fatal("expected open delimiter")
         }
     }
 
@@ -3183,7 +3130,7 @@ impl<'a> Parser<'a> {
             let pth = self.parse_path(NoTypesAllowed).path;
             self.bump();
 
-            let id = if self.token == token::LPAREN || self.token == token::LBRACE {
+            let id = if token::close_delimiter_for(&self.token).is_some() {
                 token::special_idents::invalid // no special identifier
             } else {
                 self.parse_ident()
@@ -3192,10 +3139,9 @@ impl<'a> Parser<'a> {
             // check that we're pointing at delimiters (need to check
             // again after the `if`, because of `parse_ident`
             // consuming more tokens).
-            let (bra, ket) = match self.token {
-                token::LPAREN => (token::LPAREN, token::RPAREN),
-                token::LBRACE => (token::LBRACE, token::RBRACE),
-                _ => {
+            let (bra, ket) = match token::close_delimiter_for(&self.token) {
+                Some(ket) => (self.token.clone(), ket),
+                None      => {
                     // we only expect an ident if we didn't parse one
                     // above.
                     let ident_str = if id == token::special_idents::invalid {
@@ -3822,11 +3768,11 @@ impl<'a> Parser<'a> {
     }
 
     // parse an item-position function declaration.
-    fn parse_item_fn(&mut self, purity: Purity, abis: AbiSet) -> ItemInfo {
+    fn parse_item_fn(&mut self, purity: Purity, abi: abi::Abi) -> ItemInfo {
         let (ident, generics) = self.parse_fn_header();
         let decl = self.parse_fn_decl(false);
         let (inner_attrs, body) = self.parse_inner_attrs_and_block();
-        (ident, ItemFn(decl, purity, abis, generics, body), Some(inner_attrs))
+        (ident, ItemFn(decl, purity, abi, generics, body), Some(inner_attrs))
     }
 
     // parse a method in a trait impl, starting with `attrs` attributes.
@@ -3849,7 +3795,7 @@ impl<'a> Parser<'a> {
 
         let (inner_attrs, body) = self.parse_inner_attrs_and_block();
         let hi = body.span.hi;
-        let attrs = vec::append(attrs, inner_attrs.as_slice());
+        let attrs = attrs.append(inner_attrs.as_slice());
         @ast::Method {
             ident: ident,
             attrs: attrs,
@@ -3985,7 +3931,7 @@ impl<'a> Parser<'a> {
                 let attrs = p.parse_outer_attributes();
                 let lo = p.span.lo;
                 let struct_field_ = ast::StructField_ {
-                    kind: UnnamedField,
+                    kind: UnnamedField(p.parse_visibility()),
                     id: ast::DUMMY_NODE_ID,
                     ty: p.parse_ty(false),
                     attrs: attrs,
@@ -4081,8 +4027,7 @@ impl<'a> Parser<'a> {
         while self.token != term {
             let mut attrs = self.parse_outer_attributes();
             if first {
-                attrs = vec::append(attrs_remaining.clone(),
-                                       attrs.as_slice());
+                attrs = attrs_remaining.clone().append(attrs.as_slice());
                 first = false;
             }
             debug!("parse_mod_items: parse_item_or_view_item(attrs={:?})",
@@ -4225,7 +4170,7 @@ impl<'a> Parser<'a> {
                                      &path,
                                      id_sp);
         let (inner, next) = p0.parse_inner_attrs_and_next();
-        let mod_attrs = vec::append(outer_attrs, inner.as_slice());
+        let mod_attrs = outer_attrs.append(inner.as_slice());
         let first_item_outer_attrs = next;
         let m0 = p0.parse_mod_items(token::EOF, first_item_outer_attrs);
         self.sess.included_mod_stack.borrow_mut().pop();
@@ -4290,7 +4235,7 @@ impl<'a> Parser<'a> {
     // at this point, this is essentially a wrapper for
     // parse_foreign_items.
     fn parse_foreign_mod_items(&mut self,
-                               abis: AbiSet,
+                               abi: abi::Abi,
                                first_item_attrs: Vec<Attribute> )
                                -> ForeignMod {
         let ParsedItemsAndViewItems {
@@ -4305,7 +4250,7 @@ impl<'a> Parser<'a> {
         }
         assert!(self.token == token::RBRACE);
         ast::ForeignMod {
-            abis: abis,
+            abi: abi,
             view_items: view_items,
             items: foreign_items
         }
@@ -4363,17 +4308,17 @@ impl<'a> Parser<'a> {
     /// extern {}
     fn parse_item_foreign_mod(&mut self,
                               lo: BytePos,
-                              opt_abis: Option<AbiSet>,
+                              opt_abi: Option<abi::Abi>,
                               visibility: Visibility,
                               attrs: Vec<Attribute> )
                               -> ItemOrViewItem {
 
         self.expect(&token::LBRACE);
 
-        let abis = opt_abis.unwrap_or(AbiSet::C());
+        let abi = opt_abi.unwrap_or(abi::C);
 
         let (inner, next) = self.parse_inner_attrs_and_next();
-        let m = self.parse_foreign_mod_items(abis, next);
+        let m = self.parse_foreign_mod_items(abi, next);
         self.expect(&token::RBRACE);
 
         let item = self.mk_item(lo,
@@ -4493,45 +4438,29 @@ impl<'a> Parser<'a> {
 
     // Parses a string as an ABI spec on an extern type or module. Consumes
     // the `extern` keyword, if one is found.
-    fn parse_opt_abis(&mut self) -> Option<AbiSet> {
+    fn parse_opt_abi(&mut self) -> Option<abi::Abi> {
         match self.token {
-            token::LIT_STR(s)
-            | token::LIT_STR_RAW(s, _) => {
+            token::LIT_STR(s) | token::LIT_STR_RAW(s, _) => {
                 self.bump();
                 let identifier_string = token::get_ident(s);
                 let the_string = identifier_string.get();
-                let mut abis = AbiSet::empty();
-                for word in the_string.words() {
-                    match abi::lookup(word) {
-                        Some(abi) => {
-                            if abis.contains(abi) {
-                                self.span_err(
-                                    self.span,
-                                    format!("ABI `{}` appears twice",
-                                         word));
-                            } else {
-                                abis.add(abi);
-                            }
-                        }
-
-                        None => {
-                            self.span_err(
-                                self.span,
-                                format!("illegal ABI: \
-                                      expected one of [{}], \
-                                      found `{}`",
-                                     abi::all_names().connect(", "),
-                                     word));
-                        }
-                     }
-                 }
-                Some(abis)
+                match abi::lookup(the_string) {
+                    Some(abi) => Some(abi),
+                    None => {
+                        self.span_err(
+                            self.span,
+                            format!("illegal ABI: \
+                                  expected one of [{}], \
+                                  found `{}`",
+                                 abi::all_names().connect(", "),
+                                 the_string));
+                        None
+                    }
+                }
             }
 
-            _ => {
-                None
-             }
-         }
+            _ => None,
+        }
     }
 
     // parse one of the items or view items allowed by the
@@ -4545,7 +4474,7 @@ impl<'a> Parser<'a> {
         match self.token {
             INTERPOLATED(token::NtItem(item)) => {
                 self.bump();
-                let new_attrs = vec::append(attrs, item.attrs.as_slice());
+                let new_attrs = attrs.append(item.attrs.as_slice());
                 return IoviItem(@Item {
                     attrs: new_attrs,
                     ..(*item).clone()
@@ -4584,13 +4513,13 @@ impl<'a> Parser<'a> {
                 return self.parse_item_extern_crate(lo, visibility, attrs);
             }
 
-            let opt_abis = self.parse_opt_abis();
+            let opt_abi = self.parse_opt_abi();
 
             if self.eat_keyword(keywords::Fn) {
                 // EXTERN FUNCTION ITEM
-                let abis = opt_abis.unwrap_or(AbiSet::C());
+                let abi = opt_abi.unwrap_or(abi::C);
                 let (ident, item_, extra_attrs) =
-                    self.parse_item_fn(ExternFn, abis);
+                    self.parse_item_fn(ExternFn, abi);
                 let item = self.mk_item(lo,
                                         self.last_span.hi,
                                         ident,
@@ -4599,7 +4528,7 @@ impl<'a> Parser<'a> {
                                         maybe_append(attrs, extra_attrs));
                 return IoviItem(item);
             } else if self.token == token::LBRACE {
-                return self.parse_item_foreign_mod(lo, opt_abis, visibility, attrs);
+                return self.parse_item_foreign_mod(lo, opt_abi, visibility, attrs);
             }
 
             let token_str = self.this_token_to_str();
@@ -4625,7 +4554,7 @@ impl<'a> Parser<'a> {
             // FUNCTION ITEM
             self.bump();
             let (ident, item_, extra_attrs) =
-                self.parse_item_fn(ImpureFn, AbiSet::Rust());
+                self.parse_item_fn(ImpureFn, abi::Rust);
             let item = self.mk_item(lo,
                                     self.last_span.hi,
                                     ident,
@@ -4640,7 +4569,7 @@ impl<'a> Parser<'a> {
             self.bump();
             self.expect_keyword(keywords::Fn);
             let (ident, item_, extra_attrs) =
-                self.parse_item_fn(UnsafeFn, AbiSet::Rust());
+                self.parse_item_fn(UnsafeFn, abi::Rust);
             let item = self.mk_item(lo,
                                     self.last_span.hi,
                                     ident,
@@ -4770,15 +4699,14 @@ impl<'a> Parser<'a> {
                 token::special_idents::invalid // no special identifier
             };
             // eat a matched-delimiter token tree:
-            let tts = match self.token {
-                token::LPAREN | token::LBRACE => {
-                    let ket = token::flip_delimiter(&self.token);
+            let tts = match token::close_delimiter_for(&self.token) {
+                Some(ket) => {
                     self.bump();
                     self.parse_seq_to_end(&ket,
                                           seq_sep_none(),
                                           |p| p.parse_token_tree())
                 }
-                _ => self.fatal("expected open delimiter")
+                None => self.fatal("expected open delimiter")
             };
             // single-variant-enum... :
             let m = ast::MacInvocTT(pth, tts, EMPTY_CTXT);
@@ -4973,9 +4901,7 @@ impl<'a> Parser<'a> {
                                   mut extern_mod_allowed: bool,
                                   macros_allowed: bool)
                                   -> ParsedItemsAndViewItems {
-        let mut attrs = vec::append(first_item_attrs,
-                                       self.parse_outer_attributes()
-                                           .as_slice());
+        let mut attrs = first_item_attrs.append(self.parse_outer_attributes().as_slice());
         // First, parse view items.
         let mut view_items : Vec<ast::ViewItem> = Vec::new();
         let mut items = Vec::new();
@@ -5055,9 +4981,7 @@ impl<'a> Parser<'a> {
     fn parse_foreign_items(&mut self, first_item_attrs: Vec<Attribute> ,
                            macros_allowed: bool)
         -> ParsedItemsAndViewItems {
-        let mut attrs = vec::append(first_item_attrs,
-                                       self.parse_outer_attributes()
-                                           .as_slice());
+        let mut attrs = first_item_attrs.append(self.parse_outer_attributes().as_slice());
         let mut foreign_items = Vec::new();
         loop {
             match self.parse_foreign_item(attrs, macros_allowed) {
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 15525912955..ff1509fe23a 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -22,6 +22,7 @@ use std::char;
 use std::fmt;
 use std::local_data;
 use std::path::BytesContainer;
+use std::rc::Rc;
 
 #[allow(non_camel_case_types)]
 #[deriving(Clone, Encodable, Decodable, Eq, TotalEq, Hash, Show)]
@@ -113,7 +114,7 @@ pub enum Nonterminal {
     NtExpr(@ast::Expr),
     NtTy(  P<ast::Ty>),
     NtIdent(~ast::Ident, bool),
-    NtAttr(@ast::Attribute), // #[foo]
+    NtMeta(@ast::MetaItem), // stuff inside brackets for attributes
     NtPath(~ast::Path),
     NtTT(  @ast::TokenTree), // needs @ed to break a circularity
     NtMatchers(Vec<ast::Matcher> )
@@ -129,7 +130,7 @@ impl fmt::Show for Nonterminal {
             NtExpr(..) => f.pad("NtExpr(..)"),
             NtTy(..) => f.pad("NtTy(..)"),
             NtIdent(..) => f.pad("NtIdent(..)"),
-            NtAttr(..) => f.pad("NtAttr(..)"),
+            NtMeta(..) => f.pad("NtMeta(..)"),
             NtPath(..) => f.pad("NtPath(..)"),
             NtTT(..) => f.pad("NtTT(..)"),
             NtMatchers(..) => f.pad("NtMatchers(..)"),
@@ -241,7 +242,7 @@ pub fn to_str(t: &Token) -> ~str {
       INTERPOLATED(ref nt) => {
         match nt {
             &NtExpr(e) => ::print::pprust::expr_to_str(e),
-            &NtAttr(e) => ::print::pprust::attribute_to_str(e),
+            &NtMeta(e) => ::print::pprust::meta_item_to_str(e),
             _ => {
                 ~"an interpolated " +
                     match *nt {
@@ -249,7 +250,7 @@ pub fn to_str(t: &Token) -> ~str {
                         NtBlock(..) => ~"block",
                         NtStmt(..) => ~"statement",
                         NtPat(..) => ~"pattern",
-                        NtAttr(..) => fail!("should have been handled"),
+                        NtMeta(..) => fail!("should have been handled"),
                         NtExpr(..) => fail!("should have been handled above"),
                         NtTy(..) => ~"type",
                         NtIdent(..) => ~"identifier",
@@ -296,21 +297,17 @@ pub fn can_begin_expr(t: &Token) -> bool {
     }
 }
 
-/// what's the opposite delimiter?
-pub fn flip_delimiter(t: &token::Token) -> token::Token {
+/// Returns the matching close delimiter if this is an open delimiter,
+/// otherwise `None`.
+pub fn close_delimiter_for(t: &Token) -> Option<Token> {
     match *t {
-      LPAREN => RPAREN,
-      LBRACE => RBRACE,
-      LBRACKET => RBRACKET,
-      RPAREN => LPAREN,
-      RBRACE => LBRACE,
-      RBRACKET => LBRACKET,
-      _ => fail!()
+        LPAREN   => Some(RPAREN),
+        LBRACE   => Some(RBRACE),
+        LBRACKET => Some(RBRACKET),
+        _        => None
     }
 }
 
-
-
 pub fn is_lit(t: &Token) -> bool {
     match *t {
       LIT_CHAR(_) => true,
@@ -531,13 +528,14 @@ pub type IdentInterner = StrInterner;
 
 // if an interner exists in TLS, return it. Otherwise, prepare a
 // fresh one.
-pub fn get_ident_interner() -> @IdentInterner {
-    local_data_key!(key: @::parse::token::IdentInterner)
-    match local_data::get(key, |k| k.map(|k| *k)) {
+// FIXME(eddyb) #8726 This should probably use a task-local reference.
+pub fn get_ident_interner() -> Rc<IdentInterner> {
+    local_data_key!(key: Rc<::parse::token::IdentInterner>)
+    match local_data::get(key, |k| k.map(|k| k.clone())) {
         Some(interner) => interner,
         None => {
-            let interner = @mk_fresh_ident_interner();
-            local_data::set(key, interner);
+            let interner = Rc::new(mk_fresh_ident_interner());
+            local_data::set(key, interner.clone());
             interner
         }
     }
@@ -554,7 +552,7 @@ pub fn get_ident_interner() -> @IdentInterner {
 /// somehow.
 #[deriving(Clone, Eq, Hash, Ord, TotalEq, TotalOrd)]
 pub struct InternedString {
-    priv string: RcStr,
+    string: RcStr,
 }
 
 impl InternedString {
@@ -602,15 +600,15 @@ impl<'a> Equiv<&'a str> for InternedString {
     }
 }
 
-impl<D:Decoder> Decodable<D> for InternedString {
-    fn decode(d: &mut D) -> InternedString {
-        get_name(get_ident_interner().intern(d.read_str()))
+impl<D:Decoder<E>, E> Decodable<D, E> for InternedString {
+    fn decode(d: &mut D) -> Result<InternedString, E> {
+        Ok(get_name(get_ident_interner().intern(try!(d.read_str()))))
     }
 }
 
-impl<E:Encoder> Encodable<E> for InternedString {
-    fn encode(&self, e: &mut E) {
-        e.emit_str(self.string.as_slice())
+impl<S:Encoder<E>, E> Encodable<S, E> for InternedString {
+    fn encode(&self, s: &mut S) -> Result<(), E> {
+        s.emit_str(self.string.as_slice())
     }
 }
 
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index 4996c1e96a8..7b64d0293cc 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -257,7 +257,7 @@ pub fn mk_printer(out: ~io::Writer, linewidth: uint) -> Printer {
  * called 'print'.
  */
 pub struct Printer {
-    out: ~io::Writer,
+    pub out: ~io::Writer,
     buf_len: uint,
     margin: int, // width of lines we're constrained to
     space: int, // number of spaces left on line
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index a9ab596b300..fe969c6fd51 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use abi::AbiSet;
+use abi;
 use ast::{P, RegionTyParamBound, TraitTyParamBound, Required, Provided};
 use ast;
 use ast_util;
@@ -26,13 +26,12 @@ use print::pp::{Breaks, Consistent, Inconsistent, eof};
 use print::pp;
 
 use std::cast;
-use std::cell::RefCell;
 use std::char;
 use std::str;
 use std::io;
 use std::io::{IoResult, MemWriter};
+use std::rc::Rc;
 
-// The &mut State is stored here to prevent recursive type.
 pub enum AnnNode<'a> {
     NodeBlock(&'a ast::Block),
     NodeItem(&'a ast::Item),
@@ -55,13 +54,13 @@ pub struct CurrentCommentAndLiteral {
 }
 
 pub struct State<'a> {
-    s: pp::Printer,
+    pub s: pp::Printer,
     cm: Option<&'a CodeMap>,
-    intr: @token::IdentInterner,
+    intr: Rc<token::IdentInterner>,
     comments: Option<Vec<comments::Comment> >,
     literals: Option<Vec<comments::Literal> >,
     cur_cmnt_and_lit: CurrentCommentAndLiteral,
-    boxes: RefCell<Vec<pp::Breaks> >,
+    boxes: Vec<pp::Breaks>,
     ann: &'a PpAnn
 }
 
@@ -82,7 +81,7 @@ pub fn rust_printer_annotated<'a>(writer: ~io::Writer,
             cur_cmnt: 0,
             cur_lit: 0
         },
-        boxes: RefCell::new(Vec::new()),
+        boxes: Vec::new(),
         ann: ann
     }
 }
@@ -124,7 +123,7 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
             cur_cmnt: 0,
             cur_lit: 0
         },
-        boxes: RefCell::new(Vec::new()),
+        boxes: Vec::new(),
         ann: ann
     };
     try!(s.print_mod(&krate.module, krate.attrs.as_slice()));
@@ -191,7 +190,7 @@ pub fn fun_to_str(decl: &ast::FnDecl, purity: ast::Purity, name: ast::Ident,
                   opt_explicit_self: Option<ast::ExplicitSelf_>,
                   generics: &ast::Generics) -> ~str {
     to_str(|s| {
-        try!(s.print_fn(decl, Some(purity), AbiSet::Rust(),
+        try!(s.print_fn(decl, Some(purity), abi::Rust,
                         name, generics, opt_explicit_self, ast::Inherited));
         try!(s.end()); // Close the head box
         s.end() // Close the outer box
@@ -238,23 +237,23 @@ pub fn visibility_qualified(vis: ast::Visibility, s: &str) -> ~str {
 
 impl<'a> State<'a> {
     pub fn ibox(&mut self, u: uint) -> IoResult<()> {
-        self.boxes.borrow_mut().push(pp::Inconsistent);
+        self.boxes.push(pp::Inconsistent);
         pp::ibox(&mut self.s, u)
     }
 
     pub fn end(&mut self) -> IoResult<()> {
-        self.boxes.borrow_mut().pop().unwrap();
+        self.boxes.pop().unwrap();
         pp::end(&mut self.s)
     }
 
     pub fn cbox(&mut self, u: uint) -> IoResult<()> {
-        self.boxes.borrow_mut().push(pp::Consistent);
+        self.boxes.push(pp::Consistent);
         pp::cbox(&mut self.s, u)
     }
 
     // "raw box"
     pub fn rbox(&mut self, u: uint, b: pp::Breaks) -> IoResult<()> {
-        self.boxes.borrow_mut().push(b);
+        self.boxes.push(b);
         pp::rbox(&mut self.s, u, b)
     }
 
@@ -321,8 +320,8 @@ impl<'a> State<'a> {
         self.s.last_token().is_eof() || self.s.last_token().is_hardbreak_tok()
     }
 
-    pub fn in_cbox(&mut self) -> bool {
-        match self.boxes.borrow().last() {
+    pub fn in_cbox(&self) -> bool {
+        match self.boxes.last() {
             Some(&last_box) => last_box == pp::Consistent,
             None => false
         }
@@ -479,7 +478,7 @@ impl<'a> State<'a> {
                     lifetimes: f.lifetimes.clone(),
                     ty_params: OwnedSlice::empty()
                 };
-                try!(self.print_ty_fn(Some(f.abis), None, &None,
+                try!(self.print_ty_fn(Some(f.abi), None, &None,
                                    f.purity, ast::Many, f.decl, None, &None,
                                    Some(&generics), None));
             }
@@ -525,7 +524,7 @@ impl<'a> State<'a> {
         try!(self.print_outer_attributes(item.attrs.as_slice()));
         match item.node {
             ast::ForeignItemFn(decl, ref generics) => {
-                try!(self.print_fn(decl, None, AbiSet::Rust(), item.ident, generics,
+                try!(self.print_fn(decl, None, abi::Rust, item.ident, generics,
                 None, item.vis));
                 try!(self.end()); // end head-ibox
                 try!(word(&mut self.s, ";"));
@@ -591,7 +590,7 @@ impl<'a> State<'a> {
             }
             ast::ItemForeignMod(ref nmod) => {
                 try!(self.head("extern"));
-                try!(self.word_nbsp(nmod.abis.to_str()));
+                try!(self.word_nbsp(nmod.abi.to_str()));
                 try!(self.bopen());
                 try!(self.print_foreign_mod(nmod, item.attrs.as_slice()));
                 try!(self.bclose(item.span));
@@ -743,7 +742,8 @@ impl<'a> State<'a> {
                     |s, field| {
                         match field.node.kind {
                             ast::NamedField(..) => fail!("unexpected named field"),
-                            ast::UnnamedField => {
+                            ast::UnnamedField(vis) => {
+                                try!(s.print_visibility(vis));
                                 try!(s.maybe_print_comment(field.span.lo));
                                 s.print_type(field.node.ty)
                             }
@@ -762,7 +762,7 @@ impl<'a> State<'a> {
 
             for field in struct_def.fields.iter() {
                 match field.node.kind {
-                    ast::UnnamedField => fail!("unexpected unnamed field"),
+                    ast::UnnamedField(..) => fail!("unexpected unnamed field"),
                     ast::NamedField(ident, visibility) => {
                         try!(self.hardbreak_if_not_bol());
                         try!(self.maybe_print_comment(field.span.lo));
@@ -883,7 +883,7 @@ impl<'a> State<'a> {
         try!(self.hardbreak_if_not_bol());
         try!(self.maybe_print_comment(meth.span.lo));
         try!(self.print_outer_attributes(meth.attrs.as_slice()));
-        try!(self.print_fn(meth.decl, Some(meth.purity), AbiSet::Rust(),
+        try!(self.print_fn(meth.decl, Some(meth.purity), abi::Rust,
                         meth.ident, &meth.generics, Some(meth.explicit_self.node),
                         meth.vis));
         try!(word(&mut self.s, " "));
@@ -915,9 +915,6 @@ impl<'a> State<'a> {
             match attr.node.style {
                 ast::AttrInner => {
                     try!(self.print_attribute(attr));
-                    if !attr.node.is_sugared_doc {
-                        try!(word(&mut self.s, ";"));
-                    }
                     count += 1;
                 }
                 _ => {/* fallthrough */ }
@@ -935,7 +932,10 @@ impl<'a> State<'a> {
         if attr.node.is_sugared_doc {
             word(&mut self.s, attr.value_str().unwrap().get())
         } else {
-            try!(word(&mut self.s, "#["));
+            match attr.node.style {
+                ast::AttrInner => try!(word(&mut self.s, "#![")),
+                ast::AttrOuter => try!(word(&mut self.s, "#[")),
+            }
             try!(self.print_meta_item(attr.meta()));
             word(&mut self.s, "]")
         }
@@ -1110,25 +1110,17 @@ impl<'a> State<'a> {
                 try!(self.word_space(")"));
                 try!(self.print_expr(e));
             }
-            ast::ExprVec(ref exprs, mutbl) => {
+            ast::ExprVec(ref exprs) => {
                 try!(self.ibox(indent_unit));
                 try!(word(&mut self.s, "["));
-                if mutbl == ast::MutMutable {
-                    try!(word(&mut self.s, "mut"));
-                    if exprs.len() > 0u { try!(self.nbsp()); }
-                }
                 try!(self.commasep_exprs(Inconsistent, exprs.as_slice()));
                 try!(word(&mut self.s, "]"));
                 try!(self.end());
             }
 
-            ast::ExprRepeat(element, count, mutbl) => {
+            ast::ExprRepeat(element, count) => {
                 try!(self.ibox(indent_unit));
                 try!(word(&mut self.s, "["));
-                if mutbl == ast::MutMutable {
-                    try!(word(&mut self.s, "mut"));
-                    try!(self.nbsp());
-                }
                 try!(self.print_expr(element));
                 try!(word(&mut self.s, ","));
                 try!(word(&mut self.s, ".."));
@@ -1525,7 +1517,7 @@ impl<'a> State<'a> {
         }
 
         let mut first = true;
-        for (i, segment) in path.segments.iter().enumerate() {
+        for segment in path.segments.iter() {
             if first {
                 first = false
             } else {
@@ -1534,14 +1526,6 @@ impl<'a> State<'a> {
 
             try!(self.print_ident(segment.identifier));
 
-            // If this is the last segment, print the bounds.
-            if i == path.segments.len() - 1 {
-                match *opt_bounds {
-                    None => {}
-                    Some(ref bounds) => try!(self.print_bounds(bounds, true)),
-                }
-            }
-
             if !segment.lifetimes.is_empty() || !segment.types.is_empty() {
                 if colons_before_params {
                     try!(word(&mut self.s, "::"))
@@ -1570,7 +1554,11 @@ impl<'a> State<'a> {
                 try!(word(&mut self.s, ">"))
             }
         }
-        Ok(())
+
+        match *opt_bounds {
+            None => Ok(()),
+            Some(ref bounds) => self.print_bounds(bounds, true),
+        }
     }
 
     fn print_path(&mut self, path: &ast::Path,
@@ -1721,14 +1709,14 @@ impl<'a> State<'a> {
     pub fn print_fn(&mut self,
                     decl: &ast::FnDecl,
                     purity: Option<ast::Purity>,
-                    abis: AbiSet,
+                    abi: abi::Abi,
                     name: ast::Ident,
                     generics: &ast::Generics,
                     opt_explicit_self: Option<ast::ExplicitSelf_>,
                     vis: ast::Visibility) -> IoResult<()> {
         try!(self.head(""));
-        try!(self.print_fn_header_info(opt_explicit_self, purity, abis,
-                                    ast::Many, None, vis));
+        try!(self.print_fn_header_info(opt_explicit_self, purity, abi,
+                                       ast::Many, None, vis));
         try!(self.nbsp());
         try!(self.print_ident(name));
         try!(self.print_generics(generics));
@@ -2020,7 +2008,7 @@ impl<'a> State<'a> {
     }
 
     pub fn print_ty_fn(&mut self,
-                       opt_abis: Option<AbiSet>,
+                       opt_abi: Option<abi::Abi>,
                        opt_sigil: Option<ast::Sigil>,
                        opt_region: &Option<ast::Lifetime>,
                        purity: ast::Purity,
@@ -2038,14 +2026,14 @@ impl<'a> State<'a> {
         if opt_sigil == Some(ast::OwnedSigil) && onceness == ast::Once {
             try!(word(&mut self.s, "proc"));
         } else if opt_sigil == Some(ast::BorrowedSigil) {
-            try!(self.print_extern_opt_abis(opt_abis));
+            try!(self.print_extern_opt_abi(opt_abi));
             for lifetime in opt_region.iter() {
                 try!(self.print_lifetime(lifetime));
             }
             try!(self.print_purity(purity));
             try!(self.print_onceness(onceness));
         } else {
-            try!(self.print_opt_abis_and_extern_if_nondefault(opt_abis));
+            try!(self.print_opt_abi_and_extern_if_nondefault(opt_abi));
             try!(self.print_opt_sigil(opt_sigil));
             try!(self.print_opt_lifetime(opt_region));
             try!(self.print_purity(purity));
@@ -2307,24 +2295,25 @@ impl<'a> State<'a> {
         }
     }
 
-    pub fn print_opt_abis_and_extern_if_nondefault(&mut self,
-                                                   opt_abis: Option<AbiSet>)
+    pub fn print_opt_abi_and_extern_if_nondefault(&mut self,
+                                                  opt_abi: Option<abi::Abi>)
         -> IoResult<()> {
-        match opt_abis {
-            Some(abis) if !abis.is_rust() => {
+        match opt_abi {
+            Some(abi::Rust) => Ok(()),
+            Some(abi) => {
                 try!(self.word_nbsp("extern"));
-                self.word_nbsp(abis.to_str())
+                self.word_nbsp(abi.to_str())
             }
-            Some(_) | None => Ok(())
+            None => Ok(())
         }
     }
 
-    pub fn print_extern_opt_abis(&mut self,
-                                 opt_abis: Option<AbiSet>) -> IoResult<()> {
-        match opt_abis {
-            Some(abis) => {
+    pub fn print_extern_opt_abi(&mut self,
+                                opt_abi: Option<abi::Abi>) -> IoResult<()> {
+        match opt_abi {
+            Some(abi) => {
                 try!(self.word_nbsp("extern"));
-                self.word_nbsp(abis.to_str())
+                self.word_nbsp(abi.to_str())
             }
             None => Ok(())
         }
@@ -2343,15 +2332,15 @@ impl<'a> State<'a> {
     pub fn print_fn_header_info(&mut self,
                                 _opt_explicit_self: Option<ast::ExplicitSelf_>,
                                 opt_purity: Option<ast::Purity>,
-                                abis: AbiSet,
+                                abi: abi::Abi,
                                 onceness: ast::Onceness,
                                 opt_sigil: Option<ast::Sigil>,
                                 vis: ast::Visibility) -> IoResult<()> {
         try!(word(&mut self.s, visibility_qualified(vis, "")));
 
-        if abis != AbiSet::Rust() {
+        if abi != abi::Rust {
             try!(self.word_nbsp("extern"));
-            try!(self.word_nbsp(abis.to_str()));
+            try!(self.word_nbsp(abi.to_str()));
 
             if opt_purity != Some(ast::ExternFn) {
                 try!(self.print_opt_purity(opt_purity));
diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs
index 969b9f81785..b7932da8738 100644
--- a/src/libsyntax/util/interner.rs
+++ b/src/libsyntax/util/interner.rs
@@ -23,8 +23,8 @@ use std::hash::Hash;
 use std::rc::Rc;
 
 pub struct Interner<T> {
-    priv map: RefCell<HashMap<T, Name>>,
-    priv vect: RefCell<Vec<T> >,
+    map: RefCell<HashMap<T, Name>>,
+    vect: RefCell<Vec<T> >,
 }
 
 // when traits can extend traits, we should extend index<Name,T> to get []
@@ -92,7 +92,7 @@ impl<T: TotalEq + Hash + Clone + 'static> Interner<T> {
 
 #[deriving(Clone, Eq, Hash, Ord)]
 pub struct RcStr {
-    priv string: Rc<~str>,
+    string: Rc<~str>,
 }
 
 impl TotalEq for RcStr {}
@@ -134,8 +134,8 @@ impl RcStr {
 // A StrInterner differs from Interner<String> in that it accepts
 // &str rather than RcStr, resulting in less allocation.
 pub struct StrInterner {
-    priv map: RefCell<HashMap<RcStr, Name>>,
-    priv vect: RefCell<Vec<RcStr> >,
+    map: RefCell<HashMap<RcStr, Name>>,
+    vect: RefCell<Vec<RcStr> >,
 }
 
 // when traits can extend traits, we should extend index<Name,T> to get []
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs
index b62990036e5..eb7b3162b52 100644
--- a/src/libsyntax/util/parser_testing.rs
+++ b/src/libsyntax/util/parser_testing.rs
@@ -70,7 +70,7 @@ pub fn string_to_pat(source_str: ~str) -> @ast::Pat {
 
 // convert a vector of strings to a vector of ast::Ident's
 pub fn strs_to_idents(ids: Vec<&str> ) -> Vec<ast::Ident> {
-    ids.map(|u| token::str_to_ident(*u))
+    ids.iter().map(|u| token::str_to_ident(*u)).collect()
 }
 
 // does the given string match the pattern? whitespace in the first string
diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs
index 9d6295e3f28..1dcebd7a016 100644
--- a/src/libsyntax/util/small_vector.rs
+++ b/src/libsyntax/util/small_vector.rs
@@ -29,7 +29,7 @@ impl<T> Container for SmallVector<T> {
 }
 
 impl<T> FromIterator<T> for SmallVector<T> {
-    fn from_iterator<I: Iterator<T>>(iter: I) -> SmallVector<T> {
+    fn from_iter<I: Iterator<T>>(iter: I) -> SmallVector<T> {
         let mut v = Zero;
         v.extend(iter);
         v
@@ -167,7 +167,7 @@ mod test {
     }
 
     #[test]
-    fn test_from_iterator() {
+    fn test_from_iter() {
         let v: SmallVector<int> = (vec!(1, 2, 3)).move_iter().collect();
         assert_eq!(3, v.len());
         assert_eq!(&1, v.get(0));
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index de3eb1b9b8d..81e5e228027 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use abi::AbiSet;
+use abi::Abi;
 use ast::*;
 use ast;
 use codemap::Span;
@@ -29,7 +29,7 @@ use owned_slice::OwnedSlice;
 
 pub enum FnKind<'a> {
     // fn foo() or extern "Abi" fn foo()
-    FkItemFn(Ident, &'a Generics, Purity, AbiSet),
+    FkItemFn(Ident, &'a Generics, Purity, Abi),
 
     // fn foo(&self)
     FkMethod(Ident, &'a Generics, &'a Method),
@@ -635,10 +635,10 @@ pub fn walk_expr<E: Clone, V: Visitor<E>>(visitor: &mut V, expression: &Expr, en
             visitor.visit_expr(place, env.clone());
             visitor.visit_expr(subexpression, env.clone())
         }
-        ExprVec(ref subexpressions, _) => {
+        ExprVec(ref subexpressions) => {
             walk_exprs(visitor, subexpressions.as_slice(), env.clone())
         }
-        ExprRepeat(element, count, _) => {
+        ExprRepeat(element, count) => {
             visitor.visit_expr(element, env.clone());
             visitor.visit_expr(count, env.clone())
         }
diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs
index 5ccc6bfb91e..a94a13aa017 100644
--- a/src/libterm/lib.rs
+++ b/src/libterm/lib.rs
@@ -10,17 +10,18 @@
 
 //! Simple ANSI color library
 
-#[crate_id = "term#0.10-pre"];
-#[comment = "Simple ANSI color library"];
-#[license = "MIT/ASL2"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
+#![crate_id = "term#0.11-pre"]
+#![comment = "Simple ANSI color library"]
+#![license = "MIT/ASL2"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
 
-#[feature(macro_rules)];
-#[deny(missing_doc)];
+#![feature(macro_rules)]
+
+#![deny(missing_doc)]
 
 extern crate collections;
 
@@ -111,9 +112,9 @@ fn cap_for_attr(attr: attr::Attr) -> &'static str {
 /// A Terminal that knows how many colors it supports, with a reference to its
 /// parsed TermInfo database record.
 pub struct Terminal<T> {
-    priv num_colors: u16,
-    priv out: T,
-    priv ti: ~TermInfo
+    num_colors: u16,
+    out: T,
+    ti: ~TermInfo
 }
 
 impl<T: Writer> Terminal<T> {
diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs
index 978a8a09d0a..ff01a8406ed 100644
--- a/src/libterm/terminfo/mod.rs
+++ b/src/libterm/terminfo/mod.rs
@@ -15,13 +15,13 @@ use collections::HashMap;
 /// A parsed terminfo database entry.
 pub struct TermInfo {
     /// Names for the terminal
-    priv names: Vec<~str> ,
+    pub names: Vec<~str> ,
     /// Map of capability name to boolean value
-    priv bools: HashMap<~str, bool>,
+    pub bools: HashMap<~str, bool>,
     /// Map of capability name to numeric value
-    numbers: HashMap<~str, u16>,
+    pub numbers: HashMap<~str, u16>,
     /// Map of capability name to raw (unexpanded) string
-    strings: HashMap<~str, Vec<u8> >
+    pub strings: HashMap<~str, Vec<u8> >
 }
 
 pub mod searcher;
diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs
index a638a074271..408d452adba 100644
--- a/src/libterm/terminfo/parm.rs
+++ b/src/libterm/terminfo/parm.rs
@@ -48,9 +48,9 @@ pub enum Param {
 /// Container for static and dynamic variable arrays
 pub struct Variables {
     /// Static variables A-Z
-    priv sta: [Param, ..26],
+    sta: [Param, ..26],
     /// Dynamic variables a-z
-    priv dyn: [Param, ..26]
+    dyn: [Param, ..26]
 }
 
 impl Variables {
@@ -293,12 +293,12 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
                 if cur >= 'A' && cur <= 'Z' {
                     if stack.len() > 0 {
                         let idx = (cur as u8) - ('A' as u8);
-                        vars.sta[idx] = stack.pop().unwrap();
+                        vars.sta[idx as uint] = stack.pop().unwrap();
                     } else { return Err(~"stack is empty") }
                 } else if cur >= 'a' && cur <= 'z' {
                     if stack.len() > 0 {
                         let idx = (cur as u8) - ('a' as u8);
-                        vars.dyn[idx] = stack.pop().unwrap();
+                        vars.dyn[idx as uint] = stack.pop().unwrap();
                     } else { return Err(~"stack is empty") }
                 } else {
                     return Err(~"bad variable name in %P");
@@ -307,10 +307,10 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
             GetVar => {
                 if cur >= 'A' && cur <= 'Z' {
                     let idx = (cur as u8) - ('A' as u8);
-                    stack.push(vars.sta[idx].clone());
+                    stack.push(vars.sta[idx as uint].clone());
                 } else if cur >= 'a' && cur <= 'z' {
                     let idx = (cur as u8) - ('a' as u8);
-                    stack.push(vars.dyn[idx].clone());
+                    stack.push(vars.dyn[idx as uint].clone());
                 } else {
                     return Err(~"bad variable name in %g");
                 }
@@ -563,7 +563,6 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,~str> {
 mod test {
     use super::{expand,String,Variables,Number};
     use std::result::Ok;
-    use std::vec;
 
     #[test]
     fn test_basic_setabf() {
@@ -598,10 +597,8 @@ mod test {
             assert!(res.is_err(),
                     "Op {} succeeded incorrectly with 0 stack entries", *cap);
             let p = if *cap == "%s" || *cap == "%l" { String(~"foo") } else { Number(97) };
-            let res = expand(vec::append(bytes!("%p1").iter()
-                                                         .map(|x| *x)
-                                                         .collect(),
-                                            cap.as_bytes()).as_slice(),
+            let res = expand(bytes!("%p1").iter().map(|x| *x).collect::<Vec<_>>()
+                             .append(cap.as_bytes()).as_slice(),
                              [p],
                              vars);
             assert!(res.is_ok(),
@@ -612,18 +609,14 @@ mod test {
             let res = expand(cap.as_bytes(), [], vars);
             assert!(res.is_err(),
                     "Binop {} succeeded incorrectly with 0 stack entries", *cap);
-            let res = expand(vec::append(bytes!("%{1}").iter()
-                                                          .map(|x| *x)
-                                                          .collect(),
-                                             cap.as_bytes()).as_slice(),
+            let res = expand(bytes!("%{1}").iter().map(|x| *x).collect::<Vec<_>>()
+                             .append(cap.as_bytes()).as_slice(),
                               [],
                               vars);
             assert!(res.is_err(),
                     "Binop {} succeeded incorrectly with 1 stack entry", *cap);
-            let res = expand(vec::append(bytes!("%{1}%{2}").iter()
-                                                              .map(|x| *x)
-                                                              .collect(),
-                                            cap.as_bytes()).as_slice(),
+            let res = expand(bytes!("%{1}%{2}").iter().map(|x| *x).collect::<Vec<_>>()
+                             .append(cap.as_bytes()).as_slice(),
                              [],
                              vars);
             assert!(res.is_ok(),
diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs
index 66d322e079f..6d87d91ffc0 100644
--- a/src/libterm/terminfo/parser/compiled.rs
+++ b/src/libterm/terminfo/parser/compiled.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(non_uppercase_statics)];
+#![allow(non_uppercase_statics)]
 
 //! ncurses-compatible compiled terminfo format parsing (term(5))
 
@@ -223,7 +223,7 @@ pub fn parse(file: &mut io::Reader,
             if b < 0 {
                 return Err(~"error: expected more bools but hit EOF");
             } else if b == 1 {
-                bools_map.insert(bnames[i].to_owned(), true);
+                bools_map.insert(bnames[i as uint].to_owned(), true);
             }
         }
     }
@@ -237,7 +237,7 @@ pub fn parse(file: &mut io::Reader,
         for i in range(0, numbers_count) {
             let n = try!(file.read_le_u16());
             if n != 0xFFFF {
-                numbers_map.insert(nnames[i].to_owned(), n);
+                numbers_map.insert(nnames[i as uint].to_owned(), n);
             }
         }
     }
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 96313c26f1f..622375d8a6c 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -23,17 +23,17 @@
 // running tests while providing a base that other test frameworks may
 // build off of.
 
-#[crate_id = "test#0.10-pre"];
-#[comment = "Rust internal test library only used by rustc"];
-#[license = "MIT/ASL2"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-
-#[feature(asm, macro_rules)];
-#[deny(deprecated_owned_vector)];
+#![crate_id = "test#0.11-pre"]
+#![comment = "Rust internal test library only used by rustc"]
+#![license = "MIT/ASL2"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+
+#![feature(asm, macro_rules)]
+#![deny(deprecated_owned_vector)]
 
 extern crate collections;
 extern crate getopts;
@@ -46,7 +46,7 @@ use stats::Stats;
 use time::precise_time_ns;
 use getopts::{OptGroup, optflag, optopt};
 use serialize::{json, Decodable};
-use serialize::json::ToJson;
+use serialize::json::{Json, ToJson};
 use term::Terminal;
 use term::color::{Color, RED, YELLOW, GREEN, CYAN};
 
@@ -123,7 +123,7 @@ pub enum TestFn {
     StaticTestFn(fn()),
     StaticBenchFn(fn(&mut BenchHarness)),
     StaticMetricFn(proc(&mut MetricMap)),
-    DynTestFn(proc()),
+    DynTestFn(proc:Send()),
     DynMetricFn(proc(&mut MetricMap)),
     DynBenchFn(~TDynBenchFn)
 }
@@ -147,30 +147,30 @@ impl TestFn {
 /// set-up & tear-down before running a piece of code repeatedly via a
 /// call to `iter`.
 pub struct BenchHarness {
-    priv iterations: u64,
-    priv ns_start: u64,
-    priv ns_end: u64,
-    bytes: u64
+    iterations: u64,
+    ns_start: u64,
+    ns_end: u64,
+    pub bytes: u64,
 }
 
 // The definition of a single test. A test runner will run a list of
 // these.
 #[deriving(Clone)]
 pub struct TestDesc {
-    name: TestName,
-    ignore: bool,
-    should_fail: bool
+    pub name: TestName,
+    pub ignore: bool,
+    pub should_fail: bool,
 }
 
 pub struct TestDescAndFn {
-    desc: TestDesc,
-    testfn: TestFn,
+    pub desc: TestDesc,
+    pub testfn: TestFn,
 }
 
 #[deriving(Clone, Encodable, Decodable, Eq, Show)]
 pub struct Metric {
-    priv value: f64,
-    priv noise: f64
+    value: f64,
+    noise: f64
 }
 
 impl Metric {
@@ -242,15 +242,15 @@ pub fn test_main_static(args: &[~str], tests: &[TestDescAndFn]) {
 }
 
 pub struct TestOpts {
-    filter: Option<~str>,
-    run_ignored: bool,
-    run_tests: bool,
-    run_benchmarks: bool,
-    ratchet_metrics: Option<Path>,
-    ratchet_noise_percent: Option<f64>,
-    save_metrics: Option<Path>,
-    test_shard: Option<(uint,uint)>,
-    logfile: Option<Path>
+    pub filter: Option<~str>,
+    pub run_ignored: bool,
+    pub run_tests: bool,
+    pub run_benchmarks: bool,
+    pub ratchet_metrics: Option<Path>,
+    pub ratchet_noise_percent: Option<f64>,
+    pub save_metrics: Option<Path>,
+    pub test_shard: Option<(uint,uint)>,
+    pub logfile: Option<Path>
 }
 
 /// Result of parsing the options.
@@ -375,8 +375,8 @@ pub fn opt_shard(maybestr: Option<~str>) -> Option<(uint,uint)> {
 
 #[deriving(Clone, Eq)]
 pub struct BenchSamples {
-    priv ns_iter_summ: stats::Summary,
-    priv mb_s: uint
+    ns_iter_summ: stats::Summary,
+    mb_s: uint,
 }
 
 #[deriving(Clone, Eq)]
@@ -948,7 +948,7 @@ pub fn run_test(force_ignore: bool,
     #[allow(deprecated_owned_vector)]
     fn run_test_inner(desc: TestDesc,
                       monitor_ch: Sender<MonitorMsg>,
-                      testfn: proc()) {
+                      testfn: proc:Send()) {
         spawn(proc() {
             let (tx, rx) = channel();
             let mut reader = ChanReader::new(rx);
@@ -958,8 +958,8 @@ pub fn run_test(force_ignore: bool,
                 DynTestName(ref name) => name.clone().into_maybe_owned(),
                 StaticTestName(name) => name.into_maybe_owned(),
             });
-            task.opts.stdout = Some(~stdout as ~Writer);
-            task.opts.stderr = Some(~stderr as ~Writer);
+            task.opts.stdout = Some(~stdout as ~Writer:Send);
+            task.opts.stderr = Some(~stderr as ~Writer:Send);
             let result_future = task.future_result();
             task.spawn(testfn);
 
@@ -1018,6 +1018,7 @@ impl ToJson for Metric {
     }
 }
 
+
 impl MetricMap {
 
     pub fn new() -> MetricMap {
@@ -1035,7 +1036,10 @@ impl MetricMap {
         let mut f = File::open(p).unwrap();
         let value = json::from_reader(&mut f as &mut io::Reader).unwrap();
         let mut decoder = json::Decoder::new(value);
-        MetricMap(Decodable::decode(&mut decoder))
+        MetricMap(match Decodable::decode(&mut decoder) {
+            Ok(t) => t,
+            Err(e) => fail!("failure decoding JSON: {}", e)
+        })
     }
 
     /// Write MetricDiff to a file.
diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs
index 222aff37465..e4439e57742 100644
--- a/src/libtest/stats.rs
+++ b/src/libtest/stats.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(missing_doc)];
+#![allow(missing_doc)]
 
 use std::hash::Hash;
 use std::io;
@@ -130,18 +130,18 @@ pub trait Stats {
 #[deriving(Clone, Eq)]
 #[allow(missing_doc)]
 pub struct Summary {
-    sum: f64,
-    min: f64,
-    max: f64,
-    mean: f64,
-    median: f64,
-    var: f64,
-    std_dev: f64,
-    std_dev_pct: f64,
-    median_abs_dev: f64,
-    median_abs_dev_pct: f64,
-    quartiles: (f64,f64,f64),
-    iqr: f64,
+    pub sum: f64,
+    pub min: f64,
+    pub max: f64,
+    pub mean: f64,
+    pub median: f64,
+    pub var: f64,
+    pub std_dev: f64,
+    pub std_dev_pct: f64,
+    pub median_abs_dev: f64,
+    pub median_abs_dev_pct: f64,
+    pub quartiles: (f64,f64,f64),
+    pub iqr: f64,
 }
 
 impl Summary {
diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs
index 8b496964bc0..f3398942575 100644
--- a/src/libtime/lib.rs
+++ b/src/libtime/lib.rs
@@ -8,15 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[crate_id = "time#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-#[feature(phase)];
-#[deny(deprecated_owned_vector)];
+#![crate_id = "time#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+#![feature(phase)]
+#![deny(deprecated_owned_vector)]
 
 #[cfg(test)] #[phase(syntax, link)] extern crate log;
 extern crate serialize;
@@ -67,7 +67,7 @@ mod imp {
 
 /// A record specifying a time value in seconds and nanoseconds.
 #[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Encodable, Decodable, Show)]
-pub struct Timespec { sec: i64, nsec: i32 }
+pub struct Timespec { pub sec: i64, pub nsec: i32 }
 /*
  * Timespec assumes that pre-epoch Timespecs have negative sec and positive
  * nsec fields. Darwin's and Linux's struct timespec functions handle pre-
@@ -191,46 +191,46 @@ pub fn tzset() {
 #[deriving(Clone, Eq, Encodable, Decodable, Show)]
 pub struct Tm {
     /// Seconds after the minute – [0, 60]
-    tm_sec: i32,
+    pub tm_sec: i32,
 
     /// Minutes after the hour – [0, 59]
-    tm_min: i32,
+    pub tm_min: i32,
 
     /// Hours after midnight – [0, 23]
-    tm_hour: i32,
+    pub tm_hour: i32,
 
     /// Day of the month – [1, 31]
-    tm_mday: i32,
+    pub tm_mday: i32,
 
     /// Months since January – [0, 11]
-    tm_mon: i32,
+    pub tm_mon: i32,
 
     /// Years since 1900
-    tm_year: i32,
+    pub tm_year: i32,
 
     /// Days since Sunday – [0, 6]. 0 = Sunday, 1 = Monday, …, 6 = Saturday.
-    tm_wday: i32,
+    pub tm_wday: i32,
 
     /// Days since January 1 – [0, 365]
-    tm_yday: i32,
+    pub tm_yday: i32,
 
     /// Daylight Saving Time flag.
     ///
     /// This value is positive if Daylight Saving Time is in effect, zero if Daylight Saving Time
     /// is not in effect, and negative if this information is not available.
-    tm_isdst: i32,
+    pub tm_isdst: i32,
 
     /// Identifies the time zone that was used to compute this broken-down time value, including any
     /// adjustment for Daylight Saving Time. This is the number of seconds east of UTC. For example,
     /// for U.S. Pacific Daylight Time, the value is -7*60*60 = -25200.
-    tm_gmtoff: i32,
+    pub tm_gmtoff: i32,
 
     /// Abbreviated name for the time zone that was used to compute this broken-down time value.
     /// For example, U.S. Pacific Daylight Time is "PDT".
-    tm_zone: ~str,
+    pub tm_zone: ~str,
 
     /// Nanoseconds after the second – [0, 10<sup>9</sup> - 1]
-    tm_nsec: i32,
+    pub tm_nsec: i32,
 }
 
 pub fn empty_tm() -> Tm {
diff --git a/src/liburl/lib.rs b/src/liburl/lib.rs
index 031c7fafa04..1146e602ac5 100644
--- a/src/liburl/lib.rs
+++ b/src/liburl/lib.rs
@@ -10,14 +10,14 @@
 
 //! Types/fns concerning URLs (see RFC 3986)
 
-#[crate_id = "url#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-#[feature(default_type_params)];
+#![crate_id = "url#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+#![feature(default_type_params)]
 
 extern crate collections;
 
@@ -51,40 +51,40 @@ use collections::HashMap;
 #[deriving(Clone, Eq, TotalEq)]
 pub struct Url {
     /// The scheme part of a URL, such as `https` in the above example.
-    scheme: ~str,
+    pub scheme: ~str,
     /// A URL subcomponent for user authentication.  `username` in the above example.
-    user: Option<UserInfo>,
+    pub user: Option<UserInfo>,
     /// A domain name or IP address.  For example, `example.com`.
-    host: ~str,
+    pub host: ~str,
     /// A TCP port number, for example `8080`.
-    port: Option<~str>,
+    pub port: Option<~str>,
     /// The path component of a URL, for example `/foo/bar`.
-    path: ~str,
+    pub path: ~str,
     /// The query component of a URL.  `vec!((~"baz", ~"qux"))` represents the
     /// fragment `baz=qux` in the above example.
-    query: Query,
+    pub query: Query,
     /// The fragment component, such as `quz`.  Doesn't include the leading `#` character.
-    fragment: Option<~str>
+    pub fragment: Option<~str>
 }
 
 #[deriving(Clone, Eq)]
 pub struct Path {
     /// The path component of a URL, for example `/foo/bar`.
-    path: ~str,
+    pub path: ~str,
     /// The query component of a URL.  `vec!((~"baz", ~"qux"))` represents the
     /// fragment `baz=qux` in the above example.
-    query: Query,
+    pub query: Query,
     /// The fragment component, such as `quz`.  Doesn't include the leading `#` character.
-    fragment: Option<~str>
+    pub fragment: Option<~str>
 }
 
 /// An optional subcomponent of a URI authority component.
 #[deriving(Clone, Eq, TotalEq)]
 pub struct UserInfo {
     /// The user name.
-    user: ~str,
+    pub user: ~str,
     /// Password or other scheme-specific authentication information.
-    pass: Option<~str>
+    pub pass: Option<~str>
 }
 
 /// Represents the query component of a URI.
diff --git a/src/libuuid/lib.rs b/src/libuuid/lib.rs
index d31b0f43a09..7daca07e261 100644
--- a/src/libuuid/lib.rs
+++ b/src/libuuid/lib.rs
@@ -54,15 +54,15 @@ Examples of string representations:
 
 */
 
-#[crate_id = "uuid#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
+#![crate_id = "uuid#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
 
-#[feature(default_type_params)];
+#![feature(default_type_params)]
 
 // test harness access
 #[cfg(test)]
@@ -196,7 +196,7 @@ impl Uuid {
     pub fn new_v4() -> Uuid {
         let ub = rand::task_rng().gen_vec(16);
         let mut uuid = Uuid{ bytes: [0, .. 16] };
-        slice::bytes::copy_memory(uuid.bytes, ub);
+        slice::bytes::copy_memory(uuid.bytes, ub.as_slice());
         uuid.set_variant(VariantRFC4122);
         uuid.set_version(Version4Random);
         uuid
@@ -490,17 +490,17 @@ impl Eq for Uuid {
 impl TotalEq for Uuid {}
 
 // FIXME #9845: Test these more thoroughly
-impl<T: Encoder> Encodable<T> for Uuid {
+impl<T: Encoder<E>, E> Encodable<T, E> for Uuid {
     /// Encode a UUID as a hypenated string
-    fn encode(&self, e: &mut T) {
-        e.emit_str(self.to_hyphenated_str());
+    fn encode(&self, e: &mut T) -> Result<(), E> {
+        e.emit_str(self.to_hyphenated_str())
     }
 }
 
-impl<T: Decoder> Decodable<T> for Uuid {
+impl<T: Decoder<E>, E> Decodable<T, E> for Uuid {
     /// Decode a UUID from a string
-    fn decode(d: &mut T) -> Uuid {
-        from_str(d.read_str()).unwrap()
+    fn decode(d: &mut T) -> Result<Uuid, E> {
+        Ok(from_str(try!(d.read_str())).unwrap())
     }
 }
 
@@ -510,7 +510,7 @@ impl rand::Rand for Uuid {
     fn rand<R: rand::Rng>(rng: &mut R) -> Uuid {
         let ub = rng.gen_vec(16);
         let mut uuid = Uuid{ bytes: [0, .. 16] };
-        slice::bytes::copy_memory(uuid.bytes, ub);
+        slice::bytes::copy_memory(uuid.bytes, ub.as_slice());
         uuid.set_variant(VariantRFC4122);
         uuid.set_version(Version4Random);
         uuid
@@ -797,9 +797,9 @@ mod test {
 
         let u = Uuid::new_v4();
         let mut wr = MemWriter::new();
-        u.encode(&mut ebml::writer::Encoder(&mut wr));
+        let _ = u.encode(&mut ebml::writer::Encoder(&mut wr));
         let doc = ebml::reader::Doc(wr.get_ref());
-        let u2 = Decodable::decode(&mut ebml::reader::Decoder(doc));
+        let u2 = Decodable::decode(&mut ebml::reader::Decoder(doc)).unwrap();
         assert_eq!(u, u2);
     }
 
diff --git a/src/libworkcache/lib.rs b/src/libworkcache/lib.rs
index 9c0328d4b11..6c1a52f4eee 100644
--- a/src/libworkcache/lib.rs
+++ b/src/libworkcache/lib.rs
@@ -8,15 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[crate_id = "workcache#0.10-pre"];
-#[crate_type = "rlib"];
-#[crate_type = "dylib"];
-#[license = "MIT/ASL2"];
-#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
-      html_favicon_url = "http://www.rust-lang.org/favicon.ico",
-      html_root_url = "http://static.rust-lang.org/doc/master")];
-#[feature(phase)];
-#[allow(visible_private_types)];
+#![crate_id = "workcache#0.11-pre"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+#![license = "MIT/ASL2"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+       html_root_url = "http://static.rust-lang.org/doc/master")]
+#![feature(phase)]
+#![allow(visible_private_types)]
 
 #[phase(syntax, link)] extern crate log;
 extern crate serialize;
@@ -140,9 +140,9 @@ impl WorkMap {
 }
 
 pub struct Database {
-    priv db_filename: Path,
-    priv db_cache: TreeMap<~str, ~str>,
-    db_dirty: bool
+    db_filename: Path,
+    db_cache: TreeMap<~str, ~str>,
+    pub db_dirty: bool,
 }
 
 impl Database {
@@ -203,7 +203,7 @@ impl Database {
                                     self.db_filename.display(), e.to_str()),
                     Ok(r) => {
                         let mut decoder = json::Decoder::new(r);
-                        self.db_cache = Decodable::decode(&mut decoder);
+                        self.db_cache = Decodable::decode(&mut decoder).unwrap();
                     }
                 }
             }
@@ -225,26 +225,26 @@ pub type FreshnessMap = TreeMap<~str,extern fn(&str,&str)->bool>;
 
 #[deriving(Clone)]
 pub struct Context {
-    db: Arc<RWLock<Database>>,
-    priv cfg: Arc<json::Object>,
+    pub db: Arc<RWLock<Database>>,
+    cfg: Arc<json::Object>,
     /// Map from kinds (source, exe, url, etc.) to a freshness function.
     /// The freshness function takes a name (e.g. file path) and value
     /// (e.g. hash of file contents) and determines whether it's up-to-date.
     /// For example, in the file case, this would read the file off disk,
     /// hash it, and return the result of comparing the given hash and the
     /// read hash for equality.
-    priv freshness: Arc<FreshnessMap>
+    freshness: Arc<FreshnessMap>
 }
 
 pub struct Prep<'a> {
-    priv ctxt: &'a Context,
-    priv fn_name: &'a str,
-    priv declared_inputs: WorkMap,
+    ctxt: &'a Context,
+    fn_name: &'a str,
+    declared_inputs: WorkMap,
 }
 
 pub struct Exec {
-    priv discovered_inputs: WorkMap,
-    priv discovered_outputs: WorkMap
+    discovered_inputs: WorkMap,
+    discovered_outputs: WorkMap
 }
 
 enum Work<'a, T> {
@@ -252,19 +252,19 @@ enum Work<'a, T> {
     WorkFromTask(&'a Prep<'a>, Receiver<(Exec, T)>),
 }
 
-fn json_encode<'a, T:Encodable<json::Encoder<'a>>>(t: &T) -> ~str {
+fn json_encode<'a, T:Encodable<json::Encoder<'a>, io::IoError>>(t: &T) -> ~str {
     let mut writer = MemWriter::new();
     let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer);
-    t.encode(&mut encoder);
+    let _ = t.encode(&mut encoder);
     str::from_utf8_owned(writer.unwrap()).unwrap()
 }
 
 // FIXME(#5121)
-fn json_decode<T:Decodable<json::Decoder>>(s: &str) -> T {
+fn json_decode<T:Decodable<json::Decoder, json::Error>>(s: &str) -> T {
     debug!("json decoding: {}", s);
     let j = json::from_str(s).unwrap();
     let mut decoder = json::Decoder::new(j);
-    Decodable::decode(&mut decoder)
+    Decodable::decode(&mut decoder).unwrap()
 }
 
 impl Context {
@@ -392,16 +392,16 @@ impl<'a> Prep<'a> {
     }
 
     pub fn exec<'a, T:Send +
-        Encodable<json::Encoder<'a>> +
-        Decodable<json::Decoder>>(
-            &'a self, blk: proc(&mut Exec) -> T) -> T {
+        Encodable<json::Encoder<'a>, io::IoError> +
+        Decodable<json::Decoder, json::Error>>(
+            &'a self, blk: proc:Send(&mut Exec) -> T) -> T {
         self.exec_work(blk).unwrap()
     }
 
     fn exec_work<'a, T:Send +
-        Encodable<json::Encoder<'a>> +
-        Decodable<json::Decoder>>( // FIXME(#5121)
-            &'a self, blk: proc(&mut Exec) -> T) -> Work<'a, T> {
+        Encodable<json::Encoder<'a>, io::IoError> +
+        Decodable<json::Decoder, json::Error>>( // FIXME(#5121)
+            &'a self, blk: proc:Send(&mut Exec) -> T) -> Work<'a, T> {
         let mut bo = Some(blk);
 
         debug!("exec_work: looking up {} and {:?}", self.fn_name,
@@ -443,8 +443,8 @@ impl<'a> Prep<'a> {
 }
 
 impl<'a, T:Send +
-       Encodable<json::Encoder<'a>> +
-       Decodable<json::Decoder>>
+       Encodable<json::Encoder<'a>, io::IoError> +
+       Decodable<json::Decoder, json::Error>>
     Work<'a, T> { // FIXME(#5121)
 
     pub fn from_value(elt: T) -> Work<'a, T> {
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index aaaf512bcf3..5a00a8034e6 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -10,6 +10,7 @@
 
 #include "rustllvm.h"
 #include "llvm/Object/Archive.h"
+#include "llvm/Object/ObjectFile.h"
 
 //===----------------------------------------------------------------------===
 //
@@ -323,6 +324,28 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateLexicalBlock(
         unwrapDI<DIFile>(File), Line, Col));
 }
 
+extern "C" LLVMValueRef LLVMDIBuilderCreateStaticVariable(
+    DIBuilderRef Builder,
+    LLVMValueRef Context,
+    const char* Name,
+    const char* LinkageName,
+    LLVMValueRef File,
+    unsigned LineNo,
+    LLVMValueRef Ty,
+    bool isLocalToUnit,
+    LLVMValueRef Val,
+    LLVMValueRef Decl = NULL) {
+    return wrap(Builder->createStaticVariable(unwrapDI<DIDescriptor>(Context),
+        Name,
+        LinkageName,
+        unwrapDI<DIFile>(File),
+        LineNo,
+        unwrapDI<DIType>(Ty),
+        isLocalToUnit,
+        unwrap(Val),
+        unwrapDI<MDNode*>(Decl)));
+}
+
 extern "C" LLVMValueRef LLVMDIBuilderCreateLocalVariable(
     DIBuilderRef Builder,
     unsigned Tag,
@@ -657,3 +680,27 @@ extern "C" int
 LLVMVersionMinor() {
     return LLVM_VERSION_MINOR;
 }
+
+// Note that the two following functions look quite similar to the
+// LLVMGetSectionName function. Sadly, it appears that this function only
+// returns a char* pointer, which isn't guaranteed to be null-terminated. The
+// function provided by LLVM doesn't return the length, so we've created our own
+// function which returns the length as well as the data pointer.
+//
+// For an example of this not returning a null terminated string, see
+// lib/Object/COFFObjectFile.cpp in the getSectionName function. One of the
+// branches explicitly creates a StringRef without a null terminator, and then
+// that's returned.
+
+inline section_iterator *unwrap(LLVMSectionIteratorRef SI) {
+    return reinterpret_cast<section_iterator*>(SI);
+}
+
+extern "C" int
+LLVMRustGetSectionName(LLVMSectionIteratorRef SI, const char **ptr) {
+    StringRef ret;
+    if (error_code ec = (*unwrap(SI))->getName(ret))
+      report_fatal_error(ec.message());
+    *ptr = ret.data();
+    return ret.size();
+}
diff --git a/src/rustllvm/rustllvm.def.in b/src/rustllvm/rustllvm.def.in
deleted file mode 100644
index ee82fa80f87..00000000000
--- a/src/rustllvm/rustllvm.def.in
+++ /dev/null
@@ -1,634 +0,0 @@
-LLVMRustCreateMemoryBufferWithContentsOfFile
-LLVMRustWriteOutputFile
-LLVMRustGetLastError
-LLVMRustConstSmallInt
-LLVMRustConstInt
-LLVMRustPrintPassTimings
-LLVMRustStartMultithreading
-LLVMCreateObjectFile
-LLVMDisposeObjectFile
-LLVMDisposeExecutionEngine
-LLVMGetSections
-LLVMDisposeSectionIterator
-LLVMIsSectionIteratorAtEnd
-LLVMMoveToNextSection
-LLVMGetSectionName
-LLVMGetSectionSize
-LLVMGetSectionContents
-LLVMABIAlignmentOfType
-LLVMABISizeOfType
-LLVMAddAggressiveDCEPass
-LLVMAddAlias
-LLVMAddArgumentPromotionPass
-LLVMAddAttribute
-LLVMAddBasicAliasAnalysisPass
-LLVMAddCFGSimplificationPass
-LLVMAddCase
-LLVMAddClause
-LLVMAddConstantMergePass
-LLVMAddConstantPropagationPass
-LLVMAddCorrelatedValuePropagationPass
-LLVMAddDeadArgEliminationPass
-LLVMAddDeadStoreEliminationPass
-LLVMAddDemoteMemoryToRegisterPass
-LLVMAddDestination
-LLVMAddEarlyCSEPass
-LLVMAddFunction
-LLVMAddFunctionAttr
-LLVMAddFunctionAttrString
-LLVMAddFunctionAttrsPass
-LLVMAddFunctionInliningPass
-LLVMAddGVNPass
-LLVMAddGlobal
-LLVMAddGlobalDCEPass
-LLVMAddGlobalInAddressSpace
-LLVMAddGlobalOptimizerPass
-LLVMAddIPConstantPropagationPass
-LLVMAddIPSCCPPass
-LLVMAddIncoming
-LLVMAddIndVarSimplifyPass
-LLVMAddInstrAttribute
-LLVMAddInstructionCombiningPass
-LLVMAddInternalizePass
-LLVMAddJumpThreadingPass
-LLVMAddLICMPass
-LLVMAddLoopDeletionPass
-LLVMAddLoopIdiomPass
-LLVMAddLoopRotatePass
-LLVMAddLoopUnrollPass
-LLVMAddLoopUnswitchPass
-LLVMAddMemCpyOptPass
-LLVMAddNamedMetadataOperand
-LLVMAddPromoteMemoryToRegisterPass
-LLVMAddPruneEHPass
-LLVMAddReassociatePass
-LLVMAddSCCPPass
-LLVMAddScalarReplAggregatesPass
-LLVMAddScalarReplAggregatesPassSSA
-LLVMAddScalarReplAggregatesPassWithThreshold
-LLVMAddSimplifyLibCallsPass
-LLVMAddStripDeadPrototypesPass
-LLVMAddStripSymbolsPass
-LLVMAddTailCallEliminationPass
-LLVMAddTargetData
-LLVMAddTypeBasedAliasAnalysisPass
-LLVMAddVerifierPass
-LLVMAlignOf
-LLVMAppendBasicBlock
-LLVMAppendBasicBlockInContext
-LLVMArrayType
-LLVMBasicBlockAsValue
-LLVMBlockAddress
-LLVMBuildAShr
-LLVMBuildAtomicLoad
-LLVMBuildAtomicStore
-LLVMBuildAtomicCmpXchg
-LLVMBuildAtomicRMW
-LLVMBuildAtomicFence
-LLVMBuildAdd
-LLVMBuildAggregateRet
-LLVMBuildAlloca
-LLVMBuildAnd
-LLVMBuildArrayAlloca
-LLVMBuildArrayMalloc
-LLVMBuildBinOp
-LLVMBuildBitCast
-LLVMBuildBr
-LLVMBuildCall
-LLVMBuildCast
-LLVMBuildCondBr
-LLVMBuildExactSDiv
-LLVMBuildExtractElement
-LLVMBuildExtractValue
-LLVMBuildFAdd
-LLVMBuildFCmp
-LLVMBuildFDiv
-LLVMBuildFMul
-LLVMBuildFNeg
-LLVMBuildFPCast
-LLVMBuildFPExt
-LLVMBuildFPToSI
-LLVMBuildFPToUI
-LLVMBuildFPTrunc
-LLVMBuildFRem
-LLVMBuildFSub
-LLVMBuildFree
-LLVMBuildGEP
-LLVMBuildGlobalString
-LLVMBuildGlobalStringPtr
-LLVMBuildICmp
-LLVMBuildInBoundsGEP
-LLVMBuildIndirectBr
-LLVMBuildInsertElement
-LLVMBuildInsertValue
-LLVMBuildIntCast
-LLVMBuildIntToPtr
-LLVMBuildInvoke
-LLVMBuildIsNotNull
-LLVMBuildIsNull
-LLVMBuildLandingPad
-LLVMBuildLShr
-LLVMBuildLoad
-LLVMBuildMalloc
-LLVMBuildMul
-LLVMBuildNSWAdd
-LLVMBuildNSWMul
-LLVMBuildNSWNeg
-LLVMBuildNSWSub
-LLVMBuildNUWAdd
-LLVMBuildNUWMul
-LLVMBuildNUWNeg
-LLVMBuildNUWSub
-LLVMBuildNeg
-LLVMBuildNot
-LLVMBuildOr
-LLVMBuildPhi
-LLVMBuildPointerCast
-LLVMBuildPtrDiff
-LLVMBuildPtrToInt
-LLVMBuildResume
-LLVMBuildRet
-LLVMBuildRetVoid
-LLVMBuildSDiv
-LLVMBuildSExt
-LLVMBuildSExtOrBitCast
-LLVMBuildSIToFP
-LLVMBuildSRem
-LLVMBuildSelect
-LLVMBuildShl
-LLVMBuildShuffleVector
-LLVMBuildStore
-LLVMBuildStructGEP
-LLVMBuildSub
-LLVMBuildSwitch
-LLVMBuildTrunc
-LLVMBuildTruncOrBitCast
-LLVMBuildUDiv
-LLVMBuildUIToFP
-LLVMBuildURem
-LLVMBuildUnreachable
-LLVMBuildVAArg
-LLVMBuildXor
-LLVMBuildZExt
-LLVMBuildZExtOrBitCast
-LLVMByteOrder
-LLVMCallFrameAlignmentOfType
-LLVMClearInsertionPosition
-LLVMConstAShr
-LLVMConstAdd
-LLVMConstAllOnes
-LLVMConstAnd
-LLVMConstArray
-LLVMConstBitCast
-LLVMConstExactSDiv
-LLVMConstExtractElement
-LLVMConstExtractValue
-LLVMConstFAdd
-LLVMConstFCmp
-LLVMConstFDiv
-LLVMConstFMul
-LLVMConstFNeg
-LLVMConstFPCast
-LLVMConstFPExt
-LLVMConstFPToSI
-LLVMConstFPToUI
-LLVMConstFPTrunc
-LLVMConstFRem
-LLVMConstFSub
-LLVMConstGEP
-LLVMConstICmp
-LLVMConstInBoundsGEP
-LLVMConstInlineAsm
-LLVMConstInsertElement
-LLVMConstInsertValue
-LLVMConstInt
-LLVMConstIntCast
-LLVMConstIntGetSExtValue
-LLVMConstIntGetZExtValue
-LLVMConstIntOfArbitraryPrecision
-LLVMConstIntOfString
-LLVMConstIntOfStringAndSize
-LLVMConstIntToPtr
-LLVMConstLShr
-LLVMConstMul
-LLVMConstNSWAdd
-LLVMConstNSWMul
-LLVMConstNSWNeg
-LLVMConstNSWSub
-LLVMConstNUWAdd
-LLVMConstNUWMul
-LLVMConstNUWNeg
-LLVMConstNUWSub
-LLVMConstNeg
-LLVMConstNot
-LLVMConstNull
-LLVMConstOr
-LLVMConstPointerCast
-LLVMConstPointerNull
-LLVMConstPtrToInt
-LLVMConstReal
-LLVMConstRealOfString
-LLVMConstRealOfStringAndSize
-LLVMConstSDiv
-LLVMConstSExt
-LLVMConstSExtOrBitCast
-LLVMConstSIToFP
-LLVMConstSRem
-LLVMConstSelect
-LLVMConstShl
-LLVMConstShuffleVector
-LLVMConstString
-LLVMConstStringInContext
-LLVMConstStruct
-LLVMConstStructInContext
-LLVMConstSub
-LLVMConstTrunc
-LLVMConstTruncOrBitCast
-LLVMConstUDiv
-LLVMConstUIToFP
-LLVMConstURem
-LLVMConstVector
-LLVMConstXor
-LLVMConstZExt
-LLVMConstZExtOrBitCast
-LLVMContextCreate
-LLVMContextDispose
-LLVMCopyStringRepOfTargetData
-LLVMCountBasicBlocks
-LLVMCountIncoming
-LLVMCountParamTypes
-LLVMCountParams
-LLVMCountStructElementTypes
-LLVMCreateBuilder
-LLVMCreateBuilderInContext
-LLVMCreateFunctionPassManager
-LLVMCreateFunctionPassManagerForModule
-LLVMCreateMemoryBufferWithContentsOfFile
-LLVMCreateMemoryBufferWithSTDIN
-LLVMCreateModuleProviderForExistingModule
-LLVMCreateObjectFile
-LLVMCreatePassManager
-LLVMCreateTargetData
-LLVMDeleteBasicBlock
-LLVMDeleteFunction
-LLVMDeleteGlobal
-LLVMDisposeBuilder
-LLVMDisposeMemoryBuffer
-LLVMDisposeMessage
-LLVMDisposeModule
-LLVMDisposeModuleProvider
-LLVMDisposeObjectFile
-LLVMDisposePassManager
-LLVMDisposeSectionIterator
-LLVMDisposeTargetData
-LLVMDoubleType
-LLVMDoubleTypeInContext
-LLVMDumpModule
-LLVMDumpValue
-LLVMElementAtOffset
-LLVMFP128Type
-LLVMFP128TypeInContext
-LLVMFinalizeFunctionPassManager
-LLVMFloatType
-LLVMFloatTypeInContext
-LLVMFunctionType
-LLVMGetAlignment
-LLVMGetArrayLength
-LLVMGetAttribute
-LLVMGetBasicBlockParent
-LLVMGetBasicBlocks
-LLVMGetBitcodeModule
-LLVMGetBitcodeModuleInContext
-LLVMGetBitcodeModuleProvider
-LLVMGetBitcodeModuleProviderInContext
-LLVMGetConstOpcode
-LLVMGetCurrentDebugLocation
-LLVMGetDataLayout
-LLVMGetElementType
-LLVMGetEntryBasicBlock
-LLVMGetFirstBasicBlock
-LLVMGetFirstFunction
-LLVMGetFirstGlobal
-LLVMGetFirstInstruction
-LLVMGetFirstParam
-LLVMGetFirstUse
-LLVMGetFunctionAttr
-LLVMGetFunctionCallConv
-LLVMGetGC
-LLVMGetGlobalContext
-LLVMGetGlobalParent
-LLVMGetGlobalPassRegistry
-LLVMGetIncomingBlock
-LLVMGetIncomingValue
-LLVMGetInitializer
-LLVMGetInsertBlock
-LLVMGetInstructionCallConv
-LLVMGetInstructionParent
-LLVMGetIntTypeWidth
-LLVMGetIntrinsicID
-LLVMGetLastBasicBlock
-LLVMGetLastFunction
-LLVMGetLastGlobal
-LLVMGetLastInstruction
-LLVMGetLastParam
-LLVMGetLinkage
-LLVMGetMDKindID
-LLVMGetMDKindIDInContext
-LLVMGetMetadata
-LLVMGetModuleContext
-LLVMGetNamedFunction
-LLVMGetNamedGlobal
-LLVMGetNextBasicBlock
-LLVMGetNextFunction
-LLVMGetNextGlobal
-LLVMGetNextInstruction
-LLVMGetNextParam
-LLVMGetNextUse
-LLVMGetNumOperands
-LLVMGetOperand
-LLVMGetOrInsertFunction
-LLVMGetParam
-LLVMGetParamParent
-LLVMGetParamTypes
-LLVMGetParams
-LLVMGetPointerAddressSpace
-LLVMGetPointerToGlobal
-LLVMGetPreviousBasicBlock
-LLVMGetPreviousFunction
-LLVMGetPreviousGlobal
-LLVMGetPreviousInstruction
-LLVMGetPreviousParam
-LLVMGetReturnType
-LLVMGetSection
-LLVMGetSectionContents
-LLVMGetSectionName
-LLVMGetSectionSize
-LLVMGetSections
-LLVMGetStructElementTypes
-LLVMGetTarget
-LLVMGetTypeContext
-LLVMGetTypeKind
-LLVMGetUndef
-LLVMGetUsedValue
-LLVMGetUser
-LLVMGetValueName
-LLVMGetVectorSize
-LLVMGetVisibility
-LLVMHasMetadata
-LLVMInitializeCodeGen
-LLVMInitializeFunctionPassManager
-LLVMInitializeIPA
-LLVMInitializeInstCombine
-LLVMInitializeScalarOpts
-LLVMInitializeTarget
-LLVMInitializeTransformUtils
-LLVMInitializeARMAsmParser
-LLVMInitializeMipsAsmParser
-LLVMInitializeX86AsmParser
-LLVMInitializeARMAsmPrinter
-LLVMInitializeMipsAsmPrinter
-LLVMInitializeX86AsmPrinter
-LLVMInitializeARMDisassembler
-LLVMInitializeMipsDisassembler
-LLVMInitializeX86Disassembler
-LLVMInitializeARMTarget
-LLVMInitializeMipsTarget
-LLVMInitializeX86Target
-LLVMInitializeARMTargetMC
-LLVMInitializeMipsTargetMC
-LLVMInitializeX86TargetMC
-LLVMInitializeARMTargetInfo
-LLVMInitializeMipsTargetInfo
-LLVMInitializeX86TargetInfo
-LLVMInsertBasicBlock
-LLVMInsertBasicBlockInContext
-LLVMInsertIntoBuilder
-LLVMInsertIntoBuilderWithName
-LLVMInstructionEraseFromParent
-LLVMInt16Type
-LLVMInt16TypeInContext
-LLVMInt1Type
-LLVMInt1TypeInContext
-LLVMInt32Type
-LLVMInt32TypeInContext
-LLVMInt64Type
-LLVMInt64TypeInContext
-LLVMInt8Type
-LLVMInt8TypeInContext
-LLVMIntPtrType
-LLVMIntType
-LLVMIntTypeInContext
-LLVMIsAAllocaInst
-LLVMIsAArgument
-LLVMIsABasicBlock
-LLVMIsABinaryOperator
-LLVMIsABitCastInst
-LLVMIsABranchInst
-LLVMIsACallInst
-LLVMIsACastInst
-LLVMIsACmpInst
-LLVMIsAConstant
-LLVMIsAConstantAggregateZero
-LLVMIsAConstantArray
-LLVMIsAConstantExpr
-LLVMIsAConstantFP
-LLVMIsAConstantInt
-LLVMIsAConstantPointerNull
-LLVMIsAConstantStruct
-LLVMIsAConstantVector
-LLVMIsADbgDeclareInst
-LLVMIsADbgInfoIntrinsic
-LLVMIsAExtractElementInst
-LLVMIsAExtractValueInst
-LLVMIsAFCmpInst
-LLVMIsAFPExtInst
-LLVMIsAFPToSIInst
-LLVMIsAFPToUIInst
-LLVMIsAFPTruncInst
-LLVMIsAFunction
-LLVMIsAGetElementPtrInst
-LLVMIsAGlobalAlias
-LLVMIsAGlobalValue
-LLVMIsAGlobalVariable
-LLVMIsAICmpInst
-LLVMIsAInlineAsm
-LLVMIsAInsertElementInst
-LLVMIsAInsertValueInst
-LLVMIsAInstruction
-LLVMIsAIntToPtrInst
-LLVMIsAIntrinsicInst
-LLVMIsAInvokeInst
-LLVMIsALoadInst
-LLVMIsAMemCpyInst
-LLVMIsAMemIntrinsic
-LLVMIsAMemMoveInst
-LLVMIsAMemSetInst
-LLVMIsAPHINode
-LLVMIsAPtrToIntInst
-LLVMIsAReturnInst
-LLVMIsASExtInst
-LLVMIsASIToFPInst
-LLVMIsASelectInst
-LLVMIsAShuffleVectorInst
-LLVMIsAStoreInst
-LLVMIsASwitchInst
-LLVMIsATerminatorInst
-LLVMIsATruncInst
-LLVMIsAUIToFPInst
-LLVMIsAUnaryInstruction
-LLVMIsAUndefValue
-LLVMIsAUnreachableInst
-LLVMIsAUser
-LLVMIsAVAArgInst
-LLVMIsAZExtInst
-LLVMIsConstant
-LLVMIsDeclaration
-LLVMIsFunctionVarArg
-LLVMIsGlobalConstant
-LLVMIsNull
-LLVMIsPackedStruct
-LLVMIsSectionIteratorAtEnd
-LLVMIsTailCall
-LLVMIsThreadLocal
-LLVMIsUndef
-LLVMLabelType
-LLVMLabelTypeInContext
-LLVMLinkInInterpreter
-LLVMMDNode
-LLVMMDNodeInContext
-LLVMMDString
-LLVMMDStringInContext
-LLVMMetadataTypeInContext
-LLVMModuleCreateWithName
-LLVMModuleCreateWithNameInContext
-LLVMMoveBasicBlockAfter
-LLVMMoveBasicBlockBefore
-LLVMMoveToNextSection
-LLVMOffsetOfElement
-LLVMPPCFP128Type
-LLVMPPCFP128TypeInContext
-LLVMParseBitcode
-LLVMParseBitcodeInContext
-LLVMPassManagerBuilderCreate
-LLVMPassManagerBuilderDispose
-LLVMPassManagerBuilderPopulateModulePassManager
-LLVMPassManagerBuilderSetDisableSimplifyLibCalls
-LLVMPassManagerBuilderSetDisableUnitAtATime
-LLVMPassManagerBuilderPopulateFunctionPassManager
-LLVMPassManagerBuilderSetDisableUnrollLoops
-LLVMPassManagerBuilderSetOptLevel
-LLVMPassManagerBuilderSetSizeLevel
-LLVMPassManagerBuilderUseInlinerWithThreshold
-LLVMPointerSize
-LLVMPointerType
-LLVMPositionBuilder
-LLVMPositionBuilderAtEnd
-LLVMPositionBuilderBefore
-LLVMPreferredAlignmentOfGlobal
-LLVMPreferredAlignmentOfType
-LLVMRemoveAttribute
-LLVMRemoveFunctionAttr
-LLVMRemoveInstrAttribute
-LLVMReplaceAllUsesWith
-LLVMRunFunctionPassManager
-LLVMRunPassManager
-LLVMSetAlignment
-LLVMSetCleanup
-LLVMSetCurrentDebugLocation
-LLVMSetDataLayout
-LLVMSetDebug
-LLVMSetFunctionCallConv
-LLVMSetGC
-LLVMSetGlobalConstant
-LLVMSetInitializer
-LLVMSetInstDebugLocation
-LLVMSetInstrParamAlignment
-LLVMSetInstructionCallConv
-LLVMSetLinkage
-LLVMSetMetadata
-LLVMSetModuleInlineAsm
-LLVMSetOperand
-LLVMSetParamAlignment
-LLVMSetSection
-LLVMSetTailCall
-LLVMSetTarget
-LLVMSetThreadLocal
-LLVMSetValueName
-LLVMSetVisibility
-LLVMSizeOf
-LLVMSizeOfTypeInBits
-LLVMStoreSizeOfType
-LLVMStructType
-LLVMStructTypeInContext
-LLVMTypeOf
-LLVMValueAsBasicBlock
-LLVMValueIsBasicBlock
-LLVMVectorType
-LLVMVerifyFunction
-LLVMVerifyModule
-LLVMViewFunctionCFG
-LLVMViewFunctionCFGOnly
-LLVMVoidType
-LLVMVoidTypeInContext
-LLVMWriteBitcodeToFD
-LLVMWriteBitcodeToFile
-LLVMWriteBitcodeToFileHandle
-LLVMX86FP80Type
-LLVMX86FP80TypeInContext
-LLVMX86MMXType
-LLVMX86MMXTypeInContext
-LLVMConstNamedStruct
-LLVMStructCreateNamed
-LLVMStructSetBody
-LLVMInlineAsm
-LLVMInitializePasses
-LLVMDIBuilderCreate
-LLVMDIBuilderDispose
-LLVMDIBuilderFinalize
-LLVMDIBuilderCreateCompileUnit
-LLVMDIBuilderCreateLocalVariable
-LLVMDIBuilderCreateFunction
-LLVMDIBuilderCreateFile
-LLVMDIBuilderCreateLexicalBlock
-LLVMDIBuilderCreateBasicType
-LLVMDIBuilderCreatePointerType
-LLVMDIBuilderCreateMemberType
-LLVMDIBuilderCreateStructType
-LLVMDIBuilderGetOrCreateSubrange
-LLVMDIBuilderCreateArrayType
-LLVMDIBuilderCreateVectorType
-LLVMDIBuilderCreateSubroutineType
-LLVMDIBuilderGetOrCreateArray
-LLVMDIBuilderInsertDeclareAtEnd
-LLVMDIBuilderInsertDeclareBefore
-LLVMDIBuilderCreateEnumerator
-LLVMDIBuilderCreateEnumerationType
-LLVMDIBuilderCreateUnionType
-LLVMDIBuilderCreateTemplateTypeParameter
-LLVMDIBuilderCreateOpDeref
-LLVMDIBuilderCreateOpPlus
-LLVMDIBuilderCreateComplexVariable
-LLVMDIBuilderCreateNameSpace
-LLVMDICompositeTypeSetTypeArray
-LLVMSetUnnamedAddr
-LLVMRustAddPass
-LLVMRustAddAnalysisPasses
-LLVMRustAddLibraryInfo
-LLVMRustCreateTargetMachine
-LLVMRustRunFunctionPassManager
-LLVMRustPrintModule
-LLVMRustDisposeTargetMachine
-LLVMRustAddBuilderLibraryInfo
-LLVMRustSetLLVMOptions
-LLVMRustPrintPasses
-LLVMRustSetNormalizedTarget
-LLVMRustAddAlwaysInlinePass
-LLVMAddReturnAttribute
-LLVMRemoveReturnAttribute
-LLVMTypeToString
-LLVMAddColdAttribute
-LLVMCreateMemoryBufferWithMemoryRange
-LLVMCreateMemoryBufferWithMemoryRangeCopy
-LLVMPassManagerBuilderPopulateLTOPassManager
-LLVMRustLinkInExternalBitcode
-LLVMRustRunRestrictionPass
diff --git a/src/snapshots.txt b/src/snapshots.txt
index f7f1c2d6aa3..83a8e7bb965 100644
--- a/src/snapshots.txt
+++ b/src/snapshots.txt
@@ -1,3 +1,19 @@
+S 2014-04-03 e7fe207
+  freebsd-x86_64 6d40f547d13896ab9d9dd4a4fdf2e72be553b01b
+  linux-i386 875a8f6956f7d703f7206db91ca2a9b67c244cf8
+  linux-x86_64 4d90df12231d1c9f51b5ae6e75546ccddcf0534b
+  macos-i386 e5486efa1356abca8f8d5cac9aa6135c9626ab51
+  macos-x86_64 8341419e4295d780f72950cfe2187195d0d03e83
+  winnt-i386 60c2fb349ac8a7ad30c9ba2518a61e669debb7bf
+
+S 2014-03-28 b8601a3
+  freebsd-x86_64 c6b0651b2a90697754920ad381c13f9b7942ab47
+  linux-i386 3bef5684fd0582fbd4ddebd4514182d4f72924f7
+  linux-x86_64 a7b2af1076d48e4a687a71a21478293e834349bd
+  macos-i386 41fb091c3bf5f0ebe9341f26129be82782266ddd
+  macos-x86_64 22b884a3876cb3e40ad942ad68a496b5f239fca5
+  winnt-i386 65174e80fbf69f92e41110b0bcc7e15704ca359b
+
 S 2014-03-22 94e4e91
   freebsd-x86_64 7793127e1b9ad22cb2e020f9bb01f34526cc4656
   linux-i386 aa53699d32d7acb86a6447f988c4ac73ac310bab
diff --git a/src/test/auxiliary/anon_trait_static_method_lib.rs b/src/test/auxiliary/anon_trait_static_method_lib.rs
index a15373a7033..666d2569c42 100644
--- a/src/test/auxiliary/anon_trait_static_method_lib.rs
+++ b/src/test/auxiliary/anon_trait_static_method_lib.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 pub struct Foo {
-    x: int
+    pub x: int
 }
 
 impl Foo {
diff --git a/src/test/auxiliary/cci_class.rs b/src/test/auxiliary/cci_class.rs
index e27fc68df9c..50116b39737 100644
--- a/src/test/auxiliary/cci_class.rs
+++ b/src/test/auxiliary/cci_class.rs
@@ -10,9 +10,9 @@
 
 pub mod kitties {
     pub struct cat {
-      priv meows : uint,
+      meows : uint,
 
-      how_hungry : int,
+      pub how_hungry : int,
     }
 
     pub fn cat(in_x : uint, in_y : int) -> cat  {
diff --git a/src/test/auxiliary/cci_class_2.rs b/src/test/auxiliary/cci_class_2.rs
index c0275249ca6..55fb424205e 100644
--- a/src/test/auxiliary/cci_class_2.rs
+++ b/src/test/auxiliary/cci_class_2.rs
@@ -10,9 +10,9 @@
 
 pub mod kitties {
     pub struct cat {
-      priv meows : uint,
+      meows : uint,
 
-      how_hungry : int,
+      pub how_hungry : int,
 
     }
 
diff --git a/src/test/auxiliary/cci_class_3.rs b/src/test/auxiliary/cci_class_3.rs
index 7ebf5a1e75a..6a57bb36663 100644
--- a/src/test/auxiliary/cci_class_3.rs
+++ b/src/test/auxiliary/cci_class_3.rs
@@ -10,9 +10,9 @@
 
 pub mod kitties {
     pub struct cat {
-        priv meows : uint,
+        meows : uint,
 
-        how_hungry : int,
+        pub how_hungry : int,
     }
 
     impl cat {
diff --git a/src/test/auxiliary/cci_class_4.rs b/src/test/auxiliary/cci_class_4.rs
index 7479ddc3e57..733509753d3 100644
--- a/src/test/auxiliary/cci_class_4.rs
+++ b/src/test/auxiliary/cci_class_4.rs
@@ -10,10 +10,10 @@
 
 pub mod kitties {
     pub struct cat {
-        priv meows : uint,
+        meows : uint,
 
-        how_hungry : int,
-        name : ~str,
+        pub how_hungry : int,
+        pub name : ~str,
     }
 
     impl cat {
diff --git a/src/test/auxiliary/cci_class_5.rs b/src/test/auxiliary/cci_class_5.rs
index 63a7392fc70..d113859a6bd 100644
--- a/src/test/auxiliary/cci_class_5.rs
+++ b/src/test/auxiliary/cci_class_5.rs
@@ -10,8 +10,8 @@
 
 pub mod kitties {
     pub struct cat {
-        priv meows : uint,
-        how_hungry : int,
+        meows : uint,
+        pub how_hungry : int,
     }
 
     impl cat {
diff --git a/src/test/auxiliary/cci_class_6.rs b/src/test/auxiliary/cci_class_6.rs
index 3ebb23706b6..71552f4c97e 100644
--- a/src/test/auxiliary/cci_class_6.rs
+++ b/src/test/auxiliary/cci_class_6.rs
@@ -11,10 +11,10 @@
 pub mod kitties {
 
     pub struct cat<U> {
-        priv info : Vec<U> ,
-        priv meows : uint,
+        info : Vec<U> ,
+        meows : uint,
 
-        how_hungry : int,
+        pub how_hungry : int,
     }
 
     impl<U> cat<U> {
diff --git a/src/test/auxiliary/cci_class_cast.rs b/src/test/auxiliary/cci_class_cast.rs
index e7e0e6d450a..2ce4f818659 100644
--- a/src/test/auxiliary/cci_class_cast.rs
+++ b/src/test/auxiliary/cci_class_cast.rs
@@ -12,9 +12,9 @@ pub mod kitty {
     use std::fmt;
 
     pub struct cat {
-      priv meows : uint,
-      how_hungry : int,
-      name : ~str,
+      meows : uint,
+      pub how_hungry : int,
+      pub name : ~str,
     }
 
     impl fmt::Show for cat {
diff --git a/src/test/auxiliary/crateresolve5-1.rs b/src/test/auxiliary/crateresolve5-1.rs
index 0336abae19c..4a1a4810919 100644
--- a/src/test/auxiliary/crateresolve5-1.rs
+++ b/src/test/auxiliary/crateresolve5-1.rs
@@ -12,7 +12,7 @@
 
 #[crate_type = "lib"];
 
-pub struct NameVal { name: ~str, val: int }
+pub struct NameVal { pub name: ~str, pub val: int }
 
 pub fn struct_nameval() -> NameVal {
     NameVal { name: ~"crateresolve5", val: 10 }
diff --git a/src/test/auxiliary/crateresolve5-2.rs b/src/test/auxiliary/crateresolve5-2.rs
index 9c5720680ed..f2896ec6ecb 100644
--- a/src/test/auxiliary/crateresolve5-2.rs
+++ b/src/test/auxiliary/crateresolve5-2.rs
@@ -12,7 +12,7 @@
 
 #[crate_type = "lib"];
 
-pub struct NameVal { name: ~str, val: int }
+pub struct NameVal { pub name: ~str, pub val: int }
 pub fn struct_nameval() -> NameVal {
     NameVal { name: ~"crateresolve5", val: 10 }
 }
diff --git a/src/test/auxiliary/explicit_self_xcrate.rs b/src/test/auxiliary/explicit_self_xcrate.rs
index 2f9d77691c5..e482e8c62ca 100644
--- a/src/test/auxiliary/explicit_self_xcrate.rs
+++ b/src/test/auxiliary/explicit_self_xcrate.rs
@@ -14,7 +14,7 @@ pub trait Foo {
 }
 
 pub struct Bar {
-    x: ~str
+    pub x: ~str
 }
 
 impl Foo for Bar {
diff --git a/src/test/auxiliary/impl_privacy_xc_1.rs b/src/test/auxiliary/impl_privacy_xc_1.rs
index 356990e1e01..df4e0658cb8 100644
--- a/src/test/auxiliary/impl_privacy_xc_1.rs
+++ b/src/test/auxiliary/impl_privacy_xc_1.rs
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[crate_type = "lib"];
+#![crate_type = "lib"]
 
 pub struct Fish {
-    x: int
+    pub x: int
 }
 
 impl Fish {
diff --git a/src/test/auxiliary/impl_privacy_xc_2.rs b/src/test/auxiliary/impl_privacy_xc_2.rs
index 92e6ca1cc48..b98e86fc3b0 100644
--- a/src/test/auxiliary/impl_privacy_xc_2.rs
+++ b/src/test/auxiliary/impl_privacy_xc_2.rs
@@ -11,7 +11,7 @@
 #[crate_type = "lib"];
 
 pub struct Fish {
-    x: int
+    pub x: int
 }
 
 mod unexported {
diff --git a/src/test/auxiliary/issue-11508.rs b/src/test/auxiliary/issue-11508.rs
index dfdde5e5e4e..c5dc3439f2f 100644
--- a/src/test/auxiliary/issue-11508.rs
+++ b/src/test/auxiliary/issue-11508.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct Closed01<F>(F);
+pub struct Closed01<F>(pub F);
 
 pub trait Bar { fn new() -> Self; }
 
diff --git a/src/test/auxiliary/issue-11529.rs b/src/test/auxiliary/issue-11529.rs
index 9d500532401..a8a4c438e67 100644
--- a/src/test/auxiliary/issue-11529.rs
+++ b/src/test/auxiliary/issue-11529.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct A<'a>(&'a int);
+pub struct A<'a>(pub &'a int);
diff --git a/src/test/auxiliary/issue-11908-1.rs b/src/test/auxiliary/issue-11908-1.rs
index f06929a5dee..b0abde795a8 100644
--- a/src/test/auxiliary/issue-11908-1.rs
+++ b/src/test/auxiliary/issue-11908-1.rs
@@ -10,5 +10,5 @@
 
 // no-prefer-dynamic
 
-#[crate_id = "collections#0.10-pre"];
+#[crate_id = "collections#0.11-pre"];
 #[crate_type = "dylib"];
diff --git a/src/test/auxiliary/issue-11908-2.rs b/src/test/auxiliary/issue-11908-2.rs
index 345be34f377..612ee3608e9 100644
--- a/src/test/auxiliary/issue-11908-2.rs
+++ b/src/test/auxiliary/issue-11908-2.rs
@@ -10,5 +10,5 @@
 
 // no-prefer-dynamic
 
-#[crate_id = "collections#0.10-pre"];
+#[crate_id = "collections#0.11-pre"];
 #[crate_type = "rlib"];
diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs
index e7e0bf1bd60..e61510f2ef2 100644
--- a/src/test/auxiliary/issue-2631-a.rs
+++ b/src/test/auxiliary/issue-2631-a.rs
@@ -21,5 +21,5 @@ pub type header_map = HashMap<~str, @RefCell<Vec<@~str>>>;
 
 // the unused ty param is necessary so this gets monomorphized
 pub fn request<T>(req: &header_map) {
-  let _x = (**((**req.get(&~"METHOD")).clone()).get().get(0)).clone();
+  let _x = (**((**req.get(&~"METHOD")).clone()).borrow().clone().get(0)).clone();
 }
diff --git a/src/test/auxiliary/issue-7899.rs b/src/test/auxiliary/issue-7899.rs
index f1a0fcffd16..e197e84442b 100644
--- a/src/test/auxiliary/issue-7899.rs
+++ b/src/test/auxiliary/issue-7899.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct V2<T>(T, T);
+pub struct V2<T>(pub T, pub T);
diff --git a/src/test/auxiliary/issue-8044.rs b/src/test/auxiliary/issue-8044.rs
index 7d9a4b60384..12b871b566b 100644
--- a/src/test/auxiliary/issue-8044.rs
+++ b/src/test/auxiliary/issue-8044.rs
@@ -11,11 +11,11 @@
 #[feature(struct_variant)];
 
 pub struct BTree<V> {
-    node: TreeItem<V>,
+    pub node: TreeItem<V>,
 }
 
 pub enum TreeItem<V> {
-    TreeLeaf { value: V },
+    TreeLeaf { pub value: V },
 }
 
 pub fn leaf<V>(value: V) -> TreeItem<V> {
diff --git a/src/test/auxiliary/issue2378b.rs b/src/test/auxiliary/issue2378b.rs
index 1ec6ab90696..72fe2bcec97 100644
--- a/src/test/auxiliary/issue2378b.rs
+++ b/src/test/auxiliary/issue2378b.rs
@@ -14,7 +14,7 @@ extern crate issue2378a;
 
 use issue2378a::maybe;
 
-pub struct two_maybes<T> {a: maybe<T>, b: maybe<T>}
+pub struct two_maybes<T> {pub a: maybe<T>, pub b: maybe<T>}
 
 impl<T:Clone> Index<uint,(T,T)> for two_maybes<T> {
     fn index(&self, idx: &uint) -> (T, T) {
diff --git a/src/test/auxiliary/issue_10031_aux.rs b/src/test/auxiliary/issue_10031_aux.rs
index 5724d876ef4..f0f1af2e3a3 100644
--- a/src/test/auxiliary/issue_10031_aux.rs
+++ b/src/test/auxiliary/issue_10031_aux.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct Wrap<A>(A);
+pub struct Wrap<A>(pub A);
diff --git a/src/test/auxiliary/issue_2316_b.rs b/src/test/auxiliary/issue_2316_b.rs
index 36af01fe6c6..4530fa4bc25 100644
--- a/src/test/auxiliary/issue_2316_b.rs
+++ b/src/test/auxiliary/issue_2316_b.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #[allow(unused_imports)];
-#[feature(globs)];
+#![feature(globs)]
 
 extern crate issue_2316_a;
 
diff --git a/src/test/auxiliary/issue_2472_b.rs b/src/test/auxiliary/issue_2472_b.rs
index 1475b1a75a6..5f55476427f 100644
--- a/src/test/auxiliary/issue_2472_b.rs
+++ b/src/test/auxiliary/issue_2472_b.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-pub struct S(());
+pub struct S(pub ());
 
 impl S {
     pub fn foo(&self) { }
diff --git a/src/test/auxiliary/issue_2723_a.rs b/src/test/auxiliary/issue_2723_a.rs
index 2dc88d8ff02..16b743baa3d 100644
--- a/src/test/auxiliary/issue_2723_a.rs
+++ b/src/test/auxiliary/issue_2723_a.rs
@@ -10,5 +10,5 @@
 
 
 pub unsafe fn f(xs: Vec<int> ) {
-    xs.map(|_x| { unsafe fn q() { fail!(); } });
+    xs.iter().map(|_x| { unsafe fn q() { fail!(); } }).collect::<Vec<()>>();
 }
diff --git a/src/test/auxiliary/kinds_in_metadata.rs b/src/test/auxiliary/kinds_in_metadata.rs
index 387767f374f..7ca11c8925f 100644
--- a/src/test/auxiliary/kinds_in_metadata.rs
+++ b/src/test/auxiliary/kinds_in_metadata.rs
@@ -11,9 +11,9 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-// Tests that metadata serialization works for the `Pod` kind.
+// Tests that metadata serialization works for the `Copy` kind.
 
 #[crate_type="lib"];
 
-pub fn f<T:Pod>() {}
+pub fn f<T:Copy>() {}
 
diff --git a/src/test/auxiliary/lint_stability.rs b/src/test/auxiliary/lint_stability.rs
index 4e71f3c0c2a..5afbf4492b3 100644
--- a/src/test/auxiliary/lint_stability.rs
+++ b/src/test/auxiliary/lint_stability.rs
@@ -116,18 +116,18 @@ pub trait Trait {
 impl Trait for MethodTester {}
 
 #[deprecated]
-pub struct DeprecatedStruct { i: int }
+pub struct DeprecatedStruct { pub i: int }
 #[experimental]
-pub struct ExperimentalStruct { i: int }
+pub struct ExperimentalStruct { pub i: int }
 #[unstable]
-pub struct UnstableStruct { i: int }
-pub struct UnmarkedStruct { i: int }
+pub struct UnstableStruct { pub i: int }
+pub struct UnmarkedStruct { pub i: int }
 #[stable]
-pub struct StableStruct { i: int }
+pub struct StableStruct { pub i: int }
 #[frozen]
-pub struct FrozenStruct { i: int }
+pub struct FrozenStruct { pub i: int }
 #[locked]
-pub struct LockedStruct { i: int }
+pub struct LockedStruct { pub i: int }
 
 #[deprecated]
 pub struct DeprecatedUnitStruct;
@@ -161,15 +161,15 @@ pub enum Enum {
 }
 
 #[deprecated]
-pub struct DeprecatedTupleStruct(int);
+pub struct DeprecatedTupleStruct(pub int);
 #[experimental]
-pub struct ExperimentalTupleStruct(int);
+pub struct ExperimentalTupleStruct(pub int);
 #[unstable]
-pub struct UnstableTupleStruct(int);
-pub struct UnmarkedTupleStruct(int);
+pub struct UnstableTupleStruct(pub int);
+pub struct UnmarkedTupleStruct(pub int);
 #[stable]
-pub struct StableTupleStruct(int);
+pub struct StableTupleStruct(pub int);
 #[frozen]
-pub struct FrozenTupleStruct(int);
+pub struct FrozenTupleStruct(pub int);
 #[locked]
-pub struct LockedTupleStruct(int);
+pub struct LockedTupleStruct(pub int);
diff --git a/src/test/auxiliary/logging_right_crate.rs b/src/test/auxiliary/logging_right_crate.rs
index 10725981a06..b0a6e0f84fc 100644
--- a/src/test/auxiliary/logging_right_crate.rs
+++ b/src/test/auxiliary/logging_right_crate.rs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(phase)];
+#![feature(phase)]
 #[phase(syntax, link)] extern crate log;
 
 pub fn foo<T>() {
diff --git a/src/test/auxiliary/macro_crate_outlive_expansion_phase.rs b/src/test/auxiliary/macro_crate_outlive_expansion_phase.rs
index 1a0fb8fe629..6dc62932de2 100644
--- a/src/test/auxiliary/macro_crate_outlive_expansion_phase.rs
+++ b/src/test/auxiliary/macro_crate_outlive_expansion_phase.rs
@@ -29,7 +29,7 @@ impl Drop for Foo {
 
 #[macro_registrar]
 pub fn registrar(_: |Name, SyntaxExtension|) {
-    local_data_key!(foo: ~Any);
-    local_data::set(foo, ~Foo { foo: 10 } as ~Any);
+    local_data_key!(foo: ~Any:Send);
+    local_data::set(foo, ~Foo { foo: 10 } as ~Any:Send);
 }
 
diff --git a/src/test/auxiliary/newtype_struct_xc.rs b/src/test/auxiliary/newtype_struct_xc.rs
index 3833b549b5f..60c64842c71 100644
--- a/src/test/auxiliary/newtype_struct_xc.rs
+++ b/src/test/auxiliary/newtype_struct_xc.rs
@@ -10,4 +10,4 @@
 
 #[crate_type="lib"];
 
-pub struct Au(int);
+pub struct Au(pub int);
diff --git a/src/test/auxiliary/overloaded_autoderef_xc.rs b/src/test/auxiliary/overloaded_autoderef_xc.rs
index 65a404d1ff3..850050fe3a5 100644
--- a/src/test/auxiliary/overloaded_autoderef_xc.rs
+++ b/src/test/auxiliary/overloaded_autoderef_xc.rs
@@ -11,7 +11,7 @@
 use std::ops::Deref;
 
 struct DerefWithHelper<H, T> {
-    helper: H
+    pub helper: H
 }
 
 trait Helper<T> {
diff --git a/src/test/auxiliary/privacy-tuple-struct.rs b/src/test/auxiliary/privacy-tuple-struct.rs
new file mode 100644
index 00000000000..2fb9d9923cb
--- /dev/null
+++ b/src/test/auxiliary/privacy-tuple-struct.rs
@@ -0,0 +1,14 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct A(());
+pub struct B(int);
+pub struct C(pub int, int);
+pub struct D(pub int);
diff --git a/src/test/auxiliary/pub_use_xcrate1.rs b/src/test/auxiliary/pub_use_xcrate1.rs
index 18b3fe0f767..8e1e591d94f 100644
--- a/src/test/auxiliary/pub_use_xcrate1.rs
+++ b/src/test/auxiliary/pub_use_xcrate1.rs
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 pub struct Foo {
-    name: int
+    pub name: int
 }
diff --git a/src/test/auxiliary/struct-field-privacy.rs b/src/test/auxiliary/struct-field-privacy.rs
index 497d50a2390..e2c16ae8b5c 100644
--- a/src/test/auxiliary/struct-field-privacy.rs
+++ b/src/test/auxiliary/struct-field-privacy.rs
@@ -14,6 +14,6 @@ struct A {
 }
 
 pub struct B {
-    a: int,
-    priv b: int,
+    pub a: int,
+    b: int,
 }
diff --git a/src/test/auxiliary/struct_destructuring_cross_crate.rs b/src/test/auxiliary/struct_destructuring_cross_crate.rs
index 8887cbee3fe..32838331363 100644
--- a/src/test/auxiliary/struct_destructuring_cross_crate.rs
+++ b/src/test/auxiliary/struct_destructuring_cross_crate.rs
@@ -11,6 +11,6 @@
 #[crate_type="lib"];
 
 pub struct S {
-    x: int,
-    y: int
+    pub x: int,
+    pub y: int,
 }
diff --git a/src/test/auxiliary/struct_variant_xc_aux.rs b/src/test/auxiliary/struct_variant_xc_aux.rs
index 668e5c9afb3..1a756e432c3 100644
--- a/src/test/auxiliary/struct_variant_xc_aux.rs
+++ b/src/test/auxiliary/struct_variant_xc_aux.rs
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[crate_id="struct_variant_xc_aux#0.1"];
-#[crate_type = "lib"];
+#![crate_id="struct_variant_xc_aux#0.1"]
+#![crate_type = "lib"]
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 
 pub enum Enum {
-    Variant { arg: u8 }
+    Variant { pub arg: u8 }
 }
diff --git a/src/test/auxiliary/trait_default_method_xc_aux.rs b/src/test/auxiliary/trait_default_method_xc_aux.rs
index f9f8a6be7d8..535ebebc722 100644
--- a/src/test/auxiliary/trait_default_method_xc_aux.rs
+++ b/src/test/auxiliary/trait_default_method_xc_aux.rs
@@ -10,7 +10,7 @@
 
 #[crate_id="trait_default_method_xc_aux"];
 
-pub struct Something { x: int }
+pub struct Something { pub x: int }
 
 pub trait A {
     fn f(&self) -> int;
diff --git a/src/test/auxiliary/trait_default_method_xc_aux_2.rs b/src/test/auxiliary/trait_default_method_xc_aux_2.rs
index 6a8c03ec6ad..984264a969c 100644
--- a/src/test/auxiliary/trait_default_method_xc_aux_2.rs
+++ b/src/test/auxiliary/trait_default_method_xc_aux_2.rs
@@ -13,7 +13,7 @@
 extern crate aux = "trait_default_method_xc_aux";
 use aux::A;
 
-pub struct a_struct { x: int }
+pub struct a_struct { pub x: int }
 
 impl A for a_struct {
     fn f(&self) -> int { 10 }
diff --git a/src/test/auxiliary/trait_inheritance_auto_xc_2_aux.rs b/src/test/auxiliary/trait_inheritance_auto_xc_2_aux.rs
index 7d6178db485..9ef53795a26 100644
--- a/src/test/auxiliary/trait_inheritance_auto_xc_2_aux.rs
+++ b/src/test/auxiliary/trait_inheritance_auto_xc_2_aux.rs
@@ -12,7 +12,7 @@ pub trait Foo { fn f(&self) -> int; }
 pub trait Bar { fn g(&self) -> int; }
 pub trait Baz { fn h(&self) -> int; }
 
-pub struct A { x: int }
+pub struct A { pub x: int }
 
 impl Foo for A { fn f(&self) -> int { 10 } }
 impl Bar for A { fn g(&self) -> int { 20 } }
diff --git a/src/test/auxiliary/trait_inheritance_cross_trait_call_xc_aux.rs b/src/test/auxiliary/trait_inheritance_cross_trait_call_xc_aux.rs
index c9694fec610..0a84595124a 100644
--- a/src/test/auxiliary/trait_inheritance_cross_trait_call_xc_aux.rs
+++ b/src/test/auxiliary/trait_inheritance_cross_trait_call_xc_aux.rs
@@ -14,7 +14,7 @@ pub trait Foo {
 }
 
 pub struct A {
-    x: int
+    pub x: int
 }
 
 impl Foo for A {
diff --git a/src/test/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/auxiliary/trait_inheritance_overloading_xc.rs
index 6c98cd11169..4b7a72f5043 100644
--- a/src/test/auxiliary/trait_inheritance_overloading_xc.rs
+++ b/src/test/auxiliary/trait_inheritance_overloading_xc.rs
@@ -15,7 +15,7 @@ pub trait MyNum : Add<Self,Self> + Sub<Self,Self> + Mul<Self,Self> + Eq {
 
 #[deriving(Show)]
 pub struct MyInt {
-    val: int
+    pub val: int
 }
 
 impl Add<MyInt, MyInt> for MyInt {
diff --git a/src/test/auxiliary/trait_superkinds_in_metadata.rs b/src/test/auxiliary/trait_superkinds_in_metadata.rs
index e49ed1f9cf7..40ae0ad4583 100644
--- a/src/test/auxiliary/trait_superkinds_in_metadata.rs
+++ b/src/test/auxiliary/trait_superkinds_in_metadata.rs
@@ -15,4 +15,4 @@
 
 pub trait RequiresShare : Share { }
 pub trait RequiresRequiresShareAndSend : RequiresShare + Send { }
-pub trait RequiresPod : Pod { }
+pub trait RequiresCopy : Copy { }
diff --git a/src/test/auxiliary/xc_private_method_lib.rs b/src/test/auxiliary/xc_private_method_lib.rs
index a9e5775fb4e..b9f15f1c54e 100644
--- a/src/test/auxiliary/xc_private_method_lib.rs
+++ b/src/test/auxiliary/xc_private_method_lib.rs
@@ -11,7 +11,7 @@
 #[crate_type="lib"];
 
 pub struct Struct {
-    x: int
+    pub x: int
 }
 
 impl Struct {
diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs
index d0655a43d15..730078b01a2 100644
--- a/src/test/bench/core-std.rs
+++ b/src/test/bench/core-std.rs
@@ -92,7 +92,7 @@ fn vec_plus() {
         if r.gen() {
             v.push_all_move(rv);
         } else {
-            v = vec::append(rv.clone(), v.as_slice());
+            v = rv.clone().append(v.as_slice());
         }
         i += 1;
     }
@@ -106,10 +106,10 @@ fn vec_append() {
     while i < 1500 {
         let rv = Vec::from_elem(r.gen_range(0u, i + 1), i);
         if r.gen() {
-            v = vec::append(v.clone(), rv.as_slice());
+            v = v.clone().append(rv.as_slice());
         }
         else {
-            v = vec::append(rv.clone(), v.as_slice());
+            v = rv.clone().append(v.as_slice());
         }
         i += 1;
     }
diff --git a/src/test/bench/noise.rs b/src/test/bench/noise.rs
index 4954f083b36..7e41fdea778 100644
--- a/src/test/bench/noise.rs
+++ b/src/test/bench/noise.rs
@@ -41,7 +41,7 @@ struct Noise2DContext {
 
 impl Noise2DContext {
     fn new() -> Noise2DContext {
-        let mut rng = StdRng::new();
+        let mut rng = StdRng::new().unwrap();
 
         let mut rgradients = [Vec2 { x: 0.0, y: 0.0 }, ..256];
         for x in rgradients.mut_iter() {
@@ -58,8 +58,9 @@ impl Noise2DContext {
     }
 
     fn get_gradient(&self, x: i32, y: i32) -> Vec2 {
-        let idx = self.permutations[x & 255] + self.permutations[y & 255];
-        self.rgradients[idx & 255]
+        let idx = self.permutations[(x & 255) as uint] +
+                    self.permutations[(y & 255) as uint];
+        self.rgradients[(idx & 255) as uint]
     }
 
     fn get_gradients(&self, x: f32, y: f32) -> ([Vec2, ..4], [Vec2, ..4]) {
@@ -103,16 +104,16 @@ fn main() {
     let n2d = Noise2DContext::new();
 
     for _ in range(0, 100) {
-        for y in range(0, 256) {
-            for x in range(0, 256) {
+        for y in range(0u, 256) {
+            for x in range(0u, 256) {
                 let v = n2d.get(x as f32 * 0.1, y as f32 * 0.1);
                 pixels[y*256+x] = v * 0.5 + 0.5;
             }
         }
     }
 
-    for y in range(0, 256) {
-        for x in range(0, 256) {
+    for y in range(0u, 256) {
+        for x in range(0u, 256) {
             let idx = (pixels[y*256+x] / 0.2) as uint;
             print!("{:c}", symbols[idx]);
         }
diff --git a/src/test/bench/rt-spawn-rate.rs b/src/test/bench/rt-spawn-rate.rs
index 5f445de069c..4f07660779b 100644
--- a/src/test/bench/rt-spawn-rate.rs
+++ b/src/test/bench/rt-spawn-rate.rs
@@ -8,6 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![no_start]
+
+extern crate green;
+extern crate rustuv;
+
 use std::task::spawn;
 use std::os;
 use std::uint;
@@ -15,6 +20,11 @@ use std::uint;
 // Very simple spawn rate test. Spawn N tasks that do nothing and
 // return.
 
+#[start]
+fn start(argc: int, argv: **u8) -> int {
+    green::start(argc, argv, rustuv::event_loop, main)
+}
+
 fn main() {
 
     let args = os::args();
diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs
index 8d860206d0c..e650367c6f5 100644
--- a/src/test/bench/shootout-fannkuch-redux.rs
+++ b/src/test/bench/shootout-fannkuch-redux.rs
@@ -30,7 +30,7 @@ fn fannkuch_redux(n: i32) -> i32 {
     let mut r = n;
     loop {
         while r != 1 {
-            count[r - 1] = r;
+            count[r as uint - 1] = r;
             r -= 1;
         }
 
@@ -71,13 +71,13 @@ fn fannkuch_redux(n: i32) -> i32 {
             let mut i: i32 = 0;
             while i < r {
                 let j = i + 1;
-                perm1[i] = perm1[j];
+                perm1[i as uint] = perm1[j as uint];
                 i = j;
             }
-            perm1[r] = perm0;
+            perm1[r as uint] = perm0;
 
-            count[r] -= 1;
-            if count[r] > 0 {
+            count[r as uint] -= 1;
+            if count[r as uint] > 0 {
                 break;
             }
             r += 1;
diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs
index e63f6d675f5..9da32707ef1 100644
--- a/src/test/bench/shootout-k-nucleotide-pipes.rs
+++ b/src/test/bench/shootout-k-nucleotide-pipes.rs
@@ -126,8 +126,7 @@ fn make_sequence_processor(sz: uint,
       line = from_parent.recv();
       if line == Vec::new() { break; }
 
-       carry = windows_with_carry(vec::append(carry,
-                                                 line.as_slice()).as_slice(),
+       carry = windows_with_carry(carry.append(line.as_slice()).as_slice(),
                                   sz,
                                   |window| {
          update_freq(&mut freqs, window);
diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs
index 1b9d0e03431..7ceaaa7ad22 100644
--- a/src/test/bench/shootout-k-nucleotide.rs
+++ b/src/test/bench/shootout-k-nucleotide.rs
@@ -8,8 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-android see #10393 #13206
 // ignore-pretty
 
+use std::ascii::OwnedStrAsciiExt;
 use std::str;
 use std::slice;
 
@@ -39,8 +41,8 @@ impl Code {
         Code((self.hash() << 2) + (pack_symbol(c) as u64))
     }
 
-    fn rotate(&self, c: u8, frame: i32) -> Code {
-        Code(self.push_char(c).hash() & ((1u64 << (2 * (frame as u64))) - 1))
+    fn rotate(&self, c: u8, frame: uint) -> Code {
+        Code(self.push_char(c).hash() & ((1u64 << (2 * frame)) - 1))
     }
 
     fn pack(string: &str) -> Code {
@@ -48,7 +50,7 @@ impl Code {
     }
 
     // FIXME: Inefficient.
-    fn unpack(&self, frame: i32) -> ~str {
+    fn unpack(&self, frame: uint) -> ~str {
         let mut key = self.hash();
         let mut result = Vec::new();
         for _ in range(0, frame) {
@@ -86,12 +88,12 @@ impl TableCallback for PrintCallback {
 
 struct Entry {
     code: Code,
-    count: i32,
+    count: uint,
     next: Option<~Entry>,
 }
 
 struct Table {
-    count: i32,
+    count: uint,
     items: Vec<Option<~Entry>> }
 
 struct Items<'a> {
@@ -190,79 +192,79 @@ impl<'a> Iterator<&'a Entry> for Items<'a> {
 
 fn pack_symbol(c: u8) -> u8 {
     match c as char {
-        'a' | 'A' => 0,
-        'c' | 'C' => 1,
-        'g' | 'G' => 2,
-        't' | 'T' => 3,
+        'A' => 0,
+        'C' => 1,
+        'G' => 2,
+        'T' => 3,
         _ => fail!("{}", c as char),
     }
 }
 
 fn unpack_symbol(c: u8) -> u8 {
-    TABLE[c]
-}
-
-fn next_char<'a>(mut buf: &'a [u8]) -> &'a [u8] {
-    loop {
-        buf = buf.slice(1, buf.len());
-        if buf.len() == 0 {
-            break;
-        }
-        if buf[0] != (' ' as u8) && buf[0] != ('\t' as u8) &&
-                buf[0] != ('\n' as u8) && buf[0] != 0 {
-            break;
-        }
-    }
-    buf
+    TABLE[c as uint]
 }
 
 fn generate_frequencies(frequencies: &mut Table,
                         mut input: &[u8],
-                        frame: i32) {
+                        frame: uint) {
+    if input.len() < frame { return; }
     let mut code = Code(0);
 
     // Pull first frame.
     for _ in range(0, frame) {
         code = code.push_char(input[0]);
-        input = next_char(input);
+        input = input.slice_from(1);
     }
     frequencies.lookup(code, BumpCallback);
 
     while input.len() != 0 && input[0] != ('>' as u8) {
         code = code.rotate(input[0], frame);
         frequencies.lookup(code, BumpCallback);
-        input = next_char(input);
+        input = input.slice_from(1);
     }
 }
 
-fn print_frequencies(frequencies: &Table, frame: i32) {
+fn print_frequencies(frequencies: &Table, frame: uint) {
     let mut vector = Vec::new();
     for entry in frequencies.iter() {
-        vector.push((entry.code, entry.count));
+        vector.push((entry.count, entry.code));
     }
     vector.as_mut_slice().sort();
 
     let mut total_count = 0;
-    for &(_, count) in vector.iter() {
+    for &(count, _) in vector.iter() {
         total_count += count;
     }
 
-    for &(key, count) in vector.iter() {
+    for &(count, key) in vector.iter().rev() {
         println!("{} {:.3f}",
                  key.unpack(frame),
                  (count as f32 * 100.0) / (total_count as f32));
     }
+    println!("");
 }
 
 fn print_occurrences(frequencies: &mut Table, occurrence: &'static str) {
     frequencies.lookup(Code::pack(occurrence), PrintCallback(occurrence))
 }
 
+fn get_sequence<R: Buffer>(r: &mut R, key: &str) -> ~[u8] {
+    let mut res = ~"";
+    for l in r.lines().map(|l| l.ok().unwrap())
+        .skip_while(|l| key != l.slice_to(key.len())).skip(1)
+    {
+        res.push_str(l.trim());
+    }
+    res.into_ascii_upper().into_bytes()
+}
+
 fn main() {
-    let input = include_str!("shootout-k-nucleotide.data");
-    let pos = input.find_str(">THREE").unwrap();
-    let pos2 = pos + input.slice_from(pos).find_str("\n").unwrap();
-    let input = input.slice_from(pos2 + 1).as_bytes();
+    let input = if std::os::getenv("RUST_BENCH").is_some() {
+        let fd = std::io::File::open(&Path::new("shootout-k-nucleotide.data"));
+        get_sequence(&mut std::io::BufferedReader::new(fd), ">THREE")
+    } else {
+        get_sequence(&mut std::io::stdin(), ">THREE")
+    };
 
     let mut frequencies = Table::new();
     generate_frequencies(&mut frequencies, input, 1);
@@ -276,7 +278,7 @@ fn main() {
         frequencies = Table::new();
         generate_frequencies(&mut frequencies,
                              input,
-                             occurrence.len() as i32);
+                             occurrence.len());
         print_occurrences(&mut frequencies, *occurrence);
     }
 }
diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs
index b26053bdf35..45ce1776620 100644
--- a/src/test/bench/shootout-meteor.rs
+++ b/src/test/bench/shootout-meteor.rs
@@ -255,9 +255,9 @@ fn search(
     // for every unused piece
     for id in range(0, 10).filter(|id| board & (1 << (id + 50)) == 0) {
         // for each mask that fits on the board
-        for &m in masks[id].get(i as uint)
-                           .iter()
-                           .filter(|&m| board & *m == 0) {
+        for &m in masks[id as uint].get(i as uint)
+                                   .iter()
+                                   .filter(|&m| board & *m == 0) {
             // This check is too costy.
             //if is_board_unfeasible(board | m, masks) {continue;}
             if !search(masks, board | m, i + 1, Cons(m, &cur), data) {
diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs
index acd6620d4af..a96e9e9f81a 100644
--- a/src/test/bench/shootout-reverse-complement.rs
+++ b/src/test/bench/shootout-reverse-complement.rs
@@ -29,8 +29,8 @@ fn make_complements() -> [u8, ..256] {
     }
     let lower = 'A' as u8 - 'a' as u8;
     for &(from, to) in transforms.iter() {
-        complements[from as u8] = to as u8;
-        complements[from as u8 - lower] = to as u8;
+        complements[from as uint] = to as u8;
+        complements[(from as u8 - lower) as uint] = to as u8;
     }
     complements
 }
@@ -70,11 +70,11 @@ fn main() {
         loop {
             match (it.next(), it.next_back()) {
                 (Some(front), Some(back)) => {
-                    let tmp = complements[*front];
-                    *front = complements[*back];
+                    let tmp = complements[*front as uint];
+                    *front = complements[*back as uint];
                     *back = tmp;
                 }
-                (Some(last), None) => *last = complements[*last], // last element
+                (Some(last), None) => *last = complements[*last as uint], // last element
                 _ => break // vector exhausted.
             }
         }
diff --git a/src/test/bench/silly-test-spawn.rs b/src/test/bench/silly-test-spawn.rs
index 16a9c03225a..a68b36964c1 100644
--- a/src/test/bench/silly-test-spawn.rs
+++ b/src/test/bench/silly-test-spawn.rs
@@ -8,7 +8,19 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Useful smoketest for scheduler performance.
+// This is (hopefully) a quick test to get a good idea about spawning
+// performance in libgreen. Note that this uses the rustuv event loop rather
+// than the basic event loop in order to get a better real world idea about the
+// performance of a task spawn.
+
+extern crate green;
+extern crate rustuv;
+
+#[start]
+fn start(argc: int, argv: **u8) -> int {
+    green::start(argc, argv, rustuv::event_loop, main)
+}
+
 fn main() {
     for _ in range(1, 100_000) {
         spawn(proc() {})
diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs
index 4a53b3cbfe4..4ebe885246d 100644
--- a/src/test/bench/task-perf-alloc-unwind.rs
+++ b/src/test/bench/task-perf-alloc-unwind.rs
@@ -13,12 +13,16 @@
 extern crate collections;
 extern crate time;
 
-use collections::list::{List, Cons, Nil};
 use time::precise_time_s;
 use std::os;
 use std::task;
 use std::vec;
 
+#[deriving(Clone)]
+enum List<T> {
+    Nil, Cons(T, @List<T>)
+}
+
 enum UniqueList {
     ULNil, ULCons(~UniqueList)
 }
@@ -93,8 +97,7 @@ fn recurse_or_fail(depth: int, st: Option<State>) {
                 unique: ~Cons((), @*st.unique),
                 tuple: (@Cons((), st.tuple.ref0().clone()),
                         ~Cons((), @*st.tuple.ref1().clone())),
-                vec: vec::append(st.vec.clone(),
-                     &[@Cons((), *st.vec.last().unwrap())]),
+                vec: st.vec.clone().append(&[@Cons((), *st.vec.last().unwrap())]),
                 res: r(@Cons((), st.res._l))
             }
           }
diff --git a/src/test/compile-fail/asm-in-bad-modifier.rs b/src/test/compile-fail/asm-in-bad-modifier.rs
index da4b0677f8f..dfd9fd698c9 100644
--- a/src/test/compile-fail/asm-in-bad-modifier.rs
+++ b/src/test/compile-fail/asm-in-bad-modifier.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // ignore-fast #[feature] doesn't work with check-fast
-#[feature(asm)];
+#![feature(asm)]
 
 fn foo(x: int) { println!("{}", x); }
 
diff --git a/src/test/compile-fail/asm-misplaced-option.rs b/src/test/compile-fail/asm-misplaced-option.rs
index 4f973cbbe25..36896667281 100644
--- a/src/test/compile-fail/asm-misplaced-option.rs
+++ b/src/test/compile-fail/asm-misplaced-option.rs
@@ -11,9 +11,9 @@
 // ignore-fast #[feature] doesn't work with check-fast
 // ignore-android
 
-#[feature(asm)];
+#![feature(asm)]
 
-#[allow(dead_code)];
+#![allow(dead_code)]
 
 #[cfg(target_arch = "x86")]
 #[cfg(target_arch = "x86_64")]
diff --git a/src/test/compile-fail/asm-out-assign-imm.rs b/src/test/compile-fail/asm-out-assign-imm.rs
index f183975ffe0..ae5c67c365f 100644
--- a/src/test/compile-fail/asm-out-assign-imm.rs
+++ b/src/test/compile-fail/asm-out-assign-imm.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // ignore-fast #[feature] doesn't work with check-fast
-#[feature(asm)];
+#![feature(asm)]
 
 fn foo(x: int) { println!("{}", x); }
 
diff --git a/src/test/compile-fail/asm-out-no-modifier.rs b/src/test/compile-fail/asm-out-no-modifier.rs
index 475052b637e..01aa01e09ce 100644
--- a/src/test/compile-fail/asm-out-no-modifier.rs
+++ b/src/test/compile-fail/asm-out-no-modifier.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // ignore-fast #[feature] doesn't work with check-fast
-#[feature(asm)];
+#![feature(asm)]
 
 fn foo(x: int) { println!("{}", x); }
 
diff --git a/src/test/compile-fail/asm-out-read-uninit.rs b/src/test/compile-fail/asm-out-read-uninit.rs
index 664db071f82..a63a59ff423 100644
--- a/src/test/compile-fail/asm-out-read-uninit.rs
+++ b/src/test/compile-fail/asm-out-read-uninit.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // ignore-fast #[feature] doesn't work with check-fast
-#[feature(asm)];
+#![feature(asm)]
 
 fn foo(x: int) { println!("{}", x); }
 
diff --git a/src/test/compile-fail/attr-bad-crate-attr.rc b/src/test/compile-fail/attr-bad-crate-attr.rc
index 8ce20540b93..4ab07f4fa99 100644
--- a/src/test/compile-fail/attr-bad-crate-attr.rc
+++ b/src/test/compile-fail/attr-bad-crate-attr.rc
@@ -10,5 +10,5 @@
 
 // error-pattern: expected item
 
-#[attr = "val"];
+#![attr = "val"]
 #[attr = "val"] // Unterminated
diff --git a/src/test/compile-fail/auto-ref-slice-plus-ref.rs b/src/test/compile-fail/auto-ref-slice-plus-ref.rs
index 8810421f6c4..8c8c0d9cfb6 100644
--- a/src/test/compile-fail/auto-ref-slice-plus-ref.rs
+++ b/src/test/compile-fail/auto-ref-slice-plus-ref.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 fn main() {
 
diff --git a/src/test/compile-fail/autoderef-full-lval.rs b/src/test/compile-fail/autoderef-full-lval.rs
index 8ccf2a9e675..ae9fe611221 100644
--- a/src/test/compile-fail/autoderef-full-lval.rs
+++ b/src/test/compile-fail/autoderef-full-lval.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 struct clam {
     x: @int,
diff --git a/src/test/compile-fail/bad-mid-path-type-params.rs b/src/test/compile-fail/bad-mid-path-type-params.rs
index 12e54d09de5..1b72e468428 100644
--- a/src/test/compile-fail/bad-mid-path-type-params.rs
+++ b/src/test/compile-fail/bad-mid-path-type-params.rs
@@ -10,7 +10,7 @@
 
 // ignore-tidy-linelength
 
-#[no_std];
+#![no_std]
 
 struct S<T> {
     contents: T,
diff --git a/src/test/compile-fail/borrowck-lend-flow-match.rs b/src/test/compile-fail/borrowck-lend-flow-match.rs
index 4b59df4a98f..9d234e0aaa6 100644
--- a/src/test/compile-fail/borrowck-lend-flow-match.rs
+++ b/src/test/compile-fail/borrowck-lend-flow-match.rs
@@ -10,8 +10,8 @@
 
 // ignore-pretty -- comments are unfaithfully preserved
 
-#[allow(unused_variable)];
-#[allow(dead_assignment)];
+#![allow(unused_variable)]
+#![allow(dead_assignment)]
 
 fn cond() -> bool { fail!() }
 fn link<'a>(v: &'a uint, w: &mut &'a uint) -> bool { *w = v; true }
diff --git a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
index 9d628c1f6c7..a6063ffefd4 100644
--- a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
+++ b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 struct Point {
     x: int,
diff --git a/src/test/compile-fail/borrowck-loan-rcvr.rs b/src/test/compile-fail/borrowck-loan-rcvr.rs
index dbeeb521306..2461f1ab396 100644
--- a/src/test/compile-fail/borrowck-loan-rcvr.rs
+++ b/src/test/compile-fail/borrowck-loan-rcvr.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 struct point { x: int, y: int }
 
diff --git a/src/test/compile-fail/borrowck-move-out-of-static-item.rs b/src/test/compile-fail/borrowck-move-out-of-static-item.rs
index a7e5573ccfc..ea36c76ea40 100644
--- a/src/test/compile-fail/borrowck-move-out-of-static-item.rs
+++ b/src/test/compile-fail/borrowck-move-out-of-static-item.rs
@@ -14,10 +14,10 @@ use std::kinds::marker;
 
 struct Foo {
     foo: int,
-    nopod: marker::NoPod
+    nocopy: marker::NoCopy
 }
 
-static BAR: Foo = Foo{foo: 5, nopod: marker::NoPod};
+static BAR: Foo = Foo{foo: 5, nocopy: marker::NoCopy};
 
 
 fn test(f: Foo) {
diff --git a/src/test/compile-fail/borrowck-move-subcomponent.rs b/src/test/compile-fail/borrowck-move-subcomponent.rs
index 368ceb5adab..f6ca6ac42b2 100644
--- a/src/test/compile-fail/borrowck-move-subcomponent.rs
+++ b/src/test/compile-fail/borrowck-move-subcomponent.rs
@@ -11,7 +11,7 @@
 // Tests that the borrow checker checks all components of a path when moving
 // out.
 
-#[no_std];
+#![no_std]
 
 struct S {
   x : ~int
diff --git a/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs b/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs
index 1822cd4a892..82189c6b7c1 100644
--- a/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs
+++ b/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(dead_code)];
+#![allow(dead_code)]
 fn main() {
     // Original borrow ends at end of function
     let mut x = 1u;
diff --git a/src/test/compile-fail/borrowck-struct-update-with-dtor.rs b/src/test/compile-fail/borrowck-struct-update-with-dtor.rs
index 0f09f423300..651104d1eda 100644
--- a/src/test/compile-fail/borrowck-struct-update-with-dtor.rs
+++ b/src/test/compile-fail/borrowck-struct-update-with-dtor.rs
@@ -11,8 +11,8 @@
 // Issue 4691: Ensure that functional-struct-update can only copy, not
 // move, when the struct implements Drop.
 
-// NoPod
-use NP = std::kinds::marker::NoPod;
+// NoCopy
+use NP = std::kinds::marker::NoCopy;
 struct S { a: int, np: NP }
 impl Drop for S { fn drop(&mut self) { } }
 
diff --git a/src/test/compile-fail/box-static-bound.rs b/src/test/compile-fail/box-static-bound.rs
index 1ec5dfa2da9..c4064c6fcac 100644
--- a/src/test/compile-fail/box-static-bound.rs
+++ b/src/test/compile-fail/box-static-bound.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 fn f<T>(x: T) -> @T {
     @x  //~ ERROR value may contain references
diff --git a/src/test/compile-fail/break-outside-loop.rs b/src/test/compile-fail/break-outside-loop.rs
index 4633ca66289..210e3d3af80 100644
--- a/src/test/compile-fail/break-outside-loop.rs
+++ b/src/test/compile-fail/break-outside-loop.rs
@@ -30,4 +30,6 @@ fn main() {
     }
 
     let rs: Foo = Foo{t: pth};
+
+    let unconstrained = break; //~ ERROR: `break` outside of loop
 }
diff --git a/src/test/compile-fail/check-static-values-constraints.rs b/src/test/compile-fail/check-static-values-constraints.rs
index 8ae40a74af1..f4e9521d6b6 100644
--- a/src/test/compile-fail/check-static-values-constraints.rs
+++ b/src/test/compile-fail/check-static-values-constraints.rs
@@ -7,7 +7,7 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 // Verifies all possible restrictions for static items values.
 
diff --git a/src/test/compile-fail/cleanup-rvalue-scopes-cf.rs b/src/test/compile-fail/cleanup-rvalue-scopes-cf.rs
index 47b7b51b8f7..01c6256173f 100644
--- a/src/test/compile-fail/cleanup-rvalue-scopes-cf.rs
+++ b/src/test/compile-fail/cleanup-rvalue-scopes-cf.rs
@@ -11,7 +11,7 @@
 // Test that the borrow checker prevents pointers to temporaries
 // with statement lifetimes from escaping.
 
-#[feature(macro_rules)];
+#![feature(macro_rules)]
 
 use std::ops::Drop;
 
diff --git a/src/test/compile-fail/deriving-primitive.rs b/src/test/compile-fail/deriving-primitive.rs
index 0e530666a8c..7d8741c98e2 100644
--- a/src/test/compile-fail/deriving-primitive.rs
+++ b/src/test/compile-fail/deriving-primitive.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 
 use std::num::FromPrimitive;
 use std::int;
diff --git a/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs
index 37560444af6..7babb8ea1b9 100644
--- a/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs
+++ b/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Clone-enum.rs b/src/test/compile-fail/deriving-span-Clone-enum.rs
index 89acf95f156..65404f155f1 100644
--- a/src/test/compile-fail/deriving-span-Clone-enum.rs
+++ b/src/test/compile-fail/deriving-span-Clone-enum.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Clone-struct.rs b/src/test/compile-fail/deriving-span-Clone-struct.rs
index 0afcfa18c73..0ca429e07e9 100644
--- a/src/test/compile-fail/deriving-span-Clone-struct.rs
+++ b/src/test/compile-fail/deriving-span-Clone-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs b/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs
index d116a791620..e78e59baf1b 100644
--- a/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs
+++ b/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Default-struct.rs b/src/test/compile-fail/deriving-span-Default-struct.rs
index 09afd9730fb..95132d9a5c7 100644
--- a/src/test/compile-fail/deriving-span-Default-struct.rs
+++ b/src/test/compile-fail/deriving-span-Default-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Default-tuple-struct.rs b/src/test/compile-fail/deriving-span-Default-tuple-struct.rs
index 4dbcc3de1fa..670f6e8ea52 100644
--- a/src/test/compile-fail/deriving-span-Default-tuple-struct.rs
+++ b/src/test/compile-fail/deriving-span-Default-tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Eq-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Eq-enum-struct-variant.rs
index 4e9dfd96c63..9e23493e37f 100644
--- a/src/test/compile-fail/deriving-span-Eq-enum-struct-variant.rs
+++ b/src/test/compile-fail/deriving-span-Eq-enum-struct-variant.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Eq-enum.rs b/src/test/compile-fail/deriving-span-Eq-enum.rs
index 794c36b43d8..d4962c8a76b 100644
--- a/src/test/compile-fail/deriving-span-Eq-enum.rs
+++ b/src/test/compile-fail/deriving-span-Eq-enum.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Eq-struct.rs b/src/test/compile-fail/deriving-span-Eq-struct.rs
index 4488e74d851..39c9c23e8f5 100644
--- a/src/test/compile-fail/deriving-span-Eq-struct.rs
+++ b/src/test/compile-fail/deriving-span-Eq-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Eq-tuple-struct.rs b/src/test/compile-fail/deriving-span-Eq-tuple-struct.rs
index 949e1cee37a..a9a9a1b3071 100644
--- a/src/test/compile-fail/deriving-span-Eq-tuple-struct.rs
+++ b/src/test/compile-fail/deriving-span-Eq-tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs
index 1323c4daf94..745ef501021 100644
--- a/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs
+++ b/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Hash-enum.rs b/src/test/compile-fail/deriving-span-Hash-enum.rs
index af78a1ace70..3cd867d1186 100644
--- a/src/test/compile-fail/deriving-span-Hash-enum.rs
+++ b/src/test/compile-fail/deriving-span-Hash-enum.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Hash-struct.rs b/src/test/compile-fail/deriving-span-Hash-struct.rs
index c8fdb0f19a5..e26bdd8d089 100644
--- a/src/test/compile-fail/deriving-span-Hash-struct.rs
+++ b/src/test/compile-fail/deriving-span-Hash-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs b/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs
index 897483c8ada..7554db6dae3 100644
--- a/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs
+++ b/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs
index a99191fd0dc..900fa0dcb6c 100644
--- a/src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs
+++ b/src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq)]
diff --git a/src/test/compile-fail/deriving-span-Ord-enum.rs b/src/test/compile-fail/deriving-span-Ord-enum.rs
index 2be3d5c83af..feb97dee79b 100644
--- a/src/test/compile-fail/deriving-span-Ord-enum.rs
+++ b/src/test/compile-fail/deriving-span-Ord-enum.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq)]
diff --git a/src/test/compile-fail/deriving-span-Ord-struct.rs b/src/test/compile-fail/deriving-span-Ord-struct.rs
index 5848bda1750..c0396b0822e 100644
--- a/src/test/compile-fail/deriving-span-Ord-struct.rs
+++ b/src/test/compile-fail/deriving-span-Ord-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq)]
diff --git a/src/test/compile-fail/deriving-span-Ord-tuple-struct.rs b/src/test/compile-fail/deriving-span-Ord-tuple-struct.rs
index 198721e9b75..26610d7e1fa 100644
--- a/src/test/compile-fail/deriving-span-Ord-tuple-struct.rs
+++ b/src/test/compile-fail/deriving-span-Ord-tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq)]
diff --git a/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs
index 4fee8aa84e6..e1b112bb023 100644
--- a/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs
+++ b/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Rand-enum.rs b/src/test/compile-fail/deriving-span-Rand-enum.rs
index 58f8a2b44b2..746a2aac88e 100644
--- a/src/test/compile-fail/deriving-span-Rand-enum.rs
+++ b/src/test/compile-fail/deriving-span-Rand-enum.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Rand-struct.rs b/src/test/compile-fail/deriving-span-Rand-struct.rs
index 7350f94e76b..397b2adfcc8 100644
--- a/src/test/compile-fail/deriving-span-Rand-struct.rs
+++ b/src/test/compile-fail/deriving-span-Rand-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs b/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs
index 0d7631e8e20..be6b7dcbb8f 100644
--- a/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs
+++ b/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs
index b3f94ff606d..d50f1c69278 100644
--- a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs
+++ b/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Show-enum.rs b/src/test/compile-fail/deriving-span-Show-enum.rs
index f3ff502c6e2..ada1abe8fbb 100644
--- a/src/test/compile-fail/deriving-span-Show-enum.rs
+++ b/src/test/compile-fail/deriving-span-Show-enum.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Show-struct.rs b/src/test/compile-fail/deriving-span-Show-struct.rs
index 258efaaba0c..8d74af6ad0b 100644
--- a/src/test/compile-fail/deriving-span-Show-struct.rs
+++ b/src/test/compile-fail/deriving-span-Show-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs b/src/test/compile-fail/deriving-span-Show-tuple-struct.rs
index 002495389f3..6e421ca58f5 100644
--- a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs
+++ b/src/test/compile-fail/deriving-span-Show-tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs
index 5d6d4531b40..8880d04ce41 100644
--- a/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs
+++ b/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq)]
diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum.rs b/src/test/compile-fail/deriving-span-TotalEq-enum.rs
index b80aa2646d2..d0d8ef62f1e 100644
--- a/src/test/compile-fail/deriving-span-TotalEq-enum.rs
+++ b/src/test/compile-fail/deriving-span-TotalEq-enum.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq)]
diff --git a/src/test/compile-fail/deriving-span-TotalEq-struct.rs b/src/test/compile-fail/deriving-span-TotalEq-struct.rs
index 878316c4b03..53d7e0cbe3a 100644
--- a/src/test/compile-fail/deriving-span-TotalEq-struct.rs
+++ b/src/test/compile-fail/deriving-span-TotalEq-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq)]
diff --git a/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs b/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs
index c590a1f2164..538ffdcd770 100644
--- a/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs
+++ b/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq)]
diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs
index d6ca5f72675..d0adb542fc5 100644
--- a/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs
+++ b/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq, Ord, TotalEq)]
diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum.rs b/src/test/compile-fail/deriving-span-TotalOrd-enum.rs
index e53c8495914..0fc204f6101 100644
--- a/src/test/compile-fail/deriving-span-TotalOrd-enum.rs
+++ b/src/test/compile-fail/deriving-span-TotalOrd-enum.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq, Ord, TotalEq)]
diff --git a/src/test/compile-fail/deriving-span-TotalOrd-struct.rs b/src/test/compile-fail/deriving-span-TotalOrd-struct.rs
index 8b7a9d3bea6..69cf5d2d8ef 100644
--- a/src/test/compile-fail/deriving-span-TotalOrd-struct.rs
+++ b/src/test/compile-fail/deriving-span-TotalOrd-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq, Ord, TotalEq)]
diff --git a/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs b/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs
index ff139237217..230e5b7ed99 100644
--- a/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs
+++ b/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 #[deriving(Eq, Ord, TotalEq)]
diff --git a/src/test/compile-fail/deriving-span-Zero-struct.rs b/src/test/compile-fail/deriving-span-Zero-struct.rs
index acebdff28ff..f32db20ef3f 100644
--- a/src/test/compile-fail/deriving-span-Zero-struct.rs
+++ b/src/test/compile-fail/deriving-span-Zero-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs b/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs
index 64600fef2c5..66488b0ac66 100644
--- a/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs
+++ b/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 extern crate rand;
 
 
diff --git a/src/test/compile-fail/drop-on-non-struct.rs b/src/test/compile-fail/drop-on-non-struct.rs
index e955f9d3289..1ce6cf55ac3 100644
--- a/src/test/compile-fail/drop-on-non-struct.rs
+++ b/src/test/compile-fail/drop-on-non-struct.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 
 type Foo = Vec<u8>;
diff --git a/src/test/compile-fail/dup-struct-enum-struct-variant.rs b/src/test/compile-fail/dup-struct-enum-struct-variant.rs
index b9eda0765f6..064a3b9b168 100644
--- a/src/test/compile-fail/dup-struct-enum-struct-variant.rs
+++ b/src/test/compile-fail/dup-struct-enum-struct-variant.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 
 enum Foo { C { a: int, b: int } }
 struct C { a: int, b: int }         //~ ERROR error: duplicate definition of type `C`
diff --git a/src/test/compile-fail/gated-bad-feature.rs b/src/test/compile-fail/gated-bad-feature.rs
index ed4d32ada09..5a68afaceb9 100644
--- a/src/test/compile-fail/gated-bad-feature.rs
+++ b/src/test/compile-fail/gated-bad-feature.rs
@@ -8,16 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(
+#![feature(
     foo_bar_baz,
     foo(bar),
     foo = "baz"
-)];
+)]
 //~^^^ ERROR: malformed feature
 //~^^^ ERROR: malformed feature
 
-#[feature]; //~ ERROR: malformed feature
-#[feature = "foo"]; //~ ERROR: malformed feature
+#![feature] //~ ERROR: malformed feature
+#![feature = "foo"] //~ ERROR: malformed feature
 
-#[feature(test_removed_feature)]; //~ ERROR: feature has been removed
-#[feature(test_accepted_feature)]; //~ WARNING: feature has added
+#![feature(test_removed_feature)] //~ ERROR: feature has been removed
+#![feature(test_accepted_feature)] //~ WARNING: feature has added
diff --git a/src/test/compile-fail/gated-concat_idents.rs b/src/test/compile-fail/gated-concat_idents.rs
new file mode 100644
index 00000000000..054e70f3822
--- /dev/null
+++ b/src/test/compile-fail/gated-concat_idents.rs
@@ -0,0 +1,13 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough
+}
diff --git a/src/test/compile-fail/gated-default-type-param-usage.rs b/src/test/compile-fail/gated-default-type-param-usage.rs
index 9961a81a85a..4c8b5de4c86 100644
--- a/src/test/compile-fail/gated-default-type-param-usage.rs
+++ b/src/test/compile-fail/gated-default-type-param-usage.rs
@@ -10,7 +10,7 @@
 
 // aux-build:default_type_params_xc.rs
 
-#[deny(default_type_param_usage)];
+#![deny(default_type_param_usage)]
 
 extern crate default_type_params_xc;
 
diff --git a/src/test/compile-fail/gated-non-ascii-idents.rs b/src/test/compile-fail/gated-non-ascii-idents.rs
index f37a6aa354a..174554a0832 100644
--- a/src/test/compile-fail/gated-non-ascii-idents.rs
+++ b/src/test/compile-fail/gated-non-ascii-idents.rs
@@ -10,7 +10,7 @@
 
 // ignore-fast feature doesn't work.
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 
 extern crate bäz; //~ ERROR non-ascii idents
 
diff --git a/src/test/compile-fail/generic-impl-less-params-with-defaults.rs b/src/test/compile-fail/generic-impl-less-params-with-defaults.rs
index a95124239a9..d6a47ffd786 100644
--- a/src/test/compile-fail/generic-impl-less-params-with-defaults.rs
+++ b/src/test/compile-fail/generic-impl-less-params-with-defaults.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(default_type_params)];
+#![feature(default_type_params)]
 
 struct Foo<A, B, C = (A, B)>;
 
diff --git a/src/test/compile-fail/generic-impl-more-params-with-defaults.rs b/src/test/compile-fail/generic-impl-more-params-with-defaults.rs
index c6ee8a870ee..b0040878d62 100644
--- a/src/test/compile-fail/generic-impl-more-params-with-defaults.rs
+++ b/src/test/compile-fail/generic-impl-more-params-with-defaults.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(default_type_params)];
+#![feature(default_type_params)]
 
 struct Heap;
 
diff --git a/src/test/compile-fail/generic-non-trailing-defaults.rs b/src/test/compile-fail/generic-non-trailing-defaults.rs
index a70a52992dd..0b6480fc17d 100644
--- a/src/test/compile-fail/generic-non-trailing-defaults.rs
+++ b/src/test/compile-fail/generic-non-trailing-defaults.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(default_type_params)];
+#![feature(default_type_params)]
 
 struct Heap;
 
diff --git a/src/test/compile-fail/generic-type-less-params-with-defaults.rs b/src/test/compile-fail/generic-type-less-params-with-defaults.rs
index c5badee3bc5..d1fa40bd22c 100644
--- a/src/test/compile-fail/generic-type-less-params-with-defaults.rs
+++ b/src/test/compile-fail/generic-type-less-params-with-defaults.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(default_type_params)];
+#![feature(default_type_params)]
 
 struct Heap;
 
diff --git a/src/test/compile-fail/generic-type-more-params-with-defaults.rs b/src/test/compile-fail/generic-type-more-params-with-defaults.rs
index b4c80bc1e3d..2f3f91a9c3d 100644
--- a/src/test/compile-fail/generic-type-more-params-with-defaults.rs
+++ b/src/test/compile-fail/generic-type-more-params-with-defaults.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(default_type_params)];
+#![feature(default_type_params)]
 
 struct Heap;
 
diff --git a/src/test/compile-fail/generic-type-params-forward-mention.rs b/src/test/compile-fail/generic-type-params-forward-mention.rs
index 003ffdc8cc0..424a92d74ee 100644
--- a/src/test/compile-fail/generic-type-params-forward-mention.rs
+++ b/src/test/compile-fail/generic-type-params-forward-mention.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(default_type_params)];
+#![feature(default_type_params)]
 
 // Ensure that we get an error and not an ICE for this problematic case.
 struct Foo<T = Option<U>, U = bool>;
diff --git a/src/test/compile-fail/generic-type-params-name-repr.rs b/src/test/compile-fail/generic-type-params-name-repr.rs
index 066bbc38e1a..e3d624e9452 100644
--- a/src/test/compile-fail/generic-type-params-name-repr.rs
+++ b/src/test/compile-fail/generic-type-params-name-repr.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(default_type_params)];
+#![feature(default_type_params)]
 
 struct A;
 struct B;
diff --git a/src/test/compile-fail/glob-resolve1.rs b/src/test/compile-fail/glob-resolve1.rs
index 7363fb6d0b2..aae5e0194a1 100644
--- a/src/test/compile-fail/glob-resolve1.rs
+++ b/src/test/compile-fail/glob-resolve1.rs
@@ -10,7 +10,7 @@
 
 // Make sure that globs only bring in public things.
 
-#[feature(globs)];
+#![feature(globs)]
 
 use bar::*;
 
diff --git a/src/test/compile-fail/hygienic-label-1.rs b/src/test/compile-fail/hygienic-label-1.rs
index d2720bc4570..010cde769d7 100644
--- a/src/test/compile-fail/hygienic-label-1.rs
+++ b/src/test/compile-fail/hygienic-label-1.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(macro_rules)];
+#![feature(macro_rules)]
 
 macro_rules! foo {
     () => { break 'x; }
diff --git a/src/test/compile-fail/hygienic-label-2.rs b/src/test/compile-fail/hygienic-label-2.rs
index c97317217fc..78d8fce38d5 100644
--- a/src/test/compile-fail/hygienic-label-2.rs
+++ b/src/test/compile-fail/hygienic-label-2.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(macro_rules)];
+#![feature(macro_rules)]
 
 macro_rules! foo {
     ($e: expr) => { 'x: loop { $e } }
diff --git a/src/test/compile-fail/hygienic-label-3.rs b/src/test/compile-fail/hygienic-label-3.rs
index d5284f5766e..439132fa152 100644
--- a/src/test/compile-fail/hygienic-label-3.rs
+++ b/src/test/compile-fail/hygienic-label-3.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(macro_rules)];
+#![feature(macro_rules)]
 
 macro_rules! foo {
     () => { break 'x; }
diff --git a/src/test/compile-fail/hygienic-label-4.rs b/src/test/compile-fail/hygienic-label-4.rs
index 79ac46ac59a..dfda4586527 100644
--- a/src/test/compile-fail/hygienic-label-4.rs
+++ b/src/test/compile-fail/hygienic-label-4.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(macro_rules)];
+#![feature(macro_rules)]
 
 macro_rules! foo {
     ($e: expr) => { 'x: for _ in range(0,1) { $e } }
diff --git a/src/test/compile-fail/import-glob-0.rs b/src/test/compile-fail/import-glob-0.rs
index 973e36e494c..210a47d2d03 100644
--- a/src/test/compile-fail/import-glob-0.rs
+++ b/src/test/compile-fail/import-glob-0.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -10,7 +10,7 @@
 
 // error-pattern: unresolved name
 
-#[feature(globs)];
+#![feature(globs)]
 
 use module_of_many_things::*;
 
diff --git a/src/test/compile-fail/import-glob-circular.rs b/src/test/compile-fail/import-glob-circular.rs
index 3f5127a55b8..39b18e1c445 100644
--- a/src/test/compile-fail/import-glob-circular.rs
+++ b/src/test/compile-fail/import-glob-circular.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -10,7 +10,7 @@
 
 // error-pattern: unresolved
 
-#[feature(globs)];
+#![feature(globs)]
 
 mod circ1 {
     pub use circ2::f2;
diff --git a/src/test/compile-fail/indexing-requires-a-uint.rs b/src/test/compile-fail/indexing-requires-a-uint.rs
new file mode 100644
index 00000000000..9ac4bd2566e
--- /dev/null
+++ b/src/test/compile-fail/indexing-requires-a-uint.rs
@@ -0,0 +1,25 @@
+// 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.
+
+// Make sure that indexing an array is only valid with a `uint`, not any other
+// integral type.
+
+fn main() {
+    fn bar<T>(_: T) {}
+    [0][0u8]; //~ ERROR: mismatched types
+
+    [0][0]; // should infer to be a uint
+
+    let i = 0;      // i is an IntVar
+    [0][i];         // i should be locked to uint
+    bar::<int>(i);  // i should not be re-coerced back to an int
+    //~^ ERROR: mismatched types
+}
+
diff --git a/src/test/compile-fail/integral-indexing.rs b/src/test/compile-fail/integral-indexing.rs
new file mode 100644
index 00000000000..feda4be87ac
--- /dev/null
+++ b/src/test/compile-fail/integral-indexing.rs
@@ -0,0 +1,26 @@
+// 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.
+//
+// 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 fn main() {
+    let v: Vec<int> = vec!(0, 1, 2, 3, 4, 5);
+    let s: ~str = ~"abcdef";
+    assert_eq!(v.as_slice()[3u], 3);
+    assert_eq!(v.as_slice()[3u8], 3); //~ ERROR: mismatched types
+    assert_eq!(v.as_slice()[3i8], 3); //~ ERROR: mismatched types
+    assert_eq!(v.as_slice()[3u32], 3); //~ ERROR: mismatched types
+    assert_eq!(v.as_slice()[3i32], 3); //~ ERROR: mismatched types
+    println!("{}", v.as_slice()[3u8]); //~ ERROR: mismatched types
+    assert_eq!(s[3u], 'd' as u8);
+    assert_eq!(s[3u8], 'd' as u8); //~ ERROR: mismatched types
+    assert_eq!(s[3i8], 'd' as u8); //~ ERROR: mismatched types
+    assert_eq!(s[3u32], 'd' as u8); //~ ERROR: mismatched types
+    assert_eq!(s[3i32], 'd' as u8); //~ ERROR: mismatched types
+    println!("{}", s[3u8]); //~ ERROR: mismatched types
+}
diff --git a/src/test/compile-fail/invalid-crate-type.rs b/src/test/compile-fail/invalid-crate-type.rs
index e1398b2a361..4b6b6c2fe76 100644
--- a/src/test/compile-fail/invalid-crate-type.rs
+++ b/src/test/compile-fail/invalid-crate-type.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // regression test for issue 11256
-#[crate_type="foo"];    //~ ERROR invalid `crate_type` value
+#![crate_type="foo"]    //~ ERROR invalid `crate_type` value
 
 fn main() {
     return
diff --git a/src/test/compile-fail/issue-1697.rs b/src/test/compile-fail/issue-1697.rs
index e49eb1454d8..f79a8fffd92 100644
--- a/src/test/compile-fail/issue-1697.rs
+++ b/src/test/compile-fail/issue-1697.rs
@@ -10,7 +10,7 @@
 
 // Testing that we don't fail abnormally after hitting the errors
 
-#[feature(globs)];
+#![feature(globs)]
 
 use unresolved::*; //~ ERROR unresolved import. maybe a missing
 //~^ ERROR failed to resolve import
diff --git a/src/test/compile-fail/issue-2063-resource.rs b/src/test/compile-fail/issue-2063-resource.rs
index 0fd2b04a199..d34fb10e9dd 100644
--- a/src/test/compile-fail/issue-2063-resource.rs
+++ b/src/test/compile-fail/issue-2063-resource.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 // test that autoderef of a type like this does not
 // cause compiler to loop.  Note that no instances
diff --git a/src/test/compile-fail/issue-2150.rs b/src/test/compile-fail/issue-2150.rs
index c89df46114c..b12e6799e6a 100644
--- a/src/test/compile-fail/issue-2150.rs
+++ b/src/test/compile-fail/issue-2150.rs
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(unreachable_code)];
-#[allow(unused_variable)];
-#[allow(dead_code)];
-#[allow(deprecated_owned_vector)];
+#![deny(unreachable_code)]
+#![allow(unused_variable)]
+#![allow(dead_code)]
+#![allow(deprecated_owned_vector)]
 
 
 fn fail_len(v: Vec<int> ) -> uint {
diff --git a/src/test/compile-fail/issue-3668.rs b/src/test/compile-fail/issue-3668.rs
index 9f60cceb152..e3b145411ba 100644
--- a/src/test/compile-fail/issue-3668.rs
+++ b/src/test/compile-fail/issue-3668.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 struct P { child: Option<@P> }
 trait PTrait {
diff --git a/src/test/compile-fail/issue-3763.rs b/src/test/compile-fail/issue-3763.rs
index a4d184e346b..736ac55aef5 100644
--- a/src/test/compile-fail/issue-3763.rs
+++ b/src/test/compile-fail/issue-3763.rs
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 mod my_mod {
     pub struct MyStruct {
-        priv priv_field: int
+        priv_field: int
     }
     pub fn MyStruct () -> MyStruct {
         MyStruct {priv_field: 4}
diff --git a/src/test/compile-fail/issue-4366-2.rs b/src/test/compile-fail/issue-4366-2.rs
index 6764b489b62..373e7339b69 100644
--- a/src/test/compile-fail/issue-4366-2.rs
+++ b/src/test/compile-fail/issue-4366-2.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
+#![feature(globs)]
 
 // ensures that 'use foo:*' doesn't import non-public item
 
diff --git a/src/test/compile-fail/issue-4366.rs b/src/test/compile-fail/issue-4366.rs
index e9c1092a4a5..7959078359c 100644
--- a/src/test/compile-fail/issue-4366.rs
+++ b/src/test/compile-fail/issue-4366.rs
@@ -13,7 +13,7 @@
 // ensures that 'use foo:*' doesn't import non-public 'use' statements in the
 // module 'foo'
 
-#[feature(globs)];
+#![feature(globs)]
 
 use m1::*;
 
diff --git a/src/test/compile-fail/issue-5060-fail.rs b/src/test/compile-fail/issue-5060-fail.rs
index d15fed2d9d2..fedb064d2e5 100644
--- a/src/test/compile-fail/issue-5060-fail.rs
+++ b/src/test/compile-fail/issue-5060-fail.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(macro_rules)];
+#![feature(macro_rules)]
 
 macro_rules! print_hd_tl (
     ($field_hd:ident, $($field_tl:ident),+) => ({
diff --git a/src/test/compile-fail/issue-6804.rs b/src/test/compile-fail/issue-6804.rs
index 60f16275fc4..600b28048b4 100644
--- a/src/test/compile-fail/issue-6804.rs
+++ b/src/test/compile-fail/issue-6804.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(dead_code)];
+#![allow(dead_code)]
 
 // Matching against NaN should result in a warning
 
diff --git a/src/test/compile-fail/issue-7013.rs b/src/test/compile-fail/issue-7013.rs
index 5c84cbe00a9..6a7f01e6767 100644
--- a/src/test/compile-fail/issue-7013.rs
+++ b/src/test/compile-fail/issue-7013.rs
@@ -31,12 +31,12 @@ impl Foo for B
 
 struct A
 {
-    v: ~Foo,
+    v: ~Foo:Send,
 }
 
 fn main()
 {
-    let a = A {v: ~B{v: None} as ~Foo};
+    let a = A {v: ~B{v: None} as ~Foo:Send};
     //~^ ERROR cannot pack type `~B`, which does not fulfill `Send`
     let v = Rc::new(RefCell::new(a));
     let w = v.clone();
diff --git a/src/test/compile-fail/issue-7061.rs b/src/test/compile-fail/issue-7061.rs
index c7fa286d351..d62c27edf51 100644
--- a/src/test/compile-fail/issue-7061.rs
+++ b/src/test/compile-fail/issue-7061.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 struct BarStruct;
 
diff --git a/src/test/compile-fail/issue-7246.rs b/src/test/compile-fail/issue-7246.rs
index 74bc1ac0d86..7e8d431bf19 100644
--- a/src/test/compile-fail/issue-7246.rs
+++ b/src/test/compile-fail/issue-7246.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(unreachable_code)];
-#[allow(dead_code)];
+#![deny(unreachable_code)]
+#![allow(dead_code)]
 
 use std::ptr;
 pub unsafe fn g() {
diff --git a/src/test/compile-fail/issue-7364.rs b/src/test/compile-fail/issue-7364.rs
index 541a1033302..ca66905688a 100644
--- a/src/test/compile-fail/issue-7364.rs
+++ b/src/test/compile-fail/issue-7364.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 use std::cell::RefCell;
 
diff --git a/src/test/compile-fail/issue-897-2.rs b/src/test/compile-fail/issue-897-2.rs
index 91d47cae15c..45b45dbaf5d 100644
--- a/src/test/compile-fail/issue-897-2.rs
+++ b/src/test/compile-fail/issue-897-2.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(unreachable_code)];
+#![deny(unreachable_code)]
 
 fn g() -> ! { fail!(); }
 fn f() -> ! {
diff --git a/src/test/compile-fail/kindck-copy.rs b/src/test/compile-fail/kindck-copy.rs
new file mode 100644
index 00000000000..d4010346998
--- /dev/null
+++ b/src/test/compile-fail/kindck-copy.rs
@@ -0,0 +1,86 @@
+// 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.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test which of the builtin types are considered POD.
+
+#![feature(managed_boxes)]
+
+use std::rc::Rc;
+
+fn assert_copy<T:Copy>() { }
+trait Dummy { }
+
+struct MyStruct {
+    x: int,
+    y: int,
+}
+
+struct MyNoncopyStruct {
+    x: ~int,
+}
+
+fn test<'a,T,U:Copy>(_: &'a int) {
+    // lifetime pointers are ok...
+    assert_copy::<&'static int>();
+    assert_copy::<&'a int>();
+    assert_copy::<&'a str>();
+    assert_copy::<&'a [int]>();
+
+    // ...unless they are mutable
+    assert_copy::<&'static mut int>(); //~ ERROR does not fulfill
+    assert_copy::<&'a mut int>();  //~ ERROR does not fulfill
+
+    // ~ pointers are not ok
+    assert_copy::<~int>();   //~ ERROR does not fulfill
+    assert_copy::<~str>();   //~ ERROR does not fulfill
+    assert_copy::<Vec<int> >(); //~ ERROR does not fulfill
+    assert_copy::<~&'a mut int>(); //~ ERROR does not fulfill
+
+    // borrowed object types are generally ok
+    assert_copy::<&'a Dummy>();
+    assert_copy::<&'a Dummy:Copy>();
+    assert_copy::<&'static Dummy:Copy>();
+
+    // owned object types are not ok
+    assert_copy::<~Dummy>(); //~ ERROR does not fulfill
+    assert_copy::<~Dummy:Copy>(); //~ ERROR does not fulfill
+
+    // mutable object types are not ok
+    assert_copy::<&'a mut Dummy:Copy>();  //~ ERROR does not fulfill
+
+    // closures are like an `&mut` object
+    assert_copy::<||>(); //~ ERROR does not fulfill
+
+    // unsafe ptrs are ok
+    assert_copy::<*int>();
+    assert_copy::<*&'a mut int>();
+
+    // regular old ints and such are ok
+    assert_copy::<int>();
+    assert_copy::<bool>();
+    assert_copy::<()>();
+
+    // tuples are ok
+    assert_copy::<(int,int)>();
+
+    // structs of POD are ok
+    assert_copy::<MyStruct>();
+
+    // structs containing non-POD are not ok
+    assert_copy::<MyNoncopyStruct>(); //~ ERROR does not fulfill
+
+    // managed or ref counted types are not ok
+    assert_copy::<@int>();   //~ ERROR does not fulfill
+    assert_copy::<Rc<int>>();   //~ ERROR does not fulfill
+}
+
+pub fn main() {
+}
+
diff --git a/src/test/compile-fail/kindck-destructor-owned.rs b/src/test/compile-fail/kindck-destructor-owned.rs
index 1557aff6689..0e1190d2c12 100644
--- a/src/test/compile-fail/kindck-destructor-owned.rs
+++ b/src/test/compile-fail/kindck-destructor-owned.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 struct Foo {
     f: @int,
diff --git a/src/test/compile-fail/kindck-nonsendable-1.rs b/src/test/compile-fail/kindck-nonsendable-1.rs
index 02c58ba5ee3..51687fffd11 100644
--- a/src/test/compile-fail/kindck-nonsendable-1.rs
+++ b/src/test/compile-fail/kindck-nonsendable-1.rs
@@ -8,13 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 fn foo(_x: @uint) {}
 
 fn main() {
     let x = @3u;
-    let _: proc() = proc() foo(x); //~ ERROR does not fulfill `Send`
-    let _: proc() = proc() foo(x); //~ ERROR does not fulfill `Send`
-    let _: proc() = proc() foo(x); //~ ERROR does not fulfill `Send`
+    let _: proc:Send() = proc() foo(x); //~ ERROR does not fulfill `Send`
+    let _: proc:Send() = proc() foo(x); //~ ERROR does not fulfill `Send`
+    let _: proc:Send() = proc() foo(x); //~ ERROR does not fulfill `Send`
+    let _: proc() = proc() foo(x);
 }
diff --git a/src/test/compile-fail/kindck-owned-trait-contains.rs b/src/test/compile-fail/kindck-owned-trait-contains.rs
index ed1725f3240..e2005cbae91 100644
--- a/src/test/compile-fail/kindck-owned-trait-contains.rs
+++ b/src/test/compile-fail/kindck-owned-trait-contains.rs
@@ -14,8 +14,8 @@ impl<A:Clone> Repeat<A> for A {
     fn get(&self) -> A { self.clone() }
 }
 
-fn repeater<A:Clone>(v: A) -> ~Repeat:<A> {
-    ~v as ~Repeat:<A> // No
+fn repeater<A:Clone>(v: A) -> ~Repeat<A>: {
+    ~v as ~Repeat<A>: // No
 }
 
 fn main() {
diff --git a/src/test/compile-fail/kindck-pod.rs b/src/test/compile-fail/kindck-pod.rs
deleted file mode 100644
index 94902d4e68e..00000000000
--- a/src/test/compile-fail/kindck-pod.rs
+++ /dev/null
@@ -1,86 +0,0 @@
-// 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.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test which of the builtin types are considered POD.
-
-#[feature(managed_boxes)];
-
-use std::rc::Rc;
-
-fn assert_pod<T:Pod>() { }
-trait Dummy { }
-
-struct MyStruct {
-    x: int,
-    y: int,
-}
-
-struct MyNonpodStruct {
-    x: ~int,
-}
-
-fn test<'a,T,U:Pod>(_: &'a int) {
-    // lifetime pointers are ok...
-    assert_pod::<&'static int>();
-    assert_pod::<&'a int>();
-    assert_pod::<&'a str>();
-    assert_pod::<&'a [int]>();
-
-    // ...unless they are mutable
-    assert_pod::<&'static mut int>(); //~ ERROR does not fulfill `Pod`
-    assert_pod::<&'a mut int>();  //~ ERROR does not fulfill `Pod`
-
-    // ~ pointers are not ok
-    assert_pod::<~int>();   //~ ERROR does not fulfill `Pod`
-    assert_pod::<~str>();   //~ ERROR does not fulfill `Pod`
-    assert_pod::<Vec<int> >(); //~ ERROR does not fulfill `Pod`
-    assert_pod::<~&'a mut int>(); //~ ERROR does not fulfill `Pod`
-
-    // borrowed object types are generally ok
-    assert_pod::<&'a Dummy>();
-    assert_pod::<&'a Dummy:Pod>();
-    assert_pod::<&'static Dummy:Pod>();
-
-    // owned object types are not ok
-    assert_pod::<~Dummy>(); //~ ERROR does not fulfill `Pod`
-    assert_pod::<~Dummy:Pod>(); //~ ERROR does not fulfill `Pod`
-
-    // mutable object types are not ok
-    assert_pod::<&'a mut Dummy:Pod>();  //~ ERROR does not fulfill `Pod`
-
-    // closures are like an `&mut` object
-    assert_pod::<||>(); //~ ERROR does not fulfill `Pod`
-
-    // unsafe ptrs are ok
-    assert_pod::<*int>();
-    assert_pod::<*&'a mut int>();
-
-    // regular old ints and such are ok
-    assert_pod::<int>();
-    assert_pod::<bool>();
-    assert_pod::<()>();
-
-    // tuples are ok
-    assert_pod::<(int,int)>();
-
-    // structs of POD are ok
-    assert_pod::<MyStruct>();
-
-    // structs containing non-POD are not ok
-    assert_pod::<MyNonpodStruct>(); //~ ERROR does not fulfill `Pod`
-
-    // managed or ref counted types are not ok
-    assert_pod::<@int>();   //~ ERROR does not fulfill `Pod`
-    assert_pod::<Rc<int>>();   //~ ERROR does not fulfill `Pod`
-}
-
-pub fn main() {
-}
-
diff --git a/src/test/compile-fail/linkage2.rs b/src/test/compile-fail/linkage2.rs
index 524324fa1f1..edbeebe882e 100644
--- a/src/test/compile-fail/linkage2.rs
+++ b/src/test/compile-fail/linkage2.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(linkage)];
+#![feature(linkage)]
 
 extern {
     #[linkage = "extern_weak"] static foo: i32;
diff --git a/src/test/compile-fail/linkage3.rs b/src/test/compile-fail/linkage3.rs
index 2da800bcb1c..11ae2fcf940 100644
--- a/src/test/compile-fail/linkage3.rs
+++ b/src/test/compile-fail/linkage3.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(linkage)];
+#![feature(linkage)]
 
 extern {
     #[linkage = "foo"] static foo: *i32;
diff --git a/src/test/compile-fail/lint-allocation.rs b/src/test/compile-fail/lint-allocation.rs
index 608cb7fd4a5..46199fa0280 100644
--- a/src/test/compile-fail/lint-allocation.rs
+++ b/src/test/compile-fail/lint-allocation.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(unnecessary_allocation)];
+#![deny(unnecessary_allocation)]
 
 fn f(_: &int) {}
 fn g(_: &mut int) {}
diff --git a/src/test/compile-fail/lint-change-warnings.rs b/src/test/compile-fail/lint-change-warnings.rs
index e9985430adf..441a8410700 100644
--- a/src/test/compile-fail/lint-change-warnings.rs
+++ b/src/test/compile-fail/lint-change-warnings.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(warnings)];
-#[allow(dead_code)];
+#![deny(warnings)]
+#![allow(dead_code)]
 
 fn main() {
     while true {} //~ ERROR: infinite
diff --git a/src/test/compile-fail/lint-ctypes-enum.rs b/src/test/compile-fail/lint-ctypes-enum.rs
index 2e47695f0fc..e968bd601c5 100644
--- a/src/test/compile-fail/lint-ctypes-enum.rs
+++ b/src/test/compile-fail/lint-ctypes-enum.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(ctypes)];
-#[allow(dead_code)];
+#![deny(ctypes)]
+#![allow(dead_code)]
 
 enum Z { }
 enum U { A }
diff --git a/src/test/compile-fail/lint-ctypes.rs b/src/test/compile-fail/lint-ctypes.rs
index 0a1b78c8d5d..352a31cf67b 100644
--- a/src/test/compile-fail/lint-ctypes.rs
+++ b/src/test/compile-fail/lint-ctypes.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(ctypes)];
+#![deny(ctypes)]
 
 use std::libc;
 
diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs
index 629a203fcbb..04326403376 100644
--- a/src/test/compile-fail/lint-dead-code-1.rs
+++ b/src/test/compile-fail/lint-dead-code-1.rs
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[no_std];
-#[allow(unused_variable)];
-#[allow(non_camel_case_types)];
-#[allow(visible_private_types)];
-#[deny(dead_code)];
+#![no_std]
+#![allow(unused_variable)]
+#![allow(non_camel_case_types)]
+#![allow(visible_private_types)]
+#![deny(dead_code)]
 
-#[crate_type="lib"];
+#![crate_type="lib"]
 
 pub use foo2::Bar2;
 mod foo {
diff --git a/src/test/compile-fail/lint-dead-code-2.rs b/src/test/compile-fail/lint-dead-code-2.rs
index 663e7890bbe..1563850c641 100644
--- a/src/test/compile-fail/lint-dead-code-2.rs
+++ b/src/test/compile-fail/lint-dead-code-2.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(unused_variable)];
-#[deny(dead_code)];
+#![allow(unused_variable)]
+#![deny(dead_code)]
 
 struct Foo;
 
diff --git a/src/test/compile-fail/lint-dead-code-3.rs b/src/test/compile-fail/lint-dead-code-3.rs
index e07fc96a1f3..7c8a4c2a22c 100644
--- a/src/test/compile-fail/lint-dead-code-3.rs
+++ b/src/test/compile-fail/lint-dead-code-3.rs
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(unused_variable)];
-#[allow(non_camel_case_types)];
-#[deny(dead_code)];
+#![allow(unused_variable)]
+#![allow(non_camel_case_types)]
+#![deny(dead_code)]
 
-#[crate_type="lib"];
+#![crate_type="lib"]
 
 struct Foo; //~ ERROR: code is never used
 impl Foo {
diff --git a/src/test/compile-fail/lint-deprecated-owned-vector.rs b/src/test/compile-fail/lint-deprecated-owned-vector.rs
index e73e1eacc7c..acc916a0391 100644
--- a/src/test/compile-fail/lint-deprecated-owned-vector.rs
+++ b/src/test/compile-fail/lint-deprecated-owned-vector.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(deprecated_owned_vector)];
+#![deny(deprecated_owned_vector)]
 
 fn main() {
     ~[1]; //~ ERROR use of deprecated `~[]`
diff --git a/src/test/compile-fail/lint-heap-memory.rs b/src/test/compile-fail/lint-heap-memory.rs
index f4588801075..abe4d08903d 100644
--- a/src/test/compile-fail/lint-heap-memory.rs
+++ b/src/test/compile-fail/lint-heap-memory.rs
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-#[forbid(heap_memory)];
-#[allow(dead_code)];
-#[allow(deprecated_owned_vector)];
+#![feature(managed_boxes)]
+#![forbid(heap_memory)]
+#![allow(dead_code)]
+#![allow(deprecated_owned_vector)]
 
 struct Foo {
     x: @int //~ ERROR type uses managed
diff --git a/src/test/compile-fail/lint-impl-fn.rs b/src/test/compile-fail/lint-impl-fn.rs
index ad35a22b4ef..eaef43a9083 100644
--- a/src/test/compile-fail/lint-impl-fn.rs
+++ b/src/test/compile-fail/lint-impl-fn.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(while_true)];
-#[allow(dead_code)];
+#![allow(while_true)]
+#![allow(dead_code)]
 
 struct A(int);
 
diff --git a/src/test/compile-fail/lint-managed-heap-memory.rs b/src/test/compile-fail/lint-managed-heap-memory.rs
index 6b8a971653d..d9a79d75975 100644
--- a/src/test/compile-fail/lint-managed-heap-memory.rs
+++ b/src/test/compile-fail/lint-managed-heap-memory.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-#[forbid(managed_heap_memory)];
+#![feature(managed_boxes)]
+#![forbid(managed_heap_memory)]
 
 struct Foo {
     x: @int //~ ERROR type uses managed
diff --git a/src/test/compile-fail/lint-misplaced-attr.rs b/src/test/compile-fail/lint-misplaced-attr.rs
index 64b3a52848b..d422dfc513d 100644
--- a/src/test/compile-fail/lint-misplaced-attr.rs
+++ b/src/test/compile-fail/lint-misplaced-attr.rs
@@ -11,10 +11,10 @@
 // When denying at the crate level, be sure to not get random warnings from the
 // injected intrinsics by the compiler.
 
-#[deny(attribute_usage)];
+#![deny(attribute_usage)]
 
 mod a {
-    #[crate_type = "bin"]; //~ ERROR: crate-level attribute
+    #![crate_type = "bin"] //~ ERROR: crate-level attribute
 }
 
 #[crate_type = "bin"] fn main() {} //~ ERROR: crate-level attribute
diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs
index 9d640647fe0..bf8933220bc 100644
--- a/src/test/compile-fail/lint-missing-doc.rs
+++ b/src/test/compile-fail/lint-missing-doc.rs
@@ -10,13 +10,13 @@
 
 // When denying at the crate level, be sure to not get random warnings from the
 // injected intrinsics by the compiler.
-#[feature(struct_variant)];
-#[feature(globs)];
-#[deny(missing_doc)];
-#[allow(dead_code)];
+#![feature(struct_variant)]
+#![feature(globs)]
+#![deny(missing_doc)]
+#![allow(dead_code)]
 
 //! Some garbage docs for the crate here
-#[doc="More garbage"];
+#![doc="More garbage"]
 
 struct Foo {
     a: int,
@@ -24,14 +24,14 @@ struct Foo {
 }
 
 pub struct PubFoo { //~ ERROR: missing documentation
-    a: int,      //~ ERROR: missing documentation
-    priv b: int,
+    pub a: int,      //~ ERROR: missing documentation
+    b: int,
 }
 
 #[allow(missing_doc)]
 pub struct PubFoo2 {
-    a: int,
-    c: int,
+    pub a: int,
+    pub c: int,
 }
 
 mod module_no_dox {}
@@ -106,8 +106,8 @@ enum Baz {
 
 pub enum PubBaz { //~ ERROR: missing documentation
     PubBazA { //~ ERROR: missing documentation
-        a: int, //~ ERROR: missing documentation
-        priv b: int
+        pub a: int, //~ ERROR: missing documentation
+        b: int
     },
 
     priv PubBazB
@@ -118,8 +118,8 @@ pub enum PubBaz2 {
     /// dox
     PubBaz2A {
         /// dox
-        a: int,
-        priv b: int
+        pub a: int,
+        b: int
     },
     priv PubBaz2B
 }
@@ -127,8 +127,8 @@ pub enum PubBaz2 {
 #[allow(missing_doc)]
 pub enum PubBaz3 {
     PubBaz3A {
-        a: int,
-        priv b: int
+        pub a: int,
+        b: int
     },
     priv PubBaz3B
 }
diff --git a/src/test/compile-fail/lint-non-camel-case-types.rs b/src/test/compile-fail/lint-non-camel-case-types.rs
index 6d217656cd0..57b051e1bea 100644
--- a/src/test/compile-fail/lint-non-camel-case-types.rs
+++ b/src/test/compile-fail/lint-non-camel-case-types.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(non_camel_case_types)];
-#[allow(dead_code)];
+#![forbid(non_camel_case_types)]
+#![allow(dead_code)]
 
 struct foo { //~ ERROR type `foo` should have a camel case identifier
     bar: int,
diff --git a/src/test/compile-fail/lint-non-uppercase-statics.rs b/src/test/compile-fail/lint-non-uppercase-statics.rs
index d41a4ccda8d..6eca7c3ed3d 100644
--- a/src/test/compile-fail/lint-non-uppercase-statics.rs
+++ b/src/test/compile-fail/lint-non-uppercase-statics.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(non_uppercase_statics)];
-#[allow(dead_code)];
+#![forbid(non_uppercase_statics)]
+#![allow(dead_code)]
 
 static foo: int = 1; //~ ERROR static constant should have an uppercase identifier
 
diff --git a/src/test/compile-fail/lint-obsolete-attr.rs b/src/test/compile-fail/lint-obsolete-attr.rs
index 442bcaa0923..8b70953146d 100644
--- a/src/test/compile-fail/lint-obsolete-attr.rs
+++ b/src/test/compile-fail/lint-obsolete-attr.rs
@@ -11,8 +11,8 @@
 // When denying at the crate level, be sure to not get random warnings from the
 // injected intrinsics by the compiler.
 
-#[deny(attribute_usage)];
-#[allow(dead_code)];
+#![deny(attribute_usage)]
+#![allow(dead_code)]
 
 #[abi="stdcall"] extern {} //~ ERROR: obsolete attribute
 
diff --git a/src/test/compile-fail/lint-owned-heap-memory.rs b/src/test/compile-fail/lint-owned-heap-memory.rs
index 9f5b4497d93..859dd127b97 100644
--- a/src/test/compile-fail/lint-owned-heap-memory.rs
+++ b/src/test/compile-fail/lint-owned-heap-memory.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(owned_heap_memory)];
+#![forbid(owned_heap_memory)]
 
 struct Foo {
     x: ~int //~ ERROR type uses owned
diff --git a/src/test/compile-fail/lint-qualification.rs b/src/test/compile-fail/lint-qualification.rs
index a6775c51c45..7006a283750 100644
--- a/src/test/compile-fail/lint-qualification.rs
+++ b/src/test/compile-fail/lint-qualification.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(unnecessary_qualification)];
+#![deny(unnecessary_qualification)]
 
 mod foo {
     pub fn bar() {}
diff --git a/src/test/compile-fail/lint-raw-ptr-deriving.rs b/src/test/compile-fail/lint-raw-ptr-deriving.rs
new file mode 100644
index 00000000000..d3fdd508f45
--- /dev/null
+++ b/src/test/compile-fail/lint-raw-ptr-deriving.rs
@@ -0,0 +1,35 @@
+// Copyright 2013 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(struct_variant)]
+#![allow(dead_code)]
+#![deny(raw_pointer_deriving)]
+
+#[deriving(Clone)]
+struct Foo {
+    x: *int //~ ERROR use of `#[deriving]` with a raw pointer
+}
+
+#[deriving(Clone)]
+struct Bar(*mut int); //~ ERROR use of `#[deriving]` with a raw pointer
+
+#[deriving(Clone)]
+enum Baz {
+    A(*int), //~ ERROR use of `#[deriving]` with a raw pointer
+    B { x: *mut int } //~ ERROR use of `#[deriving]` with a raw pointer
+}
+
+#[deriving(Clone)]
+struct Buzz {
+    x: (*int, //~ ERROR use of `#[deriving]` with a raw pointer
+        *uint) //~ ERROR use of `#[deriving]` with a raw pointer
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/lint-stability.rs b/src/test/compile-fail/lint-stability.rs
index f45f654229f..4ebd9f1cefd 100644
--- a/src/test/compile-fail/lint-stability.rs
+++ b/src/test/compile-fail/lint-stability.rs
@@ -11,11 +11,11 @@
 // ignore-fast aux-build
 // aux-build:lint_stability.rs
 
-#[feature(globs)];
-#[deny(unstable)];
-#[deny(deprecated)];
-#[deny(experimental)];
-#[allow(dead_code)];
+#![feature(globs)]
+#![deny(unstable)]
+#![deny(deprecated)]
+#![deny(experimental)]
+#![allow(dead_code)]
 
 mod cross_crate {
     extern crate lint_stability;
diff --git a/src/test/compile-fail/lint-type-limits.rs b/src/test/compile-fail/lint-type-limits.rs
index f609debb5bd..8cca39a7a25 100644
--- a/src/test/compile-fail/lint-type-limits.rs
+++ b/src/test/compile-fail/lint-type-limits.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(dead_code)];
+#![allow(dead_code)]
 
 // compile-flags: -D type-limits
 fn main() { }
diff --git a/src/test/compile-fail/lint-type-overflow.rs b/src/test/compile-fail/lint-type-overflow.rs
index e6c535925a4..e5a5c7dd1c7 100644
--- a/src/test/compile-fail/lint-type-overflow.rs
+++ b/src/test/compile-fail/lint-type-overflow.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 //
 
-#[deny(type_overflow)];
+#![deny(type_overflow)]
 
 fn test(x: i8) {
     println!("x {}", x);
diff --git a/src/test/compile-fail/lint-unknown-attr.rs b/src/test/compile-fail/lint-unknown-attr.rs
index ce83ba464c0..dbbf91f725d 100644
--- a/src/test/compile-fail/lint-unknown-attr.rs
+++ b/src/test/compile-fail/lint-unknown-attr.rs
@@ -11,9 +11,9 @@
 // When denying at the crate level, be sure to not get random warnings from the
 // injected intrinsics by the compiler.
 
-#[deny(attribute_usage)];
+#![deny(attribute_usage)]
 
-#[mutable_doc]; //~ ERROR: unknown crate attribute
+#![mutable_doc] //~ ERROR: unknown crate attribute
 
 #[dance] mod a {} //~ ERROR: unknown attribute
 
diff --git a/src/test/compile-fail/lint-unknown-feature.rs b/src/test/compile-fail/lint-unknown-feature.rs
index 15f446a671c..6252e01749b 100644
--- a/src/test/compile-fail/lint-unknown-feature.rs
+++ b/src/test/compile-fail/lint-unknown-feature.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(unknown_features)];
+#![deny(unknown_features)]
 
-#[feature(this_is_not_a_feature)]; //~ ERROR: unknown feature
+#![feature(this_is_not_a_feature)] //~ ERROR: unknown feature
 
 fn main() {}
diff --git a/src/test/compile-fail/lint-unnecessary-casts.rs b/src/test/compile-fail/lint-unnecessary-casts.rs
index 9324bf11005..644c5d9fb3d 100644
--- a/src/test/compile-fail/lint-unnecessary-casts.rs
+++ b/src/test/compile-fail/lint-unnecessary-casts.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(unnecessary_typecast)];
+#![forbid(unnecessary_typecast)]
 
 fn foo_i32(_: i32) {}
 
diff --git a/src/test/compile-fail/lint-unnecessary-parens.rs b/src/test/compile-fail/lint-unnecessary-parens.rs
index 528fc2f64b4..b2abe025794 100644
--- a/src/test/compile-fail/lint-unnecessary-parens.rs
+++ b/src/test/compile-fail/lint-unnecessary-parens.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(unnecessary_parens)];
+#![deny(unnecessary_parens)]
 
 fn foo() -> int {
     return (1); //~ ERROR unnecessary parentheses around `return` value
diff --git a/src/test/compile-fail/lint-unsafe-block.rs b/src/test/compile-fail/lint-unsafe-block.rs
index 529d3e921a0..a4c50781a77 100644
--- a/src/test/compile-fail/lint-unsafe-block.rs
+++ b/src/test/compile-fail/lint-unsafe-block.rs
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(unused_unsafe)];
-#[allow(dead_code)];
-#[deny(unsafe_block)];
-#[feature(macro_rules)];
+#![allow(unused_unsafe)]
+#![allow(dead_code)]
+#![deny(unsafe_block)]
+#![feature(macro_rules)]
 
 unsafe fn allowed() {}
 
diff --git a/src/test/compile-fail/lint-unused-import-tricky-globs.rs b/src/test/compile-fail/lint-unused-import-tricky-globs.rs
index 9d6140b8fd2..62ea337656d 100644
--- a/src/test/compile-fail/lint-unused-import-tricky-globs.rs
+++ b/src/test/compile-fail/lint-unused-import-tricky-globs.rs
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
-#[deny(unused_imports)];
-#[allow(dead_code)];
+#![feature(globs)]
+#![deny(unused_imports)]
+#![allow(dead_code)]
 
 mod A {
     pub fn p() {}
diff --git a/src/test/compile-fail/lint-unused-import-tricky-names.rs b/src/test/compile-fail/lint-unused-import-tricky-names.rs
index 0dc1091dabd..39e344da115 100644
--- a/src/test/compile-fail/lint-unused-import-tricky-names.rs
+++ b/src/test/compile-fail/lint-unused-import-tricky-names.rs
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(unused_imports)];
-#[allow(non_camel_case_types)];
-#[allow(dead_code)];
+#![deny(unused_imports)]
+#![allow(non_camel_case_types)]
+#![allow(dead_code)]
 
 // Regression test for issue #6633
 mod issue6633 {
diff --git a/src/test/compile-fail/lint-unused-imports.rs b/src/test/compile-fail/lint-unused-imports.rs
index e4d9048ca8d..a25b211e481 100644
--- a/src/test/compile-fail/lint-unused-imports.rs
+++ b/src/test/compile-fail/lint-unused-imports.rs
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
-#[deny(unused_imports)];
-#[allow(dead_code)];
-#[allow(deprecated_owned_vector)];
+#![feature(globs)]
+#![deny(unused_imports)]
+#![allow(dead_code)]
+#![allow(deprecated_owned_vector)]
 
 use cal = bar::c::cc;
 
@@ -40,8 +40,8 @@ mod test {
 }
 
 mod foo {
-    pub struct Point{x: int, y: int}
-    pub struct Square{p: Point, h: uint, w: uint}
+    pub struct Point{pub x: int, pub y: int}
+    pub struct Square{pub p: Point, pub h: uint, pub w: uint}
 }
 
 mod bar {
diff --git a/src/test/compile-fail/lint-unused-mut-self.rs b/src/test/compile-fail/lint-unused-mut-self.rs
index ada534ffc72..84c484a91e2 100644
--- a/src/test/compile-fail/lint-unused-mut-self.rs
+++ b/src/test/compile-fail/lint-unused-mut-self.rs
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(dead_assignment)];
-#[allow(unused_variable)];
-#[allow(dead_code)];
-#[deny(unused_mut)];
+#![allow(dead_assignment)]
+#![allow(unused_variable)]
+#![allow(dead_code)]
+#![deny(unused_mut)]
 
 struct Foo;
 impl Foo {
diff --git a/src/test/compile-fail/lint-unused-mut-variables.rs b/src/test/compile-fail/lint-unused-mut-variables.rs
index ad3ac4eba11..b372720467e 100644
--- a/src/test/compile-fail/lint-unused-mut-variables.rs
+++ b/src/test/compile-fail/lint-unused-mut-variables.rs
@@ -10,11 +10,11 @@
 
 // Exercise the unused_mut attribute in some positive and negative cases
 
-#[allow(dead_assignment)];
-#[allow(unused_variable)];
-#[allow(dead_code)];
-#[allow(deprecated_owned_vector)];
-#[deny(unused_mut)];
+#![allow(dead_assignment)]
+#![allow(unused_variable)]
+#![allow(dead_code)]
+#![allow(deprecated_owned_vector)]
+#![deny(unused_mut)]
 
 
 fn main() {
diff --git a/src/test/compile-fail/lint-unused-unsafe.rs b/src/test/compile-fail/lint-unused-unsafe.rs
index 87448f68d02..ecea33cbe8e 100644
--- a/src/test/compile-fail/lint-unused-unsafe.rs
+++ b/src/test/compile-fail/lint-unused-unsafe.rs
@@ -10,9 +10,9 @@
 
 // Exercise the unused_unsafe attribute in some positive and negative cases
 
-#[allow(dead_code)];
-#[deny(unused_unsafe)];
-#[allow(deprecated_owned_vector)];
+#![allow(dead_code)]
+#![deny(unused_unsafe)]
+#![allow(deprecated_owned_vector)]
 
 
 mod foo {
diff --git a/src/test/compile-fail/lint-uppercase-variables.rs b/src/test/compile-fail/lint-uppercase-variables.rs
index 114d5d4fdf0..386b4019485 100644
--- a/src/test/compile-fail/lint-uppercase-variables.rs
+++ b/src/test/compile-fail/lint-uppercase-variables.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(uppercase_variables)];
+#![deny(uppercase_variables)]
 
 use std::io::File;
 use std::io::IoError;
diff --git a/src/test/compile-fail/lint-visible-private-types.rs b/src/test/compile-fail/lint-visible-private-types.rs
index 6d77f8b324c..7c387d0cf56 100644
--- a/src/test/compile-fail/lint-visible-private-types.rs
+++ b/src/test/compile-fail/lint-visible-private-types.rs
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(struct_variant)];
-#[deny(visible_private_types)];
-#[allow(dead_code)];
-#[crate_type="lib"];
+#![feature(struct_variant)]
+#![deny(visible_private_types)]
+#![allow(dead_code)]
+#![crate_type="lib"]
 
 struct Private<T>;
 pub struct Public<T>;
@@ -46,8 +46,8 @@ fn y(_: Private<int>) {}
 
 
 pub struct Foo {
-    x: Private<int>, //~ ERROR private type in exported type signature
-    priv y: Private<int>
+    pub x: Private<int>, //~ ERROR private type in exported type signature
+    y: Private<int>
 }
 
 struct Bar {
@@ -57,8 +57,8 @@ struct Bar {
 pub enum Baz {
     Baz1(Private<int>), //~ ERROR private type in exported type signature
     Baz2 {
-        x: Private<int>, //~ ERROR private type in exported type signature
-        priv y: Private<int>
+        pub x: Private<int>, //~ ERROR private type in exported type signature
+        y: Private<int>
     },
 
     priv Baz3(Private<int>),
diff --git a/src/test/compile-fail/liveness-dead.rs b/src/test/compile-fail/liveness-dead.rs
index a3d388d7c34..cba0a1da7e6 100644
--- a/src/test/compile-fail/liveness-dead.rs
+++ b/src/test/compile-fail/liveness-dead.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(dead_code)];
-#[deny(dead_assignment)];
+#![allow(dead_code)]
+#![deny(dead_assignment)]
 
 fn f1(x: &mut int) {
     *x = 1; // no error
diff --git a/src/test/compile-fail/liveness-return-last-stmt-semi.rs b/src/test/compile-fail/liveness-return-last-stmt-semi.rs
index 1b32c008af1..8a6585f8bbc 100644
--- a/src/test/compile-fail/liveness-return-last-stmt-semi.rs
+++ b/src/test/compile-fail/liveness-return-last-stmt-semi.rs
@@ -10,7 +10,7 @@
 //
 // regression test for #8005
 
-#[feature(macro_rules)];
+#![feature(macro_rules)]
 
 macro_rules! test ( () => { fn foo() -> int { 1i; } } )
                                              //~^ ERROR not all control paths return a value
diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs
index 33fc094abbe..ee44872d122 100644
--- a/src/test/compile-fail/liveness-unused.rs
+++ b/src/test/compile-fail/liveness-unused.rs
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(unused_variable)];
-#[deny(dead_assignment)];
-#[allow(dead_code, non_camel_case_types)];
+#![deny(unused_variable)]
+#![deny(dead_assignment)]
+#![allow(dead_code, non_camel_case_types)]
 
 fn f1(x: int) {
     //~^ ERROR unused variable: `x`
diff --git a/src/test/compile-fail/macro-crate-unexported-macro.rs b/src/test/compile-fail/macro-crate-unexported-macro.rs
index 3ff19923df6..6f4c450940e 100644
--- a/src/test/compile-fail/macro-crate-unexported-macro.rs
+++ b/src/test/compile-fail/macro-crate-unexported-macro.rs
@@ -13,7 +13,7 @@
 // ignore-android
 // ignore-cross-compile #12102
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate macro_crate_test;
diff --git a/src/test/compile-fail/macro-crate-unknown-crate.rs b/src/test/compile-fail/macro-crate-unknown-crate.rs
index 3301eb145ce..84c915f267e 100644
--- a/src/test/compile-fail/macro-crate-unknown-crate.rs
+++ b/src/test/compile-fail/macro-crate-unknown-crate.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate doesnt_exist; //~ ERROR can't find crate
diff --git a/src/test/compile-fail/macro-incomplete-parse.rs b/src/test/compile-fail/macro-incomplete-parse.rs
index 98e0ecfad86..43ba2c8a8a5 100644
--- a/src/test/compile-fail/macro-incomplete-parse.rs
+++ b/src/test/compile-fail/macro-incomplete-parse.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(macro_rules)];
+#![feature(macro_rules)]
 
 macro_rules! ignored_item {
     () => {
diff --git a/src/test/compile-fail/macro-inner-attributes.rs b/src/test/compile-fail/macro-inner-attributes.rs
index 104438848c4..ae804ea7ece 100644
--- a/src/test/compile-fail/macro-inner-attributes.rs
+++ b/src/test/compile-fail/macro-inner-attributes.rs
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(macro_rules)];
+#![feature(macro_rules)]
 
 macro_rules! test ( ($nm:ident,
-                     $a:attr,
-                     $i:item) => (mod $nm { $a; $i }); )
+                     #[$a:meta],
+                     $i:item) => (mod $nm { #![$a] $i }); )
 
 test!(a,
       #[cfg(qux)],
diff --git a/src/test/compile-fail/macro-outer-attributes.rs b/src/test/compile-fail/macro-outer-attributes.rs
index 6bd184ce6a6..e41f1bd369a 100644
--- a/src/test/compile-fail/macro-outer-attributes.rs
+++ b/src/test/compile-fail/macro-outer-attributes.rs
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(macro_rules)];
+#![feature(macro_rules)]
 
 macro_rules! test ( ($nm:ident,
-                     $a:attr,
-                     $i:item) => (mod $nm { $a $i }); )
+                     #[$a:meta],
+                     $i:item) => (mod $nm { #[$a] $i }); )
 
 test!(a,
       #[cfg(qux)],
diff --git a/src/test/compile-fail/macros-nonfatal-errors.rs b/src/test/compile-fail/macros-nonfatal-errors.rs
index effab305c1a..df2c40657c8 100644
--- a/src/test/compile-fail/macros-nonfatal-errors.rs
+++ b/src/test/compile-fail/macros-nonfatal-errors.rs
@@ -11,8 +11,8 @@
 // test that errors in a (selection) of macros don't kill compilation
 // immediately, so that we get more errors listed at a time.
 
-#[feature(asm)];
-#[feature(trace_macros)];
+#![feature(asm)]
+#![feature(trace_macros, concat_idents)]
 
 #[deriving(Default, //~ ERROR
            Rand, //~ ERROR
diff --git a/src/test/compile-fail/marker-no-pod.rs b/src/test/compile-fail/marker-no-copy.rs
index 90b277a7432..5a7cddc250a 100644
--- a/src/test/compile-fail/marker-no-pod.rs
+++ b/src/test/compile-fail/marker-no-copy.rs
@@ -10,9 +10,9 @@
 
 use std::kinds::marker;
 
-fn foo<P:Pod>(p: P) { }
+fn foo<P:Copy>(p: P) { }
 
 fn main()
 {
-    foo(marker::NoPod); //~ ERROR does not fulfill `Pod`
+    foo(marker::NoCopy); //~ ERROR does not fulfill
 }
diff --git a/src/test/compile-fail/match-static-const-lc.rs b/src/test/compile-fail/match-static-const-lc.rs
index fd605b79dbe..f77ea2db8c0 100644
--- a/src/test/compile-fail/match-static-const-lc.rs
+++ b/src/test/compile-fail/match-static-const-lc.rs
@@ -10,8 +10,8 @@
 
 // Issue #7526: lowercase static constants in patterns look like bindings
 
-#[allow(dead_code)];
-#[deny(non_uppercase_pattern_statics)];
+#![allow(dead_code)]
+#![deny(non_uppercase_pattern_statics)]
 
 pub static a : int = 97;
 
diff --git a/src/test/compile-fail/moves-based-on-type-exprs.rs b/src/test/compile-fail/moves-based-on-type-exprs.rs
index ed0138e05be..710d9d1ca20 100644
--- a/src/test/compile-fail/moves-based-on-type-exprs.rs
+++ b/src/test/compile-fail/moves-based-on-type-exprs.rs
@@ -11,7 +11,7 @@
 // Tests that references to move-by-default values trigger moves when
 // they occur as part of various kinds of expressions.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 struct Foo<A> { f: A }
 fn guard(_s: ~str) -> bool {fail!()}
diff --git a/src/test/compile-fail/name-clash-nullary.rs b/src/test/compile-fail/name-clash-nullary.rs
index 246f0cb9e66..b5c0157cb5e 100644
--- a/src/test/compile-fail/name-clash-nullary.rs
+++ b/src/test/compile-fail/name-clash-nullary.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
+#![feature(globs)]
 
 // error-pattern:declaration of `None` shadows
 use std::option::*;
diff --git a/src/test/compile-fail/no-implicit-prelude.rs b/src/test/compile-fail/no-implicit-prelude.rs
index 7f88af36e8a..fecc597b8fd 100644
--- a/src/test/compile-fail/no-implicit-prelude.rs
+++ b/src/test/compile-fail/no-implicit-prelude.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[no_implicit_prelude];
+#![no_implicit_prelude]
 
 // Test that things from the prelude aren't in scope. Use many of them
 // so that renaming some things won't magically make this test fail
diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs
index 68077d61c9f..825a8fc604c 100644
--- a/src/test/compile-fail/no-send-res-ports.rs
+++ b/src/test/compile-fail/no-send-res-ports.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 use std::task;
 
diff --git a/src/test/compile-fail/no_crate_type.rs b/src/test/compile-fail/no_crate_type.rs
index 51ca71ae2cc..bef909917d2 100644
--- a/src/test/compile-fail/no_crate_type.rs
+++ b/src/test/compile-fail/no_crate_type.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // regresion test for issue 11256
-#[crate_type];  //~ ERROR `crate_type` requires a value
+#![crate_type]  //~ ERROR `crate_type` requires a value
 
 fn main() {
     return
diff --git a/src/test/compile-fail/occurs-check.rs b/src/test/compile-fail/occurs-check.rs
index f08272f58ac..fd0da8ba9cf 100644
--- a/src/test/compile-fail/occurs-check.rs
+++ b/src/test/compile-fail/occurs-check.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 fn main() {
     let f; //~ ERROR cyclic type of infinite size
diff --git a/src/test/compile-fail/once-cant-call-twice-on-heap.rs b/src/test/compile-fail/once-cant-call-twice-on-heap.rs
index c9ee105fe7b..9d0de6b3753 100644
--- a/src/test/compile-fail/once-cant-call-twice-on-heap.rs
+++ b/src/test/compile-fail/once-cant-call-twice-on-heap.rs
@@ -11,7 +11,7 @@
 // Testing guarantees provided by once functions.
 // This program would segfault if it were legal.
 
-#[feature(once_fns)];
+#![feature(once_fns)]
 extern crate sync;
 use sync::Arc;
 
diff --git a/src/test/compile-fail/once-cant-call-twice-on-stack.rs b/src/test/compile-fail/once-cant-call-twice-on-stack.rs
index a81ddf06ac8..45cfa883696 100644
--- a/src/test/compile-fail/once-cant-call-twice-on-stack.rs
+++ b/src/test/compile-fail/once-cant-call-twice-on-stack.rs
@@ -11,7 +11,7 @@
 // Testing guarantees provided by once functions.
 // This program would segfault if it were legal.
 
-#[feature(once_fns)];
+#![feature(once_fns)]
 extern crate sync;
 use sync::Arc;
 
diff --git a/src/test/compile-fail/once-fn-subtyping.rs b/src/test/compile-fail/once-fn-subtyping.rs
index 3a0afd70e3e..7594deda3b2 100644
--- a/src/test/compile-fail/once-fn-subtyping.rs
+++ b/src/test/compile-fail/once-fn-subtyping.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(once_fns)];
+#![feature(once_fns)]
 fn main() {
     let f: once || = ||();
     let g: || = f;  //~ ERROR mismatched types
diff --git a/src/test/compile-fail/phase-syntax-doesnt-resolve.rs b/src/test/compile-fail/phase-syntax-doesnt-resolve.rs
index 98ca0697db9..9bfc7fc34bb 100644
--- a/src/test/compile-fail/phase-syntax-doesnt-resolve.rs
+++ b/src/test/compile-fail/phase-syntax-doesnt-resolve.rs
@@ -13,7 +13,7 @@
 // ignore-android
 // ignore-cross-compile #12102
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate macro_crate_test;
diff --git a/src/test/compile-fail/pinned-deep-copy.rs b/src/test/compile-fail/pinned-deep-copy.rs
index 6479a9404e2..0589d58a4c2 100644
--- a/src/test/compile-fail/pinned-deep-copy.rs
+++ b/src/test/compile-fail/pinned-deep-copy.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 use std::cell::Cell;
 
diff --git a/src/test/compile-fail/privacy-ns1.rs b/src/test/compile-fail/privacy-ns1.rs
index 541356f6599..cb11a50055f 100644
--- a/src/test/compile-fail/privacy-ns1.rs
+++ b/src/test/compile-fail/privacy-ns1.rs
@@ -11,9 +11,9 @@
 // Check we do the correct privacy checks when we import a name and there is an
 // item with that name in both the value and type namespaces.
 
-#[feature(globs)];
-#[allow(dead_code)];
-#[allow(unused_imports)];
+#![feature(globs)]
+#![allow(dead_code)]
+#![allow(unused_imports)]
 
 // public type, private value
 pub mod foo1 {
diff --git a/src/test/compile-fail/privacy-ns2.rs b/src/test/compile-fail/privacy-ns2.rs
index e293153e9da..c75b12165c0 100644
--- a/src/test/compile-fail/privacy-ns2.rs
+++ b/src/test/compile-fail/privacy-ns2.rs
@@ -11,9 +11,9 @@
 // Check we do the correct privacy checks when we import a name and there is an
 // item with that name in both the value and type namespaces.
 
-#[feature(globs)];
-#[allow(dead_code)];
-#[allow(unused_imports)];
+#![feature(globs)]
+#![allow(dead_code)]
+#![allow(unused_imports)]
 
 // public type, private value
 pub mod foo1 {
diff --git a/src/test/compile-fail/privacy1.rs b/src/test/compile-fail/privacy1.rs
index fdc681e1da0..0aba36eebee 100644
--- a/src/test/compile-fail/privacy1.rs
+++ b/src/test/compile-fail/privacy1.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
-#[no_std]; // makes debugging this test *a lot* easier (during resolve)
+#![feature(globs)]
+#![no_std] // makes debugging this test *a lot* easier (during resolve)
 
 mod bar {
     // shouln't bring in too much
diff --git a/src/test/compile-fail/privacy2.rs b/src/test/compile-fail/privacy2.rs
index 98772b0c67b..df4e401dfa5 100644
--- a/src/test/compile-fail/privacy2.rs
+++ b/src/test/compile-fail/privacy2.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
-#[no_std]; // makes debugging this test *a lot* easier (during resolve)
+#![feature(globs)]
+#![no_std] // makes debugging this test *a lot* easier (during resolve)
 
 // Test to make sure that globs don't leak in regular `use` statements.
 
diff --git a/src/test/compile-fail/privacy3.rs b/src/test/compile-fail/privacy3.rs
index 3308be4a12e..f8d8ba2ab1a 100644
--- a/src/test/compile-fail/privacy3.rs
+++ b/src/test/compile-fail/privacy3.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
-#[no_std]; // makes debugging this test *a lot* easier (during resolve)
+#![feature(globs)]
+#![no_std] // makes debugging this test *a lot* easier (during resolve)
 
 // Test to make sure that private items imported through globs remain private
 // when  they're used.
diff --git a/src/test/compile-fail/privacy4.rs b/src/test/compile-fail/privacy4.rs
index 4e33536b2b0..18a94cb86c8 100644
--- a/src/test/compile-fail/privacy4.rs
+++ b/src/test/compile-fail/privacy4.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
-#[no_std]; // makes debugging this test *a lot* easier (during resolve)
+#![feature(globs)]
+#![no_std] // makes debugging this test *a lot* easier (during resolve)
 
 // Test to make sure that private items imported through globs remain private
 // when  they're used.
diff --git a/src/test/compile-fail/privacy5.rs b/src/test/compile-fail/privacy5.rs
new file mode 100644
index 00000000000..c057236265e
--- /dev/null
+++ b/src/test/compile-fail/privacy5.rs
@@ -0,0 +1,137 @@
+// 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.
+
+// aux-build:privacy-tuple-struct.rs
+// ignore-fast
+
+extern crate other = "privacy-tuple-struct";
+
+mod a {
+    pub struct A(());
+    pub struct B(int);
+    pub struct C(pub int, int);
+    pub struct D(pub int);
+
+    fn test() {
+        let a = A(());
+        let b = B(2);
+        let c = C(2, 3);
+        let d = D(4);
+
+        let A(()) = a;
+        let A(_) = a;
+        match a { A(()) => {} }
+        match a { A(_) => {} }
+
+        let B(_) = b;
+        let B(_b) = b;
+        match b { B(_) => {} }
+        match b { B(_b) => {} }
+        match b { B(1) => {} B(_) => {} }
+
+        let C(_, _) = c;
+        let C(_a, _) = c;
+        let C(_, _b) = c;
+        let C(_a, _b) = c;
+        match c { C(_, _) => {} }
+        match c { C(_a, _) => {} }
+        match c { C(_, _b) => {} }
+        match c { C(_a, _b) => {} }
+
+        let D(_) = d;
+        let D(_d) = d;
+        match d { D(_) => {} }
+        match d { D(_d) => {} }
+        match d { D(1) => {} D(_) => {} }
+
+        let a2 = A;
+        let b2 = B;
+        let c2 = C;
+        let d2 = D;
+    }
+}
+
+fn this_crate() {
+    let a = a::A(()); //~ ERROR: cannot invoke tuple struct constructor
+    let b = a::B(2); //~ ERROR: cannot invoke tuple struct constructor
+    let c = a::C(2, 3); //~ ERROR: cannot invoke tuple struct constructor
+    let d = a::D(4);
+
+    let a::A(()) = a; //~ ERROR: field #1 is private
+    let a::A(_) = a;
+    match a { a::A(()) => {} } //~ ERROR: field #1 is private
+    match a { a::A(_) => {} }
+
+    let a::B(_) = b;
+    let a::B(_b) = b; //~ ERROR: field #1 is private
+    match b { a::B(_) => {} }
+    match b { a::B(_b) => {} } //~ ERROR: field #1 is private
+    match b { a::B(1) => {} a::B(_) => {} } //~ ERROR: field #1 is private
+
+    let a::C(_, _) = c;
+    let a::C(_a, _) = c;
+    let a::C(_, _b) = c; //~ ERROR: field #2 is private
+    let a::C(_a, _b) = c; //~ ERROR: field #2 is private
+    match c { a::C(_, _) => {} }
+    match c { a::C(_a, _) => {} }
+    match c { a::C(_, _b) => {} } //~ ERROR: field #2 is private
+    match c { a::C(_a, _b) => {} } //~ ERROR: field #2 is private
+
+    let a::D(_) = d;
+    let a::D(_d) = d;
+    match d { a::D(_) => {} }
+    match d { a::D(_d) => {} }
+    match d { a::D(1) => {} a::D(_) => {} }
+
+    let a2 = a::A; //~ ERROR: cannot invoke tuple struct constructor
+    let b2 = a::B; //~ ERROR: cannot invoke tuple struct constructor
+    let c2 = a::C; //~ ERROR: cannot invoke tuple struct constructor
+    let d2 = a::D;
+}
+
+fn xcrate() {
+    let a = other::A(()); //~ ERROR: cannot invoke tuple struct constructor
+    let b = other::B(2); //~ ERROR: cannot invoke tuple struct constructor
+    let c = other::C(2, 3); //~ ERROR: cannot invoke tuple struct constructor
+    let d = other::D(4);
+
+    let other::A(()) = a; //~ ERROR: field #1 is private
+    let other::A(_) = a;
+    match a { other::A(()) => {} } //~ ERROR: field #1 is private
+    match a { other::A(_) => {} }
+
+    let other::B(_) = b;
+    let other::B(_b) = b; //~ ERROR: field #1 is private
+    match b { other::B(_) => {} }
+    match b { other::B(_b) => {} } //~ ERROR: field #1 is private
+    match b { other::B(1) => {} other::B(_) => {} } //~ ERROR: field #1 is private
+
+    let other::C(_, _) = c;
+    let other::C(_a, _) = c;
+    let other::C(_, _b) = c; //~ ERROR: field #2 is private
+    let other::C(_a, _b) = c; //~ ERROR: field #2 is private
+    match c { other::C(_, _) => {} }
+    match c { other::C(_a, _) => {} }
+    match c { other::C(_, _b) => {} } //~ ERROR: field #2 is private
+    match c { other::C(_a, _b) => {} } //~ ERROR: field #2 is private
+
+    let other::D(_) = d;
+    let other::D(_d) = d;
+    match d { other::D(_) => {} }
+    match d { other::D(_d) => {} }
+    match d { other::D(1) => {} other::D(_) => {} }
+
+    let a2 = other::A; //~ ERROR: cannot invoke tuple struct constructor
+    let b2 = other::B; //~ ERROR: cannot invoke tuple struct constructor
+    let c2 = other::C; //~ ERROR: cannot invoke tuple struct constructor
+    let d2 = other::D;
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/private-impl-method.rs b/src/test/compile-fail/private-impl-method.rs
index 42da53e9890..fe5908b40ab 100644
--- a/src/test/compile-fail/private-impl-method.rs
+++ b/src/test/compile-fail/private-impl-method.rs
@@ -10,7 +10,7 @@
 
 mod a {
     pub struct Foo {
-        x: int
+        pub x: int
     }
 
     impl Foo {
diff --git a/src/test/compile-fail/private-struct-field-ctor.rs b/src/test/compile-fail/private-struct-field-ctor.rs
index 7ab28d72965..a5cee47d4e3 100644
--- a/src/test/compile-fail/private-struct-field-ctor.rs
+++ b/src/test/compile-fail/private-struct-field-ctor.rs
@@ -10,7 +10,7 @@
 
 mod a {
     pub struct Foo {
-        priv x: int
+        x: int
     }
 }
 
diff --git a/src/test/compile-fail/private-struct-field-pattern.rs b/src/test/compile-fail/private-struct-field-pattern.rs
index 6f524a8eaa4..ee1303b99dd 100644
--- a/src/test/compile-fail/private-struct-field-pattern.rs
+++ b/src/test/compile-fail/private-struct-field-pattern.rs
@@ -12,7 +12,7 @@ use a::Foo;
 
 mod a {
     pub struct Foo {
-        priv x: int
+        x: int
     }
 
     pub fn make() -> Foo {
diff --git a/src/test/compile-fail/private-struct-field.rs b/src/test/compile-fail/private-struct-field.rs
index 2f6a51e1637..52e979342f5 100644
--- a/src/test/compile-fail/private-struct-field.rs
+++ b/src/test/compile-fail/private-struct-field.rs
@@ -10,7 +10,7 @@
 
 mod cat {
     pub struct Cat {
-        priv meows: uint
+        meows: uint
     }
 
     pub fn new_cat() -> Cat {
diff --git a/src/test/compile-fail/qquote-1.rs b/src/test/compile-fail/qquote-1.rs
index 27201b76813..365a2fbe287 100644
--- a/src/test/compile-fail/qquote-1.rs
+++ b/src/test/compile-fail/qquote-1.rs
@@ -10,7 +10,7 @@
 
 // ignore-test Can't use syntax crate here
 
-#[feature(quote)];
+#![feature(quote)]
 
 extern crate syntax;
 
diff --git a/src/test/compile-fail/qquote-2.rs b/src/test/compile-fail/qquote-2.rs
index 97225c863e5..f202f1bb73c 100644
--- a/src/test/compile-fail/qquote-2.rs
+++ b/src/test/compile-fail/qquote-2.rs
@@ -10,7 +10,7 @@
 
 // ignore-test Can't use syntax crate here
 
-#[feature(quote)];
+#![feature(quote)]
 
 extern crate syntax;
 
diff --git a/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs b/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs
index b17ec8782f1..b069a35ad7a 100644
--- a/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs
+++ b/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 struct point {
     x: int,
diff --git a/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs b/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
index 3719be3612b..9be8a5fef4d 100644
--- a/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
+++ b/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 fn borrow<'r, T>(x: &'r T) -> &'r T {x}
 
diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
index b36933c4957..ae1cbcf3e68 100644
--- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
+++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 struct invariant<'a> {
     f: 'static |x: &mut &'a int|
diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
index 449cbc6970f..096d8912f8b 100644
--- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
+++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 struct invariant<'a> {
     f: 'static || -> &mut &'a int
diff --git a/src/test/compile-fail/regions-infer-paramd-indirect.rs b/src/test/compile-fail/regions-infer-paramd-indirect.rs
index e2f4f791652..6e8013529a9 100644
--- a/src/test/compile-fail/regions-infer-paramd-indirect.rs
+++ b/src/test/compile-fail/regions-infer-paramd-indirect.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 // Check that we correctly infer that b and c must be region
 // parameterized because they reference a which requires a region.
diff --git a/src/test/compile-fail/simd-experimental.rs b/src/test/compile-fail/simd-experimental.rs
index 64c045366e1..f9cc4d0d8c3 100644
--- a/src/test/compile-fail/simd-experimental.rs
+++ b/src/test/compile-fail/simd-experimental.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(experimental)];
+#![deny(experimental)]
 
 use std::unstable::simd;
 
diff --git a/src/test/compile-fail/simd-type.rs b/src/test/compile-fail/simd-type.rs
index 6a57ee76cdf..16be3941298 100644
--- a/src/test/compile-fail/simd-type.rs
+++ b/src/test/compile-fail/simd-type.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(simd)];
+#![feature(simd)]
 
 #[simd]
 struct vec4<T>(T, T, T, T); //~ ERROR SIMD vector cannot be generic
diff --git a/src/test/compile-fail/static-assert.rs b/src/test/compile-fail/static-assert.rs
index d9e3846c506..349e5f4cb51 100644
--- a/src/test/compile-fail/static-assert.rs
+++ b/src/test/compile-fail/static-assert.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(dead_code)];
+#![allow(dead_code)]
 
 #[static_assert]
 static A: bool = false; //~ ERROR static assertion failed
diff --git a/src/test/compile-fail/static-assert2.rs b/src/test/compile-fail/static-assert2.rs
index 30c6f05bd60..d5e70205e95 100644
--- a/src/test/compile-fail/static-assert2.rs
+++ b/src/test/compile-fail/static-assert2.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(dead_code)];
+#![allow(dead_code)]
 
 #[static_assert]
 static E: bool = 1 == 2; //~ ERROR static assertion failed
diff --git a/src/test/compile-fail/static-items-cant-move.rs b/src/test/compile-fail/static-items-cant-move.rs
index f089904dd91..28e73f74ff3 100644
--- a/src/test/compile-fail/static-items-cant-move.rs
+++ b/src/test/compile-fail/static-items-cant-move.rs
@@ -14,10 +14,10 @@ use std::kinds::marker;
 
 struct Foo {
     foo: int,
-    nopod: marker::NoPod
+    nocopy: marker::NoCopy
 }
 
-static BAR: Foo = Foo{foo: 5, nopod: marker::NoPod};
+static BAR: Foo = Foo{foo: 5, nocopy: marker::NoCopy};
 
 
 fn test(f: Foo) {
diff --git a/src/test/compile-fail/static-region-bound.rs b/src/test/compile-fail/static-region-bound.rs
index ed9d3cd74d0..4911ceb3ef4 100644
--- a/src/test/compile-fail/static-region-bound.rs
+++ b/src/test/compile-fail/static-region-bound.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 fn f<T:'static>(_: T) {}
 
diff --git a/src/test/compile-fail/std-uncopyable-atomics.rs b/src/test/compile-fail/std-uncopyable-atomics.rs
index 1b2f1fc3207..cd853a2cf4d 100644
--- a/src/test/compile-fail/std-uncopyable-atomics.rs
+++ b/src/test/compile-fail/std-uncopyable-atomics.rs
@@ -10,7 +10,7 @@
 
 // Issue #8380
 
-#[feature(globs)];
+#![feature(globs)]
 
 use std::sync::atomics::*;
 use std::ptr;
diff --git a/src/test/compile-fail/struct-field-privacy.rs b/src/test/compile-fail/struct-field-privacy.rs
index d298d331a3f..b6ae7235bb3 100644
--- a/src/test/compile-fail/struct-field-privacy.rs
+++ b/src/test/compile-fail/struct-field-privacy.rs
@@ -20,12 +20,10 @@ mod inner {
     struct A {
         a: int,
         pub b: int,
-        priv c: int, //~ ERROR: unnecessary `priv` visibility
     }
     pub struct B {
-        a: int,
-        priv b: int,
-        pub c: int, //~ ERROR: unnecessary `pub` visibility
+        pub a: int,
+        b: int,
     }
 }
 
@@ -36,10 +34,8 @@ fn test(a: A, b: inner::A, c: inner::B, d: xc::A, e: xc::B) {
     a.a;
     b.a; //~ ERROR: field `a` is private
     b.b;
-    b.c; //~ ERROR: field `c` is private
     c.a;
     c.b; //~ ERROR: field `b` is private
-    c.c;
 
     d.a; //~ ERROR: field `a` is private
     d.b;
diff --git a/src/test/compile-fail/struct-like-enum-nonexhaustive.rs b/src/test/compile-fail/struct-like-enum-nonexhaustive.rs
index 06fd4e6d8c9..8d1e5b46279 100644
--- a/src/test/compile-fail/struct-like-enum-nonexhaustive.rs
+++ b/src/test/compile-fail/struct-like-enum-nonexhaustive.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(struct_variant)];
+#![feature(struct_variant)]
 
 enum A {
     B { x: Option<int> },
diff --git a/src/test/compile-fail/syntax-extension-fourcc-bad-len.rs b/src/test/compile-fail/syntax-extension-fourcc-bad-len.rs
index 920726a4870..865ab7e6e84 100644
--- a/src/test/compile-fail/syntax-extension-fourcc-bad-len.rs
+++ b/src/test/compile-fail/syntax-extension-fourcc-bad-len.rs
@@ -12,7 +12,7 @@
 // ignore-pretty
 // ignore-cross-compile #12102
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate fourcc;
diff --git a/src/test/compile-fail/syntax-extension-fourcc-invalid-endian.rs b/src/test/compile-fail/syntax-extension-fourcc-invalid-endian.rs
index 08ee57a2d94..c127035bf1e 100644
--- a/src/test/compile-fail/syntax-extension-fourcc-invalid-endian.rs
+++ b/src/test/compile-fail/syntax-extension-fourcc-invalid-endian.rs
@@ -12,7 +12,7 @@
 // ignore-pretty
 // ignore-cross-compile #12102
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate fourcc;
diff --git a/src/test/compile-fail/syntax-extension-fourcc-non-ascii-str.rs b/src/test/compile-fail/syntax-extension-fourcc-non-ascii-str.rs
index af49d9988d8..28b146635f1 100644
--- a/src/test/compile-fail/syntax-extension-fourcc-non-ascii-str.rs
+++ b/src/test/compile-fail/syntax-extension-fourcc-non-ascii-str.rs
@@ -12,7 +12,7 @@
 // ignore-pretty
 // ignore-cross-compile #12102
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate fourcc;
diff --git a/src/test/compile-fail/syntax-extension-fourcc-non-literal.rs b/src/test/compile-fail/syntax-extension-fourcc-non-literal.rs
index b4195ed9bc8..1f1a7ab80f9 100644
--- a/src/test/compile-fail/syntax-extension-fourcc-non-literal.rs
+++ b/src/test/compile-fail/syntax-extension-fourcc-non-literal.rs
@@ -12,7 +12,7 @@
 // ignore-pretty
 // ignore-cross-compile #12102
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate fourcc;
diff --git a/src/test/compile-fail/syntax-extension-fourcc-unsupported-literal.rs b/src/test/compile-fail/syntax-extension-fourcc-unsupported-literal.rs
index 1997b7ad8e7..a745c227fb1 100644
--- a/src/test/compile-fail/syntax-extension-fourcc-unsupported-literal.rs
+++ b/src/test/compile-fail/syntax-extension-fourcc-unsupported-literal.rs
@@ -12,7 +12,7 @@
 // ignore-pretty
 // ignore-cross-compile #12102
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate fourcc;
diff --git a/src/test/compile-fail/syntax-extension-hexfloat-bad-lits.rs b/src/test/compile-fail/syntax-extension-hexfloat-bad-lits.rs
index 9a7129dd2cf..04b34c85b78 100644
--- a/src/test/compile-fail/syntax-extension-hexfloat-bad-lits.rs
+++ b/src/test/compile-fail/syntax-extension-hexfloat-bad-lits.rs
@@ -12,7 +12,7 @@
 // ignore-pretty
 // ignore-cross-compile #12102
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate hexfloat;
diff --git a/src/test/compile-fail/syntax-extension-hexfloat-bad-types.rs b/src/test/compile-fail/syntax-extension-hexfloat-bad-types.rs
index cf7a2fb6acb..6b2f8067ccc 100644
--- a/src/test/compile-fail/syntax-extension-hexfloat-bad-types.rs
+++ b/src/test/compile-fail/syntax-extension-hexfloat-bad-types.rs
@@ -12,7 +12,7 @@
 // ignore-pretty
 // ignore-cross-compile #12102
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate hexfloat;
diff --git a/src/test/compile-fail/syntax-extension-minor.rs b/src/test/compile-fail/syntax-extension-minor.rs
index e65b1c0bf3a..2dc24753b0a 100644
--- a/src/test/compile-fail/syntax-extension-minor.rs
+++ b/src/test/compile-fail/syntax-extension-minor.rs
@@ -10,6 +10,7 @@
 
 // this now fails (correctly, I claim) because hygiene prevents
 // the assembled identifier from being a reference to the binding.
+#![feature(concat_idents)]
 
 pub fn main() {
     let asdf_fdsa = ~"<.<";
diff --git a/src/test/compile-fail/terr-sorts.rs b/src/test/compile-fail/terr-sorts.rs
index 6a2fd99f648..8f3cb5bc0a6 100644
--- a/src/test/compile-fail/terr-sorts.rs
+++ b/src/test/compile-fail/terr-sorts.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 struct foo {
     a: int,
diff --git a/src/test/compile-fail/trace_macros-format.rs b/src/test/compile-fail/trace_macros-format.rs
index 557dcdc73c8..d5955601f2d 100644
--- a/src/test/compile-fail/trace_macros-format.rs
+++ b/src/test/compile-fail/trace_macros-format.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // ignore-fast feature doesn't work
-#[feature(macro_rules, trace_macros)];
+#![feature(macro_rules, trace_macros)]
 
 fn main() {
     trace_macros!(); //~ ERROR trace_macros! accepts only `true` or `false`
diff --git a/src/test/compile-fail/trait-bounds-sugar.rs b/src/test/compile-fail/trait-bounds-sugar.rs
index 988057bc7b1..32c23a3efdd 100644
--- a/src/test/compile-fail/trait-bounds-sugar.rs
+++ b/src/test/compile-fail/trait-bounds-sugar.rs
@@ -12,7 +12,7 @@
 
 trait Foo {}
 
-fn a(_x: ~Foo) { // should be same as ~Foo:Send
+fn a(_x: ~Foo:Send) {
 }
 
 fn b(_x: &'static Foo) { // should be same as &'static Foo:'static
diff --git a/src/test/compile-fail/trait-impl-method-mismatch.rs b/src/test/compile-fail/trait-impl-method-mismatch.rs
index b5474210dc5..039f94ec2e7 100644
--- a/src/test/compile-fail/trait-impl-method-mismatch.rs
+++ b/src/test/compile-fail/trait-impl-method-mismatch.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 trait Mumbo {
     fn jumbo(&self, x: @uint) -> uint;
diff --git a/src/test/compile-fail/unique-unique-kind.rs b/src/test/compile-fail/unique-unique-kind.rs
index b9965b18229..8e951cc9b55 100644
--- a/src/test/compile-fail/unique-unique-kind.rs
+++ b/src/test/compile-fail/unique-unique-kind.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 fn f<T:Send>(_i: T) {
 }
diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs
index c76a6f2453e..b83277b38a6 100644
--- a/src/test/compile-fail/unique-vec-res.rs
+++ b/src/test/compile-fail/unique-vec-res.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 use std::cell::Cell;
 
diff --git a/src/test/compile-fail/unreachable-code.rs b/src/test/compile-fail/unreachable-code.rs
index a9365eeda1c..96adb29cbc8 100644
--- a/src/test/compile-fail/unreachable-code.rs
+++ b/src/test/compile-fail/unreachable-code.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(unreachable_code)];
-#[allow(unused_variable)];
+#![deny(unreachable_code)]
+#![allow(unused_variable)]
 
 fn main() {
   loop{}
diff --git a/src/test/compile-fail/unsafe-around-compiler-generated-unsafe.rs b/src/test/compile-fail/unsafe-around-compiler-generated-unsafe.rs
index 2aefdd213bb..484a8979d71 100644
--- a/src/test/compile-fail/unsafe-around-compiler-generated-unsafe.rs
+++ b/src/test/compile-fail/unsafe-around-compiler-generated-unsafe.rs
@@ -10,7 +10,7 @@
 
 // issue #12418
 
-#[deny(unused_unsafe)];
+#![deny(unused_unsafe)]
 
 fn main() {
     unsafe { println!("foo"); } //~ ERROR unnecessary `unsafe`
diff --git a/src/test/compile-fail/unsendable-class.rs b/src/test/compile-fail/unsendable-class.rs
index 4fbb4db4479..acfcccf3ace 100644
--- a/src/test/compile-fail/unsendable-class.rs
+++ b/src/test/compile-fail/unsendable-class.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+#![feature(managed_boxes)]
 
 // Test that a class with an unsendable field can't be
 // sent
diff --git a/src/test/compile-fail/unused-result.rs b/src/test/compile-fail/unused-result.rs
index eaf4d7d94c4..44058c1ddda 100644
--- a/src/test/compile-fail/unused-result.rs
+++ b/src/test/compile-fail/unused-result.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[deny(unused_result, unused_must_use)];
-#[allow(dead_code)];
+#![deny(unused_result, unused_must_use)]
+#![allow(dead_code)]
 
 #[must_use]
 enum MustUse { Test }
diff --git a/src/test/compile-fail/warn-foreign-int-types.rs b/src/test/compile-fail/warn-foreign-int-types.rs
index 726d778c3bb..8a5881d3797 100644
--- a/src/test/compile-fail/warn-foreign-int-types.rs
+++ b/src/test/compile-fail/warn-foreign-int-types.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(ctypes)];
-#[allow(dead_code)];
+#![forbid(ctypes)]
+#![allow(dead_code)]
 
 mod xx {
     extern {
diff --git a/src/test/compile-fail/wrong-mul-method-signature.rs b/src/test/compile-fail/wrong-mul-method-signature.rs
index a39226faee6..bb30715f75e 100644
--- a/src/test/compile-fail/wrong-mul-method-signature.rs
+++ b/src/test/compile-fail/wrong-mul-method-signature.rs
@@ -13,14 +13,29 @@
 // (In this case the mul method should take &f64 and not f64)
 // See: #11450
 
+struct Vec1 {
+    x: f64
+}
+
+// Expecting ref in input signature
+impl Mul<f64, Vec1> for Vec1 {
+    fn mul(&self, s: f64) -> Vec1 {
+    //~^ ERROR: method `mul` has an incompatible type for trait: expected &-ptr but found f64
+        Vec1 {
+            x: self.x * s
+        }
+    }
+}
+
 struct Vec2 {
     x: f64,
     y: f64
 }
 
+// Wrong type parameter ordering
 impl Mul<Vec2, f64> for Vec2 {
     fn mul(&self, s: f64) -> Vec2 {
-    //~^ ERROR: method `mul` has an incompatible type: expected &-ptr but found f64
+    //~^ ERROR: method `mul` has an incompatible type for trait: expected &-ptr but found f64
         Vec2 {
             x: self.x * s,
             y: self.y * s
@@ -28,6 +43,22 @@ impl Mul<Vec2, f64> for Vec2 {
     }
 }
 
+struct Vec3 {
+    x: f64,
+    y: f64,
+    z: f64
+}
+
+// Unexpected return type
+impl Mul<f64, i32> for Vec3 {
+    fn mul(&self, s: &f64) -> f64 {
+    //~^ ERROR: method `mul` has an incompatible type for trait: expected i32 but found f64
+        *s
+    }
+}
+
 pub fn main() {
+    Vec1 { x: 1.0 } * 2.0;
     Vec2 { x: 1.0, y: 2.0 } * 2.0;
+    Vec3 { x: 1.0, y: 2.0, z: 3.0 } * 2.0;
 }
diff --git a/src/test/debug-info/basic-types-globals-metadata.rs b/src/test/debug-info/basic-types-globals-metadata.rs
new file mode 100644
index 00000000000..efc6fda26e0
--- /dev/null
+++ b/src/test/debug-info/basic-types-globals-metadata.rs
@@ -0,0 +1,71 @@
+// 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.
+//
+// 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.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// debugger:rbreak zzz
+// debugger:run
+// debugger:finish
+// debugger:whatis 'basic-types-globals-metadata::B'
+// check:type = bool
+// debugger:whatis 'basic-types-globals-metadata::I'
+// check:type = int
+// debugger:whatis 'basic-types-globals-metadata::C'
+// check:type = char
+// debugger:whatis 'basic-types-globals-metadata::I8'
+// check:type = i8
+// debugger:whatis 'basic-types-globals-metadata::I16'
+// check:type = i16
+// debugger:whatis 'basic-types-globals-metadata::I32'
+// check:type = i32
+// debugger:whatis 'basic-types-globals-metadata::I64'
+// check:type = i64
+// debugger:whatis 'basic-types-globals-metadata::U'
+// check:type = uint
+// debugger:whatis 'basic-types-globals-metadata::U8'
+// check:type = u8
+// debugger:whatis 'basic-types-globals-metadata::U16'
+// check:type = u16
+// debugger:whatis 'basic-types-globals-metadata::U32'
+// check:type = u32
+// debugger:whatis 'basic-types-globals-metadata::U64'
+// check:type = u64
+// debugger:whatis 'basic-types-globals-metadata::F32'
+// check:type = f32
+// debugger:whatis 'basic-types-globals-metadata::F64'
+// check:type = f64
+// debugger:continue
+
+#![allow(unused_variable)]
+#![allow(dead_code)]
+
+
+static B: bool = false;
+static I: int = -1;
+static C: char = 'a';
+static I8: i8 = 68;
+static I16: i16 = -16;
+static I32: i32 = -32;
+static I64: i64 = -64;
+static U: uint = 1;
+static U8: u8 = 100;
+static U16: u16 = 16;
+static U32: u32 = 32;
+static U64: u64 = 64;
+static F32: f32 = 2.5;
+static F64: f64 = 3.5;
+
+fn main() {
+    _zzz();
+}
+
+fn _zzz() {()}
diff --git a/src/test/debug-info/basic-types-globals.rs b/src/test/debug-info/basic-types-globals.rs
new file mode 100644
index 00000000000..860a383468d
--- /dev/null
+++ b/src/test/debug-info/basic-types-globals.rs
@@ -0,0 +1,75 @@
+// 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.
+//
+// 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.
+
+// Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values)
+// as its numerical value along with its associated ASCII char, there
+// doesn't seem to be any way around this. Also, gdb doesn't know
+// about UTF-32 character encoding and will print a rust char as only
+// its numerical value.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// debugger:rbreak zzz
+// debugger:run
+// debugger:finish
+// debugger:print 'basic-types-globals::B'
+// check:$1 = false
+// debugger:print 'basic-types-globals::I'
+// check:$2 = -1
+// debugger:print 'basic-types-globals::C'
+// check:$3 = 97
+// debugger:print/d 'basic-types-globals::I8'
+// check:$4 = 68
+// debugger:print 'basic-types-globals::I16'
+// check:$5 = -16
+// debugger:print 'basic-types-globals::I32'
+// check:$6 = -32
+// debugger:print 'basic-types-globals::I64'
+// check:$7 = -64
+// debugger:print 'basic-types-globals::U'
+// check:$8 = 1
+// debugger:print/d 'basic-types-globals::U8'
+// check:$9 = 100
+// debugger:print 'basic-types-globals::U16'
+// check:$10 = 16
+// debugger:print 'basic-types-globals::U32'
+// check:$11 = 32
+// debugger:print 'basic-types-globals::U64'
+// check:$12 = 64
+// debugger:print 'basic-types-globals::F32'
+// check:$13 = 2.5
+// debugger:print 'basic-types-globals::F64'
+// check:$14 = 3.5
+// debugger:continue
+
+#[allow(unused_variable)];
+
+static B: bool = false;
+static I: int = -1;
+static C: char = 'a';
+static I8: i8 = 68;
+static I16: i16 = -16;
+static I32: i32 = -32;
+static I64: i64 = -64;
+static U: uint = 1;
+static U8: u8 = 100;
+static U16: u16 = 16;
+static U32: u32 = 32;
+static U64: u64 = 64;
+static F32: f32 = 2.5;
+static F64: f64 = 3.5;
+
+fn main() {
+    _zzz();
+}
+
+fn _zzz() {()}
diff --git a/src/test/debug-info/basic-types-metadata.rs b/src/test/debug-info/basic-types-metadata.rs
index 1c6d20783c5..95228343bda 100644
--- a/src/test/debug-info/basic-types-metadata.rs
+++ b/src/test/debug-info/basic-types-metadata.rs
@@ -46,8 +46,7 @@
 // check:type = f64
 // debugger:info functions _yyy
 // check:[...]![...]_yyy([...])([...]);
-// debugger:detach
-// debugger:quit
+// debugger:continue
 
 #[allow(unused_variable)];
 
diff --git a/src/test/debug-info/basic-types-mut-globals.rs b/src/test/debug-info/basic-types-mut-globals.rs
new file mode 100644
index 00000000000..54c2e786ac4
--- /dev/null
+++ b/src/test/debug-info/basic-types-mut-globals.rs
@@ -0,0 +1,129 @@
+// 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.
+//
+// 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.
+
+// Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values)
+// as its numerical value along with its associated ASCII char, there
+// doesn't seem to be any way around this. Also, gdb doesn't know
+// about UTF-32 character encoding and will print a rust char as only
+// its numerical value.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// debugger:rbreak zzz
+// debugger:run
+// debugger:finish
+
+// Check initializers
+// debugger:print 'basic-types-mut-globals::B'
+// check:$1 = false
+// debugger:print 'basic-types-mut-globals::I'
+// check:$2 = -1
+// debugger:print 'basic-types-mut-globals::C'
+// check:$3 = 97
+// debugger:print/d 'basic-types-mut-globals::I8'
+// check:$4 = 68
+// debugger:print 'basic-types-mut-globals::I16'
+// check:$5 = -16
+// debugger:print 'basic-types-mut-globals::I32'
+// check:$6 = -32
+// debugger:print 'basic-types-mut-globals::I64'
+// check:$7 = -64
+// debugger:print 'basic-types-mut-globals::U'
+// check:$8 = 1
+// debugger:print/d 'basic-types-mut-globals::U8'
+// check:$9 = 100
+// debugger:print 'basic-types-mut-globals::U16'
+// check:$10 = 16
+// debugger:print 'basic-types-mut-globals::U32'
+// check:$11 = 32
+// debugger:print 'basic-types-mut-globals::U64'
+// check:$12 = 64
+// debugger:print 'basic-types-mut-globals::F32'
+// check:$13 = 2.5
+// debugger:print 'basic-types-mut-globals::F64'
+// check:$14 = 3.5
+// debugger:continue
+
+// Check new values
+// debugger:print 'basic-types-mut-globals'::B
+// check:$15 = true
+// debugger:print 'basic-types-mut-globals'::I
+// check:$16 = 2
+// debugger:print 'basic-types-mut-globals'::C
+// check:$17 = 102
+// debugger:print/d 'basic-types-mut-globals'::I8
+// check:$18 = 78
+// debugger:print 'basic-types-mut-globals'::I16
+// check:$19 = -26
+// debugger:print 'basic-types-mut-globals'::I32
+// check:$20 = -12
+// debugger:print 'basic-types-mut-globals'::I64
+// check:$21 = -54
+// debugger:print 'basic-types-mut-globals'::U
+// check:$22 = 5
+// debugger:print/d 'basic-types-mut-globals'::U8
+// check:$23 = 20
+// debugger:print 'basic-types-mut-globals'::U16
+// check:$24 = 32
+// debugger:print 'basic-types-mut-globals'::U32
+// check:$25 = 16
+// debugger:print 'basic-types-mut-globals'::U64
+// check:$26 = 128
+// debugger:print 'basic-types-mut-globals'::F32
+// check:$27 = 5.75
+// debugger:print 'basic-types-mut-globals'::F64
+// check:$28 = 9.25
+
+// debugger:detach
+// debugger:quit
+
+#[allow(unused_variable)];
+
+static mut B: bool = false;
+static mut I: int = -1;
+static mut C: char = 'a';
+static mut I8: i8 = 68;
+static mut I16: i16 = -16;
+static mut I32: i32 = -32;
+static mut I64: i64 = -64;
+static mut U: uint = 1;
+static mut U8: u8 = 100;
+static mut U16: u16 = 16;
+static mut U32: u32 = 32;
+static mut U64: u64 = 64;
+static mut F32: f32 = 2.5;
+static mut F64: f64 = 3.5;
+
+fn main() {
+    _zzz();
+
+    unsafe {
+        B = true;
+        I = 2;
+        C = 'f';
+        I8 = 78;
+        I16 = -26;
+        I32 = -12;
+        I64 = -54;
+        U = 5;
+        U8 = 20;
+        U16 = 32;
+        U32 = 16;
+        U64 = 128;
+        F32 = 5.75;
+        F64 = 9.25;
+    }
+
+    _zzz();
+}
+
+fn _zzz() {()}
diff --git a/src/test/debug-info/c-style-enum.rs b/src/test/debug-info/c-style-enum.rs
index 65155417399..b570110d8d0 100644
--- a/src/test/debug-info/c-style-enum.rs
+++ b/src/test/debug-info/c-style-enum.rs
@@ -8,35 +8,71 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-win32: FIXME #13256
 // ignore-android: FIXME(#10381)
 
 // compile-flags:-g
 // debugger:rbreak zzz
+
+// debugger:print 'c-style-enum::SINGLE_VARIANT'
+// check:$1 = TheOnlyVariant
+
+// debugger:print 'c-style-enum::AUTO_ONE'
+// check:$2 = One
+
+// debugger:print 'c-style-enum::AUTO_TWO'
+// check:$3 = One
+
+// debugger:print 'c-style-enum::AUTO_THREE'
+// check:$4 = One
+
+// debugger:print 'c-style-enum::MANUAL_ONE'
+// check:$5 = OneHundred
+
+// debugger:print 'c-style-enum::MANUAL_TWO'
+// check:$6 = OneHundred
+
+// debugger:print 'c-style-enum::MANUAL_THREE'
+// check:$7 = OneHundred
+
 // debugger:run
 // debugger:finish
 
 // debugger:print auto_one
-// check:$1 = One
+// check:$8 = One
 
 // debugger:print auto_two
-// check:$2 = Two
+// check:$9 = Two
 
 // debugger:print auto_three
-// check:$3 = Three
+// check:$10 = Three
 
 // debugger:print manual_one_hundred
-// check:$4 = OneHundred
+// check:$11 = OneHundred
 
 // debugger:print manual_one_thousand
-// check:$5 = OneThousand
+// check:$12 = OneThousand
 
 // debugger:print manual_one_million
-// check:$6 = OneMillion
+// check:$13 = OneMillion
 
 // debugger:print single_variant
-// check:$7 = TheOnlyVariant
+// check:$14 = TheOnlyVariant
+
+// debugger:print 'c-style-enum::AUTO_TWO'
+// check:$15 = Two
 
-#[allow(unused_variable)];
+// debugger:print 'c-style-enum::AUTO_THREE'
+// check:$16 = Three
+
+// debugger:print 'c-style-enum::MANUAL_TWO'
+// check:$17 = OneThousand
+
+// debugger:print 'c-style-enum::MANUAL_THREE'
+// check:$18 = OneMillion
+
+#![allow(unused_variable)]
+#![allow(dead_code)]
 
 enum AutoDiscriminant {
     One,
@@ -54,6 +90,16 @@ enum SingleVariant {
     TheOnlyVariant
 }
 
+static SINGLE_VARIANT: SingleVariant = TheOnlyVariant;
+
+static mut AUTO_ONE: AutoDiscriminant = One;
+static mut AUTO_TWO: AutoDiscriminant = One;
+static mut AUTO_THREE: AutoDiscriminant = One;
+
+static mut MANUAL_ONE: ManualDiscriminant = OneHundred;
+static mut MANUAL_TWO: ManualDiscriminant = OneHundred;
+static mut MANUAL_THREE: ManualDiscriminant = OneHundred;
+
 fn main() {
 
     let auto_one = One;
@@ -66,6 +112,14 @@ fn main() {
 
     let single_variant = TheOnlyVariant;
 
+    unsafe {
+        AUTO_TWO = Two;
+        AUTO_THREE = Three;
+
+        MANUAL_TWO = OneThousand;
+        MANUAL_THREE = OneMillion;
+    };
+
     zzz();
 }
 
diff --git a/src/test/debug-info/include_string.rs b/src/test/debug-info/include_string.rs
index 39bc62e6d3b..fbfa77741a7 100644
--- a/src/test/debug-info/include_string.rs
+++ b/src/test/debug-info/include_string.rs
@@ -14,12 +14,12 @@
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
-// debugger:print string1
-// check:$1 = [...]"some text to include in another file as string 1", length = 48}
-// debugger:print string2
-// check:$2 = [...]"some text to include in another file as string 2", length = 48}
-// debugger:print string3
-// check:$3 = [...]"some text to include in another file as string 3", length = 48}
+// debugger:print string1.length
+// check:$1 = 48
+// debugger:print string2.length
+// check:$2 = 48
+// debugger:print string3.length
+// check:$3 = 48
 // debugger:continue
 
 #[allow(unused_variable)];
diff --git a/src/test/debug-info/lexical-scope-in-for-loop.rs b/src/test/debug-info/lexical-scope-in-for-loop.rs
index 5aa6caf612e..75f1d779d01 100644
--- a/src/test/debug-info/lexical-scope-in-for-loop.rs
+++ b/src/test/debug-info/lexical-scope-in-for-loop.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-win32
 // ignore-android: FIXME(#10381)
 
 // compile-flags:-g
diff --git a/src/test/debug-info/lexical-scope-in-if.rs b/src/test/debug-info/lexical-scope-in-if.rs
index 719c97a730f..712880d50f0 100644
--- a/src/test/debug-info/lexical-scope-in-if.rs
+++ b/src/test/debug-info/lexical-scope-in-if.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-win32
 // ignore-android: FIXME(#10381)
 
 // compile-flags:-g
diff --git a/src/test/debug-info/lexical-scope-in-match.rs b/src/test/debug-info/lexical-scope-in-match.rs
index bdb8416eec5..041c8b5c13f 100644
--- a/src/test/debug-info/lexical-scope-in-match.rs
+++ b/src/test/debug-info/lexical-scope-in-match.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-win32
 // ignore-android: FIXME(#10381)
 
 // compile-flags:-g
diff --git a/src/test/debug-info/lexical-scopes-in-block-expression.rs b/src/test/debug-info/lexical-scopes-in-block-expression.rs
index 39e716403a1..6626d75dc0c 100644
--- a/src/test/debug-info/lexical-scopes-in-block-expression.rs
+++ b/src/test/debug-info/lexical-scopes-in-block-expression.rs
@@ -8,190 +8,214 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-win32
+// ignore-win32: FIXME #13256
 // ignore-android: FIXME(#10381)
 
 // compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
+// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
+// check:$1 = 0
+
 // STRUCT EXPRESSION
 // debugger:finish
 // debugger:print val
-// check:$1 = -1
+// check:$2 = -1
 // debugger:print ten
-// check:$2 = 10
+// check:$3 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$3 = 11
+// check:$4 = 11
+// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
+// check:$5 = 1
 // debugger:print ten
-// check:$4 = 10
+// check:$6 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$5 = -1
+// check:$7 = -1
 // debugger:print ten
-// check:$6 = 10
+// check:$8 = 10
 // debugger:continue
 
 // FUNCTION CALL
 // debugger:finish
 // debugger:print val
-// check:$7 = -1
+// check:$9 = -1
 // debugger:print ten
-// check:$8 = 10
+// check:$10 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$9 = 12
+// check:$11 = 12
+// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
+// check:$12 = 2
 // debugger:print ten
-// check:$10 = 10
+// check:$13 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$11 = -1
+// check:$14 = -1
 // debugger:print ten
-// check:$12 = 10
+// check:$15 = 10
 // debugger:continue
 
 // TUPLE EXPRESSION
 // debugger:finish
 // debugger:print val
-// check:$13 = -1
+// check:$16 = -1
 // debugger:print ten
-// check:$14 = 10
+// check:$17 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$15 = 13
+// check:$18 = 13
+// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
+// check:$19 = 3
 // debugger:print ten
-// check:$16 = 10
+// check:$20 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$17 = -1
+// check:$21 = -1
 // debugger:print ten
-// check:$18 = 10
+// check:$22 = 10
 // debugger:continue
 
 // VEC EXPRESSION
 // debugger:finish
 // debugger:print val
-// check:$19 = -1
+// check:$23 = -1
 // debugger:print ten
-// check:$20 = 10
+// check:$24 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$21 = 14
+// check:$25 = 14
+// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
+// check:$26 = 4
 // debugger:print ten
-// check:$22 = 10
+// check:$27 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$23 = -1
+// check:$28 = -1
 // debugger:print ten
-// check:$24 = 10
+// check:$29 = 10
 // debugger:continue
 
 // REPEAT VEC EXPRESSION
 // debugger:finish
 // debugger:print val
-// check:$25 = -1
+// check:$30 = -1
 // debugger:print ten
-// check:$26 = 10
+// check:$31 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$27 = 15
+// check:$32 = 15
+// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
+// check:$33 = 5
 // debugger:print ten
-// check:$28 = 10
+// check:$34 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$29 = -1
+// check:$35 = -1
 // debugger:print ten
-// check:$30 = 10
+// check:$36 = 10
 // debugger:continue
 
 // ASSIGNMENT EXPRESSION
 // debugger:finish
 // debugger:print val
-// check:$31 = -1
+// check:$37 = -1
 // debugger:print ten
-// check:$32 = 10
+// check:$38 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$33 = 16
+// check:$39 = 16
+// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
+// check:$40 = 6
 // debugger:print ten
-// check:$34 = 10
+// check:$41 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$35 = -1
+// check:$42 = -1
 // debugger:print ten
-// check:$36 = 10
+// check:$43 = 10
 // debugger:continue
 
 
 // ARITHMETIC EXPRESSION
 // debugger:finish
 // debugger:print val
-// check:$37 = -1
+// check:$44 = -1
 // debugger:print ten
-// check:$38 = 10
+// check:$45 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$39 = 17
+// check:$46 = 17
+// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
+// check:$47 = 7
 // debugger:print ten
-// check:$40 = 10
+// check:$48 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$41 = -1
+// check:$49 = -1
 // debugger:print ten
-// check:$42 = 10
+// check:$50 = 10
 // debugger:continue
 
 // INDEX EXPRESSION
 // debugger:finish
 // debugger:print val
-// check:$43 = -1
+// check:$51 = -1
 // debugger:print ten
-// check:$44 = 10
+// check:$52 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$45 = 18
+// check:$53 = 18
+// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
+// check:$54 = 8
 // debugger:print ten
-// check:$46 = 10
+// check:$55 = 10
 // debugger:continue
 
 // debugger:finish
 // debugger:print val
-// check:$47 = -1
+// check:$56 = -1
 // debugger:print ten
-// check:$48 = 10
+// check:$57 = 10
 // debugger:continue
 
+#![allow(unused_variable)]
+#![allow(dead_assignment)]
+
+static mut MUT_INT: int = 0;
+
 struct Point {
     x: int,
     y: int
@@ -213,6 +237,7 @@ fn main() {
             sentinel();
 
             let val = ten + 1;
+            unsafe {MUT_INT = 1;};
 
             zzz();
             sentinel();
@@ -231,6 +256,7 @@ fn main() {
         sentinel();
 
         let val = ten + 2;
+        unsafe {MUT_INT = 2;};
 
         zzz();
         sentinel();
@@ -248,6 +274,7 @@ fn main() {
         sentinel();
 
         let val = ten + 3;
+        unsafe {MUT_INT = 3;};
 
         zzz();
         sentinel();
@@ -264,6 +291,7 @@ fn main() {
         sentinel();
 
         let val = ten + 4;
+        unsafe {MUT_INT = 4;};
 
         zzz();
         sentinel();
@@ -280,6 +308,7 @@ fn main() {
         sentinel();
 
         let val = ten + 5;
+        unsafe {MUT_INT = 5;};
 
         zzz();
         sentinel();
@@ -297,6 +326,7 @@ fn main() {
         sentinel();
 
         let val = ten + 6;
+        unsafe {MUT_INT = 6;};
 
         zzz();
         sentinel();
@@ -313,6 +343,7 @@ fn main() {
         sentinel();
 
         let val = ten + 7;
+        unsafe {MUT_INT = 7;};
 
         zzz();
         sentinel();
@@ -330,11 +361,12 @@ fn main() {
         sentinel();
 
         let val = ten + 8;
+        unsafe {MUT_INT = 8;};
 
         zzz();
         sentinel();
 
-        val
+        val as uint
     }];
 
     zzz();
diff --git a/src/test/debug-info/simd.rs b/src/test/debug-info/simd.rs
index e2a493e75e4..91d53339648 100644
--- a/src/test/debug-info/simd.rs
+++ b/src/test/debug-info/simd.rs
@@ -40,7 +40,7 @@
 
 // debugger:continue
 
-#[allow(experimental)];
+#![allow(experimental)]
 #[allow(unused_variable)];
 
 use std::unstable::simd::{i8x16, i16x8,i32x4,i64x2,u8x16,u16x8,u32x4,u64x2,f32x4,f64x2};
diff --git a/src/test/debug-info/simple-struct.rs b/src/test/debug-info/simple-struct.rs
index 69ec4213183..2e1cdeccad2 100644
--- a/src/test/debug-info/simple-struct.rs
+++ b/src/test/debug-info/simple-struct.rs
@@ -8,33 +8,72 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-win32: FIXME #13256
 // ignore-android: FIXME(#10381)
 
 // compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
+
+// debugger:print 'simple-struct::NO_PADDING_16'
+// check:$1 = {x = 1000, y = -1001}
+
+// debugger:print 'simple-struct::NO_PADDING_32'
+// check:$2 = {x = 1, y = 2, z = 3}
+
+// debugger:print 'simple-struct::NO_PADDING_64'
+// check:$3 = {x = 4, y = 5, z = 6}
+
+// debugger:print 'simple-struct::NO_PADDING_163264'
+// check:$4 = {a = 7, b = 8, c = 9, d = 10}
+
+// debugger:print 'simple-struct::INTERNAL_PADDING'
+// check:$5 = {x = 11, y = 12}
+
+// debugger:print 'simple-struct::PADDING_AT_END'
+// check:$6 = {x = 13, y = 14}
+
 // debugger:run
 // debugger:finish
 
 // debugger:print no_padding16
-// check:$1 = {x = 10000, y = -10001}
+// check:$7 = {x = 10000, y = -10001}
 
 // debugger:print no_padding32
-// check:$2 = {x = -10002, y = -10003.5, z = 10004}
+// check:$8 = {x = -10002, y = -10003.5, z = 10004}
 
 // debugger:print no_padding64
-// check:$3 = {x = -10005.5, y = 10006, z = 10007}
+// check:$9 = {x = -10005.5, y = 10006, z = 10007}
 
 // debugger:print no_padding163264
-// check:$4 = {a = -10008, b = 10009, c = 10010, d = 10011}
+// check:$10 = {a = -10008, b = 10009, c = 10010, d = 10011}
 
 // debugger:print internal_padding
-// check:$5 = {x = 10012, y = -10013}
+// check:$11 = {x = 10012, y = -10013}
 
 // debugger:print padding_at_end
-// check:$6 = {x = -10014, y = 10015}
+// check:$12 = {x = -10014, y = 10015}
+
+// debugger:print 'simple-struct::NO_PADDING_16'
+// check:$13 = {x = 100, y = -101}
+
+// debugger:print 'simple-struct::NO_PADDING_32'
+// check:$14 = {x = -15, y = -16, z = 17}
+
+// debugger:print 'simple-struct::NO_PADDING_64'
+// check:$15 = {x = -18, y = 19, z = 20}
+
+// debugger:print 'simple-struct::NO_PADDING_163264'
+// check:$16 = {a = -21, b = 22, c = 23, d = 24}
+
+// debugger:print 'simple-struct::INTERNAL_PADDING'
+// check:$17 = {x = 25, y = -26}
+
+// debugger:print 'simple-struct::PADDING_AT_END'
+// check:$18 = {x = -27, y = 28}
 
 #[allow(unused_variable)];
+#[allow(dead_code)];
 
 struct NoPadding16 {
     x: u16,
@@ -70,6 +109,40 @@ struct PaddingAtEnd {
     y: u16
 }
 
+static mut NO_PADDING_16: NoPadding16 = NoPadding16 {
+    x: 1000,
+    y: -1001
+};
+
+static mut NO_PADDING_32: NoPadding32 = NoPadding32 {
+    x: 1,
+    y: 2.0,
+    z: 3
+};
+
+static mut NO_PADDING_64: NoPadding64 = NoPadding64 {
+    x: 4.0,
+    y: 5,
+    z: 6
+};
+
+static mut NO_PADDING_163264: NoPadding163264 = NoPadding163264 {
+    a: 7,
+    b: 8,
+    c: 9,
+    d: 10
+};
+
+static mut INTERNAL_PADDING: InternalPadding = InternalPadding {
+    x: 11,
+    y: 12
+};
+
+static mut PADDING_AT_END: PaddingAtEnd = PaddingAtEnd {
+    x: 13,
+    y: 14
+};
+
 fn main() {
     let no_padding16 = NoPadding16 { x: 10000, y: -10001 };
     let no_padding32 = NoPadding32 { x: -10002, y: -10003.5, z: 10004 };
@@ -79,6 +152,30 @@ fn main() {
     let internal_padding = InternalPadding { x: 10012, y: -10013 };
     let padding_at_end = PaddingAtEnd { x: -10014, y: 10015 };
 
+    unsafe {
+        NO_PADDING_16.x = 100;
+        NO_PADDING_16.y = -101;
+
+        NO_PADDING_32.x = -15;
+        NO_PADDING_32.y = -16.0;
+        NO_PADDING_32.z = 17;
+
+        NO_PADDING_64.x = -18.0;
+        NO_PADDING_64.y = 19;
+        NO_PADDING_64.z = 20;
+
+        NO_PADDING_163264.a = -21;
+        NO_PADDING_163264.b = 22;
+        NO_PADDING_163264.c = 23;
+        NO_PADDING_163264.d = 24;
+
+        INTERNAL_PADDING.x = 25;
+        INTERNAL_PADDING.y = -26;
+
+        PADDING_AT_END.x = -27;
+        PADDING_AT_END.y = 28;
+    }
+
     zzz();
 }
 
diff --git a/src/test/debug-info/simple-tuple.rs b/src/test/debug-info/simple-tuple.rs
index 732e44b8c19..16b0061f25e 100644
--- a/src/test/debug-info/simple-tuple.rs
+++ b/src/test/debug-info/simple-tuple.rs
@@ -8,32 +8,80 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-win32: FIXME #13256
 // ignore-android: FIXME(#10381)
 
 // compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
+
+// debugger:print/d 'simple-tuple::NO_PADDING_8'
+// check:$1 = {-50, 50}
+// debugger:print 'simple-tuple::NO_PADDING_16'
+// check:$2 = {-1, 2, 3}
+// debugger:print 'simple-tuple::NO_PADDING_32'
+// check:$3 = {4, 5, 6}
+// debugger:print 'simple-tuple::NO_PADDING_64'
+// check:$4 = {7, 8, 9}
+
+// debugger:print 'simple-tuple::INTERNAL_PADDING_1'
+// check:$5 = {10, 11}
+// debugger:print 'simple-tuple::INTERNAL_PADDING_2'
+// check:$6 = {12, 13, 14, 15}
+
+// debugger:print 'simple-tuple::PADDING_AT_END'
+// check:$7 = {16, 17}
+
 // debugger:run
 // debugger:finish
 
 // debugger:print/d noPadding8
-// check:$1 = {-100, 100}
+// check:$8 = {-100, 100}
 // debugger:print noPadding16
-// check:$2 = {0, 1, 2}
+// check:$9 = {0, 1, 2}
 // debugger:print noPadding32
-// check:$3 = {3, 4.5, 5}
+// check:$10 = {3, 4.5, 5}
 // debugger:print noPadding64
-// check:$4 = {6, 7.5, 8}
+// check:$11 = {6, 7.5, 8}
 
 // debugger:print internalPadding1
-// check:$5 = {9, 10}
+// check:$12 = {9, 10}
 // debugger:print internalPadding2
-// check:$6 = {11, 12, 13, 14}
+// check:$13 = {11, 12, 13, 14}
 
 // debugger:print paddingAtEnd
-// check:$7 = {15, 16}
+// check:$14 = {15, 16}
+
+// debugger:print/d 'simple-tuple::NO_PADDING_8'
+// check:$15 = {-127, 127}
+// debugger:print 'simple-tuple::NO_PADDING_16'
+// check:$16 = {-10, 10, 9}
+// debugger:print 'simple-tuple::NO_PADDING_32'
+// check:$17 = {14, 15, 16}
+// debugger:print 'simple-tuple::NO_PADDING_64'
+// check:$18 = {17, 18, 19}
+
+// debugger:print 'simple-tuple::INTERNAL_PADDING_1'
+// check:$19 = {110, 111}
+// debugger:print 'simple-tuple::INTERNAL_PADDING_2'
+// check:$20 = {112, 113, 114, 115}
+
+// debugger:print 'simple-tuple::PADDING_AT_END'
+// check:$21 = {116, 117}
 
 #[allow(unused_variable)];
+#[allow(dead_code)];
+
+static mut NO_PADDING_8: (i8, u8) = (-50, 50);
+static mut NO_PADDING_16: (i16, i16, u16) = (-1, 2, 3);
+
+static mut NO_PADDING_32: (i32, f32, u32) = (4, 5.0, 6);
+static mut NO_PADDING_64: (i64, f64, u64) = (7, 8.0, 9);
+
+static mut INTERNAL_PADDING_1: (i16, i32) = (10, 11);
+static mut INTERNAL_PADDING_2: (i16, i32, u32, u64) = (12, 13, 14, 15);
+
+static mut PADDING_AT_END: (i32, i16) = (16, 17);
 
 fn main() {
     let noPadding8: (i8, u8) = (-100, 100);
@@ -46,6 +94,19 @@ fn main() {
 
     let paddingAtEnd: (i32, i16) = (15, 16);
 
+    unsafe {
+        NO_PADDING_8 = (-127, 127);
+        NO_PADDING_16 = (-10, 10, 9);
+
+        NO_PADDING_32 = (14, 15.0, 16);
+        NO_PADDING_64 = (17, 18.0, 19);
+
+        INTERNAL_PADDING_1 = (110, 111);
+        INTERNAL_PADDING_2 = (112, 113, 114, 115);
+
+        PADDING_AT_END = (116, 117);
+    }
+
     zzz();
 }
 
diff --git a/src/test/debug-info/var-captured-in-nested-closure.rs b/src/test/debug-info/var-captured-in-nested-closure.rs
index 3e4610289ae..3bf26ae8053 100644
--- a/src/test/debug-info/var-captured-in-nested-closure.rs
+++ b/src/test/debug-info/var-captured-in-nested-closure.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-win32: FIXME #10474
 // ignore-android: FIXME(#10381)
 
 // compile-flags:-g
diff --git a/src/test/debug-info/vec-slices.rs b/src/test/debug-info/vec-slices.rs
index e50e7a99198..0c7e2740cd7 100644
--- a/src/test/debug-info/vec-slices.rs
+++ b/src/test/debug-info/vec-slices.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-win32: FIXME #13256
 // ignore-android: FIXME(#10381)
 
 // compile-flags:-g
@@ -47,6 +48,11 @@
 // debugger:print padded_struct.data_ptr[1]
 // check:$13 = {x = 13, y = 14, z = 15}
 
+// debugger:print 'vec-slices::MUT_VECT_SLICE'.length
+// check:$14 = 2
+// debugger:print *((int64_t[2]*)('vec-slices::MUT_VECT_SLICE'.data_ptr))
+// check:$15 = {64, 65}
+
 #[allow(unused_variable)];
 
 struct AStruct {
@@ -55,6 +61,9 @@ struct AStruct {
     z: i16
 }
 
+static VECT_SLICE: &'static [i64] = &[64, 65];
+static mut MUT_VECT_SLICE: &'static [i64] = &[32];
+
 fn main() {
     let empty: &[i64] = &[];
     let singleton: &[i64] = &[1];
@@ -68,6 +77,10 @@ fn main() {
         AStruct { x: 13, y: 14, z: 15 }
     ];
 
+    unsafe {
+        MUT_VECT_SLICE = VECT_SLICE;
+    }
+
     zzz();
 }
 
diff --git a/src/test/debug-info/vec.rs b/src/test/debug-info/vec.rs
index 04f47f44f18..635a42d443e 100644
--- a/src/test/debug-info/vec.rs
+++ b/src/test/debug-info/vec.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-win32: FIXME #13256
 // ignore-android: FIXME(#10381)
 
 // compile-flags:-g
@@ -17,12 +18,22 @@
 // debugger:finish
 // debugger:print a
 // check:$1 = {1, 2, 3}
+// debugger:print vec::VECT
+// check:$2 = {4, 5, 6}
 
 #[allow(unused_variable)];
 
+static mut VECT: [i32, ..3] = [1, 2, 3];
+
 fn main() {
     let a = [1, 2, 3];
 
+    unsafe {
+        VECT[0] = 4;
+        VECT[1] = 5;
+        VECT[2] = 6;
+    }
+
     zzz();
 }
 
diff --git a/src/test/pretty/attr-fn-inner.rs b/src/test/pretty/attr-fn-inner.rs
index 6745a271436..65dcf900567 100644
--- a/src/test/pretty/attr-fn-inner.rs
+++ b/src/test/pretty/attr-fn-inner.rs
@@ -14,7 +14,7 @@
 // accidentally carried over to each inner function
 
 fn main() {
-    #[inner_attr];
+    #![inner_attr]
     #[outer_attr]
     fn f() { }
 
diff --git a/src/test/pretty/doc-comments.rs b/src/test/pretty/doc-comments.rs
index 45e242c0ca0..02d141f5163 100644
--- a/src/test/pretty/doc-comments.rs
+++ b/src/test/pretty/doc-comments.rs
@@ -57,5 +57,5 @@ fn f() { }
 fn g() { }
 
 fn h() {
-    #[doc = "as do inner ones"];
+    #![doc = "as do inner ones"]
 }
diff --git a/src/test/pretty/raw-str-nonexpr.rs b/src/test/pretty/raw-str-nonexpr.rs
index 026293e7524..b76591048ce 100644
--- a/src/test/pretty/raw-str-nonexpr.rs
+++ b/src/test/pretty/raw-str-nonexpr.rs
@@ -11,7 +11,7 @@
 // ignore-fast #[feature] doesn't work with check-fast
 // pp-exact
 
-#[feature(asm)];
+#![feature(asm)]
 
 #[cfg = r#"just parse this"#]
 extern crate blah = r##"blah"##;
diff --git a/src/test/run-fail/fail-macro-any.rs b/src/test/run-fail/fail-macro-any.rs
index 9bedd8c8cc8..d812e19e1c8 100644
--- a/src/test/run-fail/fail-macro-any.rs
+++ b/src/test/run-fail/fail-macro-any.rs
@@ -11,5 +11,5 @@
 // error-pattern:failed at '~Any'
 
 fn main() {
-    fail!(~413 as ~::std::any::Any);
+    fail!(~413 as ~::std::any::Any:Send);
 }
diff --git a/src/test/run-fail/glob-use-std.rs b/src/test/run-fail/glob-use-std.rs
index 77177c8fcb8..a67ab3d2efc 100644
--- a/src/test/run-fail/glob-use-std.rs
+++ b/src/test/run-fail/glob-use-std.rs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -11,7 +11,7 @@
 // Issue #7580
 
 // error-pattern:fail works
-#[feature(globs)];
+#![feature(globs)]
 
 use std::*;
 
diff --git a/src/test/run-fail/rt-set-exit-status-fail.rs b/src/test/run-fail/rt-set-exit-status-fail.rs
index 98d7d5cf437..385bc145204 100644
--- a/src/test/run-fail/rt-set-exit-status-fail.rs
+++ b/src/test/run-fail/rt-set-exit-status-fail.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -10,7 +10,7 @@
 
 // error-pattern:whatever
 
-#[feature(phase)];
+#![feature(phase)]
 #[phase(syntax, link)] extern crate log;
 use std::os;
 
diff --git a/src/test/run-fail/rt-set-exit-status-fail2.rs b/src/test/run-fail/rt-set-exit-status-fail2.rs
index 67f9f5a168f..3b5e27027b4 100644
--- a/src/test/run-fail/rt-set-exit-status-fail2.rs
+++ b/src/test/run-fail/rt-set-exit-status-fail2.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -10,7 +10,7 @@
 
 // error-pattern:whatever
 
-#[feature(phase)];
+#![feature(phase)]
 #[phase(syntax, link)] extern crate log;
 use std::os;
 use std::task;
diff --git a/src/test/run-fail/rt-set-exit-status.rs b/src/test/run-fail/rt-set-exit-status.rs
index 352e0f65644..b94045e5d12 100644
--- a/src/test/run-fail/rt-set-exit-status.rs
+++ b/src/test/run-fail/rt-set-exit-status.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -10,7 +10,7 @@
 
 // error-pattern:whatever
 
-#[feature(phase)];
+#![feature(phase)]
 #[phase(syntax, link)] extern crate log;
 use std::os;
 
diff --git a/src/test/run-fail/unwind-box-fn-unique.rs b/src/test/run-fail/unwind-box-fn-unique.rs
index a49760f3c58..4a6f37c91b7 100644
--- a/src/test/run-fail/unwind-box-fn-unique.rs
+++ b/src/test/run-fail/unwind-box-fn-unique.rs
@@ -18,7 +18,7 @@ fn failfn() {
 
 fn main() {
     let y = ~0;
-    let x: @proc() = @(proc() {
+    let x: @proc:Send() = @(proc() {
         println!("{:?}", y.clone());
     });
     failfn();
diff --git a/src/test/run-fail/unwind-misc-1.rs b/src/test/run-fail/unwind-misc-1.rs
index 013cd09b9a6..5bcf5b054c1 100644
--- a/src/test/run-fail/unwind-misc-1.rs
+++ b/src/test/run-fail/unwind-misc-1.rs
@@ -24,7 +24,7 @@ fn main() {
     for _i in range(0u, 10u) {
         arr.push(@~"key stuff");
         map.insert(arr.clone(),
-                   vec::append(arr.clone(), &[@~"value stuff"]));
+                   arr.clone().append([@~"value stuff"]));
         if arr.len() == 5 {
             fail!();
         }
diff --git a/src/test/run-make/crate-data-smoke/Makefile b/src/test/run-make/crate-data-smoke/Makefile
index 5009ed15ee6..f2b246b6437 100644
--- a/src/test/run-make/crate-data-smoke/Makefile
+++ b/src/test/run-make/crate-data-smoke/Makefile
@@ -1,7 +1,7 @@
 -include ../tools.mk
 
 all:
-	[ `$(RUSTC) --crate-id crate.rs` = "foo#0.10-pre" ]
+	[ `$(RUSTC) --crate-id crate.rs` = "foo#0.11-pre" ]
 	[ `$(RUSTC) --crate-name crate.rs` = "foo" ]
 	[ `$(RUSTC) --crate-file-name crate.rs` = "foo" ]
 	[ `$(RUSTC) --crate-file-name --crate-type=lib --test crate.rs` = "foo" ]
diff --git a/src/test/run-make/crate-data-smoke/crate.rs b/src/test/run-make/crate-data-smoke/crate.rs
index 71b54f6c341..b6587aec0ad 100644
--- a/src/test/run-make/crate-data-smoke/crate.rs
+++ b/src/test/run-make/crate-data-smoke/crate.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[crate_id = "foo#0.10-pre"];
+#[crate_id = "foo#0.11-pre"];
 
 // Querying about the crate metadata should *not* parse the entire crate, it
 // only needs the crate attributes (which are guaranteed to be at the top) be
diff --git a/src/test/run-make/many-crates-but-no-match/Makefile b/src/test/run-make/many-crates-but-no-match/Makefile
new file mode 100644
index 00000000000..4d80c09c26b
--- /dev/null
+++ b/src/test/run-make/many-crates-but-no-match/Makefile
@@ -0,0 +1,34 @@
+-include ../tools.mk
+
+# Modelled after compile-fail/changing-crates test, but this one puts
+# more than one (mismatching) candidate crate into the search path,
+# which did not appear directly expressible in compile-fail/aux-build
+# infrastructure.
+#
+# Note that we move the built libraries into target direcrtories rather than
+# use the `--out-dir` option because the `../tools.mk` file already bakes a
+# use of `--out-dir` into the definition of $(RUSTC).
+
+A1=$(TMPDIR)/a1
+A2=$(TMPDIR)/a2
+A3=$(TMPDIR)/a3
+
+# A hack to match distinct lines of output from a single run.
+LOG=$(TMPDIR)/log.txt
+
+all: 
+	mkdir -p $(A1) $(A2) $(A3)
+	$(RUSTC) --crate-type=rlib crateA1.rs
+	mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A1)
+	$(RUSTC) --crate-type=rlib -L$(A1) crateB.rs
+	$(RUSTC) --crate-type=rlib crateA2.rs
+	mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A2)
+	$(RUSTC) --crate-type=rlib crateA3.rs
+	mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A3)
+	# Ensure crateC fails to compile since A1 is "missing" and A2/A3 hashes do not match
+	$(RUSTC) -L$(A2) -L$(A3) crateC.rs >$(LOG) 2>&1 || true
+	grep "error: found possibly newer version of crate \`crateA\` which \`crateB\` depends on" $(LOG)
+	grep "note: perhaps this crate needs to be recompiled?" $(LOG)
+	grep "note: crate \`crateA\` path #1:" $(LOG)
+	grep "note: crate \`crateA\` path #2:" $(LOG)
+	grep "note: crate \`crateB\` path #1:" $(LOG)
diff --git a/src/test/run-make/many-crates-but-no-match/crateA1.rs b/src/test/run-make/many-crates-but-no-match/crateA1.rs
new file mode 100644
index 00000000000..0c88cf4745a
--- /dev/null
+++ b/src/test/run-make/many-crates-but-no-match/crateA1.rs
@@ -0,0 +1,14 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_id="crateA"]
+
+// Base crate
+pub fn func<T>() {}
diff --git a/src/test/run-make/many-crates-but-no-match/crateA2.rs b/src/test/run-make/many-crates-but-no-match/crateA2.rs
new file mode 100644
index 00000000000..e3fb50e13d0
--- /dev/null
+++ b/src/test/run-make/many-crates-but-no-match/crateA2.rs
@@ -0,0 +1,14 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_id="crateA"]
+
+// Base crate
+pub fn func<T>() { println!("hello"); }
diff --git a/src/test/run-make/many-crates-but-no-match/crateA3.rs b/src/test/run-make/many-crates-but-no-match/crateA3.rs
new file mode 100644
index 00000000000..ad9d458be24
--- /dev/null
+++ b/src/test/run-make/many-crates-but-no-match/crateA3.rs
@@ -0,0 +1,14 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_id="crateA"]
+
+// Base crate
+pub fn foo<T>() { println!("world!"); }
diff --git a/src/test/run-make/many-crates-but-no-match/crateB.rs b/src/test/run-make/many-crates-but-no-match/crateB.rs
new file mode 100644
index 00000000000..bf55017c646
--- /dev/null
+++ b/src/test/run-make/many-crates-but-no-match/crateB.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.
+
+extern crate crateA;
diff --git a/src/test/compile-fail/struct-variant-privacy.rs b/src/test/run-make/many-crates-but-no-match/crateC.rs
index f37e02be12c..174d9382b76 100644
--- a/src/test/compile-fail/struct-variant-privacy.rs
+++ b/src/test/run-make/many-crates-but-no-match/crateC.rs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -7,14 +7,7 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-#[feature(struct_variant)];
 
-pub enum Foo {
-    Bar {
-        pub x: int, //~ ERROR unnecessary `pub` visibility
-        y: int,
-        priv z: int
-    }
-}
+extern crate crateB;
 
 fn main() {}
diff --git a/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs b/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs
index eb705b8d8a0..cde78da3f61 100644
--- a/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs
+++ b/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs
@@ -14,7 +14,7 @@
 // ignore-android
 // ignore-cross-compile #12102
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate macro_crate_outlive_expansion_phase;
diff --git a/src/test/run-pass-fulldeps/macro-crate.rs b/src/test/run-pass-fulldeps/macro-crate.rs
index 6f412f01bb9..e30498bb3c1 100644
--- a/src/test/run-pass-fulldeps/macro-crate.rs
+++ b/src/test/run-pass-fulldeps/macro-crate.rs
@@ -14,7 +14,7 @@
 // ignore-android
 // ignore-cross-compile #12102
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate macro_crate_test;
diff --git a/src/test/run-pass-fulldeps/phase-syntax-link-does-resolve.rs b/src/test/run-pass-fulldeps/phase-syntax-link-does-resolve.rs
index a7b8297487d..ff82ff62a59 100644
--- a/src/test/run-pass-fulldeps/phase-syntax-link-does-resolve.rs
+++ b/src/test/run-pass-fulldeps/phase-syntax-link-does-resolve.rs
@@ -24,7 +24,7 @@
 // can't run host binaries, and force-host to make this test build as the host
 // arch.
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax, link)]
 extern crate macro_crate_test;
diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs
index 1e26ce0c4f3..1def436b4de 100644
--- a/src/test/run-pass-fulldeps/qquote.rs
+++ b/src/test/run-pass-fulldeps/qquote.rs
@@ -11,7 +11,7 @@
 // ignore-pretty
 // ignore-test
 
-#[feature(quote)];
+#![feature(quote)]
 
 extern crate syntax;
 
diff --git a/src/test/run-pass-fulldeps/quote-tokens.rs b/src/test/run-pass-fulldeps/quote-tokens.rs
index 1bf601f71b4..5180ac68482 100644
--- a/src/test/run-pass-fulldeps/quote-tokens.rs
+++ b/src/test/run-pass-fulldeps/quote-tokens.rs
@@ -10,7 +10,7 @@
 
 // ignore-test
 
-#[feature(quote)];
+#![feature(quote)]
 #[feature(managed_boxes)];
 
 extern crate syntax;
diff --git a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs
index ac8d361bf5a..ea2ffb8dcf8 100644
--- a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs
+++ b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // ignore-android
-#[feature(quote)];
+#![feature(quote)]
 #[deny(unused_variable)];
 
 extern crate syntax;
diff --git a/src/test/run-pass-fulldeps/syntax-extension-fourcc.rs b/src/test/run-pass-fulldeps/syntax-extension-fourcc.rs
index a6f118d77fa..54687c03da5 100644
--- a/src/test/run-pass-fulldeps/syntax-extension-fourcc.rs
+++ b/src/test/run-pass-fulldeps/syntax-extension-fourcc.rs
@@ -13,7 +13,7 @@
 // ignore-pretty
 // ignore-cross-compile
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate fourcc;
diff --git a/src/test/run-pass-fulldeps/syntax-extension-hexfloat.rs b/src/test/run-pass-fulldeps/syntax-extension-hexfloat.rs
index 6eeefabcf7c..eb25d82e549 100644
--- a/src/test/run-pass-fulldeps/syntax-extension-hexfloat.rs
+++ b/src/test/run-pass-fulldeps/syntax-extension-hexfloat.rs
@@ -13,7 +13,7 @@
 // ignore-cross-compile #12102
 // ignore-fast
 
-#[feature(phase)];
+#![feature(phase)]
 #[phase(syntax)]
 extern crate hexfloat;
 
diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs
index a0233360a7c..2c71d791cd4 100644
--- a/src/test/run-pass/alignment-gep-tup-like-1.rs
+++ b/src/test/run-pass/alignment-gep-tup-like-1.rs
@@ -27,11 +27,11 @@ impl<A:Clone> Invokable<A> for Invoker<A> {
     }
 }
 
-fn f<A:Clone + 'static>(a: A, b: u16) -> ~Invokable:<A> {
+fn f<A:Clone + 'static>(a: A, b: u16) -> ~Invokable<A>: {
     ~Invoker {
         a: a,
         b: b,
-    } as ~Invokable:<A>
+    } as ~Invokable<A>:
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/asm-concat-src.rs b/src/test/run-pass/asm-concat-src.rs
index 96c98a03720..5615089dcdc 100644
--- a/src/test/run-pass/asm-concat-src.rs
+++ b/src/test/run-pass/asm-concat-src.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // ignore-fast #[feature] doesn't work with check-fast
-#[feature(asm)];
+#![feature(asm)]
 
 pub fn main() {
     unsafe { asm!(concat!("", "")) };
diff --git a/src/test/run-pass/asm-in-out-operand.rs b/src/test/run-pass/asm-in-out-operand.rs
index 11d4321b3e9..0b5502aa330 100644
--- a/src/test/run-pass/asm-in-out-operand.rs
+++ b/src/test/run-pass/asm-in-out-operand.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // ignore-fast #[feature] doesn't work with check-fast
-#[feature(asm)];
+#![feature(asm)]
 
 #[cfg(target_arch = "x86")]
 #[cfg(target_arch = "x86_64")]
diff --git a/src/test/run-pass/asm-out-assign.rs b/src/test/run-pass/asm-out-assign.rs
index 2f6b87f26a7..de2630d1ca9 100644
--- a/src/test/run-pass/asm-out-assign.rs
+++ b/src/test/run-pass/asm-out-assign.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // ignore-fast #[feature] doesn't work with check-fast
-#[feature(asm)];
+#![feature(asm)]
 
 #[cfg(target_arch = "x86")]
 #[cfg(target_arch = "x86_64")]
diff --git a/src/test/run-pass/assignability-trait.rs b/src/test/run-pass/assignability-trait.rs
index 2682d9e54bc..dddec5a5624 100644
--- a/src/test/run-pass/assignability-trait.rs
+++ b/src/test/run-pass/assignability-trait.rs
@@ -51,7 +51,7 @@ pub fn main() {
     // Now try it with a type that *needs* to be borrowed
     let z = [0,1,2,3];
     // Call a method
-    z.iterate(|y| { assert!(z[*y] == *y); true });
+    z.iterate(|y| { assert!(z[*y as uint] == *y); true });
     // Call a parameterized function
     assert_eq!(length::<int, &[int]>(z), z.len());
 }
diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs
index 7252e319372..edf0e195cb3 100644
--- a/src/test/run-pass/backtrace.rs
+++ b/src/test/run-pass/backtrace.rs
@@ -8,8 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-win32 FIXME #13259
 // ignore-fast this is executing itself
-#[no_uv];
+#![no_uv]
 
 extern crate native;
 
diff --git a/src/test/run-pass/builtin-superkinds-in-metadata.rs b/src/test/run-pass/builtin-superkinds-in-metadata.rs
index 7b2977d031c..5261ea9d1e1 100644
--- a/src/test/run-pass/builtin-superkinds-in-metadata.rs
+++ b/src/test/run-pass/builtin-superkinds-in-metadata.rs
@@ -16,7 +16,7 @@
 
 extern crate trait_superkinds_in_metadata;
 use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare};
-use trait_superkinds_in_metadata::{RequiresPod};
+use trait_superkinds_in_metadata::{RequiresCopy};
 
 struct X<T>(T);
 
@@ -24,6 +24,6 @@ impl <T:Share> RequiresShare for X<T> { }
 
 impl <T:Share+Send> RequiresRequiresShareAndSend for X<T> { }
 
-impl <T:Pod> RequiresPod for X<T> { }
+impl <T:Copy> RequiresCopy for X<T> { }
 
 pub fn main() { }
diff --git a/src/test/run-pass/can-copy-pod.rs b/src/test/run-pass/can-copy-pod.rs
index a6a56a68c5a..8375aafb5b7 100644
--- a/src/test/run-pass/can-copy-pod.rs
+++ b/src/test/run-pass/can-copy-pod.rs
@@ -11,11 +11,11 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-// Tests that type parameters with the `Pod` are implicitly copyable.
+// Tests that type parameters with the `Copy` are implicitly copyable.
 
 #[allow(dead_code)];
 
-fn can_copy_pod<T:Pod>(v: T) {
+fn can_copy_copy<T:Copy>(v: T) {
     let _a = v;
     let _b = v;
 }
diff --git a/src/test/run-pass/capturing-logging.rs b/src/test/run-pass/capturing-logging.rs
index 97dfbb0d8e2..10976c5c612 100644
--- a/src/test/run-pass/capturing-logging.rs
+++ b/src/test/run-pass/capturing-logging.rs
@@ -12,7 +12,7 @@
 // ignore-android (FIXME #11419)
 // exec-env:RUST_LOG=info
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax, link)]
 extern crate log;
@@ -42,7 +42,7 @@ fn main() {
     let (tx, rx) = channel();
     let (mut r, w) = (ChanReader::new(rx), ChanWriter::new(tx));
     spawn(proc() {
-        set_logger(~MyWriter(w) as ~Logger);
+        set_logger(~MyWriter(w) as ~Logger:Send);
         debug!("debug");
         info!("info");
     });
diff --git a/src/test/run-pass/clone-with-exterior.rs b/src/test/run-pass/clone-with-exterior.rs
index 6db42c1e2ee..4f3db3a5f77 100644
--- a/src/test/run-pass/clone-with-exterior.rs
+++ b/src/test/run-pass/clone-with-exterior.rs
@@ -18,7 +18,7 @@ struct Pair {
 pub fn main() {
     let z = ~Pair { a : 10, b : 12};
 
-    let f: proc() = proc() {
+    let f: proc:Send() = proc() {
         assert_eq!(z.a, 10);
         assert_eq!(z.b, 12);
     };
diff --git a/src/test/run-pass/close-over-big-then-small-data.rs b/src/test/run-pass/close-over-big-then-small-data.rs
index ea75ae2fc5c..c57b6fdf384 100644
--- a/src/test/run-pass/close-over-big-then-small-data.rs
+++ b/src/test/run-pass/close-over-big-then-small-data.rs
@@ -31,11 +31,11 @@ impl<A:Clone> Invokable<A> for Invoker<A> {
     }
 }
 
-fn f<A:Clone + 'static>(a: A, b: u16) -> ~Invokable:<A> {
+fn f<A:Clone + 'static>(a: A, b: u16) -> ~Invokable<A>: {
     ~Invoker {
         a: a,
         b: b,
-    } as ~Invokable:<A>
+    } as ~Invokable<A>:
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/conditional-debug-macro-off.rs b/src/test/run-pass/conditional-debug-macro-off.rs
index 8a2a00f5638..460846ef31c 100644
--- a/src/test/run-pass/conditional-debug-macro-off.rs
+++ b/src/test/run-pass/conditional-debug-macro-off.rs
@@ -12,7 +12,7 @@
 // compile-flags: --cfg ndebug
 // exec-env:RUST_LOG=conditional-debug-macro-off=4
 
-#[feature(phase)];
+#![feature(phase)]
 #[phase(syntax, link)]
 extern crate log;
 
diff --git a/src/test/run-pass/core-run-destroy.rs b/src/test/run-pass/core-run-destroy.rs
index 87d3c337bdd..83232b40873 100644
--- a/src/test/run-pass/core-run-destroy.rs
+++ b/src/test/run-pass/core-run-destroy.rs
@@ -22,6 +22,12 @@ extern crate native;
 extern crate green;
 extern crate rustuv;
 
+use std::io::Process;
+
+macro_rules! succeed( ($e:expr) => (
+    match $e { Ok(..) => {}, Err(e) => fail!("failure: {}", e) }
+) )
+
 macro_rules! iotest (
     { fn $name:ident() $b:block $($a:attr)* } => (
         mod $name {
@@ -53,28 +59,29 @@ fn start(argc: int, argv: **u8) -> int {
 }
 
 iotest!(fn test_destroy_once() {
-    #[cfg(not(target_os="android"))]
-    static mut PROG: &'static str = "echo";
-
-    #[cfg(target_os="android")]
-    static mut PROG: &'static str = "ls"; // android don't have echo binary
-
-    let mut p = unsafe {Process::new(PROG, []).unwrap()};
-    p.signal_exit().unwrap(); // this shouldn't crash (and nor should the destructor)
+    let mut p = sleeper();
+    match p.signal_exit() {
+        Ok(()) => {}
+        Err(e) => fail!("error: {}", e),
+    }
 })
 
+#[cfg(unix)]
+pub fn sleeper() -> Process {
+    Process::new("sleep", [~"1000"]).unwrap()
+}
+#[cfg(windows)]
+pub fn sleeper() -> Process {
+    // There's a `timeout` command on windows, but it doesn't like having
+    // its output piped, so instead just ping ourselves a few times with
+    // gaps inbetweeen so we're sure this process is alive for awhile
+    Process::new("ping", [~"127.0.0.1", ~"-n", ~"1000"]).unwrap()
+}
+
 iotest!(fn test_destroy_twice() {
-    #[cfg(not(target_os="android"))]
-    static mut PROG: &'static str = "echo";
-    #[cfg(target_os="android")]
-    static mut PROG: &'static str = "ls"; // android don't have echo binary
-
-    let mut p = match unsafe{Process::new(PROG, [])} {
-        Ok(p) => p,
-        Err(e) => fail!("wut: {}", e),
-    };
-    p.signal_exit().unwrap(); // this shouldnt crash...
-    p.signal_exit().unwrap(); // ...and nor should this (and nor should the destructor)
+    let mut p = sleeper();
+    succeed!(p.signal_exit()); // this shouldnt crash...
+    let _ = p.signal_exit(); // ...and nor should this (and nor should the destructor)
 })
 
 pub fn test_destroy_actually_kills(force: bool) {
diff --git a/src/test/run-pass/cycle-collection.rs b/src/test/run-pass/cycle-collection.rs
index ca1e18eb87b..c6f353136ba 100644
--- a/src/test/run-pass/cycle-collection.rs
+++ b/src/test/run-pass/cycle-collection.rs
@@ -19,7 +19,7 @@ enum taggy {
 
 fn f() {
     let a_box = @RefCell::new(nil);
-    a_box.set(cons(a_box));
+    *a_box.borrow_mut() = cons(a_box);
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/empty-allocation-non-null.rs b/src/test/run-pass/empty-allocation-non-null.rs
new file mode 100644
index 00000000000..9695296ec15
--- /dev/null
+++ b/src/test/run-pass/empty-allocation-non-null.rs
@@ -0,0 +1,19 @@
+// 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 fn main() {
+    assert!(Some(~()).is_some());
+
+    struct Foo;
+    assert!(Some(~Foo).is_some());
+
+    let xs: ~[()] = ~[];
+    assert!(Some(xs).is_some());
+}
diff --git a/src/test/run-pass/export-glob-imports-target.rs b/src/test/run-pass/export-glob-imports-target.rs
index 3d8e7608788..e4f037e4563 100644
--- a/src/test/run-pass/export-glob-imports-target.rs
+++ b/src/test/run-pass/export-glob-imports-target.rs
@@ -15,7 +15,7 @@
 
 // Modified to not use export since it's going away. --pcw
 
-#[feature(globs)];
+#![feature(globs)]
 
 mod foo {
     use foo::bar::*;
diff --git a/src/test/run-pass/extern-fn-reachable.rs b/src/test/run-pass/extern-fn-reachable.rs
index d0526b75c96..d0f12ae7b10 100644
--- a/src/test/run-pass/extern-fn-reachable.rs
+++ b/src/test/run-pass/extern-fn-reachable.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // ignore-fast
+// ignore-win32 dynamic_lib can read dllexported symbols only
 // ignore-linux apparently dlsym doesn't work on program symbols?
 // ignore-android apparently dlsym doesn't work on program symbols?
 // ignore-freebsd apparently dlsym doesn't work on program symbols?
diff --git a/src/test/run-pass/fsu-moves-and-copies.rs b/src/test/run-pass/fsu-moves-and-copies.rs
index 878ea298db3..571ef4bd7b4 100644
--- a/src/test/run-pass/fsu-moves-and-copies.rs
+++ b/src/test/run-pass/fsu-moves-and-copies.rs
@@ -11,14 +11,14 @@
 // Issue 4691: Ensure that functional-struct-updates operates
 // correctly and moves rather than copy when appropriate.
 
-use NP = std::kinds::marker::NoPod;
+use NP = std::kinds::marker::NoCopy;
 
 struct ncint { np: NP, v: int }
 fn ncint(v: int) -> ncint { ncint { np: NP, v: v } }
 
-struct NoFoo { copied: int, nopod: ncint, }
+struct NoFoo { copied: int, nocopy: ncint, }
 impl NoFoo {
-    fn new(x:int,y:int) -> NoFoo { NoFoo { copied: x, nopod: ncint(y) } }
+    fn new(x:int,y:int) -> NoFoo { NoFoo { copied: x, nocopy: ncint(y) } }
 }
 
 struct MoveFoo { copied: int, moved: ~int, }
@@ -44,18 +44,18 @@ fn test0() {
     // (and thus it is okay that these are Drop; compare against
     // compile-fail test: borrowck-struct-update-with-dtor.rs).
 
-    // Case 1: Nopodable
+    // Case 1: Nocopyable
     let f = DropNoFoo::new(1, 2);
-    let b = DropNoFoo { inner: NoFoo { nopod: ncint(3), ..f.inner }};
-    let c = DropNoFoo { inner: NoFoo { nopod: ncint(4), ..f.inner }};
+    let b = DropNoFoo { inner: NoFoo { nocopy: ncint(3), ..f.inner }};
+    let c = DropNoFoo { inner: NoFoo { nocopy: ncint(4), ..f.inner }};
     assert_eq!(f.inner.copied,    1);
-    assert_eq!(f.inner.nopod.v, 2);
+    assert_eq!(f.inner.nocopy.v, 2);
 
     assert_eq!(b.inner.copied,    1);
-    assert_eq!(b.inner.nopod.v, 3);
+    assert_eq!(b.inner.nocopy.v, 3);
 
     assert_eq!(c.inner.copied,    1);
-    assert_eq!(c.inner.nopod.v, 4);
+    assert_eq!(c.inner.nocopy.v, 4);
 
     // Case 2: Owned
     let f = DropMoveFoo::new(5, 6);
@@ -86,12 +86,12 @@ fn test1() {
 fn test2() {
     // move non-copyable field
     let f = NoFoo::new(21, 22);
-    let b = NoFoo {nopod: ncint(23), ..f};
+    let b = NoFoo {nocopy: ncint(23), ..f};
     let c = NoFoo {copied: 24, ..f};
     assert_eq!(b.copied,    21);
-    assert_eq!(b.nopod.v, 23);
+    assert_eq!(b.nocopy.v, 23);
     assert_eq!(c.copied,    24);
-    assert_eq!(c.nopod.v, 22);
+    assert_eq!(c.nocopy.v, 22);
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs
index 7e9afc4de56..7cdd932faf6 100644
--- a/src/test/run-pass/ifmt.rs
+++ b/src/test/run-pass/ifmt.rs
@@ -11,7 +11,7 @@
 // ignore-fast: check-fast screws up repr paths
 
 #[feature(macro_rules)];
-#[deny(warnings)];
+#![deny(warnings)]
 #[allow(unused_must_use)];
 #[allow(deprecated_owned_vector)];
 
diff --git a/src/test/run-pass/import-glob-0.rs b/src/test/run-pass/import-glob-0.rs
index dc5c7d11769..5f4bf557b23 100644
--- a/src/test/run-pass/import-glob-0.rs
+++ b/src/test/run-pass/import-glob-0.rs
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
+#![feature(globs)]
 
 use module_of_many_things::*;
 use dug::too::greedily::and::too::deep::*;
diff --git a/src/test/run-pass/import-glob-crate.rs b/src/test/run-pass/import-glob-crate.rs
index a9a9f78943f..e1ca890f4fd 100644
--- a/src/test/run-pass/import-glob-crate.rs
+++ b/src/test/run-pass/import-glob-crate.rs
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
+#![feature(globs)]
 #[allow(dead_assignment)];
 
 use std::mem::*;
diff --git a/src/test/run-pass/import-in-block.rs b/src/test/run-pass/import-in-block.rs
index 7c0037c1e15..24196c22571 100644
--- a/src/test/run-pass/import-in-block.rs
+++ b/src/test/run-pass/import-in-block.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
+#![feature(globs)]
 
 pub fn main() {
     use std::mem::replace;
diff --git a/src/test/run-pass/integral-indexing.rs b/src/test/run-pass/integral-indexing.rs
deleted file mode 100644
index b3885691093..00000000000
--- a/src/test/run-pass/integral-indexing.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.
-//
-// 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.
-
-
-// This is a testcase for issue #94.
-pub fn main() {
-    let v: Vec<int> = vec!(0, 1, 2, 3, 4, 5);
-    let s: ~str = ~"abcdef";
-    assert_eq!(v.as_slice()[3u], 3);
-    assert_eq!(v.as_slice()[3u8], 3);
-    assert_eq!(v.as_slice()[3i8], 3);
-    assert_eq!(v.as_slice()[3u32], 3);
-    assert_eq!(v.as_slice()[3i32], 3);
-    println!("{}", v.as_slice()[3u8]);
-    assert_eq!(s[3u], 'd' as u8);
-    assert_eq!(s[3u8], 'd' as u8);
-    assert_eq!(s[3i8], 'd' as u8);
-    assert_eq!(s[3u32], 'd' as u8);
-    assert_eq!(s[3i32], 'd' as u8);
-    println!("{}", s[3u8]);
-}
diff --git a/src/test/run-pass/intrinsics-integer.rs b/src/test/run-pass/intrinsics-integer.rs
index 88c964462e8..867e12d4139 100644
--- a/src/test/run-pass/intrinsics-integer.rs
+++ b/src/test/run-pass/intrinsics-integer.rs
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
+#![feature(globs)]
 
 mod rusti {
     extern "rust-intrinsic" {
diff --git a/src/test/run-pass/issue-12582.rs b/src/test/run-pass/issue-12582.rs
new file mode 100644
index 00000000000..a5e3c647453
--- /dev/null
+++ b/src/test/run-pass/issue-12582.rs
@@ -0,0 +1,29 @@
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub fn main() {
+    let x = 1;
+    let y = 2;
+
+    assert_eq!(3, match (x, y) {
+        (1, 1) => 1,
+        (2, 2) => 2,
+        (1..2, 2) => 3,
+        _ => 4,
+    });
+
+    // nested tuple
+    assert_eq!(3, match ((x, y),) {
+        ((1, 1),) => 1,
+        ((2, 2),) => 2,
+        ((1..2, 2),) => 3,
+        _ => 4,
+    });
+}
diff --git a/src/test/run-pass/issue-13027.rs b/src/test/run-pass/issue-13027.rs
new file mode 100644
index 00000000000..f2f0418a33f
--- /dev/null
+++ b/src/test/run-pass/issue-13027.rs
@@ -0,0 +1,170 @@
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Tests that match expression handles overlapped literal and range
+// properly in the presence of guard function.
+
+fn val() -> uint { 1 }
+
+static CONST: uint = 1;
+
+pub fn main() {
+    lit_shadow_range();
+    range_shadow_lit();
+    range_shadow_range();
+    multi_pats_shadow_lit();
+    multi_pats_shadow_range();
+    lit_shadow_multi_pats();
+    range_shadow_multi_pats();
+}
+
+fn lit_shadow_range() {
+    assert_eq!(2, match 1 {
+        1 if false => 1,
+        1..2 => 2,
+        _ => 3
+    });
+
+    let x = 0;
+    assert_eq!(2, match x+1 {
+        0 => 0,
+        1 if false => 1,
+        1..2 => 2,
+        _ => 3
+    });
+
+    assert_eq!(2, match val() {
+        1 if false => 1,
+        1..2 => 2,
+        _ => 3
+    });
+
+    assert_eq!(2, match CONST {
+        0 => 0,
+        1 if false => 1,
+        1..2 => 2,
+        _ => 3
+    });
+
+    // value is out of the range of second arm, should match wildcard pattern
+    assert_eq!(3, match 3 {
+        1 if false => 1,
+        1..2 => 2,
+        _ => 3
+    });
+}
+
+fn range_shadow_lit() {
+    assert_eq!(2, match 1 {
+        1..2 if false => 1,
+        1 => 2,
+        _ => 3
+    });
+
+    let x = 0;
+    assert_eq!(2, match x+1 {
+        0 => 0,
+        1..2 if false => 1,
+        1 => 2,
+        _ => 3
+    });
+
+    assert_eq!(2, match val() {
+        1..2 if false => 1,
+        1 => 2,
+        _ => 3
+    });
+
+    assert_eq!(2, match CONST {
+        0 => 0,
+        1..2 if false => 1,
+        1 => 2,
+        _ => 3
+    });
+
+    // ditto
+    assert_eq!(3, match 3 {
+        1..2 if false => 1,
+        1 => 2,
+        _ => 3
+    });
+}
+
+fn range_shadow_range() {
+    assert_eq!(2, match 1 {
+        0..2 if false => 1,
+        1..3 => 2,
+        _ => 3,
+    });
+
+    let x = 0;
+    assert_eq!(2, match x+1 {
+        100 => 0,
+        0..2 if false => 1,
+        1..3 => 2,
+        _ => 3,
+    });
+
+    assert_eq!(2, match val() {
+        0..2 if false => 1,
+        1..3 => 2,
+        _ => 3,
+    });
+
+    assert_eq!(2, match CONST {
+        100 => 0,
+        0..2 if false => 1,
+        1..3 => 2,
+        _ => 3,
+    });
+
+    // ditto
+    assert_eq!(3, match 5 {
+        0..2 if false => 1,
+        1..3 => 2,
+        _ => 3,
+    });
+}
+
+fn multi_pats_shadow_lit() {
+    assert_eq!(2, match 1 {
+        100 => 0,
+        0 | 1..10 if false => 1,
+        1 => 2,
+        _ => 3,
+    });
+}
+
+fn multi_pats_shadow_range() {
+    assert_eq!(2, match 1 {
+        100 => 0,
+        0 | 1..10 if false => 1,
+        1..3 => 2,
+        _ => 3,
+    });
+}
+
+fn lit_shadow_multi_pats() {
+    assert_eq!(2, match 1 {
+        100 => 0,
+        1 if false => 1,
+        0 | 1..10 => 2,
+        _ => 3,
+    });
+}
+
+fn range_shadow_multi_pats() {
+    assert_eq!(2, match 1 {
+        100 => 0,
+        1..3 if false => 1,
+        0 | 1..10 => 2,
+        _ => 3,
+    });
+}
diff --git a/src/test/run-pass/issue-2190-1.rs b/src/test/run-pass/issue-2190-1.rs
index 0580dd89a30..d04717e380b 100644
--- a/src/test/run-pass/issue-2190-1.rs
+++ b/src/test/run-pass/issue-2190-1.rs
@@ -12,13 +12,13 @@ use std::task;
 
 static generations: uint = 1024+256+128+49;
 
-fn spawn(f: proc()) {
+fn spawn(f: proc:Send()) {
     let mut t = task::task();
     t.opts.stack_size = Some(32 * 1024);
     t.spawn(f);
 }
 
-fn child_no(x: uint) -> proc() {
+fn child_no(x: uint) -> proc:Send() {
     proc() {
         if x < generations {
             spawn(child_no(x+1));
diff --git a/src/test/run-pass/issue-2526-a.rs b/src/test/run-pass/issue-2526-a.rs
index b10871f78d4..00323b60649 100644
--- a/src/test/run-pass/issue-2526-a.rs
+++ b/src/test/run-pass/issue-2526-a.rs
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:issue-2526.rs
 
-#[feature(globs)];
+#![feature(globs)]
 #[allow(unused_imports)];
 
 extern crate issue_2526;
diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs
index bb0ea68e757..85299472458 100644
--- a/src/test/run-pass/issue-3563-3.rs
+++ b/src/test/run-pass/issue-3563-3.rs
@@ -99,7 +99,9 @@ impl AsciiArt {
 impl fmt::Show for AsciiArt {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         // Convert each line into a string.
-        let lines = self.lines.map(|line| str::from_chars(line.as_slice()));
+        let lines = self.lines.iter()
+                              .map(|line| str::from_chars(line.as_slice()))
+                              .collect::<Vec<~str>>();
 
         // Concatenate the lines together using a new-line.
         write!(f.buf, "{}", lines.connect("\n"))
diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs
index da620ffeb0d..1f1de9ddb9b 100644
--- a/src/test/run-pass/issue-3609.rs
+++ b/src/test/run-pass/issue-3609.rs
@@ -11,7 +11,7 @@
 use std::task;
 
 type RingBuffer = Vec<f64> ;
-type SamplesFn = proc(samples: &RingBuffer);
+type SamplesFn = proc:Send(samples: &RingBuffer);
 
 enum Msg
 {
diff --git a/src/test/run-pass/issue-3847.rs b/src/test/run-pass/issue-3847.rs
index de01448f9b8..9216c8aa1ae 100644
--- a/src/test/run-pass/issue-3847.rs
+++ b/src/test/run-pass/issue-3847.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 mod buildings {
-    pub struct Tower { height: uint }
+    pub struct Tower { pub height: uint }
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/issue-4016.rs b/src/test/run-pass/issue-4016.rs
index 4b9a2353862..7f72850aaaf 100644
--- a/src/test/run-pass/issue-4016.rs
+++ b/src/test/run-pass/issue-4016.rs
@@ -15,12 +15,12 @@ extern crate serialize;
 
 use serialize::{json, Decodable};
 
-trait JD : Decodable<json::Decoder> { }
+trait JD : Decodable<json::Decoder, json::Error> { }
 
 fn exec<T: JD>() {
     let doc = json::from_str("").unwrap();
     let mut decoder = json::Decoder::new(doc);
-    let _v: T = Decodable::decode(&mut decoder);
+    let _v: T = Decodable::decode(&mut decoder).unwrap();
     fail!()
 }
 
diff --git a/src/test/run-pass/issue-4036.rs b/src/test/run-pass/issue-4036.rs
index 1033b953305..72efd252512 100644
--- a/src/test/run-pass/issue-4036.rs
+++ b/src/test/run-pass/issue-4036.rs
@@ -20,5 +20,5 @@ use serialize::{json, Decodable};
 pub fn main() {
     let json = json::from_str("[1]").unwrap();
     let mut decoder = json::Decoder::new(json);
-    let _x: Vec<int> = Decodable::decode(&mut decoder);
+    let _x: Vec<int> = Decodable::decode(&mut decoder).unwrap();
 }
diff --git a/src/test/run-pass/issue-4830.rs b/src/test/run-pass/issue-4830.rs
index e8147a2ce82..168389bf2b8 100644
--- a/src/test/run-pass/issue-4830.rs
+++ b/src/test/run-pass/issue-4830.rs
@@ -10,7 +10,7 @@
 
 pub struct Scheduler {
     /// The event loop used to drive the scheduler and perform I/O
-    priv event_loop: ~int
+    event_loop: ~int
 }
 
 pub fn main() { }
diff --git a/src/test/run-pass/issue-980.rs b/src/test/run-pass/issue-980.rs
index f6dc4adcf9b..06f95bae559 100644
--- a/src/test/run-pass/issue-980.rs
+++ b/src/test/run-pass/issue-980.rs
@@ -23,7 +23,7 @@ struct Pointy {
 
 pub fn main() {
     let m = @RefCell::new(Pointy { x : no_pointy });
-    m.set(Pointy {
+    *m.borrow_mut() = Pointy {
         x: yes_pointy(m)
-    });
+    };
 }
diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs
index 22356764410..ae5a86c699e 100644
--- a/src/test/run-pass/item-attributes.rs
+++ b/src/test/run-pass/item-attributes.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -160,7 +160,7 @@ mod test_foreign_items {
         use std::libc;
 
         extern {
-            #[attr];
+            #![attr]
 
             #[attr]
             fn rust_get_test_int() -> libc::intptr_t;
diff --git a/src/test/run-pass/kindck-owned-trait-contains-1.rs b/src/test/run-pass/kindck-owned-trait-contains-1.rs
index 0a7e164ca5b..e4a7e7af14f 100644
--- a/src/test/run-pass/kindck-owned-trait-contains-1.rs
+++ b/src/test/run-pass/kindck-owned-trait-contains-1.rs
@@ -16,9 +16,9 @@ impl<A:Clone + 'static> repeat<A> for ~A {
     }
 }
 
-fn repeater<A:Clone + 'static>(v: ~A) -> ~repeat:<A> {
+fn repeater<A:Clone + 'static>(v: ~A) -> ~repeat<A>: {
     // Note: owned kind is not necessary as A appears in the trait type
-    ~v as ~repeat:<A> // No
+    ~v as ~repeat<A>: // No
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/kinds-in-metadata.rs b/src/test/run-pass/kinds-in-metadata.rs
index 7799bd70162..05f58acd949 100644
--- a/src/test/run-pass/kinds-in-metadata.rs
+++ b/src/test/run-pass/kinds-in-metadata.rs
@@ -14,7 +14,7 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-// Tests that metadata serialization works for the `Pod` kind.
+// Tests that metadata serialization works for the `Copy` kind.
 
 extern crate kinds_in_metadata;
 
diff --git a/src/test/run-pass/linkage1.rs b/src/test/run-pass/linkage1.rs
index c6f672c5d34..4b2c9861493 100644
--- a/src/test/run-pass/linkage1.rs
+++ b/src/test/run-pass/linkage1.rs
@@ -14,7 +14,7 @@
 // ignore-macos
 // aux-build:linkage1.rs
 
-#[feature(linkage)];
+#![feature(linkage)]
 
 extern crate other = "linkage1";
 
diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs
index 0129740252c..7e120658aae 100644
--- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs
+++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs
@@ -10,9 +10,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern crate collections;
-use collections::list::List;
-
 #[deriving(Clone)]
 enum foo {
   a(uint),
@@ -24,9 +21,21 @@ fn check_log<T>(exp: ~str, v: T) {
 }
 
 pub fn main() {
-    let x = List::from_vec([a(22u), b(~"hi")]);
-    let exp = ~"Cons(a(22u), @Cons(b(~\"hi\"), @Nil))";
+    let mut x = Some(a(22u));
+    let exp = ~"Some(a(22u))";
+    let act = format!("{:?}", x);
+    assert_eq!(act, exp);
+    check_log(exp, x);
+
+    x = Some(b(~"hi"));
+    let exp = ~"Some(b(~\"hi\"))";
+    let act = format!("{:?}", x);
+    assert_eq!(act, exp);
+    check_log(exp, x);
+
+    x = None;
+    let exp = ~"None";
     let act = format!("{:?}", x);
-    assert!(act == exp);
+    assert_eq!(act, exp);
     check_log(exp, x);
 }
diff --git a/src/test/run-pass/logging-enabled-debug.rs b/src/test/run-pass/logging-enabled-debug.rs
index b3a77aa9675..f5db1c7b1d6 100644
--- a/src/test/run-pass/logging-enabled-debug.rs
+++ b/src/test/run-pass/logging-enabled-debug.rs
@@ -12,7 +12,7 @@
 // compile-flags:--cfg ndebug
 // exec-env:RUST_LOG=logging-enabled-debug=debug
 
-#[feature(phase)];
+#![feature(phase)]
 #[phase(syntax, link)]
 extern crate log;
 
diff --git a/src/test/run-pass/logging-enabled.rs b/src/test/run-pass/logging-enabled.rs
index 587e0b9d4c5..31437586897 100644
--- a/src/test/run-pass/logging-enabled.rs
+++ b/src/test/run-pass/logging-enabled.rs
@@ -11,7 +11,7 @@
 // ignore-fast
 // exec-env:RUST_LOG=logging-enabled=info
 
-#[feature(phase)];
+#![feature(phase)]
 #[phase(syntax, link)]
 extern crate log;
 
diff --git a/src/test/run-pass/macro-attributes.rs b/src/test/run-pass/macro-attributes.rs
index 58095137428..076305002e4 100644
--- a/src/test/run-pass/macro-attributes.rs
+++ b/src/test/run-pass/macro-attributes.rs
@@ -13,11 +13,11 @@
 #[feature(macro_rules)];
 
 macro_rules! compiles_fine {
-    ($at:attr) => {
+    (#[$at:meta]) => {
         // test that the different types of attributes work
         #[attribute]
         /// Documentation!
-        $at
+        #[$at]
 
         // check that the attributes are recognised by requiring this
         // to be removed to avoid a compile error
diff --git a/src/test/run-pass/macro-crate-def-only.rs b/src/test/run-pass/macro-crate-def-only.rs
index 2c2ffd50eae..75b001a71d2 100644
--- a/src/test/run-pass/macro-crate-def-only.rs
+++ b/src/test/run-pass/macro-crate-def-only.rs
@@ -11,7 +11,7 @@
 // aux-build:macro_crate_def_only.rs
 // ignore-fast
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate macro_crate_def_only;
diff --git a/src/test/run-pass/macro-export-inner-module.rs b/src/test/run-pass/macro-export-inner-module.rs
index 14c6423ce40..d77b360336c 100644
--- a/src/test/run-pass/macro-export-inner-module.rs
+++ b/src/test/run-pass/macro-export-inner-module.rs
@@ -12,7 +12,7 @@
 //ignore-stage1
 //ignore-fast
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 extern crate macro_export_inner_module;
diff --git a/src/test/run-pass/macro-meta-items.rs b/src/test/run-pass/macro-meta-items.rs
new file mode 100644
index 00000000000..cfcde320d99
--- /dev/null
+++ b/src/test/run-pass/macro-meta-items.rs
@@ -0,0 +1,44 @@
+// 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.
+//
+// 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.
+
+// ignore-fast
+// ignore-pretty - token trees can't pretty print
+// compile-flags: --cfg foo
+
+#[feature(macro_rules)];
+
+macro_rules! compiles_fine {
+    ($at:meta) => {
+        #[cfg($at)]
+        static MISTYPED: () = "foo";
+    }
+}
+macro_rules! emit {
+    ($at:meta) => {
+        #[cfg($at)]
+        static MISTYPED: &'static str = "foo";
+    }
+}
+
+// item
+compiles_fine!(bar)
+emit!(foo)
+
+fn foo() {
+    println!("{}", MISTYPED);
+}
+
+pub fn main() {
+    // statement
+    compiles_fine!(baz);
+    emit!(baz);
+    println!("{}", MISTYPED);
+}
+
diff --git a/src/test/run-pass/method-attributes.rs b/src/test/run-pass/method-attributes.rs
index db7440738da..87c43da9ebc 100644
--- a/src/test/run-pass/method-attributes.rs
+++ b/src/test/run-pass/method-attributes.rs
@@ -22,12 +22,12 @@ trait frobable {
 impl frobable for int {
     #[frob_attr1]
     fn frob(&self) {
-        #[frob_attr2];
+        #![frob_attr2]
     }
 
     #[defrob_attr1]
     fn defrob(&self) {
-        #[defrob_attr2];
+        #![defrob_attr2]
     }
 }
 
diff --git a/src/test/run-pass/module-qualified-struct-destructure.rs b/src/test/run-pass/module-qualified-struct-destructure.rs
index 5655ff8ff24..b1c1b64ba40 100644
--- a/src/test/run-pass/module-qualified-struct-destructure.rs
+++ b/src/test/run-pass/module-qualified-struct-destructure.rs
@@ -10,8 +10,8 @@
 
 mod m {
     pub struct S {
-        x: int,
-        y: int
+        pub x: int,
+        pub y: int
     }
 }
 
diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs
deleted file mode 100644
index 66bb2e702be..00000000000
--- a/src/test/run-pass/non-boolean-pure-fns.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// ignore-fast
-
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[feature(managed_boxes)];
-
-extern crate collections;
-
-use collections::list::{List, Cons, Nil};
-
-fn pure_length_go<T>(ls: @List<T>, acc: uint) -> uint {
-    match *ls { Nil => { acc } Cons(_, tl) => { pure_length_go(tl, acc + 1u) } }
-}
-
-fn pure_length<T>(ls: @List<T>) -> uint { pure_length_go(ls, 0u) }
-
-fn nonempty_list<T>(ls: @List<T>) -> bool { pure_length(ls) > 0u }
-
-fn safe_head<T:Clone>(ls: @List<T>) -> T {
-    assert!(!ls.is_empty());
-    return ls.head().unwrap().clone();
-}
-
-pub fn main() {
-    let mylist = @Cons(@1u, @Nil);
-    assert!((nonempty_list(mylist)));
-    assert_eq!(*safe_head(mylist), 1u);
-}
diff --git a/src/test/run-pass/out-of-stack.rs b/src/test/run-pass/out-of-stack.rs
index 9344c29d5ca..00861bd9b21 100644
--- a/src/test/run-pass/out-of-stack.rs
+++ b/src/test/run-pass/out-of-stack.rs
@@ -10,13 +10,16 @@
 
 // ignore-fast
 
-#[feature(asm)];
+#![feature(asm)]
 
 use std::io::Process;
 use std::os;
 use std::str;
 
 // lifted from the test module
+// Inlining to avoid llvm turning the recursive functions into tail calls,
+// which doesn't consume stack.
+#[inline(always)]
 pub fn black_box<T>(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } }
 
 fn silent_recurse() {
@@ -28,6 +31,7 @@ fn silent_recurse() {
 fn loud_recurse() {
     println!("hello!");
     loud_recurse();
+    black_box(()); // don't optimize this into a tail call. please.
 }
 
 fn main() {
diff --git a/src/test/run-pass/overloaded-autoderef-order.rs b/src/test/run-pass/overloaded-autoderef-order.rs
index 9deeff77364..1276171853f 100644
--- a/src/test/run-pass/overloaded-autoderef-order.rs
+++ b/src/test/run-pass/overloaded-autoderef-order.rs
@@ -29,8 +29,8 @@ impl<X, Y> Deref<Y> for DerefWrapper<X, Y> {
 
 mod priv_test {
     pub struct DerefWrapperHideX<X, Y> {
-        priv x: X,
-        y: Y
+        x: X,
+        pub y: Y
     }
 
     impl<X, Y> DerefWrapperHideX<X, Y> {
diff --git a/src/test/run-pass/parameterized-trait-with-bounds.rs b/src/test/run-pass/parameterized-trait-with-bounds.rs
new file mode 100644
index 00000000000..6200d04c802
--- /dev/null
+++ b/src/test/run-pass/parameterized-trait-with-bounds.rs
@@ -0,0 +1,27 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[allow(dead_code)];
+
+trait A<T> {}
+trait B<T, U> {}
+trait C<'a, U> {}
+
+mod foo {
+    pub trait D<'a, T> {}
+}
+
+fn foo1<T>(_: &A<T>: Send) {}
+fn foo2<T>(_: ~A<T>: Send + Share) {}
+fn foo3<T>(_: ~B<int, uint>: 'static) {}
+fn foo4<'a, T>(_: ~C<'a, T>: 'static + Send) {}
+fn foo5<'a, T>(_: ~foo::D<'a, T>: 'static + Send) {}
+
+pub fn main() {}
diff --git a/src/test/run-pass/phase-use-ignored.rs b/src/test/run-pass/phase-use-ignored.rs
index 2b1a74c74ac..008a04eaa49 100644
--- a/src/test/run-pass/phase-use-ignored.rs
+++ b/src/test/run-pass/phase-use-ignored.rs
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-#[feature(phase)];
+#![feature(phase)]
 
 #[phase(syntax)]
 use std::mem;
diff --git a/src/test/run-pass/privacy-ns.rs b/src/test/run-pass/privacy-ns.rs
index c933e5bc919..bc7df6bb599 100644
--- a/src/test/run-pass/privacy-ns.rs
+++ b/src/test/run-pass/privacy-ns.rs
@@ -13,7 +13,7 @@
 // Check we do the correct privacy checks when we import a name and there is an
 // item with that name in both the value and type namespaces.
 
-#[feature(globs)];
+#![feature(globs)]
 #[allow(dead_code)];
 #[allow(unused_imports)];
 
diff --git a/src/test/run-pass/reexport-star.rs b/src/test/run-pass/reexport-star.rs
index f6f7c9921ef..3b7696b548a 100644
--- a/src/test/run-pass/reexport-star.rs
+++ b/src/test/run-pass/reexport-star.rs
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
+#![feature(globs)]
 
 // FIXME #3654
 
diff --git a/src/test/run-pass/regions-early-bound-trait-param.rs b/src/test/run-pass/regions-early-bound-trait-param.rs
new file mode 100644
index 00000000000..f3cfa0b9d33
--- /dev/null
+++ b/src/test/run-pass/regions-early-bound-trait-param.rs
@@ -0,0 +1,135 @@
+// 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.
+
+// Tests that you can use an early-bound lifetime parameter as
+// on of the generic parameters in a trait.
+
+trait Trait<'a> {
+    fn long(&'a self) -> int;
+    fn short<'b>(&'b self) -> int;
+}
+
+fn poly_invoke<'c, T: Trait<'c>>(x: &'c T) -> (int, int) {
+    let l = x.long();
+    let s = x.short();
+    (l,s)
+}
+
+fn object_invoke1<'d>(x: &'d Trait<'d>) -> (int, int) {
+    let l = x.long();
+    let s = x.short();
+    (l,s)
+}
+
+struct Struct1<'e> {
+    f: &'e Trait<'e>
+}
+
+fn field_invoke1<'f, 'g>(x: &'g Struct1<'f>) -> (int,int) {
+    let l = x.f.long();
+    let s = x.f.short();
+    (l,s)
+}
+
+struct Struct2<'h, 'i> {
+    f: &'h Trait<'i>
+}
+
+fn object_invoke2<'j, 'k>(x: &'k Trait<'j>) -> int {
+    x.short()
+}
+
+fn field_invoke2<'l, 'm, 'n>(x: &'n Struct2<'l,'m>) -> int {
+    x.f.short()
+}
+
+trait MakerTrait<'o> {
+    fn mk() -> Self;
+}
+
+fn make_val<'p, T:MakerTrait<'p>>() -> T {
+    MakerTrait::mk()
+}
+
+trait RefMakerTrait<'q> {
+    fn mk(Self) -> &'q Self;
+}
+
+fn make_ref<'r, T:RefMakerTrait<'r>>(t:T) -> &'r T {
+    RefMakerTrait::mk(t)
+}
+
+impl<'s> Trait<'s> for (int,int) {
+    fn long(&'s self) -> int {
+        let &(x,_) = self;
+        x
+    }
+    fn short<'b>(&'b self) -> int {
+        let &(_,y) = self;
+        y
+    }
+}
+
+impl<'t> MakerTrait<'t> for ~Trait<'t> {
+    fn mk() -> ~Trait<'t> { ~(4,5) as ~Trait }
+}
+
+enum List<'l> {
+    Cons(int, &'l List<'l>),
+    Null
+}
+
+impl<'l> List<'l> {
+    fn car<'m>(&'m self) -> int {
+        match self {
+            &Cons(car, _) => car,
+            &Null => fail!(),
+        }
+    }
+    fn cdr<'n>(&'n self) -> &'l List<'l> {
+        match self {
+            &Cons(_, cdr) => cdr,
+            &Null => fail!(),
+        }
+    }
+}
+
+impl<'t> RefMakerTrait<'t> for List<'t> {
+    fn mk(l:List<'t>) -> &'t List<'t> {
+        l.cdr()
+    }
+}
+
+pub fn main() {
+    let t = (2,3);
+    let o = &t as &Trait;
+    let s1 = Struct1 { f: o };
+    let s2 = Struct2 { f: o };
+    assert_eq!(poly_invoke(&t), (2,3));
+    assert_eq!(object_invoke1(&t), (2,3));
+    assert_eq!(field_invoke1(&s1), (2,3));
+    assert_eq!(object_invoke2(&t), 3);
+    assert_eq!(field_invoke2(&s2), 3);
+
+    let m : ~Trait = make_val();
+    assert_eq!(object_invoke1(m), (4,5));
+    assert_eq!(object_invoke2(m), 5);
+
+    // The RefMakerTrait above is pretty strange (i.e. it is strange
+    // to consume a value of type T and return a &T).  Easiest thing
+    // that came to my mind: consume a cell of a linked list and
+    // return a reference to the list it points to.
+    let l0 = Null;
+    let l1 = Cons(1, &l0);
+    let l2 = Cons(2, &l1);
+    let rl1 = &l1;
+    let r  = make_ref(l2);
+    assert_eq!(rl1.car(), r.car());
+}
diff --git a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs
index 835b5990ac2..ac3dd80c383 100644
--- a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs
+++ b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs
@@ -18,7 +18,7 @@ fn test05_start(f: proc(int)) {
 
 fn test05() {
     let three = ~3;
-    let fn_to_send: proc(int) = proc(n) {
+    let fn_to_send: proc:Send(int) = proc(n) {
         println!("{}", *three + n); // will copy x into the closure
         assert_eq!(*three, 3);
     };
diff --git a/src/test/run-pass/sigpipe-should-be-ignored.rs b/src/test/run-pass/sigpipe-should-be-ignored.rs
new file mode 100644
index 00000000000..5c62ea2ad21
--- /dev/null
+++ b/src/test/run-pass/sigpipe-should-be-ignored.rs
@@ -0,0 +1,36 @@
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-fast
+
+// Be sure that when a SIGPIPE would have been received that the entire process
+// doesn't die in a ball of fire, but rather it's gracefully handled.
+
+use std::os;
+use std::io::{PipeStream, Process};
+
+fn test() {
+    let os::Pipe { input, out } = os::pipe();
+    let input = PipeStream::open(input);
+    let mut out = PipeStream::open(out);
+    drop(input);
+
+    let _ = out.write([1]);
+}
+
+fn main() {
+    let args = os::args();
+    if args.len() > 1 && args[1].as_slice() == "test" {
+        return test();
+    }
+
+    let mut p = Process::new(args[0], [~"test"]).unwrap();
+    assert!(p.wait().success());
+}
diff --git a/src/test/run-pass/simd-binop.rs b/src/test/run-pass/simd-binop.rs
index 85c6555d7ce..0c2744f6838 100644
--- a/src/test/run-pass/simd-binop.rs
+++ b/src/test/run-pass/simd-binop.rs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(experimental)];
+#![allow(experimental)]
 
 use std::unstable::simd::{i32x4, f32x4, u32x4};
 
diff --git a/src/test/run-pass/simd-generics.rs b/src/test/run-pass/simd-generics.rs
index 7ef8913a847..75062a46224 100644
--- a/src/test/run-pass/simd-generics.rs
+++ b/src/test/run-pass/simd-generics.rs
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-#[feature(simd)];
+#![feature(simd)]
 
 use std::ops;
 
diff --git a/src/test/run-pass/simd-issue-10604.rs b/src/test/run-pass/simd-issue-10604.rs
index 62dce696880..4e3c3afc5ad 100644
--- a/src/test/run-pass/simd-issue-10604.rs
+++ b/src/test/run-pass/simd-issue-10604.rs
@@ -10,8 +10,8 @@
 
 // ignore-fast
 
-#[allow(experimental)];
-#[feature(simd)];
+#![allow(experimental)]
+#![feature(simd)]
 
 pub fn main() {
     let _o = None::<std::unstable::simd::i32x4>;
diff --git a/src/test/run-pass/simd-type.rs b/src/test/run-pass/simd-type.rs
index 4506a694252..c79f285e486 100644
--- a/src/test/run-pass/simd-type.rs
+++ b/src/test/run-pass/simd-type.rs
@@ -10,7 +10,7 @@
 
 // ignore-fast feature doesn't work
 
-#[feature(simd)];
+#![feature(simd)]
 
 #[simd]
 struct RGBA {
diff --git a/src/test/run-pass/tag-exports.rs b/src/test/run-pass/tag-exports.rs
index 2fd6be40d11..bc749b5d905 100644
--- a/src/test/run-pass/tag-exports.rs
+++ b/src/test/run-pass/tag-exports.rs
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
+#![feature(globs)]
 
 use alder::*;
 
diff --git a/src/test/run-pass/tcp-stress.rs b/src/test/run-pass/tcp-stress.rs
index 61478e3fdb4..d18e2ac7354 100644
--- a/src/test/run-pass/tcp-stress.rs
+++ b/src/test/run-pass/tcp-stress.rs
@@ -13,7 +13,7 @@
 // ignore-android needs extra network permissions
 // exec-env:RUST_LOG=debug
 
-#[feature(phase)];
+#![feature(phase)]
 #[phase(syntax, link)]
 extern crate log;
 
diff --git a/src/test/run-pass/tempfile.rs b/src/test/run-pass/tempfile.rs
index 873269190c5..e2806421518 100644
--- a/src/test/run-pass/tempfile.rs
+++ b/src/test/run-pass/tempfile.rs
@@ -36,7 +36,7 @@ fn test_tempdir() {
 
 fn test_rm_tempdir() {
     let (tx, rx) = channel();
-    let f: proc() = proc() {
+    let f: proc:Send() = proc() {
         let tmp = TempDir::new("test_rm_tempdir").unwrap();
         tx.send(tmp.path().clone());
         fail!("fail to unwind past `tmp`");
@@ -47,7 +47,7 @@ fn test_rm_tempdir() {
 
     let tmp = TempDir::new("test_rm_tempdir").unwrap();
     let path = tmp.path().clone();
-    let f: proc() = proc() {
+    let f: proc:Send() = proc() {
         let _tmp = tmp;
         fail!("fail to unwind past `tmp`");
     };
@@ -56,7 +56,7 @@ fn test_rm_tempdir() {
 
     let path;
     {
-        let f: proc() -> TempDir = proc() {
+        let f = proc() {
             TempDir::new("test_rm_tempdir").unwrap()
         };
         let tmp = task::try(f).ok().expect("test_rm_tmdir");
diff --git a/src/test/run-pass/trait-bounds-basic.rs b/src/test/run-pass/trait-bounds-basic.rs
index acc3ca508b2..6059e5e95ee 100644
--- a/src/test/run-pass/trait-bounds-basic.rs
+++ b/src/test/run-pass/trait-bounds-basic.rs
@@ -26,7 +26,7 @@ fn d(x: ~Foo:Send) {
 }
 
 fn e(x: ~Foo) { // sugar for ~Foo:Owned
-    b(x);
+    a(x);
 }
 
 pub fn main() { }
diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs
index 490c77d98cd..7a53df8737c 100644
--- a/src/test/run-pass/trait-cast.rs
+++ b/src/test/run-pass/trait-cast.rs
@@ -18,7 +18,7 @@ struct Tree(@RefCell<TreeR>);
 struct TreeR {
     left: Option<Tree>,
     right: Option<Tree>,
-    val: ~to_str
+    val: ~to_str:Send
 }
 
 trait to_str {
@@ -53,10 +53,10 @@ fn foo<T:to_str>(x: T) -> ~str { x.to_str_() }
 pub fn main() {
     let t1 = Tree(@RefCell::new(TreeR{left: None,
                                       right: None,
-                                      val: ~1 as ~to_str}));
+                                      val: ~1 as ~to_str:Send}));
     let t2 = Tree(@RefCell::new(TreeR{left: Some(t1),
                                       right: Some(t1),
-                                      val: ~2 as ~to_str}));
+                                      val: ~2 as ~to_str:Send}));
     let expected = ~"[2, some([1, none, none]), some([1, none, none])]";
     assert!(t2.to_str_() == expected);
     assert!(foo(t2) == expected);
diff --git a/src/test/run-pass/trait-default-method-xc.rs b/src/test/run-pass/trait-default-method-xc.rs
index c0344136059..0974efa00ee 100644
--- a/src/test/run-pass/trait-default-method-xc.rs
+++ b/src/test/run-pass/trait-default-method-xc.rs
@@ -24,7 +24,7 @@ fn welp<T>(i: int, _x: &T) -> int {
 }
 
 mod stuff {
-    pub struct thing { x: int }
+    pub struct thing { pub x: int }
 }
 
 impl A for stuff::thing {
diff --git a/src/test/run-pass/uniq-cc-generic.rs b/src/test/run-pass/uniq-cc-generic.rs
index 41e921ff6e4..78fa7520f33 100644
--- a/src/test/run-pass/uniq-cc-generic.rs
+++ b/src/test/run-pass/uniq-cc-generic.rs
@@ -19,12 +19,11 @@ enum maybe_pointy {
 
 struct Pointy {
     a : maybe_pointy,
-    d : proc() -> uint,
+    d : proc:Send() -> uint,
 }
 
-fn make_uniq_closure<A:Send>(a: A) -> proc() -> uint {
-    let result: proc() -> uint = proc() &a as *A as uint;
-    result
+fn make_uniq_closure<A:Send>(a: A) -> proc:Send() -> uint {
+    proc() { &a as *A as uint }
 }
 
 fn empty_pointy() -> @RefCell<Pointy> {
diff --git a/src/test/run-pass/uniq-cc.rs b/src/test/run-pass/uniq-cc.rs
index 57fc9ac6773..aa048a239db 100644
--- a/src/test/run-pass/uniq-cc.rs
+++ b/src/test/run-pass/uniq-cc.rs
@@ -20,7 +20,7 @@ enum maybe_pointy {
 struct Pointy {
     a : maybe_pointy,
     c : ~int,
-    d : proc()->(),
+    d : proc:Send()->(),
 }
 
 fn empty_pointy() -> @RefCell<Pointy> {
diff --git a/src/test/run-pass/use.rs b/src/test/run-pass/use.rs
index 1d65a0a5e9e..fb021411508 100644
--- a/src/test/run-pass/use.rs
+++ b/src/test/run-pass/use.rs
@@ -17,7 +17,7 @@
 #[no_std];
 extern crate std;
 extern crate zed = "std";
-extern crate bar = "std#0.10-pre";
+extern crate bar = "std#0.11-pre";
 
 
 use std::str;
diff --git a/src/test/run-pass/utf8.rs b/src/test/run-pass/utf8.rs
index 9531563fcbe..c7763617269 100644
--- a/src/test/run-pass/utf8.rs
+++ b/src/test/run-pass/utf8.rs
@@ -44,7 +44,7 @@ pub fn main() {
         for ab in a.bytes() {
             println!("{}", i);
             println!("{}", ab);
-            let bb: u8 = b[i];
+            let bb: u8 = b[i as uint];
             println!("{}", bb);
             assert_eq!(ab, bb);
             i += 1;
diff --git a/src/test/run-pass/vec-concat.rs b/src/test/run-pass/vec-concat.rs
index 84900a4453e..a0400a9dcc5 100644
--- a/src/test/run-pass/vec-concat.rs
+++ b/src/test/run-pass/vec-concat.rs
@@ -13,7 +13,7 @@ use std::vec;
 pub fn main() {
     let a: Vec<int> = vec!(1, 2, 3, 4, 5);
     let b: Vec<int> = vec!(6, 7, 8, 9, 0);
-    let v: Vec<int> = vec::append(a, b.as_slice());
+    let v: Vec<int> = a.append(b.as_slice());
     println!("{}", *v.get(9));
     assert_eq!(*v.get(0), 1);
     assert_eq!(*v.get(7), 8);
diff --git a/src/test/run-pass/vec-macro-with-brackets.rs b/src/test/run-pass/vec-macro-with-brackets.rs
new file mode 100644
index 00000000000..87b18f841ed
--- /dev/null
+++ b/src/test/run-pass/vec-macro-with-brackets.rs
@@ -0,0 +1,23 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(macro_rules)]
+
+macro_rules! vec [
+    ($($e:expr),*) => ({
+        let mut _temp = ::std::vec::Vec::new();
+        $(_temp.push($e);)*
+        _temp
+    })
+]
+
+pub fn main() {
+    let my_vec = vec![1, 2, 3, 4, 5];
+}
diff --git a/src/test/run-pass/vector-sort-failure-safe.rs b/src/test/run-pass/vector-sort-failure-safe.rs
index e307ae36f96..0190355e127 100644
--- a/src/test/run-pass/vector-sort-failure-safe.rs
+++ b/src/test/run-pass/vector-sort-failure-safe.rs
@@ -52,7 +52,7 @@ pub fn main() {
             // work out the total number of comparisons required to sort
             // this array...
             let mut count = 0;
-            main.clone().sort_by(|a, b| { count += 1; a.cmp(b) });
+            main.clone().as_mut_slice().sort_by(|a, b| { count += 1; a.cmp(b) });
 
             // ... and then fail on each and every single one.
             for fail_countdown in range(0, count) {
@@ -67,7 +67,7 @@ pub fn main() {
                 task::try(proc() {
                         let mut v = v;
                         let mut fail_countdown = fail_countdown;
-                        v.sort_by(|a, b| {
+                        v.as_mut_slice().sort_by(|a, b| {
                                 if fail_countdown == 0 {
                                     fail!()
                                 }
diff --git a/src/test/run-pass/warn-ctypes-inhibit.rs b/src/test/run-pass/warn-ctypes-inhibit.rs
index 30ce7715311..9b0a2340156 100644
--- a/src/test/run-pass/warn-ctypes-inhibit.rs
+++ b/src/test/run-pass/warn-ctypes-inhibit.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// 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.
 //
@@ -10,7 +10,7 @@
 
 // compile-flags:-D ctypes
 
-#[allow(ctypes)];
+#![allow(ctypes)]
 
 mod libc {
     extern {