about summary refs log tree commit diff
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-03-01 07:01:48 -0800
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-03-01 07:01:48 -0800
commit85fecd0ba77066e604cec9d3866b76edc626b5d3 (patch)
treea375b9e61af4c5e105b58271c9381fdaf58d31b0
parentd2c4b6492dbccc1bb60f163ac583467bc63abce6 (diff)
parenta660bb362ce5a39014fb274367e6361d4deb8a7d (diff)
downloadrust-85fecd0ba77066e604cec9d3866b76edc626b5d3.tar.gz
rust-85fecd0ba77066e604cec9d3866b76edc626b5d3.zip
Merge remote-tracking branch 'remotes/origin/incoming' into incoming
-rw-r--r--doc/tutorial.md3
-rw-r--r--src/etc/gedit/readme.txt11
-rw-r--r--src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang264
-rw-r--r--src/etc/gedit/share/mime/packages/rust.xml7
-rw-r--r--src/libcore/cell.rs2
-rw-r--r--src/libcore/comm.rs9
-rw-r--r--src/libcore/condition.rs4
-rw-r--r--src/libcore/core.rc4
-rw-r--r--src/libcore/dlist.rs6
-rw-r--r--src/libcore/dvec.rs27
-rw-r--r--src/libcore/hashmap.rs13
-rw-r--r--src/libcore/io.rs14
-rw-r--r--src/libcore/mutable.rs2
-rw-r--r--src/libcore/option.rs6
-rw-r--r--src/libcore/os.rs20
-rw-r--r--src/libcore/path.rs8
-rw-r--r--src/libcore/pipes.rs6
-rw-r--r--src/libcore/private.rs194
-rw-r--r--src/libcore/private/extfmt.rs2
-rw-r--r--src/libcore/private/finally.rs23
-rw-r--r--src/libcore/rand.rs14
-rw-r--r--src/libcore/reflect.rs2
-rw-r--r--src/libcore/repr.rs6
-rw-r--r--src/libcore/result.rs6
-rw-r--r--src/libcore/run.rs2
-rw-r--r--src/libcore/stackwalk.rs3
-rw-r--r--src/libcore/str.rs1
-rw-r--r--src/libcore/task/local_data_priv.rs2
-rw-r--r--src/libcore/task/mod.rs2
-rw-r--r--src/libcore/vec.rs3
-rw-r--r--src/librustc/metadata/common.rs6
-rw-r--r--src/librustc/metadata/csearch.rs8
-rw-r--r--src/librustc/metadata/decoder.rs19
-rw-r--r--src/librustc/metadata/encoder.rs63
-rw-r--r--src/librustc/metadata/filesearch.rs4
-rw-r--r--src/librustc/middle/astencode.rs12
-rw-r--r--src/librustc/middle/borrowck/check_loans.rs4
-rw-r--r--src/librustc/middle/borrowck/gather_loans.rs2
-rw-r--r--src/librustc/middle/borrowck/loan.rs2
-rw-r--r--src/librustc/middle/borrowck/mod.rs4
-rw-r--r--src/librustc/middle/borrowck/preserve.rs6
-rw-r--r--src/librustc/middle/lang_items.rs2
-rw-r--r--src/librustc/middle/lint.rs2
-rw-r--r--src/librustc/middle/liveness.rs8
-rw-r--r--src/librustc/middle/mem_categorization.rs2
-rw-r--r--src/librustc/middle/moves.rs4
-rw-r--r--src/librustc/middle/privacy.rs71
-rw-r--r--src/librustc/middle/resolve.rs23
-rw-r--r--src/librustc/middle/trans/_match.rs15
-rw-r--r--src/librustc/middle/trans/base.rs5
-rw-r--r--src/librustc/middle/trans/build.rs4
-rw-r--r--src/librustc/middle/trans/cabi.rs12
-rw-r--r--src/librustc/middle/trans/cabi_arm.rs4
-rw-r--r--src/librustc/middle/trans/cabi_x86_64.rs10
-rw-r--r--src/librustc/middle/trans/callee.rs18
-rw-r--r--src/librustc/middle/trans/closure.rs9
-rw-r--r--src/librustc/middle/trans/common.rs7
-rw-r--r--src/librustc/middle/trans/consts.rs4
-rw-r--r--src/librustc/middle/trans/controlflow.rs17
-rw-r--r--src/librustc/middle/trans/datum.rs14
-rw-r--r--src/librustc/middle/trans/expr.rs16
-rw-r--r--src/librustc/middle/trans/foreign.rs3
-rw-r--r--src/librustc/middle/trans/glue.rs25
-rw-r--r--src/librustc/middle/trans/inline.rs3
-rw-r--r--src/librustc/middle/trans/machine.rs5
-rw-r--r--src/librustc/middle/trans/meth.rs36
-rw-r--r--src/librustc/middle/trans/monomorphize.rs5
-rw-r--r--src/librustc/middle/trans/reachable.rs4
-rw-r--r--src/librustc/middle/trans/reflect.rs7
-rw-r--r--src/librustc/middle/trans/shape.rs1
-rw-r--r--src/librustc/middle/trans/tvec.rs23
-rw-r--r--src/librustc/middle/trans/type_of.rs6
-rw-r--r--src/librustc/middle/trans/type_use.rs4
-rw-r--r--src/librustc/middle/trans/uniq.rs1
-rw-r--r--src/librustc/middle/ty.rs4
-rw-r--r--src/librustc/middle/typeck/check/vtable.rs230
-rw-r--r--src/librustc/middle/typeck/infer/coercion.rs2
-rw-r--r--src/librustc/middle/typeck/infer/combine.rs2
-rw-r--r--src/librustc/middle/typeck/infer/glb.rs5
-rw-r--r--src/librustc/middle/typeck/infer/lattice.rs3
-rw-r--r--src/librustc/middle/typeck/infer/lub.rs5
-rw-r--r--src/librustc/middle/typeck/infer/mod.rs4
-rw-r--r--src/librustc/middle/typeck/infer/region_inference.rs2
-rw-r--r--src/librustc/middle/typeck/infer/sub.rs6
-rw-r--r--src/librustc/middle/typeck/infer/test.rs2
-rw-r--r--src/librustc/middle/typeck/rscope.rs6
-rw-r--r--src/librustdoc/doc.rs4
-rw-r--r--src/librustdoc/sort_item_type_pass.rs2
-rw-r--r--src/libstd/arc.rs79
-rw-r--r--src/libstd/arena.rs2
-rw-r--r--src/libstd/bitv.rs8
-rw-r--r--src/libstd/deque.rs5
-rw-r--r--src/libstd/ebml.rs6
-rw-r--r--src/libstd/flatpipes.rs3
-rw-r--r--src/libstd/future.rs6
-rw-r--r--src/libstd/getopts.rs2
-rw-r--r--src/libstd/json.rs1
-rw-r--r--src/libstd/net_tcp.rs2
-rw-r--r--src/libstd/net_url.rs168
-rw-r--r--src/libstd/oldmap.rs8
-rw-r--r--src/libstd/priority_queue.rs2
-rw-r--r--src/libstd/sha1.rs4
-rw-r--r--src/libstd/sort.rs2
-rw-r--r--src/libstd/sync.rs25
-rw-r--r--src/libstd/test.rs24
-rw-r--r--src/libstd/time.rs19
-rw-r--r--src/libstd/treemap.rs16
-rw-r--r--src/libstd/uv_global_loop.rs2
-rw-r--r--src/libstd/uv_iotask.rs214
-rw-r--r--src/libstd/uv_ll.rs3
-rw-r--r--src/libstd/workcache.rs10
-rw-r--r--src/libsyntax/ast.rs2
-rw-r--r--src/libsyntax/ast_map.rs1
-rw-r--r--src/libsyntax/ast_util.rs2
-rw-r--r--src/libsyntax/ext/auto_encode.rs9
-rw-r--r--src/libsyntax/ext/base.rs5
-rw-r--r--src/libsyntax/ext/concat_idents.rs3
-rw-r--r--src/libsyntax/ext/deriving.rs2
-rw-r--r--src/libsyntax/ext/env.rs7
-rw-r--r--src/libsyntax/ext/expand.rs13
-rw-r--r--src/libsyntax/ext/fmt.rs1
-rw-r--r--src/libsyntax/ext/log_syntax.rs6
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs2
-rw-r--r--src/libsyntax/ext/pipes/parse_proto.rs2
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs3
-rw-r--r--src/libsyntax/ext/quote.rs8
-rw-r--r--src/libsyntax/ext/source_util.rs2
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs2
-rw-r--r--src/libsyntax/fold.rs239
-rw-r--r--src/libsyntax/parse/attr.rs1
-rw-r--r--src/libsyntax/parse/lexer.rs8
-rw-r--r--src/libsyntax/parse/mod.rs4
-rw-r--r--src/libsyntax/parse/prec.rs1
-rw-r--r--src/libsyntax/print/pprust.rs7
-rw-r--r--src/libsyntax/visit.rs1
-rw-r--r--src/rt/rust_kernel.cpp7
-rw-r--r--src/snapshots.txt8
-rw-r--r--src/test/auxiliary/cci_class_5.rs4
-rw-r--r--src/test/auxiliary/impl_privacy_xc_1.rs2
-rw-r--r--src/test/auxiliary/issue-2380.rs2
-rw-r--r--src/test/auxiliary/issue_2472_b.rs2
-rw-r--r--src/test/bench/core-set.rs2
-rw-r--r--src/test/bench/noise.rs2
-rw-r--r--src/test/bench/shootout-mandelbrot.rs2
-rw-r--r--src/test/compile-fail/assign-to-method.rs2
-rw-r--r--src/test/compile-fail/borrowck-autoref-3261.rs2
-rw-r--r--src/test/compile-fail/borrowck-call-method-from-mut-aliasable.rs2
-rw-r--r--src/test/compile-fail/borrowck-insert-during-each.rs2
-rw-r--r--src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs2
-rw-r--r--src/test/compile-fail/class-cast-to-trait.rs4
-rw-r--r--src/test/compile-fail/issue-2356.rs2
-rw-r--r--src/test/compile-fail/issue-2766-a.rs2
-rw-r--r--src/test/compile-fail/issue-3021-b.rs2
-rw-r--r--src/test/compile-fail/issue-3080.rs2
-rw-r--r--src/test/compile-fail/issue-3311.rs2
-rw-r--r--src/test/compile-fail/issue-3707.rs2
-rw-r--r--src/test/compile-fail/issue-3763.rs2
-rw-r--r--src/test/compile-fail/issue-4366.rs39
-rw-r--r--src/test/compile-fail/kindck-owned-trait-contains.rs2
-rw-r--r--src/test/compile-fail/kindck-owned-trait-scoped.rs6
-rw-r--r--src/test/compile-fail/kindck-owned-trait.rs4
-rw-r--r--src/test/compile-fail/map-types.rs4
-rw-r--r--src/test/compile-fail/mutable-class-fields-2.rs2
-rw-r--r--src/test/compile-fail/private-method-cross-crate.rs4
-rw-r--r--src/test/compile-fail/private-method-inherited.rs15
-rw-r--r--src/test/compile-fail/regions-addr-of-self.rs2
-rw-r--r--src/test/compile-fail/regions-addr-of-upvar-self.rs2
-rw-r--r--src/test/compile-fail/regions-trait-1.rs2
-rw-r--r--src/test/compile-fail/regions-trait-2.rs2
-rw-r--r--src/test/compile-fail/regions-trait-3.rs2
-rw-r--r--src/test/compile-fail/selftype-astparam.rs4
-rw-r--r--src/test/compile-fail/tps-invariant-trait.rs2
-rw-r--r--src/test/compile-fail/trait-cast.rs2
-rw-r--r--src/test/compile-fail/trait-or-new-type-instead.rs2
-rw-r--r--src/test/compile-fail/trait-test-2.rs2
-rw-r--r--src/test/compile-fail/use-after-move-self-based-on-type.rs2
-rw-r--r--src/test/compile-fail/use-after-move-self.rs2
-rw-r--r--src/test/pretty/record-trailing-comma.rs4
-rw-r--r--src/test/run-fail/unwind-box-trait.rs2
-rw-r--r--src/test/run-pass/anon-trait-static-method.rs2
-rw-r--r--src/test/run-pass/auto-ref-newtype.rs2
-rw-r--r--src/test/run-pass/autoderef-and-borrow-method-receiver.rs2
-rw-r--r--src/test/run-pass/autoderef-method-on-trait-monomorphized.rs2
-rw-r--r--src/test/run-pass/autoderef-method-on-trait.rs2
-rw-r--r--src/test/run-pass/borrowck-wg-borrow-mut-to-imm-3.rs2
-rw-r--r--src/test/run-pass/boxed-trait-with-vstore.rs2
-rw-r--r--src/test/run-pass/class-cast-to-trait-cross-crate-2.rs2
-rw-r--r--src/test/run-pass/class-cast-to-trait-multiple-types.rs8
-rw-r--r--src/test/run-pass/class-cast-to-trait.rs4
-rw-r--r--src/test/run-pass/class-impl-very-parameterized-trait.rs4
-rw-r--r--src/test/run-pass/class-implement-trait-cross-crate.rs2
-rw-r--r--src/test/run-pass/class-implement-traits.rs2
-rw-r--r--src/test/run-pass/class-methods.rs2
-rw-r--r--src/test/run-pass/class-poly-methods.rs2
-rw-r--r--src/test/run-pass/class-separate-impl.rs4
-rw-r--r--src/test/run-pass/class-typarams.rs2
-rw-r--r--src/test/run-pass/classes-simple-method.rs2
-rw-r--r--src/test/run-pass/classes.rs2
-rw-r--r--src/test/run-pass/coerce-reborrow-imm-ptr-rcvr.rs2
-rw-r--r--src/test/run-pass/coerce-reborrow-mut-ptr-rcvr.rs2
-rw-r--r--src/test/run-pass/const-enum-byref-self.rs2
-rw-r--r--src/test/run-pass/explicit-self-closures.rs2
-rw-r--r--src/test/run-pass/explicit-self-generic.rs2
-rw-r--r--src/test/run-pass/explicit-self-objects-ext-1.rs2
-rw-r--r--src/test/run-pass/explicit-self-objects-ext-2.rs2
-rw-r--r--src/test/run-pass/explicit-self-objects-ext-3.rs2
-rw-r--r--src/test/run-pass/explicit-self-objects-ext-4.rs2
-rw-r--r--src/test/run-pass/explicit-self.rs4
-rw-r--r--src/test/run-pass/impl-implicit-trait.rs4
-rw-r--r--src/test/run-pass/issue-2288.rs2
-rw-r--r--src/test/run-pass/issue-2311-2.rs2
-rw-r--r--src/test/run-pass/issue-2312.rs2
-rw-r--r--src/test/run-pass/issue-2445-b.rs4
-rw-r--r--src/test/run-pass/issue-2445.rs4
-rw-r--r--src/test/run-pass/issue-2487-a.rs2
-rw-r--r--src/test/run-pass/issue-2502.rs2
-rw-r--r--src/test/run-pass/issue-2734.rs2
-rw-r--r--src/test/run-pass/issue-2735.rs6
-rw-r--r--src/test/run-pass/issue-2904.rs2
-rw-r--r--src/test/run-pass/issue-2935.rs2
-rw-r--r--src/test/run-pass/issue-3220.rs2
-rw-r--r--src/test/run-pass/issue-3305.rs2
-rw-r--r--src/test/run-pass/issue-3447.rs2
-rw-r--r--src/test/run-pass/issue-3860.rs2
-rw-r--r--src/test/run-pass/issue-3904.rs2
-rw-r--r--src/test/run-pass/kindck-owned-trait-contains-1.rs2
-rw-r--r--src/test/run-pass/max-min-classes.rs2
-rw-r--r--src/test/run-pass/move-self.rs2
-rw-r--r--src/test/run-pass/nested-class.rs2
-rw-r--r--src/test/run-pass/operator-overloading-explicit-self.rs2
-rw-r--r--src/test/run-pass/pipe-select-macro.rs2
-rw-r--r--src/test/run-pass/private-class-field.rs2
-rw-r--r--src/test/run-pass/private-method.rs2
-rw-r--r--src/test/run-pass/reflect-visit-data.rs8
-rw-r--r--src/test/run-pass/regions-trait.rs2
-rw-r--r--src/test/run-pass/resource-destruct.rs2
236 files changed, 1504 insertions, 1192 deletions
diff --git a/doc/tutorial.md b/doc/tutorial.md
index f9408761877..d31fbbb0c07 100644
--- a/doc/tutorial.md
+++ b/doc/tutorial.md
@@ -2304,11 +2304,10 @@ mod farm {
         farmer: Human
     }
 
