about summary refs log tree commit diff
path: root/src/rustc
diff options
context:
space:
mode:
authorSimon BD <simon@server>2012-10-03 21:47:09 -0500
committerSimon BD <simon@server>2012-10-03 21:47:09 -0500
commitefcd2385ea2389f270ff8ac8bc256636f647b130 (patch)
tree7e142ef709bc907a34ab1cb252eef6dcc0e83b91 /src/rustc
parent44f8a4401ab37a45ba49db56611d77807bcbce35 (diff)
parent3ccf6f5932d8223fd6c5cbf7c6ac429ca9e8912a (diff)
downloadrust-efcd2385ea2389f270ff8ac8bc256636f647b130.tar.gz
rust-efcd2385ea2389f270ff8ac8bc256636f647b130.zip
Merge remote-tracking branch 'original/incoming' into incoming
Conflicts:
	src/libstd/json.rs
	src/libstd/sort.rs
Diffstat (limited to 'src/rustc')
-rw-r--r--src/rustc/back/link.rs103
-rw-r--r--src/rustc/back/rpath.rs10
-rw-r--r--src/rustc/back/upcall.rs2
-rw-r--r--src/rustc/driver/driver.rs6
-rw-r--r--src/rustc/driver/rustc.rs17
-rw-r--r--src/rustc/driver/session.rs2
-rw-r--r--src/rustc/front/config.rs25
-rw-r--r--src/rustc/front/test.rs12
-rw-r--r--src/rustc/lib/llvm.rs48
-rw-r--r--src/rustc/metadata/common.rs3
-rw-r--r--src/rustc/metadata/creader.rs10
-rw-r--r--src/rustc/metadata/cstore.rs22
-rw-r--r--src/rustc/metadata/decoder.rs92
-rw-r--r--src/rustc/metadata/encoder.rs61
-rw-r--r--src/rustc/metadata/filesearch.rs10
-rw-r--r--src/rustc/metadata/loader.rs12
-rw-r--r--src/rustc/metadata/tydecode.rs16
-rw-r--r--src/rustc/middle/astencode.rs26
-rw-r--r--src/rustc/middle/borrowck.rs2
-rw-r--r--src/rustc/middle/borrowck/check_loans.rs10
-rw-r--r--src/rustc/middle/borrowck/gather_loans.rs6
-rw-r--r--src/rustc/middle/capture.rs2
-rw-r--r--src/rustc/middle/check_alt.rs18
-rw-r--r--src/rustc/middle/check_const.rs4
-rw-r--r--src/rustc/middle/const_eval.rs4
-rw-r--r--src/rustc/middle/freevars.rs2
-rw-r--r--src/rustc/middle/kind.rs26
-rw-r--r--src/rustc/middle/lang_items.rs2
-rw-r--r--src/rustc/middle/lint.rs140
-rw-r--r--src/rustc/middle/liveness.rs26
-rw-r--r--src/rustc/middle/mem_categorization.rs18
-rw-r--r--src/rustc/middle/pat_util.rs2
-rw-r--r--src/rustc/middle/privacy.rs14
-rw-r--r--src/rustc/middle/region.rs4
-rw-r--r--src/rustc/middle/resolve.rs443
-rw-r--r--src/rustc/middle/trans/alt.rs16
-rw-r--r--src/rustc/middle/trans/base.rs73
-rw-r--r--src/rustc/middle/trans/build.rs8
-rw-r--r--src/rustc/middle/trans/callee.rs12
-rw-r--r--src/rustc/middle/trans/closure.rs24
-rw-r--r--src/rustc/middle/trans/common.rs45
-rw-r--r--src/rustc/middle/trans/controlflow.rs20
-rw-r--r--src/rustc/middle/trans/datum.rs4
-rw-r--r--src/rustc/middle/trans/debuginfo.rs6
-rw-r--r--src/rustc/middle/trans/expr.rs10
-rw-r--r--src/rustc/middle/trans/foreign.rs26
-rw-r--r--src/rustc/middle/trans/glue.rs26
-rw-r--r--src/rustc/middle/trans/inline.rs2
-rw-r--r--src/rustc/middle/trans/machine.rs148
-rw-r--r--src/rustc/middle/trans/meth.rs32
-rw-r--r--src/rustc/middle/trans/monomorphize.rs18
-rw-r--r--src/rustc/middle/trans/shape.rs738
-rw-r--r--src/rustc/middle/trans/tvec.rs4
-rw-r--r--src/rustc/middle/trans/type_of.rs14
-rw-r--r--src/rustc/middle/trans/type_use.rs14
-rw-r--r--src/rustc/middle/ty.rs135
-rw-r--r--src/rustc/middle/typeck/astconv.rs6
-rw-r--r--src/rustc/middle/typeck/check.rs37
-rw-r--r--src/rustc/middle/typeck/check/alt.rs4
-rw-r--r--src/rustc/middle/typeck/check/method.rs66
-rw-r--r--src/rustc/middle/typeck/check/regionmanip.rs14
-rw-r--r--src/rustc/middle/typeck/check/vtable.rs106
-rw-r--r--src/rustc/middle/typeck/check/writeback.rs2
-rw-r--r--src/rustc/middle/typeck/coherence.rs15
-rw-r--r--src/rustc/middle/typeck/collect.rs2
-rw-r--r--src/rustc/middle/typeck/infer.rs2
-rw-r--r--src/rustc/middle/typeck/infer/combine.rs8
-rw-r--r--src/rustc/middle/typeck/infer/region_var_bindings.rs14
-rw-r--r--src/rustc/middle/typeck/infer/resolve.rs6
-rw-r--r--src/rustc/middle/typeck/infer/unify.rs2
-rw-r--r--src/rustc/rustc.rc5
-rw-r--r--src/rustc/util/common.rs2
-rw-r--r--src/rustc/util/ppaux.rs8
73 files changed, 1236 insertions, 1638 deletions
diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs
index fb3d749673c..2e310785306 100644
--- a/src/rustc/back/link.rs
+++ b/src/rustc/back/link.rs
@@ -74,17 +74,47 @@ mod jit {
             m: ModuleRef,
             opt: c_int,
             stacks: bool) unsafe {
-        let ptr = llvm::LLVMRustJIT(rusti::morestack_addr(),
-                                    pm, m, opt, stacks);
+        let manager = llvm::LLVMRustPrepareJIT(rusti::morestack_addr());
+
+        // We need to tell JIT where to resolve all linked
+        // symbols from. The equivalent of -lstd, -lcore, etc.
+        // By default the JIT will resolve symbols from the std and
+        // core linked into rustc. We don't want that,
+        // incase the user wants to use an older std library.
+
+        let cstore = sess.cstore;
+        for cstore::get_used_crate_files(cstore).each |cratepath| {
+            let path = cratepath.to_str();
+
+            debug!("linking: %s", path);
+
+            let _: () = str::as_c_str(
+                path,
+                |buf_t| {
+                    if !llvm::LLVMRustLoadCrate(manager, buf_t) {
+                        llvm_err(sess, ~"Could not link");
+                    }
+                    debug!("linked: %s", path);
+                });
+        }
+
+        // The execute function will return a void pointer
+        // to the _rust_main function. We can do closure
+        // magic here to turn it straight into a callable rust
+        // closure. It will also cleanup the memory manager
+        // for us.
 
-        if ptr::is_null(ptr) {
+        let entry = llvm::LLVMRustExecuteJIT(manager,
+                                             pm, m, opt, stacks);
+
+        if ptr::is_null(entry) {
             llvm_err(sess, ~"Could not JIT");
         } else {
             let closure = Closure {
-                code: ptr,
+                code: entry,
                 env: ptr::null()
             };
-            let func: fn(~[~str]) = cast::transmute(move closure);
+            let func: fn(++argv: ~[~str]) = cast::transmute(move closure);
 
             func(~[sess.opts.binary]);
         }
@@ -193,25 +223,6 @@ mod write {
                 // JIT execution takes ownership of the module,
                 // so don't dispose and return.
 
-                // We need to tell LLVM where to resolve all linked
-                // symbols from. The equivalent of -lstd, -lcore, etc.
-                // By default the JIT will resolve symbols from the std and
-                // core linked into rustc. We don't want that,
-                // incase the user wants to use an older std library.
-                /*let cstore = sess.cstore;
-                for cstore::get_used_crate_files(cstore).each |cratepath| {
-                    debug!{"linking: %s", cratepath};
-
-                    let _: () = str::as_c_str(
-                        cratepath,
-                        |buf_t| {
-                            if !llvm::LLVMRustLoadLibrary(buf_t) {
-                                llvm_err(sess, ~"Could not link");
-                            }
-                            debug!{"linked: %s", cratepath};
-                        });
-                }*/
-
                 jit::exec(sess, pm.llpm, llmod, CodeGenOptLevel, true);
 
                 if sess.time_llvm_passes() {
@@ -392,14 +403,14 @@ fn build_link_meta(sess: session, c: ast::crate, output: &Path,
             if attr::get_meta_item_name(*meta) == ~"name" {
                 match attr::get_meta_item_value_str(*meta) {
                   Some(v) => { name = Some(v); }
-                  None => vec::push(cmh_items, *meta)
+                  None => cmh_items.push(*meta)
                 }
             } else if attr::get_meta_item_name(*meta) == ~"vers" {
                 match attr::get_meta_item_value_str(*meta) {
                   Some(v) => { vers = Some(v); }
-                  None => vec::push(cmh_items, *meta)
+                  None => cmh_items.push(*meta)
                 }
-            } else { vec::push(cmh_items, *meta); }
+            } else { cmh_items.push(*meta); }
         }
         return {name: name, vers: vers, cmh_items: cmh_items};
     }
@@ -607,7 +618,7 @@ fn mangle_internal_name_by_path(ccx: @crate_ctxt, path: path) -> ~str {
 }
 
 fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: ~str) -> ~str {
-    return fmt!("%s_%u", flav, ccx.names(flav));
+    return fmt!("%s_%u", flav, ccx.names(flav).repr);
 }
 
 // If the user wants an exe generated we need to invoke
@@ -657,9 +668,9 @@ fn link_binary(sess: session,
 
     let mut cc_args =
         vec::append(~[stage], sess.targ_cfg.target_strs.cc_args);
-    vec::push(cc_args, ~"-o");
-    vec::push(cc_args, output.to_str());
-    vec::push(cc_args, obj_filename.to_str());
+    cc_args.push(~"-o");
+    cc_args.push(output.to_str());
+    cc_args.push(obj_filename.to_str());
 
     let mut lib_cmd;
     let os = sess.targ_cfg.os;
@@ -674,17 +685,17 @@ fn link_binary(sess: session,
     let cstore = sess.cstore;
     for cstore::get_used_crate_files(cstore).each |cratepath| {
         if cratepath.filetype() == Some(~".rlib") {
-            vec::push(cc_args, cratepath.to_str());
+            cc_args.push(cratepath.to_str());
             loop;
         }
         let dir = cratepath.dirname();
-        if dir != ~"" { vec::push(cc_args, ~"-L" + dir); }
+        if dir != ~"" { cc_args.push(~"-L" + dir); }
         let libarg = unlib(sess.targ_cfg, cratepath.filestem().get());
-        vec::push(cc_args, ~"-l" + libarg);
+        cc_args.push(~"-l" + libarg);
     }
 
     let ula = cstore::get_used_link_args(cstore);
-    for ula.each |arg| { vec::push(cc_args, *arg); }
+    for ula.each |arg| { cc_args.push(*arg); }
 
     // # Extern library linking
 
@@ -695,41 +706,41 @@ fn link_binary(sess: session,
     // forces to make sure that library can be found at runtime.
 
     let addl_paths = sess.opts.addl_lib_search_paths;
-    for addl_paths.each |path| { vec::push(cc_args, ~"-L" + path.to_str()); }
+    for addl_paths.each |path| { cc_args.push(~"-L" + path.to_str()); }
 
     // The names of the extern libraries
     let used_libs = cstore::get_used_libraries(cstore);
-    for used_libs.each |l| { vec::push(cc_args, ~"-l" + *l); }
+    for used_libs.each |l| { cc_args.push(~"-l" + *l); }
 
     if sess.building_library {
-        vec::push(cc_args, lib_cmd);
+        cc_args.push(lib_cmd);
 
         // On mac we need to tell the linker to let this library
         // be rpathed
         if sess.targ_cfg.os == session::os_macos {
-            vec::push(cc_args, ~"-Wl,-install_name,@rpath/"
+            cc_args.push(~"-Wl,-install_name,@rpath/"
                       + output.filename().get());
         }
     }
 
     if !sess.debugging_opt(session::no_rt) {
         // Always want the runtime linked in
-        vec::push(cc_args, ~"-lrustrt");
+        cc_args.push(~"-lrustrt");
     }
 
     // On linux librt and libdl are an indirect dependencies via rustrt,
     // and binutils 2.22+ won't add them automatically
     if sess.targ_cfg.os == session::os_linux {
-        vec::push_all(cc_args, ~[~"-lrt", ~"-ldl"]);
+        cc_args.push_all(~[~"-lrt", ~"-ldl"]);
 
         // LLVM implements the `frem` instruction as a call to `fmod`,
         // which lives in libm. Similar to above, on some linuxes we
         // have to be explicit about linking to it. See #2510
-        vec::push(cc_args, ~"-lm");
+        cc_args.push(~"-lm");
     }
 
     if sess.targ_cfg.os == session::os_freebsd {
-        vec::push_all(cc_args, ~[~"-pthread", ~"-lrt",
+        cc_args.push_all(~[~"-pthread", ~"-lrt",
                                 ~"-L/usr/local/lib", ~"-lexecinfo",
                                 ~"-L/usr/local/lib/gcc46",
                                 ~"-L/usr/local/lib/gcc44", ~"-lstdc++",
@@ -743,15 +754,15 @@ fn link_binary(sess: session,
     // understand how to unwind our __morestack frame, so we have to turn it
     // off. This has impacted some other projects like GHC.
     if sess.targ_cfg.os == session::os_macos {
-        vec::push(cc_args, ~"-Wl,-no_compact_unwind");
+        cc_args.push(~"-Wl,-no_compact_unwind");
     }
 
     // Stack growth requires statically linking a __morestack function
-    vec::push(cc_args, ~"-lmorestack");
+    cc_args.push(~"-lmorestack");
 
     // FIXME (#2397): At some point we want to rpath our guesses as to where
     // extern libraries might live, based on the addl_lib_search_paths
-    vec::push_all(cc_args, rpath::get_rpath_flags(sess, &output));
+    cc_args.push_all(rpath::get_rpath_flags(sess, &output));
 
     debug!("%s link args: %s", cc_prog, str::connect(cc_args, ~" "));
     // We run 'cc' here
diff --git a/src/rustc/back/rpath.rs b/src/rustc/back/rpath.rs
index 132bbc96344..8aa7caefc7a 100644
--- a/src/rustc/back/rpath.rs
+++ b/src/rustc/back/rpath.rs
@@ -81,8 +81,8 @@ fn get_rpaths(os: session::os,
     log_rpaths(~"fallback", fallback_rpaths);
 
     let mut rpaths = rel_rpaths;
-    vec::push_all(rpaths, abs_rpaths);
-    vec::push_all(rpaths, fallback_rpaths);
+    rpaths.push_all(abs_rpaths);
+    rpaths.push_all(fallback_rpaths);
 
     // Remove duplicates
     let rpaths = minimize_rpaths(rpaths);
@@ -136,9 +136,9 @@ fn get_relative_to(abs1: &Path, abs2: &Path) -> Path {
     }
 
     let mut path = ~[];
-    for uint::range(start_idx, len1 - 1) |_i| { vec::push(path, ~".."); };
+    for uint::range(start_idx, len1 - 1) |_i| { path.push(~".."); };
 
-    vec::push_all(path, vec::view(split2, start_idx, len2 - 1));
+    path.push_all(vec::view(split2, start_idx, len2 - 1));
 
     if vec::is_not_empty(path) {
         return Path("").push_many(path);
@@ -172,7 +172,7 @@ fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
     for rpaths.each |rpath| {
         let s = rpath.to_str();
         if !set.contains_key(s) {
-            vec::push(minimized, *rpath);
+            minimized.push(*rpath);
             set.insert(s, ());
         }
     }
diff --git a/src/rustc/back/upcall.rs b/src/rustc/back/upcall.rs
index f289a0bdf27..a2c864f6f46 100644
--- a/src/rustc/back/upcall.rs
+++ b/src/rustc/back/upcall.rs
@@ -28,7 +28,7 @@ fn declare_upcalls(targ_cfg: @session::config,
             tys: ~[TypeRef], rv: TypeRef) ->
        ValueRef {
         let mut arg_tys: ~[TypeRef] = ~[];
-        for tys.each |t| { vec::push(arg_tys, *t); }
+        for tys.each |t| { arg_tys.push(*t); }
         let fn_ty = T_fn(arg_tys, rv);
         return base::decl_cdecl_fn(llmod, prefix + name, fn_ty);
     }
diff --git a/src/rustc/driver/driver.rs b/src/rustc/driver/driver.rs
index f890fa85eb3..e389f3a4bdf 100644
--- a/src/rustc/driver/driver.rs
+++ b/src/rustc/driver/driver.rs
@@ -94,7 +94,7 @@ fn parse_cfgspecs(cfgspecs: ~[~str]) -> ast::crate_cfg {
     // meta_word variant.
     let mut words = ~[];
     for cfgspecs.each |s| {
-        vec::push(words, attr::mk_word_item(*s));
+        words.push(attr::mk_word_item(*s));
     }
     return words;
 }
@@ -466,7 +466,7 @@ fn build_session_options(binary: ~str,
                                            level_name, lint_name));
               }
               Some(lint) => {
-                vec::push(lint_opts, (lint.lint, *level));
+                lint_opts.push((lint.lint, *level));
               }
             }
         }
@@ -507,7 +507,7 @@ fn build_session_options(binary: ~str,
     let extra_debuginfo = opt_present(matches, ~"xg");
     let debuginfo = opt_present(matches, ~"g") || extra_debuginfo;
     let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot");
-    let sysroot_opt = sysroot_opt.map(|m| Path(m));
+    let sysroot_opt = sysroot_opt.map(|m| Path(*m));
     let target_opt = getopts::opt_maybe_str(matches, ~"target");
     let save_temps = getopts::opt_present(matches, ~"save-temps");
     match output_type {
diff --git a/src/rustc/driver/rustc.rs b/src/rustc/driver/rustc.rs
index 1b4b47f1014..c6b93fc0603 100644
--- a/src/rustc/driver/rustc.rs
+++ b/src/rustc/driver/rustc.rs
@@ -12,6 +12,7 @@ use core::*;
 
 // -*- rust -*-
 use result::{Ok, Err};
+use io::ReaderUtil;
 use std::getopts;
 use std::map::HashMap;
 use getopts::{opt_present};
@@ -60,7 +61,7 @@ Options:
     --save-temps       Write intermediate files (.bc, .opt.bc, .o)
                        in addition to normal output
     --static           Use or produce static libraries or binaries
-    --stats            Print compilation statistics
+                       (experimental)
     --sysroot <path>   Override the system root
     --test             Build a test harness
     --target <triple>  Target cpu-manufacturer-kernel[-os] to compile for
@@ -121,7 +122,7 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
     logging::console_off();
 
     let mut args = args;
-    let binary = vec::shift(args);
+    let binary = args.shift();
 
     if vec::len(args) == 0u { usage(binary); return; }
 
@@ -140,12 +141,12 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
 
     let lint_flags = vec::append(getopts::opt_strs(matches, ~"W"),
                                  getopts::opt_strs(matches, ~"warn"));
-    if lint_flags.contains(~"help") {
+    if lint_flags.contains(&~"help") {
         describe_warnings();
         return;
     }
 
-    if getopts::opt_strs(matches, ~"Z").contains(~"help") {
+    if getopts::opt_strs(matches, ~"Z").contains(&~"help") {
         describe_debug_flags();
         return;
     }
@@ -171,14 +172,14 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
     let sopts = build_session_options(binary, matches, demitter);
     let sess = build_session(sopts, demitter);
     let odir = getopts::opt_maybe_str(matches, ~"out-dir");
-    let odir = odir.map(|o| Path(o));
+    let odir = odir.map(|o| Path(*o));
     let ofile = getopts::opt_maybe_str(matches, ~"o");
-    let ofile = ofile.map(|o| Path(o));
+    let ofile = ofile.map(|o| Path(*o));
     let cfg = build_configuration(sess, binary, input);
     let pretty =
         option::map(&getopts::opt_default(matches, ~"pretty",
                                          ~"normal"),
-                    |a| parse_pretty(sess, a) );
+                    |a| parse_pretty(sess, *a) );
     match pretty {
       Some::<pp_mode>(ppm) => {
         pretty_print_input(sess, cfg, input, ppm);
@@ -235,7 +236,7 @@ fn monitor(+f: fn~(diagnostic::emitter)) {
         // The 'diagnostics emitter'. Every error, warning, etc. should
         // go through this function.
         let demitter = fn@(cmsp: Option<(codemap::codemap, codemap::span)>,
-                           msg: ~str, lvl: diagnostic::level) {
+                           msg: &str, lvl: diagnostic::level) {
             if lvl == diagnostic::fatal {
                 comm::send(ch, fatal);
             }
diff --git a/src/rustc/driver/session.rs b/src/rustc/driver/session.rs
index 335e1004078..c6c0ff2826a 100644
--- a/src/rustc/driver/session.rs
+++ b/src/rustc/driver/session.rs
@@ -243,7 +243,7 @@ impl session {
     fn ident_of(st: ~str) -> ast::ident {
         self.parse_sess.interner.intern(@st)
     }
-    fn intr() -> syntax::parse::token::ident_interner {
+    fn intr() -> @syntax::parse::token::ident_interner {
         self.parse_sess.interner
     }
 }
diff --git a/src/rustc/front/config.rs b/src/rustc/front/config.rs
index 4c262e3dc65..4577b54fb5c 100644
--- a/src/rustc/front/config.rs
+++ b/src/rustc/front/config.rs
@@ -50,13 +50,12 @@ fn filter_view_item(cx: ctxt, &&view_item: @ast::view_item
 
 fn fold_mod(cx: ctxt, m: ast::_mod, fld: fold::ast_fold) ->
    ast::_mod {
-    let item_filter = |a| filter_item(cx, a);
-    let filtered_items = vec::filter_map(m.items, item_filter);
-    let view_item_filter = |a| filter_view_item(cx, a);
-    let filtered_view_items = vec::filter_map(m.view_items, view_item_filter);
+    let filtered_items = vec::filter_map(m.items, |a| filter_item(cx, *a));
+    let filtered_view_items = vec::filter_map(m.view_items,
+                                              |a| filter_view_item(cx, *a));
     return {
         view_items: vec::map(filtered_view_items, |x| fld.fold_view_item(*x)),
-        items: vec::filter_map(filtered_items, |x| fld.fold_item(x))
+        items: vec::filter_map(filtered_items, |x| fld.fold_item(*x))
     };
 }
 
@@ -69,11 +68,10 @@ fn filter_foreign_item(cx: ctxt, &&item: @ast::foreign_item) ->
 
 fn fold_foreign_mod(cx: ctxt, nm: ast::foreign_mod,
                    fld: fold::ast_fold) -> ast::foreign_mod {
-    let item_filter = |a| filter_foreign_item(cx, a);
-    let filtered_items = vec::filter_map(nm.items, item_filter);
-    let view_item_filter = |a| filter_view_item(cx, a);
-    let filtered_view_items = vec::filter_map(
-        nm.view_items, view_item_filter);
+    let filtered_items = vec::filter_map(nm.items,
+                                         |a| filter_foreign_item(cx, *a));
+    let filtered_view_items = vec::filter_map(nm.view_items,
+                                              |a| filter_view_item(cx, *a));
     return {
         sort: nm.sort,
         view_items: vec::map(filtered_view_items, |x| fld.fold_view_item(*x)),
@@ -100,11 +98,10 @@ fn filter_stmt(cx: ctxt, &&stmt: @ast::stmt) ->
 
 fn fold_block(cx: ctxt, b: ast::blk_, fld: fold::ast_fold) ->
    ast::blk_ {
-    let filter = |a| filter_stmt(cx, a);
-    let filtered_stmts = vec::filter_map(b.stmts, filter);
+    let filtered_stmts = vec::filter_map(b.stmts, |a| filter_stmt(cx, *a));
     return {view_items: b.view_items,
          stmts: vec::map(filtered_stmts, |x| fld.fold_stmt(*x)),
-         expr: option::map(&b.expr, |x| fld.fold_expr(x)),
+         expr: option::map(&b.expr, |x| fld.fold_expr(*x)),
          id: b.id,
          rules: b.rules};
 }
@@ -136,7 +133,7 @@ fn metas_in_cfg(cfg: ast::crate_cfg, metas: ~[@ast::meta_item]) -> bool {
     // so we can match against them. This is the list of configurations for
     // which the item is valid
     let cfg_metas = vec::concat(vec::filter_map(cfg_metas,
-        |&&i| attr::get_meta_item_list(i) ));
+        |i| attr::get_meta_item_list(*i)));
 
     let has_cfg_metas = vec::len(cfg_metas) > 0u;
     if !has_cfg_metas { return true; }
diff --git a/src/rustc/front/test.rs b/src/rustc/front/test.rs
index e1441d9ee5e..952d7b9ab79 100644
--- a/src/rustc/front/test.rs
+++ b/src/rustc/front/test.rs
@@ -81,8 +81,8 @@ fn fold_mod(cx: test_ctxt, m: ast::_mod, fld: fold::ast_fold) -> ast::_mod {
     }
 
     let mod_nomain =
-        {view_items: m.view_items, items: vec::filter_map(m.items,
-                                                          |i| nomain(cx, i))};
+        {view_items: m.view_items,
+         items: vec::filter_map(m.items, |i| nomain(cx, *i))};
     return fold::noop_fold_mod(mod_nomain, fld);
 }
 
@@ -99,7 +99,7 @@ fn fold_crate(cx: test_ctxt, c: ast::crate_, fld: fold::ast_fold) ->
 fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
    Option<@ast::item> {
 
-    vec::push(cx.path, i.ident);
+    cx.path.push(i.ident);
     debug!("current path: %s",
            ast_util::path_name_i(cx.path, cx.sess.parse_sess.interner));
 
@@ -122,7 +122,7 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
     }
 
     let res = fold::noop_fold_item(i, fld);
-    vec::pop(cx.path);
+    cx.path.pop();
     return res;
 }
 
@@ -152,7 +152,7 @@ fn is_ignored(cx: test_ctxt, i: @ast::item) -> bool {
     let ignoreattrs = attr::find_attrs_by_name(i.attrs, ~"ignore");
     let ignoreitems = attr::attr_metas(ignoreattrs);
     let cfg_metas = vec::concat(vec::filter_map(ignoreitems,
-        |&&i| attr::get_meta_item_list(i) ));
+        |i| attr::get_meta_item_list(*i)));
     return if vec::is_not_empty(ignoreitems) {
         config::metas_in_cfg(cx.crate.node.config, cfg_metas)
     } else {
@@ -286,7 +286,7 @@ fn mk_test_desc_vec(cx: test_ctxt) -> @ast::expr {
     debug!("building test vector from %u tests", cx.testfns.len());
     let mut descs = ~[];
     for cx.testfns.each |test| {
-        vec::push(descs, mk_test_desc_rec(cx, *test));
+        descs.push(mk_test_desc_rec(cx, *test));
     }
 
     let inner_expr = @{id: cx.sess.next_node_id(),
diff --git a/src/rustc/lib/llvm.rs b/src/rustc/lib/llvm.rs
index 031ce219308..0d92c19b952 100644
--- a/src/rustc/lib/llvm.rs
+++ b/src/rustc/lib/llvm.rs
@@ -28,19 +28,19 @@ enum Linkage {
     AvailableExternallyLinkage = 1,
     LinkOnceAnyLinkage = 2,
     LinkOnceODRLinkage = 3,
-    WeakAnyLinkage = 4,
-    WeakODRLinkage = 5,
-    AppendingLinkage = 6,
-    InternalLinkage = 7,
-    PrivateLinkage = 8,
-    DLLImportLinkage = 9,
-    DLLExportLinkage = 10,
-    ExternalWeakLinkage = 11,
-    GhostLinkage = 12,
-    CommonLinkage = 13,
-    LinkerPrivateLinkage = 14,
-    LinkerPrivateWeakLinkage = 15,
-    LinkerPrivateWeakDefAutoLinkage = 16,
+    LinkOnceODRAutoHideLinkage = 4,
+    WeakAnyLinkage = 5,
+    WeakODRLinkage = 6,
+    AppendingLinkage = 7,
+    InternalLinkage = 8,
+    PrivateLinkage = 9,
+    DLLImportLinkage = 10,
+    DLLExportLinkage = 11,
+    ExternalWeakLinkage = 12,
+    GhostLinkage = 13,
+    CommonLinkage = 14,
+    LinkerPrivateLinkage = 15,
+    LinkerPrivateWeakLinkage = 16,
 }
 
 enum Attribute {
@@ -91,6 +91,7 @@ enum IntPredicate {
 
 // enum for the LLVM RealPredicate type
 enum RealPredicate {
+    RealPredicateFalse = 0,
     RealOEQ = 1,
     RealOGT = 2,
     RealOGE = 3,
@@ -105,6 +106,7 @@ enum RealPredicate {
     RealULT = 12,
     RealULE = 13,
     RealUNE = 14,
+    RealPredicateTrue = 15,
 }
 
 // enum for the LLVM TypeKind type - must stay in sync with the def of
@@ -990,15 +992,19 @@ extern mod llvm {
         call. */
     fn LLVMRustGetLastError() -> *c_char;
 
-    /** Load a shared library to resolve symbols against. */
-    fn LLVMRustLoadLibrary(Filename: *c_char) -> bool;
+    /** Prepare the JIT. Returns a memory manager that can load crates. */
+    fn LLVMRustPrepareJIT(__morestack: *()) -> *();
 
-    /** Create and execute the JIT engine. */
-    fn LLVMRustJIT(__morestack: *(),
-                   PM: PassManagerRef,
-                   M: ModuleRef,
-                   OptLevel: c_int,
-                   EnableSegmentedStacks: bool) -> *();
+    /** Load a crate into the memory manager. */
+    fn LLVMRustLoadCrate(MM: *(),
+                         Filename: *c_char) -> bool;
+
+    /** Execute the JIT engine. */
+    fn LLVMRustExecuteJIT(MM: *(),
+                          PM: PassManagerRef,
+                          M: ModuleRef,
+                          OptLevel: c_int,
+                          EnableSegmentedStacks: bool) -> *();
 
     /** Parses the bitcode in the given memory buffer. */
     fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) -> ModuleRef;
diff --git a/src/rustc/metadata/common.rs b/src/rustc/metadata/common.rs
index 2d62bf7b4a2..1857abf2cf2 100644
--- a/src/rustc/metadata/common.rs
+++ b/src/rustc/metadata/common.rs
@@ -120,7 +120,8 @@ enum astencode_tag { // Reserves 0x50 -- 0x6f
     tag_table_spill = 0x5f,
     tag_table_method_map = 0x60,
     tag_table_vtable_map = 0x61,
-    tag_table_adjustments = 0x62
+    tag_table_adjustments = 0x62,
+    tag_table_legacy_boxed_trait = 0x63
 }
 
 type link_meta = {name: ~str, vers: ~str, extras_hash: ~str};
diff --git a/src/rustc/metadata/creader.rs b/src/rustc/metadata/creader.rs
index f6c2bf7d5a1..3ed56a1953e 100644
--- a/src/rustc/metadata/creader.rs
+++ b/src/rustc/metadata/creader.rs
@@ -18,7 +18,7 @@ export read_crates;
 // libraries necessary for later resolving, typechecking, linking, etc.
 fn read_crates(diag: span_handler, crate: ast::crate,
                cstore: cstore::cstore, filesearch: filesearch,
-               os: loader::os, static: bool, intr: ident_interner) {
+               os: loader::os, static: bool, intr: @ident_interner) {
     let e = @{diag: diag,
               filesearch: filesearch,
               cstore: cstore,
@@ -63,9 +63,9 @@ fn warn_if_multiple_versions(e: env, diag: span_handler,
             partition(crate_cache.map_to_vec(|entry| {
                 let othername = loader::crate_name_from_metas(*entry.metas);
                 if name == othername {
-                    Left(*entry)
+                    Left(entry)
                 } else {
-                    Right(*entry)
+                    Right(entry)
                 }
             }));
 
@@ -94,7 +94,7 @@ type env = @{diag: span_handler,
              static: bool,
              crate_cache: DVec<cache_entry>,
              mut next_crate_num: ast::crate_num,
-             intr: ident_interner};
+             intr: @ident_interner};
 
 fn visit_view_item(e: env, i: @ast::view_item) {
     match i.node {
@@ -248,7 +248,7 @@ fn resolve_crate_deps(e: env, cdata: @~[u8]) -> cstore::cnum_map {
     debug!("resolving deps of external crate");
     // The map from crate numbers in the crate we're resolving to local crate
     // numbers
-    let cnum_map = HashMap::<int,ast::crate_num>();
+    let cnum_map = HashMap();
     for decoder::get_crate_deps(e.intr, cdata).each |dep| {
         let extrn_cnum = dep.cnum;
         let cname = dep.name;
diff --git a/src/rustc/metadata/cstore.rs b/src/rustc/metadata/cstore.rs
index c5686153c00..d59464d58c7 100644
--- a/src/rustc/metadata/cstore.rs
+++ b/src/rustc/metadata/cstore.rs
@@ -58,7 +58,7 @@ type cstore_private =
       mut used_crate_files: ~[Path],
       mut used_libraries: ~[~str],
       mut used_link_args: ~[~str],
-      intr: ident_interner};
+      intr: @ident_interner};
 
 // Map from node_id's of local use statements to crate numbers
 type use_crate_map = map::HashMap<ast::node_id, ast::crate_num>;
@@ -68,9 +68,9 @@ pure fn p(cstore: cstore) -> cstore_private {
     match cstore { private(p) => p }
 }
 
-fn mk_cstore(intr: ident_interner) -> cstore {
-    let meta_cache = map::HashMap::<int,crate_metadata>();
-    let crate_map = map::HashMap::<int,ast::crate_num>();
+fn mk_cstore(intr: @ident_interner) -> cstore {
+    let meta_cache = map::HashMap();
+    let crate_map = map::HashMap();
     let mod_path_map = HashMap();
     return private(@{metas: meta_cache,
                      use_crate_map: crate_map,
@@ -114,8 +114,8 @@ fn iter_crate_data(cstore: cstore, i: fn(ast::crate_num, crate_metadata)) {
 }
 
 fn add_used_crate_file(cstore: cstore, lib: &Path) {
-    if !vec::contains(p(cstore).used_crate_files, copy *lib) {
-        vec::push(p(cstore).used_crate_files, copy *lib);
+    if !vec::contains(p(cstore).used_crate_files, lib) {
+        p(cstore).used_crate_files.push(copy *lib);
     }
 }
 
@@ -126,8 +126,8 @@ fn get_used_crate_files(cstore: cstore) -> ~[Path] {
 fn add_used_library(cstore: cstore, lib: ~str) -> bool {
     assert lib != ~"";
 
-    if vec::contains(p(cstore).used_libraries, lib) { return false; }
-    vec::push(p(cstore).used_libraries, lib);
+    if vec::contains(p(cstore).used_libraries, &lib) { return false; }
+    p(cstore).used_libraries.push(lib);
     return true;
 }
 
@@ -136,7 +136,7 @@ fn get_used_libraries(cstore: cstore) -> ~[~str] {
 }
 
 fn add_used_link_args(cstore: cstore, args: ~str) {
-    vec::push_all(p(cstore).used_link_args, str::split_char(args, ' '));
+    p(cstore).used_link_args.push_all(str::split_char(args, ' '));
 }
 
 fn get_used_link_args(cstore: cstore) -> ~[~str] {
@@ -163,7 +163,7 @@ fn get_dep_hashes(cstore: cstore) -> ~[~str] {
         let cdata = cstore::get_crate_data(cstore, cnum);
         let hash = decoder::get_crate_hash(cdata.data);
         debug!("Add hash[%s]: %s", cdata.name, hash);
-        vec::push(result, {name: cdata.name, hash: hash});
+        result.push({name: cdata.name, hash: hash});
     };
     pure fn lteq(a: &crate_hash, b: &crate_hash) -> bool {a.name <= b.name}
     let sorted = std::sort::merge_sort(result, lteq);
@@ -177,7 +177,7 @@ fn get_dep_hashes(cstore: cstore) -> ~[~str] {
 
 fn get_path(cstore: cstore, d: ast::def_id) -> ~[~str] {
     option::map_default(&p(cstore).mod_path_map.find(d), ~[],
-                        |ds| str::split_str(*ds, ~"::"))
+                        |ds| str::split_str(**ds, ~"::"))
 }
 // Local Variables:
 // mode: rust
diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs
index c631e404472..0e6bc2aee15 100644
--- a/src/rustc/metadata/decoder.rs
+++ b/src/rustc/metadata/decoder.rs
@@ -196,7 +196,7 @@ fn field_mutability(d: ebml::Doc) -> ast::class_mutability {
         &ebml::maybe_get_doc(d, tag_class_mut),
         ast::class_immutable,
         |d| {
-            match ebml::doc_as_u8(d) as char {
+            match ebml::doc_as_u8(*d) as char {
               'm' => ast::class_mutable,
               _   => ast::class_immutable
             }
@@ -204,7 +204,7 @@ fn field_mutability(d: ebml::Doc) -> ast::class_mutability {
 }
 
 fn variant_disr_val(d: ebml::Doc) -> Option<int> {
-    do option::chain(&ebml::maybe_get_doc(d, tag_disr_val)) |val_doc| {
+    do option::chain(ebml::maybe_get_doc(d, tag_disr_val)) |val_doc| {
         int::parse_bytes(ebml::doc_data(val_doc), 10u)
     }
 }
@@ -227,7 +227,7 @@ fn item_type(item_id: ast::def_id, item: ebml::Doc,
 fn item_impl_traits(item: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ~[ty::t] {
     let mut results = ~[];
     for ebml::tagged_docs(item, tag_impl_trait) |ity| {
-        vec::push(results, doc_type(ity, tcx, cdata));
+        results.push(doc_type(ity, tcx, cdata));
     };
     results
 }
@@ -239,14 +239,14 @@ fn item_ty_param_bounds(item: ebml::Doc, tcx: ty::ctxt, cdata: cmd)
         let bd = parse_bounds_data(p.data, p.start, cdata.cnum, tcx, |did| {
             translate_def_id(cdata, did)
         });
-        vec::push(bounds, bd);
+        bounds.push(bd);
     }
     @bounds
 }
 
 fn item_ty_region_param(item: ebml::Doc) -> Option<ty::region_variance> {
     ebml::maybe_get_doc(item, tag_region_param).map(|doc| {
-        let d = ebml::ebml_deserializer(doc);
+        let d = ebml::ebml_deserializer(*doc);
         ty::deserialize_region_variance(d)
     })
 }
@@ -263,12 +263,12 @@ fn enum_variant_ids(item: ebml::Doc, cdata: cmd) -> ~[ast::def_id] {
     let v = tag_items_data_item_variant;
     for ebml::tagged_docs(item, v) |p| {
         let ext = ebml::with_doc_data(p, |d| parse_def_id(d));
-        vec::push(ids, {crate: cdata.cnum, node: ext.node});
+        ids.push({crate: cdata.cnum, node: ext.node});
     };
     return ids;
 }
 
-fn item_path(intr: ident_interner, item_doc: ebml::Doc) -> ast_map::path {
+fn item_path(intr: @ident_interner, item_doc: ebml::Doc) -> ast_map::path {
     let path_doc = ebml::get_doc(item_doc, tag_path);
 
     let len_doc = ebml::get_doc(path_doc, tag_path_len);
@@ -278,10 +278,10 @@ fn item_path(intr: ident_interner, item_doc: ebml::Doc) -> ast_map::path {
     for ebml::docs(path_doc) |tag, elt_doc| {
         if tag == tag_path_elt_mod {
             let str = ebml::doc_as_str(elt_doc);
-            vec::push(result, ast_map::path_mod(intr.intern(@str)));
+            result.push(ast_map::path_mod(intr.intern(@str)));
         } else if tag == tag_path_elt_name {
             let str = ebml::doc_as_str(elt_doc);
-            vec::push(result, ast_map::path_name(intr.intern(@str)));
+            result.push(ast_map::path_name(intr.intern(@str)));
         } else {
             // ignore tag_path_len element
         }
@@ -290,7 +290,7 @@ fn item_path(intr: ident_interner, item_doc: ebml::Doc) -> ast_map::path {
     return result;
 }
 
-fn item_name(intr: ident_interner, item: ebml::Doc) -> ast::ident {
+fn item_name(intr: @ident_interner, item: ebml::Doc) -> ast::ident {
     let name = ebml::get_doc(item, tag_paths_data_name);
     intr.intern(@str::from_bytes(ebml::doc_data(name)))
 }
@@ -365,7 +365,7 @@ fn get_impl_traits(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) -> ~[ty::t] {
     item_impl_traits(lookup_item(id, cdata.data), tcx, cdata)
 }
 
-fn get_impl_method(intr: ident_interner, cdata: cmd, id: ast::node_id,
+fn get_impl_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
                    name: ast::ident) -> ast::def_id {
     let items = ebml::get_doc(ebml::Doc(cdata.data), tag_items);
     let mut found = None;
@@ -378,7 +378,7 @@ fn get_impl_method(intr: ident_interner, cdata: cmd, id: ast::node_id,
     found.get()
 }
 
-fn get_class_method(intr: ident_interner, cdata: cmd, id: ast::node_id,
+fn get_class_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
                     name: ast::ident) -> ast::def_id {
     let items = ebml::get_doc(ebml::Doc(cdata.data), tag_items);
     let mut found = None;
@@ -451,7 +451,7 @@ fn path_entry(path_string: ~str, def_like: def_like) -> path_entry {
 }
 
 /// Iterates over all the paths in the given crate.
-fn each_path(intr: ident_interner, cdata: cmd, f: fn(path_entry) -> bool) {
+fn each_path(intr: @ident_interner, cdata: cmd, f: fn(path_entry) -> bool) {
     let root = ebml::Doc(cdata.data);
     let items = ebml::get_doc(root, tag_items);
     let items_data = ebml::get_doc(items, tag_items_data);
@@ -531,7 +531,7 @@ fn each_path(intr: ident_interner, cdata: cmd, f: fn(path_entry) -> bool) {
     }
 }
 
-fn get_item_path(intr: ident_interner, cdata: cmd, id: ast::node_id)
+fn get_item_path(intr: @ident_interner, cdata: cmd, id: ast::node_id)
     -> ast_map::path {
     item_path(intr, lookup_item(id, cdata.data))
 }
@@ -542,7 +542,7 @@ type decode_inlined_item = fn(
     path: ast_map::path,
     par_doc: ebml::Doc) -> Option<ast::inlined_item>;
 
-fn maybe_get_item_ast(intr: ident_interner, cdata: cmd, tcx: ty::ctxt,
+fn maybe_get_item_ast(intr: @ident_interner, cdata: cmd, tcx: ty::ctxt,
                       id: ast::node_id,
                       decode_inlined_item: decode_inlined_item
                      ) -> csearch::found_ast {
@@ -568,7 +568,7 @@ fn maybe_get_item_ast(intr: ident_interner, cdata: cmd, tcx: ty::ctxt,
     }
 }
 
-fn get_enum_variants(intr: ident_interner, cdata: cmd, id: ast::node_id,
+fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id,
                      tcx: ty::ctxt) -> ~[ty::variant_info] {
     let data = cdata.data;
     let items = ebml::get_doc(ebml::Doc(data), tag_items);
@@ -584,7 +584,7 @@ fn get_enum_variants(intr: ident_interner, cdata: cmd, id: ast::node_id,
         let mut arg_tys: ~[ty::t] = ~[];
         match ty::get(ctor_ty).sty {
           ty::ty_fn(f) => {
-            for f.sig.inputs.each |a| { vec::push(arg_tys, a.ty); }
+            for f.sig.inputs.each |a| { arg_tys.push(a.ty); }
           }
           _ => { /* Nullary enum variant. */ }
         }
@@ -592,7 +592,7 @@ fn get_enum_variants(intr: ident_interner, cdata: cmd, id: ast::node_id,
           Some(val) => { disr_val = val; }
           _         => { /* empty */ }
         }
-        vec::push(infos, @{args: arg_tys, ctor_ty: ctor_ty, name: name,
+        infos.push(@{args: arg_tys, ctor_ty: ctor_ty, name: name,
                            id: *did, disr_val: disr_val});
         disr_val += 1;
     }
@@ -638,14 +638,14 @@ fn get_self_ty(item: ebml::Doc) -> ast::self_ty_ {
     }
 }
 
-fn item_impl_methods(intr: ident_interner, cdata: cmd, item: ebml::Doc,
+fn item_impl_methods(intr: @ident_interner, cdata: cmd, item: ebml::Doc,
                      base_tps: uint) -> ~[@method_info] {
     let mut rslt = ~[];
     for ebml::tagged_docs(item, tag_item_impl_method) |doc| {
         let m_did = ebml::with_doc_data(doc, |d| parse_def_id(d));
         let mth_item = lookup_item(m_did.node, cdata.data);
         let self_ty = get_self_ty(mth_item);
-        vec::push(rslt, @{did: translate_def_id(cdata, m_did),
+        rslt.push(@{did: translate_def_id(cdata, m_did),
                     /* FIXME (maybe #2323) tjc: take a look at this. */
                    n_tps: item_ty_param_count(mth_item) - base_tps,
                    ident: item_name(intr, mth_item),
@@ -654,7 +654,7 @@ fn item_impl_methods(intr: ident_interner, cdata: cmd, item: ebml::Doc,
     rslt
 }
 
-fn get_impls_for_mod(intr: ident_interner, cdata: cmd,
+fn get_impls_for_mod(intr: @ident_interner, cdata: cmd,
                      m_id: ast::node_id, name: Option<ast::ident>,
                      get_cdata: fn(ast::crate_num) -> cmd)
                   -> @~[@_impl] {
@@ -675,7 +675,7 @@ fn get_impls_for_mod(intr: ident_interner, cdata: cmd,
         let nm = item_name(intr, item);
         if match name { Some(n) => { n == nm } None => { true } } {
            let base_tps = item_ty_param_count(item);
-           vec::push(result, @{
+           result.push(@{
                 did: local_did, ident: nm,
                 methods: item_impl_methods(intr, impl_cdata, item, base_tps)
             });
@@ -685,7 +685,7 @@ fn get_impls_for_mod(intr: ident_interner, cdata: cmd,
 }
 
 /* Works for both classes and traits */
-fn get_trait_methods(intr: ident_interner, cdata: cmd, id: ast::node_id,
+fn get_trait_methods(intr: @ident_interner, cdata: cmd, id: ast::node_id,
                      tcx: ty::ctxt) -> @~[ty::method] {
     let data = cdata.data;
     let item = lookup_item(id, data);
@@ -701,7 +701,7 @@ fn get_trait_methods(intr: ident_interner, cdata: cmd, id: ast::node_id,
                 ~"get_trait_methods: id has non-function type");
         } };
         let self_ty = get_self_ty(mth);
-        vec::push(result, {ident: name, tps: bounds, fty: fty,
+        result.push({ident: name, tps: bounds, fty: fty,
                            self_ty: self_ty,
                            vis: ast::public});
     }
@@ -712,7 +712,7 @@ fn get_trait_methods(intr: ident_interner, cdata: cmd, id: ast::node_id,
 // If the item in question is a trait, returns its set of methods and
 // their self types. Otherwise, returns none. This overlaps in an
 // annoying way with get_trait_methods.
-fn get_method_names_if_trait(intr: ident_interner, cdata: cmd,
+fn get_method_names_if_trait(intr: @ident_interner, cdata: cmd,
                              node_id: ast::node_id)
                           -> Option<@DVec<(ast::ident, ast::self_ty_)>> {
 
@@ -742,7 +742,7 @@ fn get_item_attrs(cdata: cmd,
 }
 
 // Helper function that gets either fields or methods
-fn get_class_members(intr: ident_interner, cdata: cmd, id: ast::node_id,
+fn get_class_members(intr: @ident_interner, cdata: cmd, id: ast::node_id,
                      p: fn(Family) -> bool) -> ~[ty::field_ty] {
     let data = cdata.data;
     let item = lookup_item(id, data);
@@ -753,7 +753,7 @@ fn get_class_members(intr: ident_interner, cdata: cmd, id: ast::node_id,
           let name = item_name(intr, an_item);
           let did = item_def_id(an_item, cdata);
           let mt = field_mutability(an_item);
-          vec::push(result, {ident: name, id: did, vis:
+          result.push({ident: name, id: did, vis:
                   family_to_visibility(f), mutability: mt});
        }
     }
@@ -769,7 +769,7 @@ pure fn family_to_visibility(family: Family) -> ast::visibility {
     }
 }
 
-fn get_class_fields(intr: ident_interner, cdata: cmd, id: ast::node_id)
+fn get_class_fields(intr: @ident_interner, cdata: cmd, id: ast::node_id)
     -> ~[ty::field_ty] {
     get_class_members(intr, cdata, id, |f| f == PublicField
                       || f == PrivateField || f == InheritedField)
@@ -835,7 +835,7 @@ fn get_meta_items(md: ebml::Doc) -> ~[@ast::meta_item] {
     for ebml::tagged_docs(md, tag_meta_item_word) |meta_item_doc| {
         let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name);
         let n = str::from_bytes(ebml::doc_data(nd));
-        vec::push(items, attr::mk_word_item(n));
+        items.push(attr::mk_word_item(n));
     };
     for ebml::tagged_docs(md, tag_meta_item_name_value) |meta_item_doc| {
         let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name);
@@ -844,13 +844,13 @@ fn get_meta_items(md: ebml::Doc) -> ~[@ast::meta_item] {
         let v = str::from_bytes(ebml::doc_data(vd));
         // FIXME (#623): Should be able to decode meta_name_value variants,
         // but currently the encoder just drops them
-        vec::push(items, attr::mk_name_value_item_str(n, v));
+        items.push(attr::mk_name_value_item_str(n, v));
     };
     for ebml::tagged_docs(md, tag_meta_item_list) |meta_item_doc| {
         let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name);
         let n = str::from_bytes(ebml::doc_data(nd));
         let subitems = get_meta_items(meta_item_doc);
-        vec::push(items, attr::mk_list_item(n, subitems));
+        items.push(attr::mk_list_item(n, subitems));
     };
     return items;
 }
@@ -865,10 +865,10 @@ fn get_attributes(md: ebml::Doc) -> ~[ast::attribute] {
             // an attribute
             assert (vec::len(meta_items) == 1u);
             let meta_item = meta_items[0];
-            vec::push(attrs,
-                      {node: {style: ast::attr_outer, value: *meta_item,
-                              is_sugared_doc: false},
-                       span: ast_util::dummy_sp()});
+            attrs.push(
+                {node: {style: ast::attr_outer, value: *meta_item,
+                        is_sugared_doc: false},
+                 span: ast_util::dummy_sp()});
         };
       }
       option::None => ()
@@ -876,14 +876,14 @@ fn get_attributes(md: ebml::Doc) -> ~[ast::attribute] {
     return attrs;
 }
 
-fn list_meta_items(intr: ident_interner,
+fn list_meta_items(intr: @ident_interner,
                    meta_items: ebml::Doc, out: io::Writer) {
     for get_meta_items(meta_items).each |mi| {
         out.write_str(fmt!("%s\n", pprust::meta_item_to_str(*mi, intr)));
     }
 }
 
-fn list_crate_attributes(intr: ident_interner, md: ebml::Doc, hash: ~str,
+fn list_crate_attributes(intr: @ident_interner, md: ebml::Doc, hash: ~str,
                          out: io::Writer) {
     out.write_str(fmt!("=Crate Attributes (%s)=\n", hash));
 
@@ -901,7 +901,7 @@ fn get_crate_attributes(data: @~[u8]) -> ~[ast::attribute] {
 type crate_dep = {cnum: ast::crate_num, name: ast::ident,
                   vers: ~str, hash: ~str};
 
-fn get_crate_deps(intr: ident_interner, data: @~[u8]) -> ~[crate_dep] {
+fn get_crate_deps(intr: @ident_interner, data: @~[u8]) -> ~[crate_dep] {
     let mut deps: ~[crate_dep] = ~[];
     let cratedoc = ebml::Doc(data);
     let depsdoc = ebml::get_doc(cratedoc, tag_crate_deps);
@@ -910,7 +910,7 @@ fn get_crate_deps(intr: ident_interner, data: @~[u8]) -> ~[crate_dep] {
         str::from_bytes(ebml::doc_data(ebml::get_doc(doc, tag_)))
     }
     for ebml::tagged_docs(depsdoc, tag_crate_dep) |depdoc| {
-        vec::push(deps, {cnum: crate_num,
+        deps.push({cnum: crate_num,
                   name: intr.intern(@docstr(depdoc, tag_crate_dep_name)),
                   vers: docstr(depdoc, tag_crate_dep_vers),
                   hash: docstr(depdoc, tag_crate_dep_hash)});
@@ -919,7 +919,7 @@ fn get_crate_deps(intr: ident_interner, data: @~[u8]) -> ~[crate_dep] {
     return deps;
 }
 
-fn list_crate_deps(intr: ident_interner, data: @~[u8], out: io::Writer) {
+fn list_crate_deps(intr: @ident_interner, data: @~[u8], out: io::Writer) {
     out.write_str(~"=External Dependencies=\n");
 
     for get_crate_deps(intr, data).each |dep| {
@@ -946,7 +946,7 @@ fn get_crate_vers(data: @~[u8]) -> ~str {
     };
 }
 
-fn iter_crate_items(intr: ident_interner,
+fn iter_crate_items(intr: @ident_interner,
                     cdata: cmd, proc: fn(~str, ast::def_id)) {
     for each_path(intr, cdata) |path_entry| {
         match path_entry.def_like {
@@ -958,7 +958,7 @@ fn iter_crate_items(intr: ident_interner,
     }
 }
 
-fn get_crate_module_paths(intr: ident_interner, cdata: cmd)
+fn get_crate_module_paths(intr: @ident_interner, cdata: cmd)
                                     -> ~[(ast::def_id, ~str)] {
     fn mod_of_path(p: ~str) -> ~str {
         str::connect(vec::init(str::split_str(p, ~"::")), ~"::")
@@ -967,7 +967,7 @@ fn get_crate_module_paths(intr: ident_interner, cdata: cmd)
     // find all module (path, def_ids), which are not
     // fowarded path due to renamed import or reexport
     let mut res = ~[];
-    let mods = map::HashMap::<~str,bool>();
+    let mods = map::HashMap();
     do iter_crate_items(intr, cdata) |path, did| {
         let m = mod_of_path(path);
         if str::is_not_empty(m) {
@@ -977,15 +977,15 @@ fn get_crate_module_paths(intr: ident_interner, cdata: cmd)
         // Collect everything by now. There might be multiple
         // paths pointing to the same did. Those will be
         // unified later by using the mods map
-        vec::push(res, (did, path));
+        res.push((did, path));
     }
     return do vec::filter(res) |x| {
-        let (_, xp) = x;
+        let (_, xp) = *x;
         mods.contains_key(xp)
     }
 }
 
-fn list_crate_metadata(intr: ident_interner, bytes: @~[u8],
+fn list_crate_metadata(intr: @ident_interner, bytes: @~[u8],
                        out: io::Writer) {
     let hash = get_crate_hash(bytes);
     let md = ebml::Doc(bytes);
diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs
index 8da5fa0aee2..17d686b41d1 100644
--- a/src/rustc/metadata/encoder.rs
+++ b/src/rustc/metadata/encoder.rs
@@ -118,12 +118,12 @@ type entry<T> = {val: T, pos: uint};
 fn add_to_index(ecx: @encode_ctxt, ebml_w: ebml::Writer, path: &[ident],
                 &index: ~[entry<~str>], name: ident) {
     let mut full_path = ~[];
-    vec::push_all(full_path, path);
-    vec::push(full_path, name);
-    vec::push(index,
-              {val: ast_util::path_name_i(full_path,
-                                          ecx.tcx.sess.parse_sess.interner),
-               pos: ebml_w.writer.tell()});
+    full_path.push_all(path);
+    full_path.push(name);
+    index.push(
+        {val: ast_util::path_name_i(full_path,
+                                    ecx.tcx.sess.parse_sess.interner),
+         pos: ebml_w.writer.tell()});
 }
 
 fn encode_trait_ref(ebml_w: ebml::Writer, ecx: @encode_ctxt, t: @trait_ref) {
@@ -225,7 +225,7 @@ fn encode_enum_variant_info(ecx: @encode_ctxt, ebml_w: ebml::Writer,
     let mut i = 0;
     let vi = ty::enum_variants(ecx.tcx, {crate: local_crate, node: id});
     for variants.each |variant| {
-        vec::push(*index, {val: variant.node.id, pos: ebml_w.writer.tell()});
+        index.push({val: variant.node.id, pos: ebml_w.writer.tell()});
         ebml_w.start_tag(tag_items_data_item);
         encode_def_id(ebml_w, local_def(variant.node.id));
         encode_family(ebml_w, 'v');
@@ -390,9 +390,9 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::Writer,
         match field.node.kind {
             named_field(nm, mt, vis) => {
                 let id = field.node.id;
-                vec::push(*index, {val: id, pos: ebml_w.writer.tell()});
-                vec::push(*global_index, {val: id,
-                                          pos: ebml_w.writer.tell()});
+                index.push({val: id, pos: ebml_w.writer.tell()});
+                global_index.push({val: id,
+                                    pos: ebml_w.writer.tell()});
                 ebml_w.start_tag(tag_items_data_item);
                 debug!("encode_info_for_class: doing %s %d",
                        tcx.sess.str_of(nm), id);
@@ -411,9 +411,9 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::Writer,
     for methods.each |m| {
         match m.vis {
             public | inherited => {
-                vec::push(*index, {val: m.id, pos: ebml_w.writer.tell()});
-                vec::push(*global_index,
-                          {val: m.id, pos: ebml_w.writer.tell()});
+                index.push({val: m.id, pos: ebml_w.writer.tell()});
+                global_index.push(
+                    {val: m.id, pos: ebml_w.writer.tell()});
                 let impl_path = vec::append_one(path,
                                                 ast_map::path_name(m.ident));
                 debug!("encode_info_for_class: doing %s %d",
@@ -519,7 +519,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item,
 
     fn add_to_index_(item: @item, ebml_w: ebml::Writer,
                      index: @mut ~[entry<int>]) {
-        vec::push(*index, {val: item.id, pos: ebml_w.writer.tell()});
+        index.push({val: item.id, pos: ebml_w.writer.tell()});
     }
     let add_to_index = |copy ebml_w| add_to_index_(item, ebml_w, index);
 
@@ -603,13 +603,13 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item,
                                         index);
         /* Encode the dtor */
         do struct_def.dtor.iter |dtor| {
-            vec::push(*index, {val: dtor.node.id, pos: ebml_w.writer.tell()});
+            index.push({val: dtor.node.id, pos: ebml_w.writer.tell()});
           encode_info_for_ctor(ecx, ebml_w, dtor.node.id,
                                ecx.tcx.sess.ident_of(
                                    ecx.tcx.sess.str_of(item.ident) +
                                    ~"_dtor"),
                                path, if tps.len() > 0u {
-                                   Some(ii_dtor(dtor, item.ident, tps,
+                                   Some(ii_dtor(*dtor, item.ident, tps,
                                                 local_def(item.id))) }
                                else { None }, tps);
         }
@@ -688,7 +688,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item,
         for struct_def.ctor.each |ctor| {
             debug!("encoding info for ctor %s %d",
                    ecx.tcx.sess.str_of(item.ident), ctor.node.id);
-            vec::push(*index, {
+            index.push({
                 val: ctor.node.id,
                 pos: ebml_w.writer.tell()
             });
@@ -715,7 +715,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item,
             ebml_w.end_tag();
         }
         do opt_trait.iter() |associated_trait| {
-           encode_trait_ref(ebml_w, ecx, associated_trait)
+           encode_trait_ref(ebml_w, ecx, *associated_trait)
         }
         encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident));
         ebml_w.end_tag();
@@ -723,7 +723,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item,
         let impl_path = vec::append_one(path,
                                         ast_map::path_name(item.ident));
         for methods.each |m| {
-            vec::push(*index, {val: m.id, pos: ebml_w.writer.tell()});
+            index.push({val: m.id, pos: ebml_w.writer.tell()});
             encode_info_for_method(ecx, ebml_w, impl_path,
                                    should_inline(m.attrs), item.id, *m,
                                    vec::append(tps, m.tps));
@@ -774,7 +774,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item,
             let ty_m = ast_util::trait_method_to_ty_method(*m);
             if ty_m.self_ty.node != ast::sty_static { loop; }
 
-            vec::push(*index, {val: ty_m.id, pos: ebml_w.writer.tell()});
+            index.push({val: ty_m.id, pos: ebml_w.writer.tell()});
 
             ebml_w.start_tag(tag_items_data_item);
             encode_def_id(ebml_w, local_def(ty_m.id));
@@ -799,7 +799,7 @@ fn encode_info_for_foreign_item(ecx: @encode_ctxt, ebml_w: ebml::Writer,
                                 index: @mut ~[entry<int>],
                                 path: ast_map::path, abi: foreign_abi) {
     if !reachable(ecx, nitem.id) { return; }
-    vec::push(*index, {val: nitem.id, pos: ebml_w.writer.tell()});
+    index.push({val: nitem.id, pos: ebml_w.writer.tell()});
 
     ebml_w.start_tag(tag_items_data_item);
     match nitem.node {
@@ -831,7 +831,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::Writer,
                          crate: @crate) -> ~[entry<int>] {
     let index = @mut ~[];
     ebml_w.start_tag(tag_items_data);
-    vec::push(*index, {val: crate_node_id, pos: ebml_w.writer.tell()});
+    index.push({val: crate_node_id, pos: ebml_w.writer.tell()});
     encode_info_for_mod(ecx, ebml_w, crate.node.module,
                         crate_node_id, ~[],
                         syntax::parse::token::special_idents::invalid);
@@ -869,15 +869,15 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::Writer,
 fn create_index<T: Copy Hash IterBytes>(index: ~[entry<T>]) ->
    ~[@~[entry<T>]] {
     let mut buckets: ~[@mut ~[entry<T>]] = ~[];
-    for uint::range(0u, 256u) |_i| { vec::push(buckets, @mut ~[]); };
+    for uint::range(0u, 256u) |_i| { buckets.push(@mut ~[]); };
     for index.each |elt| {
         let h = elt.val.hash() as uint;
-        vec::push(*buckets[h % 256], *elt);
+        buckets[h % 256].push(*elt);
     }
 
     let mut buckets_frozen = ~[];
     for buckets.each |bucket| {
-        vec::push(buckets_frozen, @**bucket);
+        buckets_frozen.push(@**bucket);
     }
     return buckets_frozen;
 }
@@ -889,7 +889,7 @@ fn encode_index<T>(ebml_w: ebml::Writer, buckets: ~[@~[entry<T>]],
     let mut bucket_locs: ~[uint] = ~[];
     ebml_w.start_tag(tag_index_buckets);
     for buckets.each |bucket| {
-        vec::push(bucket_locs, ebml_w.writer.tell());
+        bucket_locs.push(ebml_w.writer.tell());
         ebml_w.start_tag(tag_index_buckets_bucket);
         for vec::each(**bucket) |elt| {
             ebml_w.start_tag(tag_index_buckets_bucket_elt);
@@ -996,8 +996,7 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> ~[attribute] {
     let mut attrs: ~[attribute] = ~[];
     let mut found_link_attr = false;
     for crate.node.attrs.each |attr| {
-        vec::push(
-            attrs,
+        attrs.push(
             if attr::get_attr_name(*attr) != ~"link" {
                 *attr
             } else {
@@ -1011,7 +1010,7 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> ~[attribute] {
             });
     }
 
-    if !found_link_attr { vec::push(attrs, synthesize_link_attr(ecx, ~[])); }
+    if !found_link_attr { attrs.push(synthesize_link_attr(ecx, ~[])); }
 
     return attrs;
 }
@@ -1031,7 +1030,7 @@ fn encode_crate_deps(ecx: @encode_ctxt, ebml_w: ebml::Writer,
             let dep = {cnum: key, name: ecx.tcx.sess.ident_of(val.name),
                        vers: decoder::get_crate_vers(val.data),
                        hash: decoder::get_crate_hash(val.data)};
-            vec::push(deps, dep);
+            deps.push(dep);
         };
 
         // Sort by cnum
@@ -1176,7 +1175,7 @@ fn encode_metadata(parms: encode_parms, crate: @crate) -> ~[u8] {
     //   vec::from_slice(metadata_encoding_version) +
 
     (do str::as_bytes(&~"rust\x00\x00\x00\x01") |bytes| {
-        vec::slice(bytes, 0, 8)
+        vec::slice(*bytes, 0, 8)
     }) + flate::deflate_bytes(wr.buf.check_out(|buf| buf))
 }
 
diff --git a/src/rustc/metadata/filesearch.rs b/src/rustc/metadata/filesearch.rs
index 77d06bd2d29..63370b09321 100644
--- a/src/rustc/metadata/filesearch.rs
+++ b/src/rustc/metadata/filesearch.rs
@@ -39,15 +39,15 @@ fn mk_filesearch(maybe_sysroot: Option<Path>,
         fn lib_search_paths() -> ~[Path] {
             let mut paths = self.addl_lib_search_paths;
 
-            vec::push(paths,
-                      make_target_lib_path(&self.sysroot,
-                                           self.target_triple));
+            paths.push(
+                make_target_lib_path(&self.sysroot,
+                                     self.target_triple));
             match get_cargo_lib_path_nearest() {
-              result::Ok(p) => vec::push(paths, p),
+              result::Ok(p) => paths.push(p),
               result::Err(_) => ()
             }
             match get_cargo_lib_path() {
-              result::Ok(p) => vec::push(paths, p),
+              result::Ok(p) => paths.push(p),
               result::Err(_) => ()
             }
             paths
diff --git a/src/rustc/metadata/loader.rs b/src/rustc/metadata/loader.rs
index e11793a36d0..0a8354be71f 100644
--- a/src/rustc/metadata/loader.rs
+++ b/src/rustc/metadata/loader.rs
@@ -35,7 +35,7 @@ type ctxt = {
     hash: ~str,
     os: os,
     static: bool,
-    intr: ident_interner
+    intr: @ident_interner
 };
 
 fn load_library_crate(cx: ctxt) -> {ident: ~str, data: @~[u8]} {
@@ -90,7 +90,7 @@ fn find_library_crate_aux(cx: ctxt,
                     option::None::<()>
                 } else {
                     debug!("found %s with matching metadata", path.to_str());
-                    vec::push(matches, {ident: path.to_str(), data: cvec});
+                    matches.push({ident: path.to_str(), data: cvec});
                     option::None::<()>
                 }
               }
@@ -135,7 +135,7 @@ fn crate_name_from_metas(metas: ~[@ast::meta_item]) -> ~str {
     }
 }
 
-fn note_linkage_attrs(intr: ident_interner, diag: span_handler,
+fn note_linkage_attrs(intr: @ident_interner, diag: span_handler,
                       attrs: ~[ast::attribute]) {
     for attr::find_linkage_metas(attrs).each |mi| {
         diag.handler().note(fmt!("meta: %s",
@@ -193,7 +193,7 @@ fn get_metadata_section(os: os,
                        vlen);
                 let minsz = uint::min(vlen, csz);
                 let mut version_ok = false;
-                do vec::raw::form_slice(cvbuf, minsz) |buf0| {
+                do vec::raw::buf_as_slice(cvbuf, minsz) |buf0| {
                     version_ok = (buf0 ==
                                   encoder::metadata_encoding_version);
                 }
@@ -202,7 +202,7 @@ fn get_metadata_section(os: os,
                 let cvbuf1 = ptr::offset(cvbuf, vlen);
                 debug!("inflating %u bytes of compressed metadata",
                        csz - vlen);
-                do vec::raw::form_slice(cvbuf1, csz-vlen) |bytes| {
+                do vec::raw::buf_as_slice(cvbuf1, csz-vlen) |bytes| {
                     let inflated = flate::inflate_bytes(bytes);
                     found = move Some(@(move inflated));
                 }
@@ -226,7 +226,7 @@ fn meta_section_name(os: os) -> ~str {
 }
 
 // A diagnostic function for dumping crate metadata to an output stream
-fn list_file_metadata(intr: ident_interner,
+fn list_file_metadata(intr: @ident_interner,
                       os: os, path: &Path, out: io::Writer) {
     match get_metadata_section(os, path) {
       option::Some(bytes) => decoder::list_crate_metadata(intr, bytes, out),
diff --git a/src/rustc/metadata/tydecode.rs b/src/rustc/metadata/tydecode.rs
index 5cf24aef558..f3fa0e3f350 100644
--- a/src/rustc/metadata/tydecode.rs
+++ b/src/rustc/metadata/tydecode.rs
@@ -84,7 +84,7 @@ fn parse_ret_ty(st: @pstate, conv: conv_did) -> (ast::ret_style, ty::t) {
 fn parse_path(st: @pstate) -> @ast::path {
     let mut idents: ~[ast::ident] = ~[];
     fn is_last(c: char) -> bool { return c == '(' || c == ':'; }
-    vec::push(idents, parse_ident_(st, is_last));
+    idents.push(parse_ident_(st, is_last));
     loop {
         match peek(st) {
           ':' => { next(st); next(st); }
@@ -93,7 +93,7 @@ fn parse_path(st: @pstate) -> @ast::path {
                 return @{span: ast_util::dummy_sp(),
                       global: false, idents: idents,
                       rp: None, types: ~[]};
-            } else { vec::push(idents, parse_ident_(st, is_last)); }
+            } else { idents.push(parse_ident_(st, is_last)); }
           }
         }
     };
@@ -136,7 +136,7 @@ fn parse_substs(st: @pstate, conv: conv_did) -> ty::substs {
 
     assert next(st) == '[';
     let mut params: ~[ty::t] = ~[];
-    while peek(st) != ']' { vec::push(params, parse_ty(st, conv)); }
+    while peek(st) != ']' { params.push(parse_ty(st, conv)); }
     st.pos = st.pos + 1u;
 
     return {self_r: self_r,
@@ -273,7 +273,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
         let mut fields: ~[ty::field] = ~[];
         while peek(st) != ']' {
             let name = st.tcx.sess.ident_of(parse_str(st, '='));
-            vec::push(fields, {ident: name, mt: parse_mt(st, conv)});
+            fields.push({ident: name, mt: parse_mt(st, conv)});
         }
         st.pos = st.pos + 1u;
         return ty::mk_rec(st.tcx, fields);
@@ -281,7 +281,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
       'T' => {
         assert (next(st) == '[');
         let mut params = ~[];
-        while peek(st) != ']' { vec::push(params, parse_ty(st, conv)); }
+        while peek(st) != ']' { params.push(parse_ty(st, conv)); }
         st.pos = st.pos + 1u;
         return ty::mk_tup(st.tcx, params);
       }
@@ -348,7 +348,7 @@ fn parse_mt(st: @pstate, conv: conv_did) -> ty::mt {
 
 fn parse_def(st: @pstate, conv: conv_did) -> ast::def_id {
     let mut def = ~[];
-    while peek(st) != '|' { vec::push(def, next_byte(st)); }
+    while peek(st) != '|' { def.push(next_byte(st)); }
     st.pos = st.pos + 1u;
     return conv(parse_def_id(def));
 }
@@ -412,7 +412,7 @@ fn parse_ty_fn(st: @pstate, conv: conv_did) -> ty::FnTy {
     let mut inputs: ~[ty::arg] = ~[];
     while peek(st) != ']' {
         let mode = parse_mode(st);
-        vec::push(inputs, {mode: mode, ty: parse_ty(st, conv)});
+        inputs.push({mode: mode, ty: parse_ty(st, conv)});
     }
     st.pos += 1u; // eat the ']'
     let (ret_style, ret_ty) = parse_ret_ty(st, conv);
@@ -464,7 +464,7 @@ fn parse_bounds_data(data: @~[u8], start: uint,
 fn parse_bounds(st: @pstate, conv: conv_did) -> @~[ty::param_bound] {
     let mut bounds = ~[];
     loop {
-        vec::push(bounds, match next(st) {
+        bounds.push(match next(st) {
           'S' => ty::bound_send,
           'C' => ty::bound_copy,
           'K' => ty::bound_const,
diff --git a/src/rustc/middle/astencode.rs b/src/rustc/middle/astencode.rs
index acb7bb1bf2c..29368ae95b8 100644
--- a/src/rustc/middle/astencode.rs
+++ b/src/rustc/middle/astencode.rs
@@ -723,7 +723,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
         do ebml_w.tag(c::tag_table_def) {
             ebml_w.id(id);
             do ebml_w.tag(c::tag_table_val) {
-                ast::serialize_def(ebml_w, def)
+                ast::serialize_def(ebml_w, *def)
             }
         }
     }
@@ -731,7 +731,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
         do ebml_w.tag(c::tag_table_node_type) {
             ebml_w.id(id);
             do ebml_w.tag(c::tag_table_val) {
-                ebml_w.emit_ty(ecx, ty);
+                ebml_w.emit_ty(ecx, *ty);
             }
         }
     }
@@ -740,7 +740,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
         do ebml_w.tag(c::tag_table_node_type_subst) {
             ebml_w.id(id);
             do ebml_w.tag(c::tag_table_val) {
-                ebml_w.emit_tys(ecx, tys)
+                ebml_w.emit_tys(ecx, *tys)
             }
         }
     }
@@ -749,7 +749,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
         do ebml_w.tag(c::tag_table_freevars) {
             ebml_w.id(id);
             do ebml_w.tag(c::tag_table_val) {
-                do ebml_w.emit_from_vec(*fv) |fv_entry| {
+                do ebml_w.emit_from_vec(**fv) |fv_entry| {
                     encode_freevar_entry(ebml_w, *fv_entry)
                 }
             }
@@ -761,7 +761,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
         do ebml_w.tag(c::tag_table_tcache) {
             ebml_w.id(id);
             do ebml_w.tag(c::tag_table_val) {
-                ebml_w.emit_tpbt(ecx, tpbt);
+                ebml_w.emit_tpbt(ecx, *tpbt);
             }
         }
     }
@@ -770,7 +770,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
         do ebml_w.tag(c::tag_table_param_bounds) {
             ebml_w.id(id);
             do ebml_w.tag(c::tag_table_val) {
-                ebml_w.emit_bounds(ecx, pbs)
+                ebml_w.emit_bounds(ecx, *pbs)
             }
         }
     }
@@ -810,7 +810,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
         do ebml_w.tag(c::tag_table_method_map) {
             ebml_w.id(id);
             do ebml_w.tag(c::tag_table_val) {
-                serialize_method_map_entry(ecx, ebml_w, mme)
+                serialize_method_map_entry(ecx, ebml_w, *mme)
             }
         }
     }
@@ -819,7 +819,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
         do ebml_w.tag(c::tag_table_vtable_map) {
             ebml_w.id(id);
             do ebml_w.tag(c::tag_table_val) {
-                encode_vtable_res(ecx, ebml_w, dr);
+                encode_vtable_res(ecx, ebml_w, *dr);
             }
         }
     }
@@ -828,10 +828,16 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
         do ebml_w.tag(c::tag_table_adjustments) {
             ebml_w.id(id);
             do ebml_w.tag(c::tag_table_val) {
-                ty::serialize_AutoAdjustment(ebml_w, *adj)
+                ty::serialize_AutoAdjustment(ebml_w, **adj)
             }
         }
     }
+
+    do option::iter(&tcx.legacy_boxed_traits.find(id)) |_x| {
+        do ebml_w.tag(c::tag_table_legacy_boxed_trait) {
+            ebml_w.id(id);
+        }
+    }
 }
 
 trait doc_decoder_helpers {
@@ -923,6 +929,8 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
 
         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 {
             let val_doc = entry_doc[c::tag_table_val as uint];
             let val_dsr = ebml::ebml_deserializer(val_doc);
diff --git a/src/rustc/middle/borrowck.rs b/src/rustc/middle/borrowck.rs
index 4906eb4a0a3..414890cbd7c 100644
--- a/src/rustc/middle/borrowck.rs
+++ b/src/rustc/middle/borrowck.rs
@@ -415,7 +415,7 @@ impl root_map_key : cmp::Eq {
 }
 
 impl root_map_key : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         to_bytes::iter_bytes_2(&self.id, &self.derefs, lsb0, f);
     }
 }
diff --git a/src/rustc/middle/borrowck/check_loans.rs b/src/rustc/middle/borrowck/check_loans.rs
index c0aaa041d18..0c79c0fcd7f 100644
--- a/src/rustc/middle/borrowck/check_loans.rs
+++ b/src/rustc/middle/borrowck/check_loans.rs
@@ -183,7 +183,7 @@ impl check_loan_ctxt {
         debug!("check_pure_callee_or_arg(pc=%?, expr=%?, \
                 callee_id=%d, ty=%s)",
                pc,
-               opt_expr.map(|e| pprust::expr_to_str(e, tcx.sess.intr()) ),
+               opt_expr.map(|e| pprust::expr_to_str(*e, tcx.sess.intr()) ),
                callee_id,
                ty_to_str(self.tcx(), ty::node_id_to_type(tcx, callee_id)));
 
@@ -204,7 +204,7 @@ impl check_loan_ctxt {
                 let did = ast_util::def_id_of_def(def);
                 let is_fn_arg =
                     did.crate == ast::local_crate &&
-                    (*self.fn_args).contains(did.node);
+                    (*self.fn_args).contains(&(did.node));
                 if is_fn_arg { return; } // case (a) above
               }
               ast::expr_fn_block(*) | ast::expr_fn(*) |
@@ -251,7 +251,7 @@ impl check_loan_ctxt {
             let def = self.tcx().def_map.get(expr.id);
             let did = ast_util::def_id_of_def(def);
             did.crate == ast::local_crate &&
-                (*self.fn_args).contains(did.node)
+                (*self.fn_args).contains(&(did.node))
           }
           ast::expr_fn_block(*) | ast::expr_fn(*) => {
             self.is_stack_closure(expr.id)
@@ -524,10 +524,10 @@ impl check_loan_ctxt {
         let arg_tys =
             ty::ty_fn_args(
                 ty::node_id_to_type(self.tcx(), callee_id));
-        do vec::iter2(args, arg_tys) |arg, arg_ty| {
+        for vec::each2(args, arg_tys) |arg, arg_ty| {
             match ty::resolved_mode(self.tcx(), arg_ty.mode) {
                 ast::by_move => {
-                    self.check_move_out(arg);
+                    self.check_move_out(*arg);
                 }
                 ast::by_mutbl_ref | ast::by_ref |
                 ast::by_copy | ast::by_val => {
diff --git a/src/rustc/middle/borrowck/gather_loans.rs b/src/rustc/middle/borrowck/gather_loans.rs
index b3f846d47fd..327db51518b 100644
--- a/src/rustc/middle/borrowck/gather_loans.rs
+++ b/src/rustc/middle/borrowck/gather_loans.rs
@@ -113,14 +113,14 @@ fn req_loans_in_expr(ex: @ast::expr,
       ast::expr_call(f, args, _) => {
         let arg_tys = ty::ty_fn_args(ty::expr_ty(self.tcx(), f));
         let scope_r = ty::re_scope(ex.id);
-        do vec::iter2(args, arg_tys) |arg, arg_ty| {
+        for vec::each2(args, arg_tys) |arg, arg_ty| {
             match ty::resolved_mode(self.tcx(), arg_ty.mode) {
               ast::by_mutbl_ref => {
-                let arg_cmt = self.bccx.cat_expr(arg);
+                let arg_cmt = self.bccx.cat_expr(*arg);
                 self.guarantee_valid(arg_cmt, m_mutbl, scope_r);
               }
               ast::by_ref => {
-                let arg_cmt = self.bccx.cat_expr(arg);
+                let arg_cmt = self.bccx.cat_expr(*arg);
                 self.guarantee_valid(arg_cmt, m_imm,  scope_r);
               }
               ast::by_val => {
diff --git a/src/rustc/middle/capture.rs b/src/rustc/middle/capture.rs
index 1e885605171..618d43e121a 100644
--- a/src/rustc/middle/capture.rs
+++ b/src/rustc/middle/capture.rs
@@ -122,6 +122,6 @@ fn compute_capture_vars(tcx: ty::ctxt,
     }
 
     let mut result = ~[];
-    for cap_map.each_value |cap_var| { vec::push(result, cap_var); }
+    for cap_map.each_value |cap_var| { result.push(cap_var); }
     return result;
 }
diff --git a/src/rustc/middle/check_alt.rs b/src/rustc/middle/check_alt.rs
index 0d8d8b8dfe0..f71b82a2be7 100644
--- a/src/rustc/middle/check_alt.rs
+++ b/src/rustc/middle/check_alt.rs
@@ -67,7 +67,7 @@ fn check_arms(tcx: ty::ctxt, arms: ~[arm]) {
               }
               _ => ()
             }
-            if arm.guard.is_none() { vec::push(seen, v); }
+            if arm.guard.is_none() { seen.push(v); }
         }
     }
 }
@@ -195,7 +195,7 @@ fn is_useful(tcx: ty::ctxt, m: matrix, v: ~[@pat]) -> useful {
             }
           }
           Some(ctor) => {
-            match is_useful(tcx, vec::filter_map(m, |r| default(tcx, r) ),
+            match is_useful(tcx, vec::filter_map(m, |r| default(tcx, *r) ),
                           vec::tail(v)) {
               useful_ => useful(left_ty, ctor),
               u => u
@@ -212,7 +212,7 @@ fn is_useful(tcx: ty::ctxt, m: matrix, v: ~[@pat]) -> useful {
 
 fn is_useful_specialized(tcx: ty::ctxt, m: matrix, v: ~[@pat], ctor: ctor,
                           arity: uint, lty: ty::t) -> useful {
-    let ms = vec::filter_map(m, |r| specialize(tcx, r, ctor, arity, lty) );
+    let ms = vec::filter_map(m, |r| specialize(tcx, *r, ctor, arity, lty) );
     let could_be_useful = is_useful(
         tcx, ms, specialize(tcx, v, ctor, arity, lty).get());
     match could_be_useful {
@@ -269,13 +269,15 @@ fn missing_ctor(tcx: ty::ctxt, m: matrix, left_ty: ty::t) -> Option<ctor> {
         let mut found = ~[];
         for m.each |r| {
             do option::iter(&pat_ctor_id(tcx, r[0])) |id| {
-                if !vec::contains(found, id) { vec::push(found, id); }
+                if !vec::contains(found, id) {
+                    found.push(*id);
+                }
             }
         }
         let variants = ty::enum_variants(tcx, eid);
         if found.len() != (*variants).len() {
             for vec::each(*variants) |v| {
-                if !found.contains(variant(v.id)) {
+                if !found.contains(&(variant(v.id))) {
                     return Some(variant(v.id));
                 }
             }
@@ -430,7 +432,7 @@ fn check_local(tcx: ty::ctxt, loc: @local, &&s: (), v: visit::vt<()>) {
     }
 }
 
-fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool {
+fn is_refutable(tcx: ty::ctxt, pat: &pat) -> bool {
     match tcx.def_map.find(pat.id) {
       Some(def_variant(enum_id, _)) => {
         if vec::len(*ty::enum_variants(tcx, enum_id)) != 1u {
@@ -455,10 +457,10 @@ fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool {
         fields.any(|f| is_refutable(tcx, f.pat))
       }
       pat_tup(elts) => {
-        elts.any(|elt| is_refutable(tcx, elt))
+        elts.any(|elt| is_refutable(tcx, *elt))
       }
       pat_enum(_, Some(args)) => {
-        args.any(|a| is_refutable(tcx, a))
+        args.any(|a| is_refutable(tcx, *a))
       }
       pat_enum(_,_) => { false }
     }
diff --git a/src/rustc/middle/check_const.rs b/src/rustc/middle/check_const.rs
index e194a907ffd..bd3abe20134 100644
--- a/src/rustc/middle/check_const.rs
+++ b/src/rustc/middle/check_const.rs
@@ -28,7 +28,7 @@ fn check_item(sess: session, ast_map: ast_map::map,
       item_enum(enum_definition, _) => {
         for enum_definition.variants.each |var| {
             do option::iter(&var.node.disr_expr) |ex| {
-                v.visit_expr(ex, true, v);
+                v.visit_expr(*ex, true, v);
             }
         }
       }
@@ -169,7 +169,7 @@ fn check_item_recursion(sess: session, ast_map: ast_map::map,
     visitor.visit_item(it, env, visitor);
 
     fn visit_item(it: @item, &&env: env, v: visit::vt<env>) {
-        if (*env.idstack).contains(it.id) {
+        if (*env.idstack).contains(&(it.id)) {
             env.sess.span_fatal(env.root_it.span, ~"recursive constant");
         }
         (*env.idstack).push(it.id);
diff --git a/src/rustc/middle/const_eval.rs b/src/rustc/middle/const_eval.rs
index 463bf502036..5def18cacc3 100644
--- a/src/rustc/middle/const_eval.rs
+++ b/src/rustc/middle/const_eval.rs
@@ -41,7 +41,7 @@ enum constness {
 }
 
 fn join(a: constness, b: constness) -> constness {
-    match (a,b) {
+    match (a, b) {
       (integral_const, integral_const) => integral_const,
       (integral_const, general_const)
       | (general_const, integral_const)
@@ -51,7 +51,7 @@ fn join(a: constness, b: constness) -> constness {
 }
 
 fn join_all(cs: &[constness]) -> constness {
-    vec::foldl(integral_const, cs, join)
+    vec::foldl(integral_const, cs, |a, b| join(a, *b))
 }
 
 fn classify(e: @expr,
diff --git a/src/rustc/middle/freevars.rs b/src/rustc/middle/freevars.rs
index 251ef2c89b7..7e925d7d8d8 100644
--- a/src/rustc/middle/freevars.rs
+++ b/src/rustc/middle/freevars.rs
@@ -63,7 +63,7 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk)
                       if i == depth { // Made it to end of loop
                         let dnum = ast_util::def_id_of_def(def).node;
                         if !seen.contains_key(dnum) {
-                            vec::push(*refs, @{def:def, span:expr.span});
+                            refs.push(@{def:def, span:expr.span});
                             seen.insert(dnum, ());
                         }
                       }
diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs
index 0f918ba92a9..9aff382775c 100644
--- a/src/rustc/middle/kind.rs
+++ b/src/rustc/middle/kind.rs
@@ -42,17 +42,17 @@ fn kind_to_str(k: kind) -> ~str {
     let mut kinds = ~[];
 
     if ty::kind_lteq(kind_const(), k) {
-        vec::push(kinds, ~"const");
+        kinds.push(~"const");
     }
 
     if ty::kind_can_be_copied(k) {
-        vec::push(kinds, ~"copy");
+        kinds.push(~"copy");
     }
 
     if ty::kind_can_be_sent(k) {
-        vec::push(kinds, ~"send");
+        kinds.push(~"send");
     } else if ty::kind_is_owned(k) {
-        vec::push(kinds, ~"owned");
+        kinds.push(~"owned");
     }
 
     str::connect(kinds, ~" ")
@@ -199,13 +199,13 @@ fn check_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, sp: span,
             let id = ast_util::def_id_of_def(fv.def).node;
 
             // skip over free variables that appear in the cap clause
-            if captured_vars.contains(id) { loop; }
+            if captured_vars.contains(&id) { loop; }
 
             // if this is the last use of the variable, then it will be
             // a move and not a copy
             let is_move = {
                 match cx.last_use_map.find(fn_id) {
-                  Some(vars) => (*vars).contains(id),
+                  Some(vars) => (*vars).contains(&id),
                   None => false
                 }
             };
@@ -264,16 +264,16 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
                 ~"non path/method call expr has type substs??")
           }
         };
-        if vec::len(ts) != vec::len(*bounds) {
+        if vec::len(*ts) != vec::len(*bounds) {
             // Fail earlier to make debugging easier
             fail fmt!("Internal error: in kind::check_expr, length \
                        mismatch between actual and declared bounds: actual = \
                         %s (%u tys), declared = %? (%u tys)",
-                      tys_to_str(cx.tcx, ts), ts.len(),
+                      tys_to_str(cx.tcx, *ts), ts.len(),
                       *bounds, (*bounds).len());
         }
-        do vec::iter2(ts, *bounds) |ty, bound| {
-            check_bounds(cx, id_to_use, e.span, ty, bound)
+        for vec::each2(*ts, *bounds) |ty, bound| {
+            check_bounds(cx, id_to_use, e.span, *ty, *bound)
         }
     }
 
@@ -376,8 +376,8 @@ fn check_ty(aty: @ty, cx: ctx, v: visit::vt<ctx>) {
         do option::iter(&cx.tcx.node_type_substs.find(id)) |ts| {
             let did = ast_util::def_id_of_def(cx.tcx.def_map.get(id));
             let bounds = ty::lookup_item_type(cx.tcx, did).bounds;
-            do vec::iter2(ts, *bounds) |ty, bound| {
-                check_bounds(cx, aty.id, aty.span, ty, bound)
+            for vec::each2(*ts, *bounds) |ty, bound| {
+                check_bounds(cx, aty.id, aty.span, *ty, *bound)
             }
         }
       }
@@ -588,7 +588,7 @@ fn check_cast_for_escaping_regions(
     do ty::walk_ty(source_ty) |ty| {
         match ty::get(ty).sty {
           ty::ty_param(source_param) => {
-            if target_params.contains(source_param) {
+            if target_params.contains(&source_param) {
                 /* case (2) */
             } else {
                 check_owned(cx.tcx, ty, source.span); /* case (3) */
diff --git a/src/rustc/middle/lang_items.rs b/src/rustc/middle/lang_items.rs
index ea22e3a7809..7cb2c9eb9cf 100644
--- a/src/rustc/middle/lang_items.rs
+++ b/src/rustc/middle/lang_items.rs
@@ -179,7 +179,7 @@ impl LanguageItemCollector {
     }
 
     fn collect_local_language_items() {
-        let this = unsafe { ptr::addr_of(self) };
+        let this = unsafe { ptr::addr_of(&self) };
         visit_crate(*self.crate, (), mk_simple_visitor(@{
             visit_item: |item| {
                 for item.attrs.each |attribute| {
diff --git a/src/rustc/middle/lint.rs b/src/rustc/middle/lint.rs
index a6778d83b99..0f31f2056a1 100644
--- a/src/rustc/middle/lint.rs
+++ b/src/rustc/middle/lint.rs
@@ -149,7 +149,7 @@ fn get_lint_dict() -> lint_dict {
         (~"deprecated_mode",
          @{lint: deprecated_mode,
            desc: ~"warn about deprecated uses of modes",
-           default: allow}),
+           default: warn}),
 
         (~"deprecated_pattern",
          @{lint: deprecated_pattern,
@@ -159,7 +159,7 @@ fn get_lint_dict() -> lint_dict {
         (~"non_camel_case_types",
          @{lint: non_camel_case_types,
            desc: ~"types, variants and traits should have camel case names",
-           default: warn}),
+           default: allow}),
 
         (~"managed_heap_memory",
          @{lint: managed_heap_memory,
@@ -288,7 +288,7 @@ impl ctxt {
                     for metas.each |meta| {
                         match meta.node {
                           ast::meta_word(lintname) => {
-                            vec::push(triples, (*meta, *level, lintname));
+                            triples.push((*meta, *level, lintname));
                           }
                           _ => {
                             self.sess.span_err(
@@ -396,6 +396,7 @@ fn check_item(i: @ast::item, cx: ty::ctxt) {
     check_item_non_camel_case_types(cx, i);
     check_item_heap(cx, i);
     check_item_structural_records(cx, i);
+    check_item_deprecated_modes(cx, i);
 }
 
 // Take a visitor, and modify it so that it will not proceed past subitems.
@@ -666,43 +667,114 @@ fn check_fn(tcx: ty::ctxt, fk: visit::fn_kind, decl: ast::fn_decl,
     }
 
     let fn_ty = ty::node_id_to_type(tcx, id);
+    check_fn_deprecated_modes(tcx, fn_ty, decl, span, id);
+}
+
+fn check_fn_deprecated_modes(tcx: ty::ctxt, fn_ty: ty::t, decl: ast::fn_decl,
+                             span: span, id: ast::node_id) {
     match ty::get(fn_ty).sty {
-      ty::ty_fn(fn_ty) => {
-        let mut counter = 0;
-        do vec::iter2(fn_ty.sig.inputs, decl.inputs) |arg_ty, arg_ast| {
-            counter += 1;
-            debug!("arg %d, ty=%s, mode=%s",
-                   counter,
-                   ty_to_str(tcx, arg_ty.ty),
-                   mode_to_str(arg_ast.mode));
-            match arg_ast.mode {
-              ast::expl(ast::by_copy) => {
-                /* always allow by-copy */
-              }
+        ty::ty_fn(fn_ty) => {
+            let mut counter = 0;
+            for vec::each2(fn_ty.sig.inputs, decl.inputs) |arg_ty, arg_ast| {
+                counter += 1;
+                debug!("arg %d, ty=%s, mode=%s",
+                       counter,
+                       ty_to_str(tcx, arg_ty.ty),
+                       mode_to_str(arg_ast.mode));
+                match arg_ast.mode {
+                    ast::expl(ast::by_copy) => {
+                        if !tcx.legacy_modes {
+                            tcx.sess.span_lint(
+                                deprecated_mode, id, id, span,
+                                fmt!("argument %d uses by-copy mode",
+                                     counter));
+                        }
+                    }
 
-              ast::expl(_) => {
-                tcx.sess.span_lint(
-                    deprecated_mode, id, id,
-                    span,
-                    fmt!("argument %d uses an explicit mode", counter));
-              }
+                    ast::expl(_) => {
+                        tcx.sess.span_lint(
+                            deprecated_mode, id, id,
+                            span,
+                         fmt!("argument %d uses an explicit mode", counter));
+                    }
+
+                    ast::infer(_) => {
+                        if tcx.legacy_modes {
+                            let kind = ty::type_kind(tcx, arg_ty.ty);
+                            if !ty::kind_is_safe_for_default_mode(kind) {
+                                tcx.sess.span_lint(
+                                    deprecated_mode, id, id,
+                                    span,
+                                    fmt!("argument %d uses the default mode \
+                                          but shouldn't",
+                                         counter));
+                            }
+                        }
+                    }
+                }
 
-              ast::infer(_) => {
-                let kind = ty::type_kind(tcx, arg_ty.ty);
-                if !ty::kind_is_safe_for_default_mode(kind) {
-                    tcx.sess.span_lint(
-                        deprecated_mode, id, id,
-                        span,
-                        fmt!("argument %d uses the default mode \
-                              but shouldn't",
-                             counter));
+                match ty::get(arg_ty.ty).sty {
+                    ty::ty_fn(*) => {
+                        let span = arg_ast.ty.span;
+                        // Recurse to check fn-type argument
+                        match arg_ast.ty.node {
+                            ast::ty_fn(_, _, _, decl) => {
+                                check_fn_deprecated_modes(tcx, arg_ty.ty,
+                                                          decl, span, id);
+                            }
+                            ast::ty_path(*) => {
+                                // This is probably a typedef, so we can't
+                                // see the actual fn decl
+                                // e.g. fn foo(f: InitOp<T>)
+                            }
+                            ast::ty_rptr(_, mt)
+                            | ast::ty_box(mt)
+                            | ast::ty_uniq(mt) => {
+                                // Functions with preceding sigil are parsed
+                                // as pointers of functions
+                                match mt.ty.node {
+                                    ast::ty_fn(_, _, _, decl) => {
+                                        check_fn_deprecated_modes(
+                                            tcx, arg_ty.ty,
+                                            decl, span, id);
+                                    }
+                                    _ => fail
+                                }
+                            }
+                            _ => {
+                                tcx.sess.span_warn(span, ~"what");
+                                error!("arg %d, ty=%s, mode=%s",
+                                       counter,
+                                       ty_to_str(tcx, arg_ty.ty),
+                                       mode_to_str(arg_ast.mode));
+                                error!("%?",arg_ast.ty.node);
+                                fail
+                            }
+                        };
+                    }
+                    _ => ()
                 }
-              }
             }
         }
-      }
-      _ => tcx.sess.impossible_case(span, ~"check_fn: function has \
-             non-fn type")
+
+        _ => tcx.sess.impossible_case(span, ~"check_fn: function has \
+                                              non-fn type")
+    }
+}
+
+fn check_item_deprecated_modes(tcx: ty::ctxt, it: @ast::item) {
+    match it.node {
+        ast::item_ty(ty, _) => {
+            match ty.node {
+                ast::ty_fn(_, _, _, decl) => {
+                    let fn_ty = ty::node_id_to_type(tcx, it.id);
+                    check_fn_deprecated_modes(
+                        tcx, fn_ty, decl, ty.span, it.id)
+                }
+                _ => ()
+            }
+        }
+        _ => ()
     }
 }
 
diff --git a/src/rustc/middle/liveness.rs b/src/rustc/middle/liveness.rs
index a4c9b5f4b35..69b325b03a4 100644
--- a/src/rustc/middle/liveness.rs
+++ b/src/rustc/middle/liveness.rs
@@ -302,7 +302,7 @@ fn IrMaps(tcx: ty::ctxt, method_map: typeck::method_map,
 impl IrMaps {
     fn add_live_node(lnk: LiveNodeKind) -> LiveNode {
         let ln = LiveNode(self.num_live_nodes);
-        vec::push(self.lnks, lnk);
+        self.lnks.push(lnk);
         self.num_live_nodes += 1u;
 
         debug!("%s is of kind %?", ln.to_str(), lnk);
@@ -319,7 +319,7 @@ impl IrMaps {
 
     fn add_variable(vk: VarKind) -> Variable {
         let v = Variable(self.num_vars);
-        vec::push(self.var_kinds, vk);
+        self.var_kinds.push(vk);
         self.num_vars += 1u;
 
         match vk {
@@ -416,7 +416,7 @@ fn visit_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
     let fn_maps = @IrMaps(self.tcx, self.method_map,
                           self.last_use_map);
 
-    debug!("creating fn_maps: %x", ptr::addr_of(*fn_maps) as uint);
+    debug!("creating fn_maps: %x", ptr::addr_of(&(*fn_maps)) as uint);
 
     for decl.inputs.each |arg| {
         debug!("adding argument %d", arg.id);
@@ -540,7 +540,7 @@ fn visit_expr(expr: @expr, &&self: @IrMaps, vt: vt<@IrMaps>) {
                   cap_move | cap_drop => true, // var must be dead afterwards
                   cap_copy | cap_ref => false // var can still be used
                 };
-                vec::push(call_caps, {ln: cv_ln, is_move: is_move, rv: rv});
+                call_caps.push({ln: cv_ln, is_move: is_move, rv: rv});
               }
               None => {}
             }
@@ -659,7 +659,7 @@ impl Liveness {
           expr_path(_) => {
             let def = self.tcx.def_map.get(expr.id);
             relevant_def(def).map(
-                |rdef| self.variable_from_rdef(rdef, expr.span)
+                |rdef| self.variable_from_rdef(*rdef, expr.span)
             )
           }
           _ => None
@@ -675,7 +675,7 @@ impl Liveness {
         match self.tcx.def_map.find(node_id) {
           Some(def) => {
             relevant_def(def).map(
-                |rdef| self.variable_from_rdef(rdef, span)
+                |rdef| self.variable_from_rdef(*rdef, span)
             )
           }
           None => {
@@ -955,7 +955,7 @@ impl Liveness {
     fn propagate_through_block(blk: blk, succ: LiveNode) -> LiveNode {
         let succ = self.propagate_through_opt_expr(blk.node.expr, succ);
         do blk.node.stmts.foldr(succ) |stmt, succ| {
-            self.propagate_through_stmt(stmt, succ)
+            self.propagate_through_stmt(*stmt, succ)
         }
     }
 
@@ -975,7 +975,7 @@ impl Liveness {
         match decl.node {
           decl_local(locals) => {
             do locals.foldr(succ) |local, succ| {
-                self.propagate_through_local(local, succ)
+                self.propagate_through_local(*local, succ)
             }
           }
           decl_item(_) => {
@@ -1007,14 +1007,14 @@ impl Liveness {
     fn propagate_through_exprs(exprs: ~[@expr],
                                succ: LiveNode) -> LiveNode {
         do exprs.foldr(succ) |expr, succ| {
-            self.propagate_through_expr(expr, succ)
+            self.propagate_through_expr(*expr, succ)
         }
     }
 
     fn propagate_through_opt_expr(opt_expr: Option<@expr>,
                                   succ: LiveNode) -> LiveNode {
         do opt_expr.foldl(succ) |succ, expr| {
-            self.propagate_through_expr(expr, succ)
+            self.propagate_through_expr(*expr, *succ)
         }
     }
 
@@ -1396,7 +1396,7 @@ impl Liveness {
                 // Note: the field_map is empty unless we are in a ctor
                 return self.ir.field_map.find(fld).map(|var| {
                     let ln = self.live_node(expr.id, expr.span);
-                    (ln, var)
+                    (ln, *var)
                 });
               }
               _ => return None
@@ -1571,11 +1571,11 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
 
       expr_call(f, args, _) => {
         let targs = ty::ty_fn_args(ty::expr_ty(self.tcx, f));
-        do vec::iter2(args, targs) |arg_expr, arg_ty| {
+        for vec::each2(args, targs) |arg_expr, arg_ty| {
             match ty::resolved_mode(self.tcx, arg_ty.mode) {
                 by_val | by_copy | by_ref | by_mutbl_ref => {}
                 by_move => {
-                    self.check_move_from_expr(arg_expr, vt);
+                    self.check_move_from_expr(*arg_expr, vt);
                 }
             }
         }
diff --git a/src/rustc/middle/mem_categorization.rs b/src/rustc/middle/mem_categorization.rs
index 03d453a84f5..fe465db1312 100644
--- a/src/rustc/middle/mem_categorization.rs
+++ b/src/rustc/middle/mem_categorization.rs
@@ -612,7 +612,7 @@ impl &mem_categorization_ctxt {
                                 cmt: cmt) -> cmt {
         @{id: arg.id(), span: arg.span(),
           cat: cat_comp(cmt, comp_variant(enum_did)),
-          lp: cmt.lp.map(|l| @lp_comp(l, comp_variant(enum_did)) ),
+          lp: cmt.lp.map(|l| @lp_comp(*l, comp_variant(enum_did)) ),
           mutbl: cmt.mutbl, // imm iff in an immutable context
           ty: self.tcx.ty(arg)}
     }
@@ -649,7 +649,7 @@ impl &mem_categorization_ctxt {
         };
         let m = self.inherited_mutability(base_cmt.mutbl, f_mutbl);
         let f_comp = comp_field(f_name, f_mutbl);
-        let lp = base_cmt.lp.map(|lp| @lp_comp(lp, f_comp) );
+        let lp = base_cmt.lp.map(|lp| @lp_comp(*lp, f_comp) );
         @{id: node.id(), span: node.span(),
           cat: cat_comp(base_cmt, f_comp), lp:lp,
           mutbl: m, ty: self.tcx.ty(node)}
@@ -670,14 +670,14 @@ impl &mem_categorization_ctxt {
 
         match deref_kind(self.tcx, base_cmt.ty) {
             deref_ptr(ptr) => {
-                let lp = do base_cmt.lp.chain |l| {
+                let lp = do base_cmt.lp.chain_ref |l| {
                     // Given that the ptr itself is loanable, we can
                     // loan out deref'd uniq ptrs as the data they are
                     // the only way to reach the data they point at.
                     // Other ptr types admit aliases and are therefore
                     // not loanable.
                     match ptr {
-                        uniq_ptr => {Some(@lp_deref(l, ptr))}
+                        uniq_ptr => {Some(@lp_deref(*l, ptr))}
                         gc_ptr | region_ptr(_) | unsafe_ptr => {None}
                     }
                 };
@@ -699,7 +699,7 @@ impl &mem_categorization_ctxt {
             }
 
             deref_comp(comp) => {
-                let lp = base_cmt.lp.map(|l| @lp_comp(l, comp) );
+                let lp = base_cmt.lp.map(|l| @lp_comp(*l, comp) );
                 let m = self.inherited_mutability(base_cmt.mutbl, mt.mutbl);
                 @{id:node.id(), span:node.span(),
                   cat:cat_comp(base_cmt, comp), lp:lp,
@@ -724,7 +724,7 @@ impl &mem_categorization_ctxt {
             // (a) the contents are loanable if the base is loanable
             // and this is a *unique* vector
             let deref_lp = match ptr {
-              uniq_ptr => {base_cmt.lp.map(|lp| @lp_deref(lp, uniq_ptr))}
+              uniq_ptr => {base_cmt.lp.map(|lp| @lp_deref(*lp, uniq_ptr))}
               _ => {None}
             };
 
@@ -756,7 +756,7 @@ impl &mem_categorization_ctxt {
         fn comp(expr: @ast::expr, of_cmt: cmt,
                 vect: ty::t, mutbl: ast::mutability, ty: ty::t) -> cmt {
             let comp = comp_index(vect, mutbl);
-            let index_lp = of_cmt.lp.map(|lp| @lp_comp(lp, comp) );
+            let index_lp = of_cmt.lp.map(|lp| @lp_comp(*lp, comp) );
             @{id:expr.id, span:expr.span,
               cat:cat_comp(of_cmt, comp), lp:index_lp,
               mutbl:mutbl, ty:ty}
@@ -766,7 +766,7 @@ impl &mem_categorization_ctxt {
     fn cat_tuple_elt<N: ast_node>(elt: N, cmt: cmt) -> cmt {
         @{id: elt.id(), span: elt.span(),
           cat: cat_comp(cmt, comp_tuple),
-          lp: cmt.lp.map(|l| @lp_comp(l, comp_tuple) ),
+          lp: cmt.lp.map(|l| @lp_comp(*l, comp_tuple) ),
           mutbl: cmt.mutbl, // imm iff in an immutable context
           ty: self.tcx.ty(elt)}
     }
@@ -958,7 +958,7 @@ impl &mem_categorization_ctxt {
              self.cat_to_repr(cmt.cat),
              cmt.id,
              self.mut_to_str(cmt.mutbl),
-             cmt.lp.map_default(~"none", |p| self.lp_to_str(p) ),
+             cmt.lp.map_default(~"none", |p| self.lp_to_str(*p) ),
              ty_to_str(self.tcx, cmt.ty))
     }
 
diff --git a/src/rustc/middle/pat_util.rs b/src/rustc/middle/pat_util.rs
index e67b85b869c..006065988b9 100644
--- a/src/rustc/middle/pat_util.rs
+++ b/src/rustc/middle/pat_util.rs
@@ -54,6 +54,6 @@ fn pat_bindings(dm: resolve::DefMap, pat: @pat,
 
 fn pat_binding_ids(dm: resolve::DefMap, pat: @pat) -> ~[node_id] {
     let mut found = ~[];
-    pat_bindings(dm, pat, |_bm, b_id, _sp, _pt| vec::push(found, b_id) );
+    pat_bindings(dm, pat, |_bm, b_id, _sp, _pt| found.push(b_id) );
     return found;
 }
diff --git a/src/rustc/middle/privacy.rs b/src/rustc/middle/privacy.rs
index 6b0df4630da..4d291ceb590 100644
--- a/src/rustc/middle/privacy.rs
+++ b/src/rustc/middle/privacy.rs
@@ -56,7 +56,7 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
                             if method.vis == private &&
                                     (impl_id.crate != local_crate ||
                                      !privileged_items
-                                     .contains(impl_id.node)) {
+                                     .contains(&(impl_id.node))) {
                                 tcx.sess.span_err(span,
                                                   fmt!("method `%s` is \
                                                         private",
@@ -95,9 +95,9 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
                                     }
                                     match methods[method_num] {
                                         provided(method)
-                                                if method.vis == private &&
-                                                !privileged_items
-                                                .contains(trait_id.node) => {
+                                             if method.vis == private &&
+                                             !privileged_items
+                                             .contains(&(trait_id.node)) => {
                                             tcx.sess.span_err(span,
                                                               fmt!("method
                                                                     `%s` \
@@ -157,7 +157,7 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
                     match ty::get(ty::expr_ty(tcx, base)).sty {
                         ty_class(id, _)
                         if id.crate != local_crate ||
-                           !privileged_items.contains(id.node) => {
+                           !privileged_items.contains(&(id.node)) => {
                             match method_map.find(expr.id) {
                                 None => {
                                     debug!("(privacy checking) checking \
@@ -178,7 +178,7 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
                     match ty::get(ty::expr_ty(tcx, expr)).sty {
                         ty_class(id, _) => {
                             if id.crate != local_crate ||
-                                    !privileged_items.contains(id.node) {
+                                    !privileged_items.contains(&(id.node)) {
                                 for fields.each |field| {
                                         debug!("(privacy checking) checking \
                                                 field in struct literal");
@@ -205,7 +205,7 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
                     match ty::get(ty::pat_ty(tcx, pattern)).sty {
                         ty_class(id, _) => {
                             if id.crate != local_crate ||
-                                    !privileged_items.contains(id.node) {
+                                    !privileged_items.contains(&(id.node)) {
                                 for fields.each |field| {
                                         debug!("(privacy checking) checking \
                                                 struct pattern");
diff --git a/src/rustc/middle/region.rs b/src/rustc/middle/region.rs
index cf496ae6683..ff708b7f4ef 100644
--- a/src/rustc/middle/region.rs
+++ b/src/rustc/middle/region.rs
@@ -141,7 +141,7 @@ fn nearest_common_ancestor(region_map: region_map, scope_a: ast::node_id,
             match region_map.find(scope) {
                 None => return result,
                 Some(superscope) => {
-                    vec::push(result, superscope);
+                    result.push(superscope);
                     scope = superscope;
                 }
             }
@@ -485,7 +485,7 @@ impl determine_rp_ctxt {
             }
         };
         let dep = {ambient_variance: self.ambient_variance, id: self.item_id};
-        if !vec.contains(dep) { vec.push(dep); }
+        if !vec.contains(&dep) { vec.push(dep); }
     }
 
     // Determines whether a reference to a region that appears in the
diff --git a/src/rustc/middle/resolve.rs b/src/rustc/middle/resolve.rs
index f7c389e67ff..eca0687f2fd 100644
--- a/src/rustc/middle/resolve.rs
+++ b/src/rustc/middle/resolve.rs
@@ -167,8 +167,8 @@ enum CaptureClause {
 type ResolveVisitor = vt<()>;
 
 enum ModuleDef {
-    NoModuleDef,            // Does not define a module.
-    ModuleDef(@Module),     // Defines a module.
+    NoModuleDef,                     // Does not define a module.
+    ModuleDef(Privacy, @Module),     // Defines a module.
 }
 
 impl ModuleDef {
@@ -191,7 +191,7 @@ impl ImportDirectiveNS : cmp::Eq {
 
 /// Contains data for specific types of import directives.
 enum ImportDirectiveSubclass {
-    SingleImport(Atom /* target */, Atom /* source */, ImportDirectiveNS),
+    SingleImport(ident /* target */, ident /* source */, ImportDirectiveNS),
     GlobImport
 }
 
@@ -303,29 +303,15 @@ enum EnumVariantOrConstResolution {
     EnumVariantOrConstNotFound
 }
 
-// FIXME (issue #2550): Should be a class but then it becomes not implicitly
-// copyable due to a kind bug.
-
-type Atom = uint;
-
-fn Atom(n: uint) -> Atom {
-    return n;
-}
-
-/// Creates a hash table of atoms.
-fn atom_hashmap<V:Copy>() -> HashMap<Atom,V> {
-  HashMap::<Atom,V>()
-}
-
 /// One local scope.
 struct Rib {
-    bindings: HashMap<Atom,def_like>,
+    bindings: HashMap<ident,def_like>,
     kind: RibKind,
 }
 
 fn Rib(kind: RibKind) -> Rib {
     Rib {
-        bindings: atom_hashmap(),
+        bindings: HashMap(),
         kind: kind
     }
 }
@@ -333,15 +319,18 @@ fn Rib(kind: RibKind) -> Rib {
 
 /// One import directive.
 struct ImportDirective {
-    module_path: @DVec<Atom>,
+    privacy: Privacy,
+    module_path: @DVec<ident>,
     subclass: @ImportDirectiveSubclass,
     span: span,
 }
 
-fn ImportDirective(module_path: @DVec<Atom>,
+fn ImportDirective(privacy: Privacy,
+                   module_path: @DVec<ident>,
                    subclass: @ImportDirectiveSubclass,
                    span: span) -> ImportDirective {
     ImportDirective {
+        privacy: privacy,
         module_path: module_path,
         subclass: subclass,
         span: span
@@ -362,6 +351,7 @@ fn Target(target_module: @Module, bindings: @NameBindings) -> Target {
 }
 
 struct ImportResolution {
+    privacy: Privacy,
     span: span,
 
     // The number of outstanding references to this name. When this reaches
@@ -377,8 +367,9 @@ struct ImportResolution {
     mut used: bool,
 }
 
-fn ImportResolution(span: span) -> ImportResolution {
+fn ImportResolution(privacy: Privacy, span: span) -> ImportResolution {
     ImportResolution {
+        privacy: privacy,
         span: span,
         outstanding_references: 0u,
         module_target: None,
@@ -401,7 +392,7 @@ impl ImportResolution {
 /// The link from a module up to its nearest parent node.
 enum ParentLink {
     NoParentLink,
-    ModuleParentLink(@Module, Atom),
+    ModuleParentLink(@Module, ident),
     BlockParentLink(@Module, node_id)
 }
 
@@ -410,7 +401,7 @@ struct Module {
     parent_link: ParentLink,
     mut def_id: Option<def_id>,
 
-    children: HashMap<Atom,@NameBindings>,
+    children: HashMap<ident,@NameBindings>,
     imports: DVec<@ImportDirective>,
 
     // The anonymous children of this node. Anonymous children are pseudo-
@@ -433,10 +424,10 @@ struct Module {
     // XXX: This is about to be reworked so that exports are on individual
     // items, not names.
     //
-    // The atom is the name of the exported item, while the node ID is the
+    // The ident is the name of the exported item, while the node ID is the
     // ID of the export path.
 
-    exported_names: HashMap<Atom,node_id>,
+    exported_names: HashMap<ident,node_id>,
 
     // XXX: This is a transition measure to let us switch export-evaluation
     // logic when compiling modules that have transitioned to listing their
@@ -446,7 +437,7 @@ struct Module {
     legacy_exports: bool,
 
     // The status of resolving each import in this module.
-    import_resolutions: HashMap<Atom,@ImportResolution>,
+    import_resolutions: HashMap<ident,@ImportResolution>,
 
     // The number of unresolved globs that this module exports.
     mut glob_count: uint,
@@ -461,12 +452,12 @@ fn Module(parent_link: ParentLink,
     Module {
         parent_link: parent_link,
         def_id: def_id,
-        children: atom_hashmap(),
+        children: HashMap(),
         imports: DVec(),
         anonymous_children: HashMap(),
-        exported_names: atom_hashmap(),
+        exported_names: HashMap(),
         legacy_exports: legacy_exports,
-        import_resolutions: atom_hashmap(),
+        import_resolutions: HashMap(),
         glob_count: 0u,
         resolved_import_count: 0u
     }
@@ -533,13 +524,14 @@ struct NameBindings {
 impl NameBindings {
 
     /// Creates a new module in this set of name bindings.
-    fn define_module(parent_link: ParentLink,
+    fn define_module(privacy: Privacy,
+                     parent_link: ParentLink,
                      def_id: Option<def_id>,
                      legacy_exports: bool,
                      sp: span) {
         if self.module_def.is_none() {
             let module_ = @Module(parent_link, def_id, legacy_exports);
-            self.module_def = ModuleDef(module_);
+            self.module_def = ModuleDef(privacy, module_);
             self.module_span = Some(sp);
         }
     }
@@ -560,7 +552,7 @@ impl NameBindings {
     fn get_module_if_available() -> Option<@Module> {
         match self.module_def {
             NoModuleDef         => return None,
-            ModuleDef(module_)  => return Some(module_)
+            ModuleDef(_privacy, module_)  => return Some(module_)
         }
     }
 
@@ -574,7 +566,7 @@ impl NameBindings {
                 fail
                     ~"get_module called on a node with no module definition!";
             }
-            ModuleDef(module_) => {
+            ModuleDef(_, module_) => {
                 return module_;
             }
         }
@@ -599,12 +591,12 @@ impl NameBindings {
           ValueNS => return self.value_def,
           ModuleNS => match self.module_def {
             NoModuleDef => return None,
-            ModuleDef(module_) =>
+            ModuleDef(privacy, module_) =>
                 match module_.def_id {
                     None => return None,
                     Some(def_id) => {
                         return Some(Definition {
-                            privacy: Public,
+                            privacy: privacy,
                             def: def_mod(def_id)
                         });
                     }
@@ -641,20 +633,20 @@ fn NameBindings() -> NameBindings {
 
 /// Interns the names of the primitive types.
 struct PrimitiveTypeTable {
-    primitive_types: HashMap<Atom,prim_ty>,
+    primitive_types: HashMap<ident,prim_ty>,
 }
 
 impl PrimitiveTypeTable {
-    fn intern(intr: ident_interner, string: @~str,
+    fn intern(intr: @ident_interner, string: @~str,
               primitive_type: prim_ty) {
-        let atom = intr.intern(string);
-        self.primitive_types.insert(atom, primitive_type);
+        let ident = intr.intern(string);
+        self.primitive_types.insert(ident, primitive_type);
     }
 }
 
-fn PrimitiveTypeTable(intr: ident_interner) -> PrimitiveTypeTable {
+fn PrimitiveTypeTable(intr: @ident_interner) -> PrimitiveTypeTable {
     let table = PrimitiveTypeTable {
-        primitive_types: atom_hashmap()
+        primitive_types: HashMap()
     };
 
     table.intern(intr, @~"bool",    ty_bool);
@@ -703,7 +695,8 @@ fn Resolver(session: session, lang_items: LanguageItems,
 
     let graph_root = @NameBindings();
 
-    (*graph_root).define_module(NoParentLink,
+    (*graph_root).define_module(Public,
+                                NoParentLink,
                                 Some({ crate: 0, node: 0 }),
                                 has_legacy_export_attr(crate.node.attrs),
                                 crate.span);
@@ -735,7 +728,7 @@ fn Resolver(session: session, lang_items: LanguageItems,
         xray_context: NoXray,
         current_trait_refs: None,
 
-        self_atom: syntax::parse::token::special_idents::self_,
+        self_ident: syntax::parse::token::special_idents::self_,
         primitive_type_table: @PrimitiveTypeTable(session.
                                                   parse_sess.interner),
 
@@ -757,13 +750,13 @@ struct Resolver {
     lang_items: LanguageItems,
     crate: @crate,
 
-    intr: ident_interner,
+    intr: @ident_interner,
 
     graph_root: @NameBindings,
 
     unused_import_lint_level: level,
 
-    trait_info: HashMap<def_id,@HashMap<Atom,()>>,
+    trait_info: HashMap<def_id,@HashMap<ident,()>>,
     structs: HashMap<def_id,bool>,
 
     // The number of imports that are currently unresolved.
@@ -789,10 +782,10 @@ struct Resolver {
     // The trait that the current context can refer to.
     mut current_trait_refs: Option<@DVec<def_id>>,
 
-    // The atom for the keyword "self".
-    self_atom: Atom,
+    // The ident for the keyword "self".
+    self_ident: ident,
 
-    // The atoms for the primitive types.
+    // The idents for the primitive types.
     primitive_type_table: @PrimitiveTypeTable,
 
     // The four namespaces.
@@ -891,7 +884,7 @@ impl Resolver {
      * If this node does not have a module definition and we are not inside
      * a block, fails.
      */
-    fn add_child(name: Atom,
+    fn add_child(name: ident,
                  reduced_graph_parent: ReducedGraphParent,
                  // Pass in the namespaces for the child item so that we can
                  // check for duplicate items in the same namespace
@@ -929,7 +922,7 @@ impl Resolver {
                             namespace_to_str(ns),
                             self.session.str_of(name)));
                   do child.span_for_namespace(ns).iter() |sp| {
-                      self.session.span_note(sp,
+                      self.session.span_note(*sp,
                            #fmt("First definition of %s %s here:",
                                 namespace_to_str(ns),
                                 self.session.str_of(name)));
@@ -973,7 +966,8 @@ impl Resolver {
         return false;
     }
 
-    fn get_parent_link(parent: ReducedGraphParent, name: Atom) -> ParentLink {
+    fn get_parent_link(parent: ReducedGraphParent,
+                       name: ident) -> ParentLink {
         match parent {
             ModuleReducedGraphParent(module_) => {
                 return ModuleParentLink(module_, name);
@@ -986,22 +980,23 @@ impl Resolver {
                                     parent: ReducedGraphParent,
                                     &&visitor: vt<ReducedGraphParent>) {
 
-        let atom = item.ident;
+        let ident = item.ident;
         let sp = item.span;
         let legacy = match parent {
           ModuleReducedGraphParent(m) => m.legacy_exports
         };
+        let privacy = self.visibility_to_privacy(item.vis, legacy);
 
         match item.node {
             item_mod(module_) => {
               let legacy = has_legacy_export_attr(item.attrs);
-              let (name_bindings, new_parent) = self.add_child(atom, parent,
+              let (name_bindings, new_parent) = self.add_child(ident, parent,
                                                        ~[ModuleNS], sp);
 
-                let parent_link = self.get_parent_link(new_parent, atom);
+                let parent_link = self.get_parent_link(new_parent, ident);
                 let def_id = { crate: 0, node: item.id };
-              (*name_bindings).define_module(parent_link, Some(def_id),
-                                             legacy, sp);
+              (*name_bindings).define_module(privacy, parent_link,
+                                             Some(def_id), legacy, sp);
 
                 let new_parent =
                     ModuleReducedGraphParent((*name_bindings).get_module());
@@ -1012,13 +1007,13 @@ impl Resolver {
               let legacy = has_legacy_export_attr(item.attrs);
               let new_parent = match fm.sort {
                 named => {
-                  let (name_bindings, new_parent) = self.add_child(atom,
+                  let (name_bindings, new_parent) = self.add_child(ident,
                      parent, ~[ModuleNS], sp);
 
-                  let parent_link = self.get_parent_link(new_parent, atom);
+                  let parent_link = self.get_parent_link(new_parent, ident);
                   let def_id = { crate: 0, node: item.id };
-                  (*name_bindings).define_module(parent_link, Some(def_id),
-                                                 legacy, sp);
+                  (*name_bindings).define_module(privacy, parent_link,
+                                                 Some(def_id), legacy, sp);
 
                   ModuleReducedGraphParent((*name_bindings).get_module())
                 }
@@ -1032,48 +1027,42 @@ impl Resolver {
 
             // These items live in the value namespace.
             item_const(*) => {
-              let (name_bindings, _) = self.add_child(atom, parent,
+              let (name_bindings, _) = self.add_child(ident, parent,
                                                       ~[ValueNS], sp);
 
                 (*name_bindings).define_value
-                    (self.visibility_to_privacy(item.vis, legacy),
-                     def_const(local_def(item.id)),
-                     sp);
+                    (privacy, def_const(local_def(item.id)), sp);
             }
             item_fn(_, purity, _, _) => {
-              let (name_bindings, new_parent) = self.add_child(atom, parent,
+              let (name_bindings, new_parent) = self.add_child(ident, parent,
                                                         ~[ValueNS], sp);
 
                 let def = def_fn(local_def(item.id), purity);
-                (*name_bindings).define_value
-                    (self.visibility_to_privacy(item.vis, legacy), def, sp);
+                (*name_bindings).define_value(privacy, def, sp);
                 visit_item(item, new_parent, visitor);
             }
 
             // These items live in the type namespace.
             item_ty(*) => {
-              let (name_bindings, _) = self.add_child(atom, parent,
+              let (name_bindings, _) = self.add_child(ident, parent,
                                                       ~[TypeNS], sp);
 
                 (*name_bindings).define_type
-                    (self.visibility_to_privacy(item.vis, legacy),
-                     def_ty(local_def(item.id)),
-                     sp);
+                    (privacy, def_ty(local_def(item.id)), sp);
             }
 
             item_enum(enum_definition, _) => {
 
-              let (name_bindings, new_parent) = self.add_child(atom, parent,
+              let (name_bindings, new_parent) = self.add_child(ident, parent,
                                                                ~[TypeNS], sp);
 
                 (*name_bindings).define_type
-                    (self.visibility_to_privacy(item.vis, legacy),
-                     def_ty(local_def(item.id)),
-                     sp);
+                    (privacy, def_ty(local_def(item.id)), sp);
 
                 for enum_definition.variants.each |variant| {
                     self.build_reduced_graph_for_variant(*variant,
                                                          local_def(item.id),
+                                                         privacy,
                                                          new_parent,
                                                          visitor);
                 }
@@ -1085,22 +1074,17 @@ impl Resolver {
                     match struct_definition.ctor {
                     None => {
                         let (name_bindings, new_parent) =
-                            self.add_child(atom, parent, ~[TypeNS], sp);
+                            self.add_child(ident, parent, ~[TypeNS], sp);
 
                         (*name_bindings).define_type
-                            (self.visibility_to_privacy(item.vis, legacy),
-                             def_ty(local_def(item.id)),
-                             sp);
+                            (privacy, def_ty(local_def(item.id)), sp);
                         new_parent
                     }
                     Some(ctor) => {
                         let (name_bindings, new_parent) =
-                            self.add_child(atom, parent, ~[ValueNS, TypeNS],
+                            self.add_child(ident, parent, ~[ValueNS, TypeNS],
                                            sp);
 
-                        let privacy = self.visibility_to_privacy(item.vis,
-                                                                 legacy);
-
                         (*name_bindings).define_type
                             (privacy, def_ty(local_def(item.id)), sp);
 
@@ -1124,22 +1108,22 @@ impl Resolver {
             }
 
             item_trait(_, _, methods) => {
-              let (name_bindings, new_parent) = self.add_child(atom, parent,
+              let (name_bindings, new_parent) = self.add_child(ident, parent,
                                                                ~[TypeNS], sp);
 
                 // Add the names of all the methods to the trait info.
-                let method_names = @atom_hashmap();
+                let method_names = @HashMap();
                 for methods.each |method| {
                     let ty_m = trait_method_to_ty_method(*method);
 
-                    let atom = ty_m.ident;
+                    let ident = ty_m.ident;
                     // Add it to the trait info if not static,
                     // add it as a name in the enclosing module otherwise.
                     match ty_m.self_ty.node {
                       sty_static => {
                         // which parent to use??
                         let (method_name_bindings, _) =
-                            self.add_child(atom, new_parent, ~[ValueNS],
+                            self.add_child(ident, new_parent, ~[ValueNS],
                                            ty_m.span);
                         let def = def_static_method(local_def(ty_m.id),
                                                     ty_m.purity);
@@ -1147,7 +1131,7 @@ impl Resolver {
                             (Public, def, ty_m.span);
                       }
                       _ => {
-                        (*method_names).insert(atom, ());
+                        (*method_names).insert(ident, ());
                       }
                     }
                 }
@@ -1156,7 +1140,7 @@ impl Resolver {
                 self.trait_info.insert(def_id, method_names);
 
                 (*name_bindings).define_type
-                    (self.visibility_to_privacy(item.vis, legacy),
+                    (privacy,
                      def_ty(def_id),
                      sp);
                 visit_item(item, new_parent, visitor);
@@ -1172,17 +1156,20 @@ impl Resolver {
     // type and/or value namespaces.
     fn build_reduced_graph_for_variant(variant: variant,
                                        item_id: def_id,
+                                       +parent_privacy: Privacy,
                                        parent: ReducedGraphParent,
                                        &&visitor: vt<ReducedGraphParent>) {
 
-        let legacy = match parent {
-          ModuleReducedGraphParent(m) => m.legacy_exports
-        };
-
-        let atom = variant.node.name;
-        let (child, _) = self.add_child(atom, parent, ~[ValueNS],
+        let ident = variant.node.name;
+        let (child, _) = self.add_child(ident, parent, ~[ValueNS],
                                         variant.span);
-        let privacy = self.visibility_to_privacy(variant.node.vis, legacy);
+
+        let privacy;
+        match variant.node.vis {
+            public => privacy = Public,
+            private => privacy = Private,
+            inherited => privacy = parent_privacy
+        }
 
         match variant.node.kind {
             tuple_variant_kind(_) => {
@@ -1204,6 +1191,7 @@ impl Resolver {
                                      variant.span);
                 for enum_definition.variants.each |variant| {
                     self.build_reduced_graph_for_variant(*variant, item_id,
+                                                         parent_privacy,
                                                          parent, visitor);
                 }
             }
@@ -1218,6 +1206,10 @@ impl Resolver {
                                          parent: ReducedGraphParent,
                                          &&_visitor: vt<ReducedGraphParent>) {
 
+        let legacy = match parent {
+          ModuleReducedGraphParent(m) => m.legacy_exports
+        };
+        let privacy = self.visibility_to_privacy(view_item.vis, legacy);
         match view_item.node {
             view_item_import(view_paths) => {
                 for view_paths.each |view_path| {
@@ -1259,7 +1251,8 @@ impl Resolver {
                             let subclass = @SingleImport(binding,
                                                          source_ident,
                                                          ns);
-                            self.build_import_directive(module_,
+                            self.build_import_directive(privacy,
+                                                        module_,
                                                         module_path,
                                                         subclass,
                                                         view_path.span);
@@ -1270,14 +1263,16 @@ impl Resolver {
                                 let subclass = @SingleImport(name,
                                                              name,
                                                              AnyNS);
-                                self.build_import_directive(module_,
+                                self.build_import_directive(privacy,
+                                                            module_,
                                                             module_path,
                                                             subclass,
                                                             view_path.span);
                             }
                         }
                         view_path_glob(_, _) => {
-                            self.build_import_directive(module_,
+                            self.build_import_directive(privacy,
+                                                        module_,
                                                         module_path,
                                                         @GlobImport,
                                                         view_path.span);
@@ -1334,9 +1329,9 @@ impl Resolver {
                                 }
 
                                 for path_list_idents.each |path_list_ident| {
-                                    let atom = path_list_ident.node.name;
+                                    let ident = path_list_ident.node.name;
                                     let id = path_list_ident.node.id;
-                                    module_.exported_names.insert(atom, id);
+                                    module_.exported_names.insert(ident, id);
                                 }
                             }
                         }
@@ -1356,7 +1351,8 @@ impl Resolver {
                         let parent_link = ModuleParentLink
                             (self.get_module_from_parent(new_parent), name);
 
-                        (*child_name_bindings).define_module(parent_link,
+                        (*child_name_bindings).define_module(privacy,
+                                                             parent_link,
                                                              Some(def_id),
                                                              false,
                                                              view_item.span);
@@ -1428,7 +1424,7 @@ impl Resolver {
     fn handle_external_def(def: def, modules: HashMap<def_id, @Module>,
                            child_name_bindings: @NameBindings,
                            final_ident: ~str,
-                           atom: Atom, new_parent: ReducedGraphParent) {
+                           ident: ident, new_parent: ReducedGraphParent) {
         match def {
           def_mod(def_id) | def_foreign_mod(def_id) => {
             match copy child_name_bindings.module_def {
@@ -1436,11 +1432,12 @@ impl Resolver {
                 debug!("(building reduced graph for \
                         external crate) building module \
                         %s", final_ident);
-                let parent_link = self.get_parent_link(new_parent, atom);
+                let parent_link = self.get_parent_link(new_parent, ident);
 
                 match modules.find(def_id) {
                   None => {
-                    child_name_bindings.define_module(parent_link,
+                    child_name_bindings.define_module(Public,
+                                                      parent_link,
                                                       Some(def_id),
                                                       false,
                                                       dummy_sp());
@@ -1452,7 +1449,7 @@ impl Resolver {
                     // avoid creating cycles in the
                     // module graph.
 
-                    let resolution = @ImportResolution(dummy_sp());
+                    let resolution = @ImportResolution(Public, dummy_sp());
                     resolution.outstanding_references = 0;
 
                     match existing_module.parent_link {
@@ -1460,9 +1457,9 @@ impl Resolver {
                       BlockParentLink(*) => {
                         fail ~"can't happen";
                       }
-                      ModuleParentLink(parent_module, atom) => {
+                      ModuleParentLink(parent_module, ident) => {
 
-                        let name_bindings = parent_module.children.get(atom);
+                        let name_bindings = parent_module.children.get(ident);
 
                         resolution.module_target =
                             Some(Target(parent_module, name_bindings));
@@ -1472,11 +1469,11 @@ impl Resolver {
                     debug!("(building reduced graph for external crate) \
                             ... creating import resolution");
 
-                    new_parent.import_resolutions.insert(atom, resolution);
+                    new_parent.import_resolutions.insert(ident, resolution);
                   }
                 }
               }
-              ModuleDef(module_) => {
+              ModuleDef(_priv, module_) => {
                 debug!("(building reduced graph for \
                         external crate) already created \
                         module");
@@ -1504,7 +1501,7 @@ impl Resolver {
                 // Nothing to do.
               }
               Some(method_names) => {
-                let interned_method_names = @atom_hashmap();
+                let interned_method_names = @HashMap();
                 for method_names.each |method_data| {
                     let (method_name, self_ty) = *method_data;
                     debug!("(building reduced graph for \
@@ -1562,7 +1559,7 @@ impl Resolver {
                     path_entry.def_like);
 
             let mut pieces = split_str(path_entry.path_string, ~"::");
-            let final_ident_str = pop(pieces);
+            let final_ident_str = pieces.pop();
             let final_ident = self.session.ident_of(final_ident_str);
 
             // Find the module we need, creating modules along the way if we
@@ -1585,11 +1582,12 @@ impl Resolver {
                                 autovivifying %s", *ident_str);
                         let parent_link = self.get_parent_link(new_parent,
                                                                ident);
-                        (*child_name_bindings).define_module(parent_link,
-                                                       None, false,
+                        (*child_name_bindings).define_module(Public,
+                                                             parent_link,
+                                                             None, false,
                                                              dummy_sp());
                     }
-                    ModuleDef(_) => { /* Fall through. */ }
+                    ModuleDef(*) => { /* Fall through. */ }
                 }
 
                 current_module = (*child_name_bindings).get_module();
@@ -1625,12 +1623,14 @@ impl Resolver {
     }
 
     /// Creates and adds an import directive to the given module.
-    fn build_import_directive(module_: @Module,
-                              module_path: @DVec<Atom>,
+    fn build_import_directive(privacy: Privacy,
+                              module_: @Module,
+                              module_path: @DVec<ident>,
                               subclass: @ImportDirectiveSubclass,
                               span: span) {
 
-        let directive = @ImportDirective(module_path, subclass, span);
+        let directive = @ImportDirective(privacy, module_path,
+                                         subclass, span);
         module_.imports.push(directive);
 
         // Bump the reference count on the name. Or, if this is a glob, set
@@ -1638,12 +1638,21 @@ impl Resolver {
 
         match *subclass {
             SingleImport(target, _, _) => {
+                debug!("(building import directive) building import \
+                        directive: privacy %? %s::%s",
+                       privacy,
+                       self.idents_to_str(module_path.get()),
+                       self.session.str_of(target));
+
                 match module_.import_resolutions.find(target) {
                     Some(resolution) => {
+                        debug!("(building import directive) bumping \
+                                reference");
                         resolution.outstanding_references += 1u;
                     }
                     None => {
-                        let resolution = @ImportResolution(span);
+                        debug!("(building import directive) creating new");
+                        let resolution = @ImportResolution(privacy, span);
                         resolution.outstanding_references = 1u;
                         module_.import_resolutions.insert(target, resolution);
                     }
@@ -1755,17 +1764,17 @@ impl Resolver {
         }
     }
 
-    fn atoms_to_str(atoms: ~[Atom]) -> ~str {
+    fn idents_to_str(idents: ~[ident]) -> ~str {
         // XXX: str::connect should do this.
         let mut result = ~"";
         let mut first = true;
-        for atoms.each() |atom| {
+        for idents.each() |ident| {
             if first {
                 first = false;
             } else {
                 result += ~"::";
             }
-            result += self.session.str_of(*atom);
+            result += self.session.str_of(*ident);
         }
         // XXX: Shouldn't copy here. We need string builder functionality.
         return result;
@@ -1786,7 +1795,7 @@ impl Resolver {
 
         debug!("(resolving import for module) resolving import `%s::...` in \
                 `%s`",
-               self.atoms_to_str((*module_path).get()),
+               self.idents_to_str((*module_path).get()),
                self.module_to_str(module_));
 
         // One-level renaming imports of the form `import foo = bar;` are
@@ -1829,8 +1838,9 @@ impl Resolver {
                         }
                         GlobImport => {
                             let span = import_directive.span;
+                            let p = import_directive.privacy;
                             resolution_result =
-                                self.resolve_glob_import(module_,
+                                self.resolve_glob_import(p, module_,
                                                          containing_module,
                                                          span);
                         }
@@ -1872,8 +1882,8 @@ impl Resolver {
 
     fn resolve_single_import(module_: @Module,
                              containing_module: @Module,
-                             target: Atom,
-                             source: Atom)
+                             target: ident,
+                             source: ident)
                           -> ResolveResult<()> {
 
         debug!("(resolving single import) resolving `%s` = `%s::%s` from \
@@ -1965,6 +1975,12 @@ impl Resolver {
                                        namespace: Namespace)
                                     -> NamespaceResult {
 
+                            // Import resolutions must be declared with "pub"
+                            // in order to be exported.
+                            if import_resolution.privacy == Private {
+                                return UnboundResult;
+                            }
+
                             match (*import_resolution).
                                     target_for_namespace(namespace) {
                                 None => {
@@ -2062,8 +2078,8 @@ impl Resolver {
 
     fn resolve_single_module_import(module_: @Module,
                                     containing_module: @Module,
-                                    target: Atom,
-                                    source: Atom)
+                                    target: ident,
+                                    source: ident)
                                  -> ResolveResult<()> {
 
         debug!("(resolving single module import) resolving `%s` = `%s::%s` \
@@ -2196,7 +2212,8 @@ impl Resolver {
      * succeeds or bails out (as importing * from an empty module or a module
      * that exports nothing is valid).
      */
-    fn resolve_glob_import(module_: @Module,
+    fn resolve_glob_import(privacy: Privacy,
+                           module_: @Module,
                            containing_module: @Module,
                            span: span)
                         -> ResolveResult<()> {
@@ -2218,11 +2235,11 @@ impl Resolver {
 
         // Add all resolved imports from the containing module.
         for containing_module.import_resolutions.each
-                |atom, target_import_resolution| {
+                |ident, target_import_resolution| {
 
-            if !self.name_is_exported(containing_module, atom) {
+            if !self.name_is_exported(containing_module, ident) {
                 debug!("(resolving glob import) name `%s` is unexported",
-                       self.session.str_of(atom));
+                       self.session.str_of(ident));
                 loop;
             }
 
@@ -2232,11 +2249,12 @@ impl Resolver {
                    self.module_to_str(module_));
 
             // Here we merge two import resolutions.
-            match module_.import_resolutions.find(atom) {
+            match module_.import_resolutions.find(ident) {
                 None => {
                     // Simple: just copy the old import resolution.
                     let new_import_resolution =
-                        @ImportResolution(target_import_resolution.span);
+                        @ImportResolution(privacy,
+                                          target_import_resolution.span);
                     new_import_resolution.module_target =
                         copy target_import_resolution.module_target;
                     new_import_resolution.value_target =
@@ -2245,7 +2263,7 @@ impl Resolver {
                         copy target_import_resolution.type_target;
 
                     module_.import_resolutions.insert
-                        (atom, new_import_resolution);
+                        (ident, new_import_resolution);
                 }
                 Some(dest_import_resolution) => {
                     // Merge the two import resolutions at a finer-grained
@@ -2283,20 +2301,21 @@ impl Resolver {
         }
 
         // Add all children from the containing module.
-        for containing_module.children.each |atom, name_bindings| {
-            if !self.name_is_exported(containing_module, atom) {
+        for containing_module.children.each |ident, name_bindings| {
+            if !self.name_is_exported(containing_module, ident) {
                 debug!("(resolving glob import) name `%s` is unexported",
-                       self.session.str_of(atom));
+                       self.session.str_of(ident));
                 loop;
             }
 
             let mut dest_import_resolution;
-            match module_.import_resolutions.find(atom) {
+            match module_.import_resolutions.find(ident) {
                 None => {
                     // Create a new import resolution from this child.
-                    dest_import_resolution = @ImportResolution(span);
+                    dest_import_resolution = @ImportResolution(privacy,
+                                                               span);
                     module_.import_resolutions.insert
-                        (atom, dest_import_resolution);
+                        (ident, dest_import_resolution);
                 }
                 Some(existing_import_resolution) => {
                     dest_import_resolution = existing_import_resolution;
@@ -2306,7 +2325,7 @@ impl Resolver {
 
             debug!("(resolving glob import) writing resolution `%s` in `%s` \
                     to `%s`",
-                   self.session.str_of(atom),
+                   self.session.str_of(ident),
                    self.module_to_str(containing_module),
                    self.module_to_str(module_));
 
@@ -2333,7 +2352,7 @@ impl Resolver {
     }
 
     fn resolve_module_path_from_root(module_: @Module,
-                                     module_path: @DVec<Atom>,
+                                     module_path: @DVec<ident>,
                                      index: uint,
                                      xray: XrayFlag,
                                      span: span)
@@ -2372,7 +2391,7 @@ impl Resolver {
                                                            str_of(name)));
                             return Failed;
                         }
-                        ModuleDef(copy module_) => {
+                        ModuleDef(_, copy module_) => {
                             search_module = module_;
                         }
                     }
@@ -2390,7 +2409,7 @@ impl Resolver {
      * the given module.
      */
     fn resolve_module_path_for_import(module_: @Module,
-                                      module_path: @DVec<Atom>,
+                                      module_path: @DVec<ident>,
                                       xray: XrayFlag,
                                       span: span)
                                    -> ResolveResult<@Module> {
@@ -2400,7 +2419,7 @@ impl Resolver {
 
         debug!("(resolving module path for import) processing `%s` rooted at \
                `%s`",
-               self.atoms_to_str((*module_path).get()),
+               self.idents_to_str((*module_path).get()),
                self.module_to_str(module_));
 
         // The first element of the module path must be in the current scope
@@ -2431,7 +2450,7 @@ impl Resolver {
     }
 
     fn resolve_item_in_lexical_scope(module_: @Module,
-                                     name: Atom,
+                                     name: ident,
                                      namespace: Namespace)
                                   -> ResolveResult<Target> {
 
@@ -2517,7 +2536,7 @@ impl Resolver {
         }
     }
 
-    fn resolve_module_in_lexical_scope(module_: @Module, name: Atom)
+    fn resolve_module_in_lexical_scope(module_: @Module, name: ident)
                                     -> ResolveResult<@Module> {
 
         match self.resolve_item_in_lexical_scope(module_, name, ModuleNS) {
@@ -2528,7 +2547,7 @@ impl Resolver {
                                 wasn't actually a module!");
                         return Failed;
                     }
-                    ModuleDef(module_) => {
+                    ModuleDef(_, module_) => {
                         return Success(module_);
                     }
                 }
@@ -2546,7 +2565,7 @@ impl Resolver {
         }
     }
 
-    fn name_is_exported(module_: @Module, name: Atom) -> bool {
+    fn name_is_exported(module_: @Module, name: ident) -> bool {
         return !module_.legacy_exports ||
             module_.exported_names.size() == 0u ||
             module_.exported_names.contains_key(name);
@@ -2558,7 +2577,7 @@ impl Resolver {
      * the name.
      */
     fn resolve_name_in_module(module_: @Module,
-                              name: Atom,
+                              name: ident,
                               namespace: Namespace,
                               xray: XrayFlag)
                            -> ResolveResult<Target> {
@@ -2850,7 +2869,7 @@ impl Resolver {
 
         self.record_exports_for_module(module_);
 
-        for module_.children.each |_atom, child_name_bindings| {
+        for module_.children.each |_ident, child_name_bindings| {
             match child_name_bindings.get_module_if_available() {
                 None => {
                     // Nothing to do.
@@ -2886,15 +2905,20 @@ impl Resolver {
 
 
     fn add_exports_of_namebindings(exports2: &mut ~[Export2],
-                                   atom: Atom,
+                                   ident: ident,
                                    namebindings: @NameBindings,
                                    reexport: bool) {
         for [ModuleNS, TypeNS, ValueNS].each |ns| {
             match namebindings.def_for_namespace(*ns) {
                 Some(d) if d.privacy == Public => {
-                    vec::push(*exports2,  Export2 {
+                    debug!("(computing exports) YES: %s '%s' \
+                            => %?",
+                           if reexport { ~"reexport" } else { ~"export"},
+                           self.session.str_of(ident),
+                           def_id_of_def(d.def));
+                    exports2.push(Export2 {
                         reexport: reexport,
-                        name: self.session.str_of(atom),
+                        name: self.session.str_of(ident),
                         def_id: def_id_of_def(d.def)
                     });
                 }
@@ -2905,16 +2929,20 @@ impl Resolver {
 
     fn add_exports_for_module(exports2: &mut ~[Export2], module_: @Module) {
 
-        for module_.children.each_ref |atom, namebindings| {
-            self.add_exports_of_namebindings(exports2, *atom,
+        for module_.children.each_ref |ident, namebindings| {
+            debug!("(computing exports) maybe export '%s'",
+                   self.session.str_of(*ident));
+            self.add_exports_of_namebindings(exports2, *ident,
                                              *namebindings, false)
         }
 
-        for module_.import_resolutions.each_ref |atom, importresolution| {
+        for module_.import_resolutions.each_ref |ident, importresolution| {
             for [ModuleNS, TypeNS, ValueNS].each |ns| {
                 match importresolution.target_for_namespace(*ns) {
                     Some(target) => {
-                        self.add_exports_of_namebindings(exports2, *atom,
+                        debug!("(computing exports) maybe reexport '%s'",
+                               self.session.str_of(*ident));
+                        self.add_exports_of_namebindings(exports2, *ident,
                                                          target.bindings,
                                                          true)
                     }
@@ -2936,22 +2964,22 @@ impl Resolver {
                         // Nothing to do.
                     }
                     ChildNameDefinition(target_def) => {
-                        debug!("(computing exports) found child export '%s' \
+                        debug!("(computing exports) legacy export '%s' \
                                 for %?",
                                self.session.str_of(name),
                                module_.def_id);
-                        vec::push(*exports2, Export2 {
+                        exports2.push(Export2 {
                             reexport: false,
                             name: self.session.str_of(name),
                             def_id: def_id_of_def(target_def)
                         });
                     }
                     ImportNameDefinition(target_def) => {
-                        debug!("(computing exports) found reexport '%s' for \
+                        debug!("(computing exports) legacy reexport '%s' for \
                                 %?",
                                self.session.str_of(name),
                                module_.def_id);
-                        vec::push(*exports2, Export2 {
+                        exports2.push(Export2 {
                             reexport: true,
                             name: self.session.str_of(name),
                             def_id: def_id_of_def(target_def)
@@ -2980,7 +3008,7 @@ impl Resolver {
     // generate a fake "implementation scope" containing all the
     // implementations thus found, for compatibility with old resolve pass.
 
-    fn with_scope(name: Option<Atom>, f: fn()) {
+    fn with_scope(name: Option<ident>, f: fn()) {
         let orig_module = self.current_module;
 
         // Move down in the graph.
@@ -3120,7 +3148,7 @@ impl Resolver {
         return Some(dl_def(def));
     }
 
-    fn search_ribs(ribs: @DVec<@Rib>, name: Atom, span: span,
+    fn search_ribs(ribs: @DVec<@Rib>, name: ident, span: span,
                    allow_capturing_self: AllowCapturingSelfFlag)
                 -> Option<def_like> {
 
@@ -3201,7 +3229,7 @@ impl Resolver {
                 // Create a new rib for the self type.
                 let self_type_rib = @Rib(NormalRibKind);
                 (*self.type_ribs).push(self_type_rib);
-                self_type_rib.bindings.insert(self.self_atom,
+                self_type_rib.bindings.insert(self.self_ident,
                                               dl_def(def_self(item.id)));
 
                 // Create a new rib for the trait-wide type parameters.
@@ -3461,7 +3489,7 @@ impl Resolver {
                 }
                 HasSelfBinding(self_node_id) => {
                     let def_like = dl_def(def_self(self_node_id));
-                    (*function_value_rib).bindings.insert(self.self_atom,
+                    (*function_value_rib).bindings.insert(self.self_ident,
                                                           def_like);
                 }
             }
@@ -3796,7 +3824,7 @@ impl Resolver {
     fn resolve_arm(arm: arm, visitor: ResolveVisitor) {
         (*self.value_ribs).push(@Rib(NormalRibKind));
 
-        let bindings_list = atom_hashmap();
+        let bindings_list = HashMap();
         for arm.pats.each |pattern| {
             self.resolve_pattern(*pattern, RefutableMode, Immutable,
                                  Some(bindings_list), visitor);
@@ -3915,7 +3943,7 @@ impl Resolver {
                        mutability: Mutability,
                        // Maps idents to the node ID for the (outermost)
                        // pattern that binds them
-                       bindings_list: Option<HashMap<Atom,node_id>>,
+                       bindings_list: Option<HashMap<ident,node_id>>,
                        visitor: ResolveVisitor) {
 
         let pat_id = pattern.id;
@@ -3932,13 +3960,13 @@ impl Resolver {
                     // matching such a variant is simply disallowed (since
                     // it's rarely what you want).
 
-                    let atom = path.idents[0];
+                    let ident = path.idents[0];
 
-                    match self.resolve_enum_variant_or_const(atom) {
+                    match self.resolve_enum_variant_or_const(ident) {
                         FoundEnumVariant(def) if mode == RefutableMode => {
                             debug!("(resolving pattern) resolving `%s` to \
                                     enum variant",
-                                    self.session.str_of(atom));
+                                    self.session.str_of(ident));
 
                             self.record_def(pattern.id, def);
                         }
@@ -3948,7 +3976,7 @@ impl Resolver {
                                                         shadows an enum \
                                                         that's in scope",
                                                         self.session
-                                                        .str_of(atom)));
+                                                        .str_of(ident)));
                         }
                         FoundConst => {
                             self.session.span_err(pattern.span,
@@ -3958,7 +3986,7 @@ impl Resolver {
                         }
                         EnumVariantOrConstNotFound => {
                             debug!("(resolving pattern) binding `%s`",
-                                   self.session.str_of(atom));
+                                   self.session.str_of(ident));
 
                             let is_mutable = mutability == Mutable;
 
@@ -3989,14 +4017,14 @@ impl Resolver {
 
                             match bindings_list {
                                 Some(bindings_list)
-                                if !bindings_list.contains_key(atom) => {
+                                if !bindings_list.contains_key(ident) => {
                                     let last_rib = (*self.value_ribs).last();
-                                    last_rib.bindings.insert(atom,
+                                    last_rib.bindings.insert(ident,
                                                              dl_def(def));
-                                    bindings_list.insert(atom, pat_id);
+                                    bindings_list.insert(ident, pat_id);
                                 }
                                 Some(b) => {
-                                  if b.find(atom) == Some(pat_id) {
+                                  if b.find(ident) == Some(pat_id) {
                                       // Then this is a duplicate variable
                                       // in the same disjunct, which is an
                                       // error
@@ -4010,7 +4038,7 @@ impl Resolver {
                                 }
                                 None => {
                                     let last_rib = (*self.value_ribs).last();
-                                    last_rib.bindings.insert(atom,
+                                    last_rib.bindings.insert(ident,
                                                              dl_def(def));
                                 }
                             }
@@ -4088,7 +4116,7 @@ impl Resolver {
         }
     }
 
-    fn resolve_enum_variant_or_const(name: Atom)
+    fn resolve_enum_variant_or_const(name: ident)
                                   -> EnumVariantOrConstResolution {
 
         match self.resolve_item_in_lexical_scope(self.current_module,
@@ -4183,7 +4211,7 @@ impl Resolver {
 
     // XXX: Merge me with resolve_name_in_module?
     fn resolve_definition_of_name_in_module(containing_module: @Module,
-                                            name: Atom,
+                                            name: ident,
                                             namespace: Namespace,
                                             xray: XrayFlag)
                                          -> NameDefinition {
@@ -4215,7 +4243,8 @@ impl Resolver {
 
         // Next, search import resolutions.
         match containing_module.import_resolutions.find(name) {
-            Some(import_resolution) => {
+            Some(import_resolution) if import_resolution.privacy == Public ||
+                                       xray == Xray => {
                 match (*import_resolution).target_for_namespace(namespace) {
                     Some(target) => {
                         match (*target.bindings)
@@ -4238,23 +4267,23 @@ impl Resolver {
                     }
                 }
             }
-            None => {
+            Some(_) | None => {
                 return NoNameDefinition;
             }
         }
     }
 
-    fn intern_module_part_of_path(path: @path) -> @DVec<Atom> {
-        let module_path_atoms = @DVec();
+    fn intern_module_part_of_path(path: @path) -> @DVec<ident> {
+        let module_path_idents = @DVec();
         for path.idents.eachi |index, ident| {
             if index == path.idents.len() - 1u {
                 break;
             }
 
-            (*module_path_atoms).push(*ident);
+            (*module_path_idents).push(*ident);
         }
 
-        return module_path_atoms;
+        return module_path_idents;
     }
 
     fn resolve_module_relative_path(path: @path,
@@ -4262,19 +4291,19 @@ impl Resolver {
                                     namespace: Namespace)
                                  -> Option<def> {
 
-        let module_path_atoms = self.intern_module_part_of_path(path);
+        let module_path_idents = self.intern_module_part_of_path(path);
 
         let mut containing_module;
         match self.resolve_module_path_for_import(self.current_module,
-                                                module_path_atoms,
+                                                module_path_idents,
                                                 xray,
                                                 path.span) {
 
             Failed => {
                 self.session.span_err(path.span,
                                       fmt!("use of undeclared module `%s`",
-                                           self.atoms_to_str(
-                                               (*module_path_atoms).get())));
+                                           self.idents_to_str(
+                                               (*module_path_idents).get())));
                 return None;
             }
 
@@ -4307,13 +4336,13 @@ impl Resolver {
                                    namespace: Namespace)
                                 -> Option<def> {
 
-        let module_path_atoms = self.intern_module_part_of_path(path);
+        let module_path_idents = self.intern_module_part_of_path(path);
 
         let root_module = (*self.graph_root).get_module();
 
         let mut containing_module;
         match self.resolve_module_path_from_root(root_module,
-                                               module_path_atoms,
+                                               module_path_idents,
                                                0u,
                                                xray,
                                                path.span) {
@@ -4321,8 +4350,8 @@ impl Resolver {
             Failed => {
                 self.session.span_err(path.span,
                                       fmt!("use of undeclared module `::%s`",
-                                            self.atoms_to_str
-                                              ((*module_path_atoms).get())));
+                                            self.idents_to_str
+                                              ((*module_path_idents).get())));
                 return None;
             }
 
@@ -4654,7 +4683,7 @@ impl Resolver {
         }
     }
 
-    fn search_for_traits_containing_method(name: Atom) -> @DVec<def_id> {
+    fn search_for_traits_containing_method(name: ident) -> @DVec<def_id> {
         let found_traits = @DVec();
         let mut search_module = self.current_module;
         loop {
@@ -4693,7 +4722,7 @@ impl Resolver {
 
             // Look for imports.
             for search_module.import_resolutions.each
-                    |_atom, import_resolution| {
+                    |_ident, import_resolution| {
 
                 match import_resolution.target_for_namespace(TypeNS) {
                     None => {
@@ -4739,7 +4768,7 @@ impl Resolver {
 
     fn add_trait_info_if_containing_method(found_traits: @DVec<def_id>,
                                            trait_def_id: def_id,
-                                           name: Atom) {
+                                           name: ident) {
 
         match self.trait_info.find(trait_def_id) {
             Some(trait_info) if trait_info.contains_key(name) => {
@@ -4805,7 +4834,7 @@ impl Resolver {
 
         self.check_for_unused_imports_in_module(module_);
 
-        for module_.children.each |_atom, child_name_bindings| {
+        for module_.children.each |_ident, child_name_bindings| {
             match (*child_name_bindings).get_module_if_available() {
                 None => {
                     // Nothing to do.
@@ -4854,7 +4883,7 @@ impl Resolver {
 
     /// A somewhat inefficient routine to print out the name of a module.
     fn module_to_str(module_: @Module) -> ~str {
-        let atoms = DVec();
+        let idents = DVec();
         let mut current_module = module_;
         loop {
             match current_module.parent_link {
@@ -4862,27 +4891,27 @@ impl Resolver {
                     break;
                 }
                 ModuleParentLink(module_, name) => {
-                    atoms.push(name);
+                    idents.push(name);
                     current_module = module_;
                 }
                 BlockParentLink(module_, _) => {
-                    atoms.push(syntax::parse::token::special_idents::opaque);
+                    idents.push(syntax::parse::token::special_idents::opaque);
                     current_module = module_;
                 }
             }
         }
 
-        if atoms.len() == 0u {
+        if idents.len() == 0u {
             return ~"???";
         }
 
         let mut string = ~"";
-        let mut i = atoms.len() - 1u;
+        let mut i = idents.len() - 1u;
         loop {
-            if i < atoms.len() - 1u {
+            if i < idents.len() - 1u {
                 string += ~"::";
             }
-            string += self.session.str_of(atoms.get_elt(i));
+            string += self.session.str_of(idents.get_elt(i));
 
             if i == 0u {
                 break;
diff --git a/src/rustc/middle/trans/alt.rs b/src/rustc/middle/trans/alt.rs
index 11b694bcb1d..73f1e9bd119 100644
--- a/src/rustc/middle/trans/alt.rs
+++ b/src/rustc/middle/trans/alt.rs
@@ -305,7 +305,7 @@ fn enter_match(bcx: block, dm: DefMap, m: &[@Match/&r],
                     _ => {}
                 }
 
-                vec::push(result, @Match {pats: pats, data: br.data});
+                result.push(@Match {pats: pats, data: br.data});
             }
             None => ()
         }
@@ -398,8 +398,8 @@ fn enter_rec_or_struct(bcx: block, dm: DefMap, m: &[@Match/&r], col: uint,
                 let mut pats = ~[];
                 for vec::each(fields) |fname| {
                     match fpats.find(|p| p.ident == *fname) {
-                        None => vec::push(pats, dummy),
-                        Some(pat) => vec::push(pats, pat.pat)
+                        None => pats.push(dummy),
+                        Some(pat) => pats.push(pat.pat)
                     }
                 }
                 Some(pats)
@@ -514,7 +514,7 @@ fn enter_region(bcx: block, dm: DefMap, m: &[@Match/&r],
 
 fn get_options(ccx: @crate_ctxt, m: &[@Match], col: uint) -> ~[Opt] {
     fn add_to_set(tcx: ty::ctxt, set: &DVec<Opt>, val: Opt) {
-        if set.any(|l| opt_eq(tcx, &l, &val)) {return;}
+        if set.any(|l| opt_eq(tcx, l, &val)) {return;}
         set.push(val);
     }
 
@@ -581,8 +581,8 @@ fn collect_record_or_struct_fields(m: &[@Match], col: uint) -> ~[ast::ident] {
     fn extend(idents: &mut ~[ast::ident], field_pats: &[ast::field_pat]) {
         for field_pats.each |field_pat| {
             let field_ident = field_pat.ident;
-            if !vec::any(*idents, |x| x == field_ident) {
-                vec::push(*idents, field_ident);
+            if !vec::any(*idents, |x| *x == field_ident) {
+                idents.push(field_ident);
             }
         }
     }
@@ -1162,9 +1162,9 @@ fn trans_alt_inner(scope_cx: block,
         let arm_data = @ArmData {bodycx: body,
                                  arm: arm,
                                  bindings_map: bindings_map};
-        vec::push(arm_datas, arm_data);
+        arm_datas.push(arm_data);
         for vec::each(arm.pats) |p| {
-            vec::push(matches, @Match {pats: ~[*p], data: arm_data});
+            matches.push(@Match {pats: ~[*p], data: arm_data});
         }
     }
 
diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs
index 65a788991bf..0631d7b1ea4 100644
--- a/src/rustc/middle/trans/base.rs
+++ b/src/rustc/middle/trans/base.rs
@@ -57,7 +57,7 @@ struct icx_popper {
     ccx: @crate_ctxt,
     drop {
       if self.ccx.sess.count_llvm_insns() {
-          vec::pop(*(self.ccx.stats.llvm_insn_ctxt));
+          self.ccx.stats.llvm_insn_ctxt.pop();
       }
     }
 }
@@ -76,7 +76,7 @@ impl @crate_ctxt: get_insn_ctxt {
     fn insn_ctxt(s: &str) -> icx_popper {
         debug!("new insn_ctxt: %s", s);
         if self.sess.count_llvm_insns() {
-            vec::push(*self.stats.llvm_insn_ctxt, str::from_slice(s));
+            self.stats.llvm_insn_ctxt.push(str::from_slice(s));
         }
         icx_popper(self)
     }
@@ -98,7 +98,7 @@ fn log_fn_time(ccx: @crate_ctxt, name: ~str, start: time::Timespec,
                end: time::Timespec) {
     let elapsed = 1000 * ((end.sec - start.sec) as int) +
         ((end.nsec as int) - (start.nsec as int)) / 1000000;
-    vec::push(*ccx.stats.fn_times, {ident: name, time: elapsed});
+    ccx.stats.fn_times.push({ident: name, time: elapsed});
 }
 
 fn decl_fn(llmod: ModuleRef, name: ~str, cc: lib::llvm::CallConv,
@@ -383,7 +383,7 @@ fn get_res_dtor(ccx: @crate_ctxt, did: ast::def_id,
                 parent_id: ast::def_id, substs: ~[ty::t])
    -> ValueRef {
     let _icx = ccx.insn_ctxt("trans_res_dtor");
-    if (substs.len() > 0u) {
+    if (substs.is_not_empty()) {
         let did = if did.crate != ast::local_crate {
             inline::maybe_instantiate_inline(ccx, did)
         } else { did };
@@ -1153,7 +1153,7 @@ fn cleanup_and_leave(bcx: block, upto: Option<BasicBlockRef>,
             }
             let sub_cx = sub_block(bcx, ~"cleanup");
             Br(bcx, sub_cx.llbb);
-            vec::push(inf.cleanup_paths, {target: leave, dest: sub_cx.llbb});
+            inf.cleanup_paths.push({target: leave, dest: sub_cx.llbb});
             bcx = trans_block_cleanups_(sub_cx, block_cleanups(cur), is_lpad);
           }
           _ => ()
@@ -1252,7 +1252,7 @@ fn alloc_local(cx: block, local: @ast::local) -> block {
     let val = alloc_ty(cx, t);
     if cx.sess().opts.debuginfo {
         do option::iter(&simple_name) |name| {
-            str::as_c_str(cx.ccx().sess.str_of(name), |buf| {
+            str::as_c_str(cx.ccx().sess.str_of(*name), |buf| {
                 llvm::LLVMSetValueName(val, buf)
             });
         }
@@ -1406,9 +1406,9 @@ fn new_fn_ctxt_w_id(ccx: @crate_ctxt, path: path,
           mut llself: None,
           mut personality: None,
           mut loop_ret: None,
-          llargs: HashMap::<int,local_val>(),
-          lllocals: HashMap::<int,local_val>(),
-          llupvars: HashMap::<int,ValueRef>(),
+          llargs: HashMap(),
+          lllocals: HashMap(),
+          llupvars: HashMap(),
           id: id,
           param_substs: param_substs,
           span: sp,
@@ -1496,7 +1496,7 @@ fn copy_args_to_allocas(fcx: fn_ctxt,
 
         // For certain mode/type combinations, the raw llarg values are passed
         // by value.  However, within the fn body itself, we want to always
-        // have all locals and argumenst be by-ref so that we can cancel the
+        // have all locals and arguments be by-ref so that we can cancel the
         // cleanup and for better interaction with LLVM's debug info.  So, if
         // the argument would be passed by value, we store it into an alloca.
         // This alloca should be optimized away by LLVM's mem-to-reg pass in
@@ -1767,9 +1767,7 @@ fn trans_class_dtor(ccx: @crate_ctxt, path: path,
 
   /* The dtor takes a (null) output pointer, and a self argument,
      and returns () */
-  let lldty = T_fn(~[T_ptr(type_of(ccx, ty::mk_nil(tcx))),
-                    T_ptr(type_of(ccx, class_ty))],
-                   llvm::LLVMVoidType());
+  let lldty = type_of_dtor(ccx, class_ty);
 
   let s = get_dtor_symbol(ccx, path, dtor_id, psubsts);
 
@@ -1780,7 +1778,7 @@ fn trans_class_dtor(ccx: @crate_ctxt, path: path,
   /* If we're monomorphizing, register the monomorphized decl
      for the dtor */
     do option::iter(&hash_id) |h_id| {
-    ccx.monomorphized.insert(h_id, lldecl);
+    ccx.monomorphized.insert(*h_id, lldecl);
   }
   /* Translate the dtor body */
   trans_fn(ccx, path, ast_util::dtor_dec(),
@@ -1833,7 +1831,7 @@ fn trans_item(ccx: @crate_ctxt, item: ast::item) {
                                          *path,
                                          ~[path_name(item.ident)]),
                                      decl, body, llfndecl, item.id);
-        } else if tps.len() == 0u {
+        } else if tps.is_empty() {
             let llfndecl = get_item_val(ccx, item.id);
             trans_fn(ccx,
                      vec::append(*path, ~[path_name(item.ident)]),
@@ -2001,7 +1999,7 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
         let llenvarg = llvm::LLVMGetParam(llfdecl, 1 as c_uint);
         let mut args = ~[lloutputarg, llenvarg];
         if takes_argv {
-            vec::push(args, llvm::LLVMGetParam(llfdecl, 2 as c_uint));
+            args.push(llvm::LLVMGetParam(llfdecl, 2 as c_uint));
         }
         Call(bcx, main_llfn, args);
 
@@ -2315,7 +2313,7 @@ fn declare_intrinsics(llmod: ModuleRef) -> HashMap<~str, ValueRef> {
     let frameaddress = decl_cdecl_fn(llmod, ~"llvm.frameaddress",
                                      T_fn(T_frameaddress_args,
                                           T_ptr(T_i8())));
-    let intrinsics = HashMap::<~str,ValueRef>();
+    let intrinsics = HashMap();
     intrinsics.insert(~"llvm.gcroot", gcroot);
     intrinsics.insert(~"llvm.gcread", gcread);
     intrinsics.insert(~"llvm.memmove.p0i8.p0i8.i32", memmove32);
@@ -2349,10 +2347,15 @@ fn trap(bcx: block) {
 }
 
 fn push_rtcall(ccx: @crate_ctxt, name: ~str, did: ast::def_id) {
-    if ccx.rtcalls.contains_key(name) {
-        fail fmt!("multiple definitions for runtime call %s", name);
+    match ccx.rtcalls.find(name) {
+        Some(existing_did) if did != existing_did => {
+            ccx.sess.fatal(fmt!("multiple definitions for runtime call %s",
+                                name));
+        }
+        Some(_) | None => {
+            ccx.rtcalls.insert(name, did);
+        }
     }
-    ccx.rtcalls.insert(name, did);
 }
 
 fn gather_local_rtcalls(ccx: @crate_ctxt, crate: @ast::crate) {
@@ -2451,10 +2454,10 @@ fn create_module_map(ccx: @crate_ctxt) -> ValueRef {
     for ccx.module_data.each |key, val| {
         let elt = C_struct(~[p2i(ccx, C_cstr(ccx, key)),
                             p2i(ccx, val)]);
-        vec::push(elts, elt);
+        elts.push(elt);
     }
     let term = C_struct(~[C_int(ccx, 0), C_int(ccx, 0)]);
-    vec::push(elts, term);
+    elts.push(term);
     llvm::LLVMSetInitializer(map, C_array(elttype, elts));
     return map;
 }
@@ -2492,10 +2495,10 @@ fn fill_crate_map(ccx: @crate_ctxt, map: ValueRef) {
         let cr = str::as_c_str(nm, |buf| {
             llvm::LLVMAddGlobal(ccx.llmod, ccx.int_type, buf)
         });
-        vec::push(subcrates, p2i(ccx, cr));
+        subcrates.push(p2i(ccx, cr));
         i += 1;
     }
-    vec::push(subcrates, C_int(ccx, 0));
+    subcrates.push(C_int(ccx, 0));
 
     let llannihilatefn;
     let annihilate_def_id = ccx.tcx.lang_items.annihilate_fn.get();
@@ -2627,17 +2630,17 @@ fn trans_crate(sess: session::session,
           llmod: llmod,
           td: td,
           tn: tn,
-          externs: HashMap::<~str,ValueRef>(),
+          externs: HashMap(),
           intrinsics: intrinsics,
-          item_vals: HashMap::<int,ValueRef>(),
+          item_vals: HashMap(),
           exp_map2: emap2,
           reachable: reachable,
-          item_symbols: HashMap::<int,~str>(),
+          item_symbols: HashMap(),
           mut main_fn: None::<ValueRef>,
           link_meta: link_meta,
           enum_sizes: ty::new_ty_hash(),
           discrims: HashMap(),
-          discrim_symbols: HashMap::<int,~str>(),
+          discrim_symbols: HashMap(),
           tydescs: ty::new_ty_hash(),
           mut finished_tydescs: false,
           external: HashMap(),
@@ -2646,15 +2649,15 @@ fn trans_crate(sess: session::session,
           type_use_cache: HashMap(),
           vtables: map::HashMap(),
           const_cstr_cache: HashMap(),
-          const_globals: HashMap::<int,ValueRef>(),
-          module_data: HashMap::<~str,ValueRef>(),
+          const_globals: HashMap(),
+          module_data: HashMap(),
           lltypes: ty::new_ty_hash(),
           names: new_namegen(sess.parse_sess.interner),
           next_addrspace: new_addrspace_gen(),
           symbol_hasher: symbol_hasher,
           type_hashcodes: ty::new_ty_hash(),
           type_short_names: ty::new_ty_hash(),
-          all_llvm_symbols: HashMap::<~str,()>(),
+          all_llvm_symbols: HashMap(),
           tcx: tcx,
           maps: maps,
           stats:
@@ -2672,7 +2675,7 @@ fn trans_crate(sess: session::session,
           upcalls:
               upcall::declare_upcalls(targ_cfg, tn, tydesc_type,
                                       llmod),
-          rtcalls: HashMap::<~str,ast::def_id>(),
+          rtcalls: HashMap(),
           tydesc_type: tydesc_type,
           int_type: int_type,
           float_type: float_type,
@@ -2683,7 +2686,7 @@ fn trans_crate(sess: session::session,
           crate_map: crate_map,
           mut uses_gc: false,
           dbg_cx: dbg_cx,
-          class_ctors: HashMap::<int,ast::def_id>(),
+          class_ctors: HashMap(),
           mut do_not_commit_warning_issued: false};
 
 
@@ -2701,11 +2704,7 @@ fn trans_crate(sess: session::session,
 
     decl_gc_metadata(ccx, llmod_id);
     fill_crate_map(ccx, crate_map);
-    // NB: Must call force_declare_tydescs before emit_tydescs to break
-    // cyclical dependency with shape code! See shape.rs for details.
-    force_declare_tydescs(ccx);
     glue::emit_tydescs(ccx);
-    gen_shape_tables(ccx);
     write_abi_version(ccx);
 
     // Translate the metadata.
diff --git a/src/rustc/middle/trans/build.rs b/src/rustc/middle/trans/build.rs
index 865374054e6..69de8a2cca3 100644
--- a/src/rustc/middle/trans/build.rs
+++ b/src/rustc/middle/trans/build.rs
@@ -134,7 +134,7 @@ fn IndirectBr(cx: block, Addr: ValueRef, NumDests: uint) {
 // lot more efficient) than doing str::as_c_str("", ...) every time.
 fn noname() -> *libc::c_char unsafe {
     const cnull: uint = 0u;
-    return cast::reinterpret_cast(&ptr::addr_of(cnull));
+    return cast::reinterpret_cast(&ptr::addr_of(&cnull));
 }
 
 fn Invoke(cx: block, Fn: ValueRef, Args: ~[ValueRef],
@@ -435,7 +435,7 @@ fn GEP(cx: block, Pointer: ValueRef, Indices: ~[ValueRef]) -> ValueRef {
 // XXX: Use a small-vector optimization to avoid allocations here.
 fn GEPi(cx: block, base: ValueRef, ixs: &[uint]) -> ValueRef {
     let mut v: ~[ValueRef] = ~[];
-    for vec::each(ixs) |i| { vec::push(v, C_i32(*i as i32)); }
+    for vec::each(ixs) |i| { v.push(C_i32(*i as i32)); }
     count_insn(cx, "gepi");
     return InBoundsGEP(cx, base, v);
 }
@@ -629,8 +629,8 @@ fn Phi(cx: block, Ty: TypeRef, vals: ~[ValueRef], bbs: ~[BasicBlockRef])
 fn AddIncomingToPhi(phi: ValueRef, val: ValueRef, bb: BasicBlockRef) {
     if llvm::LLVMIsUndef(phi) == lib::llvm::True { return; }
     unsafe {
-        let valptr = cast::reinterpret_cast(&ptr::addr_of(val));
-        let bbptr = cast::reinterpret_cast(&ptr::addr_of(bb));
+        let valptr = cast::reinterpret_cast(&ptr::addr_of(&val));
+        let bbptr = cast::reinterpret_cast(&ptr::addr_of(&bb));
         llvm::LLVMAddIncoming(phi, valptr, bbptr, 1 as c_uint);
     }
 }
diff --git a/src/rustc/middle/trans/callee.rs b/src/rustc/middle/trans/callee.rs
index 3050297b360..e7b4dd171e3 100644
--- a/src/rustc/middle/trans/callee.rs
+++ b/src/rustc/middle/trans/callee.rs
@@ -478,10 +478,10 @@ fn trans_args(cx: block, llenv: ValueRef, args: CallArgs, fn_ty: ty::t,
             }
         }
     };
-    vec::push(llargs, llretslot);
+    llargs.push(llretslot);
 
     // Arg 1: Env (closure-bindings / self value)
-    vec::push(llargs, llenv);
+    llargs.push(llenv);
 
     // ... then explicit args.
 
@@ -497,11 +497,11 @@ fn trans_args(cx: block, llenv: ValueRef, args: CallArgs, fn_ty: ty::t,
                                if i == last { ret_flag } else { None },
                                autoref_arg)
             });
-            vec::push(llargs, arg_val);
+            llargs.push(arg_val);
         }
       }
       ArgVals(vs) => {
-        vec::push_all(llargs, vs);
+        llargs.push_all(vs);
       }
     }
 
@@ -537,7 +537,7 @@ fn trans_arg_expr(bcx: block,
             ret_flag=%?)",
            formal_ty.mode, bcx.ty_to_str(formal_ty.ty),
            bcx.expr_to_str(arg_expr),
-           ret_flag.map(|v| bcx.val_str(v)));
+           ret_flag.map(|v| bcx.val_str(*v)));
     let _indenter = indenter();
 
     // translate the arg expr to a datum
@@ -622,7 +622,7 @@ fn trans_arg_expr(bcx: block,
                         // However, we must cleanup should we fail before the
                         // callee is actually invoked.
                         scratch.add_clean(bcx);
-                        vec::push(*temp_cleanups, scratch.val);
+                        temp_cleanups.push(scratch.val);
 
                         match arg_datum.appropriate_mode() {
                             ByValue => {
diff --git a/src/rustc/middle/trans/closure.rs b/src/rustc/middle/trans/closure.rs
index 38526c223a1..1ab25a18329 100644
--- a/src/rustc/middle/trans/closure.rs
+++ b/src/rustc/middle/trans/closure.rs
@@ -259,16 +259,16 @@ fn build_closure(bcx0: block,
         match cap_var.mode {
             capture::cap_ref => {
                 assert ck == ty::ck_block;
-                vec::push(env_vals, EnvValue {action: EnvRef,
-                                              datum: datum});
+                env_vals.push(EnvValue {action: EnvRef,
+                                        datum: datum});
             }
             capture::cap_copy => {
-                vec::push(env_vals, EnvValue {action: EnvStore,
-                                              datum: datum});
+                env_vals.push(EnvValue {action: EnvStore,
+                                        datum: datum});
             }
             capture::cap_move => {
-                vec::push(env_vals, EnvValue {action: EnvMove,
-                                              datum: datum});
+                env_vals.push(EnvValue {action: EnvMove,
+                                        datum: datum});
             }
             capture::cap_drop => {
                 bcx = datum.drop_val(bcx);
@@ -281,10 +281,10 @@ fn build_closure(bcx0: block,
     // variables:
     do option::iter(&include_ret_handle) |flagptr| {
         // Flag indicating we have returned (a by-ref bool):
-        let flag_datum = Datum {val: flagptr, ty: ty::mk_bool(tcx),
+        let flag_datum = Datum {val: *flagptr, ty: ty::mk_bool(tcx),
                                 mode: ByRef, source: FromLvalue};
-        vec::push(env_vals, EnvValue {action: EnvRef,
-                                      datum: flag_datum});
+        env_vals.push(EnvValue {action: EnvRef,
+                                datum: flag_datum});
 
         // Return value (we just pass a by-ref () and cast it later to
         // the right thing):
@@ -295,8 +295,8 @@ fn build_closure(bcx0: block,
         let ret_casted = PointerCast(bcx, ret_true, T_ptr(T_nil()));
         let ret_datum = Datum {val: ret_casted, ty: ty::mk_nil(tcx),
                                mode: ByRef, source: FromLvalue};
-        vec::push(env_vals, EnvValue {action: EnvRef,
-                                      datum: ret_datum});
+        env_vals.push(EnvValue {action: EnvRef,
+                                datum: ret_datum});
     }
 
     return store_environment(bcx, env_vals, ck);
@@ -363,7 +363,7 @@ fn trans_expr_fn(bcx: block,
     let llfnty = type_of_fn_from_ty(ccx, fty);
     let sub_path = vec::append_one(bcx.fcx.path,
                                    path_name(special_idents::anon));
-    let s = mangle_internal_name_by_path(ccx, sub_path);
+    let s = mangle_internal_name_by_path_and_seq(ccx, sub_path, ~"expr_fn");
     let llfn = decl_internal_cdecl_fn(ccx.llmod, s, llfnty);
 
     let trans_closure_env = fn@(ck: ty::closure_kind) -> Result {
diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs
index a1ca4287f0e..6768f3e71a0 100644
--- a/src/rustc/middle/trans/common.rs
+++ b/src/rustc/middle/trans/common.rs
@@ -25,9 +25,9 @@ use syntax::parse::token::ident_interner;
 use syntax::ast::ident;
 
 type namegen = fn@(~str) -> ident;
-fn new_namegen(intr: ident_interner) -> namegen {
+fn new_namegen(intr: @ident_interner) -> namegen {
     return fn@(prefix: ~str) -> ident {
-        return intr.gensym(@fmt!("%s_%u", prefix, intr.gensym(@prefix)))
+        return intr.gensym(@fmt!("%s_%u", prefix, intr.gensym(@prefix).repr))
     };
 }
 
@@ -348,9 +348,9 @@ fn add_clean(bcx: block, val: ValueRef, t: ty::t) {
     let {root, rooted} = root_for_cleanup(bcx, val, t);
     let cleanup_type = cleanup_type(bcx.tcx(), t);
     do in_scope_cx(bcx) |info| {
-        vec::push(info.cleanups,
-                  clean(|a| glue::drop_ty_root(a, root, rooted, t),
-                        cleanup_type));
+        info.cleanups.push(
+            clean(|a| glue::drop_ty_root(a, root, rooted, t),
+                  cleanup_type));
         scope_clean_changed(info);
     }
 }
@@ -362,9 +362,9 @@ fn add_clean_temp_immediate(cx: block, val: ValueRef, ty: ty::t) {
            ty_to_str(cx.ccx().tcx, ty));
     let cleanup_type = cleanup_type(cx.tcx(), ty);
     do in_scope_cx(cx) |info| {
-        vec::push(info.cleanups,
-                  clean_temp(val, |a| glue::drop_ty_immediate(a, val, ty),
-                             cleanup_type));
+        info.cleanups.push(
+            clean_temp(val, |a| glue::drop_ty_immediate(a, val, ty),
+                       cleanup_type));
         scope_clean_changed(info);
     }
 }
@@ -376,9 +376,9 @@ fn add_clean_temp_mem(bcx: block, val: ValueRef, t: ty::t) {
     let {root, rooted} = root_for_cleanup(bcx, val, t);
     let cleanup_type = cleanup_type(bcx.tcx(), t);
     do in_scope_cx(bcx) |info| {
-        vec::push(info.cleanups,
-                  clean_temp(val, |a| glue::drop_ty_root(a, root, rooted, t),
-                             cleanup_type));
+        info.cleanups.push(
+            clean_temp(val, |a| glue::drop_ty_root(a, root, rooted, t),
+                       cleanup_type));
         scope_clean_changed(info);
     }
 }
@@ -388,8 +388,8 @@ fn add_clean_free(cx: block, ptr: ValueRef, heap: heap) {
       heap_exchange => |a| glue::trans_unique_free(a, ptr)
     };
     do in_scope_cx(cx) |info| {
-        vec::push(info.cleanups, clean_temp(ptr, free_fn,
-                                     normal_exit_and_unwind));
+        info.cleanups.push(clean_temp(ptr, free_fn,
+                                      normal_exit_and_unwind));
         scope_clean_changed(info);
     }
 }
@@ -402,7 +402,7 @@ fn revoke_clean(cx: block, val: ValueRef) {
     do in_scope_cx(cx) |info| {
         let cleanup_pos = vec::position(
             info.cleanups,
-            |cu| match cu {
+            |cu| match *cu {
                 clean_temp(v, _, _) if v == val => true,
                 _ => false
             });
@@ -472,7 +472,7 @@ type optional_boxed_ast_expr = Option<@ast::expr>;
 
 impl optional_boxed_ast_expr: get_node_info {
     fn info() -> Option<node_info> {
-        self.chain(|s| s.info())
+        self.chain_ref(|s| s.info())
     }
 }
 
@@ -645,7 +645,7 @@ impl block {
             fmt!("[block %d]", node_info.id)
           }
           None => {
-            fmt!("[block %x]", ptr::addr_of(*self) as uint)
+            fmt!("[block %x]", ptr::addr_of(&(*self)) as uint)
           }
         }
     }
@@ -1024,7 +1024,7 @@ fn C_cstr(cx: @crate_ctxt, s: ~str) -> ValueRef {
         llvm::LLVMConstString(buf, str::len(s) as c_uint, False)
     };
     let g =
-        str::as_c_str(fmt!("str%u", cx.names(~"str")),
+        str::as_c_str(fmt!("str%u", cx.names(~"str").repr),
                     |buf| llvm::LLVMAddGlobal(cx.llmod, val_ty(sc), buf));
     llvm::LLVMSetInitializer(g, sc);
     llvm::LLVMSetGlobalConstant(g, True);
@@ -1050,7 +1050,7 @@ fn C_postr(s: ~str) -> ValueRef {
 fn C_zero_byte_arr(size: uint) -> ValueRef unsafe {
     let mut i = 0u;
     let mut elts: ~[ValueRef] = ~[];
-    while i < size { vec::push(elts, C_u8(0u)); i += 1u; }
+    while i < size { elts.push(C_u8(0u)); i += 1u; }
     return llvm::LLVMConstArray(T_i8(), vec::raw::to_ptr(elts),
                              elts.len() as c_uint);
 }
@@ -1086,7 +1086,8 @@ fn C_bytes_plus_null(bytes: ~[u8]) -> ValueRef unsafe {
 
 fn C_shape(ccx: @crate_ctxt, bytes: ~[u8]) -> ValueRef {
     let llshape = C_bytes_plus_null(bytes);
-    let llglobal = str::as_c_str(fmt!("shape%u", ccx.names(~"shape")), |buf| {
+    let name = fmt!("shape%u", ccx.names(~"shape").repr);
+    let llglobal = str::as_c_str(name, |buf| {
         llvm::LLVMAddGlobal(ccx.llmod, val_ty(llshape), buf)
     });
     llvm::LLVMSetInitializer(llglobal, llshape);
@@ -1141,7 +1142,7 @@ impl mono_id_ : cmp::Eq {
 }
 
 impl mono_param_id : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         match self {
           mono_precise(t, mids) =>
           to_bytes::iter_bytes_3(&0u8, &ty::type_id(t), &mids, lsb0, f),
@@ -1155,7 +1156,7 @@ impl mono_param_id : to_bytes::IterBytes {
 }
 
 impl mono_id_ : core::to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         to_bytes::iter_bytes_2(&self.def, &self.params, lsb0, f);
     }
 }
@@ -1221,7 +1222,7 @@ fn node_id_type_params(bcx: block, id: ast::node_id) -> ~[ty::t] {
 fn node_vtables(bcx: block, id: ast::node_id) -> Option<typeck::vtable_res> {
     let raw_vtables = bcx.ccx().maps.vtable_map.find(id);
     raw_vtables.map(
-        |vts| meth::resolve_vtables_in_fn_ctxt(bcx.fcx, vts))
+        |vts| meth::resolve_vtables_in_fn_ctxt(bcx.fcx, *vts))
 }
 
 fn resolve_vtables_in_fn_ctxt(fcx: fn_ctxt, vts: typeck::vtable_res)
diff --git a/src/rustc/middle/trans/controlflow.rs b/src/rustc/middle/trans/controlflow.rs
index 5d8b0fbbbe1..ce32cd0a2dd 100644
--- a/src/rustc/middle/trans/controlflow.rs
+++ b/src/rustc/middle/trans/controlflow.rs
@@ -158,7 +158,7 @@ fn trans_log(log_ex: @ast::expr,
     let modpath = vec::append(
         ~[path_mod(ccx.sess.ident_of(ccx.link_meta.name))],
         vec::filter(bcx.fcx.path, |e|
-            match e { path_mod(_) => true, _ => false }
+            match *e { path_mod(_) => true, _ => false }
         ));
     let modname = path_str(ccx.sess, modpath);
 
@@ -344,3 +344,21 @@ fn trans_fail_value(bcx: block, sp_opt: Option<span>, V_fail_str: ValueRef)
     Unreachable(bcx);
     return bcx;
 }
+
+fn trans_fail_bounds_check(bcx: block, sp: span,
+                           index: ValueRef, len: ValueRef) -> block {
+    let _icx = bcx.insn_ctxt("trans_fail_bounds_check");
+    let ccx = bcx.ccx();
+
+    let loc = codemap::lookup_char_pos(bcx.sess().parse_sess.cm, sp.lo);
+    let line = C_int(ccx, loc.line as int);
+    let filename_cstr = C_cstr(bcx.ccx(), loc.file.name);
+    let filename = PointerCast(bcx, filename_cstr, T_ptr(T_i8()));
+
+    let args = ~[filename, line, index, len];
+    let bcx = callee::trans_rtcall(bcx, ~"fail_bounds_check", args,
+                                   expr::Ignore);
+    Unreachable(bcx);
+    return bcx;
+}
+
diff --git a/src/rustc/middle/trans/datum.rs b/src/rustc/middle/trans/datum.rs
index 3f2705a9bcc..241fa5e53af 100644
--- a/src/rustc/middle/trans/datum.rs
+++ b/src/rustc/middle/trans/datum.rs
@@ -146,7 +146,7 @@ impl DatumMode: cmp::Eq {
 }
 
 impl DatumMode: to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         (self as uint).iter_bytes(lsb0, f)
     }
 }
@@ -204,7 +204,7 @@ fn appropriate_mode(ty: ty::t) -> DatumMode {
     *
     * Indicates the "appropriate" mode for this value,
     * which is either by ref or by value, depending
-    * on whether type is iimmediate or what. */
+    * on whether type is immediate or not. */
 
     if ty::type_is_nil(ty) || ty::type_is_bot(ty) {
         ByValue
diff --git a/src/rustc/middle/trans/debuginfo.rs b/src/rustc/middle/trans/debuginfo.rs
index 9944daefea4..6cd4b49fa3b 100644
--- a/src/rustc/middle/trans/debuginfo.rs
+++ b/src/rustc/middle/trans/debuginfo.rs
@@ -90,7 +90,7 @@ type debug_ctxt = {
     crate_file: ~str
 };
 
-fn mk_ctxt(crate: ~str, intr: ident_interner) -> debug_ctxt {
+fn mk_ctxt(crate: ~str, intr: @ident_interner) -> debug_ctxt {
     {llmetadata: map::HashMap(),
      names: new_namegen(intr),
      crate_file: crate}
@@ -383,7 +383,7 @@ fn create_derived_type(type_tag: int, file: ValueRef, name: ~str, line: int,
 
 fn add_member(cx: @struct_ctxt, name: ~str, line: int, size: int, align: int,
               ty: ValueRef) {
-    vec::push(cx.members, create_derived_type(MemberTag, cx.file, name, line,
+    cx.members.push(create_derived_type(MemberTag, cx.file, name, line,
                                        size * 8, align * 8, cx.total_size,
                                        ty));
     cx.total_size += size * 8;
@@ -529,7 +529,7 @@ fn create_ty(_cx: @crate_ctxt, _t: ty::t, _ty: @ast::ty)
           ty::ty_rec(fields) {
             let fs = ~[];
             for field in fields {
-                vec::push(fs, {node: {ident: field.ident,
+                fs.push({node: {ident: field.ident,
                                mt: {ty: t_to_ty(cx, field.mt.ty, span),
                                     mutbl: field.mt.mutbl}},
                         span: span});
diff --git a/src/rustc/middle/trans/expr.rs b/src/rustc/middle/trans/expr.rs
index 0a38e19a26c..57439daca2f 100644
--- a/src/rustc/middle/trans/expr.rs
+++ b/src/rustc/middle/trans/expr.rs
@@ -813,7 +813,7 @@ fn trans_local_var(bcx: block, ref_id: ast::node_id, def: ast::def) -> Datum {
                   nid: ast::node_id) -> Datum {
         let is_last_use = match bcx.ccx().maps.last_use_map.find(ref_id) {
             None => false,
-            Some(vars) => (*vars).contains(nid)
+            Some(vars) => (*vars).contains(&nid)
         };
 
         let source = if is_last_use {FromLastUseLvalue} else {FromLvalue};
@@ -946,7 +946,9 @@ fn trans_index(bcx: block,
 
     let bounds_check = ICmp(bcx, lib::llvm::IntUGE, scaled_ix, len);
     let bcx = do with_cond(bcx, bounds_check) |bcx| {
-        controlflow::trans_fail(bcx, Some(index_expr.span), ~"bounds check")
+        let unscaled_len = UDiv(bcx, len, vt.llunit_size);
+        controlflow::trans_fail_bounds_check(bcx, index_expr.span,
+                                             ix_val, unscaled_len)
     };
     let elt = InBoundsGEP(bcx, base, ~[ix_val]);
     let elt = PointerCast(bcx, elt, T_ptr(vt.llunit_ty));
@@ -993,7 +995,7 @@ fn trans_rec_or_struct(bcx: block,
             let dest = GEPi(bcx, addr, struct_field(ix));
             bcx = trans_into(bcx, field.node.expr, SaveIn(dest));
             add_clean_temp_mem(bcx, dest, field_tys[ix].mt.ty);
-            vec::push(temp_cleanups, dest);
+            temp_cleanups.push(dest);
         }
 
         // copy over any remaining fields from the base (for
@@ -1046,7 +1048,7 @@ fn trans_tup(bcx: block, elts: ~[@ast::expr], dest: Dest) -> block {
         let e_ty = expr_ty(bcx, *e);
         bcx = trans_into(bcx, *e, SaveIn(dest));
         add_clean_temp_mem(bcx, dest, e_ty);
-        vec::push(temp_cleanups, dest);
+        temp_cleanups.push(dest);
     }
     for vec::each(temp_cleanups) |cleanup| {
         revoke_clean(bcx, *cleanup);
diff --git a/src/rustc/middle/trans/foreign.rs b/src/rustc/middle/trans/foreign.rs
index e775b3fd746..74dadd2cab4 100644
--- a/src/rustc/middle/trans/foreign.rs
+++ b/src/rustc/middle/trans/foreign.rs
@@ -92,7 +92,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
             Double => 8,
             Struct => {
               do vec::foldl(0, struct_tys(ty)) |a, t| {
-                  uint::max(a, ty_align(t))
+                  uint::max(a, ty_align(*t))
               }
             }
             Array => {
@@ -113,7 +113,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
             Double => 8,
             Struct => {
               do vec::foldl(0, struct_tys(ty)) |s, t| {
-                    s + ty_size(t)
+                    s + ty_size(*t)
                 }
             }
             Array => {
@@ -297,21 +297,21 @@ fn llreg_ty(cls: ~[x86_64_reg_class]) -> TypeRef {
     while i < e {
         match cls[i] {
             integer_class => {
-                vec::push(tys, T_i64());
+                tys.push(T_i64());
             }
             sse_fv_class => {
                 let vec_len = llvec_len(vec::tailn(cls, i + 1u)) * 2u;
                 let vec_ty = llvm::LLVMVectorType(T_f32(),
                                                   vec_len as c_uint);
-                vec::push(tys, vec_ty);
+                tys.push(vec_ty);
                 i += vec_len;
                 loop;
             }
             sse_fs_class => {
-                vec::push(tys, T_f32());
+                tys.push(T_f32());
             }
             sse_ds_class => {
-                vec::push(tys, T_f64());
+                tys.push(T_f64());
             }
             _ => fail ~"llregtype: unhandled class"
         }
@@ -378,8 +378,8 @@ fn x86_64_tys(atys: ~[TypeRef],
     let mut attrs = ~[];
     for vec::each(atys) |t| {
         let (ty, attr) = x86_64_ty(*t, is_pass_byval, ByValAttribute);
-        vec::push(arg_tys, ty);
-        vec::push(attrs, attr);
+        arg_tys.push(ty);
+        attrs.push(attr);
     }
     let mut (ret_ty, ret_attr) = x86_64_ty(rty, is_ret_bysret,
                                        StructRetAttribute);
@@ -619,7 +619,7 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
                         } else {
                             load_inbounds(bcx, llargbundle, [0u, i])
                         };
-                        vec::push(llargvals, llargval);
+                        llargvals.push(llargval);
                         i += 1u;
                     }
                 }
@@ -627,7 +627,7 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
                     while i < n {
                         let llargval = load_inbounds(bcx, llargbundle,
                                                           [0u, i]);
-                        vec::push(llargvals, llargval);
+                        llargvals.push(llargval);
                         i += 1u;
                     }
                 }
@@ -1041,12 +1041,12 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
             let mut i = 0u;
             let n = vec::len(tys.arg_tys);
             let llretptr = load_inbounds(bcx, llargbundle, ~[0u, n]);
-            vec::push(llargvals, llretptr);
+            llargvals.push(llretptr);
             let llenvptr = C_null(T_opaque_box_ptr(bcx.ccx()));
-            vec::push(llargvals, llenvptr);
+            llargvals.push(llenvptr);
             while i < n {
                 let llargval = load_inbounds(bcx, llargbundle, ~[0u, i]);
-                vec::push(llargvals, llargval);
+                llargvals.push(llargval);
                 i += 1u;
             }
             return llargvals;
diff --git a/src/rustc/middle/trans/glue.rs b/src/rustc/middle/trans/glue.rs
index 8ac42bc2284..a8a750cd4be 100644
--- a/src/rustc/middle/trans/glue.rs
+++ b/src/rustc/middle/trans/glue.rs
@@ -192,16 +192,16 @@ fn lazily_emit_simplified_tydesc_glue(ccx: @crate_ctxt, field: uint,
         lazily_emit_tydesc_glue(ccx, field, simpl_ti);
         if field == abi::tydesc_field_take_glue {
             ti.take_glue =
-                simpl_ti.take_glue.map(|v| cast_glue(ccx, ti, v));
+                simpl_ti.take_glue.map(|v| cast_glue(ccx, ti, *v));
         } else if field == abi::tydesc_field_drop_glue {
             ti.drop_glue =
-                simpl_ti.drop_glue.map(|v| cast_glue(ccx, ti, v));
+                simpl_ti.drop_glue.map(|v| cast_glue(ccx, ti, *v));
         } else if field == abi::tydesc_field_free_glue {
             ti.free_glue =
-                simpl_ti.free_glue.map(|v| cast_glue(ccx, ti, v));
+                simpl_ti.free_glue.map(|v| cast_glue(ccx, ti, *v));
         } else if field == abi::tydesc_field_visit_glue {
             ti.visit_glue =
-                simpl_ti.visit_glue.map(|v| cast_glue(ccx, ti, v));
+                simpl_ti.visit_glue.map(|v| cast_glue(ccx, ti, *v));
         }
         return true;
     }
@@ -398,7 +398,7 @@ fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) {
       ty::ty_class(did, ref substs) => {
         // Call the dtor if there is one
         do option::map_default(&ty::ty_dtor(bcx.tcx(), did), bcx) |dt_id| {
-            trans_class_drop(bcx, v, dt_id, did, substs)
+            trans_class_drop(bcx, v, *dt_id, did, substs)
         }
       }
       _ => bcx
@@ -426,8 +426,8 @@ fn trans_class_drop(bcx: block,
         // Class dtors have no explicit args, so the params should
         // just consist of the output pointer and the environment
         // (self)
-        assert(params.len() == 2u);
-        let self_arg = PointerCast(bcx, v0, params[1u]);
+        assert(params.len() == 2);
+        let self_arg = PointerCast(bcx, v0, params[1]);
         let args = ~[bcx.fcx.llretptr, self_arg];
         Call(bcx, dtor_addr, args);
 
@@ -440,7 +440,7 @@ fn trans_class_drop(bcx: block,
             bcx = drop_ty(bcx, llfld_a, fld.mt.ty);
         }
 
-        Store(bcx, C_u8(0u), drop_flag);
+        Store(bcx, C_u8(0), drop_flag);
         bcx
     }
 }
@@ -679,7 +679,7 @@ fn emit_tydescs(ccx: @crate_ctxt) {
     let _icx = ccx.insn_ctxt("emit_tydescs");
     // As of this point, allow no more tydescs to be created.
     ccx.finished_tydescs = true;
-    for ccx.tydescs.each |key, val| {
+    for ccx.tydescs.each |_key, val| {
         let glue_fn_ty = T_ptr(T_generic_glue_fn(ccx));
         let ti = val;
 
@@ -720,10 +720,8 @@ fn emit_tydescs(ccx: @crate_ctxt) {
               }
             };
 
-        let shape = shape_of(ccx, key);
-        let shape_tables =
-            llvm::LLVMConstPointerCast(ccx.shape_cx.llshapetables,
-                                       T_ptr(T_i8()));
+        let shape = C_null(T_ptr(T_i8()));
+        let shape_tables = C_null(T_ptr(T_i8()));
 
         let tydesc =
             C_named_struct(ccx.tydesc_type,
@@ -733,7 +731,7 @@ fn emit_tydescs(ccx: @crate_ctxt) {
                              drop_glue, // drop_glue
                              free_glue, // free_glue
                              visit_glue, // visit_glue
-                             C_shape(ccx, shape), // shape
+                             shape, // shape
                              shape_tables]); // shape_tables
 
         let gvar = ti.tydesc;
diff --git a/src/rustc/middle/trans/inline.rs b/src/rustc/middle/trans/inline.rs
index 08e9cde6ac5..76888471bf9 100644
--- a/src/rustc/middle/trans/inline.rs
+++ b/src/rustc/middle/trans/inline.rs
@@ -49,7 +49,7 @@ fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id)
               ast::item_enum(_, _) => {
                 let vs_here = ty::enum_variants(ccx.tcx, local_def(item.id));
                 let vs_there = ty::enum_variants(ccx.tcx, parent_id);
-                do vec::iter2(*vs_here, *vs_there) |here, there| {
+                for vec::each2(*vs_here, *vs_there) |here, there| {
                     if there.id == fn_id { my_id = here.id.node; }
                     ccx.external.insert(there.id, Some(here.id.node));
                 }
diff --git a/src/rustc/middle/trans/machine.rs b/src/rustc/middle/trans/machine.rs
new file mode 100644
index 00000000000..5515d80f4bd
--- /dev/null
+++ b/src/rustc/middle/trans/machine.rs
@@ -0,0 +1,148 @@
+// Information concerning the machine representation of various types.
+
+use middle::trans::common::*;
+
+// Creates a simpler, size-equivalent type. The resulting type is guaranteed
+// to have (a) the same size as the type that was passed in; (b) to be non-
+// recursive. This is done by replacing all boxes in a type with boxed unit
+// types.
+// This should reduce all pointers to some simple pointer type, to
+// ensure that we don't recurse endlessly when computing the size of a
+// nominal type that has pointers to itself in it.
+pub fn simplify_type(tcx: ty::ctxt, typ: ty::t) -> ty::t {
+    fn nilptr(tcx: ty::ctxt) -> ty::t {
+        ty::mk_ptr(tcx, {ty: ty::mk_nil(tcx), mutbl: ast::m_imm})
+    }
+    fn simplifier(tcx: ty::ctxt, typ: ty::t) -> ty::t {
+        match ty::get(typ).sty {
+          ty::ty_box(_) | ty::ty_opaque_box | ty::ty_uniq(_) |
+          ty::ty_evec(_, ty::vstore_uniq) | ty::ty_evec(_, ty::vstore_box) |
+          ty::ty_estr(ty::vstore_uniq) | ty::ty_estr(ty::vstore_box) |
+          ty::ty_ptr(_) | ty::ty_rptr(_,_) => nilptr(tcx),
+          ty::ty_fn(_) => ty::mk_tup(tcx, ~[nilptr(tcx), nilptr(tcx)]),
+          ty::ty_evec(_, ty::vstore_slice(_)) |
+          ty::ty_estr(ty::vstore_slice(_)) => {
+            ty::mk_tup(tcx, ~[nilptr(tcx), ty::mk_int(tcx)])
+          }
+          // Reduce a class type to a record type in which all the fields are
+          // simplified
+          ty::ty_class(did, ref substs) => {
+            let simpl_fields = (if ty::ty_dtor(tcx, did).is_some() {
+                // remember the drop flag
+                  ~[{ident: syntax::parse::token::special_idents::dtor,
+                     mt: {ty: ty::mk_u8(tcx),
+                          mutbl: ast::m_mutbl}}] }
+                else { ~[] }) +
+                do ty::lookup_class_fields(tcx, did).map |f| {
+                 let t = ty::lookup_field_type(tcx, did, f.id, substs);
+                 {ident: f.ident,
+                  mt: {ty: simplify_type(tcx, t), mutbl: ast::m_const}}
+            };
+            ty::mk_rec(tcx, simpl_fields)
+          }
+          _ => typ
+        }
+    }
+    ty::fold_ty(tcx, typ, |t| simplifier(tcx, t))
+}
+
+// ______________________________________________________________________
+// compute sizeof / alignof
+
+pub type metrics = {
+    bcx: block,
+    sz: ValueRef,
+    align: ValueRef
+};
+
+pub type tag_metrics = {
+    bcx: block,
+    sz: ValueRef,
+    align: ValueRef,
+    payload_align: ValueRef
+};
+
+// Returns the number of bytes clobbered by a Store to this type.
+pub fn llsize_of_store(cx: @crate_ctxt, t: TypeRef) -> uint {
+    return llvm::LLVMStoreSizeOfType(cx.td.lltd, t) as uint;
+}
+
+// Returns the number of bytes between successive elements of type T in an
+// array of T. This is the "ABI" size. It includes any ABI-mandated padding.
+pub fn llsize_of_alloc(cx: @crate_ctxt, t: TypeRef) -> uint {
+    return llvm::LLVMABISizeOfType(cx.td.lltd, t) as uint;
+}
+
+// Returns, as near as we can figure, the "real" size of a type. As in, the
+// bits in this number of bytes actually carry data related to the datum
+// with the type. Not junk, padding, accidentally-damaged words, or
+// whatever. Rounds up to the nearest byte though, so if you have a 1-bit
+// value, we return 1 here, not 0. Most of rustc works in bytes.
+pub fn llsize_of_real(cx: @crate_ctxt, t: TypeRef) -> uint {
+    let nbits = llvm::LLVMSizeOfTypeInBits(cx.td.lltd, t) as uint;
+    if nbits & 7u != 0u {
+        // Not an even number of bytes, spills into "next" byte.
+        1u + (nbits >> 3)
+    } else {
+        nbits >> 3
+    }
+}
+
+// Returns the "default" size of t, which is calculated by casting null to a
+// *T and then doing gep(1) on it and measuring the result. Really, look in
+// the LLVM sources. It does that. So this is likely similar to the ABI size
+// (i.e. including alignment-padding), but goodness knows which alignment it
+// winds up using. Probably the ABI one? Not recommended.
+pub fn llsize_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
+    return llvm::LLVMConstIntCast(lib::llvm::llvm::LLVMSizeOf(t), cx.int_type,
+                               False);
+}
+
+// Returns the preferred alignment of the given type for the current target.
+// The preffered alignment may be larger than the alignment used when
+// packing the type into structs. This will be used for things like
+// allocations inside a stack frame, which LLVM has a free hand in.
+pub fn llalign_of_pref(cx: @crate_ctxt, t: TypeRef) -> uint {
+    return llvm::LLVMPreferredAlignmentOfType(cx.td.lltd, t) as uint;
+}
+
+// Returns the minimum alignment of a type required by the plattform.
+// This is the alignment that will be used for struct fields, arrays,
+// and similar ABI-mandated things.
+pub fn llalign_of_min(cx: @crate_ctxt, t: TypeRef) -> uint {
+    return llvm::LLVMABIAlignmentOfType(cx.td.lltd, t) as uint;
+}
+
+// Returns the "default" alignment of t, which is calculated by casting
+// null to a record containing a single-bit followed by a t value, then
+// doing gep(0,1) to get at the trailing (and presumably padded) t cell.
+pub fn llalign_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
+    return llvm::LLVMConstIntCast(
+        lib::llvm::llvm::LLVMAlignOf(t), cx.int_type, False);
+}
+
+// Computes the size of the data part of an enum.
+pub fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint {
+    if cx.enum_sizes.contains_key(t) { return cx.enum_sizes.get(t); }
+    match ty::get(t).sty {
+      ty::ty_enum(tid, ref substs) => {
+        // Compute max(variant sizes).
+        let mut max_size = 0u;
+        let variants = ty::enum_variants(cx.tcx, tid);
+        for vec::each(*variants) |variant| {
+            let tup_ty = simplify_type(cx.tcx,
+                                       ty::mk_tup(cx.tcx, variant.args));
+            // Perform any type parameter substitutions.
+            let tup_ty = ty::subst(cx.tcx, substs, tup_ty);
+            // Here we possibly do a recursive call.
+            let this_size =
+                llsize_of_real(cx, type_of::type_of(cx, tup_ty));
+            if max_size < this_size { max_size = this_size; }
+        }
+        cx.enum_sizes.insert(t, max_size);
+        return max_size;
+      }
+      _ => cx.sess.bug(~"static_size_of_enum called on non-enum")
+    }
+}
+
diff --git a/src/rustc/middle/trans/meth.rs b/src/rustc/middle/trans/meth.rs
index 33df35cca52..a94519306a4 100644
--- a/src/rustc/middle/trans/meth.rs
+++ b/src/rustc/middle/trans/meth.rs
@@ -364,8 +364,8 @@ fn combine_impl_and_methods_origins(bcx: block,
 
     // Flatten out to find the number of vtables the method expects.
     let m_vtables = m_boundss.foldl(0, |sum, m_bounds| {
-        m_bounds.foldl(sum, |sum, m_bound| {
-            sum + match m_bound {
+        m_bounds.foldl(*sum, |sum, m_bound| {
+            (*sum) + match (*m_bound) {
                 ty::bound_copy | ty::bound_owned |
                 ty::bound_send | ty::bound_const => 0,
                 ty::bound_trait(_) => 1
@@ -536,6 +536,7 @@ fn trans_trait_cast(bcx: block,
                     dest: expr::Dest)
     -> block
 {
+    let mut bcx = bcx;
     let _icx = bcx.insn_ctxt("impl::trans_cast");
 
     let lldest = match dest {
@@ -548,16 +549,23 @@ fn trans_trait_cast(bcx: block,
     let ccx = bcx.ccx();
     let v_ty = expr_ty(bcx, val);
 
-    // Allocate an @ box and store the value into it
-    let {bcx: bcx, box: llbox, body: body} = malloc_boxed(bcx, v_ty);
-    add_clean_free(bcx, llbox, heap_shared);
-    let bcx = expr::trans_into(bcx, val, SaveIn(body));
-    revoke_clean(bcx, llbox);
-
-    // Store the @ box into the pair
-    Store(bcx, llbox, PointerCast(bcx,
-                                  GEPi(bcx, lldest, [0u, 1u]),
-                                  T_ptr(val_ty(llbox))));
+    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 {bcx: new_bcx, box: llbox, body: body} = malloc_boxed(bcx, v_ty);
+        bcx = new_bcx;
+        add_clean_free(bcx, llbox, heap_shared);
+        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 @ box 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));
+    }
 
     // Store the vtable into the pair
     let orig = ccx.maps.vtable_map.get(id)[0];
diff --git a/src/rustc/middle/trans/monomorphize.rs b/src/rustc/middle/trans/monomorphize.rs
index 8a68ef4823b..cd8cffa297a 100644
--- a/src/rustc/middle/trans/monomorphize.rs
+++ b/src/rustc/middle/trans/monomorphize.rs
@@ -33,7 +33,7 @@ fn monomorphic_fn(ccx: @crate_ctxt,
     let param_uses = type_use::type_uses_for(ccx, fn_id, substs.len());
     let hash_id = make_mono_id(ccx, fn_id, substs, vtables, Some(param_uses));
     if vec::any(hash_id.params,
-                |p| match p { mono_precise(_, _) => false, _ => true }) {
+                |p| match *p { mono_precise(_, _) => false, _ => true }) {
         must_cast = true;
     }
 
@@ -103,11 +103,11 @@ fn monomorphic_fn(ccx: @crate_ctxt,
     // Random cut-off -- code that needs to instantiate the same function
     // recursively more than ten times can probably safely be assumed to be
     // causing an infinite expansion.
-    if depth > 10u {
+    if depth > 10 {
         ccx.sess.span_fatal(
             span, ~"overly deep expansion of inlined function");
     }
-    ccx.monomorphizing.insert(fn_id, depth + 1u);
+    ccx.monomorphizing.insert(fn_id, depth + 1);
 
     let pt = vec::append(*pt,
                          ~[path_name(ccx.names(ccx.sess.str_of(name)))]);
@@ -243,16 +243,16 @@ fn make_mono_id(ccx: @crate_ctxt, item: ast::def_id, substs: ~[ty::t],
         let mut i = 0u;
         vec::map2(*bounds, substs, |bounds, subst| {
             let mut v = ~[];
-            for vec::each(*bounds) |bound| {
+            for bounds.each |bound| {
                 match *bound {
                   ty::bound_trait(_) => {
-                    vec::push(v, meth::vtable_id(ccx, vts[i]));
+                    v.push(meth::vtable_id(ccx, vts[i]));
                     i += 1u;
                   }
                   _ => ()
                 }
             }
-            (subst, if v.len() > 0u { Some(v) } else { None })
+            (*subst, if v.len() > 0u { Some(v) } else { None })
         })
       }
       None => {
@@ -262,12 +262,12 @@ fn make_mono_id(ccx: @crate_ctxt, item: ast::def_id, substs: ~[ty::t],
     let param_ids = match param_uses {
       Some(uses) => {
         vec::map2(precise_param_ids, uses, |id, uses| {
-            match id {
+            match *id {
                 (a, b@Some(_)) => mono_precise(a, b),
                 (subst, None) => {
-                    if uses == 0u {
+                    if *uses == 0u {
                         mono_any
-                    } else if uses == type_use::use_repr &&
+                    } else if *uses == type_use::use_repr &&
                         !ty::type_needs_drop(ccx.tcx, subst)
                     {
                         let llty = type_of::type_of(ccx, subst);
diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs
index e09e3d9493d..cf58b5b51c4 100644
--- a/src/rustc/middle/trans/shape.rs
+++ b/src/rustc/middle/trans/shape.rs
@@ -7,6 +7,7 @@ use driver::session;
 use driver::session::session;
 use trans::base;
 use middle::trans::common::*;
+use middle::trans::machine::*;
 use back::abi;
 use middle::ty;
 use middle::ty::field;
@@ -22,92 +23,13 @@ use option::is_some;
 
 use ty_ctxt = middle::ty::ctxt;
 
-type nominal_id_ = {did: ast::def_id, parent_id: Option<ast::def_id>,
-                    tps: ~[ty::t]};
-type nominal_id = @nominal_id_;
-
-impl nominal_id_ : core::cmp::Eq {
-    pure fn eq(other: &nominal_id_) -> bool {
-        if self.did != other.did ||
-            self.parent_id != other.parent_id {
-            false
-        } else {
-            do vec::all2(self.tps, other.tps) |m_tp, n_tp| {
-                ty::type_id(m_tp) == ty::type_id(n_tp)
-            }
-        }
-    }
-    pure fn ne(other: &nominal_id_) -> bool {
-        ! (self == *other)
-    }
-}
-
-impl nominal_id_ : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
-        to_bytes::iter_bytes_2(&self.did, &self.parent_id, lsb0, f);
-        for self.tps.each |t| {
-            ty::type_id(*t).iter_bytes(lsb0, f);
-        }
-    }
-}
-
-fn mk_nominal_id(tcx: ty::ctxt, did: ast::def_id,
-                 parent_id: Option<ast::def_id>,
-                 tps: ~[ty::t]) -> nominal_id {
-    let tps_norm = tps.map(|t| ty::normalize_ty(tcx, *t));
-    @{did: did, parent_id: parent_id, tps: tps_norm}
-}
-
-fn new_nominal_id_hash<T: Copy>() -> HashMap<nominal_id, T> {
-    return HashMap();
-}
-
-type enum_data = {did: ast::def_id, substs: ty::substs};
-
-type ctxt =
-    {mut next_tag_id: u16,
-     pad: u16,
-     tag_id_to_index: HashMap<nominal_id, u16>,
-     tag_order: DVec<enum_data>,
-     resources: interner::interner<nominal_id>,
-     llshapetablesty: TypeRef,
-     llshapetables: ValueRef};
-
-const shape_u8: u8 = 0u8;
-const shape_u16: u8 = 1u8;
-const shape_u32: u8 = 2u8;
-const shape_u64: u8 = 3u8;
-const shape_i8: u8 = 4u8;
-const shape_i16: u8 = 5u8;
-const shape_i32: u8 = 6u8;
-const shape_i64: u8 = 7u8;
-const shape_f32: u8 = 8u8;
-const shape_f64: u8 = 9u8;
-const shape_box: u8 = 10u8;
-const shape_enum: u8 = 12u8;
-const shape_struct: u8 = 17u8;
-const shape_box_fn: u8 = 18u8;
-const shape_res: u8 = 20u8;
-const shape_uniq: u8 = 22u8;
-const shape_opaque_closure_ptr: u8 = 23u8; // the closure itself.
-const shape_uniq_fn: u8 = 25u8;
-const shape_stack_fn: u8 = 26u8;
-const shape_bare_fn: u8 = 27u8;
-const shape_tydesc: u8 = 28u8;
-const shape_send_tydesc: u8 = 29u8;
-const shape_rptr: u8 = 31u8;
-const shape_fixedvec: u8 = 32u8;
-const shape_slice: u8 = 33u8;
-const shape_unboxed_vec: u8 = 34u8;
+type ctxt = {mut next_tag_id: u16, pad: u16, pad2: u32};
 
 fn mk_global(ccx: @crate_ctxt, name: ~str, llval: ValueRef, internal: bool) ->
    ValueRef {
-    let llglobal =
-        str::as_c_str(name,
-                      |buf| {
-                        lib::llvm::llvm::LLVMAddGlobal(ccx.llmod,
-                                                       val_ty(llval), buf)
-                    });
+    let llglobal = do str::as_c_str(name) |buf| {
+        lib::llvm::llvm::LLVMAddGlobal(ccx.llmod, val_ty(llval), buf)
+    };
     lib::llvm::llvm::LLVMSetInitializer(llglobal, llval);
     lib::llvm::llvm::LLVMSetGlobalConstant(llglobal, True);
 
@@ -118,91 +40,13 @@ fn mk_global(ccx: @crate_ctxt, name: ~str, llval: ValueRef, internal: bool) ->
     return llglobal;
 }
 
-
-// Computes a set of variants of a enum that are guaranteed to have size and
-// alignment at least as large as any other variant of the enum. This is an
-// important performance optimization.
-
-fn round_up(size: u16, align: u8) -> u16 {
-    assert (align >= 1u8);
-    let alignment = align as u16;
-    return size - 1u16 + alignment & !(alignment - 1u16);
-}
-
-type size_align = {size: u16, align: u8};
-
-enum enum_kind {
-    tk_unit,    // 1 variant, no data
-    tk_enum,    // N variants, no data
-    tk_newtype, // 1 variant, data
-    tk_complex  // N variants, no data
-}
-
-fn enum_kind(ccx: @crate_ctxt, did: ast::def_id) -> enum_kind {
-    let variants = ty::enum_variants(ccx.tcx, did);
-    if vec::any(*variants, |v| vec::len(v.args) > 0u) {
-        if vec::len(*variants) == 1u { tk_newtype }
-        else { tk_complex }
-    } else {
-        if vec::len(*variants) <= 1u { tk_unit }
-        else { tk_enum }
-    }
-}
-
-// Returns the code corresponding to the pointer size on this architecture.
-fn s_int(tcx: ty_ctxt) -> u8 {
-    return match tcx.sess.targ_cfg.arch {
-        session::arch_x86 => shape_i32,
-        session::arch_x86_64 => shape_i64,
-        session::arch_arm => shape_i32
-    };
-}
-
-fn s_uint(tcx: ty_ctxt) -> u8 {
-    return match tcx.sess.targ_cfg.arch {
-        session::arch_x86 => shape_u32,
-        session::arch_x86_64 => shape_u64,
-        session::arch_arm => shape_u32
-    };
-}
-
-fn s_float(tcx: ty_ctxt) -> u8 {
-    return match tcx.sess.targ_cfg.arch {
-        session::arch_x86 => shape_f64,
-        session::arch_x86_64 => shape_f64,
-        session::arch_arm => shape_f64
-    };
-}
-
-fn s_variant_enum_t(tcx: ty_ctxt) -> u8 {
-    return s_int(tcx);
-}
-
-fn s_tydesc(_tcx: ty_ctxt) -> u8 {
-    return shape_tydesc;
-}
-
-fn s_send_tydesc(_tcx: ty_ctxt) -> u8 {
-    return shape_send_tydesc;
-}
-
 fn mk_ctxt(llmod: ModuleRef) -> ctxt {
     let llshapetablesty = trans::common::T_named_struct(~"shapes");
-    let llshapetables = str::as_c_str(~"shapes", |buf| {
+    let _llshapetables = str::as_c_str(~"shapes", |buf| {
         lib::llvm::llvm::LLVMAddGlobal(llmod, llshapetablesty, buf)
     });
 
-    return {mut next_tag_id: 0u16,
-         pad: 0u16,
-         tag_id_to_index: new_nominal_id_hash(),
-         tag_order: DVec(),
-         resources: interner::mk(),
-         llshapetablesty: llshapetablesty,
-         llshapetables: llshapetables};
-}
-
-fn add_bool(&dest: ~[u8], val: bool) {
-    dest += ~[if val { 1u8 } else { 0u8 }];
+    return {mut next_tag_id: 0u16, pad: 0u16, pad2: 0u32};
 }
 
 fn add_u16(&dest: ~[u8], val: u16) {
@@ -214,571 +58,3 @@ fn add_substr(&dest: ~[u8], src: ~[u8]) {
     dest += src;
 }
 
-fn shape_of(ccx: @crate_ctxt, t: ty::t) -> ~[u8] {
-    match ty::get(t).sty {
-        ty::ty_nil | ty::ty_bool | ty::ty_uint(ast::ty_u8) |
-        ty::ty_bot => ~[shape_u8],
-        ty::ty_int(ast::ty_i) => ~[s_int(ccx.tcx)],
-        ty::ty_float(ast::ty_f) => ~[s_float(ccx.tcx)],
-        ty::ty_uint(ast::ty_u) | ty::ty_ptr(_) => ~[s_uint(ccx.tcx)],
-        ty::ty_type => ~[s_tydesc(ccx.tcx)],
-        ty::ty_int(ast::ty_i8) => ~[shape_i8],
-        ty::ty_uint(ast::ty_u16) => ~[shape_u16],
-        ty::ty_int(ast::ty_i16) => ~[shape_i16],
-        ty::ty_uint(ast::ty_u32) => ~[shape_u32],
-        ty::ty_int(ast::ty_i32) | ty::ty_int(ast::ty_char) => ~[shape_i32],
-        ty::ty_uint(ast::ty_u64) => ~[shape_u64],
-        ty::ty_int(ast::ty_i64) => ~[shape_i64],
-        ty::ty_float(ast::ty_f32) => ~[shape_f32],
-        ty::ty_float(ast::ty_f64) => ~[shape_f64],
-        ty::ty_estr(ty::vstore_uniq) => {
-            shape_of(ccx, tvec::expand_boxed_vec_ty(ccx.tcx, t))
-        }
-        ty::ty_enum(did, substs) => {
-            match enum_kind(ccx, did) {
-                tk_unit => ~[s_variant_enum_t(ccx.tcx)],
-                tk_enum => ~[s_variant_enum_t(ccx.tcx)],
-                tk_newtype | tk_complex => {
-                    let mut s = ~[shape_enum], id;
-                    let nom_id = mk_nominal_id(ccx.tcx, did,
-                                               None, substs.tps);
-                    match ccx.shape_cx.tag_id_to_index.find(nom_id) {
-                        None => {
-                            id = ccx.shape_cx.next_tag_id;
-                            ccx.shape_cx.tag_id_to_index.insert(nom_id, id);
-                            ccx.shape_cx.tag_order.push({did: did,
-                                                         substs: substs});
-                            ccx.shape_cx.next_tag_id += 1u16;
-                        }
-                        Some(existing_id) => id = existing_id,
-                    }
-                    add_u16(s, id as u16);
-
-                    s
-                }
-            }
-        }
-        ty::ty_estr(ty::vstore_box) |
-        ty::ty_evec(_, ty::vstore_box) |
-        ty::ty_box(_) | ty::ty_opaque_box => ~[shape_box],
-        ty::ty_uniq(mt) => {
-            let mut s = ~[shape_uniq];
-            add_substr(s, shape_of(ccx, mt.ty));
-            s
-        }
-        ty::ty_unboxed_vec(mt) => {
-            let mut s = ~[shape_unboxed_vec];
-            add_bool(s, ty::type_is_pod(ccx.tcx, mt.ty));
-            add_substr(s, shape_of(ccx, mt.ty));
-            s
-        }
-        ty::ty_evec(_, ty::vstore_uniq) => {
-            shape_of(ccx, tvec::expand_boxed_vec_ty(ccx.tcx, t))
-        }
-
-        ty::ty_estr(ty::vstore_fixed(n)) => {
-            let mut s = ~[shape_fixedvec];
-            let u8_t = ty::mk_mach_uint(ccx.tcx, ast::ty_u8);
-            assert (n + 1u) <= 0xffffu;
-            add_u16(s, (n + 1u) as u16);
-            add_bool(s, true);
-            add_substr(s, shape_of(ccx, u8_t));
-            s
-        }
-
-        ty::ty_evec(mt, ty::vstore_fixed(n)) => {
-            let mut s = ~[shape_fixedvec];
-            assert n <= 0xffffu;
-            add_u16(s, n as u16);
-            add_bool(s, ty::type_is_pod(ccx.tcx, mt.ty));
-            add_substr(s, shape_of(ccx, mt.ty));
-            s
-        }
-
-        ty::ty_estr(ty::vstore_slice(_)) => {
-            let mut s = ~[shape_slice];
-            let u8_t = ty::mk_mach_uint(ccx.tcx, ast::ty_u8);
-            add_bool(s, true); // is_pod
-            add_bool(s, true); // is_str
-            add_substr(s, shape_of(ccx, u8_t));
-            s
-        }
-
-        ty::ty_evec(mt, ty::vstore_slice(_)) => {
-            let mut s = ~[shape_slice];
-            add_bool(s, ty::type_is_pod(ccx.tcx, mt.ty));
-            add_bool(s, false); // is_str
-            add_substr(s, shape_of(ccx, mt.ty));
-            s
-        }
-
-        ty::ty_rec(fields) => {
-            let mut s = ~[shape_struct], sub = ~[];
-            for vec::each(fields) |f| {
-                sub += shape_of(ccx, f.mt.ty);
-            }
-            add_substr(s, sub);
-            s
-        }
-        ty::ty_tup(elts) => {
-            let mut s = ~[shape_struct], sub = ~[];
-            for vec::each(elts) |elt| {
-                sub += shape_of(ccx, *elt);
-            }
-            add_substr(s, sub);
-            s
-        }
-        ty::ty_trait(_, _, _) => ~[shape_box_fn],
-        ty::ty_class(did, ref substs) => {
-            // same as records, unless there's a dtor
-            let tps = substs.tps;
-            let m_dtor_did = ty::ty_dtor(ccx.tcx, did);
-            let mut s = if m_dtor_did.is_some() {
-                ~[shape_res]
-            }
-            else { ~[shape_struct] }, sub = ~[];
-            do m_dtor_did.iter |dtor_did| {
-                let ri = @{did: dtor_did, parent_id: Some(did), tps: tps};
-                let id = ccx.shape_cx.resources.intern(ri);
-                add_u16(s, id as u16);
-            };
-            for ty::class_items_as_mutable_fields(ccx.tcx, did,
-                                                  substs).each |f| {
-                sub += shape_of(ccx, f.mt.ty);
-            }
-            add_substr(s, sub);
-            s
-        }
-        ty::ty_rptr(_, mt) => {
-            let mut s = ~[shape_rptr];
-            add_substr(s, shape_of(ccx, mt.ty));
-            s
-        }
-        ty::ty_param(*) => {
-            ccx.tcx.sess.bug(~"non-monomorphized type parameter");
-        }
-        ty::ty_fn(ref fn_ty) => {
-            match fn_ty.meta.proto {
-                ty::proto_vstore(ty::vstore_box) => ~[shape_box_fn],
-                ty::proto_vstore(ty::vstore_uniq) => ~[shape_uniq_fn],
-                ty::proto_vstore(ty::vstore_slice(_)) => ~[shape_stack_fn],
-                ty::proto_bare => ~[shape_bare_fn],
-                ty::proto_vstore(ty::vstore_fixed(_)) =>
-                fail ~"fixed vstore is impossible",
-            }
-        }
-        ty::ty_opaque_closure_ptr(_) => ~[shape_opaque_closure_ptr],
-        ty::ty_infer(_) | ty::ty_self => {
-            ccx.sess.bug(~"shape_of: unexpected type struct found")
-        }
-    }
-}
-
-fn shape_of_variant(ccx: @crate_ctxt, v: ty::variant_info) -> ~[u8] {
-    let mut s = ~[];
-    for vec::each(v.args) |t| { s += shape_of(ccx, *t); }
-    return s;
-}
-
-fn gen_enum_shapes(ccx: @crate_ctxt) -> ValueRef {
-    // Loop over all the enum variants and write their shapes into a
-    // data buffer. As we do this, it's possible for us to discover
-    // new enums, so we must do this first.
-    let mut data = ~[];
-    let mut offsets = ~[];
-    let mut i = 0u;
-    let mut enum_variants = ~[];
-    while i < ccx.shape_cx.tag_order.len() {
-        let {did, substs} = ccx.shape_cx.tag_order[i];
-        let variants = @ty::substd_enum_variants(ccx.tcx, did, &substs);
-        for vec::each(*variants) |v| {
-            offsets += ~[vec::len(data) as u16];
-
-            let variant_shape = shape_of_variant(ccx, *v);
-            add_substr(data, variant_shape);
-
-            let zname = str::to_bytes(ccx.sess.str_of(v.name)) + ~[0u8];
-            add_substr(data, zname);
-        }
-        enum_variants += ~[variants];
-        i += 1u;
-    }
-
-    // Now calculate the sizes of the header space (which contains offsets to
-    // info records for each enum) and the info space (which contains offsets
-    // to each variant shape). As we do so, build up the header.
-
-    let mut header = ~[];
-    let mut inf = ~[];
-    let header_sz = 2u16 * ccx.shape_cx.next_tag_id;
-    let data_sz = vec::len(data) as u16;
-
-    let mut inf_sz = 0u16;
-    for enum_variants.each |variants| {
-        let num_variants = vec::len(**variants) as u16;
-        add_u16(header, header_sz + inf_sz);
-        inf_sz += 2u16 * (num_variants + 2u16) + 3u16;
-    }
-
-    // Construct the info tables, which contain offsets to the shape of each
-    // variant. Also construct the largest-variant table for each enum, which
-    // contains the variants that the size-of operation needs to look at.
-
-    let mut lv_table = ~[];
-    let mut i = 0u;
-    for enum_variants.each |variants| {
-        add_u16(inf, vec::len(**variants) as u16);
-
-        // Construct the largest-variants table.
-        add_u16(inf,
-                header_sz + inf_sz + data_sz + (vec::len(lv_table) as u16));
-
-        let lv = largest_variants(ccx, *variants);
-        add_u16(lv_table, vec::len(lv) as u16);
-        for vec::each(lv) |v| { add_u16(lv_table, *v as u16); }
-
-        // Determine whether the enum has dynamic size.
-        assert !variants.any(|v| v.args.any(|t| ty::type_has_params(t)));
-
-        // If we can, write in the static size and alignment of the enum.
-        // Otherwise, write a placeholder.
-        let size_align = compute_static_enum_size(ccx, lv, *variants);
-
-        // Write in the static size and alignment of the enum.
-        add_u16(inf, size_align.size);
-        inf += ~[size_align.align];
-
-        // Now write in the offset of each variant.
-        for variants.each |_v| {
-            add_u16(inf, header_sz + inf_sz + offsets[i]);
-            i += 1u;
-        }
-    }
-
-    assert (i == vec::len(offsets));
-    assert (header_sz == vec::len(header) as u16);
-    assert (inf_sz == vec::len(inf) as u16);
-    assert (data_sz == vec::len(data) as u16);
-
-    header += inf;
-    header += data;
-    header += lv_table;
-
-    return mk_global(ccx, ~"tag_shapes", C_bytes(header), true);
-
-/* tjc: Not annotating FIXMEs in this module because of #1498 */
-    fn largest_variants(ccx: @crate_ctxt,
-                        variants: @~[ty::variant_info]) -> ~[uint] {
-        // Compute the minimum and maximum size and alignment for each
-        // variant.
-        //
-        // NB: We could do better here; e.g. we know that any
-        // variant that contains (T,T) must be as least as large as
-        // any variant that contains just T.
-        let mut ranges = ~[];
-        for vec::each(*variants) |variant| {
-            let mut bounded = true;
-            let mut min_size = 0u, min_align = 0u;
-            for vec::each(variant.args) |elem_t| {
-                if ty::type_has_params(*elem_t) {
-                    // NB: We could do better here; this causes us to
-                    // conservatively assume that (int, T) has minimum size 0,
-                    // when in fact it has minimum size sizeof(int).
-                    bounded = false;
-                } else {
-                    let llty = type_of::type_of(ccx, *elem_t);
-                    min_size += llsize_of_real(ccx, llty);
-                    min_align += llalign_of_pref(ccx, llty);
-                }
-            }
-
-            ranges +=
-                ~[{size: {min: min_size, bounded: bounded},
-                  align: {min: min_align, bounded: bounded}}];
-        }
-
-        // Initialize the candidate set to contain all variants.
-        let mut candidates = ~[mut];
-        for vec::each(*variants) |_v| { candidates += ~[mut true]; }
-
-        // Do a pairwise comparison among all variants still in the
-        // candidate set.  Throw out any variant that we know has size
-        // and alignment at least as small as some other variant.
-        let mut i = 0u;
-        while i < vec::len(ranges) - 1u {
-            if candidates[i] {
-                let mut j = i + 1u;
-                while j < vec::len(ranges) {
-                    if candidates[j] {
-                        if ranges[i].size.bounded &&
-                            ranges[i].align.bounded &&
-                            ranges[j].size.bounded &&
-                            ranges[j].align.bounded {
-                            if ranges[i].size.min >= ranges[j].size.min &&
-                                ranges[i].align.min >= ranges[j].align.min {
-                                // Throw out j.
-                                candidates[j] = false;
-                            } else if ranges[j].size.min >=
-                                    ranges[i].size.min &&
-                                ranges[j].align.min >=
-                                    ranges[j].align.min {
-                                // Throw out i.
-                                candidates[i] = false;
-                            }
-                        }
-                    }
-                    j += 1u;
-                }
-            }
-            i += 1u;
-        }
-
-        // Return the resulting set.
-        let mut result = ~[];
-        let mut i = 0u;
-        while i < vec::len(candidates) {
-            if candidates[i] { vec::push(result, i); }
-            i += 1u;
-        }
-        return result;
-    }
-
-    fn compute_static_enum_size(ccx: @crate_ctxt, largest_variants: ~[uint],
-                                variants: @~[ty::variant_info])
-        -> size_align {
-        let mut max_size = 0u16;
-        let mut max_align = 1u8;
-        for vec::each(largest_variants) |vid| {
-            // We increment a "virtual data pointer" to compute the size.
-            let mut lltys = ~[];
-            for vec::each(variants[*vid].args) |typ| {
-                lltys += ~[type_of::type_of(ccx, *typ)];
-            }
-
-            let llty = trans::common::T_struct(lltys);
-            let dp = llsize_of_real(ccx, llty) as u16;
-            let variant_align = llalign_of_pref(ccx, llty) as u8;
-
-            if max_size < dp { max_size = dp; }
-            if max_align < variant_align { max_align = variant_align; }
-        }
-
-        // Add space for the enum if applicable.
-        // FIXME (issue #792): This is wrong. If the enum starts with an
-        // 8 byte aligned quantity, we don't align it.
-        if vec::len(*variants) > 1u {
-            let variant_t = T_enum_discrim(ccx);
-            max_size += llsize_of_real(ccx, variant_t) as u16;
-            let align = llalign_of_pref(ccx, variant_t) as u8;
-            if max_align < align { max_align = align; }
-        }
-
-        return {size: max_size, align: max_align};
-    }
-}
-
-fn gen_resource_shapes(ccx: @crate_ctxt) -> ValueRef {
-    let mut dtors = ~[];
-    let len = ccx.shape_cx.resources.len();
-    for uint::range(0u, len) |i| {
-        let ri = ccx.shape_cx.resources.get(i);
-        for ri.tps.each() |s| { assert !ty::type_has_params(*s); }
-        do ri.parent_id.iter |id| {
-            dtors += ~[trans::base::get_res_dtor(ccx, ri.did, id, ri.tps)];
-        }
-    }
-    return mk_global(ccx, ~"resource_shapes", C_struct(dtors), true);
-}
-
-// This function serves to break a cyclical dependence between
-// emit_tydescs and gen_shape_tables.
-//
-//  * emit_tydescs calls shape_of, which causes changes to the shape
-//    tables
-//  * gen_shape_tables transitively calls get_tydesc, which causes new
-//    tydescs to be created
-//
-// We force those tydescs to be emitted now, thus breaking the
-// dependency.
-fn force_declare_tydescs(ccx: @crate_ctxt) {
-    // Walk all known tydescs first to force shape code to declare
-    // dependencies.
-    for ccx.tydescs.each |key, _val| {
-        shape_of(ccx, key);
-    }
-
-    // Then walk all resource shapes to force emit all dtors.
-    let len = ccx.shape_cx.resources.len();
-    for uint::range(0u, len) |i| {
-        let ri = ccx.shape_cx.resources.get(i);
-        for ri.tps.each() |s| { assert !ty::type_has_params(*s); }
-        do ri.parent_id.iter |id| {
-            trans::base::get_res_dtor(ccx, ri.did, id, ri.tps);
-        }
-    }
-}
-
-fn gen_shape_tables(ccx: @crate_ctxt) {
-    let lltagstable = gen_enum_shapes(ccx);
-    let llresourcestable = gen_resource_shapes(ccx);
-    trans::common::set_struct_body(ccx.shape_cx.llshapetablesty,
-                                   ~[val_ty(lltagstable),
-                                    val_ty(llresourcestable)]);
-
-    let lltables =
-        C_named_struct(ccx.shape_cx.llshapetablesty,
-                       ~[lltagstable, llresourcestable]);
-    lib::llvm::llvm::LLVMSetInitializer(ccx.shape_cx.llshapetables, lltables);
-    lib::llvm::llvm::LLVMSetGlobalConstant(ccx.shape_cx.llshapetables, True);
-    lib::llvm::SetLinkage(ccx.shape_cx.llshapetables,
-                          lib::llvm::InternalLinkage);
-}
-
-// ______________________________________________________________________
-// compute sizeof / alignof
-
-type metrics = {
-    bcx: block,
-    sz: ValueRef,
-    align: ValueRef
-};
-
-type tag_metrics = {
-    bcx: block,
-    sz: ValueRef,
-    align: ValueRef,
-    payload_align: ValueRef
-};
-
-// Returns the number of bytes clobbered by a Store to this type.
-fn llsize_of_store(cx: @crate_ctxt, t: TypeRef) -> uint {
-    return llvm::LLVMStoreSizeOfType(cx.td.lltd, t) as uint;
-}
-
-// Returns the number of bytes between successive elements of type T in an
-// array of T. This is the "ABI" size. It includes any ABI-mandated padding.
-fn llsize_of_alloc(cx: @crate_ctxt, t: TypeRef) -> uint {
-    return llvm::LLVMABISizeOfType(cx.td.lltd, t) as uint;
-}
-
-// Returns, as near as we can figure, the "real" size of a type. As in, the
-// bits in this number of bytes actually carry data related to the datum
-// with the type. Not junk, padding, accidentally-damaged words, or
-// whatever. Rounds up to the nearest byte though, so if you have a 1-bit
-// value, we return 1 here, not 0. Most of rustc works in bytes.
-fn llsize_of_real(cx: @crate_ctxt, t: TypeRef) -> uint {
-    let nbits = llvm::LLVMSizeOfTypeInBits(cx.td.lltd, t) as uint;
-    if nbits & 7u != 0u {
-        // Not an even number of bytes, spills into "next" byte.
-        1u + (nbits >> 3)
-    } else {
-        nbits >> 3
-    }
-}
-
-// Returns the "default" size of t, which is calculated by casting null to a
-// *T and then doing gep(1) on it and measuring the result. Really, look in
-// the LLVM sources. It does that. So this is likely similar to the ABI size
-// (i.e. including alignment-padding), but goodness knows which alignment it
-// winds up using. Probably the ABI one? Not recommended.
-fn llsize_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
-    return llvm::LLVMConstIntCast(lib::llvm::llvm::LLVMSizeOf(t), cx.int_type,
-                               False);
-}
-
-// Returns the preferred alignment of the given type for the current target.
-// The preffered alignment may be larger than the alignment used when
-// packing the type into structs. This will be used for things like
-// allocations inside a stack frame, which LLVM has a free hand in.
-fn llalign_of_pref(cx: @crate_ctxt, t: TypeRef) -> uint {
-    return llvm::LLVMPreferredAlignmentOfType(cx.td.lltd, t) as uint;
-}
-
-// Returns the minimum alignment of a type required by the plattform.
-// This is the alignment that will be used for struct fields, arrays,
-// and similar ABI-mandated things.
-fn llalign_of_min(cx: @crate_ctxt, t: TypeRef) -> uint {
-    return llvm::LLVMABIAlignmentOfType(cx.td.lltd, t) as uint;
-}
-
-// Returns the "default" alignment of t, which is calculated by casting
-// null to a record containing a single-bit followed by a t value, then
-// doing gep(0,1) to get at the trailing (and presumably padded) t cell.
-fn llalign_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
-    return llvm::LLVMConstIntCast(
-        lib::llvm::llvm::LLVMAlignOf(t), cx.int_type, False);
-}
-
-// Computes the static size of a enum, without using mk_tup(), which is
-// bad for performance.
-//
-// NB: Migrate trans over to use this.
-
-// Computes the size of the data part of an enum.
-fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint {
-    if cx.enum_sizes.contains_key(t) { return cx.enum_sizes.get(t); }
-    match ty::get(t).sty {
-      ty::ty_enum(tid, ref substs) => {
-        // Compute max(variant sizes).
-        let mut max_size = 0u;
-        let variants = ty::enum_variants(cx.tcx, tid);
-        for vec::each(*variants) |variant| {
-            let tup_ty = simplify_type(cx.tcx,
-                                       ty::mk_tup(cx.tcx, variant.args));
-            // Perform any type parameter substitutions.
-            let tup_ty = ty::subst(cx.tcx, substs, tup_ty);
-            // Here we possibly do a recursive call.
-            let this_size =
-                llsize_of_real(cx, type_of::type_of(cx, tup_ty));
-            if max_size < this_size { max_size = this_size; }
-        }
-        cx.enum_sizes.insert(t, max_size);
-        return max_size;
-      }
-      _ => cx.sess.bug(~"static_size_of_enum called on non-enum")
-    }
-}
-
-// Creates a simpler, size-equivalent type. The resulting type is guaranteed
-// to have (a) the same size as the type that was passed in; (b) to be non-
-// recursive. This is done by replacing all boxes in a type with boxed unit
-// types.
-// This should reduce all pointers to some simple pointer type, to
-// ensure that we don't recurse endlessly when computing the size of a
-// nominal type that has pointers to itself in it.
-fn simplify_type(tcx: ty::ctxt, typ: ty::t) -> ty::t {
-    fn nilptr(tcx: ty::ctxt) -> ty::t {
-        ty::mk_ptr(tcx, {ty: ty::mk_nil(tcx), mutbl: ast::m_imm})
-    }
-    fn simplifier(tcx: ty::ctxt, typ: ty::t) -> ty::t {
-        match ty::get(typ).sty {
-          ty::ty_box(_) | ty::ty_opaque_box | ty::ty_uniq(_) |
-          ty::ty_evec(_, ty::vstore_uniq) | ty::ty_evec(_, ty::vstore_box) |
-          ty::ty_estr(ty::vstore_uniq) | ty::ty_estr(ty::vstore_box) |
-          ty::ty_ptr(_) | ty::ty_rptr(_,_) => nilptr(tcx),
-          ty::ty_fn(_) => ty::mk_tup(tcx, ~[nilptr(tcx), nilptr(tcx)]),
-          ty::ty_evec(_, ty::vstore_slice(_)) |
-          ty::ty_estr(ty::vstore_slice(_)) => {
-            ty::mk_tup(tcx, ~[nilptr(tcx), ty::mk_int(tcx)])
-          }
-          // Reduce a class type to a record type in which all the fields are
-          // simplified
-          ty::ty_class(did, ref substs) => {
-            let simpl_fields = (if ty::ty_dtor(tcx, did).is_some() {
-                // remember the drop flag
-                  ~[{ident: syntax::parse::token::special_idents::dtor,
-                     mt: {ty: ty::mk_u8(tcx),
-                          mutbl: ast::m_mutbl}}] }
-                else { ~[] }) +
-                do ty::lookup_class_fields(tcx, did).map |f| {
-                 let t = ty::lookup_field_type(tcx, did, f.id, substs);
-                 {ident: f.ident,
-                  mt: {ty: simplify_type(tcx, t), mutbl: ast::m_const}}
-            };
-            ty::mk_rec(tcx, simpl_fields)
-          }
-          _ => typ
-        }
-    }
-    ty::fold_ty(tcx, typ, |t| simplifier(tcx, t))
-}
diff --git a/src/rustc/middle/trans/tvec.rs b/src/rustc/middle/trans/tvec.rs
index 10f93626280..e1eae115694 100644
--- a/src/rustc/middle/trans/tvec.rs
+++ b/src/rustc/middle/trans/tvec.rs
@@ -332,7 +332,7 @@ fn write_content(bcx: block,
                         bcx = expr::trans_into(bcx, *element,
                                                SaveIn(lleltptr));
                         add_clean_temp_mem(bcx, lleltptr, vt.unit_ty);
-                        vec::push(temp_cleanups, lleltptr);
+                        temp_cleanups.push(lleltptr);
                     }
                     for vec::each(temp_cleanups) |cleanup| {
                         revoke_clean(bcx, *cleanup);
@@ -369,7 +369,7 @@ fn write_content(bcx: block,
                             bcx = tmpdatum.move_to(bcx, INIT, lleltptr);
                         }
                         add_clean_temp_mem(bcx, lleltptr, vt.unit_ty);
-                        vec::push(temp_cleanups, lleltptr);
+                        temp_cleanups.push(lleltptr);
                     }
 
                     for vec::each(temp_cleanups) |cleanup| {
diff --git a/src/rustc/middle/trans/type_of.rs b/src/rustc/middle/trans/type_of.rs
index d9032f8ce90..b45da3b2700 100644
--- a/src/rustc/middle/trans/type_of.rs
+++ b/src/rustc/middle/trans/type_of.rs
@@ -39,13 +39,13 @@ fn type_of_fn(cx: @crate_ctxt, inputs: ~[ty::arg],
     let mut atys: ~[TypeRef] = ~[];
 
     // Arg 0: Output pointer.
-    vec::push(atys, T_ptr(type_of(cx, output)));
+    atys.push(T_ptr(type_of(cx, output)));
 
     // Arg 1: Environment
-    vec::push(atys, T_opaque_box_ptr(cx));
+    atys.push(T_opaque_box_ptr(cx));
 
     // ... then explicit args.
-    vec::push_all(atys, type_of_explicit_args(cx, inputs));
+    atys.push_all(type_of_explicit_args(cx, inputs));
     return T_fn(atys, llvm::LLVMVoidType());
 }
 
@@ -151,7 +151,7 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
         let mut tys: ~[TypeRef] = ~[];
         for vec::each(fields) |f| {
             let mt_ty = f.mt.ty;
-            vec::push(tys, type_of(cx, mt_ty));
+            tys.push(type_of(cx, mt_ty));
         }
 
         // n.b.: introduce an extra layer of indirection to match
@@ -164,7 +164,7 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
       ty::ty_tup(elts) => {
         let mut tys = ~[];
         for vec::each(elts) |elt| {
-            vec::push(tys, type_of(cx, *elt));
+            tys.push(type_of(cx, *elt));
         }
         T_struct(tys)
       }
@@ -254,8 +254,8 @@ fn llvm_type_name(cx: @crate_ctxt,
 }
 
 fn type_of_dtor(ccx: @crate_ctxt, self_ty: ty::t) -> TypeRef {
-    T_fn(~[T_ptr(type_of(ccx, ty::mk_nil(ccx.tcx))),
-          T_ptr(type_of(ccx, self_ty))],
+    T_fn(~[T_ptr(type_of(ccx, ty::mk_nil(ccx.tcx))), // output pointer
+           T_ptr(type_of(ccx, self_ty))],            // self arg
          llvm::LLVMVoidType())
 }
 
diff --git a/src/rustc/middle/trans/type_use.rs b/src/rustc/middle/trans/type_use.rs
index 8a0873f0585..6bd3c22f626 100644
--- a/src/rustc/middle/trans/type_use.rs
+++ b/src/rustc/middle/trans/type_use.rs
@@ -204,10 +204,10 @@ fn mark_for_expr(cx: ctx, e: @expr) {
       expr_path(_) => {
         do cx.ccx.tcx.node_type_substs.find(e.id).iter |ts| {
             let id = ast_util::def_id_of_def(cx.ccx.tcx.def_map.get(e.id));
-            vec::iter2(type_uses_for(cx.ccx, id, ts.len()), ts,
-                       |uses, subst| {
-                           type_needs(cx, uses, subst)
-                       })
+            let uses_for_ts = type_uses_for(cx.ccx, id, ts.len());
+            for vec::each2(uses_for_ts, *ts) |uses, subst| {
+                type_needs(cx, *uses, *subst)
+            }
         }
       }
       expr_fn(*) | expr_fn_block(*) => {
@@ -238,8 +238,10 @@ fn mark_for_expr(cx: ctx, e: @expr) {
             match mth.origin {
               typeck::method_static(did) => {
                 do cx.ccx.tcx.node_type_substs.find(e.id).iter |ts| {
-                    do vec::iter2(type_uses_for(cx.ccx, did, ts.len()), ts)
-                        |uses, subst| { type_needs(cx, uses, subst)}
+                    let type_uses = type_uses_for(cx.ccx, did, ts.len());
+                    for vec::each2(type_uses, *ts) |uses, subst| {
+                        type_needs(cx, *uses, *subst)
+                    }
                 }
               }
               typeck::method_param({param_num: param, _}) => {
diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs
index f256b4b76cd..109db9ace09 100644
--- a/src/rustc/middle/ty.rs
+++ b/src/rustc/middle/ty.rs
@@ -248,7 +248,7 @@ impl creader_cache_key : cmp::Eq {
 }
 
 impl creader_cache_key : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         to_bytes::iter_bytes_3(&self.cnum, &self.pos, &self.len, lsb0, f);
     }
 }
@@ -263,7 +263,7 @@ impl intern_key : cmp::Eq {
 }
 
 impl intern_key : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         to_bytes::iter_bytes_2(&self.sty, &self.o_def_id, lsb0, f);
     }
 }
@@ -356,7 +356,8 @@ type ctxt =
       inferred_modes: HashMap<ast::node_id, ast::mode>,
       adjustments: HashMap<ast::node_id, @AutoAdjustment>,
       normalized_cache: HashMap<t, t>,
-      lang_items: middle::lang_items::LanguageItems};
+      lang_items: middle::lang_items::LanguageItems,
+      legacy_boxed_traits: HashMap<node_id, ()>};
 
 enum tbox_flag {
     has_params = 1,
@@ -406,7 +407,7 @@ enum closure_kind {
 }
 
 impl closure_kind : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         (self as u8).iter_bytes(lsb0, f)
     }
 }
@@ -424,7 +425,7 @@ enum fn_proto {
 }
 
 impl fn_proto : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         match self {
           proto_bare =>
           0u8.iter_bytes(lsb0, f),
@@ -502,7 +503,7 @@ impl param_ty : cmp::Eq {
 }
 
 impl param_ty : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         to_bytes::iter_bytes_2(&self.idx, &self.def_id, lsb0, f)
     }
 }
@@ -676,7 +677,7 @@ enum InferTy {
 }
 
 impl InferTy : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         match self {
           TyVar(ref tv) => to_bytes::iter_bytes_2(&0u8, tv, lsb0, f),
           IntVar(ref iv) => to_bytes::iter_bytes_2(&1u8, iv, lsb0, f)
@@ -685,7 +686,7 @@ impl InferTy : to_bytes::IterBytes {
 }
 
 impl param_bound : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         match self {
           bound_copy => 0u8.iter_bytes(lsb0, f),
           bound_owned => 1u8.iter_bytes(lsb0, f),
@@ -749,25 +750,25 @@ impl purity: purity_to_str {
 }
 
 impl RegionVid : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         (*self).iter_bytes(lsb0, f)
     }
 }
 
 impl TyVid : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         (*self).iter_bytes(lsb0, f)
     }
 }
 
 impl IntVid : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         (*self).iter_bytes(lsb0, f)
     }
 }
 
 impl FnVid : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         (*self).iter_bytes(lsb0, f)
     }
 }
@@ -875,7 +876,8 @@ fn mk_ctxt(s: session::session,
       inferred_modes: HashMap(),
       adjustments: HashMap(),
       normalized_cache: new_ty_hash(),
-      lang_items: move lang_items}
+      lang_items: move lang_items,
+      legacy_boxed_traits: HashMap()}
 }
 
 
@@ -902,7 +904,7 @@ fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option<ast::def_id>) -> t {
     fn sflags(substs: &substs) -> uint {
         let mut f = 0u;
         for substs.tps.each |tt| { f |= get(*tt).flags; }
-        substs.self_r.iter(|r| f |= rflags(r));
+        substs.self_r.iter(|r| f |= rflags(*r));
         return f;
     }
     match st {
@@ -1091,12 +1093,15 @@ pure fn mach_sty(cfg: @session::config, t: t) -> sty {
 }
 
 fn default_arg_mode_for_ty(tcx: ctxt, ty: ty::t) -> ast::rmode {
-    return if type_is_fn(ty) {
-        //    ^^^^^^^^^^^^^^
-        // FIXME(#2202) --- We retain by-ref by default to workaround a memory
-        // leak that otherwise results when @fn is upcast to &fn.
-        ast::by_ref
-    } else if tcx.legacy_modes {
+        // FIXME(#2202) --- We retain by-ref for fn& things to workaround a
+        // memory leak that otherwise results when @fn is upcast to &fn.
+    if type_is_fn(ty) {
+        match ty_fn_proto(ty) {
+           proto_vstore(vstore_slice(_)) => return ast::by_ref,
+            _ => ()
+        }
+    }
+    return if tcx.legacy_modes {
         if type_is_borrowed(ty) {
             // the old mode default was ++ for things like &ptr, but to be
             // forward-compatible with non-legacy, we should use +
@@ -1177,7 +1182,7 @@ fn fold_sty_to_ty(tcx: ty::ctxt, sty: &sty, foldop: fn(t) -> t) -> t {
 fn fold_sty(sty: &sty, fldop: fn(t) -> t) -> sty {
     fn fold_substs(substs: &substs, fldop: fn(t) -> t) -> substs {
         {self_r: substs.self_r,
-         self_ty: substs.self_ty.map(|t| fldop(t)),
+         self_ty: substs.self_ty.map(|t| fldop(*t)),
          tps: substs.tps.map(|t| fldop(*t))}
     }
 
@@ -1273,8 +1278,8 @@ fn fold_regions_and_ty(
         fldr: fn(r: region) -> region,
         fldt: fn(t: t) -> t) -> substs {
 
-        {self_r: substs.self_r.map(|r| fldr(r)),
-         self_ty: substs.self_ty.map(|t| fldt(t)),
+        {self_r: substs.self_r.map(|r| fldr(*r)),
+         self_ty: substs.self_ty.map(|t| fldt(*t)),
          tps: substs.tps.map(|t| fldt(*t))}
     }
 
@@ -1403,8 +1408,8 @@ fn substs_is_noop(substs: &substs) -> bool {
 
 fn substs_to_str(cx: ctxt, substs: &substs) -> ~str {
     fmt!("substs(self_r=%s, self_ty=%s, tps=%?)",
-         substs.self_r.map_default(~"none", |r| region_to_str(cx, r)),
-         substs.self_ty.map_default(~"none", |t| ty_to_str(cx, t)),
+         substs.self_r.map_default(~"none", |r| region_to_str(cx, *r)),
+         substs.self_ty.map_default(~"none", |t| ty_to_str(cx, *t)),
          tys_to_str(cx, substs.tps))
 }
 
@@ -2137,25 +2142,25 @@ fn type_size(cx: ctxt, ty: t) -> uint {
       }
 
       ty_rec(flds) => {
-        flds.foldl(0, |s, f| s + type_size(cx, f.mt.ty))
+        flds.foldl(0, |s, f| *s + type_size(cx, f.mt.ty))
       }
 
       ty_class(did, ref substs) => {
         let flds = class_items_as_fields(cx, did, substs);
-        flds.foldl(0, |s, f| s + type_size(cx, f.mt.ty))
+        flds.foldl(0, |s, f| *s + type_size(cx, f.mt.ty))
       }
 
       ty_tup(tys) => {
-        tys.foldl(0, |s, t| s + type_size(cx, t))
+        tys.foldl(0, |s, t| *s + type_size(cx, *t))
       }
 
       ty_enum(did, ref substs) => {
         let variants = substd_enum_variants(cx, did, substs);
         variants.foldl( // find max size of any variant
             0,
-            |m, v| uint::max(m,
+            |m, v| uint::max(*m,
                              // find size of this variant:
-                             v.args.foldl(0, |s, a| s + type_size(cx, a))))
+                             v.args.foldl(0, |s, a| *s + type_size(cx, *a))))
       }
 
       ty_param(_) | ty_self => {
@@ -2238,38 +2243,38 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
             false
           }
 
-          ty_class(did, _) if vec::contains(*seen, did) => {
+          ty_class(ref did, _) if vec::contains(*seen, did) => {
             false
           }
 
           ty_class(did, ref substs) => {
-            vec::push(*seen, did);
-            let r = vec::any(class_items_as_fields(cx, did, substs),
-                             |f| type_requires(cx, seen, r_ty, f.mt.ty));
-            vec::pop(*seen);
+              seen.push(did);
+              let r = vec::any(class_items_as_fields(cx, did, substs),
+                               |f| type_requires(cx, seen, r_ty, f.mt.ty));
+              seen.pop();
             r
           }
 
           ty_tup(ts) => {
-            vec::any(ts, |t| type_requires(cx, seen, r_ty, t))
+            vec::any(ts, |t| type_requires(cx, seen, r_ty, *t))
           }
 
-          ty_enum(did, _) if vec::contains(*seen, did) => {
+          ty_enum(ref did, _) if vec::contains(*seen, did) => {
             false
           }
 
-          ty_enum(did, ref substs) => {
-            vec::push(*seen, did);
-            let vs = enum_variants(cx, did);
-            let r = vec::len(*vs) > 0u && vec::all(*vs, |variant| {
-                vec::any(variant.args, |aty| {
-                    let sty = subst(cx, substs, aty);
-                    type_requires(cx, seen, r_ty, sty)
-                })
-            });
-            vec::pop(*seen);
-            r
-          }
+            ty_enum(did, ref substs) => {
+                seen.push(did);
+                let vs = enum_variants(cx, did);
+                let r = vec::len(*vs) > 0u && vec::all(*vs, |variant| {
+                    vec::any(variant.args, |aty| {
+                        let sty = subst(cx, substs, *aty);
+                        type_requires(cx, seen, r_ty, sty)
+                    })
+                });
+                seen.pop();
+                r
+            }
         };
 
         debug!("subtypes_require(%s, %s)? %b",
@@ -2505,7 +2510,7 @@ fn index_sty(cx: ctxt, sty: &sty) -> Option<mt> {
 }
 
 impl bound_region : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         match self {
           ty::br_self => 0u8.iter_bytes(lsb0, f),
 
@@ -2522,7 +2527,7 @@ impl bound_region : to_bytes::IterBytes {
 }
 
 impl region : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         match self {
           re_bound(ref br) =>
           to_bytes::iter_bytes_2(&0u8, br, lsb0, f),
@@ -2542,7 +2547,7 @@ impl region : to_bytes::IterBytes {
 }
 
 impl vstore : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         match self {
           vstore_fixed(ref u) =>
           to_bytes::iter_bytes_2(&0u8, u, lsb0, f),
@@ -2557,7 +2562,7 @@ impl vstore : to_bytes::IterBytes {
 }
 
 impl substs : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
           to_bytes::iter_bytes_3(&self.self_r,
                                  &self.self_ty,
                                  &self.tps, lsb0, f)
@@ -2565,28 +2570,28 @@ impl substs : to_bytes::IterBytes {
 }
 
 impl mt : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
           to_bytes::iter_bytes_2(&self.ty,
                                  &self.mutbl, lsb0, f)
     }
 }
 
 impl field : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
           to_bytes::iter_bytes_2(&self.ident,
                                  &self.mt, lsb0, f)
     }
 }
 
 impl arg : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
           to_bytes::iter_bytes_2(&self.mode,
                                  &self.ty, lsb0, f)
     }
 }
 
 impl sty : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         match self {
           ty_nil => 0u8.iter_bytes(lsb0, f),
           ty_bool => 1u8.iter_bytes(lsb0, f),
@@ -3036,7 +3041,7 @@ fn param_tys_in_type(ty: t) -> ~[param_ty] {
     do walk_ty(ty) |ty| {
         match get(ty).sty {
           ty_param(p) => {
-            vec::push(rslt, p);
+            rslt.push(p);
           }
           _ => ()
         }
@@ -3052,7 +3057,7 @@ fn occurs_check(tcx: ctxt, sp: span, vid: TyVid, rt: t) {
         let mut rslt = ~[];
         do walk_ty(ty) |ty| {
             match get(ty).sty {
-              ty_infer(TyVar(v)) => vec::push(rslt, v),
+              ty_infer(TyVar(v)) => rslt.push(v),
               _ => ()
             }
         }
@@ -3063,7 +3068,7 @@ fn occurs_check(tcx: ctxt, sp: span, vid: TyVid, rt: t) {
     if !type_needs_infer(rt) { return; }
 
     // Occurs check!
-    if vec::contains(vars_in_type(rt), vid) {
+    if vec::contains(vars_in_type(rt), &vid) {
             // Maybe this should be span_err -- however, there's an
             // assertion later on that the type doesn't contain
             // variables, so in this case we have to be sure to die.
@@ -3704,10 +3709,10 @@ fn class_field_tys(fields: ~[@struct_field]) -> ~[field_ty] {
     for fields.each |field| {
         match field.node.kind {
             named_field(ident, mutability, visibility) => {
-                vec::push(rslt, {ident: ident,
-                                 id: ast_util::local_def(field.node.id),
-                                 vis: visibility,
-                                 mutability: mutability});
+                rslt.push({ident: ident,
+                           id: ast_util::local_def(field.node.id),
+                           vis: visibility,
+                           mutability: mutability});
             }
             unnamed_field => {}
        }
@@ -3747,7 +3752,7 @@ fn class_item_fields(cx:ctxt,
     for lookup_class_fields(cx, did).each |f| {
        // consider all instance vars mut, because the
        // constructor may mutate all vars
-       vec::push(rslt, {ident: f.ident, mt:
+       rslt.push({ident: f.ident, mt:
                {ty: lookup_field_type(cx, did, f.id, substs),
                     mutbl: frob_mutability(f.mutability)}});
     }
diff --git a/src/rustc/middle/typeck/astconv.rs b/src/rustc/middle/typeck/astconv.rs
index 0c474994553..45a7c22e2f9 100644
--- a/src/rustc/middle/typeck/astconv.rs
+++ b/src/rustc/middle/typeck/astconv.rs
@@ -415,7 +415,7 @@ fn ty_of_arg<AC: ast_conv, RS: region_scope Copy Owned>(
     let mode = {
         match a.mode {
           ast::infer(_) if expected_ty.is_some() => {
-            result::get(ty::unify_mode(
+            result::get(&ty::unify_mode(
                 self.tcx(),
                 ty::expected_found {expected: expected_ty.get().mode,
                                     found: a.mode}))
@@ -434,7 +434,7 @@ fn ty_of_arg<AC: ast_conv, RS: region_scope Copy Owned>(
               _ => {
                 let m1 = ast::expl(ty::default_arg_mode_for_ty(self.tcx(),
                                                                ty));
-                result::get(ty::unify_mode(
+                result::get(&ty::unify_mode(
                     self.tcx(),
                     ty::expected_found {expected: m1,
                                         found: a.mode}))
@@ -484,7 +484,7 @@ fn ty_of_fn_decl<AC: ast_conv, RS: region_scope Copy Owned>(
         let rb = in_binding_rscope(rscope);
 
         let input_tys = do decl.inputs.mapi |i, a| {
-            let expected_arg_ty = do expected_tys.chain |e| {
+            let expected_arg_ty = do expected_tys.chain_ref |e| {
                 // no guarantee that the correct number of expected args
                 // were supplied
                 if i < e.inputs.len() {Some(e.inputs[i])} else {None}
diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs
index 8d2384cd530..368b69cafab 100644
--- a/src/rustc/middle/typeck/check.rs
+++ b/src/rustc/middle/typeck/check.rs
@@ -181,7 +181,7 @@ impl isr_alist: get_and_find_region {
 
     fn find(br: ty::bound_region) -> Option<ty::region> {
         for list::each(self) |isr| {
-            let (isr_br, isr_r) = isr;
+            let (isr_br, isr_r) = *isr;
             if isr_br == br { return Some(isr_r); }
         }
         return None;
@@ -279,7 +279,7 @@ fn check_fn(ccx: @crate_ctxt,
 
     // Update the self_info to contain an accurate self type (taking
     // into account explicit self).
-    let self_info = do self_info.chain |info| {
+    let self_info = do self_info.chain_ref |info| {
         // If the self type is sty_static, we don't have a self ty.
         if info.explicit_self.node == ast::sty_static {
             None
@@ -288,7 +288,7 @@ fn check_fn(ccx: @crate_ctxt,
             let ty = method::transform_self_type_for_method(
                 fcx.tcx(), self_region,
                 info.self_ty, info.explicit_self.node);
-            Some({self_ty: ty,.. info})
+            Some({self_ty: ty,.. *info})
         }
     };
 
@@ -308,8 +308,8 @@ fn check_fn(ccx: @crate_ctxt,
     for self_info.each |info| {
         fcx.write_ty(info.self_id, info.self_ty);
     }
-    do vec::iter2(decl.inputs, arg_tys) |input, arg| {
-        fcx.write_ty(input.id, arg);
+    for vec::each2(decl.inputs, arg_tys) |input, arg| {
+        fcx.write_ty(input.id, *arg);
     }
 
     // If we don't have any enclosing function scope, it is time to
@@ -351,8 +351,8 @@ fn check_fn(ccx: @crate_ctxt,
         }
 
         // Add formal parameters.
-        do vec::iter2(arg_tys, decl.inputs) |arg_ty, input| {
-            assign(input.ty.span, input.id, Some(arg_ty));
+        for vec::each2(arg_tys, decl.inputs) |arg_ty, input| {
+            assign(input.ty.span, input.id, Some(*arg_ty));
             debug!("Argument %s is assigned to %s",
                    tcx.sess.str_of(input.ident),
                    fcx.inh.locals.get(input.id).to_str());
@@ -605,7 +605,7 @@ impl @fn_ctxt: region_scope {
 }
 
 impl @fn_ctxt {
-    fn tag() -> ~str { fmt!("%x", ptr::addr_of(*self) as uint) }
+    fn tag() -> ~str { fmt!("%x", ptr::addr_of(&(*self)) as uint) }
 
     fn expr_to_str(expr: @ast::expr) -> ~str {
         fmt!("expr(%?:%s)", expr.id,
@@ -807,7 +807,7 @@ fn do_autoderef(fcx: @fn_ctxt, sp: span, t: ty::t) -> (ty::t, uint) {
                     _ => ()
                 }
             }
-            ty::ty_enum(did, _) => {
+            ty::ty_enum(ref did, _) => {
                 // Watch out for a type like `enum t = @t`.  Such a
                 // type would otherwise infinitely auto-deref.  Only
                 // autoderef loops during typeck (basically, this one
@@ -818,7 +818,7 @@ fn do_autoderef(fcx: @fn_ctxt, sp: span, t: ty::t) -> (ty::t, uint) {
                 if vec::contains(enum_dids, did) {
                     return (t1, autoderefs);
                 }
-                vec::push(enum_dids, did);
+                enum_dids.push(*did);
             }
             _ => { /*ok*/ }
         }
@@ -1864,7 +1864,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
         fcx.write_ty(id, typ);
       }
       ast::expr_rec(fields, base) => {
-        option::iter(&base, |b| { check_expr(fcx, b, expected); });
+        option::iter(&base, |b| { check_expr(fcx, *b, expected); });
         let expected = if expected.is_none() && base.is_some() {
             Some(fcx.expr_ty(base.get()))
         } else { expected };
@@ -1872,8 +1872,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
             match sty { ty::ty_rec(flds) => Some(flds), _ => None }
         );
         let fields_t = vec::map(fields, |f| {
-            bot |= check_expr(fcx, f.node.expr, flds.chain(|flds|
-                vec::find(flds, |tf| tf.ident == f.node.ident)
+            bot |= check_expr(fcx, f.node.expr, flds.chain_ref(|flds|
+                vec::find(*flds, |tf| tf.ident == f.node.ident)
             ).map(|tf| tf.mt.ty));
             let expr_t = fcx.expr_ty(f.node.expr);
             let expr_mt = {ty: expr_t, mutbl: f.node.mutbl};
@@ -2029,8 +2029,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
                         let name = class_field.ident;
                         let (_, seen) = class_field_map.get(name);
                         if !seen {
-                            vec::push(missing_fields,
-                                      ~"`" + tcx.sess.str_of(name) + ~"`");
+                            missing_fields.push(
+                                ~"`" + tcx.sess.str_of(name) + ~"`");
                         }
                     }
 
@@ -2294,11 +2294,11 @@ fn check_enum_variants(ccx: @crate_ctxt,
               }
               _ => ()
             }
-            if vec::contains(*disr_vals, *disr_val) {
+            if vec::contains(*disr_vals, &*disr_val) {
                 ccx.tcx.sess.span_err(v.span,
                                       ~"discriminator value already exists");
             }
-            vec::push(*disr_vals, *disr_val);
+            disr_vals.push(*disr_val);
             let ctor_ty = ty::node_id_to_type(ccx.tcx, v.node.id);
             let arg_tys;
 
@@ -2321,7 +2321,8 @@ fn check_enum_variants(ccx: @crate_ctxt,
             match arg_tys {
                 None => {}
                 Some(arg_tys) => {
-                    vec::push(*variants, @{args: arg_tys, ctor_ty: ctor_ty,
+                    variants.push(
+                        @{args: arg_tys, ctor_ty: ctor_ty,
                           name: v.node.name, id: local_def(v.node.id),
                           disr_val: this_disr_val});
                 }
diff --git a/src/rustc/middle/typeck/check/alt.rs b/src/rustc/middle/typeck/check/alt.rs
index 61d85b2dbfa..0b2e9c8ab3d 100644
--- a/src/rustc/middle/typeck/check/alt.rs
+++ b/src/rustc/middle/typeck/check/alt.rs
@@ -164,8 +164,8 @@ fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::path,
             }
 
             do subpats.iter() |pats| {
-                do vec::iter2(pats, arg_types) |subpat, arg_ty| {
-                  check_pat(pcx, subpat, arg_ty);
+                for vec::each2(*pats, arg_types) |subpat, arg_ty| {
+                  check_pat(pcx, *subpat, *arg_ty);
                 }
             };
         } else if subpats_len > 0u {
diff --git a/src/rustc/middle/typeck/check/method.rs b/src/rustc/middle/typeck/check/method.rs
index 815101a1448..d08d3e9b847 100644
--- a/src/rustc/middle/typeck/check/method.rs
+++ b/src/rustc/middle/typeck/check/method.rs
@@ -48,11 +48,12 @@ candidates in the same way.
 
 If find no matching candidate at all, we proceed to auto-deref the
 receiver type and search again.  We keep doing that until we cannot
-auto-deref any longer.  At that point, we will attempt an auto-ref.
-If THAT fails, method lookup fails altogether.  Autoref itself comes
-in two varieties, autoslice and autoptr.  The former converts `~[]` to
-`&[]` and the latter converts any type `T` to `&mut T`, `&const T`, or
-`&T`.
+auto-deref any longer.  At each step, we also check for candidates
+based on "autoptr", which if the current type is `T`, checks for `&mut
+T`, `&const T`, and `&T` receivers.  Finally, at the very end, we will
+also try autoslice, which converts `~[]` to `&[]` (there is no point
+at trying autoslice earlier, because no autoderefable type is also
+sliceable).
 
 ## Why two phases?
 
@@ -159,22 +160,9 @@ impl LookupContext {
                 None => {}
             }
 
-            // some special logic around newtypes:
-            match ty::get(self_ty).sty {
-                ty_enum(*) => {
-                    // Note: in general, we prefer not to auto-ref a
-                    // partially autoderef'd type, because it
-                    // seems... crazy.  But we have to be careful
-                    // around newtype enums.  They can be further
-                    // deref'd, but they may also have intrinsic
-                    // methods hanging off of them with interior type.
-                    match self.search_for_any_autorefd_method(self_ty,
-                                                              autoderefs) {
-                        Some(move mme) => { return Some(mme); }
-                        None => {}
-                    }
-                }
-                _ => {}
+            match self.search_for_autoptrd_method(self_ty, autoderefs) {
+                Some(move mme) => { return Some(move mme); }
+                None => {}
             }
 
             match self.deref(self_ty, &enum_dids) {
@@ -186,7 +174,7 @@ impl LookupContext {
             }
         }
 
-        self.search_for_any_autorefd_method(self_ty, autoderefs)
+        self.search_for_autosliced_method(self_ty, autoderefs)
     }
 
     fn deref(ty: ty::t, enum_dids: &DVec<ast::def_id>) -> Option<ty::t> {
@@ -194,7 +182,7 @@ impl LookupContext {
             ty_enum(did, _) => {
                 // Watch out for newtype'd enums like "enum t = @T".
                 // See discussion in typeck::check::do_autoderef().
-                if enum_dids.contains(did) {
+                if enum_dids.contains(&did) {
                     return None;
                 }
                 enum_dids.push(did);
@@ -516,30 +504,6 @@ impl LookupContext {
         }
     }
 
-    fn search_for_any_autorefd_method(
-        &self,
-        self_ty: ty::t,
-        autoderefs: uint)
-        -> Option<method_map_entry>
-    {
-        /*!
-         *
-         * Attempts both auto-slice and auto-ptr, as appropriate.
-         */
-
-        match self.search_for_autosliced_method(self_ty, autoderefs) {
-            Some(move mme) => { return Some(move mme); }
-            None => {}
-        }
-
-        match self.search_for_autoptrd_method(self_ty, autoderefs) {
-            Some(move mme) => { return Some(move mme); }
-            None => {}
-        }
-
-        return None;
-    }
-
     fn search_for_autosliced_method(
         &self,
         self_ty: ty::t,
@@ -594,13 +558,7 @@ impl LookupContext {
 
         let tcx = self.tcx();
         match ty::get(self_ty).sty {
-            ty_box(*) | ty_uniq(*) | ty_rptr(*) => {
-                // we should be fully autoderef'd
-                self.bug(fmt!("Receiver type %s should be fully \
-                               autoderef'd by this point",
-                              self.ty_to_str(self_ty)));
-            }
-
+            ty_box(*) | ty_uniq(*) | ty_rptr(*) |
             ty_infer(IntVar(_)) | // FIXME(#3211)---should be resolved
             ty_self | ty_param(*) | ty_nil | ty_bot | ty_bool |
             ty_int(*) | ty_uint(*) |
diff --git a/src/rustc/middle/typeck/check/regionmanip.rs b/src/rustc/middle/typeck/check/regionmanip.rs
index d969ce908f0..4afb3ad78a6 100644
--- a/src/rustc/middle/typeck/check/regionmanip.rs
+++ b/src/rustc/middle/typeck/check/regionmanip.rs
@@ -27,17 +27,17 @@ fn replace_bound_regions_in_fn_ty(
         let region = ty::re_bound(ty::br_self);
         let ty = ty::mk_rptr(tcx, region,
                              { ty: ty::mk_self(tcx), mutbl: m });
-        vec::push(all_tys, ty);
+        all_tys.push(ty);
       }
       _ => {}
     }
 
 
-    for self_ty.each |t| { vec::push(all_tys, *t) }
+    for self_ty.each |t| { all_tys.push(*t) }
 
     debug!("replace_bound_regions_in_fn_ty(self_info.self_ty=%?, fn_ty=%s, \
                 all_tys=%?)",
-           self_ty.map(|t| ty_to_str(tcx, t)),
+           self_ty.map(|t| ty_to_str(tcx, *t)),
            ty_to_str(tcx, ty::mk_fn(tcx, *fn_ty)),
            all_tys.map(|t| ty_to_str(tcx, *t)));
     let _i = indenter();
@@ -50,11 +50,11 @@ fn replace_bound_regions_in_fn_ty(
     let t_fn = ty::fold_sty_to_ty(tcx, &ty_fn, |t| {
         replace_bound_regions(tcx, isr, t)
     });
-    let t_self = self_ty.map(|t| replace_bound_regions(tcx, isr, t));
+    let t_self = self_ty.map(|t| replace_bound_regions(tcx, isr, *t));
 
     debug!("result of replace_bound_regions_in_fn_ty: self_info.self_ty=%?, \
                 fn_ty=%s",
-           t_self.map(|t| ty_to_str(tcx, t)),
+           t_self.map(|t| ty_to_str(tcx, *t)),
            ty_to_str(tcx, t_fn));
 
 
@@ -111,14 +111,14 @@ fn replace_bound_regions_in_fn_ty(
 
         // For each type `ty` in `tys`...
         do tys.foldl(isr) |isr, ty| {
-            let mut isr = isr;
+            let mut isr = *isr;
 
             // Using fold_regions is inefficient, because it
             // constructs new types, but it avoids code duplication in
             // terms of locating all the regions within the various
             // kinds of types.  This had already caused me several
             // bugs so I decided to switch over.
-            do ty::fold_regions(tcx, ty) |r, in_fn| {
+            do ty::fold_regions(tcx, *ty) |r, in_fn| {
                 if !in_fn { isr = append_isr(isr, to_r, r); }
                 r
             };
diff --git a/src/rustc/middle/typeck/check/vtable.rs b/src/rustc/middle/typeck/check/vtable.rs
index d48f5b9c070..e8595b2f50a 100644
--- a/src/rustc/middle/typeck/check/vtable.rs
+++ b/src/rustc/middle/typeck/check/vtable.rs
@@ -23,8 +23,8 @@ use util::common::indenter;
 
 fn has_trait_bounds(tps: ~[ty::param_bounds]) -> bool {
     vec::any(tps, |bs| {
-        vec::any(*bs, |b| {
-            match b { ty::bound_trait(_) => true, _ => false }
+        bs.any(|b| {
+            match b { &ty::bound_trait(_) => true, _ => false }
         })
     })
 }
@@ -51,8 +51,18 @@ fn lookup_vtables(fcx: @fn_ctxt,
             match *bound {
               ty::bound_trait(i_ty) => {
                 let i_ty = ty::subst(tcx, substs, i_ty);
-                vec::push(result, lookup_vtable(fcx, expr, *ty, i_ty,
-                                                allow_unsafe, is_early));
+                match lookup_vtable(fcx, expr, *ty, i_ty, allow_unsafe,
+                                    is_early) {
+                    Some(vtable) => result.push(vtable),
+                    None => {
+                        fcx.tcx().sess.span_fatal(
+                            expr.span,
+                            fmt!("failed to find an implementation of trait \
+                                  %s for %s",
+                                 ty_to_str(fcx.tcx(), i_ty),
+                                 ty_to_str(fcx.tcx(), *ty)));
+                    }
+                }
               }
               _ => ()
             }
@@ -69,7 +79,7 @@ fn fixup_substs(fcx: @fn_ctxt, expr: @ast::expr,
     // use a dummy type just to package up the substs that need fixing up
     let t = ty::mk_trait(tcx, id, substs, ty::vstore_slice(ty::re_static));
     do fixup_ty(fcx, expr, t, is_early).map |t_f| {
-        match ty::get(t_f).sty {
+        match ty::get(*t_f).sty {
           ty::ty_trait(_, substs_f, _) => substs_f,
           _ => fail ~"t_f should be a trait"
         }
@@ -91,7 +101,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
                  trait_ty: ty::t,
                  allow_unsafe: bool,
                  is_early: bool)
-    -> vtable_origin
+    -> Option<vtable_origin>
 {
 
     debug!("lookup_vtable(ty=%s, trait_ty=%s)",
@@ -113,7 +123,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
             // The type has unconstrained type variables in it, so we can't
             // do early resolution on it. Return some completely bogus vtable
             // information: we aren't storing it anyways.
-            return vtable_param(0, 0);
+            return Some(vtable_param(0, 0));
         }
     };
 
@@ -135,7 +145,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
                                            idid);
                                     relate_trait_tys(fcx, expr,
                                                      trait_ty, ity);
-                                    return vtable_param(n, n_bound);
+                                    return Some(vtable_param(n, n_bound));
                                 }
                             }
                             _ => tcx.sess.impossible_case(
@@ -170,7 +180,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
                     }
                 }
             }
-            return vtable_trait(did, substs.tps);
+            return Some(vtable_trait(did, substs.tps));
         }
 
         _ => {
@@ -303,7 +313,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
                                 None => {
                                     assert is_early;
                                     // Bail out with a bogus answer
-                                    return vtable_param(0, 0);
+                                    return Some(vtable_param(0, 0));
                                 }
                             };
 
@@ -331,9 +341,9 @@ fn lookup_vtable(fcx: @fn_ctxt,
                             // the impl as well as the resolved list
                             // of type substitutions for the target
                             // trait.
-                            vec::push(found,
-                                      vtable_static(im.did, substs_f.tps,
-                                                    subres));
+                            found.push(
+                                vtable_static(im.did, substs_f.tps,
+                                              subres));
                         }
                     }
                 }
@@ -341,23 +351,20 @@ fn lookup_vtable(fcx: @fn_ctxt,
 
             match found.len() {
                 0 => { /* fallthrough */ }
-                1 => { return found[0]; }
+                1 => { return Some(found[0]); }
                 _ => {
                     if !is_early {
                         fcx.ccx.tcx.sess.span_err(
                             expr.span,
                             ~"multiple applicable methods in scope");
                     }
-                    return found[0];
+                    return Some(found[0]);
                 }
             }
         }
     }
 
-    tcx.sess.span_fatal(
-        expr.span,
-        fmt!("failed to find an implementation of trait %s for %s",
-             ty_to_str(tcx, trait_ty), ty_to_str(tcx, ty)));
+    return None;
 }
 
 fn fixup_ty(fcx: @fn_ctxt,
@@ -392,8 +399,9 @@ fn connect_trait_tps(fcx: @fn_ctxt, expr: @ast::expr, impl_tys: ~[ty::t],
            ty::get(trait_ty).sty, impl_did);
     match ty::get(trait_ty).sty {
      ty::ty_trait(_, substs, _) => {
-        vec::iter2(substs.tps, trait_tys,
-                   |a, b| demand::suptype(fcx, expr.span, a, b));
+         for vec::each2(substs.tps, trait_tys) |a, b| {
+             demand::suptype(fcx, expr.span, *a, *b)
+         }
       }
      _ => tcx.sess.impossible_case(expr.span, "connect_trait_tps: \
             don't know how to handle a non-trait ty")
@@ -458,13 +466,55 @@ fn early_resolve_expr(ex: @ast::expr, &&fcx: @fn_ctxt, is_early: bool) {
             Look up vtables for the type we're casting to,
             passing in the source and target type
             */
-            let vtable = lookup_vtable(fcx, ex, fcx.expr_ty(src),
-                                       target_ty, true, is_early);
-            /*
-            Map this expression to that vtable (that is: "ex has
-            vtable <vtable>")
-            */
-            if !is_early { cx.vtable_map.insert(ex.id, @~[vtable]); }
+            let ty = fcx.expr_ty(src);
+            let vtable_opt = lookup_vtable(fcx, ex, ty, target_ty, true,
+                                           is_early);
+            match vtable_opt {
+                None => {
+                    // Try the new-style boxed 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(boxed_ty) => {
+                            let vtable_opt = lookup_vtable(fcx, ex,
+                                                           boxed_ty.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 {
+                                        cx.vtable_map.insert(ex.id,
+                                                             @~[vtable]);
+                                    }
+                                }
+                                None => err = true
+                            }
+                        }
+                        _ => err = true
+                    }
+
+                    if err {
+                        fcx.tcx().sess.span_fatal(
+                            ex.span,
+                            fmt!("failed to find an implementation of trait \
+                                  %s for %s",
+                                 ty_to_str(fcx.tcx(), target_ty),
+                                 ty_to_str(fcx.tcx(), ty)));
+                    }
+                }
+                Some(vtable) => {
+                    /*
+                    Map this expression to that vtable (that is: "ex has
+                    vtable <vtable>")
+                    */
+                    if !is_early { cx.vtable_map.insert(ex.id, @~[vtable]); }
+                    fcx.tcx().legacy_boxed_traits.insert(ex.id, ());
+                }
+            }
           }
           _ => ()
         }
diff --git a/src/rustc/middle/typeck/check/writeback.rs b/src/rustc/middle/typeck/check/writeback.rs
index a70e5f600d3..33a26c8daf4 100644
--- a/src/rustc/middle/typeck/check/writeback.rs
+++ b/src/rustc/middle/typeck/check/writeback.rs
@@ -94,7 +94,7 @@ fn resolve_type_vars_for_node(wbcx: wb_ctxt, sp: span, id: ast::node_id)
             let mut new_tps = ~[];
             for substs.tps.each |subst| {
                 match resolve_type_vars_in_type(fcx, sp, *subst) {
-                  Some(t) => vec::push(new_tps, t),
+                  Some(t) => new_tps.push(t),
                   None => { wbcx.success = false; return None; }
                 }
             }
diff --git a/src/rustc/middle/typeck/coherence.rs b/src/rustc/middle/typeck/coherence.rs
index 17d5f81993d..e9238e30c66 100644
--- a/src/rustc/middle/typeck/coherence.rs
+++ b/src/rustc/middle/typeck/coherence.rs
@@ -198,7 +198,7 @@ impl CoherenceChecker {
                                               existing trait",
                                               sess.str_of(mi.ident));
                                       let mut method_infos = mis;
-                                      push(method_infos, mi);
+                                      method_infos.push(mi);
                                       pmm.insert(item.id, method_infos);
                                     }
                                     None => {
@@ -484,7 +484,7 @@ impl CoherenceChecker {
 
                                         let trait_def_id =
                                             self.trait_ref_to_trait_def_id(
-                                                trait_ref);
+                                                *trait_ref);
 
                                         if trait_def_id.crate != local_crate {
                                             let session =
@@ -547,7 +547,7 @@ impl CoherenceChecker {
                     debug!(
                         "(creating impl) adding provided method `%s` to impl",
                         sess.str_of(provided_method.ident));
-                    push(methods, *provided_method);
+                    methods.push(*provided_method);
                 }
             }
 
@@ -559,8 +559,7 @@ impl CoherenceChecker {
                 let mut methods = ~[];
 
                 for ast_methods.each |ast_method| {
-                    push(methods,
-                         method_to_MethodInfo(*ast_method));
+                    methods.push(method_to_MethodInfo(*ast_method));
                 }
 
                 // For each trait that the impl implements, see what
@@ -619,7 +618,7 @@ impl CoherenceChecker {
                             -> @Impl {
         let mut methods = ~[];
         for struct_def.methods.each |ast_method| {
-            push(methods, @{
+            methods.push(@{
                 did: local_def(ast_method.id),
                 n_tps: ast_method.tps.len(),
                 ident: ast_method.ident,
@@ -654,6 +653,10 @@ impl CoherenceChecker {
                                                 module_def_id,
                                                 None);
         for (*implementations).each |implementation| {
+            debug!("coherence: adding impl from external crate: %s",
+                   ty::item_path_str(self.crate_context.tcx,
+                                     implementation.did));
+
             // Make sure we don't visit the same implementation
             // multiple times.
             match impls_seen.find(implementation.did) {
diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs
index 630ac8c13a1..18e29981af3 100644
--- a/src/rustc/middle/typeck/collect.rs
+++ b/src/rustc/middle/typeck/collect.rs
@@ -725,7 +725,7 @@ fn ty_of_foreign_item(ccx: @crate_ctxt, it: @ast::foreign_item)
 fn compute_bounds(ccx: @crate_ctxt,
                   ast_bounds: @~[ast::ty_param_bound]) -> ty::param_bounds {
     @do vec::flat_map(*ast_bounds) |b| {
-        match b {
+        match *b {
           ast::bound_send => ~[ty::bound_send],
           ast::bound_copy => ~[ty::bound_copy],
           ast::bound_const => ~[ty::bound_const],
diff --git a/src/rustc/middle/typeck/infer.rs b/src/rustc/middle/typeck/infer.rs
index a0bb828e412..e5aa0debfe1 100644
--- a/src/rustc/middle/typeck/infer.rs
+++ b/src/rustc/middle/typeck/infer.rs
@@ -507,7 +507,7 @@ fn rollback_to<V:Copy vid, T:Copy>(
     vb: &vals_and_bindings<V, T>, len: uint) {
 
     while vb.bindings.len() != len {
-        let (vid, old_v) = vec::pop(vb.bindings);
+        let (vid, old_v) = vb.bindings.pop();
         vb.vals.insert(vid.to_uint(), old_v);
     }
 }
diff --git a/src/rustc/middle/typeck/infer/combine.rs b/src/rustc/middle/typeck/infer/combine.rs
index 84791b59b32..db65bff9bfe 100644
--- a/src/rustc/middle/typeck/infer/combine.rs
+++ b/src/rustc/middle/typeck/infer/combine.rs
@@ -221,7 +221,7 @@ fn super_tps<C:combine>(
 
     if vec::same_length(as_, bs) {
         iter_vec2(as_, bs, |a, b| {
-            eq_tys(self, a, b)
+            eq_tys(self, *a, *b)
         }).then(|| Ok(as_.to_vec()) )
     } else {
         Err(ty::terr_ty_param_size(
@@ -327,7 +327,7 @@ fn super_fn_sigs<C:combine>(
                           b_args: ~[ty::arg]) -> cres<~[ty::arg]> {
 
         if vec::same_length(a_args, b_args) {
-            map_vec2(a_args, b_args, |a, b| self.args(a, b))
+            map_vec2(a_args, b_args, |a, b| self.args(*a, *b))
         } else {
             Err(ty::terr_arg_count)
         }
@@ -474,7 +474,7 @@ fn super_tys<C:combine>(
       (ty::ty_rec(as_), ty::ty_rec(bs)) => {
         if vec::same_length(as_, bs) {
             map_vec2(as_, bs, |a,b| {
-                self.flds(a, b)
+                self.flds(*a, *b)
             }).chain(|flds| Ok(ty::mk_rec(tcx, flds)) )
         } else {
             Err(ty::terr_record_size(expected_found(self, as_.len(),
@@ -484,7 +484,7 @@ fn super_tys<C:combine>(
 
       (ty::ty_tup(as_), ty::ty_tup(bs)) => {
         if vec::same_length(as_, bs) {
-            map_vec2(as_, bs, |a, b| self.tys(a, b) )
+            map_vec2(as_, bs, |a, b| self.tys(*a, *b) )
                 .chain(|ts| Ok(ty::mk_tup(tcx, ts)) )
         } else {
             Err(ty::terr_tuple_size(
diff --git a/src/rustc/middle/typeck/infer/region_var_bindings.rs b/src/rustc/middle/typeck/infer/region_var_bindings.rs
index c0312872488..8bbdab74d23 100644
--- a/src/rustc/middle/typeck/infer/region_var_bindings.rs
+++ b/src/rustc/middle/typeck/infer/region_var_bindings.rs
@@ -350,7 +350,7 @@ impl Constraint : cmp::Eq {
 }
 
 impl Constraint : to_bytes::IterBytes {
-   pure  fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+   pure  fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         match self {
           ConstrainVarSubVar(ref v0, ref v1) =>
           to_bytes::iter_bytes_3(&0u8, v0, v1, lsb0, f),
@@ -377,7 +377,7 @@ impl TwoRegions : cmp::Eq {
 }
 
 impl TwoRegions : to_bytes::IterBytes {
-    pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) {
+    pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
         to_bytes::iter_bytes_2(&self.a, &self.b, lsb0, f)
     }
 }
@@ -830,7 +830,7 @@ impl RegionVarBindings {
         // It would be nice to write this using map():
         let mut edges = vec::with_capacity(num_edges);
         for self.constraints.each_ref |constraint, span| {
-            vec::push(edges, GraphEdge {
+            edges.push(GraphEdge {
                 next_edge: [mut uint::max_value, uint::max_value],
                 constraint: *constraint,
                 span: *span
@@ -1192,7 +1192,7 @@ impl RegionVarBindings {
         set.insert(*orig_node_idx, ());
         let mut result = ~[];
         while !vec::is_empty(stack) {
-            let node_idx = vec::pop(stack);
+            let node_idx = stack.pop();
             for self.each_edge(graph, node_idx, dir) |edge| {
                 match edge.constraint {
                   ConstrainVarSubVar(from_vid, to_vid) => {
@@ -1201,13 +1201,13 @@ impl RegionVarBindings {
                       Outgoing => to_vid
                     };
                     if set.insert(*vid, ()) {
-                        vec::push(stack, vid);
+                        stack.push(vid);
                     }
                   }
 
                   ConstrainRegSubVar(region, _) => {
                     assert dir == Incoming;
-                    vec::push(result, SpannedRegion {
+                    result.push(SpannedRegion {
                         region: region,
                         span: edge.span
                     });
@@ -1215,7 +1215,7 @@ impl RegionVarBindings {
 
                   ConstrainVarSubReg(_, region) => {
                     assert dir == Outgoing;
-                    vec::push(result, SpannedRegion {
+                    result.push(SpannedRegion {
                         region: region,
                         span: edge.span
                     });
diff --git a/src/rustc/middle/typeck/infer/resolve.rs b/src/rustc/middle/typeck/infer/resolve.rs
index 5d748efc332..2a851a5f7bb 100644
--- a/src/rustc/middle/typeck/infer/resolve.rs
+++ b/src/rustc/middle/typeck/infer/resolve.rs
@@ -170,11 +170,11 @@ impl resolve_state {
     }
 
     fn resolve_ty_var(vid: TyVid) -> ty::t {
-        if vec::contains(self.v_seen, vid) {
+        if vec::contains(self.v_seen, &vid) {
             self.err = Some(cyclic_ty(vid));
             return ty::mk_var(self.infcx.tcx, vid);
         } else {
-            vec::push(self.v_seen, vid);
+            self.v_seen.push(vid);
             let tcx = self.infcx.tcx;
 
             // Nonobvious: prefer the most specific type
@@ -197,7 +197,7 @@ impl resolve_state {
                 ty::mk_var(tcx, vid)
               }
             };
-            vec::pop(self.v_seen);
+            self.v_seen.pop();
             return t1;
         }
     }
diff --git a/src/rustc/middle/typeck/infer/unify.rs b/src/rustc/middle/typeck/infer/unify.rs
index 500a4d5b419..7ccbaa40ada 100644
--- a/src/rustc/middle/typeck/infer/unify.rs
+++ b/src/rustc/middle/typeck/infer/unify.rs
@@ -51,7 +51,7 @@ impl infer_ctxt {
         +new_v: var_value<V, T>) {
 
         let old_v = vb.vals.get(vid.to_uint());
-        vec::push(vb.bindings, (vid, old_v));
+        vb.bindings.push((vid, old_v));
         vb.vals.insert(vid.to_uint(), new_v);
 
         debug!("Updating variable %s from %s to %s",
diff --git a/src/rustc/rustc.rc b/src/rustc/rustc.rc
index d34ae4e35f3..dad27b706e6 100644
--- a/src/rustc/rustc.rc
+++ b/src/rustc/rustc.rc
@@ -12,10 +12,12 @@
 #[no_core];
 
 #[legacy_modes];
+#[legacy_exports];
 
 #[allow(vecs_implicitly_copyable)];
 #[allow(non_camel_case_types)];
-// #[warn(deprecated_pattern)];
+#[allow(deprecated_mode)];
+#[allow(deprecated_pattern)];
 
 extern mod core(vers = "0.4");
 extern mod std(vers = "0.4");
@@ -86,6 +88,7 @@ mod middle {
         mod type_use;
         #[legacy_exports]
         mod reachable;
+        mod machine;
     }
     #[legacy_exports]
     mod ty;
diff --git a/src/rustc/util/common.rs b/src/rustc/util/common.rs
index 4c033515b9a..37cc016e8ea 100644
--- a/src/rustc/util/common.rs
+++ b/src/rustc/util/common.rs
@@ -36,7 +36,7 @@ fn field_expr(f: ast::field) -> @ast::expr { return f.node.expr; }
 
 fn field_exprs(fields: ~[ast::field]) -> ~[@ast::expr] {
     let mut es = ~[];
-    for fields.each |f| { vec::push(es, f.node.expr); }
+    for fields.each |f| { es.push(f.node.expr); }
     return es;
 }
 
diff --git a/src/rustc/util/ppaux.rs b/src/rustc/util/ppaux.rs
index 9ade20c5568..0df5827ed3d 100644
--- a/src/rustc/util/ppaux.rs
+++ b/src/rustc/util/ppaux.rs
@@ -261,7 +261,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> ~str {
                 m == ty::default_arg_mode_for_ty(cx, ty) {
                 ~""
             } else {
-                mode_to_str(ast::expl(m))
+                mode_to_str(ast::expl(m)) + ":"
             }
           }
         };
@@ -286,7 +286,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> ~str {
         }
         s += ~"(";
         let mut strs = ~[];
-        for inputs.each |a| { vec::push(strs, fn_input_to_str(cx, *a)); }
+        for inputs.each |a| { strs.push(fn_input_to_str(cx, *a)); }
         s += str::connect(strs, ~", ");
         s += ~")";
         if ty::get(output).sty != ty_nil {
@@ -342,12 +342,12 @@ fn ty_to_str(cx: ctxt, typ: t) -> ~str {
       ty_type => ~"type",
       ty_rec(elems) => {
         let mut strs: ~[~str] = ~[];
-        for elems.each |fld| { vec::push(strs, field_to_str(cx, *fld)); }
+        for elems.each |fld| { strs.push(field_to_str(cx, *fld)); }
         ~"{" + str::connect(strs, ~",") + ~"}"
       }
       ty_tup(elems) => {
         let mut strs = ~[];
-        for elems.each |elem| { vec::push(strs, ty_to_str(cx, *elem)); }
+        for elems.each |elem| { strs.push(ty_to_str(cx, *elem)); }
         ~"(" + str::connect(strs, ~",") + ~")"
       }
       ty_fn(ref f) => {