-    // Note - visibility modifiers on impls currently have no effect
     impl Farm {
         priv fn feed_chickens(&self) { ... }
         priv fn feed_cows(&self) { ... }
-        fn add_chicken(&self, c: Chicken) { ... }
+        pub fn add_chicken(&self, c: Chicken) { ... }
     }
 
     pub fn feed_animals(farm: &Farm) {
diff --git a/src/etc/gedit/readme.txt b/src/etc/gedit/readme.txt
new file mode 100644
index 00000000000..735b0236276
--- /dev/null
+++ b/src/etc/gedit/readme.txt
@@ -0,0 +1,11 @@
+Add syntax highlighting for Mozilla Rust in GtkSourceView (used by GEdit).
+
+
+Instructions for Ubuntu Linux 12.04+
+
+1) Close all instances of GEdit
+
+2) Copy the included "share" folder into "~/.local/"
+
+3) Open a shell in "~/.local/share/" and run "update-mime-database mime"
+
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
new file mode 100644
index 00000000000..0b23808b765
--- /dev/null
+++ b/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang
@@ -0,0 +1,264 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Syntax highlighting for the under-development Mozilla Rust language -->
+
+<language id="rust" _name="Rust" version="2.0" _section="Sources">
+  <metadata>
+    <property name="mimetypes">text/x-rust</property>
+    <property name="globs">*.rs;*.rc</property>
+    <property name="line-comment-start">//</property>
+    <property name="block-comment-start">/*</property>
+    <property name="block-comment-end">*/</property>
+  </metadata>
+
+  <styles>
+    <style id="comment" _name="Comment" map-to="def:comment"/>
+    <style id="string" _name="String" map-to="def:string"/>
+    <style id="char" _name="Character" map-to="def:character"/>
+    <style id="keyword" _name="Keyword" map-to="def:keyword"/>
+    <style id="type" _name="Data Type" map-to="def:type"/>
+    <style id="constant" _name="Constant" map-to="def:constant"/>
+    <style id="identifier" _name="Identifier" map-to="def:identifier"/>
+    <style id="number" _name="Number" map-to="def:decimal"/>
+    <style id="scope" _name="Scope" map-to="def:preprocessor"/>
+  </styles>
+
+  <definitions>
+
+    <context id="function" style-ref="keyword">
+		<keyword>fn</keyword>
+    </context>
+
+    <context id="type" style-ref="keyword">
+		<keyword>type</keyword>
+    </context>
+
+    <context id="keywords" style-ref="keyword">
+		<keyword>as</keyword>
+		<keyword>assert</keyword>
+		<keyword>break</keyword>
+		<keyword>const</keyword>
+		<keyword>copy</keyword>
+		<keyword>do</keyword>
+		<keyword>drop</keyword>
+		<keyword>else</keyword>
+		<keyword>enum</keyword>
+		<keyword>export</keyword>
+		<keyword>extern</keyword>
+		<keyword>fail</keyword>
+		<keyword>for</keyword>
+		<keyword>if</keyword>
+		<keyword>impl</keyword>
+		<keyword>let</keyword>
+		<keyword>log</keyword>
+		<keyword>loop</keyword>
+		<keyword>match</keyword>
+		<keyword>mod</keyword>
+		<keyword>move</keyword>
+		<keyword>mut</keyword>
+		<keyword>priv</keyword>
+		<keyword>pub</keyword>
+		<keyword>pure</keyword>
+		<keyword>ref</keyword>
+		<keyword>return</keyword>
+		<keyword>static</keyword>
+		<keyword>struct</keyword>
+		<keyword>trait</keyword>
+		<keyword>unsafe</keyword>
+		<keyword>use</keyword>
+		<keyword>while</keyword>
+    </context>
+
+    <context id="types" style-ref="type">
+		<keyword>bool</keyword>
+		<keyword>int</keyword>
+		<keyword>uint</keyword>
+		<keyword>i8</keyword>
+		<keyword>i16</keyword>
+		<keyword>i32</keyword>
+		<keyword>i64</keyword>
+		<keyword>u8</keyword>
+		<keyword>u16</keyword>
+		<keyword>u32</keyword>
+		<keyword>u64</keyword>
+		<keyword>f32</keyword>
+		<keyword>f64</keyword>
+		<keyword>float</keyword>
+		<keyword>char</keyword>
+		<keyword>str</keyword>
+		<keyword>Either</keyword>
+		<keyword>Option</keyword>
+		<keyword>Result</keyword>
+    </context>
+
+    <context id="ctypes" style-ref="type">
+		<keyword>c_float</keyword>
+		<keyword>c_double</keyword>
+		<keyword>c_void</keyword>
+		<keyword>FILE</keyword>
+		<keyword>fpos_t</keyword>
+		<keyword>DIR</keyword>
+		<keyword>dirent</keyword>
+		<keyword>c_char</keyword>
+		<keyword>c_schar</keyword>
+		<keyword>c_uchar</keyword>
+		<keyword>c_short</keyword>
+		<keyword>c_ushort</keyword>
+		<keyword>c_int</keyword>
+		<keyword>c_uint</keyword>
+		<keyword>c_long</keyword>
+		<keyword>c_ulong</keyword>
+		<keyword>size_t</keyword>
+		<keyword>ptrdiff_t</keyword>
+		<keyword>clock_t</keyword>
+		<keyword>time_t</keyword>
+		<keyword>c_longlong</keyword>
+		<keyword>c_ulonglong</keyword>
+		<keyword>intptr_t</keyword>
+		<keyword>uintptr_t</keyword>
+		<keyword>off_t</keyword>
+		<keyword>dev_t</keyword>
+		<keyword>ino_t</keyword>
+		<keyword>pid_t</keyword>
+		<keyword>mode_t</keyword>
+		<keyword>ssize_t</keyword>
+    </context>
+    
+    <context id="self" style-ref="identifier">
+		<keyword>self</keyword>
+    </context>
+    
+    <context id="constants" style-ref="constant">
+		<keyword>true</keyword>
+		<keyword>false</keyword>
+		<keyword>Some</keyword>
+		<keyword>None</keyword>
+		<keyword>Left</keyword>
+		<keyword>Right</keyword>
+		<keyword>Ok</keyword>
+		<keyword>Err</keyword>
+		<keyword>Success</keyword>
+		<keyword>Failure</keyword>
+		<keyword>Cons</keyword>
+		<keyword>Nil</keyword>
+    </context>
+
+    <context id="cconstants" style-ref="constant">
+		<keyword>EXIT_FAILURE</keyword>
+		<keyword>EXIT_SUCCESS</keyword>
+		<keyword>RAND_MAX</keyword>
+		<keyword>EOF</keyword>
+		<keyword>SEEK_SET</keyword>
+		<keyword>SEEK_CUR</keyword>
+		<keyword>SEEK_END</keyword>
+		<keyword>_IOFBF</keyword>
+		<keyword>_IONBF</keyword>
+		<keyword>_IOLBF</keyword>
+		<keyword>BUFSIZ</keyword>
+		<keyword>FOPEN_MAX</keyword>
+		<keyword>FILENAME_MAX</keyword>
+		<keyword>L_tmpnam</keyword>
+		<keyword>TMP_MAX</keyword>
+		<keyword>O_RDONLY</keyword>
+		<keyword>O_WRONLY</keyword>
+		<keyword>O_RDWR</keyword>
+		<keyword>O_APPEND</keyword>
+		<keyword>O_CREAT</keyword>
+		<keyword>O_EXCL</keyword>
+		<keyword>O_TRUNC</keyword>
+		<keyword>S_IFIFO</keyword>
+		<keyword>S_IFCHR</keyword>
+		<keyword>S_IFBLK</keyword>
+		<keyword>S_IFDIR</keyword>
+		<keyword>S_IFREG</keyword>
+		<keyword>S_IFMT</keyword>
+		<keyword>S_IEXEC</keyword>
+		<keyword>S_IWRITE</keyword>
+		<keyword>S_IREAD</keyword>
+		<keyword>S_IRWXU</keyword>
+		<keyword>S_IXUSR</keyword>
+		<keyword>S_IWUSR</keyword>
+		<keyword>S_IRUSR</keyword>
+		<keyword>F_OK</keyword>
+		<keyword>R_OK</keyword>
+		<keyword>W_OK</keyword>
+		<keyword>X_OK</keyword>
+		<keyword>STDIN_FILENO</keyword>
+		<keyword>STDOUT_FILENO</keyword>
+		<keyword>STDERR_FILENO</keyword>
+    </context>
+
+    <context id="line-comment" style-ref="comment" end-at-line-end="true" class="comment" class-disabled="no-spell-check">
+      <start>//</start>
+      <include>
+        <context ref="def:in-line-comment"/>
+      </include>
+    </context>
+
+    <context id="block-comment" style-ref="comment" class="comment" class-disabled="no-spell-check">
+      <start>/\*</start>
+      <end>\*/</end>
+      <include>
+        <context ref="def:in-comment"/>
+      </include>
+    </context>
+
+    <context id="number" style-ref="number">
+      <match extended="true">
+        (?&lt;![\w\.])
+        (
+        0x[0-9a-fA-F_]+(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?|
+        0b[0-1_]+(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?|
+        [0-9][0-9_]*\.[0-9_]*([eE][+-]?[0-9_]+)?(f32|f64|f)?|
+        [0-9][0-9_]*(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?
+        )
+        (?![\w\.])
+      </match>
+    </context>
+
+    <context id="scope" style-ref="scope">
+      <match extended="true">
+        [a-zA-Z_][a-zA-Z0-9_]*::
+      </match>
+    </context>
+
+    <context id="string" style-ref="string" class="string" class-disabled="no-spell-check">
+      <start>"</start>
+      <end>"</end>
+      <include>
+        <context ref="def:escape"/>
+        <context ref="def:line-continue"/>
+      </include>
+    </context>
+
+    <context id="char" style-ref="char" end-at-line-end="true" class="char" class-disabled="no-spell-check">
+      <start>'</start>
+      <end>'</end>
+      <include>
+        <context ref="def:escape"/>
+      </include>
+    </context>
+
+    <context id="rust" class="no-spell-check">
+      <include>
+        <context ref="function"/>
+        <context ref="type"/>
+        <context ref="keywords"/>
+        <context ref="types"/>
+        <context ref="ctypes"/>
+        <context ref="self"/>
+        <context ref="constants"/>
+        <context ref="cconstants"/>
+        <context ref="line-comment"/>
+        <context ref="block-comment"/>
+        <context ref="number"/>
+        <context ref="scope"/>
+        <context ref="string"/>
+        <context ref="char"/>
+      </include>
+    </context>
+
+  </definitions>
+
+</language>
+
diff --git a/src/etc/gedit/share/mime/packages/rust.xml b/src/etc/gedit/share/mime/packages/rust.xml
new file mode 100644
index 00000000000..65168aae1d9
--- /dev/null
+++ b/src/etc/gedit/share/mime/packages/rust.xml
@@ -0,0 +1,7 @@
+<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+  <mime-type type="text/x-rust">
+    <comment>Rust Source</comment>
+    <glob pattern="*.rs"/>
+    <glob pattern="*.rc"/>    
+  </mime-type>
+</mime-info>
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index 5887df6802f..6c35c62c3a7 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -28,7 +28,7 @@ pub pure fn empty_cell<T>() -> Cell<T> {
     Cell { value: None }
 }
 
-impl<T> Cell<T> {
+pub impl<T> Cell<T> {
     /// Yields the value, failing if the cell is empty.
     fn take() -> T {
         if self.is_empty() {
diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs
index 7939644e51c..b0825816626 100644
--- a/src/libcore/comm.rs
+++ b/src/libcore/comm.rs
@@ -8,9 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Transitional -- needs snapshot
-#[allow(structural_records)];
-
 use either::{Either, Left, Right};
 use kinds::Owned;
 use option;
@@ -190,7 +187,7 @@ pub fn PortSet<T: Owned>() -> PortSet<T>{
     }
 }
 
-impl<T: Owned> PortSet<T> {
+pub impl<T: Owned> PortSet<T> {
 
     fn add(port: Port<T>) {
         self.ports.push(port)
@@ -323,12 +320,12 @@ pub fn oneshot<T: Owned>() -> (PortOne<T>, ChanOne<T>) {
     (port, chan)
 }
 
-impl<T: Owned> PortOne<T> {
+pub impl<T: Owned> PortOne<T> {
     fn recv(self) -> T { recv_one(self) }
     fn try_recv(self) -> Option<T> { try_recv_one(self) }
 }
 
-impl<T: Owned> ChanOne<T> {
+pub impl<T: Owned> ChanOne<T> {
     fn send(self, data: T) { send_one(self, data) }
     fn try_send(self, data: T) -> bool { try_send_one(self, data) }
 }
diff --git a/src/libcore/condition.rs b/src/libcore/condition.rs
index a7c8c1f4d66..00048beae5a 100644
--- a/src/libcore/condition.rs
+++ b/src/libcore/condition.rs
@@ -25,7 +25,7 @@ pub struct Condition<T, U> {
     key: task::local_data::LocalDataKey<Handler<T, U>>
 }
 
-impl<T, U> Condition<T, U> {
+pub impl<T, U> Condition<T, U> {
     fn trap(&self, h: &self/fn(T) -> U) -> Trap/&self<T, U> {
         unsafe {
             let p : *RustClosure = ::cast::transmute(&h);
@@ -69,7 +69,7 @@ struct Trap<T, U> {
     handler: @Handler<T, U>
 }
 
-impl<T, U> Trap<T, U> {
+pub impl<T, U> Trap<T, U> {
     fn in<V>(&self, inner: &self/fn() -> V) -> V {
         unsafe {
             let _g = Guard { cond: self.cond };
diff --git a/src/libcore/core.rc b/src/libcore/core.rc
index ed18388f578..91eb61e342e 100644
--- a/src/libcore/core.rc
+++ b/src/libcore/core.rc
@@ -227,10 +227,6 @@ pub const debug : u32 = 4_u32;
 
 // The runtime interface used by the compiler
 #[cfg(notest)] pub mod rt;
-// The runtime and compiler interface to fmt!
-#[cfg(stage0)]
-#[path = "private/extfmt.rs"]
-pub mod extfmt;
 // Private APIs
 pub mod private;
 
diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs
index 35807364889..f1f4e558661 100644
--- a/src/libcore/dlist.rs
+++ b/src/libcore/dlist.rs
@@ -62,7 +62,7 @@ priv impl<T> DListNode<T> {
     }
 }
 
-impl<T> DListNode<T> {
+pub impl<T> DListNode<T> {
     /// Get the next node in the list, if there is one.
     pure fn next_link(@mut self) -> DListLink<T> {
         self.assert_links();
@@ -208,7 +208,7 @@ priv impl<T> DList<T> {
     }
 }
 
-impl<T> DList<T> {
+pub impl<T> DList<T> {
     /// Get the size of the list. O(1).
     pure fn len(@mut self) -> uint { self.size }
     /// Returns true if the list is empty. O(1).
@@ -457,7 +457,7 @@ impl<T> DList<T> {
     }
 }
 
-impl<T:Copy> DList<T> {
+pub impl<T:Copy> DList<T> {
     /// Remove data from the head of the list. O(1).
     fn pop(@mut self) -> Option<T> {
         self.pop_n().map(|nobe| nobe.data)
diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs
index 9f2036c5f41..1fef4ad42f1 100644
--- a/src/libcore/dvec.rs
+++ b/src/libcore/dvec.rs
@@ -93,17 +93,6 @@ priv impl<A> DVec<A> {
     }
 
     #[inline(always)]
-    fn check_out<B>(f: &fn(v: ~[A]) -> B) -> B {
-        unsafe {
-            let mut data = cast::reinterpret_cast(&null::<()>());
-            data <-> self.data;
-            let data_ptr: *() = cast::reinterpret_cast(&data);
-            if data_ptr.is_null() { fail!(~"Recursive use of dvec"); }
-            return f(data);
-        }
-    }
-
-    #[inline(always)]
     fn give_back(data: ~[A]) {
         unsafe {
             self.data = data;
@@ -117,7 +106,19 @@ priv impl<A> DVec<A> {
 // In theory, most everything should work with any A, but in practice
 // almost nothing works without the copy bound due to limitations
 // around closures.
-impl<A> DVec<A> {
+pub impl<A> DVec<A> {
+    // FIXME (#3758): This should not need to be public.
+    #[inline(always)]
+    fn check_out<B>(f: &fn(v: ~[A]) -> B) -> B {
+        unsafe {
+            let mut data = cast::reinterpret_cast(&null::<()>());
+            data <-> self.data;
+            let data_ptr: *() = cast::reinterpret_cast(&data);
+            if data_ptr.is_null() { fail!(~"Recursive use of dvec"); }
+            return f(data);
+        }
+    }
+
     /// Reserves space for N elements
     fn reserve(count: uint) {
         vec::reserve(&mut self.data, count)
@@ -215,7 +216,7 @@ impl<A> DVec<A> {
     }
 }
 
-impl<A:Copy> DVec<A> {
+pub impl<A:Copy> DVec<A> {
     /**
      * Append all elements of a vector to the end of the list
      *
diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs
index 07c7780898f..c2a39cfdcc3 100644
--- a/src/libcore/hashmap.rs
+++ b/src/libcore/hashmap.rs
@@ -10,14 +10,12 @@
 
 //! Sendable hash maps.
 
-use container::{Container, Mutable, Map, Set};
-use cmp::Eq;
-use hash::Hash;
-use to_bytes::IterBytes;
-
 /// Open addressing with linear probing.
 pub mod linear {
-    use super::*;
+    use container::{Container, Mutable, Map, Set};
+    use cmp::Eq;
+    use hash::Hash;
+    use to_bytes::IterBytes;
     use iter::BaseIter;
     use hash::Hash;
     use iter;
@@ -752,7 +750,8 @@ mod test_map {
 
 #[test]
 mod test_set {
-    use super::*;
+    use hashmap::linear;
+    use container::{Container, Mutable, Map, Set};
     use vec;
 
     #[test]
diff --git a/src/libcore/io.rs b/src/libcore/io.rs
index 45d89b29a2e..fdb622f6539 100644
--- a/src/libcore/io.rs
+++ b/src/libcore/io.rs
@@ -504,7 +504,7 @@ pub fn FILE_reader(f: *libc::FILE, cleanup: bool) -> @Reader {
 
 pub fn stdin() -> @Reader {
     unsafe {
-        rustrt::rust_get_stdin() as @Reader
+        @rustrt::rust_get_stdin() as @Reader
     }
 }
 
@@ -642,11 +642,11 @@ impl Writer for *libc::FILE {
     }
 }
 
-pub fn FILE_writer(f: *libc::FILE, cleanup: bool) -> Writer {
+pub fn FILE_writer(f: *libc::FILE, cleanup: bool) -> @Writer {
     if cleanup {
-        Wrapper { base: f, cleanup: FILERes(f) } as Writer
+        @Wrapper { base: f, cleanup: FILERes(f) } as @Writer
     } else {
-        f as Writer
+        @f as @Writer
     }
 }
 
@@ -702,11 +702,11 @@ pub fn FdRes(fd: fd_t) -> FdRes {
     }
 }
 
-pub fn fd_writer(fd: fd_t, cleanup: bool) -> Writer {
+pub fn fd_writer(fd: fd_t, cleanup: bool) -> @Writer {
     if cleanup {
-        Wrapper { base: fd, cleanup: FdRes(fd) } as Writer
+        @Wrapper { base: fd, cleanup: FdRes(fd) } as @Writer
     } else {
-        fd as Writer
+        @fd as @Writer
     }
 }
 
diff --git a/src/libcore/mutable.rs b/src/libcore/mutable.rs
index 1fb855520ba..f888fbdb40c 100644
--- a/src/libcore/mutable.rs
+++ b/src/libcore/mutable.rs
@@ -43,7 +43,7 @@ pub fn unwrap<T>(m: Mut<T>) -> T {
     value
 }
 
-impl<T> Data<T> {
+pub impl<T> Data<T> {
     fn borrow_mut<R>(op: &fn(t: &mut T) -> R) -> R {
         match self.mode {
             Immutable => fail!(fmt!("%? currently immutable",
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 12ed0df0076..53944c4c2c8 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -281,7 +281,7 @@ pub pure fn expect<T>(opt: Option<T>, reason: &str) -> T {
     }
 }
 
-impl<T> Option<T> {
+pub impl<T> Option<T> {
     /// Returns true if the option equals `none`
     #[inline(always)]
     pure fn is_none(&self) -> bool { is_none(self) }
@@ -393,7 +393,7 @@ impl<T> Option<T> {
     pure fn expect(self, reason: &str) -> T { expect(self, reason) }
 }
 
-impl<T:Copy> Option<T> {
+pub impl<T:Copy> Option<T> {
     /**
     Gets the value out of an option
 
@@ -421,7 +421,7 @@ impl<T:Copy> Option<T> {
     }
 }
 
-impl<T:Copy + Zero> Option<T> {
+pub impl<T:Copy + Zero> Option<T> {
     #[inline(always)]
     pure fn get_or_zero(self) -> T { get_or_zero(self) }
 }
diff --git a/src/libcore/os.rs b/src/libcore/os.rs
index 2522e9c2cda..8b6d27496d9 100644
--- a/src/libcore/os.rs
+++ b/src/libcore/os.rs
@@ -1021,10 +1021,10 @@ extern {
 pub mod consts {
 
     #[cfg(unix)]
-    use os::consts::unix::*;
+    pub use os::consts::unix::*;
 
     #[cfg(windows)]
-    use os::consts::windows::*;
+    pub use os::consts::windows::*;
 
     pub mod unix {
         pub const FAMILY: &str = "unix";
@@ -1035,19 +1035,19 @@ pub mod consts {
     }
 
     #[cfg(target_os = "macos")]
-    use os::consts::macos::*;
+    pub use os::consts::macos::*;
 
     #[cfg(target_os = "freebsd")]
-    use os::consts::freebsd::*;
+    pub use os::consts::freebsd::*;
 
     #[cfg(target_os = "linux")]
-    use os::consts::linux::*;
+    pub use os::consts::linux::*;
 
     #[cfg(target_os = "android")]
-    use os::consts::android::*;
+    pub use os::consts::android::*;
 
     #[cfg(target_os = "win32")]
-    use os::consts::win32::*;
+    pub use os::consts::win32::*;
 
     pub mod macos {
         pub const SYSNAME: &str = "macos";
@@ -1086,13 +1086,13 @@ pub mod consts {
 
 
     #[cfg(target_arch = "x86")]
-    use os::consts::x86::*;
+    pub use os::consts::x86::*;
 
     #[cfg(target_arch = "x86_64")]
-    use os::consts::x86_64::*;
+    pub use os::consts::x86_64::*;
 
     #[cfg(target_arch = "arm")]
-    use os::consts::arm::*;
+    pub use os::consts::arm::*;
 
     pub mod x86 {
         pub const ARCH: &str = "x86";
diff --git a/src/libcore/path.rs b/src/libcore/path.rs
index 1753862649f..4e0e4e93cf5 100644
--- a/src/libcore/path.rs
+++ b/src/libcore/path.rs
@@ -241,7 +241,7 @@ mod stat {
 }
 
 
-impl Path {
+pub impl Path {
     fn stat(&self) -> Option<libc::stat> {
         unsafe {
              do str::as_c_str(self.to_str()) |buf| {
@@ -290,7 +290,7 @@ impl Path {
 #[cfg(target_os = "freebsd")]
 #[cfg(target_os = "linux")]
 #[cfg(target_os = "macos")]
-impl Path {
+pub impl Path {
     fn get_atime(&self) -> Option<(i64, int)> {
         match self.stat() {
             None => None,
@@ -324,7 +324,7 @@ impl Path {
 
 #[cfg(target_os = "freebsd")]
 #[cfg(target_os = "macos")]
-impl Path {
+pub impl Path {
     fn get_birthtime(&self) -> Option<(i64, int)> {
         match self.stat() {
             None => None,
@@ -337,7 +337,7 @@ impl Path {
 }
 
 #[cfg(target_os = "win32")]
-impl Path {
+pub impl Path {
     fn get_atime(&self) -> Option<(i64, int)> {
         match self.stat() {
             None => None,
diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs
index a0a29c6b516..77554656913 100644
--- a/src/libcore/pipes.rs
+++ b/src/libcore/pipes.rs
@@ -82,8 +82,6 @@ bounded and unbounded protocols allows for less code duplication.
 
 */
 
-#[allow(structural_records)]; // Macros -- needs another snapshot
-
 use cmp::Eq;
 use cast::{forget, reinterpret_cast, transmute};
 use cell::Cell;
@@ -800,7 +798,7 @@ pub fn SendPacketBuffered<T,Tbuffer>(p: *Packet<T>)
     }
 }
 
-impl<T,Tbuffer> SendPacketBuffered<T,Tbuffer> {
+pub impl<T,Tbuffer> SendPacketBuffered<T,Tbuffer> {
     fn unwrap() -> *Packet<T> {
         let mut p = None;
         p <-> self.p;
@@ -857,7 +855,7 @@ impl<T:Owned,Tbuffer:Owned> ::ops::Drop for RecvPacketBuffered<T,Tbuffer> {
     }
 }
 
-impl<T:Owned,Tbuffer:Owned> RecvPacketBuffered<T, Tbuffer> {
+pub impl<T:Owned,Tbuffer:Owned> RecvPacketBuffered<T, Tbuffer> {
     fn unwrap() -> *Packet<T> {
         let mut p = None;
         p <-> self.p;
diff --git a/src/libcore/private.rs b/src/libcore/private.rs
index e4fab18966c..d19951e76db 100644
--- a/src/libcore/private.rs
+++ b/src/libcore/private.rs
@@ -107,20 +107,9 @@ fn compare_and_swap(address: &mut int, oldval: int, newval: int) -> bool {
  * Shared state & exclusive ARC
  ****************************************************************************/
 
-struct UnwrapProtoInner {
-    contents: Option<(comm::ChanOne<()>,  comm::PortOne<bool>)>,
-}
-
-// An unwrapper uses this protocol to communicate with the "other" task that
-// drops the last refcount on an arc. Unfortunately this can't be a proper
-// pipe protocol because the unwrapper has to access both stages at once.
-type UnwrapProto = ~UnwrapProtoInner;
-
 struct ArcData<T> {
     mut count:     libc::intptr_t,
-    mut unwrapper: int, // either a UnwrapProto or 0
-    // FIXME(#3224) should be able to make this non-option to save memory, and
-    // in unwrap() use "let ~ArcData { data: result, _ } = thing" to unwrap it
+    // FIXME(#3224) should be able to make this non-option to save memory
     mut data:      Option<T>,
 }
 
@@ -131,37 +120,13 @@ struct ArcDestruct<T> {
 impl<T> Drop for ArcDestruct<T>{
     fn finalize(&self) {
         unsafe {
-            if self.data.is_null() {
-                return; // Happens when destructing an unwrapper's handle.
-            }
             do task::unkillable {
                 let data: ~ArcData<T> = cast::reinterpret_cast(&self.data);
                 let new_count =
                     intrinsics::atomic_xsub(&mut data.count, 1) - 1;
                 assert new_count >= 0;
                 if new_count == 0 {
-                    // Were we really last, or should we hand off to an
-                    // unwrapper? It's safe to not xchg because the unwrapper
-                    // will set the unwrap lock *before* dropping his/her
-                    // reference. In effect, being here means we're the only
-                    // *awake* task with the data.
-                    if data.unwrapper != 0 {
-                        let mut p: UnwrapProto =
-                            cast::reinterpret_cast(&data.unwrapper);
-                        let (message, response) =
-                            option::swap_unwrap(&mut p.contents);
-                        // Send 'ready' and wait for a response.
-                        comm::send_one(message, ());
-                        // Unkillable wait. Message guaranteed to come.
-                        if comm::recv_one(response) {
-                            // Other task got the data.
-                            cast::forget(data);
-                        } else {
-                            // Other task was killed. drop glue takes over.
-                        }
-                    } else {
-                        // drop glue takes over.
-                    }
+                    // drop glue takes over.
                 } else {
                     cast::forget(data);
                 }
@@ -176,79 +141,6 @@ fn ArcDestruct<T>(data: *libc::c_void) -> ArcDestruct<T> {
     }
 }
 
-pub unsafe fn unwrap_shared_mutable_state<T:Owned>(rc: SharedMutableState<T>)
-        -> T {
-    struct DeathThroes<T> {
-        mut ptr:      Option<~ArcData<T>>,
-        mut response: Option<comm::ChanOne<bool>>,
-    }
-
-    impl<T> Drop for DeathThroes<T>{
-        fn finalize(&self) {
-            unsafe {
-                let response = option::swap_unwrap(&mut self.response);
-                // In case we get killed early, we need to tell the person who
-                // tried to wake us whether they should hand-off the data to
-                // us.
-                if task::failing() {
-                    comm::send_one(response, false);
-                    // Either this swap_unwrap or the one below (at "Got
-                    // here") ought to run.
-                    cast::forget(option::swap_unwrap(&mut self.ptr));
-                } else {
-                    assert self.ptr.is_none();
-                    comm::send_one(response, true);
-                }
-            }
-        }
-    }
-
-    do task::unkillable {
-        let ptr: ~ArcData<T> = cast::reinterpret_cast(&rc.data);
-        let (p1,c1) = comm::oneshot(); // ()
-        let (p2,c2) = comm::oneshot(); // bool
-        let mut server: UnwrapProto = ~UnwrapProtoInner {
-            contents: Some((c1,p2))
-        };
-        let serverp: int = cast::transmute(server);
-        // Try to put our server end in the unwrapper slot.
-        if compare_and_swap(&mut ptr.unwrapper, 0, serverp) {
-            // Got in. Step 0: Tell destructor not to run. We are now it.
-            rc.data = ptr::null();
-            // Step 1 - drop our own reference.
-            let new_count = intrinsics::atomic_xsub(&mut ptr.count, 1) - 1;
-            //assert new_count >= 0;
-            if new_count == 0 {
-                // We were the last owner. Can unwrap immediately.
-                // Also we have to free the server endpoints.
-                let _server: UnwrapProto = cast::transmute(serverp);
-                option::swap_unwrap(&mut ptr.data)
-                // drop glue takes over.
-            } else {
-                // The *next* person who sees the refcount hit 0 will wake us.
-                let end_result =
-                    DeathThroes { ptr: Some(ptr),
-                                  response: Some(c2) };
-                let mut p1 = Some(p1); // argh
-                do task::rekillable {
-                    comm::recv_one(option::swap_unwrap(&mut p1));
-                }
-                // Got here. Back in the 'unkillable' without getting killed.
-                // Recover ownership of ptr, then take the data out.
-                let ptr = option::swap_unwrap(&mut end_result.ptr);
-                option::swap_unwrap(&mut ptr.data)
-                // drop glue takes over.
-            }
-        } else {
-            // Somebody else was trying to unwrap. Avoid guaranteed deadlock.
-            cast::forget(ptr);
-            // Also we have to free the (rejected) server endpoints.
-            let _server: UnwrapProto = cast::transmute(serverp);
-            fail!(~"Another task is already unwrapping this ARC!");
-        }
-    }
-}
-
 /**
  * COMPLETELY UNSAFE. Used as a primitive for the safe versions in std::arc.
  *
@@ -259,7 +151,7 @@ pub type SharedMutableState<T> = ArcDestruct<T>;
 
 pub unsafe fn shared_mutable_state<T:Owned>(data: T) ->
         SharedMutableState<T> {
-    let data = ~ArcData { count: 1, unwrapper: 0, data: Some(data) };
+    let data = ~ArcData { count: 1, data: Some(data) };
     unsafe {
         let ptr = cast::transmute(data);
         ArcDestruct(ptr)
@@ -335,7 +227,7 @@ fn LittleLock() -> LittleLock {
     }
 }
 
-impl LittleLock {
+pub impl LittleLock {
     #[inline(always)]
     unsafe fn lock<T>(f: fn() -> T) -> T {
         struct Unlock {
@@ -381,7 +273,7 @@ impl<T:Owned> Clone for Exclusive<T> {
     }
 }
 
-impl<T:Owned> Exclusive<T> {
+pub impl<T:Owned> Exclusive<T> {
     // Exactly like std::arc::mutex_arc,access(), but with the little_lock
     // instead of a proper mutex. Same reason for being unsafe.
     //
@@ -413,14 +305,6 @@ impl<T:Owned> Exclusive<T> {
     }
 }
 
-// FIXME(#3724) make this a by-move method on the exclusive
-pub fn unwrap_exclusive<T:Owned>(arc: Exclusive<T>) -> T {
-    let Exclusive { x: x } = arc;
-    let inner = unsafe { unwrap_shared_mutable_state(x) };
-    let ExData { data: data, _ } = inner;
-    data
-}
-
 #[cfg(test)]
 pub mod tests {
     use core::option::{None, Some};
@@ -428,7 +312,7 @@ pub mod tests {
     use cell::Cell;
     use comm;
     use option;
-    use private::{exclusive, unwrap_exclusive};
+    use private::exclusive;
     use result;
     use task;
     use uint;
@@ -479,70 +363,4 @@ pub mod tests {
             assert *one == 1;
         }
     }
-
-    #[test]
-    pub fn exclusive_unwrap_basic() {
-        let x = exclusive(~~"hello");
-        assert unwrap_exclusive(x) == ~~"hello";
-    }
-
-    #[test]
-    pub fn exclusive_unwrap_contended() {
-        let x = exclusive(~~"hello");
-        let x2 = Cell(x.clone());
-        do task::spawn {
-            let x2 = x2.take();
-            do x2.with |_hello| { }
-            task::yield();
-        }
-        assert unwrap_exclusive(x) == ~~"hello";
-
-        // Now try the same thing, but with the child task blocking.
-        let x = exclusive(~~"hello");
-        let x2 = Cell(x.clone());
-        let mut res = None;
-        do task::task().future_result(|+r| res = Some(r)).spawn {
-            let x2 = x2.take();
-            assert unwrap_exclusive(x2) == ~~"hello";
-        }
-        // Have to get rid of our reference before blocking.
-        { let _x = x; } // FIXME(#3161) util::ignore doesn't work here
-        let res = option::swap_unwrap(&mut res);
-        res.recv();
-    }
-
-    #[test] #[should_fail] #[ignore(cfg(windows))]
-    pub fn exclusive_unwrap_conflict() {
-        let x = exclusive(~~"hello");
-        let x2 = Cell(x.clone());
-        let mut res = None;
-        do task::task().future_result(|+r| res = Some(r)).spawn {
-            let x2 = x2.take();
-            assert unwrap_exclusive(x2) == ~~"hello";
-        }
-        assert unwrap_exclusive(x) == ~~"hello";
-        let res = option::swap_unwrap(&mut res);
-        // See #4689 for why this can't be just "res.recv()".
-        assert res.recv() == task::Success;
-    }
-
-    #[test] #[ignore(cfg(windows))]
-    pub fn exclusive_unwrap_deadlock() {
-        // This is not guaranteed to get to the deadlock before being killed,
-        // but it will show up sometimes, and if the deadlock were not there,
-        // the test would nondeterministically fail.
-        let result = do task::try {
-            // a task that has two references to the same exclusive will
-            // deadlock when it unwraps. nothing to be done about that.
-            let x = exclusive(~~"hello");
-            let x2 = x.clone();
-            do task::spawn {
-                for 10.times { task::yield(); } // try to let the unwrapper go
-                fail!(); // punt it awake from its deadlock
-            }
-            let _z = unwrap_exclusive(x);
-            do x2.with |_hello| { }
-        };
-        assert result.is_err();
-    }
 }
diff --git a/src/libcore/private/extfmt.rs b/src/libcore/private/extfmt.rs
index 36ea67ea695..616d37a133a 100644
--- a/src/libcore/private/extfmt.rs
+++ b/src/libcore/private/extfmt.rs
@@ -142,7 +142,7 @@ pub mod ct {
         next: uint
     }
 
-    impl<T> Parsed<T> {
+    pub impl<T> Parsed<T> {
         static pure fn new(val: T, next: uint) -> Parsed<T> {
             Parsed {val: val, next: next}
         }
diff --git a/src/libcore/private/finally.rs b/src/libcore/private/finally.rs
index af7197159ca..ff75963511c 100644
--- a/src/libcore/private/finally.rs
+++ b/src/libcore/private/finally.rs
@@ -26,33 +26,10 @@ do || {
 use ops::Drop;
 use task::{spawn, failing};
 
-#[cfg(stage0)]
-pub trait Finally<T> {
-    fn finally(&self, +dtor: &fn()) -> T;
-}
-
-#[cfg(stage1)]
-#[cfg(stage2)]
-#[cfg(stage3)]
 pub trait Finally<T> {
     fn finally(&self, dtor: &fn()) -> T;
 }
 
-#[cfg(stage0)]
-impl<T> Finally<T> for &fn() -> T {
-    // FIXME #4518: Should not require a mode here
-    fn finally(&self, +dtor: &fn()) -> T {
-        let _d = Finallyalizer {
-            dtor: dtor
-        };
-
-        (*self)()
-    }
-}
-
-#[cfg(stage1)]
-#[cfg(stage2)]
-#[cfg(stage3)]
 impl<T> Finally<T> for &fn() -> T {
     fn finally(&self, dtor: &fn()) -> T {
         let _d = Finallyalizer {
diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs
index 15362f89e3f..d9c2b91fb97 100644
--- a/src/libcore/rand.rs
+++ b/src/libcore/rand.rs
@@ -141,7 +141,7 @@ pub struct Weighted<T> {
 }
 
 /// Extension methods for random number generators
-impl Rng {
+pub impl Rng {
     /// Return a random value for a Rand type
     fn gen<T:Rand>() -> T {
         Rand::rand(self)
@@ -412,8 +412,8 @@ pub fn Rng() -> Rng {
  * all other generators constructed with the same seed. The seed may be any
  * length.
  */
-pub fn seeded_rng(seed: &[u8]) -> Rng {
-    seeded_randres(seed) as Rng
+pub fn seeded_rng(seed: &[u8]) -> @Rng {
+    @seeded_randres(seed) as @Rng
 }
 
 fn seeded_randres(seed: &[u8]) -> @RandRes {
@@ -449,8 +449,8 @@ pub pure fn xorshift() -> Rng {
     seeded_xorshift(123456789u32, 362436069u32, 521288629u32, 88675123u32)
 }
 
-pub pure fn seeded_xorshift(x: u32, y: u32, z: u32, w: u32) -> Rng {
-    XorShiftState { x: x, y: y, z: z, w: w } as Rng
+pub pure fn seeded_xorshift(x: u32, y: u32, z: u32, w: u32) -> @Rng {
+    @XorShiftState { x: x, y: y, z: z, w: w } as @Rng
 }
 
 
@@ -472,10 +472,10 @@ pub fn task_rng() -> Rng {
             unsafe {
                 let rng = seeded_randres(seed());
                 task::local_data::local_data_set(tls_rng_state, rng);
-                rng as Rng
+                @rng as @Rng
             }
         }
-        Some(rng) => rng as Rng
+        Some(rng) => @rng as @Rng
     }
 }
 
diff --git a/src/libcore/reflect.rs b/src/libcore/reflect.rs
index ed7e485678e..2a688482f61 100644
--- a/src/libcore/reflect.rs
+++ b/src/libcore/reflect.rs
@@ -45,7 +45,7 @@ pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
     MovePtrAdaptor { inner: v }
 }
 
-impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
+pub impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
     #[inline(always)]
     fn bump(sz: uint) {
       do self.inner.move_ptr() |p| {
diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs
index 4c3abb09756..af135339b2e 100644
--- a/src/libcore/repr.rs
+++ b/src/libcore/repr.rs
@@ -167,7 +167,7 @@ impl MovePtr for ReprVisitor {
     }
 }
 
-impl ReprVisitor {
+pub impl ReprVisitor {
 
     // Various helpers for the TyVisitor impl
 
@@ -201,7 +201,7 @@ impl ReprVisitor {
         unsafe {
             let mut u = ReprVisitor(ptr, self.writer);
             let v = reflect::MovePtrAdaptor(u);
-            visit_tydesc(inner, (v) as @TyVisitor);
+            visit_tydesc(inner, @v as @TyVisitor);
             true
         }
     }
@@ -570,7 +570,7 @@ pub fn write_repr<T>(writer: @Writer, object: &T) {
         let tydesc = intrinsic::get_tydesc::<T>();
         let mut u = ReprVisitor(ptr, writer);
         let v = reflect::MovePtrAdaptor(u);
-        visit_tydesc(tydesc, (v) as @TyVisitor)
+        visit_tydesc(tydesc, @v as @TyVisitor)
     }
 }
 
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index b03eaeab3e0..ddcd1547841 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -228,7 +228,7 @@ pub pure fn map_err<T:Copy,E,F:Copy>(res: &Result<T, E>, op: fn(&E) -> F)
     }
 }
 
-impl<T, E> Result<T, E> {
+pub impl<T, E> Result<T, E> {
     #[inline(always)]
     pure fn get_ref(&self) -> &self/T { get_ref(self) }
 
@@ -261,7 +261,7 @@ impl<T, E> Result<T, E> {
     }
 }
 
-impl<T:Copy,E> Result<T, E> {
+pub impl<T:Copy,E> Result<T, E> {
     #[inline(always)]
     pure fn get(&self) -> T { get(self) }
 
@@ -271,7 +271,7 @@ impl<T:Copy,E> Result<T, E> {
     }
 }
 
-impl<T, E: Copy> Result<T, E> {
+pub impl<T, E: Copy> Result<T, E> {
     #[inline(always)]
     pure fn get_err(&self) -> E { get_err(self) }
 
diff --git a/src/libcore/run.rs b/src/libcore/run.rs
index aa1e473e3bf..e8cd9caaef6 100644
--- a/src/libcore/run.rs
+++ b/src/libcore/run.rs
@@ -288,7 +288,7 @@ pub fn start_program(prog: &str, args: &[~str]) -> Program {
         finished: false,
     };
 
-    ProgRes(repr) as Program
+    @ProgRes(repr) as @Program
 }
 
 fn read_all(rd: io::Reader) -> ~str {
diff --git a/src/libcore/stackwalk.rs b/src/libcore/stackwalk.rs
index 2e24df86c78..8950a1d0c02 100644
--- a/src/libcore/stackwalk.rs
+++ b/src/libcore/stackwalk.rs
@@ -10,9 +10,6 @@
 
 #[doc(hidden)]; // FIXME #3538
 
-#[legacy_modes]; // tjc: remove after snapshot
-#[allow(deprecated_mode)];
-
 use cast::reinterpret_cast;
 use ptr::offset;
 use sys::size_of;
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 66be5481819..6ee6d282841 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -2375,6 +2375,7 @@ impl OwnedStr for ~str {
 #[cfg(test)]
 mod tests {
     use char;
+    use option::Some;
     use debug;
     use libc::c_char;
     use libc;
diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs
index 3ac457b23d1..df5a5af74ca 100644
--- a/src/libcore/task/local_data_priv.rs
+++ b/src/libcore/task/local_data_priv.rs
@@ -155,7 +155,7 @@ pub unsafe fn local_set<T:Durable>(
     // does not have a reference associated with it, so it may become invalid
     // when the box is destroyed.
     let data_ptr = cast::reinterpret_cast(&data);
-    let data_box = data as LocalData;
+    let data_box = @data as @LocalData;
     // Construct new entry to store in the map.
     let new_entry = Some((keyval, data_ptr, data_box));
     // Find a place to put it.
diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs
index 2a640e4bf8c..49507897392 100644
--- a/src/libcore/task/mod.rs
+++ b/src/libcore/task/mod.rs
@@ -232,7 +232,7 @@ priv impl TaskBuilder {
     }
 }
 
-impl TaskBuilder {
+pub impl TaskBuilder {
     /**
      * Decouple the child task's failure from the parent's. If either fails,
      * the other will not be killed.
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 687ad2f7938..4d28c769b18 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -1444,7 +1444,7 @@ pub fn each2<U, T>(v1: &[U], v2: &[T], f: fn(u: &U, t: &T) -> bool) {
  * The total number of permutations produced is `len(v)!`.  If `v` contains
  * repeated elements, then some permutations are repeated.
  */
-pure fn each_permutation<T:Copy>(v: &[T], put: fn(ts: &[T]) -> bool) {
+pub pure fn each_permutation<T:Copy>(v: &[T], put: fn(ts: &[T]) -> bool) {
     let ln = len(v);
     if ln <= 1 {
         put(v);
@@ -2427,6 +2427,7 @@ impl<A:Copy> iter::CopyableNonstrictIter<A> for @[A] {
 mod tests {
     use option::{None, Option, Some};
     use option;
+    use sys;
     use vec::*;
 
     fn square(n: uint) -> uint { return n * n; }
diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs
index 877098ed49f..daf369f7279 100644
--- a/src/librustc/metadata/common.rs
+++ b/src/librustc/metadata/common.rs
@@ -132,9 +132,8 @@ pub enum astencode_tag { // Reserves 0x50 -- 0x6f
     tag_table_method_map = 0x60,
     tag_table_vtable_map = 0x61,
     tag_table_adjustments = 0x62,
-    tag_table_legacy_boxed_trait = 0x63,
-    tag_table_moves_map = 0x64,
-    tag_table_capture_map = 0x65
+    tag_table_moves_map = 0x63,
+    tag_table_capture_map = 0x64
 }
 
 pub const tag_item_trait_method_sort: uint = 0x70;
@@ -155,6 +154,7 @@ pub const tag_lang_items_item_node_id: uint = 0x75;
 
 pub const tag_item_unnamed_field: uint = 0x76;
 pub const tag_items_data_item_struct_ctor: uint = 0x77;
+pub const tag_items_data_item_visibility: uint = 0x78;
 
 pub struct LinkMeta {
     name: @str,
diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs
index eda7362b9c1..ae4a223c1ae 100644
--- a/src/librustc/metadata/csearch.rs
+++ b/src/librustc/metadata/csearch.rs
@@ -234,6 +234,14 @@ pub fn struct_dtor(cstore: @mut cstore::CStore, def: ast::def_id)
     let cdata = cstore::get_crate_data(cstore, def.crate);
     decoder::struct_dtor(cdata, def.node)
 }
+
+pub fn get_method_visibility(cstore: @mut cstore::CStore,
+                             def_id: ast::def_id)
+                          -> ast::visibility {
+    let cdata = cstore::get_crate_data(cstore, def_id.crate);
+    decoder::get_method_visibility(cdata, def_id.node)
+}
+
 // Local Variables:
 // mode: rust
 // fill-column: 78;
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs
index 5d74d03e27b..cbe2217c9fc 100644
--- a/src/librustc/metadata/decoder.rs
+++ b/src/librustc/metadata/decoder.rs
@@ -151,6 +151,16 @@ fn item_family(item: ebml::Doc) -> Family {
     }
 }
 
+fn item_visibility(item: ebml::Doc) -> ast::visibility {
+    let visibility = reader::get_doc(item, tag_items_data_item_visibility);
+    match reader::doc_as_u8(visibility) as char {
+        'y' => ast::public,
+        'n' => ast::private,
+        'i' => ast::inherited,
+        _ => fail!(~"unknown visibility character"),
+    }
+}
+
 fn item_method_sort(item: ebml::Doc) -> char {
     for reader::tagged_docs(item, tag_item_trait_method_sort) |doc| {
         return str::from_bytes(reader::doc_data(doc))[0] as char;
@@ -860,7 +870,7 @@ pub fn get_item_attrs(cdata: cmd,
     }
 }
 
-pure fn family_to_visibility(family: Family) -> ast::visibility {
+pure fn struct_field_family_to_visibility(family: Family) -> ast::visibility {
     match family {
       PublicField => ast::public,
       PrivateField => ast::private,
@@ -883,7 +893,7 @@ pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::node_id)
             result.push(ty::field_ty {
                 ident: name,
                 id: did, vis:
-                family_to_visibility(f),
+                struct_field_family_to_visibility(f),
                 mutability: mt,
             });
         }
@@ -900,6 +910,11 @@ pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::node_id)
     result
 }
 
+pub fn get_method_visibility(cdata: cmd, id: ast::node_id)
+                          -> ast::visibility {
+    item_visibility(lookup_item(id, cdata.data))
+}
+
 fn family_has_type_params(fam: Family) -> bool {
     match fam {
       Const | ForeignType | Mod | ForeignMod | PublicField | PrivateField
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index a5932775003..7d2423c7c5d 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -383,7 +383,8 @@ fn encode_info_for_mod(ecx: @EncodeContext, ebml_w: writer::Encoder,
     ebml_w.end_tag();
 }
 
-fn encode_visibility(ebml_w: writer::Encoder, visibility: visibility) {
+fn encode_struct_field_family(ebml_w: writer::Encoder,
+                              visibility: visibility) {
     encode_family(ebml_w, match visibility {
         public => 'g',
         private => 'j',
@@ -391,6 +392,17 @@ fn encode_visibility(ebml_w: writer::Encoder, visibility: visibility) {
     });
 }
 
+fn encode_visibility(ebml_w: writer::Encoder, visibility: visibility) {
+    ebml_w.start_tag(tag_items_data_item_visibility);
+    let ch = match visibility {
+        public => 'y',
+        private => 'n',
+        inherited => 'i',
+    };
+    ebml_w.wr_str(str::from_char(ch));
+    ebml_w.end_tag();
+}
+
 fn encode_self_type(ebml_w: writer::Encoder, self_type: ast::self_ty_) {
     ebml_w.start_tag(tag_item_trait_method_self_ty);
 
@@ -456,7 +468,7 @@ fn encode_info_for_struct(ecx: @EncodeContext, ebml_w: writer::Encoder,
         ebml_w.start_tag(tag_items_data_item);
         debug!("encode_info_for_struct: doing %s %d",
                *tcx.sess.str_of(nm), id);
-        encode_visibility(ebml_w, vis);
+        encode_struct_field_family(ebml_w, vis);
         encode_name(ecx, ebml_w, nm);
         encode_path(ecx, ebml_w, path, ast_map::path_name(nm));
         encode_type(ecx, ebml_w, node_id_to_type(tcx, id));
@@ -525,6 +537,7 @@ fn encode_info_for_method(ecx: @EncodeContext,
                           should_inline: bool,
                           parent_id: node_id,
                           m: @method,
+                          parent_visibility: ast::visibility,
                           owner_generics: &ast::Generics,
                           method_generics: &ast::Generics) {
     debug!("encode_info_for_method: %d %s %u %u", m.id,
@@ -533,6 +546,7 @@ fn encode_info_for_method(ecx: @EncodeContext,
            method_generics.ty_params.len());
     ebml_w.start_tag(tag_items_data_item);
     encode_def_id(ebml_w, local_def(m.id));
+
     match m.self_ty.node {
         ast::sty_static => {
             encode_family(ebml_w, purity_static_method_family(m.purity));
@@ -550,6 +564,14 @@ fn encode_info_for_method(ecx: @EncodeContext,
     encode_name(ecx, ebml_w, m.ident);
     encode_path(ecx, ebml_w, impl_path, ast_map::path_name(m.ident));
     encode_self_type(ebml_w, m.self_ty.node);
+
+    // Combine parent visibility and this visibility.
+    let visibility = match m.vis {
+        ast::inherited => parent_visibility,
+        vis => vis,
+    };
+    encode_visibility(ebml_w, visibility);
+
     if len > 0u || should_inline {
         (ecx.encode_inlined_item)(
            ecx, ebml_w, impl_path,
@@ -568,6 +590,7 @@ fn purity_fn_family(p: purity) -> char {
       extern_fn => 'e'
     }
 }
+
 fn purity_static_method_family(p: purity) -> char {
     match p {
       unsafe_fn => 'U',
@@ -757,7 +780,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
             match f.node.kind {
                 named_field(ident, _, vis) => {
                    ebml_w.start_tag(tag_item_field);
-                   encode_visibility(ebml_w, vis);
+                   encode_struct_field_family(ebml_w, vis);
                    encode_name(ecx, ebml_w, ident);
                    encode_def_id(ebml_w, local_def(f.node.id));
                    ebml_w.end_tag();
@@ -808,12 +831,28 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
         let mut impl_path = vec::append(~[], path);
         impl_path += ~[ast_map::path_name(item.ident)];
 
+        // If there is a trait reference, treat the methods as always public.
+        // This is to work around some incorrect behavior in privacy checking:
+        // when the method belongs to a trait, it should acquire the privacy
+        // from the trait, not the impl. Forcing the visibility to be public
+        // makes things sorta work.
+        let parent_visibility = if opt_trait.is_some() {
+            ast::public
+        } else {
+            item.vis
+        };
+
         for methods.each |m| {
             index.push(entry {val: m.id, pos: ebml_w.writer.tell()});
-            encode_info_for_method(ecx, ebml_w, impl_path,
+            encode_info_for_method(ecx,
+                                   ebml_w,
+                                   impl_path,
                                    should_inline(m.attrs),
-                                   item.id, *m,
-                                   generics, &m.generics);
+                                   item.id,
+                                   *m,
+                                   parent_visibility,
+                                   generics,
+                                   &m.generics);
         }
       }
       item_trait(ref generics, ref traits, ref ms) => {
@@ -902,9 +941,15 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
             // of provided methods.  I am not sure why this is. -ndm
             let owner_generics = ast_util::empty_generics();
 
-            encode_info_for_method(ecx, ebml_w, /*bad*/copy path,
-                                   true, item.id, *m,
-                                   &owner_generics, &m.generics);
+            encode_info_for_method(ecx,
+                                   ebml_w,
+                                   /*bad*/copy path,
+                                   true,
+                                   item.id,
+                                   *m,
+                                   item.vis,
+                                   &owner_generics,
+                                   &m.generics);
         }
       }
       item_mac(*) => fail!(~"item macros unimplemented")
diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index 82ea0b6d6f1..1a7c7b0793a 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -71,11 +71,11 @@ pub fn mk_filesearch(maybe_sysroot: Option<Path>,
 
     let sysroot = get_sysroot(maybe_sysroot);
     debug!("using sysroot = %s", sysroot.to_str());
-    FileSearchImpl {
+    @FileSearchImpl {
         sysroot: sysroot,
         addl_lib_search_paths: addl_lib_search_paths,
         target_triple: str::from_slice(target_triple)
-    } as FileSearch
+    } as @FileSearch
 }
 
 pub fn search<T:Copy>(filesearch: FileSearch, pick: pick<T>) -> Option<T> {
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index ecc0ce90553..222931d1829 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -167,7 +167,7 @@ fn reserve_id_range(sess: Session,
     ast_util::id_range { min: to_id_min, max: to_id_min }
 }
 
-impl ExtendedDecodeContext {
+pub impl ExtendedDecodeContext {
     fn tr_id(&self, id: ast::node_id) -> ast::node_id {
         /*!
          *
@@ -966,12 +966,6 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext,
         }
     }
 
-    do option::iter(&tcx.legacy_boxed_traits.find(&id)) |_x| {
-        do ebml_w.tag(c::tag_table_legacy_boxed_trait) {
-            ebml_w.id(id);
-        }
-    }
-
     for maps.moves_map.find(&id).each |_| {
         do ebml_w.tag(c::tag_table_moves_map) {
             ebml_w.id(id);
@@ -1121,8 +1115,6 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
 
         if tag == (c::tag_table_mutbl as uint) {
             dcx.maps.mutbl_map.insert(id, ());
-        } else if tag == (c::tag_table_legacy_boxed_trait as uint) {
-            dcx.tcx.legacy_boxed_traits.insert(id, ());
         } else if tag == (c::tag_table_moves_map as uint) {
             dcx.maps.moves_map.insert(id, ());
         } else {
@@ -1230,7 +1222,7 @@ impl fake_ext_ctxt for fake_session {
 
 #[cfg(test)]
 fn mk_ctxt() -> fake_ext_ctxt {
-    parse::new_parse_sess(None) as fake_ext_ctxt
+    @parse::new_parse_sess(None) as fake_ext_ctxt
 }
 
 #[cfg(test)]
diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs
index 6efcc0b97c0..c3555e54519 100644
--- a/src/librustc/middle/borrowck/check_loans.rs
+++ b/src/librustc/middle/borrowck/check_loans.rs
@@ -89,7 +89,7 @@ enum assignment_type {
     at_swap
 }
 
-impl assignment_type {
+pub impl assignment_type {
     fn checked_by_liveness(&self) -> bool {
         // the liveness pass guarantees that immutable local variables
         // are only assigned once; but it doesn't consider &mut
@@ -106,7 +106,7 @@ impl assignment_type {
     }
 }
 
-impl CheckLoanCtxt {
+pub impl CheckLoanCtxt {
     fn tcx(@mut self) -> ty::ctxt { self.bccx.tcx }
 
     fn purity(@mut self, scope_id: ast::node_id) -> Option<purity_cause> {
diff --git a/src/librustc/middle/borrowck/gather_loans.rs b/src/librustc/middle/borrowck/gather_loans.rs
index eea11fa0675..c6f4f04fe71 100644
--- a/src/librustc/middle/borrowck/gather_loans.rs
+++ b/src/librustc/middle/borrowck/gather_loans.rs
@@ -289,7 +289,7 @@ fn req_loans_in_expr(ex: @ast::expr,
     self.root_ub = old_root_ub;
 }
 
-impl GatherLoanCtxt {
+pub impl GatherLoanCtxt {
     fn tcx(@mut self) -> ty::ctxt { self.bccx.tcx }
 
     fn guarantee_adjustments(@mut self,
diff --git a/src/librustc/middle/borrowck/loan.rs b/src/librustc/middle/borrowck/loan.rs
index c39f2455c2f..e095c970931 100644
--- a/src/librustc/middle/borrowck/loan.rs
+++ b/src/librustc/middle/borrowck/loan.rs
@@ -87,7 +87,7 @@ struct LoanContext {
     loans: ~[Loan]
 }
 
-impl LoanContext {
+pub impl LoanContext {
     fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
 
     fn loan(&mut self,
diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs
index eb2a93d86f9..9bdf69f4c88 100644
--- a/src/librustc/middle/borrowck/mod.rs
+++ b/src/librustc/middle/borrowck/mod.rs
@@ -230,6 +230,7 @@ use middle::liveness;
 use middle::mem_categorization::*;
 use middle::region;
 use middle::ty;
+use middle::typeck;
 use middle::moves;
 use util::common::{indenter, stmt_set};
 use util::ppaux::{expr_repr, note_and_explain_region};
@@ -239,6 +240,7 @@ use core::cmp;
 use core::dvec::DVec;
 use core::io;
 use core::result::{Result, Ok, Err};
+use core::to_bytes;
 use std::list::{List, Cons, Nil};
 use std::list;
 use std::oldmap::{HashMap, Set};
@@ -433,7 +435,7 @@ pub fn save_and_restore_managed<T:Copy,U>(save_and_restore_t: @mut T,
     u
 }
 
-impl LoanKind {
+pub impl LoanKind {
     fn is_freeze(&self) -> bool {
         match *self {
             TotalFreeze | PartialFreeze => true,
diff --git a/src/librustc/middle/borrowck/preserve.rs b/src/librustc/middle/borrowck/preserve.rs
index a123793e20b..aabcd7a2fe5 100644
--- a/src/librustc/middle/borrowck/preserve.rs
+++ b/src/librustc/middle/borrowck/preserve.rs
@@ -35,7 +35,7 @@ pub enum PreserveCondition {
     PcIfPure(bckerr)
 }
 
-impl PreserveCondition {
+pub impl PreserveCondition {
     // combines two preservation conditions such that if either of
     // them requires purity, the result requires purity
     fn combine(&self, pc: PreserveCondition) -> PreserveCondition {
@@ -46,7 +46,7 @@ impl PreserveCondition {
     }
 }
 
-impl BorrowckCtxt {
+pub impl BorrowckCtxt {
     fn preserve(&self,
                 cmt: cmt,
                 scope_region: ty::Region,
@@ -80,7 +80,7 @@ struct PreserveCtxt {
     root_managed_data: bool
 }
 
-impl PreserveCtxt {
+pub impl PreserveCtxt {
     fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
 
     fn preserve(&self, cmt: cmt) -> bckres<PreserveCondition> {
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index c2c623e36d6..d399f0e6886 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -322,7 +322,7 @@ struct LanguageItemCollector {
     item_refs: HashMap<@~str, uint>,
 }
 
-impl LanguageItemCollector {
+pub impl LanguageItemCollector {
     fn match_and_collect_meta_item(&self, item_def_id: def_id,
                                    meta_item: @meta_item) {
         match meta_item.node {
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs
index 1df59b64fe6..8bcc573ac36 100644
--- a/src/librustc/middle/lint.rs
+++ b/src/librustc/middle/lint.rs
@@ -331,7 +331,7 @@ struct Context {
     sess: Session
 }
 
-impl Context {
+pub impl Context {
     fn get_level(&self, lint: lint) -> level {
         get_lint_level(self.curr, lint)
     }
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index 86398dac6d8..5286fa1025a 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -254,7 +254,7 @@ impl to_str::ToStr for Variable {
 // variable must not be assigned if there is some successor
 // assignment.  And so forth.
 
-impl LiveNode {
+pub impl LiveNode {
     pure fn is_valid(&self) -> bool { **self != uint::max_value }
 }
 
@@ -334,7 +334,7 @@ fn IrMaps(tcx: ty::ctxt,
     }
 }
 
-impl IrMaps {
+pub impl IrMaps {
     fn add_live_node(&mut self, lnk: LiveNodeKind) -> LiveNode {
         let ln = LiveNode(self.num_live_nodes);
         self.lnks.push(lnk);
@@ -693,7 +693,7 @@ fn Liveness(ir: @mut IrMaps, specials: Specials) -> Liveness {
     }
 }
 
-impl Liveness {
+pub impl Liveness {
     fn live_node(&self, node_id: node_id, span: span) -> LiveNode {
         match self.ir.live_node_map.find(&node_id) {
           Some(ln) => ln,
@@ -1649,7 +1649,7 @@ enum ReadKind {
     PartiallyMovedValue
 }
 
-impl @Liveness {
+pub impl @Liveness {
     fn check_ret(&self, id: node_id, sp: span, _fk: &visit::fn_kind,
                  entry_ln: LiveNode) {
         if self.live_on_entry(entry_ln, self.s.no_ret_var).is_some() {
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index 3f8ee61e841..227d262a79e 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -312,7 +312,7 @@ impl ToStr for MutabilityCategory {
     }
 }
 
-impl MutabilityCategory {
+pub impl MutabilityCategory {
     static fn from_mutbl(&self, m: ast::mutability) -> MutabilityCategory {
         match m {
             m_imm => McImmutable,
diff --git a/src/librustc/middle/moves.rs b/src/librustc/middle/moves.rs
index b23066c1d96..d5adfee65af 100644
--- a/src/librustc/middle/moves.rs
+++ b/src/librustc/middle/moves.rs
@@ -301,7 +301,7 @@ fn compute_modes_for_expr(expr: @expr,
     cx.consume_expr(expr, v);
 }
 
-impl UseMode {
+pub impl UseMode {
     fn component_mode(&self, expr: @expr) -> UseMode {
         /*!
          *
@@ -316,7 +316,7 @@ impl UseMode {
     }
 }
 
-impl VisitContext {
+pub impl VisitContext {
     fn consume_exprs(&self,
                      exprs: &[@expr],
                      visitor: vt<VisitContext>)
diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs
index 3ec1cf3a705..e60069e05da 100644
--- a/src/librustc/middle/privacy.rs
+++ b/src/librustc/middle/privacy.rs
@@ -14,10 +14,11 @@
 
 use core::prelude::*;
 
+use metadata::csearch;
 use middle::ty::{ty_struct, ty_enum};
 use middle::ty;
-use middle::typeck::{method_map, method_origin, method_param, method_self,
-                     method_super};
+use middle::typeck::{method_map, method_origin, method_param, method_self};
+use middle::typeck::{method_super};
 use middle::typeck::{method_static, method_trait};
 
 use core::dvec::DVec;
@@ -25,7 +26,7 @@ use core::util::ignore;
 use syntax::ast::{def_variant, expr_field, expr_method_call, expr_struct};
 use syntax::ast::{expr_unary, ident, item_struct, item_enum, item_impl};
 use syntax::ast::{item_trait, local_crate, node_id, pat_struct, private};
-use syntax::ast::{provided, required};
+use syntax::ast::{provided, public, required};
 use syntax::ast;
 use syntax::ast_map::{node_item, node_method};
 use syntax::ast_map;
@@ -100,14 +101,52 @@ pub fn check_crate(tcx: ty::ctxt,
     };
 
     // Checks that a private method is in scope.
-    let check_method: @fn(span: span, origin: &method_origin) =
-            |span, origin| {
+    let check_method: @fn(span: span,
+                          origin: &method_origin,
+                          ident: ast::ident) =
+            |span, origin, ident| {
         match *origin {
             method_static(method_id) => {
                 if method_id.crate == local_crate {
                     match tcx.items.find(&method_id.node) {
                         Some(node_method(method, impl_id, _)) => {
-                            if method.vis == private &&
+                            let mut is_private = false;
+                            if method.vis == private {
+                                is_private = true;
+                            } else if method.vis == public {
+                                is_private = false;
+                            } else {
+                                // Look up the enclosing impl.
+                                if impl_id.crate != local_crate {
+                                    tcx.sess.span_bug(span,
+                                                      ~"local method isn't \
+                                                        in local impl?!");
+                                }
+
+                                match tcx.items.find(&impl_id.node) {
+                                    Some(node_item(item, _)) => {
+                                        match item.node {
+                                            item_impl(_, None, _, _)
+                                                    if item.vis != public => {
+                                                is_private = true;
+                                            }
+                                            _ => {}
+                                        }
+                                    }
+                                    Some(_) => {
+                                        tcx.sess.span_bug(span,
+                                                          ~"impl wasn't an \
+                                                            item?!");
+                                    }
+                                    None => {
+                                        tcx.sess.span_bug(span,
+                                                          ~"impl wasn't in \
+                                                            AST map?!");
+                                    }
+                                }
+                            }
+
+                            if is_private &&
                                     (impl_id.crate != local_crate ||
                                      !privileged_items
                                      .contains(&(impl_id.node))) {
@@ -131,7 +170,15 @@ pub fn check_crate(tcx: ty::ctxt,
                         }
                     }
                 } else {
-                    // FIXME #4732: External crates.
+                    let visibility =
+                        csearch::get_method_visibility(tcx.sess.cstore,
+                                                       method_id);
+                    if visibility != public {
+                        tcx.sess.span_err(span,
+                                          fmt!("method `%s` is private",
+                                               *tcx.sess.parse_sess.interner
+                                                   .get(ident)));
+                    }
                 }
             }
             method_param(method_param {
@@ -230,14 +277,16 @@ pub fn check_crate(tcx: ty::ctxt,
                                 Some(ref entry) => {
                                     debug!("(privacy checking) checking \
                                             impl method");
-                                    check_method(expr.span, &(*entry).origin);
+                                    check_method(expr.span,
+                                                 &entry.origin,
+                                                 ident);
                                 }
                             }
                         }
                         _ => {}
                     }
                 }
-                expr_method_call(base, _, _, _, _) => {
+                expr_method_call(base, ident, _, _, _) => {
                     // Ditto
                     match ty::get(ty::type_autoderef(tcx, ty::expr_ty(tcx,
                                                           base))).sty {
@@ -253,7 +302,9 @@ pub fn check_crate(tcx: ty::ctxt,
                                 Some(ref entry) => {
                                     debug!("(privacy checking) checking \
                                             impl method");
-                                    check_method(expr.span, &(*entry).origin);
+                                    check_method(expr.span,
+                                                 &entry.origin,
+                                                 ident);
                                 }
                             }
                         }
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index 6b7d4669621..1c4928fd374 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -622,6 +622,19 @@ pub impl NameBindings {
         }
     }
 
+    fn defined_in_public_namespace(namespace: Namespace) -> bool {
+        match namespace {
+            TypeNS => match self.type_def {
+                Some(def) => def.privacy != Private,
+                None => false
+            },
+            ValueNS => match self.value_def {
+                Some(def) => def.privacy != Private,
+                None => false
+            }
+        }
+    }
+
     fn def_for_namespace(namespace: Namespace) -> Option<def> {
         match namespace {
             TypeNS => {
@@ -2480,7 +2493,7 @@ pub impl Resolver {
 
             // Here we merge two import resolutions.
             match module_.import_resolutions.find(&ident) {
-                None => {
+                None if target_import_resolution.privacy == Public => {
                     // Simple: just copy the old import resolution.
                     let new_import_resolution =
                         @mut ImportResolution(privacy,
@@ -2494,6 +2507,7 @@ pub impl Resolver {
                     module_.import_resolutions.insert
                         (ident, new_import_resolution);
                 }
+                None => { /* continue ... */ }
                 Some(dest_import_resolution) => {
                     // Merge the two import resolutions at a finer-grained
                     // level.
@@ -2537,7 +2551,6 @@ pub impl Resolver {
                 }
             }
 
-
             debug!("(resolving glob import) writing resolution `%s` in `%s` \
                     to `%s`, privacy=%?",
                    *self.session.str_of(ident),
@@ -2546,12 +2559,12 @@ pub impl Resolver {
                    dest_import_resolution.privacy);
 
             // Merge the child item into the import resolution.
-            if (*name_bindings).defined_in_namespace(ValueNS) {
+            if (*name_bindings).defined_in_public_namespace(ValueNS) {
                 debug!("(resolving glob import) ... for value target");
                 dest_import_resolution.value_target =
                     Some(Target(containing_module, name_bindings));
             }
-            if (*name_bindings).defined_in_namespace(TypeNS) {
+            if (*name_bindings).defined_in_public_namespace(TypeNS) {
                 debug!("(resolving glob import) ... for type target");
                 dest_import_resolution.type_target =
                     Some(Target(containing_module, name_bindings));
@@ -2756,6 +2769,8 @@ pub impl Resolver {
                                namespace);
                     }
                     Some(target) => {
+                        debug!("(resolving item in lexical scope) using \
+                                import resolution");
                         import_resolution.state.used = true;
                         return Success(copy target);
                     }
diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs
index 8ed85b8f421..2f920378087 100644
--- a/src/librustc/middle/trans/_match.rs
+++ b/src/librustc/middle/trans/_match.rs
@@ -145,9 +145,10 @@
 use core::prelude::*;
 
 use back::abi;
-use lib::llvm::llvm;
-use lib::llvm::{ValueRef, BasicBlockRef};
+use lib;
+use lib::llvm::{llvm, ValueRef, BasicBlockRef};
 use middle::const_eval;
+use middle::borrowck::root_map_key;
 use middle::pat_util::*;
 use middle::resolve::DefMap;
 use middle::trans::base::*;
@@ -156,20 +157,26 @@ use middle::trans::callee;
 use middle::trans::common::*;
 use middle::trans::consts;
 use middle::trans::controlflow;
+use middle::trans::datum;
 use middle::trans::datum::*;
 use middle::trans::expr::Dest;
 use middle::trans::expr;
 use middle::trans::glue;
+use middle::trans::tvec;
+use middle::trans::type_of;
+use middle::ty;
 use util::common::indenter;
 
 use core::dvec::DVec;
 use core::dvec;
+use core::libc::c_ulonglong;
 use std::oldmap::HashMap;
 use syntax::ast::def_id;
 use syntax::ast;
-use syntax::ast_util::{dummy_sp, path_to_ident};
+use syntax::ast::ident;
+use syntax::ast_util::path_to_ident;
 use syntax::ast_util;
-use syntax::codemap::span;
+use syntax::codemap::{span, dummy_sp};
 use syntax::print::pprust::pat_to_str;
 
 // An option identifying a literal: either a unit-like struct or an
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 54d2af5ccce..d1472f63ae7 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -44,6 +44,7 @@ use middle::borrowck::RootInfo;
 use middle::pat_util::*;
 use middle::resolve;
 use middle::trans::_match;
+use middle::trans::base;
 use middle::trans::build::*;
 use middle::trans::callee;
 use middle::trans::common::*;
@@ -56,12 +57,15 @@ use middle::trans::foreign;
 use middle::trans::glue;
 use middle::trans::inline;
 use middle::trans::machine;
+use middle::trans::machine::llsize_of;
 use middle::trans::meth;
 use middle::trans::monomorphize;
 use middle::trans::reachable;
 use middle::trans::shape::*;
 use middle::trans::tvec;
+use middle::trans::type_of;
 use middle::trans::type_of::*;
+use middle::ty;
 use middle::ty::arg;
 use util::common::indenter;
 use util::ppaux::{ty_to_str, ty_to_short_str};
@@ -77,6 +81,7 @@ use core::option;
 use core::uint;
 use std::oldmap::HashMap;
 use std::{oldmap, time, list};
+use syntax::ast::ident;
 use syntax::ast_map::{path, path_elt_to_str, path_mod, path_name};
 use syntax::ast_util::{def_id_of_def, local_def, path_to_ident};
 use syntax::attr;
diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs
index 85e8be09878..7ac54518d37 100644
--- a/src/librustc/middle/trans/build.rs
+++ b/src/librustc/middle/trans/build.rs
@@ -10,6 +10,7 @@
 
 
 use codemap::span;
+use lib;
 use lib::llvm::llvm;
 use lib::llvm::{CallConv, TypeKind, AtomicBinOp, AtomicOrdering};
 use lib::llvm::{Opcode, IntPredicate, RealPredicate, True, False};
@@ -18,9 +19,12 @@ use libc::{c_uint, c_int, c_ulonglong};
 use middle::trans::common::*;
 use middle::trans::machine::llsize_of_real;
 
+use core::prelude::*;
 use core::cast::transmute;
 use core::cast;
 use core::libc;
+use core::option::Some;
+use core::ptr;
 use core::str;
 use core::vec;
 use std::oldmap::HashMap;
diff --git a/src/librustc/middle/trans/cabi.rs b/src/librustc/middle/trans/cabi.rs
index bc48519ffda..bbc19cf86ea 100644
--- a/src/librustc/middle/trans/cabi.rs
+++ b/src/librustc/middle/trans/cabi.rs
@@ -13,6 +13,10 @@ use middle::trans::base::*;
 use middle::trans::build::*;
 use middle::trans::common::*;
 
+use core::libc::c_uint;
+use core::option;
+use core::vec;
+
 pub trait ABIInfo {
     fn compute_info(&self,
                     atys: &[TypeRef],
@@ -28,7 +32,7 @@ pub struct LLVMType {
 pub struct FnType {
     arg_tys: ~[LLVMType],
     ret_ty: LLVMType,
-    attrs: ~[Option<Attribute>],
+    attrs: ~[option::Option<Attribute>],
     sret: bool
 }
 
@@ -93,7 +97,7 @@ pub impl FnType {
                       llargbundle: ValueRef, llretval: ValueRef) {
         for vec::eachi(self.attrs) |i, a| {
             match *a {
-                Some(attr) => {
+                option::Some(attr) => {
                     unsafe {
                         llvm::LLVMAddInstrAttribute(
                             llretval, (i + 1u) as c_uint,
@@ -205,8 +209,8 @@ impl ABIInfo for LLVM_ABIInfo {
     }
 }
 
-pub fn llvm_abi_info() -> ABIInfo {
-    return LLVM_ABIInfo as ABIInfo;
+pub fn llvm_abi_info() -> @ABIInfo {
+    return @LLVM_ABIInfo as @ABIInfo;
 }
 
 
diff --git a/src/librustc/middle/trans/cabi_arm.rs b/src/librustc/middle/trans/cabi_arm.rs
index 259392bef40..a16b3672b7a 100644
--- a/src/librustc/middle/trans/cabi_arm.rs
+++ b/src/librustc/middle/trans/cabi_arm.rs
@@ -159,6 +159,6 @@ impl ABIInfo for ARM_ABIInfo {
     }
 }
 
-pub fn abi_info() -> ABIInfo {
-    return ARM_ABIInfo as ABIInfo;
+pub fn abi_info() -> @ABIInfo {
+    return @ARM_ABIInfo as @ABIInfo;
 }
diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs
index df0f11eedae..562009dc2ca 100644
--- a/src/librustc/middle/trans/cabi_x86_64.rs
+++ b/src/librustc/middle/trans/cabi_x86_64.rs
@@ -18,6 +18,14 @@ use lib::llvm::struct_tys;
 use middle::trans::common::*;
 use middle::trans::cabi::*;
 
+use core::cmp;
+use core::libc::c_uint;
+use core::option;
+use core::option::Option;
+use core::ptr;
+use core::uint;
+use core::vec;
+
 enum x86_64_reg_class {
     no_class,
     integer_class,
@@ -400,5 +408,5 @@ impl ABIInfo for X86_64_ABIInfo {
 }
 
 pub fn x86_64_abi_info() -> ABIInfo {
-    return X86_64_ABIInfo as ABIInfo;
+    return @X86_64_ABIInfo as @ABIInfo;
 }
diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs
index f72390f7271..3a68e8e94c6 100644
--- a/src/librustc/middle/trans/callee.rs
+++ b/src/librustc/middle/trans/callee.rs
@@ -18,21 +18,33 @@
 
 use core::prelude::*;
 
-use lib::llvm::ValueRef;
-use middle::trans::base::{get_item_val, trans_external_path};
+use back::abi;
+use driver::session;
+use lib;
+use lib::llvm::{ValueRef, TypeRef};
+use lib::llvm::llvm;
+use metadata::csearch;
+use middle::trans::base;
+use middle::trans::base::*;
 use middle::trans::build::*;
 use middle::trans::callee;
 use middle::trans::closure;
-use middle::trans::common::{block, node_id_type_params};
+use middle::trans::common;
+use middle::trans::common::*;
 use middle::trans::datum::*;
 use middle::trans::datum::Datum;
+use middle::trans::expr;
+use middle::trans::glue;
 use middle::trans::inline;
 use middle::trans::meth;
 use middle::trans::monomorphize;
+use middle::trans::type_of;
+use middle::ty;
 use middle::typeck;
 use util::common::indenter;
 
 use syntax::ast;
+use syntax::ast_map;
 use syntax::print::pprust::{expr_to_str, stmt_to_str, path_to_str};
 use syntax::visit;
 
diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs
index 40407fbf52b..949318d1723 100644
--- a/src/librustc/middle/trans/closure.rs
+++ b/src/librustc/middle/trans/closure.rs
@@ -13,8 +13,7 @@ use core::prelude::*;
 use back::abi;
 use back::link::{mangle_internal_name_by_path_and_seq};
 use back::link::{mangle_internal_name_by_path};
-use lib::llvm::llvm;
-use lib::llvm::{ValueRef, TypeRef};
+use lib::llvm::{llvm, ValueRef, TypeRef};
 use middle::moves;
 use middle::trans::base::*;
 use middle::trans::build::*;
@@ -25,6 +24,7 @@ use middle::trans::expr;
 use middle::trans::glue;
 use middle::trans::machine;
 use middle::trans::type_of::*;
+use middle::ty;
 use util::ppaux::ty_to_str;
 
 use core::libc::c_uint;
@@ -33,6 +33,7 @@ use syntax::ast;
 use syntax::ast_map::{path, path_mod, path_name};
 use syntax::ast_util;
 use syntax::codemap::span;
+use syntax::parse::token::special_idents;
 use syntax::print::pprust::expr_to_str;
 
 // ___Good to know (tm)__________________________________________________
@@ -185,7 +186,7 @@ pub fn allocate_cbox(bcx: block, sigil: ast::Sigil, cdata_ty: ty::t)
         }
         ast::BorrowedSigil => {
             let cbox_ty = tuplify_box_ty(tcx, cdata_ty);
-            let llbox = base::alloc_ty(bcx, cbox_ty);
+            let llbox = alloc_ty(bcx, cbox_ty);
             nuke_ref_count(bcx, llbox);
             rslt(bcx, llbox)
         }
@@ -342,7 +343,7 @@ pub fn load_environment(fcx: fn_ctxt,
     let bcx = raw_block(fcx, false, llloadenv);
 
     // Load a pointer to the closure data, skipping over the box header:
-    let llcdata = base::opaque_box_body(bcx, cdata_ty, fcx.llenv);
+    let llcdata = opaque_box_body(bcx, cdata_ty, fcx.llenv);
 
     // Populate the upvars from the environment.
     let mut i = 0u;
diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs
index 566b2689f2e..97f8ec84a1d 100644
--- a/src/librustc/middle/trans/common.rs
+++ b/src/librustc/middle/trans/common.rs
@@ -157,7 +157,7 @@ pub fn BuilderRef_res(B: BuilderRef) -> BuilderRef_res {
     }
 }
 
-type ExternMap = HashMap<@str, ValueRef>;
+pub type ExternMap = HashMap<@str, ValueRef>;
 
 // Crate context.  Every crate we compile has one of these.
 pub struct CrateContext {
@@ -553,10 +553,7 @@ impl get_node_info for ast::blk {
     }
 }
 
-// XXX: Work around a trait parsing bug. remove after snapshot
-pub type optional_boxed_ast_expr = Option<@ast::expr>;
-
-impl get_node_info for optional_boxed_ast_expr {
+impl get_node_info for Option<@ast::expr> {
     fn info(&self) -> Option<NodeInfo> {
         self.chain_ref(|s| s.info())
     }
diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs
index ab85da304cb..36cda3dfbe9 100644
--- a/src/librustc/middle/trans/consts.rs
+++ b/src/librustc/middle/trans/consts.rs
@@ -10,14 +10,18 @@
 
 use core::prelude::*;
 
+use lib::llvm::{llvm, ValueRef, True, TypeRef, False};
 use middle::const_eval;
+use middle::trans::base;
 use middle::trans::base::get_insn_ctxt;
 use middle::trans::common::*;
 use middle::trans::consts;
 use middle::trans::expr;
 use middle::trans::machine;
+use middle::trans::type_of;
 use middle::ty;
 
+use core::libc::c_uint;
 use syntax::{ast, ast_util, codemap, ast_map};
 
 pub fn const_lit(cx: @CrateContext, e: @ast::expr, lit: ast::lit)
diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs
index 70321d50f3f..9b282e71b3e 100644
--- a/src/librustc/middle/trans/controlflow.rs
+++ b/src/librustc/middle/trans/controlflow.rs
@@ -10,13 +10,28 @@
 
 use core::prelude::*;
 
-use lib::llvm::ValueRef;
+use back::link;
+use lib;
+use lib::llvm::*;
 use middle::trans::base::*;
+use middle::trans::build::*;
 use middle::trans::callee;
 use middle::trans::common::*;
 use middle::trans::datum::*;
+use middle::trans::debuginfo;
+use middle::trans::expr;
+use middle::trans::type_of::*;
+use middle::ty;
+use util::common::indenter;
+use util::ppaux;
 
 use core::str;
+use syntax::ast;
+use syntax::ast::ident;
+use syntax::ast_map::path_mod;
+use syntax::ast_util;
+use syntax::codemap::span;
+use syntax::print::pprust::expr_to_str;
 
 pub fn trans_block(bcx: block, b: &ast::blk, dest: expr::Dest) -> block {
     let _icx = bcx.insn_ctxt("trans_block");
diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs
index c93ab056de0..94c90aaad6d 100644
--- a/src/librustc/middle/trans/datum.rs
+++ b/src/librustc/middle/trans/datum.rs
@@ -87,21 +87,29 @@
 
 use core::prelude::*;
 
+use lib;
 use lib::llvm::ValueRef;
 use middle::borrowck::{RootInfo, root_map_key};
 use middle::trans::base::*;
 use middle::trans::build::*;
+use middle::trans::callee;
 use middle::trans::common::*;
 use middle::trans::common;
+use middle::trans::expr;
+use middle::trans::glue;
 use middle::trans::tvec;
+use middle::trans::type_of;
+use middle::ty;
 use middle::typeck;
 use util::common::indenter;
 use util::ppaux::ty_to_str;
 
 use core::cmp;
 use core::option;
+use core::to_bytes;
 use core::uint;
 use core::vec;
+use syntax::ast;
 use syntax::parse::token::special_idents;
 
 #[deriving_eq]
@@ -326,7 +334,7 @@ pub impl Datum {
                 Store(bcx, self.val, dst);
             }
             ByRef => {
-                base::memcpy_ty(bcx, dst, self.val, self.ty);
+                memcpy_ty(bcx, dst, self.val, self.ty);
             }
         }
 
@@ -354,7 +362,7 @@ pub impl Datum {
 
         match self.mode {
             ByRef => {
-                base::memcpy_ty(bcx, dst, self.val, self.ty);
+                memcpy_ty(bcx, dst, self.val, self.ty);
             }
             ByValue => {
                 Store(bcx, self.val, dst);
@@ -540,7 +548,7 @@ pub impl Datum {
 
         let scratch = scratch_datum(bcx, self.ty, true);
         self.copy_to_datum(bcx, INIT, scratch);
-        base::add_root_cleanup(bcx, root_info, scratch.val, scratch.ty);
+        add_root_cleanup(bcx, root_info, scratch.val, scratch.ty);
 
         // If we need to freeze the box, do that now.
         if root_info.freezes {
diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs
index 6226e83d046..c6ed190c7c3 100644
--- a/src/librustc/middle/trans/expr.rs
+++ b/src/librustc/middle/trans/expr.rs
@@ -121,10 +121,15 @@ lvalues are *never* stored by value.
 
 use core::prelude::*;
 
-use lib::llvm::ValueRef;
+use back::abi;
+use lib;
+use lib::llvm::{ValueRef, TypeRef, llvm, True};
 use middle::borrowck::root_map_key;
 use middle::resolve;
+use middle::trans::_match;
+use middle::trans::base;
 use middle::trans::base::*;
+use middle::trans::build::*;
 use middle::trans::callee::{AutorefArg, DoAutorefArg, DontAutorefArg};
 use middle::trans::callee;
 use middle::trans::closure;
@@ -132,16 +137,21 @@ use middle::trans::common::*;
 use middle::trans::consts;
 use middle::trans::controlflow;
 use middle::trans::datum::*;
+use middle::trans::debuginfo;
 use middle::trans::machine;
 use middle::trans::meth;
 use middle::trans::tvec;
+use middle::trans::type_of;
+use middle::ty;
 use middle::ty::struct_mutable_fields;
 use middle::ty::{AutoPtr, AutoBorrowVec, AutoBorrowVecRef, AutoBorrowFn};
 use util::common::indenter;
 use util::ppaux::ty_to_str;
 
+use std::oldmap::HashMap;
 use syntax::print::pprust::{expr_to_str};
 use syntax::ast;
+use syntax::codemap;
 use syntax::codemap::spanned;
 
 // Destinations
@@ -154,7 +164,7 @@ pub enum Dest {
     Ignore,
 }
 
-impl Dest {
+pub impl Dest {
     fn to_str(&self, ccx: @CrateContext) -> ~str {
         match *self {
             SaveIn(v) => fmt!("SaveIn(%s)", val_str(ccx.tn, v)),
@@ -1128,7 +1138,7 @@ fn trans_rec_or_struct(bcx: block,
                     let fields = ty::struct_mutable_fields(
                         tcx, variant_id, substs);
                     let field_lltys = do fields.map |field| {
-                        type_of(bcx.ccx(),
+                        type_of::type_of(bcx.ccx(),
                                 ty::subst_tps(
                                     tcx, substs.tps, None, field.mt.ty))
                     };
diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs
index ef0d61d49de..6c0c73dd016 100644
--- a/src/librustc/middle/trans/foreign.rs
+++ b/src/librustc/middle/trans/foreign.rs
@@ -11,6 +11,7 @@
 use core::prelude::*;
 
 use back::{link, abi};
+use driver::session;
 use driver::session::arch_x86_64;
 use driver::session::arch_arm;
 use lib::llvm::{SequentiallyConsistent, Acquire, Release, Xchg};
@@ -27,11 +28,13 @@ use middle::trans::callee::*;
 use middle::trans::common::*;
 use middle::trans::datum::*;
 use middle::trans::expr::{Dest, Ignore};
+use middle::trans::machine::llsize_of;
 use middle::trans::glue;
 use middle::trans::machine;
 use middle::trans::shape;
 use middle::trans::type_of::*;
 use middle::trans::type_of;
+use middle::ty;
 use middle::ty::{FnSig, arg};
 use util::ppaux::ty_to_str;
 
diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs
index bcb22022d46..96deb2906eb 100644
--- a/src/librustc/middle/trans/glue.rs
+++ b/src/librustc/middle/trans/glue.rs
@@ -14,19 +14,32 @@
 
 use core::prelude::*;
 
-use lib::llvm::{ValueRef, TypeRef};
+use back::abi;
+use back::link::*;
+use driver::session;
+use lib;
+use lib::llvm::{llvm, ValueRef, TypeRef, True};
 use middle::trans::base::*;
 use middle::trans::callee;
 use middle::trans::closure;
 use middle::trans::common::*;
 use middle::trans::build::*;
+use middle::trans::expr;
+use middle::trans::machine::*;
 use middle::trans::reflect;
 use middle::trans::tvec;
-use middle::trans::type_of::type_of;
+use middle::trans::type_of::{type_of, type_of_glue_fn};
 use middle::trans::uniq;
+use middle::ty;
+use util::ppaux;
+use util::ppaux::ty_to_short_str;
 
 use core::io;
+use core::libc::c_uint;
 use core::str;
+use std::time;
+use syntax::ast;
+use syntax::parse::token::special_idents;
 
 pub fn trans_free(cx: block, v: ValueRef) -> block {
     let _icx = cx.insn_ctxt("trans_free");
@@ -218,7 +231,7 @@ pub fn lazily_emit_simplified_tydesc_glue(ccx: @CrateContext,
     let _icx = ccx.insn_ctxt("lazily_emit_simplified_tydesc_glue");
     let simpl = simplified_glue_type(ccx.tcx, field, ti.ty);
     if simpl != ti.ty {
-        let simpl_ti = base::get_tydesc(ccx, simpl);
+        let simpl_ti = get_tydesc(ccx, simpl);
         lazily_emit_tydesc_glue(ccx, field, simpl_ti);
         if field == abi::tydesc_field_take_glue {
             ti.take_glue =
@@ -661,7 +674,7 @@ pub fn declare_tydesc(ccx: @CrateContext, t: ty::t) -> @mut tydesc_info {
     if ccx.sess.count_type_sizes() {
         io::println(fmt!("%u\t%s",
                          llsize_of_real(ccx, llty),
-                         ty_to_str(ccx.tcx, t)));
+                         ppaux::ty_to_str(ccx.tcx, t)));
     }
 
     let llsize = llsize_of(ccx, llty);
@@ -675,7 +688,7 @@ pub fn declare_tydesc(ccx: @CrateContext, t: ty::t) -> @mut tydesc_info {
     };
     // XXX: Bad copy.
     note_unique_llvm_symbol(ccx, copy name);
-    log(debug, fmt!("+++ declare_tydesc %s %s", ty_to_str(ccx.tcx, t), name));
+    debug!("+++ declare_tydesc %s %s", ppaux::ty_to_str(ccx.tcx, t), name);
     let gvar = str::as_c_str(name, |buf| {
         unsafe {
             llvm::LLVMAddGlobal(ccx.llmod, ccx.tydesc_type, buf)
@@ -709,7 +722,7 @@ pub fn declare_generic_glue(ccx: @CrateContext, t: ty::t, llfnty: TypeRef,
     } else {
         fn_nm = mangle_internal_name_by_seq(ccx, (~"glue_" + name));
     }
-    debug!("%s is for type %s", fn_nm, ty_to_str(ccx.tcx, t));
+    debug!("%s is for type %s", fn_nm, ppaux::ty_to_str(ccx.tcx, t));
     // XXX: Bad copy.
     note_unique_llvm_symbol(ccx, copy fn_nm);
     let llfn = decl_cdecl_fn(ccx.llmod, fn_nm, llfnty);
diff --git a/src/librustc/middle/trans/inline.rs b/src/librustc/middle/trans/inline.rs
index b352b078a47..7ce36c2b1e2 100644
--- a/src/librustc/middle/trans/inline.rs
+++ b/src/librustc/middle/trans/inline.rs
@@ -10,6 +10,7 @@
 
 use core::prelude::*;
 
+use metadata::csearch;
 use middle::astencode;
 use middle::trans::base::{get_insn_ctxt};
 use middle::trans::base::{impl_owned_self, impl_self, no_self};
@@ -18,6 +19,8 @@ use middle::trans::common::*;
 use middle::trans::common;
 use middle::trans::inline;
 use middle::trans::monomorphize;
+use middle::ty;
+use util::ppaux::ty_to_str;
 
 use core::vec;
 use syntax::ast;
diff --git a/src/librustc/middle/trans/machine.rs b/src/librustc/middle/trans/machine.rs
index bfada859bc2..8d447f54c20 100644
--- a/src/librustc/middle/trans/machine.rs
+++ b/src/librustc/middle/trans/machine.rs
@@ -11,6 +11,9 @@
 // Information concerning the machine representation of various types.
 
 
+use lib::llvm::{ModuleRef, ValueRef, TypeRef, BasicBlockRef, BuilderRef};
+use lib::llvm::{True, False, Bool};
+use lib::llvm::llvm;
 use middle::trans::common::*;
 use middle::trans::type_of;
 use middle::ty;
@@ -122,7 +125,7 @@ pub fn llalign_of_min(cx: @CrateContext, t: TypeRef) -> uint {
 pub fn llalign_of(cx: @CrateContext, t: TypeRef) -> ValueRef {
     unsafe {
         return llvm::LLVMConstIntCast(
-            lib::llvm::llvm::LLVMAlignOf(t), cx.int_type, False);
+            llvm::LLVMAlignOf(t), cx.int_type, False);
     }
 }
 
diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs
index d836bcb9df9..d2bf034165d 100644
--- a/src/librustc/middle/trans/meth.rs
+++ b/src/librustc/middle/trans/meth.rs
@@ -28,14 +28,16 @@ use middle::trans::glue;
 use middle::trans::inline;
 use middle::trans::monomorphize;
 use middle::trans::type_of::*;
+use middle::ty;
 use middle::ty::arg;
 use middle::typeck;
+use util::common::indenter;
 use util::ppaux::{ty_to_str, tys_to_str};
 
 use core::libc::c_uint;
 use std::oldmap::HashMap;
 use syntax::ast_map::{path, path_mod, path_name, node_id_to_str};
-use syntax::ast_util::local_def;
+use syntax::ast_util;
 use syntax::print::pprust::expr_to_str;
 use syntax::{ast, ast_map};
 
@@ -351,7 +353,7 @@ pub fn trans_static_method_callee(bcx: block,
 
 pub fn method_from_methods(ms: ~[@ast::method], name: ast::ident)
     -> Option<ast::def_id> {
-    ms.find(|m| m.ident == name).map(|m| local_def(m.id))
+    ms.find(|m| m.ident == name).map(|m| ast_util::local_def(m.id))
 }
 
 pub fn method_with_name(ccx: @CrateContext, impl_id: ast::def_id,
@@ -725,7 +727,7 @@ pub fn trans_trait_callee_from_llval(bcx: block,
 
     // Load the function from the vtable and cast it to the expected type.
     debug!("(translating trait callee) loading method");
-    let llcallee_ty = type_of::type_of_fn_from_ty(ccx, callee_ty);
+    let llcallee_ty = type_of_fn_from_ty(ccx, callee_ty);
     let mptr = Load(bcx, GEPi(bcx, llvtable, [0u, n_method]));
     let mptr = PointerCast(bcx, mptr, T_ptr(llcallee_ty));
 
@@ -868,27 +870,11 @@ pub fn trans_trait_cast(bcx: block,
     match vstore {
         ty::vstore_slice(*) | ty::vstore_box => {
             let mut llboxdest = GEPi(bcx, lldest, [0u, 1u]);
-            if bcx.tcx().legacy_boxed_traits.contains_key(&id) {
-                // Allocate an @ box and store the value into it
-                let MallocResult {bcx: new_bcx, box: llbox, body: body} =
-                    malloc_boxed(bcx, v_ty);
-                bcx = new_bcx;
-                add_clean_free(bcx, llbox, heap_managed);
-                bcx = expr::trans_into(bcx, val, SaveIn(body));
-                revoke_clean(bcx, llbox);
-
-                // Store the @ box into the pair
-                Store(bcx, llbox, PointerCast(bcx,
-                                              llboxdest,
-                                              T_ptr(val_ty(llbox))));
-            } else {
-                // Just store the pointer into the pair.
-                llboxdest = PointerCast(bcx,
-                                        llboxdest,
-                                        T_ptr(type_of::type_of(bcx.ccx(),
-                                                               v_ty)));
-                bcx = expr::trans_into(bcx, val, SaveIn(llboxdest));
-            }
+            // Just store the pointer into the pair.
+            llboxdest = PointerCast(bcx,
+                                    llboxdest,
+                                    T_ptr(type_of(bcx.ccx(), v_ty)));
+            bcx = expr::trans_into(bcx, val, SaveIn(llboxdest));
         }
         ty::vstore_uniq => {
             // Translate the uniquely-owned value into the second element of
@@ -896,7 +882,7 @@ pub fn trans_trait_cast(bcx: block,
             let mut llvaldest = GEPi(bcx, lldest, [0, 1]);
             llvaldest = PointerCast(bcx,
                                     llvaldest,
-                                    T_ptr(type_of::type_of(bcx.ccx(), v_ty)));
+                                    T_ptr(type_of(bcx.ccx(), v_ty)));
             bcx = expr::trans_into(bcx, val, SaveIn(llvaldest));
 
             // Get the type descriptor of the wrapped value and store it into
diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs
index 9be316b3022..30a42210a13 100644
--- a/src/librustc/middle/trans/monomorphize.rs
+++ b/src/librustc/middle/trans/monomorphize.rs
@@ -11,6 +11,8 @@
 use core::prelude::*;
 
 use back::link::mangle_exported_name;
+use driver::session;
+use lib::llvm::ValueRef;
 use middle::trans::base::{get_insn_ctxt};
 use middle::trans::base::{set_inline_hint_if_appr, set_inline_hint};
 use middle::trans::base::{trans_enum_variant, trans_struct_dtor};
@@ -26,12 +28,15 @@ use middle::trans::shape;
 use middle::trans::type_of::type_of_fn_from_ty;
 use middle::trans::type_of;
 use middle::trans::type_use;
+use middle::ty;
 use middle::ty::{FnSig};
 use middle::typeck;
+use util::ppaux::ty_to_str;
 
 use core::option;
 use core::vec;
 use syntax::ast;
+use syntax::ast_map;
 use syntax::ast_map::{path, path_mod, path_name};
 use syntax::ast_util::local_def;
 use syntax::parse::token::special_idents;
diff --git a/src/librustc/middle/trans/reachable.rs b/src/librustc/middle/trans/reachable.rs
index d93886dbb3e..17abebad600 100644
--- a/src/librustc/middle/trans/reachable.rs
+++ b/src/librustc/middle/trans/reachable.rs
@@ -21,11 +21,13 @@ use middle::resolve;
 use middle::ty;
 use middle::typeck;
 
-use core::vec;
+use core::prelude::*;
 use std::oldmap::HashMap;
+use syntax::ast;
 use syntax::ast::*;
 use syntax::ast_util::def_id_of_def;
 use syntax::attr;
+use syntax::codemap;
 use syntax::print::pprust::expr_to_str;
 use syntax::{visit, ast_util, ast_map};
 
diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs
index 1fa97325313..dcfa897ab60 100644
--- a/src/librustc/middle/trans/reflect.rs
+++ b/src/librustc/middle/trans/reflect.rs
@@ -22,8 +22,11 @@ use middle::trans::glue;
 use middle::trans::machine;
 use middle::trans::meth;
 use middle::trans::type_of::*;
+use middle::ty;
 use util::ppaux::ty_to_str;
 
+use core::option::None;
+use core::vec;
 use std::oldmap::HashMap;
 use syntax::ast::def_id;
 use syntax::ast;
@@ -60,7 +63,7 @@ pub impl Reflector {
     }
 
     fn c_size_and_align(&mut self, t: ty::t) -> ~[ValueRef] {
-        let tr = type_of::type_of(self.bcx.ccx(), t);
+        let tr = type_of(self.bcx.ccx(), t);
         let s = machine::llsize_of_real(self.bcx.ccx(), tr);
         let a = machine::llalign_of_min(self.bcx.ccx(), tr);
         return ~[self.c_uint(s),
@@ -351,7 +354,7 @@ pub fn emit_calls_to_trait_visit_ty(bcx: block,
     let final = sub_block(bcx, ~"final");
     assert bcx.ccx().tcx.intrinsic_defs.contains_key(&tydesc);
     let (_, tydesc_ty) = bcx.ccx().tcx.intrinsic_defs.get(&tydesc);
-    let tydesc_ty = type_of::type_of(bcx.ccx(), tydesc_ty);
+    let tydesc_ty = type_of(bcx.ccx(), tydesc_ty);
     let mut r = Reflector {
         visitor_val: visitor_val,
         visitor_methods: ty::trait_methods(bcx.tcx(), visitor_trait_id),
diff --git a/src/librustc/middle/trans/shape.rs b/src/librustc/middle/trans/shape.rs
index 72e2369111d..72e4fa2f4eb 100644
--- a/src/librustc/middle/trans/shape.rs
+++ b/src/librustc/middle/trans/shape.rs
@@ -25,6 +25,7 @@ use util::ppaux::ty_to_str;
 
 use core::dvec::DVec;
 use core::option::is_some;
+use core::str;
 use core::vec;
 use std::oldmap::HashMap;
 use syntax::ast;
diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs
index dc004c81b11..4ce60daf60f 100644
--- a/src/librustc/middle/trans/tvec.rs
+++ b/src/librustc/middle/trans/tvec.rs
@@ -10,20 +10,27 @@
 
 
 use back::abi;
-use lib::llvm::{ValueRef, TypeRef};
+use lib;
+use lib::llvm::{llvm, ValueRef, TypeRef};
+use middle::trans::base;
+use middle::trans::base::*;
 use middle::trans::build::*;
+use middle::trans::callee;
 use middle::trans::common::*;
 use middle::trans::datum::*;
 use middle::trans::expr::{Dest, Ignore, SaveIn};
 use middle::trans::expr;
 use middle::trans::glue;
-use middle::trans::shape::{llsize_of, nonzero_llsize_of};
+use middle::trans::machine::{llsize_of, nonzero_llsize_of};
 use middle::trans::type_of;
 use middle::ty;
 use util::common::indenter;
 use util::ppaux::ty_to_str;
 
+use core::uint;
+use core::vec;
 use syntax::ast;
+use syntax::codemap;
 use syntax::codemap::span;
 use syntax::print::pprust::{expr_to_str};
 
@@ -81,7 +88,7 @@ pub fn alloc_raw(bcx: block, unit_ty: ty::t,
     let vecbodyty = ty::mk_mut_unboxed_vec(bcx.tcx(), unit_ty);
     let vecsize = Add(bcx, alloc, llsize_of(ccx, ccx.opaque_vec_type));
 
-    let MallocResult {bcx, box: bx, body} =
+    let base::MallocResult {bcx, box: bx, body} =
         base::malloc_general_dyn(bcx, vecbodyty, heap, vecsize);
     Store(bcx, fill, GEPi(bcx, body, [0u, abi::vec_elt_fill]));
     Store(bcx, alloc, GEPi(bcx, body, [0u, abi::vec_elt_alloc]));
@@ -91,7 +98,7 @@ pub fn alloc_raw(bcx: block, unit_ty: ty::t,
 
 pub fn alloc_uniq_raw(bcx: block, unit_ty: ty::t,
                       fill: ValueRef, alloc: ValueRef) -> Result {
-    alloc_raw(bcx, unit_ty, fill, alloc, heap_for_unique(bcx, unit_ty))
+    alloc_raw(bcx, unit_ty, fill, alloc, base::heap_for_unique(bcx, unit_ty))
 }
 
 pub fn alloc_vec(bcx: block,
@@ -305,13 +312,13 @@ pub fn trans_uniq_or_managed_vstore(bcx: block,
                     let llptrval = PointerCast(bcx, llptrval, T_ptr(T_i8()));
                     let llsizeval = C_uint(bcx.ccx(), s.len());
                     let typ = ty::mk_estr(bcx.tcx(), ty::vstore_uniq);
-                    let lldestval = datum::scratch_datum(bcx, typ, false);
+                    let lldestval = scratch_datum(bcx, typ, false);
                     let bcx = callee::trans_lang_call(
                         bcx,
                         bcx.tcx().lang_items.strdup_uniq_fn(),
                         ~[ llptrval, llsizeval ],
                         expr::SaveIn(lldestval.to_ref_llval(bcx)));
-                    return datum::DatumBlock {
+                    return DatumBlock {
                         bcx: bcx,
                         datum: lldestval
                     };
@@ -508,8 +515,8 @@ pub fn get_base_and_len(bcx: block,
             (base, len)
         }
         ty::vstore_uniq | ty::vstore_box => {
-            let body = tvec::get_bodyptr(bcx, llval);
-            (tvec::get_dataptr(bcx, body), tvec::get_fill(bcx, body))
+            let body = get_bodyptr(bcx, llval);
+            (get_dataptr(bcx, body), get_fill(bcx, body))
         }
     }
 }
diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs
index 8275db8cdb2..7d3aa4c24f4 100644
--- a/src/librustc/middle/trans/type_of.rs
+++ b/src/librustc/middle/trans/type_of.rs
@@ -11,12 +11,16 @@
 
 use lib::llvm::llvm;
 use lib::llvm::{TypeRef};
+use middle::trans::base;
 use middle::trans::common::*;
 use middle::trans::common;
 use middle::trans::expr;
 use middle::trans::machine;
+use middle::ty;
 use util::ppaux;
 
+use core::option::None;
+use core::vec;
 use std::oldmap::HashMap;
 use syntax::ast;
 
@@ -387,7 +391,7 @@ pub fn type_of_dtor(ccx: @CrateContext, self_ty: ty::t) -> TypeRef {
 pub fn type_of_rooted(ccx: @CrateContext, t: ty::t) -> TypeRef {
     let addrspace = base::get_tydesc(ccx, t).addrspace;
     debug!("type_of_rooted %s in addrspace %u",
-           ty_to_str(ccx.tcx, t), addrspace as uint);
+           ppaux::ty_to_str(ccx.tcx, t), addrspace as uint);
     return T_root(type_of(ccx, t), addrspace);
 }
 
diff --git a/src/librustc/middle/trans/type_use.rs b/src/librustc/middle/trans/type_use.rs
index 627042a6516..ff92f265cc0 100644
--- a/src/librustc/middle/trans/type_use.rs
+++ b/src/librustc/middle/trans/type_use.rs
@@ -32,13 +32,17 @@ use metadata::csearch;
 use middle::freevars;
 use middle::trans::common::*;
 use middle::trans::inline;
+use middle::ty;
+use middle::typeck;
 
 use core::option;
+use core::option::{Some, None, Option};
 use core::uint;
 use core::vec;
 use std::list::{List, Cons, Nil};
 use std::list;
 use std::oldmap::HashMap;
+use syntax::ast;
 use syntax::ast::*;
 use syntax::ast_map;
 use syntax::ast_util;
diff --git a/src/librustc/middle/trans/uniq.rs b/src/librustc/middle/trans/uniq.rs
index aa02cc4bf5d..7db76258404 100644
--- a/src/librustc/middle/trans/uniq.rs
+++ b/src/librustc/middle/trans/uniq.rs
@@ -17,6 +17,7 @@ use middle::trans::common::*;
 use middle::trans::datum::immediate_rvalue;
 use middle::trans::datum;
 use middle::trans::glue;
+use middle::ty;
 
 use syntax::ast;
 
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index c34e8dae21f..90f97a939ad 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -269,7 +269,6 @@ struct ctxt_ {
     adjustments: HashMap<ast::node_id, @AutoAdjustment>,
     normalized_cache: HashMap<t, t>,
     lang_items: middle::lang_items::LanguageItems,
-    legacy_boxed_traits: HashMap<node_id, ()>,
     // A mapping from an implementation ID to the method info and trait
     // method ID of the provided (a.k.a. default) methods in the traits that
     // that implementation implements.
@@ -831,7 +830,6 @@ pub fn mk_ctxt(s: session::Session,
         adjustments: HashMap(),
         normalized_cache: new_ty_hash(),
         lang_items: lang_items,
-        legacy_boxed_traits: HashMap(),
         provided_methods: HashMap(),
         provided_method_sources: HashMap(),
         supertraits: HashMap(),
@@ -3714,7 +3712,7 @@ pub enum DtorKind {
     TraitDtor(def_id)
 }
 
-impl DtorKind {
+pub impl DtorKind {
     pure fn is_not_present(&const self) -> bool {
         match *self {
             NoDtor => true,
diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs
index c8cd7c05fe8..2dbf74e1666 100644
--- a/src/librustc/middle/typeck/check/vtable.rs
+++ b/src/librustc/middle/typeck/check/vtable.rs
@@ -97,8 +97,8 @@ pub fn lookup_vtables(vcx: &VtableContext,
     let mut result = ~[], i = 0u;
     for substs.tps.each |ty| {
         for ty::iter_bound_traits_and_supertraits(
-            tcx, bounds[i]) |trait_ty| {
-
+            tcx, bounds[i]) |trait_ty|
+        {
             debug!("about to subst: %?, %?",
                    ppaux::ty_to_str(tcx, trait_ty),
                    ty::substs_to_str(tcx, substs));
@@ -585,138 +585,102 @@ pub fn early_resolve_expr(ex: @ast::expr,
         }
       }
       ast::expr_cast(src, _) => {
-        let target_ty = fcx.expr_ty(ex);
-        match ty::get(target_ty).sty {
-          ty::ty_trait(_, _, vstore) => {
-            // Look up vtables for the type we're casting to, passing in the
-            // source and target type.
-            //
-            // XXX: This is invariant and shouldn't be. --pcw
-
-            let ty = fcx.expr_ty(src);
-            let vcx = VtableContext { ccx: fcx.ccx, infcx: fcx.infcx() };
-            let vtable_opt =
-                lookup_vtable(&vcx,
-                              &location_info_for_expr(ex),
-                              ty,
-                              target_ty,
-                              true,
-                              is_early);
-            match vtable_opt {
-                None => {
-                    // Try the new-style boxed trait; "@int as @Trait".
-                    // Or the new-style region trait; "&int as &Trait".
-                    // Or the new-style uniquely-owned trait; "~int as
-                    // ~Trait".
-                    let mut err = false;
-                    let ty = structurally_resolved_type(fcx, ex.span, ty);
-                    match ty::get(ty).sty {
-                        ty::ty_box(mt) | ty::ty_rptr(_, mt) |
-                        ty::ty_uniq(mt) => {
-                            // Ensure that the trait vstore and the pointer
-                            // type match.
-                            match (&ty::get(ty).sty, vstore) {
-                                (&ty::ty_box(_), ty::vstore_box) |
-                                (&ty::ty_uniq(_), ty::vstore_uniq) |
-                                (&ty::ty_rptr(*), ty::vstore_slice(*)) => {
-                                    let location_info =
-                                        &location_info_for_expr(ex);
-                                    let vtable_opt =
-                                        lookup_vtable(&vcx,
-                                                      location_info,
-                                                      mt.ty,
-                                                      target_ty,
-                                                      true,
-                                                      is_early);
-                                    match vtable_opt {
-                                        Some(vtable) => {
-                                            // Map this expression to that
-                                            // vtable (that is: "ex has vtable
-                                            // <vtable>")
-                                            if !is_early {
-                                                let vtable_map =
-                                                    cx.vtable_map;
-                                                vtable_map.insert(ex.id,
-                                                                  @~[vtable]);
-                                            }
-                                        }
-                                        None => err = true
-                                    }
-
-                                    // Now, if this is &trait, we need to link
-                                    // the regions.
-                                    match (&ty::get(ty).sty, vstore) {
-                                        (&ty::ty_rptr(ra, _),
-                                         ty::vstore_slice(rb)) => {
-                                            infer::mk_subr(fcx.infcx(),
-                                                           false,
-                                                           ex.span,
-                                                           rb,
-                                                           ra);
-                                        }
-                                        _ => {}
-                                    }
-                                }
-                                (&ty::ty_box(_), _) => {
-                                    fcx.ccx.tcx.sess.span_err(ex.span,
-                                                              ~"must cast \
-                                                                a boxed \
-                                                                pointer to \
-                                                                a boxed
-                                                                trait");
-                                    err = true;
-                                }
-                                (&ty::ty_rptr(*), _) => {
-                                    fcx.ccx.tcx.sess.span_err(ex.span,
-                                                              ~"must cast \
-                                                                a borrowed \
-                                                                pointer to \
-                                                                a borrowed \
-                                                                trait");
-                                }
-                                (&ty::ty_uniq(*), _) => {
-                                    fcx.ccx.tcx.sess.span_err(ex.span,
-                                                              ~"must cast \
-                                                                a unique \
-                                                                pointer to \
-                                                                a uniquely-\
-                                                                owned trait");
-                                }
-                                _ => {
-                                    fcx.ccx.tcx.sess.impossible_case(
-                                        ex.span,
-                                        ~"impossible combination of type and \
-                                          trait vstore");
-                                }
-                            }
-                        }
-                        _ => err = true
-                    }
-
-                    if err {
-                        fcx.tcx().sess.span_fatal(
-                            ex.span,
-                            fmt!("failed to find an implementation of trait \
-                                  %s for %s",
-                                 fcx.infcx().ty_to_str(target_ty),
-                                 fcx.infcx().ty_to_str(ty)));
-                    }
-                }
-                Some(vtable) => {
-                    /*
-                    Map this expression to that vtable (that is: "ex has
-                    vtable <vtable>")
-                    */
-                    if !is_early {
-                        let vtable_map = cx.vtable_map;
-                        vtable_map.insert(ex.id, @~[vtable]);
-                    }
-                    fcx.tcx().legacy_boxed_traits.insert(ex.id, ());
-                }
-            }
+          let target_ty = fcx.expr_ty(ex);
+          match ty::get(target_ty).sty {
+              ty::ty_trait(_, _, vstore) => {
+                  // Look up vtables for the type we're casting to,
+                  // passing in the source and target type.  The source
+                  // must be a pointer type suitable to the object sigil,
+                  // e.g.: `@x as @Trait`, `&x as &Trait` or `~x as ~Trait`
+                  let ty = structurally_resolved_type(fcx, ex.span,
+                                                      fcx.expr_ty(src));
+                  match (&ty::get(ty).sty, vstore) {
+                      (&ty::ty_box(mt), ty::vstore_box) |
+                      (&ty::ty_uniq(mt), ty::vstore_uniq) |
+                      (&ty::ty_rptr(_, mt), ty::vstore_slice(*)) => {
+                          let location_info =
+                              &location_info_for_expr(ex);
+                          let vcx = VtableContext {
+                              ccx: fcx.ccx,
+                              infcx: fcx.infcx()
+                          };
+                          let vtable_opt =
+                              lookup_vtable(&vcx,
+                                            location_info,
+                                            mt.ty,
+                                            target_ty,
+                                            true,
+                                            is_early);
+                          match vtable_opt {
+                              Some(vtable) => {
+                                  // Map this expression to that
+                                  // vtable (that is: "ex has vtable
+                                  // <vtable>")
+                                  if !is_early {
+                                      let vtable_map =
+                                          cx.vtable_map;
+                                      vtable_map.insert(ex.id,
+                                                        @~[vtable]);
+                                  }
+                              }
+                              None => {
+                                  fcx.tcx().sess.span_err(
+                                      ex.span,
+                                      fmt!("failed to find an implementation \
+                                            of trait %s for %s",
+                                           fcx.infcx().ty_to_str(target_ty),
+                                           fcx.infcx().ty_to_str(mt.ty)));
+                              }
+                          }
+
+                          // Now, if this is &trait, we need to link the
+                          // regions.
+                          match (&ty::get(ty).sty, vstore) {
+                              (&ty::ty_rptr(ra, _),
+                               ty::vstore_slice(rb)) => {
+                                  infer::mk_subr(fcx.infcx(),
+                                                 false,
+                                                 ex.span,
+                                                 rb,
+                                                 ra);
+                              }
+                              _ => {}
+                          }
+                      }
+
+                      (_, ty::vstore_box(*)) => {
+                          fcx.ccx.tcx.sess.span_err(
+                              ex.span,
+                              fmt!("can only cast an @-pointer \
+                                    to an @-object, not a %s",
+                                   ty::ty_sort_str(fcx.tcx(), ty)));
+                      }
+
+                      (_, ty::vstore_uniq(*)) => {
+                          fcx.ccx.tcx.sess.span_err(
+                              ex.span,
+                              fmt!("can only cast an ~-pointer \
+                                    to a ~-object, not a %s",
+                                   ty::ty_sort_str(fcx.tcx(), ty)));
+                      }
+
+                      (_, ty::vstore_slice(*)) => {
+                          fcx.ccx.tcx.sess.span_err(
+                              ex.span,
+                              fmt!("can only cast an &-pointer \
+                                    to an &-object, not a %s",
+                                   ty::ty_sort_str(fcx.tcx(), ty)));
+                      }
+
+                      (_, ty::vstore_fixed(*)) => {
+                          fcx.tcx().sess.span_bug(
+                              ex.span,
+                              fmt!("trait with fixed vstore"));
+                      }
+                  }
+              }
+              _ => { /* not a cast to a trait; ignore */ }
           }
-          _ => ()
-        }
       }
       _ => ()
     }
diff --git a/src/librustc/middle/typeck/infer/coercion.rs b/src/librustc/middle/typeck/infer/coercion.rs
index 5d291fdde77..6ad58bc5d4f 100644
--- a/src/librustc/middle/typeck/infer/coercion.rs
+++ b/src/librustc/middle/typeck/infer/coercion.rs
@@ -87,7 +87,7 @@ use syntax::ast;
 // function.
 pub enum Coerce = CombineFields;
 
-impl Coerce {
+pub impl Coerce {
     fn tys(&self, a: ty::t, b: ty::t) -> CoerceResult {
         debug!("Coerce.tys(%s => %s)",
                a.inf_str(self.infcx),
diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs
index f63dac4c5ae..e140bcad11c 100644
--- a/src/librustc/middle/typeck/infer/combine.rs
+++ b/src/librustc/middle/typeck/infer/combine.rs
@@ -316,7 +316,7 @@ pub fn super_modes<C:Combine>(
     ty::unify_mode(tcx, expected_found(self, a, b))
 }
 
-fn super_args<C:Combine>(
+pub fn super_args<C:Combine>(
     self: &C, a: ty::arg, b: ty::arg)
     -> cres<ty::arg> {
 
diff --git a/src/librustc/middle/typeck/infer/glb.rs b/src/librustc/middle/typeck/infer/glb.rs
index 936ca1e8297..981d7be3d5f 100644
--- a/src/librustc/middle/typeck/infer/glb.rs
+++ b/src/librustc/middle/typeck/infer/glb.rs
@@ -18,9 +18,14 @@ use middle::typeck::infer::lattice::*;
 use middle::typeck::infer::lub::Lub;
 use middle::typeck::infer::sub::Sub;
 use middle::typeck::infer::to_str::InferStr;
+use middle::typeck::infer::{cres, InferCtxt};
 use middle::typeck::isr_alist;
+use syntax::ast;
 use syntax::ast::{Many, Once, extern_fn, impure_fn, m_const, m_imm, m_mutbl};
 use syntax::ast::{noreturn, pure_fn, ret_style, return_val, unsafe_fn};
+use syntax::ast::{Onceness, purity};
+use syntax::codemap::span;
+use util::common::{indent, indenter};
 use util::ppaux::mt_to_str;
 
 use std::list;
diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs
index 8fa887fca0b..fe12af52d26 100644
--- a/src/librustc/middle/typeck/infer/lattice.rs
+++ b/src/librustc/middle/typeck/infer/lattice.rs
@@ -34,7 +34,7 @@
 
 use core::prelude::*;
 
-use middle::ty::{RegionVid, TyVar};
+use middle::ty::{RegionVid, TyVar, Vid};
 use middle::ty;
 use middle::typeck::isr_alist;
 use middle::typeck::infer::*;
@@ -46,6 +46,7 @@ use middle::typeck::infer::sub::Sub;
 use middle::typeck::infer::lub::Lub;
 use middle::typeck::infer::glb::Glb;
 use middle::typeck::infer::to_str::InferStr;
+use util::common::indenter;
 
 use std::list;
 
diff --git a/src/librustc/middle/typeck/infer/lub.rs b/src/librustc/middle/typeck/infer/lub.rs
index 2c4fd9f01ee..83cbd4c745c 100644
--- a/src/librustc/middle/typeck/infer/lub.rs
+++ b/src/librustc/middle/typeck/infer/lub.rs
@@ -17,12 +17,17 @@ use middle::typeck::infer::glb::Glb;
 use middle::typeck::infer::lattice::*;
 use middle::typeck::infer::sub::Sub;
 use middle::typeck::infer::to_str::InferStr;
+use middle::typeck::infer::{cres, InferCtxt};
 use middle::typeck::isr_alist;
+use util::common::indent;
 use util::ppaux::mt_to_str;
 
 use std::list;
+use syntax::ast;
 use syntax::ast::{Many, Once, extern_fn, m_const, impure_fn, noreturn};
 use syntax::ast::{pure_fn, ret_style, return_val, unsafe_fn};
+use syntax::ast::{Onceness, purity};
+use syntax::codemap::span;
 
 pub enum Lub = CombineFields;  // least-upper-bound: common supertype
 
diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs
index 8bb1f2f47e5..aff2d599a0e 100644
--- a/src/librustc/middle/typeck/infer/mod.rs
+++ b/src/librustc/middle/typeck/infer/mod.rs
@@ -551,7 +551,7 @@ struct Snapshot {
     region_vars_snapshot: uint,
 }
 
-impl @mut InferCtxt {
+pub impl @mut InferCtxt {
     fn combine_fields(&self, a_is_expected: bool,
                       span: span) -> CombineFields {
         CombineFields {infcx: *self,
@@ -643,7 +643,7 @@ fn next_simple_var<V:Copy,T:Copy>(
     return id;
 }
 
-impl @mut InferCtxt {
+pub impl @mut InferCtxt {
     fn next_ty_var_id(&self) -> TyVid {
         let id = self.ty_var_counter;
         self.ty_var_counter += 1;
diff --git a/src/librustc/middle/typeck/infer/region_inference.rs b/src/librustc/middle/typeck/infer/region_inference.rs
index ee598686652..d016a6f790a 100644
--- a/src/librustc/middle/typeck/infer/region_inference.rs
+++ b/src/librustc/middle/typeck/infer/region_inference.rs
@@ -1218,7 +1218,7 @@ fn TwoRegionsMap() -> TwoRegionsMap {
     return HashMap();
 }
 
-impl RegionVarBindings {
+pub impl RegionVarBindings {
     fn infer_variable_values(&mut self) -> ~[GraphNodeValue] {
         let mut graph = self.construct_graph();
         self.expansion(&mut graph);
diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/typeck/infer/sub.rs
index 5552b71d0d7..aaaf3b425c2 100644
--- a/src/librustc/middle/typeck/infer/sub.rs
+++ b/src/librustc/middle/typeck/infer/sub.rs
@@ -11,6 +11,7 @@
 use core::prelude::*;
 
 use middle::ty;
+use middle::ty::TyVar;
 use middle::typeck::check::regionmanip::replace_bound_regions_in_fn_sig;
 use middle::typeck::infer::combine::*;
 use middle::typeck::infer::cres;
@@ -19,11 +20,14 @@ use middle::typeck::infer::InferCtxt;
 use middle::typeck::infer::lub::Lub;
 use middle::typeck::infer::to_str::InferStr;
 use middle::typeck::infer::unify::*;
+use util::common::{indent, indenter};
 use util::ppaux::bound_region_to_str;
 
 use std::list::Nil;
 use std::list;
-use syntax::ast::{m_const, purity, ret_style};
+use syntax::ast;
+use syntax::ast::{Onceness, m_const, purity, ret_style};
+use syntax::codemap::span;
 
 
 pub enum Sub = CombineFields;  // "subtype", "subregion" etc
diff --git a/src/librustc/middle/typeck/infer/test.rs b/src/librustc/middle/typeck/infer/test.rs
index 27355da4b9a..9701e370ca8 100644
--- a/src/librustc/middle/typeck/infer/test.rs
+++ b/src/librustc/middle/typeck/infer/test.rs
@@ -79,7 +79,7 @@ fn setup_env(test_name: &str, source_string: &str) -> Env {
                 err_messages: messages};
 }
 
-impl Env {
+pub impl Env {
     fn create_region_hierarchy(&self, rh: &RH) {
         for rh.sub.each |child_rh| {
             self.create_region_hierarchy(child_rh);
diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs
index 628cccfa9a2..d82667285ff 100644
--- a/src/librustc/middle/typeck/rscope.rs
+++ b/src/librustc/middle/typeck/rscope.rs
@@ -70,11 +70,11 @@ pub fn bound_self_region(rp: Option<ty::region_variance>)
     }
 }
 
-pub struct anon_rscope { anon: ty::Region, base: region_scope }
+pub struct anon_rscope { anon: ty::Region, base: @region_scope }
 pub fn in_anon_rscope<RS:region_scope + Copy + Durable>(self: RS,
                                                         r: ty::Region)
                                                      -> @anon_rscope {
-    @anon_rscope {anon: r, base: self as region_scope}
+    @anon_rscope {anon: r, base: @self as @region_scope}
 }
 
 impl region_scope for @anon_rscope {
@@ -97,7 +97,7 @@ pub struct binding_rscope {
 
 pub fn in_binding_rscope<RS:region_scope + Copy + Durable>(self: RS)
     -> @mut binding_rscope {
-    let base = self as region_scope;
+    let base = @self as @region_scope;
     @mut binding_rscope { base: base, anon_bindings: 0 }
 }
 
diff --git a/src/librustdoc/doc.rs b/src/librustdoc/doc.rs
index 40617e13b8d..f7de1997d53 100644
--- a/src/librustdoc/doc.rs
+++ b/src/librustdoc/doc.rs
@@ -174,7 +174,7 @@ pub struct IndexEntry {
     link: ~str
 }
 
-impl Doc {
+pub impl Doc {
     fn CrateDoc(&self) -> CrateDoc {
         option::get(vec::foldl(None, self.pages, |_m, page| {
             match copy *page {
@@ -190,7 +190,7 @@ impl Doc {
 }
 
 /// Some helper methods on ModDoc, mostly for testing
-impl ModDoc {
+pub impl ModDoc {
     fn mods(&self) -> ~[ModDoc] {
         do vec::filter_mapped(self.items) |itemtag| {
             match copy *itemtag {
diff --git a/src/librustdoc/sort_item_type_pass.rs b/src/librustdoc/sort_item_type_pass.rs
index 646dc12d336..1a370947d69 100644
--- a/src/librustdoc/sort_item_type_pass.rs
+++ b/src/librustdoc/sort_item_type_pass.rs
@@ -51,7 +51,7 @@ fn test() {
          fn ifn() { } \
          enum ienum { ivar } \
          trait itrait { fn a(); } \
-         impl int { fn a() { } } \
+         pub impl int { fn a() { } } \
          type itype = int; \
          struct istruct { f: () }";
     do astsrv::from_str(source) |srv| {
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs
index f258e649122..69c5026cbd1 100644
--- a/src/libstd/arc.rs
+++ b/src/libstd/arc.rs
@@ -21,7 +21,7 @@ use core::cell::Cell;
 use core::pipes;
 use core::prelude::*;
 use core::private::{SharedMutableState, shared_mutable_state};
-use core::private::{clone_shared_mutable_state, unwrap_shared_mutable_state};
+use core::private::{clone_shared_mutable_state};
 use core::private::{get_shared_mutable_state, get_shared_immutable_state};
 use core::ptr;
 use core::task;
@@ -30,7 +30,7 @@ use core::util;
 /// As sync::condvar, a mechanism for unlock-and-descheduling and signalling.
 pub struct Condvar { is_mutex: bool, failed: &mut bool, cond: &sync::Condvar }
 
-impl &Condvar {
+pub impl &Condvar {
     /// Atomically exit the associated ARC and block until a signal is sent.
     #[inline(always)]
     fn wait() { self.wait_on(0) }
@@ -104,20 +104,6 @@ pub fn clone<T:Const + Owned>(rc: &ARC<T>) -> ARC<T> {
     ARC { x: unsafe { clone_shared_mutable_state(&rc.x) } }
 }
 
-/**
- * Retrieve the data back out of the ARC. This function blocks until the
- * reference given to it is the last existing one, and then unwrap the data
- * instead of destroying it.
- *
- * If multiple tasks call unwrap, all but the first will fail. Do not call
- * unwrap from a task that holds another reference to the same ARC; it is
- * guaranteed to deadlock.
- */
-pub fn unwrap<T:Const + Owned>(rc: ARC<T>) -> T {
-    let ARC { x: x } = rc;
-    unsafe { unwrap_shared_mutable_state(x) }
-}
-
 impl<T:Const + Owned> Clone for ARC<T> {
     fn clone(&self) -> ARC<T> {
         clone(self)
@@ -158,7 +144,7 @@ impl<T:Owned> Clone for MutexARC<T> {
     }
 }
 
-impl<T:Owned> &MutexARC<T> {
+pub impl<T:Owned> &MutexARC<T> {
 
     /**
      * Access the underlying mutable data with mutual exclusion from other
@@ -213,23 +199,6 @@ impl<T:Owned> &MutexARC<T> {
     }
 }
 
-/**
- * Retrieves the data, blocking until all other references are dropped,
- * exactly as arc::unwrap.
- *
- * Will additionally fail if another task has failed while accessing the arc.
- */
-// FIXME(#3724) make this a by-move method on the arc
-pub fn unwrap_mutex_arc<T:Owned>(arc: MutexARC<T>) -> T {
-    let MutexARC { x: x } = arc;
-    let inner = unsafe { unwrap_shared_mutable_state(x) };
-    let MutexARCInner { failed: failed, data: data, _ } = inner;
-    if failed {
-        fail!(~"Can't unwrap poisoned MutexARC - another task failed inside!")
-    }
-    data
-}
-
 // Common code for {mutex.access,rwlock.write}{,_cond}.
 #[inline(always)]
 #[doc(hidden)]
@@ -301,7 +270,7 @@ pub fn rw_arc_with_condvars<T:Const + Owned>(
     RWARC { x: unsafe { shared_mutable_state(data) }, cant_nest: () }
 }
 
-impl<T:Const + Owned> RWARC<T> {
+pub impl<T:Const + Owned> RWARC<T> {
     /// Duplicate a rwlock-protected ARC, as arc::clone.
     fn clone(&self) -> RWARC<T> {
         RWARC { x: unsafe { clone_shared_mutable_state(&self.x) },
@@ -310,7 +279,7 @@ impl<T:Const + Owned> RWARC<T> {
 
 }
 
-impl<T:Const + Owned> &RWARC<T> {
+pub impl<T:Const + Owned> &RWARC<T> {
     /**
      * Access the underlying data mutably. Locks the rwlock in write mode;
      * other readers and writers will block.
@@ -411,24 +380,6 @@ impl<T:Const + Owned> &RWARC<T> {
     }
 }
 
-/**
- * Retrieves the data, blocking until all other references are dropped,
- * exactly as arc::unwrap.
- *
- * Will additionally fail if another task has failed while accessing the arc
- * in write mode.
- */
-// FIXME(#3724) make this a by-move method on the arc
-pub fn unwrap_rw_arc<T:Const + Owned>(arc: RWARC<T>) -> T {
-    let RWARC { x: x, _ } = arc;
-    let inner = unsafe { unwrap_shared_mutable_state(x) };
-    let RWARCInner { failed: failed, data: data, _ } = inner;
-    if failed {
-        fail!(~"Can't unwrap poisoned RWARC - another task failed inside!")
-    }
-    data
-}
-
 // Borrowck rightly complains about immutably aliasing the rwlock in order to
 // lock it. This wraps the unsafety, with the justification that the 'lock'
 // field is never overwritten; only 'failed' and 'data'.
@@ -445,7 +396,7 @@ pub enum RWWriteMode<T> =
 /// The "read permission" token used for RWARC.write_downgrade().
 pub enum RWReadMode<T> = (&T, sync::RWlockReadMode);
 
-impl<T:Const + Owned> &RWWriteMode<T> {
+pub impl<T:Const + Owned> &RWWriteMode<T> {
     /// Access the pre-downgrade RWARC in write mode.
     fn write<U>(blk: fn(x: &mut T) -> U) -> U {
         match *self {
@@ -475,7 +426,7 @@ impl<T:Const + Owned> &RWWriteMode<T> {
     }
 }
 
-impl<T:Const + Owned> &RWReadMode<T> {
+pub impl<T:Const + Owned> &RWReadMode<T> {
     /// Access the post-downgrade rwlock in read mode.
     fn read<U>(blk: fn(x: &T) -> U) -> U {
         match *self {
@@ -497,6 +448,7 @@ mod tests {
     use arc::*;
     use arc;
 
+    use core::cell::Cell;
     use core::option::{Some, None};
     use core::option;
     use core::pipes;
@@ -585,21 +537,6 @@ mod tests {
         }
     }
     #[test] #[should_fail] #[ignore(cfg(windows))]
-    pub fn test_mutex_arc_unwrap_poison() {
-        let arc = MutexARC(1);
-        let arc2 = ~(&arc).clone();
-        let (p, c) = comm::stream();
-        do task::spawn || {
-            do arc2.access |one| {
-                c.send(());
-                assert *one == 2;
-            }
-        }
-        let _ = p.recv();
-        let one = unwrap_mutex_arc(arc);
-        assert one == 1;
-    }
-    #[test] #[should_fail] #[ignore(cfg(windows))]
     pub fn test_rw_arc_poison_wr() {
         let arc = ~RWARC(1);
         let arc2 = ~arc.clone();
diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs
index 177932aa072..a30ee94a42b 100644
--- a/src/libstd/arena.rs
+++ b/src/libstd/arena.rs
@@ -161,7 +161,7 @@ unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TypeDesc, bool) {
     (reinterpret_cast(&(p & !1)), p & 1 == 1)
 }
 
-impl &Arena {
+pub impl &Arena {
     // Functions for the POD part of the arena
     fn alloc_pod_grow(n_bytes: uint, align: uint) -> *u8 {
         // Allocate a new chunk.
diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs
index 30d7b825add..cf278b07c9d 100644
--- a/src/libstd/bitv.rs
+++ b/src/libstd/bitv.rs
@@ -27,7 +27,7 @@ fn small_mask(nbits: uint) -> uint {
     (1 << nbits) - 1
 }
 
-impl SmallBitv {
+pub impl SmallBitv {
     static fn new(bits: uint) -> SmallBitv {
         SmallBitv {bits: bits}
     }
@@ -124,7 +124,7 @@ fn big_mask(nbits: uint, elem: uint) -> uint {
     }
 }
 
-impl BigBitv {
+pub impl BigBitv {
     static fn new(storage: ~[uint]) -> BigBitv {
         BigBitv {storage: storage}
     }
@@ -256,7 +256,7 @@ priv impl Bitv {
 
 }
 
-impl Bitv {
+pub impl Bitv {
     static fn new(nbits: uint, init: bool) -> Bitv {
         let rep = if nbits <= uint::bits {
             Small(~SmallBitv::new(if init {!0} else {0}))
@@ -591,7 +591,7 @@ pub struct BitvSet {
     priv bitv: BigBitv
 }
 
-impl BitvSet {
+pub impl BitvSet {
     /// Creates a new bit vector set with initially no contents
     static fn new() -> BitvSet {
         BitvSet{ size: 0, bitv: BigBitv::new(~[0]) }
diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs
index 0ac76cefd6b..f6fcf6c8d3b 100644
--- a/src/libstd/deque.rs
+++ b/src/libstd/deque.rs
@@ -37,7 +37,7 @@ impl<T> Mutable for Deque<T> {
     }
 }
 
-impl<T> Deque<T> {
+pub impl<T> Deque<T> {
     static pure fn new() -> Deque<T> {
         Deque{nelts: 0, lo: 0, hi: 0,
               elts: vec::from_fn(initial_capacity, |_| None)}
@@ -116,6 +116,9 @@ fn get<T>(elts: &r/[Option<T>], i: uint) -> &r/T {
 #[cfg(test)]
 mod tests {
     use super::*;
+    use core::cmp::Eq;
+    use core::kinds::{Durable, Copy};
+    use core::prelude::debug;
 
     #[test]
     fn test_simple() {
diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs
index 84df1785503..7d04f676079 100644
--- a/src/libstd/ebml.rs
+++ b/src/libstd/ebml.rs
@@ -279,7 +279,7 @@ pub mod reader {
         }
     }
 
-    impl Decoder {
+    pub impl Decoder {
         fn read_opaque<R>(&self, op: fn(Doc) -> R) -> R {
             do self.push_doc(self.next_doc(EsOpaque)) {
                 op(copy self.parent)
@@ -451,7 +451,7 @@ pub mod writer {
     }
 
     // FIXME (#2741): Provide a function to write the standard ebml header.
-    impl Encoder {
+    pub impl Encoder {
         fn start_tag(tag_id: uint) {
             debug!("Start tag %u", tag_id);
 
@@ -571,7 +571,7 @@ pub mod writer {
         }
     }
 
-    impl Encoder {
+    pub impl Encoder {
         fn emit_opaque(&self, f: fn()) {
             do self.wr_tag(EsOpaque as uint) {
                 f()
diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs
index 2ee994bdf32..73dbe4bea57 100644
--- a/src/libstd/flatpipes.rs
+++ b/src/libstd/flatpipes.rs
@@ -636,6 +636,7 @@ mod test {
     use DefaultEncoder = json::Encoder;
     use DefaultDecoder = json::Decoder;
 
+    use flatpipes::{Flattener, Unflattener};
     use flatpipes::flatteners::*;
     use flatpipes::bytepipes::*;
     use flatpipes::pod;
@@ -647,7 +648,7 @@ mod test {
 
     use core::dvec::DVec;
     use core::int;
-    use core::io::BytesReader;
+    use core::io::{BytesReader, BytesWriter};
     use core::io;
     use core::prelude::*;
     use core::result;
diff --git a/src/libstd/future.rs b/src/libstd/future.rs
index 7f48466ed0a..c5775406125 100644
--- a/src/libstd/future.rs
+++ b/src/libstd/future.rs
@@ -49,14 +49,14 @@ priv enum FutureState<A> {
 }
 
 /// Methods on the `future` type
-impl<A:Copy> Future<A> {
+pub impl<A:Copy> Future<A> {
     fn get() -> A {
         //! Get the value of the future
         *(self.get_ref())
     }
 }
 
-impl<A> Future<A> {
+pub impl<A> Future<A> {
 
     pure fn get_ref(&self) -> &self/A {
         /*!
@@ -150,7 +150,7 @@ pub mod test {
 
     use future::*;
 
-    use core::comm::oneshot;
+    use core::comm::{oneshot, send_one};
     use core::task;
 
     #[test]
diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs
index 3726943321c..dd205583259 100644
--- a/src/libstd/getopts.rs
+++ b/src/libstd/getopts.rs
@@ -445,7 +445,7 @@ pub fn opt_default(mm: &Matches, nm: &str, def: &str) -> Option<~str> {
 }
 
 #[deriving_eq]
-enum FailType {
+pub enum FailType {
     ArgumentMissing_,
     UnrecognizedOption_,
     OptionMissing_,
diff --git a/src/libstd/json.rs b/src/libstd/json.rs
index c6e76aa1a68..d1a65517aad 100644
--- a/src/libstd/json.rs
+++ b/src/libstd/json.rs
@@ -1208,6 +1208,7 @@ mod tests {
     use core::prelude::*;
 
     use json::*;
+    use serialize;
 
     use core::result;
     use core::hashmap::linear::LinearMap;
diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs
index 8835cdfb105..dcbf7e60d89 100644
--- a/src/libstd/net_tcp.rs
+++ b/src/libstd/net_tcp.rs
@@ -820,7 +820,7 @@ pub fn socket_buf(sock: TcpSocket) -> TcpSocketBuf {
 }
 
 /// Convenience methods extending `net::tcp::tcp_socket`
-impl TcpSocket {
+pub impl TcpSocket {
     pub fn read_start() -> result::Result<@Port<
         result::Result<~[u8], TcpErrData>>, TcpErrData> {
         read_start(&self)
diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs
index 29cb57c01be..08b7b3d6ae5 100644
--- a/src/libstd/net_url.rs
+++ b/src/libstd/net_url.rs
@@ -730,6 +730,91 @@ impl to_bytes::IterBytes for Url {
     }
 }
 
+// Put a few tests outside of the 'test' module so they can test the internal
+// functions and those functions don't need 'pub'
+
+#[test]
+fn test_split_char_first() {
+    let (u,v) = split_char_first(~"hello, sweet world", ',');
+    assert u == ~"hello";
+    assert v == ~" sweet world";
+
+    let (u,v) = split_char_first(~"hello sweet world", ',');
+    assert u == ~"hello sweet world";
+    assert v == ~"";
+}
+
+#[test]
+fn test_get_authority() {
+    let (u, h, p, r) = get_authority(
+        "//user:pass@rust-lang.org/something").unwrap();
+    assert u == Some(UserInfo::new(~"user", Some(~"pass")));
+    assert h == ~"rust-lang.org";
+    assert p.is_none();
+    assert r == ~"/something";
+
+    let (u, h, p, r) = get_authority(
+        "//rust-lang.org:8000?something").unwrap();
+    assert u.is_none();
+    assert h == ~"rust-lang.org";
+    assert p == Some(~"8000");
+    assert r == ~"?something";
+
+    let (u, h, p, r) = get_authority(
+        "//rust-lang.org#blah").unwrap();
+    assert u.is_none();
+    assert h == ~"rust-lang.org";
+    assert p.is_none();
+    assert r == ~"#blah";
+
+    // ipv6 tests
+    let (_, h, _, _) = get_authority(
+        "//2001:0db8:85a3:0042:0000:8a2e:0370:7334#blah").unwrap();
+    assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334";
+
+    let (_, h, p, _) = get_authority(
+        "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000#blah").unwrap();
+    assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334";
+    assert p == Some(~"8000");
+
+    let (u, h, p, _) = get_authority(
+        "//us:p@2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000#blah"
+    ).unwrap();
+    assert u == Some(UserInfo::new(~"us", Some(~"p")));
+    assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334";
+    assert p == Some(~"8000");
+
+    // invalid authorities;
+    assert get_authority("//user:pass@rust-lang:something").is_err();
+    assert get_authority("//user@rust-lang:something:/path").is_err();
+    assert get_authority(
+        "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:800a").is_err();
+    assert get_authority(
+        "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000:00").is_err();
+
+    // these parse as empty, because they don't start with '//'
+    let (_, h, _, _) = get_authority(~"user:pass@rust-lang").unwrap();
+    assert h == ~"";
+    let (_, h, _, _) = get_authority(~"rust-lang.org").unwrap();
+    assert h == ~"";
+}
+
+#[test]
+fn test_get_path() {
+    let (p, r) = get_path("/something+%20orother", true).unwrap();
+    assert p == ~"/something+ orother";
+    assert r == ~"";
+    let (p, r) = get_path("test@email.com#fragment", false).unwrap();
+    assert p == ~"test@email.com";
+    assert r == ~"#fragment";
+    let (p, r) = get_path(~"/gen/:addr=?q=v", false).unwrap();
+    assert p == ~"/gen/:addr=";
+    assert r == ~"?q=v";
+
+    //failure cases
+    assert get_path(~"something?q", true).is_err();
+}
+
 #[cfg(test)]
 mod tests {
     use core::prelude::*;
@@ -737,92 +822,11 @@ mod tests {
     use net_url::*;
     use net_url::UserInfo;
 
+    use core::hashmap::linear::LinearMap;
     use core::result;
     use core::str;
 
     #[test]
-    pub fn test_split_char_first() {
-        let (u,v) = split_char_first(~"hello, sweet world", ',');
-        assert u == ~"hello";
-        assert v == ~" sweet world";
-
-        let (u,v) = split_char_first(~"hello sweet world", ',');
-        assert u == ~"hello sweet world";
-        assert v == ~"";
-    }
-
-    #[test]
-    pub fn test_get_authority() {
-        let (u, h, p, r) = get_authority(
-            "//user:pass@rust-lang.org/something").unwrap();
-        assert u == Some(UserInfo::new(~"user", Some(~"pass")));
-        assert h == ~"rust-lang.org";
-        assert p.is_none();
-        assert r == ~"/something";
-
-        let (u, h, p, r) = get_authority(
-            "//rust-lang.org:8000?something").unwrap();
-        assert u.is_none();
-        assert h == ~"rust-lang.org";
-        assert p == Some(~"8000");
-        assert r == ~"?something";
-
-        let (u, h, p, r) = get_authority(
-            "//rust-lang.org#blah").unwrap();
-        assert u.is_none();
-        assert h == ~"rust-lang.org";
-        assert p.is_none();
-        assert r == ~"#blah";
-
-        // ipv6 tests
-        let (_, h, _, _) = get_authority(
-            "//2001:0db8:85a3:0042:0000:8a2e:0370:7334#blah").unwrap();
-        assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334";
-
-        let (_, h, p, _) = get_authority(
-            "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000#blah").unwrap();
-        assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334";
-        assert p == Some(~"8000");
-
-        let (u, h, p, _) = get_authority(
-            "//us:p@2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000#blah"
-        ).unwrap();
-        assert u == Some(UserInfo::new(~"us", Some(~"p")));
-        assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334";
-        assert p == Some(~"8000");
-
-        // invalid authorities;
-        assert get_authority("//user:pass@rust-lang:something").is_err();
-        assert get_authority("//user@rust-lang:something:/path").is_err();
-        assert get_authority(
-            "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:800a").is_err();
-        assert get_authority(
-            "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000:00").is_err();
-
-        // these parse as empty, because they don't start with '//'
-        let (_, h, _, _) = get_authority(~"user:pass@rust-lang").unwrap();
-        assert h == ~"";
-        let (_, h, _, _) = get_authority(~"rust-lang.org").unwrap();
-        assert h == ~"";
-    }
-
-    #[test]
-    pub fn test_get_path() {
-        let (p, r) = get_path("/something+%20orother", true).unwrap();
-        assert p == ~"/something+ orother";
-        assert r == ~"";
-        let (p, r) = get_path("test@email.com#fragment", false).unwrap();
-        assert p == ~"test@email.com";
-        assert r == ~"#fragment";
-        let (p, r) = get_path(~"/gen/:addr=?q=v", false).unwrap();
-        assert p == ~"/gen/:addr=";
-        assert r == ~"?q=v";
-
-        //failure cases
-        assert get_path(~"something?q", true).is_err();
-    }
-
-    #[test]
     pub fn test_url_parse() {
         let url = ~"http://user:pass@rust-lang.org/doc?s=v#something";
 
diff --git a/src/libstd/oldmap.rs b/src/libstd/oldmap.rs
index 53692cd3be5..1d21f749b32 100644
--- a/src/libstd/oldmap.rs
+++ b/src/libstd/oldmap.rs
@@ -134,7 +134,9 @@ pub mod chained {
             }
             self.chains = new_chains;
         }
+    }
 
+    pub impl<K:Eq + IterBytes + Hash,V> T<K, V> {
         pure fn each_entry(blk: fn(@Entry<K,V>) -> bool) {
             // n.b. we can't use vec::iter() here because self.chains
             // is stored in a mutable location.
@@ -168,7 +170,7 @@ pub mod chained {
         }
     }
 
-    impl<K:Eq + IterBytes + Hash,V> T<K, V> {
+    pub impl<K:Eq + IterBytes + Hash,V> T<K, V> {
         pure fn contains_key(&self, k: &K) -> bool {
             let hash = k.hash_keyed(0,0) as uint;
             match self.search_tbl(k, hash) {
@@ -252,7 +254,7 @@ pub mod chained {
         }
     }
 
-    impl<K:Eq + IterBytes + Hash + Copy,V:Copy> T<K, V> {
+    pub impl<K:Eq + IterBytes + Hash + Copy,V:Copy> T<K, V> {
         pure fn find(&self, k: &K) -> Option<V> {
             match self.search_tbl(k, k.hash_keyed(0,0) as uint) {
               NotFound => None,
@@ -325,7 +327,7 @@ pub mod chained {
         }
     }
 
-    impl<K:Eq + IterBytes + Hash + Copy + ToStr,V:ToStr + Copy> T<K, V> {
+    pub impl<K:Eq + IterBytes + Hash + Copy + ToStr,V:ToStr + Copy> T<K, V> {
         fn to_writer(wr: io::Writer) {
             if self.count == 0u {
                 wr.write_str(~"{}");
diff --git a/src/libstd/priority_queue.rs b/src/libstd/priority_queue.rs
index f642bf52f65..4b92bd7543a 100644
--- a/src/libstd/priority_queue.rs
+++ b/src/libstd/priority_queue.rs
@@ -48,7 +48,7 @@ impl<T:Ord> Mutable for PriorityQueue<T> {
     fn clear(&mut self) { self.data.truncate(0) }
 }
 
-impl <T:Ord> PriorityQueue<T> {
+pub impl <T:Ord> PriorityQueue<T> {
     /// Returns the greatest item in the queue - fails if empty
     pure fn top(&self) -> &self/T { &self.data[0] }
 
diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs
index 69c3de5ff62..e8c1413e90a 100644
--- a/src/libstd/sha1.rs
+++ b/src/libstd/sha1.rs
@@ -63,7 +63,7 @@ const k3: u32 = 0xCA62C1D6u32;
 
 
 /// Construct a `sha` object
-pub fn sha1() -> Sha1 {
+pub fn sha1() -> @Sha1 {
     struct Sha1State
         { h: ~[u32],
           len_low: u32,
@@ -269,7 +269,7 @@ pub fn sha1() -> Sha1 {
          computed: false,
          work_buf: @mut vec::from_elem(work_buf_len, 0u32)
     };
-    let mut sh = (st) as Sha1;
+    let mut sh = @st as @Sha1;
     sh.reset();
     return sh;
 }
diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs
index 75f38da5a19..43fab9df163 100644
--- a/src/libstd/sort.rs
+++ b/src/libstd/sort.rs
@@ -404,7 +404,7 @@ fn MergeState<T>() -> MergeState<T> {
     }
 }
 
-impl<T:Copy + Ord> MergeState<T> {
+pub impl<T:Copy + Ord> MergeState<T> {
     fn push_run(&self, run_base: uint, run_len: uint) {
         let tmp = RunState{base: run_base, len: run_len};
         self.runs.push(tmp);
diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs
index 1ff51e8bff0..39d3fd569a6 100644
--- a/src/libstd/sync.rs
+++ b/src/libstd/sync.rs
@@ -100,7 +100,7 @@ fn new_sem_and_signal(count: int, num_condvars: uint)
 }
 
 #[doc(hidden)]
-impl<Q:Owned> &Sem<Q> {
+pub impl<Q:Owned> &Sem<Q> {
     fn acquire() {
         let mut waiter_nobe = None;
         unsafe {
@@ -136,7 +136,7 @@ impl<Q:Owned> &Sem<Q> {
 }
 // FIXME(#3154) move both copies of this into Sem<Q>, and unify the 2 structs
 #[doc(hidden)]
-impl &Sem<()> {
+pub impl &Sem<()> {
     fn access<U>(blk: fn() -> U) -> U {
         let mut release = None;
         unsafe {
@@ -149,7 +149,7 @@ impl &Sem<()> {
     }
 }
 #[doc(hidden)]
-impl &Sem<~[Waitqueue]> {
+pub impl &Sem<~[Waitqueue]> {
     fn access<U>(blk: fn() -> U) -> U {
         let mut release = None;
         unsafe {
@@ -192,7 +192,7 @@ pub struct Condvar { priv sem: &Sem<~[Waitqueue]> }
 
 impl Drop for Condvar { fn finalize(&self) {} }
 
-impl &Condvar {
+pub impl &Condvar {
     /**
      * Atomically drop the associated lock, and block until a signal is sent.
      *
@@ -344,7 +344,7 @@ fn check_cvar_bounds<U>(out_of_bounds: Option<uint>, id: uint, act: &str,
 }
 
 #[doc(hidden)]
-impl &Sem<~[Waitqueue]> {
+pub impl &Sem<~[Waitqueue]> {
     // The only other place that condvars get built is rwlock_write_mode.
     fn access_cond<U>(blk: fn(c: &Condvar) -> U) -> U {
         do self.access { blk(&Condvar { sem: self }) }
@@ -370,7 +370,7 @@ impl Clone for Semaphore {
     }
 }
 
-impl &Semaphore {
+pub impl &Semaphore {
     /**
      * Acquire a resource represented by the semaphore. Blocks if necessary
      * until resource(s) become available.
@@ -399,7 +399,7 @@ impl &Semaphore {
  * A task which fails while holding a mutex will unlock the mutex as it
  * unwinds.
  */
-struct Mutex { priv sem: Sem<~[Waitqueue]> }
+pub struct Mutex { priv sem: Sem<~[Waitqueue]> }
 
 /// Create a new mutex, with one associated condvar.
 pub fn Mutex() -> Mutex { mutex_with_condvars(1) }
@@ -418,7 +418,7 @@ impl Clone for Mutex {
     fn clone(&self) -> Mutex { Mutex { sem: Sem((*self.sem).clone()) } }
 }
 
-impl &Mutex {
+pub impl &Mutex {
     /// Run a function with ownership of the mutex.
     fn lock<U>(blk: fn() -> U) -> U { (&self.sem).access(blk) }
 
@@ -447,7 +447,7 @@ struct RWlockInner {
  * A task which fails while holding an rwlock will unlock the rwlock as it
  * unwinds.
  */
-struct RWlock {
+pub struct RWlock {
     priv order_lock:  Semaphore,
     priv access_lock: Sem<~[Waitqueue]>,
     priv state:       Exclusive<RWlockInner>
@@ -467,7 +467,7 @@ pub fn rwlock_with_condvars(num_condvars: uint) -> RWlock {
                                              read_count: 0 }) }
 }
 
-impl &RWlock {
+pub impl &RWlock {
     /// Create a new handle to the rwlock.
     fn clone() -> RWlock {
         RWlock { order_lock:  (&(self.order_lock)).clone(),
@@ -688,7 +688,7 @@ impl Drop for RWlockWriteMode { fn finalize(&self) {} }
 pub struct RWlockReadMode  { priv lock: &RWlock }
 impl Drop for RWlockReadMode { fn finalize(&self) {} }
 
-impl &RWlockWriteMode {
+pub impl &RWlockWriteMode {
     /// Access the pre-downgrade rwlock in write mode.
     fn write<U>(blk: fn() -> U) -> U { blk() }
     /// Access the pre-downgrade rwlock in write mode with a condvar.
@@ -696,7 +696,7 @@ impl &RWlockWriteMode {
         blk(&Condvar { sem: &self.lock.access_lock })
     }
 }
-impl &RWlockReadMode {
+pub impl &RWlockReadMode {
     /// Access the post-downgrade rwlock in read mode.
     fn read<U>(blk: fn() -> U) -> U { blk() }
 }
@@ -712,6 +712,7 @@ mod tests {
     use sync::*;
 
     use core::cast;
+    use core::cell::Cell;
     use core::option;
     use core::pipes;
     use core::ptr;
diff --git a/src/libstd/test.rs b/src/libstd/test.rs
index bfeaf8400bc..49a8dff4a96 100644
--- a/src/libstd/test.rs
+++ b/src/libstd/test.rs
@@ -46,34 +46,10 @@ extern mod rustrt {
 // colons. This way if some test runner wants to arrange the tests
 // hierarchically it may.
 
-#[cfg(stage0)]
-pub enum TestName {
-    // Stage0 doesn't understand sendable &static/str yet
-    StaticTestName(&static/[u8]),
-    DynTestName(~str)
-}
-
-#[cfg(stage0)]
-impl ToStr for TestName {
-    pure fn to_str(&self) -> ~str {
-        match self {
-            &StaticTestName(s) => str::from_bytes(s),
-            &DynTestName(s) => s.to_str()
-        }
-    }
-}
-
-#[cfg(stage1)]
-#[cfg(stage2)]
-#[cfg(stage3)]
 pub enum TestName {
     StaticTestName(&static/str),
     DynTestName(~str)
 }
-
-#[cfg(stage1)]
-#[cfg(stage2)]
-#[cfg(stage3)]
 impl ToStr for TestName {
     pure fn to_str(&self) -> ~str {
         match self {
diff --git a/src/libstd/time.rs b/src/libstd/time.rs
index c8379d3ef44..6e80665d80e 100644
--- a/src/libstd/time.rs
+++ b/src/libstd/time.rs
@@ -47,7 +47,7 @@ pub struct Timespec { sec: i64, nsec: i32 }
  * -1.2 seconds before the epoch is represented by `Timespec { sec: -2_i64,
  * nsec: 800_000_000_i32 }`.
  */
-impl Timespec {
+pub impl Timespec {
     static pure fn new(sec: i64, nsec: i32) -> Timespec {
         assert nsec >= 0 && nsec < NSEC_PER_SEC;
         Timespec { sec: sec, nsec: nsec }
@@ -208,7 +208,7 @@ pub pure fn strftime(format: &str, tm: &Tm) -> ~str {
     unsafe { do_strftime(format, tm) }
 }
 
-impl Tm {
+pub impl Tm {
     /// Convert time to the seconds from January 1, 1970
     fn to_timespec() -> Timespec {
         unsafe {
@@ -892,6 +892,7 @@ mod tests {
     use core::float;
     use core::os;
     use core::result;
+    use core::result::{Err, Ok};
     use core::str;
     use core::u64;
     use core::uint;
@@ -902,15 +903,13 @@ mod tests {
         const some_future_date: i64 = 1577836800i64; // 2020-01-01T00:00:00Z
 
         let tv1 = get_time();
-        log(debug, ~"tv1=" + uint::to_str(tv1.sec as uint) + ~" sec + "
-                   + uint::to_str(tv1.nsec as uint) + ~" nsec");
+        debug!("tv1=%? sec + %? nsec", tv1.sec as uint, tv1.nsec as uint);
 
         assert tv1.sec > some_recent_date;
         assert tv1.nsec < 1000000000i32;
 
         let tv2 = get_time();
-        log(debug, ~"tv2=" + uint::to_str(tv2.sec as uint) + ~" sec + "
-                   + uint::to_str(tv2.nsec as uint) + ~" nsec");
+        debug!("tv2=%? sec + %? nsec", tv2.sec as uint, tv2.nsec as uint);
 
         assert tv2.sec >= tv1.sec;
         assert tv2.sec < some_future_date;
@@ -924,16 +923,16 @@ mod tests {
         let s0 = precise_time_s();
         let ns1 = precise_time_ns();
 
-        log(debug, ~"s0=" + float::to_str_digits(s0, 9u) + ~" sec");
+        debug!("s0=%s sec", float::to_str_digits(s0, 9u));
         assert s0 > 0.;
         let ns0 = (s0 * 1000000000.) as u64;
-        log(debug, ~"ns0=" + u64::to_str(ns0) + ~" ns");
+        debug!("ns0=%? ns", ns0);
 
-        log(debug, ~"ns1=" + u64::to_str(ns1) + ~" ns");
+        debug!("ns1=%? ns", ns0);
         assert ns1 >= ns0;
 
         let ns2 = precise_time_ns();
-        log(debug, ~"ns2=" + u64::to_str(ns2) + ~" ns");
+        debug!("ns2=%? ns", ns0);
         assert ns2 >= ns1;
     }
 
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs
index 0e593ba42d1..88e4ade4b82 100644
--- a/src/libstd/treemap.rs
+++ b/src/libstd/treemap.rs
@@ -177,7 +177,7 @@ impl<K:Ord,V> Map<K, V> for TreeMap<K, V> {
     }
 }
 
-impl <K:Ord,V> TreeMap<K, V> {
+pub impl <K:Ord,V> TreeMap<K, V> {
     /// Create an empty TreeMap
     static pure fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
 
@@ -207,8 +207,8 @@ pub struct TreeMapIterator<K, V> {
 /// Advance the iterator to the next node (in order) and return a
 /// tuple with a reference to the key and value. If there are no
 /// more nodes, return `None`.
-fn map_next<K: Ord, V>(iter: &mut TreeMapIterator/&r<K, V>)
- -> Option<(&r/K, &r/V)> {
+pub fn map_next<K: Ord, V>(iter: &mut TreeMapIterator/&r<K, V>)
+                        -> Option<(&r/K, &r/V)> {
     while !iter.stack.is_empty() || iter.node.is_some() {
         match *iter.node {
           Some(ref x) => {
@@ -226,7 +226,7 @@ fn map_next<K: Ord, V>(iter: &mut TreeMapIterator/&r<K, V>)
 }
 
 /// Advance the iterator through the map
-fn map_advance<K: Ord, V>(iter: &mut TreeMapIterator/&r<K, V>,
+pub fn map_advance<K: Ord, V>(iter: &mut TreeMapIterator/&r<K, V>,
                           f: fn((&r/K, &r/V)) -> bool) {
     loop {
         match map_next(iter) {
@@ -480,7 +480,7 @@ impl<T:Ord> Set<T> for TreeSet<T> {
     }
 }
 
-impl <T:Ord> TreeSet<T> {
+pub impl <T:Ord> TreeSet<T> {
     /// Create an empty TreeSet
     static pure fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} }
 
@@ -518,7 +518,7 @@ struct TreeNode<K, V> {
     level: uint
 }
 
-impl <K:Ord,V> TreeNode<K, V> {
+pub impl <K:Ord,V> TreeNode<K, V> {
     #[inline(always)]
     static pure fn new(key: K, value: V) -> TreeNode<K, V> {
         TreeNode{key: key, value: value, left: None, right: None, level: 1}
@@ -683,7 +683,11 @@ fn remove<K:Ord,V>(node: &mut Option<~TreeNode<K, V>>, key: &K) -> bool {
 #[cfg(test)]
 mod test_treemap {
     use super::*;
+    use core::cmp::{Ord, Eq};
+    use core::option::{Some, Option, None};
+    use core::rand;
     use core::str;
+    use core::vec;
 
     #[test]
     fn find_empty() {
diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs
index 401cecf8811..37d9b3221b2 100644
--- a/src/libstd/uv_global_loop.rs
+++ b/src/libstd/uv_global_loop.rs
@@ -123,9 +123,11 @@ fn spawn_loop() -> IoTask {
 mod test {
     use core::prelude::*;
 
+    use get_gl = get;
     use uv::iotask;
     use uv::ll;
     use uv_global_loop::*;
+    use uv_iotask::IoTask;
 
     use core::iter;
     use core::libc;
diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs
index 52956f152fe..14726a0854d 100644
--- a/src/libstd/uv_iotask.rs
+++ b/src/libstd/uv_iotask.rs
@@ -202,124 +202,120 @@ extern fn tear_down_close_cb(handle: *ll::uv_async_t) {
 }
 
 #[cfg(test)]
-mod test {
-    use core::prelude::*;
-
-    use uv::ll;
-    use uv_iotask::*;
-
-    use core::iter;
-    use core::libc;
-    use core::ptr;
-    use core::task;
-    use core::pipes::{stream, Chan, SharedChan, Port};
-
-    extern fn async_close_cb(handle: *ll::uv_async_t) {
-        unsafe {
-            log(debug, fmt!("async_close_cb handle %?", handle));
-            let exit_ch = &(*(ll::get_data_for_uv_handle(handle)
-                            as *AhData)).exit_ch;
-            let exit_ch = exit_ch.clone();
-            exit_ch.send(());
-        }
-    }
-    extern fn async_handle_cb(handle: *ll::uv_async_t, status: libc::c_int) {
-        unsafe {
-            log(debug,
-                fmt!("async_handle_cb handle %? status %?",handle,status));
-            ll::close(handle, async_close_cb);
-        }
-    }
-    struct AhData {
-        iotask: IoTask,
-        exit_ch: SharedChan<()>
+extern fn async_close_cb(handle: *ll::uv_async_t) {
+    unsafe {
+        log(debug, fmt!("async_close_cb handle %?", handle));
+        let exit_ch = &(*(ll::get_data_for_uv_handle(handle)
+                        as *AhData)).exit_ch;
+        let exit_ch = exit_ch.clone();
+        exit_ch.send(());
     }
-    fn impl_uv_iotask_async(iotask: &IoTask) {
-        unsafe {
-            let async_handle = ll::async_t();
-            let ah_ptr = ptr::addr_of(&async_handle);
-            let (exit_po, exit_ch) = stream::<()>();
-            let ah_data = AhData {
-                iotask: iotask.clone(),
-                exit_ch: SharedChan(exit_ch)
-            };
-            let ah_data_ptr: *AhData = unsafe {
-                ptr::to_unsafe_ptr(&ah_data)
-            };
-            debug!("about to interact");
-            do interact(iotask) |loop_ptr| {
-                unsafe {
-                    debug!("interacting");
-                    ll::async_init(loop_ptr, ah_ptr, async_handle_cb);
-                    ll::set_data_for_uv_handle(
-                        ah_ptr, ah_data_ptr as *libc::c_void);
-                    ll::async_send(ah_ptr);
-                }
-            };
-            debug!("waiting for async close");
-            exit_po.recv();
-        }
+}
+
+#[cfg(test)]
+extern fn async_handle_cb(handle: *ll::uv_async_t, status: libc::c_int) {
+    unsafe {
+        log(debug,
+            fmt!("async_handle_cb handle %? status %?",handle,status));
+        ll::close(handle, async_close_cb);
     }
+}
+
+#[cfg(test)]
+struct AhData {
+    iotask: IoTask,
+    exit_ch: SharedChan<()>
+}
 
-    // this fn documents the bear minimum neccesary to roll your own
-    // high_level_loop
-    unsafe fn spawn_test_loop(exit_ch: ~Chan<()>) -> IoTask {
-        let (iotask_port, iotask_ch) = stream::<IoTask>();
-        do task::spawn_sched(task::ManualThreads(1u)) {
-            debug!("about to run a test loop");
-            run_loop(&iotask_ch);
-            exit_ch.send(());
+#[cfg(test)]
+fn impl_uv_iotask_async(iotask: &IoTask) {
+    unsafe {
+        let async_handle = ll::async_t();
+        let ah_ptr = ptr::addr_of(&async_handle);
+        let (exit_po, exit_ch) = stream::<()>();
+        let ah_data = AhData {
+            iotask: iotask.clone(),
+            exit_ch: SharedChan(exit_ch)
+        };
+        let ah_data_ptr: *AhData = unsafe {
+            ptr::to_unsafe_ptr(&ah_data)
         };
-        return iotask_port.recv();
+        debug!("about to interact");
+        do interact(iotask) |loop_ptr| {
+            unsafe {
+                debug!("interacting");
+                ll::async_init(loop_ptr, ah_ptr, async_handle_cb);
+                ll::set_data_for_uv_handle(
+                    ah_ptr, ah_data_ptr as *libc::c_void);
+                ll::async_send(ah_ptr);
+            }
+        };
+        debug!("waiting for async close");
+        exit_po.recv();
     }
+}
 
-    extern fn lifetime_handle_close(handle: *libc::c_void) {
-        unsafe {
-            log(debug, fmt!("lifetime_handle_close ptr %?", handle));
-        }
-    }
+// this fn documents the bear minimum neccesary to roll your own
+// high_level_loop
+#[cfg(test)]
+unsafe fn spawn_test_loop(exit_ch: ~Chan<()>) -> IoTask {
+    let (iotask_port, iotask_ch) = stream::<IoTask>();
+    do task::spawn_sched(task::ManualThreads(1u)) {
+        debug!("about to run a test loop");
+        run_loop(&iotask_ch);
+        exit_ch.send(());
+    };
+    return iotask_port.recv();
+}
 
-    extern fn lifetime_async_callback(handle: *libc::c_void,
-                                     status: libc::c_int) {
-        log(debug, fmt!("lifetime_handle_close ptr %? status %?",
-                        handle, status));
+#[cfg(test)]
+extern fn lifetime_handle_close(handle: *libc::c_void) {
+    unsafe {
+        log(debug, fmt!("lifetime_handle_close ptr %?", handle));
     }
+}
 
-    #[test]
-    fn test_uv_iotask_async() {
-        unsafe {
-            let (exit_po, exit_ch) = stream::<()>();
-            let iotask = &spawn_test_loop(~exit_ch);
-
-            debug!("spawned iotask");
-
-            // using this handle to manage the lifetime of the
-            // high_level_loop, as it will exit the first time one of
-            // the impl_uv_hl_async() is cleaned up with no one ref'd
-            // handles on the loop (Which can happen under
-            // race-condition type situations.. this ensures that the
-            // loop lives until, at least, all of the
-            // impl_uv_hl_async() runs have been called, at least.
-            let (work_exit_po, work_exit_ch) = stream::<()>();
-            let work_exit_ch = SharedChan(work_exit_ch);
-            for iter::repeat(7u) {
-                let iotask_clone = iotask.clone();
-                let work_exit_ch_clone = work_exit_ch.clone();
-                do task::spawn_sched(task::ManualThreads(1u)) {
-                    debug!("async");
-                    impl_uv_iotask_async(&iotask_clone);
-                    debug!("done async");
-                    work_exit_ch_clone.send(());
-                };
-            };
-            for iter::repeat(7u) {
-                debug!("waiting");
-                work_exit_po.recv();
+#[cfg(test)]
+extern fn lifetime_async_callback(handle: *libc::c_void,
+                                 status: libc::c_int) {
+    log(debug, fmt!("lifetime_handle_close ptr %? status %?",
+                    handle, status));
+}
+
+#[test]
+fn test_uv_iotask_async() {
+    unsafe {
+        let (exit_po, exit_ch) = stream::<()>();
+        let iotask = &spawn_test_loop(~exit_ch);
+
+        debug!("spawned iotask");
+
+        // using this handle to manage the lifetime of the
+        // high_level_loop, as it will exit the first time one of
+        // the impl_uv_hl_async() is cleaned up with no one ref'd
+        // handles on the loop (Which can happen under
+        // race-condition type situations.. this ensures that the
+        // loop lives until, at least, all of the
+        // impl_uv_hl_async() runs have been called, at least.
+        let (work_exit_po, work_exit_ch) = stream::<()>();
+        let work_exit_ch = SharedChan(work_exit_ch);
+        for iter::repeat(7u) {
+            let iotask_clone = iotask.clone();
+            let work_exit_ch_clone = work_exit_ch.clone();
+            do task::spawn_sched(task::ManualThreads(1u)) {
+                debug!("async");
+                impl_uv_iotask_async(&iotask_clone);
+                debug!("done async");
+                work_exit_ch_clone.send(());
             };
-            log(debug, ~"sending teardown_loop msg..");
-            exit(iotask);
-            exit_po.recv();
-            log(debug, ~"after recv on exit_po.. exiting..");
-        }
+        };
+        for iter::repeat(7u) {
+            debug!("waiting");
+            work_exit_po.recv();
+        };
+        log(debug, ~"sending teardown_loop msg..");
+        exit(iotask);
+        exit_po.recv();
+        log(debug, ~"after recv on exit_po.. exiting..");
     }
 }
diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs
index dd54620c83d..b7111bfb023 100644
--- a/src/libstd/uv_ll.rs
+++ b/src/libstd/uv_ll.rs
@@ -1199,6 +1199,7 @@ pub mod test {
 
     use uv_ll::*;
 
+    use core::comm::{SharedChan, stream};
     use core::libc;
     use core::ptr;
     use core::str;
@@ -1687,7 +1688,7 @@ pub mod test {
 
     // this is the impl for a test that is (maybe) ran on a
     // per-platform/arch basis below
-    fn impl_uv_tcp_server_and_request() {
+    pub fn impl_uv_tcp_server_and_request() {
         unsafe {
             let bind_ip = ~"0.0.0.0";
             let request_ip = ~"127.0.0.1";
diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs
index c85aa78d983..592ac40e082 100644
--- a/src/libstd/workcache.rs
+++ b/src/libstd/workcache.rs
@@ -132,7 +132,7 @@ impl cmp::Ord for WorkKey {
     }
 }
 
-impl WorkKey {
+pub impl WorkKey {
     static fn new(kind: &str, name: &str) -> WorkKey {
     WorkKey { kind: kind.to_owned(), name: name.to_owned() }
     }
@@ -168,7 +168,7 @@ struct Database {
     mut db_dirty: bool
 }
 
-impl Database {
+pub impl Database {
     fn prepare(&mut self, fn_name: &str,
                declared_inputs: &WorkMap) -> Option<(WorkMap, WorkMap, ~str)>
     {
@@ -199,7 +199,7 @@ struct Logger {
     a: ()
 }
 
-impl Logger {
+pub impl Logger {
     fn info(i: &str) {
         io::println(~"workcache: " + i.to_owned());
     }
@@ -254,7 +254,7 @@ fn digest_file(path: &Path) -> ~str {
     sha.result_str()
 }
 
-impl Context {
+pub impl Context {
 
     static fn new(db: @Mut<Database>,
                   lg: @Mut<Logger>,
@@ -356,7 +356,7 @@ impl TPrep for @Mut<Prep> {
     }
 }
 
-impl<T:Owned + Encodable<json::Encoder> + Decodable<json::Decoder>> Work<T> {
+pub impl<T:Owned+Encodable<json::Encoder>+Decodable<json::Decoder>> Work<T> {
     static fn new(p: @Mut<Prep>, e: Either<T,PortOne<(Exec,T)>>) -> Work<T> {
         Work { prep: p, res: Some(e) }
     }
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 46ecd96bef1..1053473a3a5 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -162,7 +162,7 @@ pub struct Generics {
     ty_params: OptVec<TyParam>
 }
 
-impl Generics {
+pub impl Generics {
     fn is_empty(&self) -> bool {
         self.lifetimes.len() + self.ty_params.len() == 0
     }
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index 88c0363917f..0627e063d97 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -16,6 +16,7 @@ use ast_util::{inlined_item_utils, path_to_ident, stmt_id};
 use ast_util;
 use attr;
 use codemap;
+use codemap::spanned;
 use diagnostic::span_handler;
 use parse::token::ident_interner;
 use print::pprust;
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index cede82d03dc..7e0cd2640b2 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -13,7 +13,7 @@ use core::prelude::*;
 use ast::*;
 use ast;
 use ast_util;
-use codemap::{span, BytePos, dummy_sp};
+use codemap::{span, BytePos, dummy_sp, spanned};
 use parse::token;
 use visit;
 use opt_vec;
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index 973b2ae2066..8cebe3cd187 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -93,6 +93,7 @@ use core::prelude::*;
 use ast;
 use ast_util;
 use attr;
+use codemap;
 use codemap::span;
 use ext::base::*;
 use parse;
@@ -1310,7 +1311,7 @@ mod test {
     }
 
 
-    fn to_call_log (val: Encodable<TestEncoder>) -> ~[call] {
+    fn to_call_log<E:Encodable<TestEncoder>>(val: E) -> ~[call] {
         let mut te = TestEncoder {call_log: @mut ~[]};
         val.encode(&te);
         copy *te.call_log
@@ -1323,8 +1324,7 @@ mod test {
     }
 
     #[test] fn encode_enum_test () {
-        check_equal (to_call_log(Book(34,44)
-                                 as Encodable::<TestEncoder>),
+        check_equal (to_call_log(Book(34,44)),
                      ~[CallToEmitEnum (~"Written"),
                        CallToEmitEnumVariant (~"Book",0,2),
                        CallToEmitEnumVariantArg (0),
@@ -1339,8 +1339,7 @@ mod test {
     pub struct HasPos { pos : BPos }
 
     #[test] fn encode_newtype_test () {
-        check_equal (to_call_log (HasPos {pos:BPos(48)}
-                                 as Encodable::<TestEncoder>),
+        check_equal (to_call_log (HasPos {pos:BPos(48)}),
                     ~[CallToEmitStruct(~"HasPos",1),
                       CallToEmitField(~"pos",0),
                       CallToEmitUint(48)]);
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index f5a7bbddf99..7d3c7cafa95 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -82,7 +82,7 @@ pub enum SyntaxExtension {
     IdentTT(SyntaxExpanderTTItem),
 }
 
-type SyntaxEnv = @mut MapChain<Name, Transformer>;
+pub type SyntaxEnv = @mut MapChain<Name, Transformer>;
 
 // Name : the domain of SyntaxEnvs
 // want to change these to uints....
@@ -98,7 +98,7 @@ type Name = @~str;
 // toward a more uniform syntax syntax (sorry) where blocks are just
 // another kind of transformer.
 
-enum Transformer {
+pub enum Transformer {
     // this identifier maps to a syntax extension or macro
     SE(SyntaxExtension),
     // should blocks occurring here limit macro scopes?
@@ -494,6 +494,7 @@ mod test {
     use super::*;
     use super::MapChain;
     use util::testing::check_equal;
+    use core::hashmap::linear::LinearMap;
 
     #[test] fn testenv () {
         let mut a = LinearMap::new();
diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs
index d4104c3a14a..4f53bf62efb 100644
--- a/src/libsyntax/ext/concat_idents.rs
+++ b/src/libsyntax/ext/concat_idents.rs
@@ -10,8 +10,11 @@
 
 use core::prelude::*;
 
+use ast;
+use codemap::span;
 use ext::base::*;
 use ext::base;
+use parse::token;
 
 pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs
index fc603cdee98..50047d2ce41 100644
--- a/src/libsyntax/ext/deriving.rs
+++ b/src/libsyntax/ext/deriving.rs
@@ -38,7 +38,7 @@ enum Junction {
     Disjunction,
 }
 
-impl Junction {
+pub impl Junction {
     fn to_binop(self) -> binop {
         match self {
             Conjunction => and,
diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs
index 030e819ca3f..91a9de9c051 100644
--- a/src/libsyntax/ext/env.rs
+++ b/src/libsyntax/ext/env.rs
@@ -15,13 +15,14 @@
  * interface.
  */
 
+use prelude::*;
+
+use ast;
+use codemap::span;
 use ext::base::*;
 use ext::base;
 use ext::build::mk_uniq_str;
 
-use core::option;
-use core::os;
-
 pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
 
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 105b65c35c9..e3408a47c9a 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -10,13 +10,16 @@
 
 use core::prelude::*;
 
+use ast::{blk_, attribute_, attr_outer, meta_word};
 use ast::{crate, expr_, expr_mac, mac_invoc_tt};
 use ast::{tt_delim, tt_tok, item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi};
 use ast;
 use attr;
-use codemap::{span, CallInfo, ExpandedFrom, NameAndSpan};
+use codemap;
+use codemap::{span, CallInfo, ExpandedFrom, NameAndSpan, spanned};
 use ext::base::*;
 use fold::*;
+use parse;
 use parse::{parser, parse_item_from_source_str, new_parser_from_tts};
 
 use core::option;
@@ -184,7 +187,7 @@ pub fn expand_item(extsbox: @mut SyntaxEnv,
 }
 
 // does this attribute list contain "macro_escape" ?
-fn contains_macro_escape (attrs: &[ast::attribute]) -> bool{
+pub fn contains_macro_escape (attrs: &[ast::attribute]) -> bool{
     let mut accum = false;
     do attrs.each |attr| {
         let mname = attr::get_attr_name(attr);
@@ -490,7 +493,13 @@ pub fn expand_crate(parse_sess: @mut parse::ParseSess,
 #[cfg(test)]
 mod test {
     use super::*;
+    use ast;
+    use ast::{attribute_, attr_outer, meta_word};
+    use codemap;
+    use codemap::spanned;
+    use parse;
     use util::testing::check_equal;
+    use core::option::{None, Some};
 
     // make sure that fail! is present
     #[test] fn fail_exists_test () {
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index 2169e8f6f2f..35b11962524 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -22,6 +22,7 @@ use ast;
 use codemap::span;
 use ext::base::*;
 use ext::base;
+use ext::build;
 use ext::build::*;
 use private::extfmt::ct::*;
 
diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs
index a59e43b1c1a..368520acd2d 100644
--- a/src/libsyntax/ext/log_syntax.rs
+++ b/src/libsyntax/ext/log_syntax.rs
@@ -8,15 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use prelude::*;
+use core::io::WriterUtil;
+
 use ast;
 use codemap;
 use ext::base::*;
 use ext::base;
 use print;
 
-use core::io::WriterUtil;
-use core::option;
-
 pub fn expand_syntax_ext(cx: ext_ctxt,
                          sp: codemap::span,
                          tt: &[ast::token_tree])
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 973a4f0a4f0..40d0e2c5db2 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -20,7 +20,7 @@ use ast;
 use ast_util::{ident_to_path};
 use ast_util;
 use attr;
-use codemap::{span, respan, dummy_sp};
+use codemap::{span, respan, dummy_sp, spanned};
 use codemap;
 use ext::base::{ext_ctxt, mk_ctxt};
 use ext::quote::rt::*;
diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs
index bdcdf61fc58..a5ca24c6737 100644
--- a/src/libsyntax/ext/pipes/parse_proto.rs
+++ b/src/libsyntax/ext/pipes/parse_proto.rs
@@ -10,7 +10,9 @@
 
 // Parsing pipes protocols from token trees.
 
+use ast_util;
 use ext::pipes::pipec::*;
+use ext::pipes::proto::*;
 use parse::common::SeqSep;
 use parse::parser;
 use parse::token;
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 7b0f6c1529c..968a0e5f77e 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -10,8 +10,9 @@
 
 // A protocol compiler for Rust.
 
+use ast;
 use ast::ident;
-use codemap::dummy_sp;
+use codemap::{dummy_sp, spanned};
 use ext::base::ext_ctxt;
 use ext::pipes::ast_builder::{append_types, ext_ctxt_ast_builder, path};
 use ext::pipes::ast_builder::{path_global};
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index e09d7555005..4349ffaea43 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -34,10 +34,12 @@ use core::str;
 
 pub mod rt {
     use ast;
+    use codemap;
     use ext::base::ext_ctxt;
     use parse;
     use print::pprust;
 
+    use core::prelude::*;
     use core::str;
 
     pub use ast::*;
@@ -49,7 +51,7 @@ pub mod rt {
     use print::pprust;
     use print::pprust::{item_to_str, ty_to_str};
 
-    trait ToTokens {
+    pub trait ToTokens {
         pub fn to_tokens(&self, _cx: ext_ctxt) -> ~[token_tree];
     }
 
@@ -73,7 +75,7 @@ pub mod rt {
 
     */
 
-    trait ToSource {
+    pub trait ToSource {
         // Takes a thing and generates a string containing rust code for it.
         pub fn to_source(&self, cx: ext_ctxt) -> ~str;
     }
@@ -164,7 +166,7 @@ pub mod rt {
         }
     }
 
-    trait ExtParseUtils {
+    pub trait ExtParseUtils {
         fn parse_item(s: ~str) -> @ast::item;
         fn parse_expr(s: ~str) -> @ast::expr;
         fn parse_stmt(s: ~str) -> @ast::stmt;
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index f9eb2d7e0af..296305bb62e 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -8,12 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use ast;
 use codemap;
 use codemap::{FileMap, Loc, Pos, ExpandedFrom, span};
 use codemap::{CallInfo, NameAndSpan};
 use ext::base::*;
 use ext::base;
 use ext::build::{mk_base_vec_e, mk_uint, mk_u8, mk_base_str};
+use parse;
 use print::pprust;
 
 use core::io;
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 419c051ea97..fae9e1651d3 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // Earley-like parser for macros.
+use ast;
 use ast::{matcher, match_tok, match_seq, match_nonterminal, ident};
 use codemap::{BytePos, mk_sp};
 use codemap;
@@ -23,6 +24,7 @@ use core::dvec::DVec;
 use core::dvec;
 use core::io;
 use core::option;
+use core::option::{Option, Some, None};
 use core::str;
 use core::uint;
 use core::vec;
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 8e1d0d7f3e4..f820669ab1c 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -12,35 +12,36 @@ use core::prelude::*;
 
 use ast::*;
 use ast;
-use codemap::span;
+use codemap::{span, spanned};
+use opt_vec::OptVec;
 
 use core::option;
 use core::vec;
 
 pub trait ast_fold {
-    fn fold_crate(&crate) -> crate;
-    fn fold_view_item(@view_item) -> @view_item;
-    fn fold_foreign_item(@foreign_item) -> @foreign_item;
-    fn fold_item(@item) -> Option<@item>;
-    fn fold_struct_field(@struct_field) -> @struct_field;
-    fn fold_item_underscore(&item_) -> item_;
-    fn fold_method(@method) -> @method;
-    fn fold_block(&blk) -> blk;
-    fn fold_stmt(&stmt) -> @stmt;
-    fn fold_arm(&arm) -> arm;
-    fn fold_pat(@pat) -> @pat;
-    fn fold_decl(@decl) -> @decl;
-    fn fold_expr(@expr) -> @expr;
-    fn fold_ty(@Ty) -> @Ty;
-    fn fold_mod(&_mod) -> _mod;
-    fn fold_foreign_mod(&foreign_mod) -> foreign_mod;
-    fn fold_variant(&variant) -> variant;
-    fn fold_ident(ident) -> ident;
-    fn fold_path(@path) -> @path;
-    fn fold_local(@local) -> @local;
-    fn map_exprs(fn@(@expr) -> @expr, &[@expr]) -> ~[@expr];
-    fn new_id(node_id) -> node_id;
-    fn new_span(span) -> span;
+    fn fold_crate(@self, &crate) -> crate;
+    fn fold_view_item(@self, @view_item) -> @view_item;
+    fn fold_foreign_item(@self, @foreign_item) -> @foreign_item;
+    fn fold_item(@self, @item) -> Option<@item>;
+    fn fold_struct_field(@self, @struct_field) -> @struct_field;
+    fn fold_item_underscore(@self, &item_) -> item_;
+    fn fold_method(@self, @method) -> @method;
+    fn fold_block(@self, &blk) -> blk;
+    fn fold_stmt(@self, &stmt) -> @stmt;
+    fn fold_arm(@self, &arm) -> arm;
+    fn fold_pat(@self, @pat) -> @pat;
+    fn fold_decl(@self, @decl) -> @decl;
+    fn fold_expr(@self, @expr) -> @expr;
+    fn fold_ty(@self, @Ty) -> @Ty;
+    fn fold_mod(@self, &_mod) -> _mod;
+    fn fold_foreign_mod(@self, &foreign_mod) -> foreign_mod;
+    fn fold_variant(@self, &variant) -> variant;
+    fn fold_ident(@self, ident) -> ident;
+    fn fold_path(@self, @path) -> @path;
+    fn fold_local(@self, @local) -> @local;
+    fn map_exprs(@self, fn@(@expr) -> @expr, &[@expr]) -> ~[@expr];
+    fn new_id(@self, node_id) -> node_id;
+    fn new_span(@self, span) -> span;
 }
 
 // We may eventually want to be able to fold over type parameters, too
@@ -77,7 +78,7 @@ pub type ast_fold_fns = @AstFoldFns;
 /* some little folds that probably aren't useful to have in ast_fold itself*/
 
 //used in noop_fold_item and noop_fold_crate and noop_fold_crate_directive
-fn fold_meta_item_(mi: @meta_item, fld: ast_fold) -> @meta_item {
+fn fold_meta_item_(mi: @meta_item, fld: @ast_fold) -> @meta_item {
     @spanned {
         node:
             match mi.node {
@@ -96,7 +97,7 @@ fn fold_meta_item_(mi: @meta_item, fld: ast_fold) -> @meta_item {
         span: fld.new_span(mi.span) }
 }
 //used in noop_fold_item and noop_fold_crate
-fn fold_attribute_(at: attribute, fld: ast_fold) -> attribute {
+fn fold_attribute_(at: attribute, fld: @ast_fold) -> attribute {
     spanned {
         node: ast::attribute_ {
             style: at.node.style,
@@ -107,7 +108,7 @@ fn fold_attribute_(at: attribute, fld: ast_fold) -> attribute {
     }
 }
 //used in noop_fold_foreign_item and noop_fold_fn_decl
-fn fold_arg_(a: arg, fld: ast_fold) -> arg {
+fn fold_arg_(a: arg, fld: @ast_fold) -> arg {
     ast::arg {
         mode: a.mode,
         is_mutbl: a.is_mutbl,
@@ -117,14 +118,14 @@ fn fold_arg_(a: arg, fld: ast_fold) -> arg {
     }
 }
 //used in noop_fold_expr, and possibly elsewhere in the future
-fn fold_mac_(m: mac, fld: ast_fold) -> mac {
+fn fold_mac_(m: mac, fld: @ast_fold) -> mac {
     spanned {
         node: match m.node { mac_invoc_tt(*) => copy m.node },
         span: fld.new_span(m.span),
     }
 }
 
-pub fn fold_fn_decl(decl: &ast::fn_decl, fld: ast_fold) -> ast::fn_decl {
+pub fn fold_fn_decl(decl: &ast::fn_decl, fld: @ast_fold) -> ast::fn_decl {
     ast::fn_decl {
         inputs: decl.inputs.map(|x| fold_arg_(*x, fld)),
         output: fld.fold_ty(decl.output),
@@ -132,41 +133,43 @@ pub fn fold_fn_decl(decl: &ast::fn_decl, fld: ast_fold) -> ast::fn_decl {
     }
 }
 
-fn fold_ty_param_bound(tpb: &TyParamBound, fld: ast_fold) -> TyParamBound {
+fn fold_ty_param_bound(tpb: &TyParamBound, fld: @ast_fold) -> TyParamBound {
     match *tpb {
         TraitTyParamBound(ty) => TraitTyParamBound(fld.fold_ty(ty)),
         RegionTyParamBound => RegionTyParamBound
     }
 }
 
-pub fn fold_ty_param(tp: TyParam, fld: ast_fold) -> TyParam {
+pub fn fold_ty_param(tp: TyParam,
+                     fld: @ast_fold) -> TyParam {
     TyParam {ident: tp.ident,
              id: fld.new_id(tp.id),
              bounds: @tp.bounds.map(|x| fold_ty_param_bound(x, fld))}
 }
 
 pub fn fold_ty_params(tps: &OptVec<TyParam>,
-                      fld: ast_fold) -> OptVec<TyParam> {
+                      fld: @ast_fold) -> OptVec<TyParam> {
     tps.map(|tp| fold_ty_param(*tp, fld))
 }
 
-pub fn fold_lifetime(l: &Lifetime, fld: ast_fold) -> Lifetime {
+pub fn fold_lifetime(l: &Lifetime,
+                     fld: @ast_fold) -> Lifetime {
     Lifetime {id: fld.new_id(l.id),
               span: fld.new_span(l.span),
               ident: l.ident}
 }
 
 pub fn fold_lifetimes(lts: &OptVec<Lifetime>,
-                      fld: ast_fold) -> OptVec<Lifetime> {
+                      fld: @ast_fold) -> OptVec<Lifetime> {
     lts.map(|l| fold_lifetime(l, fld))
 }
 
-pub fn fold_generics(generics: &Generics, fld: ast_fold) -> Generics {
+pub fn fold_generics(generics: &Generics, fld: @ast_fold) -> Generics {
     Generics {ty_params: fold_ty_params(&generics.ty_params, fld),
               lifetimes: fold_lifetimes(&generics.lifetimes, fld)}
 }
 
-pub fn noop_fold_crate(c: &crate_, fld: ast_fold) -> crate_ {
+pub fn noop_fold_crate(c: &crate_, fld: @ast_fold) -> crate_ {
     let fold_meta_item = |x| fold_meta_item_(x, fld);
     let fold_attribute = |x| fold_attribute_(x, fld);
 
@@ -177,12 +180,12 @@ pub fn noop_fold_crate(c: &crate_, fld: ast_fold) -> crate_ {
     }
 }
 
-fn noop_fold_view_item(vi: view_item_, _fld: ast_fold) -> view_item_ {
+fn noop_fold_view_item(vi: view_item_, _fld: @ast_fold) -> view_item_ {
     return /* FIXME (#2543) */ copy vi;
 }
 
 
-fn noop_fold_foreign_item(ni: @foreign_item, fld: ast_fold)
+fn noop_fold_foreign_item(ni: @foreign_item, fld: @ast_fold)
     -> @foreign_item {
     let fold_arg = |x| fold_arg_(x, fld);
     let fold_attribute = |x| fold_attribute_(x, fld);
@@ -212,7 +215,7 @@ fn noop_fold_foreign_item(ni: @foreign_item, fld: ast_fold)
     }
 }
 
-pub fn noop_fold_item(i: @item, fld: ast_fold) -> Option<@item> {
+pub fn noop_fold_item(i: @item, fld: @ast_fold) -> Option<@item> {
     let fold_attribute = |x| fold_attribute_(x, fld);
 
     Some(@ast::item { ident: fld.fold_ident(i.ident),
@@ -223,7 +226,7 @@ pub fn noop_fold_item(i: @item, fld: ast_fold) -> Option<@item> {
                       span: fld.new_span(i.span) })
 }
 
-fn noop_fold_struct_field(sf: @struct_field, fld: ast_fold)
+fn noop_fold_struct_field(sf: @struct_field, fld: @ast_fold)
                        -> @struct_field {
     @spanned { node: ast::struct_field_ { kind: copy sf.node.kind,
                                           id: sf.node.id,
@@ -231,7 +234,7 @@ fn noop_fold_struct_field(sf: @struct_field, fld: ast_fold)
                span: sf.span }
 }
 
-pub fn noop_fold_item_underscore(i: &item_, fld: ast_fold) -> item_ {
+pub fn noop_fold_item_underscore(i: &item_, fld: @ast_fold) -> item_ {
     match *i {
         item_const(t, e) => item_const(fld.fold_ty(t), fld.fold_expr(e)),
         item_fn(ref decl, purity, ref generics, ref body) => {
@@ -295,7 +298,7 @@ pub fn noop_fold_item_underscore(i: &item_, fld: ast_fold) -> item_ {
     }
 }
 
-fn fold_struct_def(struct_def: @ast::struct_def, fld: ast_fold)
+fn fold_struct_def(struct_def: @ast::struct_def, fld: @ast_fold)
                 -> @ast::struct_def {
     let dtor = do option::map(&struct_def.dtor) |dtor| {
         let dtor_body = fld.fold_block(&dtor.node.body);
@@ -316,14 +319,14 @@ fn fold_struct_def(struct_def: @ast::struct_def, fld: ast_fold)
     }
 }
 
-fn fold_trait_ref(p: @trait_ref, fld: ast_fold) -> @trait_ref {
+fn fold_trait_ref(p: @trait_ref, fld: @ast_fold) -> @trait_ref {
     @ast::trait_ref {
         path: fld.fold_path(p.path),
         ref_id: fld.new_id(p.ref_id),
     }
 }
 
-fn fold_struct_field(f: @struct_field, fld: ast_fold) -> @struct_field {
+fn fold_struct_field(f: @struct_field, fld: @ast_fold) -> @struct_field {
     @spanned {
         node: ast::struct_field_ {
             kind: copy f.node.kind,
@@ -334,7 +337,7 @@ fn fold_struct_field(f: @struct_field, fld: ast_fold) -> @struct_field {
     }
 }
 
-fn noop_fold_method(m: @method, fld: ast_fold) -> @method {
+fn noop_fold_method(m: @method, fld: @ast_fold) -> @method {
     @ast::method {
         ident: fld.fold_ident(m.ident),
         attrs: /* FIXME (#2543) */ copy m.attrs,
@@ -351,7 +354,7 @@ fn noop_fold_method(m: @method, fld: ast_fold) -> @method {
 }
 
 
-pub fn noop_fold_block(b: &blk_, fld: ast_fold) -> blk_ {
+pub fn noop_fold_block(b: &blk_, fld: @ast_fold) -> blk_ {
     ast::blk_ {
         view_items: b.view_items.map(|x| fld.fold_view_item(*x)),
         stmts: b.stmts.map(|x| fld.fold_stmt(*x)),
@@ -361,7 +364,7 @@ pub fn noop_fold_block(b: &blk_, fld: ast_fold) -> blk_ {
     }
 }
 
-fn noop_fold_stmt(s: &stmt_, fld: ast_fold) -> stmt_ {
+fn noop_fold_stmt(s: &stmt_, fld: @ast_fold) -> stmt_ {
     let fold_mac = |x| fold_mac_(x, fld);
     match *s {
         stmt_decl(d, nid) => stmt_decl(fld.fold_decl(d), fld.new_id(nid)),
@@ -371,7 +374,7 @@ fn noop_fold_stmt(s: &stmt_, fld: ast_fold) -> stmt_ {
     }
 }
 
-fn noop_fold_arm(a: &arm, fld: ast_fold) -> arm {
+fn noop_fold_arm(a: &arm, fld: @ast_fold) -> arm {
     arm {
         pats: a.pats.map(|x| fld.fold_pat(*x)),
         guard: a.guard.map(|x| fld.fold_expr(*x)),
@@ -379,7 +382,7 @@ fn noop_fold_arm(a: &arm, fld: ast_fold) -> arm {
     }
 }
 
-pub fn noop_fold_pat(p: &pat_, fld: ast_fold) -> pat_ {
+pub fn noop_fold_pat(p: &pat_, fld: @ast_fold) -> pat_ {
     match *p {
         pat_wild => pat_wild,
         pat_ident(binding_mode, pth, ref sub) => {
@@ -431,7 +434,7 @@ pub fn noop_fold_pat(p: &pat_, fld: ast_fold) -> pat_ {
     }
 }
 
-fn noop_fold_decl(d: &decl_, fld: ast_fold) -> decl_ {
+fn noop_fold_decl(d: &decl_, fld: @ast_fold) -> decl_ {
     match *d {
         decl_local(ref ls) => decl_local(ls.map(|x| fld.fold_local(*x))),
         decl_item(it) => {
@@ -446,13 +449,13 @@ fn noop_fold_decl(d: &decl_, fld: ast_fold) -> decl_ {
 pub fn wrap<T>(f: fn@(&T, ast_fold) -> T)
     -> fn@(&T, span, ast_fold) -> (T, span)
 {
-    fn@(x: &T, s: span, fld: ast_fold) -> (T, span) {
+    fn@(x: &T, s: span, fld: @ast_fold) -> (T, span) {
         (f(x, fld), s)
     }
 }
 
-pub fn noop_fold_expr(e: &expr_, fld: ast_fold) -> expr_ {
-    fn fold_field_(field: field, fld: ast_fold) -> field {
+pub fn noop_fold_expr(e: &expr_, fld: @ast_fold) -> expr_ {
+    fn fold_field_(field: field, fld: @ast_fold) -> field {
         spanned {
             node: ast::field_ {
                 mutbl: field.node.mutbl,
@@ -594,15 +597,15 @@ pub fn noop_fold_expr(e: &expr_, fld: ast_fold) -> expr_ {
     }
 }
 
-pub fn noop_fold_ty(t: &ty_, fld: ast_fold) -> ty_ {
+pub fn noop_fold_ty(t: &ty_, fld: @ast_fold) -> ty_ {
     let fold_mac = |x| fold_mac_(x, fld);
-    fn fold_mt(mt: &mt, fld: ast_fold) -> mt {
+    fn fold_mt(mt: &mt, fld: @ast_fold) -> mt {
         mt {
             ty: fld.fold_ty(mt.ty),
             mutbl: mt.mutbl,
         }
     }
-    fn fold_field(f: ty_field, fld: ast_fold) -> ty_field {
+    fn fold_field(f: ty_field, fld: @ast_fold) -> ty_field {
         spanned {
             node: ast::ty_field_ {
                 ident: fld.fold_ident(f.node.ident),
@@ -648,14 +651,14 @@ pub fn noop_fold_ty(t: &ty_, fld: ast_fold) -> ty_ {
 }
 
 // ...nor do modules
-pub fn noop_fold_mod(m: &_mod, fld: ast_fold) -> _mod {
+pub fn noop_fold_mod(m: &_mod, fld: @ast_fold) -> _mod {
     ast::_mod {
         view_items: vec::map(m.view_items, |x| fld.fold_view_item(*x)),
         items: vec::filter_mapped(m.items, |x| fld.fold_item(*x)),
     }
 }
 
-fn noop_fold_foreign_mod(nm: &foreign_mod, fld: ast_fold) -> foreign_mod {
+fn noop_fold_foreign_mod(nm: &foreign_mod, fld: @ast_fold) -> foreign_mod {
     ast::foreign_mod {
         sort: nm.sort,
         abi: nm.abi,
@@ -664,8 +667,8 @@ fn noop_fold_foreign_mod(nm: &foreign_mod, fld: ast_fold) -> foreign_mod {
     }
 }
 
-fn noop_fold_variant(v: &variant_, fld: ast_fold) -> variant_ {
-    fn fold_variant_arg_(va: variant_arg, fld: ast_fold) -> variant_arg {
+fn noop_fold_variant(v: &variant_, fld: @ast_fold) -> variant_ {
+    fn fold_variant_arg_(va: variant_arg, fld: @ast_fold) -> variant_arg {
         ast::variant_arg { ty: fld.fold_ty(va.ty), id: fld.new_id(va.id) }
     }
     let fold_variant_arg = |x| fold_variant_arg_(x, fld);
@@ -730,19 +733,21 @@ fn noop_fold_variant(v: &variant_, fld: ast_fold) -> variant_ {
     }
 }
 
-fn noop_fold_ident(i: ident, _fld: ast_fold) -> ident {
+fn noop_fold_ident(i: ident, _fld: @ast_fold) -> ident {
     /* FIXME (#2543) */ copy i
 }
 
-fn noop_fold_path(p: @path, fld: ast_fold) -> path {
-    ast::path { span: fld.new_span(p.span),
-                global: p.global,
-                idents: p.idents.map(|x| fld.fold_ident(*x)),
-                rp: p.rp,
-                types: p.types.map(|x| fld.fold_ty(*x)) }
+fn noop_fold_path(p: @path, fld: @ast_fold) -> path {
+    ast::path {
+        span: fld.new_span(p.span),
+        global: p.global,
+        idents: p.idents.map(|x| fld.fold_ident(*x)),
+        rp: p.rp,
+        types: p.types.map(|x| fld.fold_ty(*x)),
+    }
 }
 
-fn noop_fold_local(l: &local_, fld: ast_fold) -> local_ {
+fn noop_fold_local(l: &local_, fld: @ast_fold) -> local_ {
     local_ {
         is_mutbl: l.is_mutbl,
         ty: fld.fold_ty(l.ty),
@@ -786,73 +791,73 @@ pub fn default_ast_fold() -> ast_fold_fns {
         fold_local: wrap(noop_fold_local),
         map_exprs: noop_map_exprs,
         new_id: noop_id,
-        new_span: noop_span
+        new_span: noop_span,
     }
 }
 
-impl ast_fold for ast_fold_fns {
+impl ast_fold for AstFoldFns {
     /* naturally, a macro to write these would be nice */
-    fn fold_crate(c: &crate) -> crate {
-        let (n, s) = (self.fold_crate)(&c.node, c.span, self as ast_fold);
+    fn fold_crate(@self, c: &crate) -> crate {
+        let (n, s) = (self.fold_crate)(&c.node, c.span, self as @ast_fold);
         spanned { node: n, span: (self.new_span)(s) }
     }
-    fn fold_view_item(x: @view_item) ->
+    fn fold_view_item(@self, x: @view_item) ->
        @view_item {
         @ast::view_item {
-            node: (self.fold_view_item)(x.node, self as ast_fold),
+            node: (self.fold_view_item)(x.node, self as @ast_fold),
             attrs: vec::map(x.attrs, |a|
-                  fold_attribute_(*a, self as ast_fold)),
+                  fold_attribute_(*a, self as @ast_fold)),
             vis: x.vis,
             span: (self.new_span)(x.span),
         }
     }
-    fn fold_foreign_item(x: @foreign_item) -> @foreign_item {
-        (self.fold_foreign_item)(x, self as ast_fold)
+    fn fold_foreign_item(@self, x: @foreign_item) -> @foreign_item {
+        (self.fold_foreign_item)(x, self as @ast_fold)
     }
-    fn fold_item(i: @item) -> Option<@item> {
-        (self.fold_item)(i, self as ast_fold)
+    fn fold_item(@self, i: @item) -> Option<@item> {
+        (self.fold_item)(i, self as @ast_fold)
     }
-    fn fold_struct_field(sf: @struct_field) -> @struct_field {
+    fn fold_struct_field(@self, sf: @struct_field) -> @struct_field {
         @spanned {
             node: ast::struct_field_ {
                 kind: copy sf.node.kind,
                 id: sf.node.id,
-                ty: (self as ast_fold).fold_ty(sf.node.ty),
+                ty: (self as @ast_fold).fold_ty(sf.node.ty),
             },
             span: (self.new_span)(sf.span),
         }
     }
-    fn fold_item_underscore(i: &item_) -> item_ {
-        (self.fold_item_underscore)(i, self as ast_fold)
+    fn fold_item_underscore(@self, i: &item_) -> item_ {
+        (self.fold_item_underscore)(i, self as @ast_fold)
     }
-    fn fold_method(x: @method) -> @method {
-        (self.fold_method)(x, self as ast_fold)
+    fn fold_method(@self, x: @method) -> @method {
+        (self.fold_method)(x, self as @ast_fold)
     }
-    fn fold_block(x: &blk) -> blk {
-        let (n, s) = (self.fold_block)(&x.node, x.span, self as ast_fold);
+    fn fold_block(@self, x: &blk) -> blk {
+        let (n, s) = (self.fold_block)(&x.node, x.span, self as @ast_fold);
         spanned { node: n, span: (self.new_span)(s) }
     }
-    fn fold_stmt(x: &stmt) -> @stmt {
-        let (n, s) = (self.fold_stmt)(&x.node, x.span, self as ast_fold);
+    fn fold_stmt(@self, x: &stmt) -> @stmt {
+        let (n, s) = (self.fold_stmt)(&x.node, x.span, self as @ast_fold);
         @spanned { node: n, span: (self.new_span)(s) }
     }
-    fn fold_arm(x: &arm) -> arm {
-        (self.fold_arm)(x, self as ast_fold)
+    fn fold_arm(@self, x: &arm) -> arm {
+        (self.fold_arm)(x, self as @ast_fold)
     }
-    fn fold_pat(x: @pat) -> @pat {
-        let (n, s) =  (self.fold_pat)(&x.node, x.span, self as ast_fold);
+    fn fold_pat(@self, x: @pat) -> @pat {
+        let (n, s) =  (self.fold_pat)(&x.node, x.span, self as @ast_fold);
         @pat {
             id: (self.new_id)(x.id),
             node: n,
             span: (self.new_span)(s),
         }
     }
-    fn fold_decl(x: @decl) -> @decl {
-        let (n, s) = (self.fold_decl)(&x.node, x.span, self as ast_fold);
+    fn fold_decl(@self, x: @decl) -> @decl {
+        let (n, s) = (self.fold_decl)(&x.node, x.span, self as @ast_fold);
         @spanned { node: n, span: (self.new_span)(s) }
     }
-    fn fold_expr(x: @expr) -> @expr {
-        let (n, s) = (self.fold_expr)(&x.node, x.span, self as ast_fold);
+    fn fold_expr(@self, x: @expr) -> @expr {
+        let (n, s) = (self.fold_expr)(&x.node, x.span, self as @ast_fold);
         @expr {
             id: (self.new_id)(x.id),
             callee_id: (self.new_id)(x.callee_id),
@@ -860,41 +865,45 @@ impl ast_fold for ast_fold_fns {
             span: (self.new_span)(s),
         }
     }
-    fn fold_ty(x: @Ty) -> @Ty {
-        let (n, s) = (self.fold_ty)(&x.node, x.span, self as ast_fold);
+    fn fold_ty(@self, x: @Ty) -> @Ty {
+        let (n, s) = (self.fold_ty)(&x.node, x.span, self as @ast_fold);
         @Ty {
             id: (self.new_id)(x.id),
             node: n,
             span: (self.new_span)(s),
         }
     }
-    fn fold_mod(x: &_mod) -> _mod {
-        (self.fold_mod)(x, self as ast_fold)
+    fn fold_mod(@self, x: &_mod) -> _mod {
+        (self.fold_mod)(x, self as @ast_fold)
     }
-    fn fold_foreign_mod(x: &foreign_mod) -> foreign_mod {
-        (self.fold_foreign_mod)(x, self as ast_fold)
+    fn fold_foreign_mod(@self, x: &foreign_mod) -> foreign_mod {
+        (self.fold_foreign_mod)(x, self as @ast_fold)
     }
-    fn fold_variant(x: &variant) -> variant {
-        let (n, s) = (self.fold_variant)(&x.node, x.span, self as ast_fold);
+    fn fold_variant(@self, x: &variant) -> variant {
+        let (n, s) = (self.fold_variant)(&x.node, x.span, self as @ast_fold);
         spanned { node: n, span: (self.new_span)(s) }
     }
-    fn fold_ident(x: ident) -> ident {
-        (self.fold_ident)(x, self as ast_fold)
+    fn fold_ident(@self, x: ident) -> ident {
+        (self.fold_ident)(x, self as @ast_fold)
     }
-    fn fold_path(x: @path) -> @path {
-        @(self.fold_path)(x, self as ast_fold)
+    fn fold_path(@self, x: @path) -> @path {
+        @(self.fold_path)(x, self as @ast_fold)
     }
-    fn fold_local(x: @local) -> @local {
-        let (n, s) = (self.fold_local)(&x.node, x.span, self as ast_fold);
+    fn fold_local(@self, x: @local) -> @local {
+        let (n, s) = (self.fold_local)(&x.node, x.span, self as @ast_fold);
         @spanned { node: n, span: (self.new_span)(s) }
     }
-    fn map_exprs(f: fn@(@expr) -> @expr, e: &[@expr]) -> ~[@expr] {
+    fn map_exprs(
+        @self,
+        f: fn@(@expr) -> @expr,
+        e: &[@expr]
+    ) -> ~[@expr] {
         (self.map_exprs)(f, e)
     }
-    fn new_id(node_id: ast::node_id) -> node_id {
+    fn new_id(@self, node_id: ast::node_id) -> node_id {
         (self.new_id)(node_id)
     }
-    fn new_span(span: span) -> span {
+    fn new_span(@self, span: span) -> span {
         (self.new_span)(span)
     }
 }
@@ -906,7 +915,7 @@ pub impl ast_fold {
 }
 
 pub fn make_fold(afp: ast_fold_fns) -> ast_fold {
-    afp as ast_fold
+    afp as @ast_fold
 }
 
 //
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index a52a9f3ba5e..28f84613740 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -15,6 +15,7 @@ use codemap::spanned;
 use codemap::BytePos;
 use parse::common::*; //resolve bug?
 use parse::token;
+use parse::parser::Parser;
 
 use core::either::{Either, Left, Right};
 
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index 2a40b700c11..ed71fa411c6 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -773,10 +773,14 @@ fn consume_whitespace(rdr: @mut StringReader) {
 
 #[cfg(test)]
 pub mod test {
-
     use super::*;
-    use util::interner;
+
+    use ast;
+    use codemap::{BytePos, CodeMap, span};
+    use core::option::None;
     use diagnostic;
+    use parse::token;
+    use util::interner;
     use util::testing::{check_equal, check_equal_ptr};
 
     // represents a testing reader (incl. both reader and interner)
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 816e4137126..887f064018f 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -299,6 +299,8 @@ mod test {
     use super::*;
     use std::serialize::Encodable;
     use std;
+    use core::io;
+    use core::option::None;
     use core::str;
     use util::testing::*;
 
@@ -314,7 +316,7 @@ mod test {
             @~"fn foo (x : int) { x; }",
             ~[],
             new_parse_sess(None));
-        check_equal(to_json_str(tts as Encodable::<std::json::Encoder>),
+        check_equal(to_json_str(@tts as Encodable::<std::json::Encoder>),
                     ~"[[\"tt_tok\",[,[\"IDENT\",[\"fn\",false]]]],\
                       [\"tt_tok\",[,[\"IDENT\",[\"foo\",false]]]],\
                       [\"tt_delim\",[[[\"tt_tok\",[,[\"LPAREN\",[]]]],\
diff --git a/src/libsyntax/parse/prec.rs b/src/libsyntax/parse/prec.rs
index fff222876aa..e2a89d2a28c 100644
--- a/src/libsyntax/parse/prec.rs
+++ b/src/libsyntax/parse/prec.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use ast;
 use ast::*;
 use parse::token::*;
 use parse::token::Token;
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 208ef6fa845..f08b042ad6a 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -2300,11 +2300,14 @@ pub fn print_onceness(s: @ps, o: ast::Onceness) {
 
 #[cfg(test)]
 pub mod test {
+    use super::*;
+
     use ast;
     use ast_util;
+    use codemap;
+    use core::cmp::Eq;
+    use core::option::None;
     use parse;
-    use super::*;
-    //use util;
     use util::testing::check_equal;
 
     fn string_check<T:Eq> (given : &T, expected: &T) {
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index eac16eac9b6..5919271664e 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -16,6 +16,7 @@ use ast_util;
 use codemap::span;
 use parse;
 use opt_vec;
+use opt_vec::OptVec;
 
 use core::option;
 use core::vec;
diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp
index 4d2d6ad344c..761dbeade53 100644
--- a/src/rt/rust_kernel.cpp
+++ b/src/rt/rust_kernel.cpp
@@ -342,8 +342,11 @@ rust_kernel::register_exit_function(spawn_fn runner, fn_env_pair *f) {
     assert(!at_exit_started && "registering at_exit function after exit");
 
     if (at_exit_runner) {
-        assert(runner == at_exit_runner
-               && "there can be only one at_exit_runner");
+        // FIXME #2912 Would be very nice to assert this but we can't because
+        // of the way coretest works (the test case ends up using its own
+        // function)
+        //assert(runner == at_exit_runner
+        //       && "there can be only one at_exit_runner");
     }
 
     at_exit_runner = runner;
diff --git a/src/snapshots.txt b/src/snapshots.txt
index a6ec0e499c7..fc72551e7dd 100644
--- a/src/snapshots.txt
+++ b/src/snapshots.txt
@@ -1,3 +1,11 @@
+S 2013-02-27 a6d9689
+  freebsd-x86_64 d33b5ebbf3335f6a8a5cc23572f630ad66539830
+  linux-i386 22f5c2a91941735007ed804586fc0f0e82fc3601
+  linux-x86_64 328fb144edbed8cabb8c2c6306304e3d8460ef60
+  macos-i386 5dda51347f9aba4c70a0890d3ec084d98a49c015
+  macos-x86_64 ca57514c51d6a38d53a92a8eab212379872baddb
+  winnt-i386 1ba692a33072597ae124736c9e4040197bc5c1cb
+
 S 2013-02-04 2f46b76
   freebsd-x86_64 d33b5ebbf3335f6a8a5cc23572f630ad66539830
   linux-i386 7537519ae3de82592d6150b9ca81cd4bf45d9457
diff --git a/src/test/auxiliary/cci_class_5.rs b/src/test/auxiliary/cci_class_5.rs
index e2564a55279..c04cdbcab1a 100644
--- a/src/test/auxiliary/cci_class_5.rs
+++ b/src/test/auxiliary/cci_class_5.rs
@@ -10,12 +10,12 @@
 
 pub mod kitties {
     pub struct cat {
-        priv mut meows : uint,
+        priv meows : uint,
         how_hungry : int,
     }
 
     pub impl cat {
-      priv fn nap() { for uint::range(1, 10000u) |_i|{}}
+      priv fn nap(&self) { for uint::range(1, 10000u) |_i|{}}
     }
 
     pub fn cat(in_x : uint, in_y : int) -> cat {
diff --git a/src/test/auxiliary/impl_privacy_xc_1.rs b/src/test/auxiliary/impl_privacy_xc_1.rs
index 05d5cee47f2..92452cbe8fd 100644
--- a/src/test/auxiliary/impl_privacy_xc_1.rs
+++ b/src/test/auxiliary/impl_privacy_xc_1.rs
@@ -4,7 +4,7 @@ pub struct Fish {
     x: int
 }
 
-impl Fish {
+pub impl Fish {
     fn swim(&self) {}
 }
 
diff --git a/src/test/auxiliary/issue-2380.rs b/src/test/auxiliary/issue-2380.rs
index 7cc8dcb22c9..afe7d4a6e8b 100644
--- a/src/test/auxiliary/issue-2380.rs
+++ b/src/test/auxiliary/issue-2380.rs
@@ -16,5 +16,5 @@ pub trait i<T> { }
 pub fn f<T>() -> i<T> {
     impl<T> i<T> for () { }
 
-    () as i::<T>
+    @() as @i<T>
 }
diff --git a/src/test/auxiliary/issue_2472_b.rs b/src/test/auxiliary/issue_2472_b.rs
index e1be3adcd4a..e7a92954725 100644
--- a/src/test/auxiliary/issue_2472_b.rs
+++ b/src/test/auxiliary/issue_2472_b.rs
@@ -11,7 +11,7 @@
 
 enum S = ();
 
-impl S {
+pub impl S {
     fn foo() { }
 }
 
diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs
index 2845596e780..5e73b286530 100644
--- a/src/test/bench/core-set.rs
+++ b/src/test/bench/core-set.rs
@@ -31,7 +31,7 @@ fn timed(result: &mut float, op: fn()) {
     *result = (end - start);
 }
 
-impl Results {
+pub impl Results {
     fn bench_int<T:Set<uint>>(&mut self, rng: @rand::Rng, num_keys: uint,
                                rand_cap: uint, f: fn() -> T) {
         {
diff --git a/src/test/bench/noise.rs b/src/test/bench/noise.rs
index 39caba92732..9825671bc8a 100644
--- a/src/test/bench/noise.rs
+++ b/src/test/bench/noise.rs
@@ -40,7 +40,7 @@ fn Noise2DContext() -> ~Noise2DContext {
     }
 }
 
-impl Noise2DContext {
+pub impl Noise2DContext {
     #[inline(always)]
     fn get_gradient(&self, x: int, y: int) -> Vec2 {
         let idx = self.permutations[x & 255] + self.permutations[y & 255];
diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs
index 5e472712fda..a52b7889017 100644
--- a/src/test/bench/shootout-mandelbrot.rs
+++ b/src/test/bench/shootout-mandelbrot.rs
@@ -112,7 +112,7 @@ fn writer(path: ~str, pport: comm::Port<Line>, size: uint)
 {
     let cout: io::Writer = match path {
         ~"" => {
-            Devnull as io::Writer
+            @Devnull as @io::Writer
         }
         ~"-" => {
             io::stdout()
diff --git a/src/test/compile-fail/assign-to-method.rs b/src/test/compile-fail/assign-to-method.rs
index 7d68d6d0c38..0a2834a95e6 100644
--- a/src/test/compile-fail/assign-to-method.rs
+++ b/src/test/compile-fail/assign-to-method.rs
@@ -14,7 +14,7 @@ struct cat {
   how_hungry : int,
 }
 
-impl cat {
+pub impl cat {
 
   fn speak() { self.meows += 1u; }
 }
diff --git a/src/test/compile-fail/borrowck-autoref-3261.rs b/src/test/compile-fail/borrowck-autoref-3261.rs
index b3ef5f4d481..068bb7cd7a6 100644
--- a/src/test/compile-fail/borrowck-autoref-3261.rs
+++ b/src/test/compile-fail/borrowck-autoref-3261.rs
@@ -10,7 +10,7 @@
 
 use core::either::*;
 enum X = Either<(uint,uint),extern fn()>;
-impl &X {
+pub impl &X {
     fn with(blk: fn(x: &Either<(uint,uint),extern fn()>)) {
         blk(&**self)
     }
diff --git a/src/test/compile-fail/borrowck-call-method-from-mut-aliasable.rs b/src/test/compile-fail/borrowck-call-method-from-mut-aliasable.rs
index 4e0cc76bf75..2c68429baec 100644
--- a/src/test/compile-fail/borrowck-call-method-from-mut-aliasable.rs
+++ b/src/test/compile-fail/borrowck-call-method-from-mut-aliasable.rs
@@ -12,7 +12,7 @@ struct Foo {
     x: int,
 }
 
-impl Foo {
+pub impl Foo {
     fn f(&self) {}
     fn g(&const self) {}
     fn h(&mut self) {}
diff --git a/src/test/compile-fail/borrowck-insert-during-each.rs b/src/test/compile-fail/borrowck-insert-during-each.rs
index e0fca586b6b..476a790b85e 100644
--- a/src/test/compile-fail/borrowck-insert-during-each.rs
+++ b/src/test/compile-fail/borrowck-insert-during-each.rs
@@ -14,7 +14,7 @@ struct Foo {
   n: LinearSet<int>,
 }
 
-impl Foo {
+pub impl Foo {
   fn foo(&mut self, fun: fn(&int)) {
     for self.n.each |f| {
       fun(f);
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 e15edd8cf19..61cf346ffa4 100644
--- a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
+++ b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
@@ -19,7 +19,7 @@ impl ops::Add<int,int> for Point {
     }
 }
 
-impl Point {
+pub impl Point {
     fn times(z: int) -> int {
         self.x * self.y * z
     }
diff --git a/src/test/compile-fail/class-cast-to-trait.rs b/src/test/compile-fail/class-cast-to-trait.rs
index 671298040a9..092fb4a5b66 100644
--- a/src/test/compile-fail/class-cast-to-trait.rs
+++ b/src/test/compile-fail/class-cast-to-trait.rs
@@ -19,7 +19,7 @@ struct cat {
   name : ~str,
 }
 
-impl cat {
+pub impl cat {
 
   fn eat() -> bool {
     if self.how_hungry > 0 {
@@ -58,6 +58,6 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
 }
 
 fn main() {
-  let nyan : noisy  = cat(0, 2, ~"nyan") as noisy;
+  let nyan : noisy  = @cat(0, 2, ~"nyan") as @noisy;
   nyan.eat(); //~ ERROR type `@noisy` does not implement any method in scope named `eat`
 }
diff --git a/src/test/compile-fail/issue-2356.rs b/src/test/compile-fail/issue-2356.rs
index 30a9fadaeb0..9a574b984ca 100644
--- a/src/test/compile-fail/issue-2356.rs
+++ b/src/test/compile-fail/issue-2356.rs
@@ -14,6 +14,6 @@ struct cat {
   tail: int,
 }
 
-impl cat {
+pub impl cat {
   fn meow() { tail += 1; } //~ ERROR: Did you mean: `self.tail`
 }
diff --git a/src/test/compile-fail/issue-2766-a.rs b/src/test/compile-fail/issue-2766-a.rs
index 77a840e7e36..8ec63ddc634 100644
--- a/src/test/compile-fail/issue-2766-a.rs
+++ b/src/test/compile-fail/issue-2766-a.rs
@@ -14,7 +14,7 @@ pub mod stream {
         use core::option;
         use core::pipes;
 
-        impl<T:Owned> Stream<T> {
+        pub impl<T:Owned> Stream<T> {
             pub fn recv() -> extern fn(+v: Stream<T>) -> ::stream::Stream<T> {
               // resolve really should report just one error here.
               // Change the test case when it changes.
diff --git a/src/test/compile-fail/issue-3021-b.rs b/src/test/compile-fail/issue-3021-b.rs
index 1d4cd69c54e..e6d16042445 100644
--- a/src/test/compile-fail/issue-3021-b.rs
+++ b/src/test/compile-fail/issue-3021-b.rs
@@ -16,7 +16,7 @@ fn siphash(k0 : u64) {
         v0: u64,
     }
 
-    impl siphash {
+    pub impl siphash {
         fn reset(&mut self) {
            self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR attempted dynamic environment-capture
            //~^ ERROR unresolved name: `k0`.
diff --git a/src/test/compile-fail/issue-3080.rs b/src/test/compile-fail/issue-3080.rs
index d7a214dc76b..530dadd7e90 100644
--- a/src/test/compile-fail/issue-3080.rs
+++ b/src/test/compile-fail/issue-3080.rs
@@ -10,7 +10,7 @@
 
 // xfail-test
 enum x = ();
-impl x {
+pub impl x {
     unsafe fn with() { } // This should fail
 }
 
diff --git a/src/test/compile-fail/issue-3311.rs b/src/test/compile-fail/issue-3311.rs
index a09a87d9a6b..1207ddcb9a0 100644
--- a/src/test/compile-fail/issue-3311.rs
+++ b/src/test/compile-fail/issue-3311.rs
@@ -14,7 +14,7 @@ struct Foo {
     u: ~()
 }
 
-impl Foo {
+pub impl Foo {
     fn get_s(&self) -> &self/str {
         self.s
     }
diff --git a/src/test/compile-fail/issue-3707.rs b/src/test/compile-fail/issue-3707.rs
index c166c400b36..040bd46ab8c 100644
--- a/src/test/compile-fail/issue-3707.rs
+++ b/src/test/compile-fail/issue-3707.rs
@@ -13,7 +13,7 @@ struct Obj {
     member: uint
 }
 
-impl Obj {
+pub impl Obj {
     static pure fn boom() -> bool {
         return 1+1 == 2
     }
diff --git a/src/test/compile-fail/issue-3763.rs b/src/test/compile-fail/issue-3763.rs
index ea4b70c3c29..09a3f3d89c4 100644
--- a/src/test/compile-fail/issue-3763.rs
+++ b/src/test/compile-fail/issue-3763.rs
@@ -15,7 +15,7 @@ mod my_mod {
     pub fn MyStruct () -> MyStruct {
         MyStruct {priv_field: 4}
     }
-    impl MyStruct {
+    pub impl MyStruct {
         priv fn happyfun() {}
     }
 }
diff --git a/src/test/compile-fail/issue-4366.rs b/src/test/compile-fail/issue-4366.rs
new file mode 100644
index 00000000000..d4d97c69354
--- /dev/null
+++ b/src/test/compile-fail/issue-4366.rs
@@ -0,0 +1,39 @@
+// 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.
+
+// regression test for issue 4366
+
+// ensures that 'use foo:*' doesn't import non-public 'use' statements in the
+// module 'foo'
+
+mod foo {
+    pub fn foo() {}
+}
+mod a {
+    pub mod b {
+        use foo::foo;
+        type bar = int;
+    }
+    pub mod sub {
+        use a::b::*;
+        fn sub() -> bar { foo(); 1 } //~ ERROR: unresolved name: `foo`
+        //~^ ERROR: use of undeclared type name `bar`
+    }
+}
+
+mod m1 {
+    fn foo() {}
+}
+use m1::*;
+
+fn main() {
+    foo(); //~ ERROR: unresolved name: `foo`
+}
+
diff --git a/src/test/compile-fail/kindck-owned-trait-contains.rs b/src/test/compile-fail/kindck-owned-trait-contains.rs
index 2864e27f42f..f369e765d69 100644
--- a/src/test/compile-fail/kindck-owned-trait-contains.rs
+++ b/src/test/compile-fail/kindck-owned-trait-contains.rs
@@ -16,7 +16,7 @@ impl<A:Copy> repeat<A> for @A {
 
 fn repeater<A:Copy>(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
 }
 
 fn main() {
diff --git a/src/test/compile-fail/kindck-owned-trait-scoped.rs b/src/test/compile-fail/kindck-owned-trait-scoped.rs
index f11703ecf02..2e0f2774861 100644
--- a/src/test/compile-fail/kindck-owned-trait-scoped.rs
+++ b/src/test/compile-fail/kindck-owned-trait-scoped.rs
@@ -26,7 +26,7 @@ fn to_foo<T:Copy>(t: T) {
     // the fn body itself.
     let v = &3;
     struct F<T> { f: T }
-    let x = F {f:t} as foo;
+    let x = @F {f:t} as foo;
     assert x.foo(v) == 3;
 }
 
@@ -34,14 +34,14 @@ fn to_foo_2<T:Copy>(t: T) -> foo {
     // Not OK---T may contain borrowed ptrs and it is going to escape
     // as part of the returned foo value
     struct F<T> { f: T }
-    F {f:t} as foo //~ ERROR value may contain borrowed pointers; use `&static` bound
+    @F {f:t} as foo //~ ERROR value may contain borrowed pointers; use `&static` bound
 }
 
 fn to_foo_3<T:Copy + &static>(t: T) -> foo {
     // OK---T may escape as part of the returned foo value, but it is
     // owned and hence does not contain borrowed ptrs
     struct F<T> { f: T }
-    F {f:t} as foo
+    @F {f:t} as foo
 }
 
 fn main() {
diff --git a/src/test/compile-fail/kindck-owned-trait.rs b/src/test/compile-fail/kindck-owned-trait.rs
index 2bc6a911204..30f6a5f9b2d 100644
--- a/src/test/compile-fail/kindck-owned-trait.rs
+++ b/src/test/compile-fail/kindck-owned-trait.rs
@@ -11,11 +11,11 @@
 trait foo { fn foo(); }
 
 fn to_foo<T:Copy + foo>(t: T) -> foo {
-    t as foo //~ ERROR value may contain borrowed pointers; use `&static` bound
+    @t as @foo //~ ERROR value may contain borrowed pointers; use `&static` bound
 }
 
 fn to_foo2<T:Copy + foo + &static>(t: T) -> foo {
-    t as foo
+    @t as @foo
 }
 
 fn main() {}
diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs
index f829c730637..8512e8d13dc 100644
--- a/src/test/compile-fail/map-types.rs
+++ b/src/test/compile-fail/map-types.rs
@@ -14,8 +14,8 @@ use core::hashmap::linear::LinearMap;
 // Test that trait types printed in error msgs include the type arguments.
 
 fn main() {
-    let x: Map<~str, ~str> = LinearMap::new::<~str, ~str>() as
+    let x: @Map<~str, ~str> = @LinearMap::new::<~str, ~str>() as
         Map::<~str, ~str>;
-    let y: Map<uint, ~str> = x;
+    let y: @Map<uint, ~str> = @x;
     //~^ ERROR mismatched types: expected `@core::container::Map/&<uint,~str>`
 }
diff --git a/src/test/compile-fail/mutable-class-fields-2.rs b/src/test/compile-fail/mutable-class-fields-2.rs
index 04ba25fc07d..3a63cdee20c 100644
--- a/src/test/compile-fail/mutable-class-fields-2.rs
+++ b/src/test/compile-fail/mutable-class-fields-2.rs
@@ -15,7 +15,7 @@ struct cat {
   how_hungry : int,
 }
 
-impl cat {
+pub impl cat {
   fn eat() {
     self.how_hungry -= 5;
   }
diff --git a/src/test/compile-fail/private-method-cross-crate.rs b/src/test/compile-fail/private-method-cross-crate.rs
index 7897ccb23e6..7414dc57216 100644
--- a/src/test/compile-fail/private-method-cross-crate.rs
+++ b/src/test/compile-fail/private-method-cross-crate.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:attempted access of field `nap` on type
-// xfail-test Cross-crate impl method privacy doesn't work
 // xfail-fast
 // aux-build:cci_class_5.rs
 extern mod cci_class_5;
@@ -17,5 +15,5 @@ use cci_class_5::kitties::*;
 
 fn main() {
   let nyan : cat = cat(52, 99);
-  nyan.nap();
+  nyan.nap();   //~ ERROR method `nap` is private
 }
diff --git a/src/test/compile-fail/private-method-inherited.rs b/src/test/compile-fail/private-method-inherited.rs
new file mode 100644
index 00000000000..7b64623e16c
--- /dev/null
+++ b/src/test/compile-fail/private-method-inherited.rs
@@ -0,0 +1,15 @@
+// Tests that inherited visibility applies to methods.
+
+mod a {
+    pub struct Foo;
+
+    impl Foo {
+        fn f(self) {}
+    }
+}
+
+fn main() {
+    let x = a::Foo;
+    x.f();  //~ ERROR method `f` is private
+}
+
diff --git a/src/test/compile-fail/regions-addr-of-self.rs b/src/test/compile-fail/regions-addr-of-self.rs
index c6c89a3ae04..96657edb5b1 100644
--- a/src/test/compile-fail/regions-addr-of-self.rs
+++ b/src/test/compile-fail/regions-addr-of-self.rs
@@ -12,7 +12,7 @@ struct dog {
     cats_chased: uint,
 }
 
-impl dog {
+pub impl dog {
     fn chase_cat(&mut self) {
         let p: &static/mut uint = &mut self.cats_chased; //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements
         *p += 1u;
diff --git a/src/test/compile-fail/regions-addr-of-upvar-self.rs b/src/test/compile-fail/regions-addr-of-upvar-self.rs
index 8e98d4341a8..b9a9e2f38f5 100644
--- a/src/test/compile-fail/regions-addr-of-upvar-self.rs
+++ b/src/test/compile-fail/regions-addr-of-upvar-self.rs
@@ -12,7 +12,7 @@ struct dog {
     food: uint,
 }
 
-impl dog {
+pub impl dog {
     fn chase_cat(&mut self) {
         for uint::range(0u, 10u) |_i| {
             let p: &'static mut uint = &mut self.food; //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements
diff --git a/src/test/compile-fail/regions-trait-1.rs b/src/test/compile-fail/regions-trait-1.rs
index 4a78fdf9714..811d7c452e3 100644
--- a/src/test/compile-fail/regions-trait-1.rs
+++ b/src/test/compile-fail/regions-trait-1.rs
@@ -34,5 +34,5 @@ fn get_v(gc: get_ctxt) -> uint {
 fn main() {
     let ctxt = ctxt { v: 22u };
     let hc = has_ctxt { c: &ctxt };
-    assert get_v(hc as get_ctxt) == 22u;
+    assert get_v(@hc as get_ctxt) == 22u;
 }
diff --git a/src/test/compile-fail/regions-trait-2.rs b/src/test/compile-fail/regions-trait-2.rs
index 2cb1f9deb49..c5978e55fb3 100644
--- a/src/test/compile-fail/regions-trait-2.rs
+++ b/src/test/compile-fail/regions-trait-2.rs
@@ -23,7 +23,7 @@ impl get_ctxt for has_ctxt {
 fn make_gc() -> get_ctxt  {
     let ctxt = ctxt { v: 22u };
     let hc = has_ctxt { c: &ctxt }; //~ ERROR illegal borrow
-    return hc as get_ctxt;
+    return @hc as get_ctxt;
 }
 
 fn main() {
diff --git a/src/test/compile-fail/regions-trait-3.rs b/src/test/compile-fail/regions-trait-3.rs
index d62d6cace3e..0ddaf25710c 100644
--- a/src/test/compile-fail/regions-trait-3.rs
+++ b/src/test/compile-fail/regions-trait-3.rs
@@ -17,7 +17,7 @@ fn make_gc1(gc: get_ctxt/&a) -> get_ctxt/&b  {
 }
 
 fn make_gc2(gc: get_ctxt/&a) -> get_ctxt/&b  {
-    return gc as get_ctxt; //~ ERROR cannot infer an appropriate lifetime
+    return @gc as get_ctxt; //~ ERROR cannot infer an appropriate lifetime
 }
 
 fn main() {
diff --git a/src/test/compile-fail/selftype-astparam.rs b/src/test/compile-fail/selftype-astparam.rs
index c89d1d2795b..08b6c0f71fe 100644
--- a/src/test/compile-fail/selftype-astparam.rs
+++ b/src/test/compile-fail/selftype-astparam.rs
@@ -19,7 +19,7 @@ impl add for int {
 fn do_add<A:add>(x: A, y: A) -> A { x.plus(y) }
 
 fn main() {
-    let x = 3 as add;
-    let y = 4 as add;
+    let x = @3 as @add;
+    let y = @4 as @add;
     do_add(x, y); //~ ERROR a boxed trait with self types may not be passed as a bounded type
 }
diff --git a/src/test/compile-fail/tps-invariant-trait.rs b/src/test/compile-fail/tps-invariant-trait.rs
index 60da6d2208a..94bcea8f1d3 100644
--- a/src/test/compile-fail/tps-invariant-trait.rs
+++ b/src/test/compile-fail/tps-invariant-trait.rs
@@ -34,7 +34,7 @@ fn set_box_impl<T>(b: box_impl<@const T>, v: @const T) {
 
 fn main() {
     let b = box_impl::<@int>(box::<@int> {f: @3});
-    set_box_trait(b as box_trait::<@int>, @mut 5);
+    set_box_trait(@b as box_trait::<@int>, @mut 5);
     //~^ ERROR values differ in mutability
     set_box_impl(b, @mut 5);
     //~^ ERROR values differ in mutability
diff --git a/src/test/compile-fail/trait-cast.rs b/src/test/compile-fail/trait-cast.rs
index 7b2fc2165b4..d0738be09c7 100644
--- a/src/test/compile-fail/trait-cast.rs
+++ b/src/test/compile-fail/trait-cast.rs
@@ -11,7 +11,7 @@
 trait foo<T> { }
 
 fn bar(x: foo<uint>) -> foo<int> {
-    return (x as foo::<int>);
+    return (@x as foo::<int>);
     //~^ ERROR mismatched types: expected `@foo<int>` but found `@foo<uint>`
     //~^^ ERROR mismatched types: expected `@foo<int>` but found `@foo<uint>`
     // This is unfortunate -- new handling of parens means the error message
diff --git a/src/test/compile-fail/trait-or-new-type-instead.rs b/src/test/compile-fail/trait-or-new-type-instead.rs
index 0634205140b..dc7c7cec65f 100644
--- a/src/test/compile-fail/trait-or-new-type-instead.rs
+++ b/src/test/compile-fail/trait-or-new-type-instead.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // error-pattern: implement a trait or new type instead
-impl <T> Option<T> {
+pub impl <T> Option<T> {
     fn foo() { }
 }
 
diff --git a/src/test/compile-fail/trait-test-2.rs b/src/test/compile-fail/trait-test-2.rs
index 73b7c4369ac..a00e63b60d7 100644
--- a/src/test/compile-fail/trait-test-2.rs
+++ b/src/test/compile-fail/trait-test-2.rs
@@ -15,5 +15,5 @@ impl bar for uint { fn dup() -> uint { self } fn blah<X>() {} }
 fn main() {
     10i.dup::<int>(); //~ ERROR does not take type parameters
     10i.blah::<int, int>(); //~ ERROR incorrect number of type parameters
-    (10 as bar).dup(); //~ ERROR contains a self-type
+    (@10 as bar).dup(); //~ ERROR contains a self-type
 }
diff --git a/src/test/compile-fail/use-after-move-self-based-on-type.rs b/src/test/compile-fail/use-after-move-self-based-on-type.rs
index a06bc42d29a..b0a2bc8ec12 100644
--- a/src/test/compile-fail/use-after-move-self-based-on-type.rs
+++ b/src/test/compile-fail/use-after-move-self-based-on-type.rs
@@ -6,7 +6,7 @@ impl Drop for S {
     fn finalize(&self) {}
 }
 
-impl S {
+pub impl S {
     fn foo(self) -> int {
         self.bar();
         return self.x;  //~ ERROR use of moved value
diff --git a/src/test/compile-fail/use-after-move-self.rs b/src/test/compile-fail/use-after-move-self.rs
index 7ad41b518a1..3eded9fd4f3 100644
--- a/src/test/compile-fail/use-after-move-self.rs
+++ b/src/test/compile-fail/use-after-move-self.rs
@@ -2,7 +2,7 @@ struct S {
     x: ~int
 }
 
-impl S {
+pub impl S {
     fn foo(self) -> int {
         self.bar();
         return *self.x;  //~ ERROR use of moved value
diff --git a/src/test/pretty/record-trailing-comma.rs b/src/test/pretty/record-trailing-comma.rs
index ace5da8eb4e..f026f217b99 100644
--- a/src/test/pretty/record-trailing-comma.rs
+++ b/src/test/pretty/record-trailing-comma.rs
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// NOTE this is a pretty-printer bug that I fixed, but it's
-// not in the snapshot yet. After a new snapshot, can un-xfail
-// xfail-pretty
+// xfail-test
 // pp-exact
 struct Thing {
     x: int,
diff --git a/src/test/run-fail/unwind-box-trait.rs b/src/test/run-fail/unwind-box-trait.rs
index b17fc467f0b..905670f8fb7 100644
--- a/src/test/run-fail/unwind-box-trait.rs
+++ b/src/test/run-fail/unwind-box-trait.rs
@@ -23,7 +23,7 @@ impl i for ~int {
 }
 
 fn main() {
-    let x = ~0 as i;
+    let x = @~0 as @i;
     failfn();
     log(error, x);
 }
diff --git a/src/test/run-pass/anon-trait-static-method.rs b/src/test/run-pass/anon-trait-static-method.rs
index 4143c12cf67..2ec0b59e13f 100644
--- a/src/test/run-pass/anon-trait-static-method.rs
+++ b/src/test/run-pass/anon-trait-static-method.rs
@@ -12,7 +12,7 @@ struct Foo {
     x: int
 }
 
-impl Foo {
+pub impl Foo {
     static fn new() -> Foo {
         Foo { x: 3 }
     }
diff --git a/src/test/run-pass/auto-ref-newtype.rs b/src/test/run-pass/auto-ref-newtype.rs
index 80f20b13bdd..1b4c22e80f3 100644
--- a/src/test/run-pass/auto-ref-newtype.rs
+++ b/src/test/run-pass/auto-ref-newtype.rs
@@ -13,7 +13,7 @@
 
 enum Foo = uint;
 
-impl Foo {
+pub impl Foo {
     fn len(&self) -> uint { **self }
 }
 
diff --git a/src/test/run-pass/autoderef-and-borrow-method-receiver.rs b/src/test/run-pass/autoderef-and-borrow-method-receiver.rs
index 6e6d289e90f..883cffa792b 100644
--- a/src/test/run-pass/autoderef-and-borrow-method-receiver.rs
+++ b/src/test/run-pass/autoderef-and-borrow-method-receiver.rs
@@ -12,7 +12,7 @@ struct Foo {
     x: int,
 }
 
-impl Foo {
+pub impl Foo {
     fn f(&const self) {}
 }
 
diff --git a/src/test/run-pass/autoderef-method-on-trait-monomorphized.rs b/src/test/run-pass/autoderef-method-on-trait-monomorphized.rs
index b44d1cbb78d..bfde19993e9 100644
--- a/src/test/run-pass/autoderef-method-on-trait-monomorphized.rs
+++ b/src/test/run-pass/autoderef-method-on-trait-monomorphized.rs
@@ -21,6 +21,6 @@ fn is_equal<D:double>(x: @D, exp: uint) {
 }
 
 pub fn main() {
-    let x = @(3u as double);
+    let x = @(@3u as @double);
     is_equal(x, 6);
 }
diff --git a/src/test/run-pass/autoderef-method-on-trait.rs b/src/test/run-pass/autoderef-method-on-trait.rs
index 3653c0eb9c9..65a274d7764 100644
--- a/src/test/run-pass/autoderef-method-on-trait.rs
+++ b/src/test/run-pass/autoderef-method-on-trait.rs
@@ -17,6 +17,6 @@ impl double for uint {
 }
 
 pub fn main() {
-    let x = @(3u as double);
+    let x = @(@3u as @double);
     assert x.double() == 6u;
 }
diff --git a/src/test/run-pass/borrowck-wg-borrow-mut-to-imm-3.rs b/src/test/run-pass/borrowck-wg-borrow-mut-to-imm-3.rs
index 748672ef050..d8612155f6c 100644
--- a/src/test/run-pass/borrowck-wg-borrow-mut-to-imm-3.rs
+++ b/src/test/run-pass/borrowck-wg-borrow-mut-to-imm-3.rs
@@ -2,7 +2,7 @@ struct Wizard {
     spells: ~[&static/str]
 }
 
-impl Wizard {
+pub impl Wizard {
     fn cast(&mut self) {
         for self.spells.each |&spell| {
             io::println(spell);
diff --git a/src/test/run-pass/boxed-trait-with-vstore.rs b/src/test/run-pass/boxed-trait-with-vstore.rs
index 50e137d6fd5..1d2c30108f1 100644
--- a/src/test/run-pass/boxed-trait-with-vstore.rs
+++ b/src/test/run-pass/boxed-trait-with-vstore.rs
@@ -19,7 +19,7 @@ impl Foo for int {
 }
 
 pub fn main() {
-    let x = 3 as @Foo;
+    let x = @3 as @Foo;
     x.foo();
 }
 
diff --git a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs
index f81b12b555e..1db3d4b38d7 100644
--- a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs
+++ b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs
@@ -21,7 +21,7 @@ fn print_out<T:ToStr>(thing: T, expected: ~str) {
 }
 
 pub fn main() {
-  let nyan : ToStr  = cat(0u, 2, ~"nyan") as ToStr;
+  let nyan : @ToStr = @cat(0u, 2, ~"nyan") as @ToStr;
   print_out(nyan, ~"nyan");
 }
 
diff --git a/src/test/run-pass/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/class-cast-to-trait-multiple-types.rs
index f35a91c2b91..5cf68174075 100644
--- a/src/test/run-pass/class-cast-to-trait-multiple-types.rs
+++ b/src/test/run-pass/class-cast-to-trait-multiple-types.rs
@@ -18,7 +18,7 @@ struct dog {
   volume : @mut int,
 }
 
-impl dog {
+pub impl dog {
     priv fn bark() -> int {
       debug!("Woof %u %d", *self.barks, *self.volume);
       *self.barks += 1u;
@@ -55,7 +55,7 @@ impl noisy for cat {
   fn speak() -> int { self.meow() as int }
 }
 
-impl cat {
+pub impl cat {
   fn meow_count() -> uint { *self.meows }
 }
 
@@ -86,8 +86,8 @@ fn annoy_neighbors<T:noisy>(critter: T) {
 pub fn main() {
   let nyan : cat  = cat(0u, 2, ~"nyan");
   let whitefang : dog = dog();
-  annoy_neighbors((copy nyan) as noisy);
-  annoy_neighbors((copy whitefang) as noisy);
+  annoy_neighbors(@(copy nyan) as @noisy);
+  annoy_neighbors(@(copy whitefang) as @noisy);
   assert(nyan.meow_count() == 10u);
   assert(*whitefang.volume == 1);
 }
diff --git a/src/test/run-pass/class-cast-to-trait.rs b/src/test/run-pass/class-cast-to-trait.rs
index 157ea586c2c..a15afa60c75 100644
--- a/src/test/run-pass/class-cast-to-trait.rs
+++ b/src/test/run-pass/class-cast-to-trait.rs
@@ -22,7 +22,7 @@ impl noisy for cat {
   fn speak(&mut self) { self.meow(); }
 }
 
-impl cat {
+pub impl cat {
   fn eat(&mut self) -> bool {
     if self.how_hungry > 0 {
         error!("OM NOM NOM");
@@ -56,6 +56,6 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
 
 
 pub fn main() {
-  let mut nyan: noisy = cat(0u, 2, ~"nyan") as noisy;
+  let mut nyan: @noisy = @cat(0u, 2, ~"nyan") as @noisy;
   nyan.speak();
 }
diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs
index 40f728d40bf..f71675c06be 100644
--- a/src/test/run-pass/class-impl-very-parameterized-trait.rs
+++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs
@@ -34,7 +34,7 @@ struct cat<T> {
     name : T,
 }
 
-impl<T> cat<T> {
+pub impl<T> cat<T> {
     fn speak(&mut self) { self.meow(); }
 
     fn eat(&mut self) -> bool {
@@ -103,7 +103,7 @@ impl<T> Map<int, T> for cat<T> {
     }
 }
 
-impl<T> cat<T> {
+pub impl<T> cat<T> {
     pure fn get(&self, k: &int) -> &self/T {
         match self.find(k) {
           Some(v) => { v }
diff --git a/src/test/run-pass/class-implement-trait-cross-crate.rs b/src/test/run-pass/class-implement-trait-cross-crate.rs
index aa7bb738bf5..aa77dbb62c0 100644
--- a/src/test/run-pass/class-implement-trait-cross-crate.rs
+++ b/src/test/run-pass/class-implement-trait-cross-crate.rs
@@ -20,7 +20,7 @@ struct cat {
   name : ~str,
 }
 
-impl cat {
+pub impl cat {
     fn eat(&mut self) -> bool {
         if self.how_hungry > 0 {
             error!("OM NOM NOM");
diff --git a/src/test/run-pass/class-implement-traits.rs b/src/test/run-pass/class-implement-traits.rs
index bdc8f7568a1..896b139110f 100644
--- a/src/test/run-pass/class-implement-traits.rs
+++ b/src/test/run-pass/class-implement-traits.rs
@@ -32,7 +32,7 @@ priv impl cat {
     }
 }
 
-impl cat {
+pub impl cat {
     fn eat(&mut self) -> bool {
         if self.how_hungry > 0 {
             error!("OM NOM NOM");
diff --git a/src/test/run-pass/class-methods.rs b/src/test/run-pass/class-methods.rs
index 1e41b60a822..f65bcf7be8e 100644
--- a/src/test/run-pass/class-methods.rs
+++ b/src/test/run-pass/class-methods.rs
@@ -14,7 +14,7 @@ struct cat {
   how_hungry : int,
 }
 
-impl cat {
+pub impl cat {
     fn speak(&mut self) { self.meows += 1u; }
     fn meow_count(&mut self) -> uint { self.meows }
 }
diff --git a/src/test/run-pass/class-poly-methods.rs b/src/test/run-pass/class-poly-methods.rs
index e81d07a783b..654260d8399 100644
--- a/src/test/run-pass/class-poly-methods.rs
+++ b/src/test/run-pass/class-poly-methods.rs
@@ -15,7 +15,7 @@ struct cat<U> {
     how_hungry : int,
 }
 
-impl<U> cat<U> {
+pub impl<U> cat<U> {
     fn speak<T>(&mut self, stuff: ~[T]) {
         self.meows += stuff.len();
     }
diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs
index 9c7d9ce7415..b232be32550 100644
--- a/src/test/run-pass/class-separate-impl.rs
+++ b/src/test/run-pass/class-separate-impl.rs
@@ -18,7 +18,7 @@ struct cat {
     name : ~str,
 }
 
-impl cat {
+pub impl cat {
     fn speak(&mut self) { self.meow(); }
 
     fn eat(&mut self) -> bool {
@@ -63,6 +63,6 @@ fn print_out<T:ToStr>(thing: T, expected: ~str) {
 }
 
 pub fn main() {
-  let mut nyan : ToStr = cat(0u, 2, ~"nyan") as ToStr;
+  let mut nyan : @ToStr = @cat(0u, 2, ~"nyan") as @ToStr;
   print_out(nyan, ~"nyan");
 }
diff --git a/src/test/run-pass/class-typarams.rs b/src/test/run-pass/class-typarams.rs
index cbc69719caa..29354c54d8b 100644
--- a/src/test/run-pass/class-typarams.rs
+++ b/src/test/run-pass/class-typarams.rs
@@ -14,7 +14,7 @@ struct cat<U> {
     how_hungry : int,
 }
 
-impl<U> cat<U> {
+pub impl<U> cat<U> {
     fn speak(&mut self) { self.meows += 1u; }
     fn meow_count(&mut self) -> uint { self.meows }
 }
diff --git a/src/test/run-pass/classes-simple-method.rs b/src/test/run-pass/classes-simple-method.rs
index ac80ca9b9e9..505537af7a1 100644
--- a/src/test/run-pass/classes-simple-method.rs
+++ b/src/test/run-pass/classes-simple-method.rs
@@ -14,7 +14,7 @@ struct cat {
     how_hungry : int,
 }
 
-impl cat {
+pub impl cat {
   fn speak(&mut self) {}
 }
 
diff --git a/src/test/run-pass/classes.rs b/src/test/run-pass/classes.rs
index 552715dccb4..0d8d7fc37a9 100644
--- a/src/test/run-pass/classes.rs
+++ b/src/test/run-pass/classes.rs
@@ -15,7 +15,7 @@ struct cat {
     name : ~str,
 }
 
-impl cat {
+pub impl cat {
     fn speak(&mut self) { self.meow(); }
 
     fn eat(&mut self) -> bool {
diff --git a/src/test/run-pass/coerce-reborrow-imm-ptr-rcvr.rs b/src/test/run-pass/coerce-reborrow-imm-ptr-rcvr.rs
index 268e540c10e..35f963d8fb9 100644
--- a/src/test/run-pass/coerce-reborrow-imm-ptr-rcvr.rs
+++ b/src/test/run-pass/coerce-reborrow-imm-ptr-rcvr.rs
@@ -2,7 +2,7 @@ struct SpeechMaker {
     speeches: uint
 }
 
-impl SpeechMaker {
+pub impl SpeechMaker {
     pure fn how_many(&self) -> uint { self.speeches }
 }
 
diff --git a/src/test/run-pass/coerce-reborrow-mut-ptr-rcvr.rs b/src/test/run-pass/coerce-reborrow-mut-ptr-rcvr.rs
index a2ba4ddb827..fd47c262d6a 100644
--- a/src/test/run-pass/coerce-reborrow-mut-ptr-rcvr.rs
+++ b/src/test/run-pass/coerce-reborrow-mut-ptr-rcvr.rs
@@ -2,7 +2,7 @@ struct SpeechMaker {
     speeches: uint
 }
 
-impl SpeechMaker {
+pub impl SpeechMaker {
     fn talk(&mut self) {
         self.speeches += 1;
     }
diff --git a/src/test/run-pass/const-enum-byref-self.rs b/src/test/run-pass/const-enum-byref-self.rs
index 19311cb1732..57cfdd2f9d4 100644
--- a/src/test/run-pass/const-enum-byref-self.rs
+++ b/src/test/run-pass/const-enum-byref-self.rs
@@ -11,7 +11,7 @@
 enum E { V, VV(int) }
 const C: E = V;
 
-impl E {
+pub impl E {
     fn method(&self) {
         match *self {
             V => {}
diff --git a/src/test/run-pass/explicit-self-closures.rs b/src/test/run-pass/explicit-self-closures.rs
index d40b2f72ae8..e019140d1a0 100644
--- a/src/test/run-pass/explicit-self-closures.rs
+++ b/src/test/run-pass/explicit-self-closures.rs
@@ -14,7 +14,7 @@ struct Box {
     x: uint
 }
 
-impl Box {
+pub impl Box {
     fn set_many(&mut self, xs: &[uint]) {
         for xs.each |x| { self.x = *x; }
     }
diff --git a/src/test/run-pass/explicit-self-generic.rs b/src/test/run-pass/explicit-self-generic.rs
index d03893367b4..5df155e4ad3 100644
--- a/src/test/run-pass/explicit-self-generic.rs
+++ b/src/test/run-pass/explicit-self-generic.rs
@@ -30,7 +30,7 @@ fn linear_map<K,V>() -> LinearMap<K,V> {
         size: 0})
 }
 
-impl<K,V> LinearMap<K,V> {
+pub impl<K,V> LinearMap<K,V> {
     fn len(&mut self) -> uint {
         self.size
     }
diff --git a/src/test/run-pass/explicit-self-objects-ext-1.rs b/src/test/run-pass/explicit-self-objects-ext-1.rs
index e226423f848..92f745d7d53 100644
--- a/src/test/run-pass/explicit-self-objects-ext-1.rs
+++ b/src/test/run-pass/explicit-self-objects-ext-1.rs
@@ -34,6 +34,6 @@ impl Reader for S {
 
 pub fn main() {
     let x = S { x: 1, y: 2 };
-    let x = x as @Reader;
+    let x = @x as @Reader;
     x.read_bytes(0);
 }
diff --git a/src/test/run-pass/explicit-self-objects-ext-2.rs b/src/test/run-pass/explicit-self-objects-ext-2.rs
index e226423f848..92f745d7d53 100644
--- a/src/test/run-pass/explicit-self-objects-ext-2.rs
+++ b/src/test/run-pass/explicit-self-objects-ext-2.rs
@@ -34,6 +34,6 @@ impl Reader for S {
 
 pub fn main() {
     let x = S { x: 1, y: 2 };
-    let x = x as @Reader;
+    let x = @x as @Reader;
     x.read_bytes(0);
 }
diff --git a/src/test/run-pass/explicit-self-objects-ext-3.rs b/src/test/run-pass/explicit-self-objects-ext-3.rs
index 1a18ee7c6f7..2cfd327dc4e 100644
--- a/src/test/run-pass/explicit-self-objects-ext-3.rs
+++ b/src/test/run-pass/explicit-self-objects-ext-3.rs
@@ -34,6 +34,6 @@ impl Reader for S {
 
 pub fn main() {
     let x = S { x: 1, y: 2 };
-    let x = x as @Reader;
+    let x = @x as @Reader;
     x.read_bytes(0);
 }
diff --git a/src/test/run-pass/explicit-self-objects-ext-4.rs b/src/test/run-pass/explicit-self-objects-ext-4.rs
index a5d934d9984..3945be77904 100644
--- a/src/test/run-pass/explicit-self-objects-ext-4.rs
+++ b/src/test/run-pass/explicit-self-objects-ext-4.rs
@@ -34,6 +34,6 @@ impl Reader for S {
 
 pub fn main() {
     let x = S { x: 1, y: 2 };
-    let x = x as @Reader;
+    let x = @x as @Reader;
     x.read_bytes(0);
 }
diff --git a/src/test/run-pass/explicit-self.rs b/src/test/run-pass/explicit-self.rs
index 26e2023e89c..885eb9837a7 100644
--- a/src/test/run-pass/explicit-self.rs
+++ b/src/test/run-pass/explicit-self.rs
@@ -26,7 +26,7 @@ fn compute_area(shape: &shape) -> float {
     }
 }
 
-impl shape {
+pub impl shape {
     // self is in the implicit self region
     fn select<T>(&self, threshold: float,
                  a: &r/T, b: &r/T) -> &r/T {
@@ -54,7 +54,7 @@ fn thing(x: A) -> thing {
     }
 }
 
-impl thing {
+pub impl thing {
     fn foo(@self) -> int { *self.x.a }
     fn bar(~self) -> int { *self.x.a }
     fn quux(&self) -> int { *self.x.a }
diff --git a/src/test/run-pass/impl-implicit-trait.rs b/src/test/run-pass/impl-implicit-trait.rs
index 511529bbc8f..88e220670ba 100644
--- a/src/test/run-pass/impl-implicit-trait.rs
+++ b/src/test/run-pass/impl-implicit-trait.rs
@@ -13,7 +13,7 @@ enum option_<T> {
     some_(T),
 }
 
-impl<T> option_<T> {
+pub impl<T> option_<T> {
     fn foo() -> bool { true }
 }
 
@@ -22,7 +22,7 @@ enum option__ {
     some__(int)
 }
 
-impl option__ {
+pub impl option__ {
     fn foo() -> bool { true }
 }
 
diff --git a/src/test/run-pass/issue-2288.rs b/src/test/run-pass/issue-2288.rs
index 375259baaf5..85ed524118b 100644
--- a/src/test/run-pass/issue-2288.rs
+++ b/src/test/run-pass/issue-2288.rs
@@ -33,6 +33,6 @@ fn f<A:Copy>(x: clam<A>, a: A) {
 pub fn main() {
 
   let c = foo(42);
-  let d: clam<int> = c as clam::<int>;
+  let d: clam<int> = @c as clam::<int>;
   f(d, c.x);
 }
diff --git a/src/test/run-pass/issue-2311-2.rs b/src/test/run-pass/issue-2311-2.rs
index b4141b47b4d..f60db84eb86 100644
--- a/src/test/run-pass/issue-2311-2.rs
+++ b/src/test/run-pass/issue-2311-2.rs
@@ -13,7 +13,7 @@ struct foo<A> {
     x: A,
 }
 
-impl<A:Copy> foo<A> {
+pub impl<A:Copy> foo<A> {
    fn bar<B,C:clam<A>>(c: C) -> B {
      fail!();
    }
diff --git a/src/test/run-pass/issue-2312.rs b/src/test/run-pass/issue-2312.rs
index 12e9157ba24..9e45a6b53c2 100644
--- a/src/test/run-pass/issue-2312.rs
+++ b/src/test/run-pass/issue-2312.rs
@@ -14,7 +14,7 @@ trait clam<A> { }
 
 enum foo = int;
 
-impl foo {
+pub impl foo {
     fn bar<B,C:clam<B>>(c: C) -> B { fail!(); }
 }
 
diff --git a/src/test/run-pass/issue-2445-b.rs b/src/test/run-pass/issue-2445-b.rs
index 9869b8d330b..73bf97ad7af 100644
--- a/src/test/run-pass/issue-2445-b.rs
+++ b/src/test/run-pass/issue-2445-b.rs
@@ -12,7 +12,7 @@ struct c1<T> {
     x: T,
 }
 
-impl<T:Copy> c1<T> {
+pub impl<T:Copy> c1<T> {
     fn f1(x: int) {
     }
 }
@@ -23,7 +23,7 @@ fn c1<T:Copy>(x: T) -> c1<T> {
     }
 }
 
-impl<T:Copy> c1<T> {
+pub impl<T:Copy> c1<T> {
     fn f2(x: int) {
     }
 }
diff --git a/src/test/run-pass/issue-2445.rs b/src/test/run-pass/issue-2445.rs
index 4a085a1eb8a..973b8d85161 100644
--- a/src/test/run-pass/issue-2445.rs
+++ b/src/test/run-pass/issue-2445.rs
@@ -12,7 +12,7 @@ struct c1<T> {
     x: T,
 }
 
-impl<T:Copy> c1<T> {
+pub impl<T:Copy> c1<T> {
     fn f1(x: T) {}
 }
 
@@ -22,7 +22,7 @@ fn c1<T:Copy>(x: T) -> c1<T> {
     }
 }
 
-impl<T:Copy> c1<T> {
+pub impl<T:Copy> c1<T> {
     fn f2(x: T) {}
 }
 
diff --git a/src/test/run-pass/issue-2487-a.rs b/src/test/run-pass/issue-2487-a.rs
index 198a8c900d7..33023db5323 100644
--- a/src/test/run-pass/issue-2487-a.rs
+++ b/src/test/run-pass/issue-2487-a.rs
@@ -17,7 +17,7 @@ impl Drop for socket {
     fn finalize(&self) {}
 }
 
-impl socket {
+pub impl socket {
 
     fn set_identity()  {
         do closure {
diff --git a/src/test/run-pass/issue-2502.rs b/src/test/run-pass/issue-2502.rs
index 7696ec37217..57e5aa39864 100644
--- a/src/test/run-pass/issue-2502.rs
+++ b/src/test/run-pass/issue-2502.rs
@@ -12,7 +12,7 @@ struct font {
     fontbuf: &self/~[u8],
 }
 
-impl font {
+pub impl font {
     fn buf() -> &self/~[u8] {
         self.fontbuf
     }
diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs
index 45c6b22544d..a76d2242b40 100644
--- a/src/test/run-pass/issue-2734.rs
+++ b/src/test/run-pass/issue-2734.rs
@@ -12,7 +12,7 @@ trait hax { }
 impl<A> hax for A { } 
 
 fn perform_hax<T:&static>(x: @T) -> hax {
-    x as hax 
+    @x as @hax
 }
 
 fn deadcode() {
diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs
index 7c87c6a31cd..14e27dce63d 100644
--- a/src/test/run-pass/issue-2735.rs
+++ b/src/test/run-pass/issue-2735.rs
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait hax { } 
-impl<A> hax for A { } 
+trait hax { }
+impl<A> hax for A { }
 
 fn perform_hax<T:&static>(x: @T) -> hax {
-    x as hax 
+    @x as @hax
 }
 
 fn deadcode() {
diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs
index 9106d39c592..3ed7d2f842d 100644
--- a/src/test/run-pass/issue-2904.rs
+++ b/src/test/run-pass/issue-2904.rs
@@ -60,7 +60,7 @@ fn square_from_char(c: char) -> square {
 }
 
 fn read_board_grid<rdr: &static + io::Reader>(+in: rdr) -> ~[~[square]] {
-    let in = (in) as io::Reader;
+    let in = @in as @io::Reader;
     let mut grid = ~[];
     for in.each_line |line| {
         let mut row = ~[];
diff --git a/src/test/run-pass/issue-2935.rs b/src/test/run-pass/issue-2935.rs
index 82089dd3bed..64af4de46a2 100644
--- a/src/test/run-pass/issue-2935.rs
+++ b/src/test/run-pass/issue-2935.rs
@@ -25,7 +25,7 @@ pub fn main() {
   //   let y = @({a: 4i});
   //    let z = @({a: 4i} as it);
   //    let z = @({a: true} as it);
-    let z = @(true as it);
+    let z = @(@true as it);
     //  x.f();
     // y.f();
     // (*z).f();
diff --git a/src/test/run-pass/issue-3220.rs b/src/test/run-pass/issue-3220.rs
index ef65531e554..9ecc46c17ac 100644
--- a/src/test/run-pass/issue-3220.rs
+++ b/src/test/run-pass/issue-3220.rs
@@ -19,7 +19,7 @@ fn thing() -> thing {
         x: 0
     }
 }
-impl thing { fn f(self) {} }
+pub impl thing { fn f(self) {} }
 
 pub fn main() {
     let z = thing();
diff --git a/src/test/run-pass/issue-3305.rs b/src/test/run-pass/issue-3305.rs
index b44d1cbb78d..bfde19993e9 100644
--- a/src/test/run-pass/issue-3305.rs
+++ b/src/test/run-pass/issue-3305.rs
@@ -21,6 +21,6 @@ fn is_equal<D:double>(x: @D, exp: uint) {
 }
 
 pub fn main() {
-    let x = @(3u as double);
+    let x = @(@3u as @double);
     is_equal(x, 6);
 }
diff --git a/src/test/run-pass/issue-3447.rs b/src/test/run-pass/issue-3447.rs
index 0d1b0b9d002..2f7cb998e1a 100644
--- a/src/test/run-pass/issue-3447.rs
+++ b/src/test/run-pass/issue-3447.rs
@@ -13,7 +13,7 @@ struct list<T> {
     next: Option<@mut list<T>>
 }
 
-impl<T> list<T>{
+pub impl<T> list<T>{
     fn addEnd(&mut self, element: &self/T) {
         let newList = list {
             element: element,
diff --git a/src/test/run-pass/issue-3860.rs b/src/test/run-pass/issue-3860.rs
index fdc50220014..b113e902963 100644
--- a/src/test/run-pass/issue-3860.rs
+++ b/src/test/run-pass/issue-3860.rs
@@ -10,7 +10,7 @@
 
 struct Foo { x: int }
 
-impl Foo {
+pub impl Foo {
     fn stuff(&mut self) -> &self/mut Foo {
         return self;
     }
diff --git a/src/test/run-pass/issue-3904.rs b/src/test/run-pass/issue-3904.rs
index 8f2b13b6eb0..1a09a8b860f 100644
--- a/src/test/run-pass/issue-3904.rs
+++ b/src/test/run-pass/issue-3904.rs
@@ -23,7 +23,7 @@ struct X {
     err: ErrPrinter
 }
 
-impl X {
+pub impl X {
     fn boom() {
         exit(self.err, "prog", "arg");
     }
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 351f68ab37c..0ef09d39663 100644
--- a/src/test/run-pass/kindck-owned-trait-contains-1.rs
+++ b/src/test/run-pass/kindck-owned-trait-contains-1.rs
@@ -16,7 +16,7 @@ impl<A:Copy> repeat<A> for @A {
 
 fn repeater<A:Copy>(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/max-min-classes.rs b/src/test/run-pass/max-min-classes.rs
index 762b89f5101..56c16d92874 100644
--- a/src/test/run-pass/max-min-classes.rs
+++ b/src/test/run-pass/max-min-classes.rs
@@ -17,7 +17,7 @@ struct Foo {
     y: int,
 }
 
-impl Foo {
+pub impl Foo {
     fn sum() -> int {
         self.x + self.y
     }
diff --git a/src/test/run-pass/move-self.rs b/src/test/run-pass/move-self.rs
index 37ce1bce9e6..d8464695728 100644
--- a/src/test/run-pass/move-self.rs
+++ b/src/test/run-pass/move-self.rs
@@ -2,7 +2,7 @@ struct S {
     x: ~str
 }
 
-impl S {
+pub impl S {
     fn foo(self) {
         self.bar();
     }
diff --git a/src/test/run-pass/nested-class.rs b/src/test/run-pass/nested-class.rs
index 149e346bb47..2f2930dbab7 100644
--- a/src/test/run-pass/nested-class.rs
+++ b/src/test/run-pass/nested-class.rs
@@ -14,7 +14,7 @@ pub fn main() {
     i: int,
   }
 
-  impl b {
+  pub impl b {
     fn do_stuff() -> int { return 37; }
   }
 
diff --git a/src/test/run-pass/operator-overloading-explicit-self.rs b/src/test/run-pass/operator-overloading-explicit-self.rs
index 5a3ed4c6082..b56f7fa961e 100644
--- a/src/test/run-pass/operator-overloading-explicit-self.rs
+++ b/src/test/run-pass/operator-overloading-explicit-self.rs
@@ -12,7 +12,7 @@ struct S {
     x: int
 }
 
-impl S {
+pub impl S {
     pure fn add(&self, other: &S) -> S {
         S { x: self.x + other.x }
     }
diff --git a/src/test/run-pass/pipe-select-macro.rs b/src/test/run-pass/pipe-select-macro.rs
index 368cda63394..a77e6acbb25 100644
--- a/src/test/run-pass/pipe-select-macro.rs
+++ b/src/test/run-pass/pipe-select-macro.rs
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// tjc: un-xfail after snapshot
 // xfail-test
-// xfail-pretty
 
 // Protocols
 proto! foo (
diff --git a/src/test/run-pass/private-class-field.rs b/src/test/run-pass/private-class-field.rs
index 9cb86ffe837..0abb758bd7e 100644
--- a/src/test/run-pass/private-class-field.rs
+++ b/src/test/run-pass/private-class-field.rs
@@ -14,7 +14,7 @@ struct cat {
     how_hungry : int,
 }
 
-impl cat {
+pub impl cat {
   fn meow_count(&mut self) -> uint { self.meows }
 }
 
diff --git a/src/test/run-pass/private-method.rs b/src/test/run-pass/private-method.rs
index 432c189ae42..1fab77cb5c8 100644
--- a/src/test/run-pass/private-method.rs
+++ b/src/test/run-pass/private-method.rs
@@ -14,7 +14,7 @@ struct cat {
     how_hungry : int,
 }
 
-impl cat {
+pub impl cat {
     fn play(&mut self) {
         self.meows += 1u;
         self.nap();
diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs
index 27afde631b2..c472e530584 100644
--- a/src/test/run-pass/reflect-visit-data.rs
+++ b/src/test/run-pass/reflect-visit-data.rs
@@ -30,7 +30,7 @@ fn align(size: uint, align: uint) -> uint {
 
 enum ptr_visit_adaptor<V> = Inner<V>;
 
-impl<V:TyVisitor + movable_ptr> ptr_visit_adaptor<V> {
+pub impl<V:TyVisitor + movable_ptr> ptr_visit_adaptor<V> {
 
     #[inline(always)]
     fn bump(sz: uint) {
@@ -478,7 +478,7 @@ struct Stuff {
     vals: ~[~str]
 }
 
-impl my_visitor {
+pub impl my_visitor {
     fn get<T>(f: fn(T)) {
         unsafe {
             f(*(self.ptr1 as *T));
@@ -489,7 +489,7 @@ impl my_visitor {
         unsafe {
             let u = my_visitor(*self);
             let v = ptr_visit_adaptor::<my_visitor>(Inner {inner: u});
-            visit_tydesc(inner, v as TyVisitor);
+            visit_tydesc(inner, @v as @TyVisitor);
             true
         }
     }
@@ -644,7 +644,7 @@ pub fn main() {
         let td = get_tydesc_for(r);
         unsafe { error!("tydesc sz: %u, align: %u",
                         (*td).size, (*td).align); }
-        let v = v as TyVisitor;
+        let v = @v as @TyVisitor;
         visit_tydesc(td, v);
 
         for (copy u.vals).each |s| {
diff --git a/src/test/run-pass/regions-trait.rs b/src/test/run-pass/regions-trait.rs
index e45a0d252c6..2b9930778b2 100644
--- a/src/test/run-pass/regions-trait.rs
+++ b/src/test/run-pass/regions-trait.rs
@@ -30,5 +30,5 @@ pub fn main() {
     let ctxt = Ctxt { v: 22 };
     let hc = HasCtxt { c: &ctxt };
 
-    assert get_v(hc as get_ctxt) == 22;
+    assert get_v(@hc as @get_ctxt) == 22;
 }
diff --git a/src/test/run-pass/resource-destruct.rs b/src/test/run-pass/resource-destruct.rs
index 3dc4ca7bd61..2b00aea2b4c 100644
--- a/src/test/run-pass/resource-destruct.rs
+++ b/src/test/run-pass/resource-destruct.rs
@@ -18,7 +18,7 @@ impl Drop for shrinky_pointer {
     }
 }
 
-impl shrinky_pointer {
+pub impl shrinky_pointer {
   fn look_at() -> int { return **(self.i); }
 }