From 8a91d33ee7267c71a0ae286739dbd72433470004 Mon Sep 17 00:00:00 2001
From: Eduard Burtescu <edy.burt@gmail.com>
Date: Wed, 1 Oct 2014 01:26:04 +0300
Subject: [PATCH] rustc: remove support for Gc.

---
 src/librustc/lint/builtin.rs                  |  20 +--
 src/librustc/metadata/tydecode.rs             |   1 -
 src/librustc/metadata/tyencode.rs             |   1 -
 src/librustc/middle/borrowck/check_loans.rs   |   5 -
 .../borrowck/gather_loans/gather_moves.rs     |   1 -
 .../middle/borrowck/gather_loans/lifetime.rs  |   4 +-
 .../borrowck/gather_loans/move_error.rs       |   1 -
 .../borrowck/gather_loans/restrictions.rs     |   5 +-
 src/librustc/middle/borrowck/mod.rs           |   5 -
 src/librustc/middle/check_match.rs            |   7 +-
 src/librustc/middle/intrinsicck.rs            |   4 +-
 src/librustc/middle/lang_items.rs             |   4 -
 src/librustc/middle/mem_categorization.rs     |  17 +--
 src/librustc/middle/traits/coherence.rs       |   5 -
 src/librustc/middle/traits/select.rs          |  17 ---
 src/librustc/middle/trans/adt.rs              |   3 -
 src/librustc/middle/trans/base.rs             |  30 -----
 src/librustc/middle/trans/cleanup.rs          |   7 -
 src/librustc/middle/trans/common.rs           |   2 +-
 src/librustc/middle/trans/datum.rs            |  44 +++---
 src/librustc/middle/trans/debuginfo.rs        | 126 +-----------------
 src/librustc/middle/trans/doc.rs              |   2 +-
 src/librustc/middle/trans/expr.rs             |  41 +-----
 src/librustc/middle/trans/glue.rs             |  70 +---------
 src/librustc/middle/trans/reflect.rs          |   8 --
 src/librustc/middle/trans/tvec.rs             |   2 +-
 src/librustc/middle/trans/type_of.rs          |   4 -
 src/librustc/middle/ty.rs                     |  74 +++-------
 src/librustc/middle/ty_fold.rs                |   3 -
 src/librustc/middle/typeck/astconv.rs         |  60 ---------
 src/librustc/middle/typeck/check/method.rs    |   2 +-
 src/librustc/middle/typeck/check/mod.rs       |   6 -
 src/librustc/middle/typeck/check/regionck.rs  |   3 -
 .../middle/typeck/check/regionmanip.rs        |   1 -
 src/librustc/middle/typeck/check/vtable2.rs   |   2 +-
 src/librustc/middle/typeck/coherence/mod.rs   |   6 +-
 src/librustc/middle/typeck/infer/coercion.rs  |   2 +-
 src/librustc/middle/typeck/infer/combine.rs   |   4 -
 .../middle/typeck/infer/error_reporting.rs    |  10 --
 src/librustc/middle/typeck/infer/mod.rs       |   5 -
 src/librustc/middle/typeck/infer/skolemize.rs |   1 -
 src/librustc/middle/typeck/variance.rs        |   2 +-
 src/librustc/util/ppaux.rs                    |   3 +-
 43 files changed, 55 insertions(+), 565 deletions(-)

diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 5774a0485cb..213e8b44813 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -412,26 +412,16 @@ impl LintPass for CTypes {
     }
 }
 
-declare_lint!(MANAGED_HEAP_MEMORY, Allow,
-              "use of managed (@ type) heap memory")
-
 declare_lint!(OWNED_HEAP_MEMORY, Allow,
               "use of owned (Box type) heap memory")
 
-declare_lint!(HEAP_MEMORY, Allow,
-              "use of any (Box type or @ type) heap memory")
-
 pub struct HeapMemory;
 
 impl HeapMemory {
     fn check_heap_type(&self, cx: &Context, span: Span, ty: ty::t) {
-        let mut n_box = 0i;
         let mut n_uniq = 0i;
         ty::fold_ty(cx.tcx, ty, |t| {
             match ty::get(t).sty {
-                ty::ty_box(_) => {
-                    n_box += 1;
-                }
                 ty::ty_uniq(_) |
                 ty::ty_closure(box ty::ClosureTy {
                     store: ty::UniqTraitStore,
@@ -449,21 +439,13 @@ impl HeapMemory {
             let s = ty_to_string(cx.tcx, ty);
             let m = format!("type uses owned (Box type) pointers: {}", s);
             cx.span_lint(OWNED_HEAP_MEMORY, span, m.as_slice());
-            cx.span_lint(HEAP_MEMORY, span, m.as_slice());
-        }
-
-        if n_box > 0 {
-            let s = ty_to_string(cx.tcx, ty);
-            let m = format!("type uses managed (@ type) pointers: {}", s);
-            cx.span_lint(MANAGED_HEAP_MEMORY, span, m.as_slice());
-            cx.span_lint(HEAP_MEMORY, span, m.as_slice());
         }
     }
 }
 
 impl LintPass for HeapMemory {
     fn get_lints(&self) -> LintArray {
-        lint_array!(MANAGED_HEAP_MEMORY, OWNED_HEAP_MEMORY, HEAP_MEMORY)
+        lint_array!(OWNED_HEAP_MEMORY)
     }
 
     fn check_item(&mut self, cx: &Context, it: &ast::Item) {
diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs
index ce5494ef477..a07518cf3f2 100644
--- a/src/librustc/metadata/tydecode.rs
+++ b/src/librustc/metadata/tydecode.rs
@@ -397,7 +397,6 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
         assert_eq!(next(st), '|');
         return ty::mk_param(st.tcx, space, index, did);
       }
-      '@' => return ty::mk_box(st.tcx, parse_ty(st, |x,y| conv(x,y))),
       '~' => return ty::mk_uniq(st.tcx, parse_ty(st, |x,y| conv(x,y))),
       '*' => return ty::mk_ptr(st.tcx, parse_mt(st, |x,y| conv(x,y))),
       '&' => {
diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs
index fd3e4fe6738..e3d8d0e5375 100644
--- a/src/librustc/metadata/tyencode.rs
+++ b/src/librustc/metadata/tyencode.rs
@@ -244,7 +244,6 @@ fn enc_sty(w: &mut SeekableMemWriter, cx: &ctxt, st: &ty::sty) {
             for t in ts.iter() { enc_ty(w, cx, *t); }
             mywrite!(w, "]");
         }
-        ty::ty_box(typ) => { mywrite!(w, "@"); enc_ty(w, cx, typ); }
         ty::ty_uniq(typ) => { mywrite!(w, "~"); enc_ty(w, cx, typ); }
         ty::ty_ptr(mt) => { mywrite!(w, "*"); enc_mt(w, cx, mt); }
         ty::ty_rptr(r, mt) => {
diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs
index a5111cdf7c8..e114eb88705 100644
--- a/src/librustc/middle/borrowck/check_loans.rs
+++ b/src/librustc/middle/borrowck/check_loans.rs
@@ -815,11 +815,6 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
                         return;
                     }
 
-                    mc::cat_deref(_, _, mc::GcPtr) => {
-                        assert_eq!(cmt.mutbl, mc::McImmutable);
-                        return;
-                    }
-
                     mc::cat_rvalue(..) |
                     mc::cat_static_item |
                     mc::cat_deref(_, _, mc::UnsafePtr(..)) |
diff --git a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs
index 25439fce68c..1ae512a244c 100644
--- a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs
+++ b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs
@@ -132,7 +132,6 @@ fn check_and_get_illegal_move_origin(bccx: &BorrowckCtxt,
     match cmt.cat {
         mc::cat_deref(_, _, mc::BorrowedPtr(..)) |
         mc::cat_deref(_, _, mc::Implicit(..)) |
-        mc::cat_deref(_, _, mc::GcPtr) |
         mc::cat_deref(_, _, mc::UnsafePtr(..)) |
         mc::cat_upvar(..) | mc::cat_static_item |
         mc::cat_copied_upvar(mc::CopiedUpvar { onceness: ast::Many, .. }) => {
diff --git a/src/librustc/middle/borrowck/gather_loans/lifetime.rs b/src/librustc/middle/borrowck/gather_loans/lifetime.rs
index c0712332525..8ec58fe0eee 100644
--- a/src/librustc/middle/borrowck/gather_loans/lifetime.rs
+++ b/src/librustc/middle/borrowck/gather_loans/lifetime.rs
@@ -82,8 +82,7 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
 
             mc::cat_downcast(ref base) |
             mc::cat_deref(ref base, _, mc::OwnedPtr) |     // L-Deref-Send
-            mc::cat_interior(ref base, _) |                // L-Field
-            mc::cat_deref(ref base, _, mc::GcPtr) => {
+            mc::cat_interior(ref base, _) => {             // L-Field
                 self.check(base, discr_scope)
             }
 
@@ -185,7 +184,6 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
             }
             mc::cat_downcast(ref cmt) |
             mc::cat_deref(ref cmt, _, mc::OwnedPtr) |
-            mc::cat_deref(ref cmt, _, mc::GcPtr) |
             mc::cat_interior(ref cmt, _) |
             mc::cat_discr(ref cmt, _) => {
                 self.scope(cmt)
diff --git a/src/librustc/middle/borrowck/gather_loans/move_error.rs b/src/librustc/middle/borrowck/gather_loans/move_error.rs
index b826768c937..1b18d07f590 100644
--- a/src/librustc/middle/borrowck/gather_loans/move_error.rs
+++ b/src/librustc/middle/borrowck/gather_loans/move_error.rs
@@ -114,7 +114,6 @@ fn report_cannot_move_out_of(bccx: &BorrowckCtxt, move_from: mc::cmt) {
     match move_from.cat {
         mc::cat_deref(_, _, mc::BorrowedPtr(..)) |
         mc::cat_deref(_, _, mc::Implicit(..)) |
-        mc::cat_deref(_, _, mc::GcPtr) |
         mc::cat_deref(_, _, mc::UnsafePtr(..)) |
         mc::cat_upvar(..) | mc::cat_static_item |
         mc::cat_copied_upvar(mc::CopiedUpvar { onceness: ast::Many, .. }) => {
diff --git a/src/librustc/middle/borrowck/gather_loans/restrictions.rs b/src/librustc/middle/borrowck/gather_loans/restrictions.rs
index e0018919b98..067a73fcc9b 100644
--- a/src/librustc/middle/borrowck/gather_loans/restrictions.rs
+++ b/src/librustc/middle/borrowck/gather_loans/restrictions.rs
@@ -101,16 +101,13 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
                 self.extend(result, cmt.mutbl, LpInterior(i))
             }
 
-            mc::cat_deref(cmt_base, _, pk @ mc::OwnedPtr) |
-            mc::cat_deref(cmt_base, _, pk @ mc::GcPtr) => {
+            mc::cat_deref(cmt_base, _, pk @ mc::OwnedPtr) => {
                 // R-Deref-Send-Pointer
                 //
                 // When we borrow the interior of an owned pointer, we
                 // cannot permit the base to be mutated, because that
                 // would cause the unique pointer to be freed.
                 //
-                // For a managed pointer, the rules are basically the
-                // same, because this could be the last ref.
                 // Eventually we should make these non-special and
                 // just rely on Deref<T> implementation.
                 let result = self.restrict(cmt_base);
diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs
index b411620dac0..234afc7ae7a 100644
--- a/src/librustc/middle/borrowck/mod.rs
+++ b/src/librustc/middle/borrowck/mod.rs
@@ -730,11 +730,6 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
                     span,
                     format!("{} in a static location", prefix).as_slice());
             }
-            mc::AliasableManaged => {
-                self.tcx.sess.span_err(
-                    span,
-                    format!("{} in a `Gc` pointer", prefix).as_slice());
-            }
             mc::AliasableBorrowed => {
                 self.tcx.sess.span_err(
                     span,
diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs
index bef63ec3153..90d75b9554b 100644
--- a/src/librustc/middle/check_match.rs
+++ b/src/librustc/middle/check_match.rs
@@ -440,11 +440,6 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
             }
         }
 
-        ty::ty_box(_) => {
-            assert_eq!(pats_len, 1);
-            PatBox(pats.nth(0).unwrap())
-        }
-
         ty::ty_vec(_, Some(len)) => {
             assert_eq!(pats_len, len);
             PatVec(pats.collect(), None, vec![])
@@ -681,7 +676,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
 pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: ty::t) -> uint {
     match ty::get(ty).sty {
         ty::ty_tup(ref fs) => fs.len(),
-        ty::ty_box(_) | ty::ty_uniq(_) => 1u,
+        ty::ty_uniq(_) => 1u,
         ty::ty_rptr(_, ty::mt { ty: ty, .. }) => match ty::get(ty).sty {
             ty::ty_vec(_, None) => match *ctor {
                 Slice(length) => length,
diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs
index dccb93f58cc..de291595ccc 100644
--- a/src/librustc/middle/intrinsicck.rs
+++ b/src/librustc/middle/intrinsicck.rs
@@ -28,8 +28,8 @@ fn type_size_is_affected_by_type_parameters(tcx: &ty::ctxt, typ: ty::t)
     let mut result = false;
     ty::maybe_walk_ty(typ, |typ| {
         match ty::get(typ).sty {
-            ty::ty_box(_) | ty::ty_uniq(_) | ty::ty_ptr(_) |
-            ty::ty_rptr(..) | ty::ty_bare_fn(..) | ty::ty_closure(..) => {
+            ty::ty_uniq(_) | ty::ty_ptr(_) | ty::ty_rptr(..) |
+            ty::ty_bare_fn(..) | ty::ty_closure(..) => {
                 false
             }
             ty::ty_param(_) => {
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index 50c92b45fdf..3c9ebd86b94 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -279,8 +279,6 @@ lets_do_this! {
 
     ExchangeMallocFnLangItem,        "exchange_malloc",         exchange_malloc_fn;
     ExchangeFreeFnLangItem,          "exchange_free",           exchange_free_fn;
-    MallocFnLangItem,                "malloc",                  malloc_fn;
-    FreeFnLangItem,                  "free",                    free_fn;
     StrDupUniqFnLangItem,            "strdup_uniq",             strdup_uniq_fn;
 
     StartFnLangItem,                 "start",                   start_fn;
@@ -293,9 +291,7 @@ lets_do_this! {
 
     EhPersonalityLangItem,           "eh_personality",          eh_personality;
 
-    ManagedHeapLangItem,             "managed_heap",            managed_heap;
     ExchangeHeapLangItem,            "exchange_heap",           exchange_heap;
-    GcLangItem,                      "gc",                      gc;
     OwnedBoxLangItem,                "owned_box",               owned_box;
 
     CovariantTypeItem,               "covariant_type",          covariant_type;
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index bb44b1f55cb..273360c9279 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -104,7 +104,6 @@ pub struct CopiedUpvar {
 #[deriving(Clone, PartialEq, Eq, Hash)]
 pub enum PointerKind {
     OwnedPtr,
-    GcPtr,
     BorrowedPtr(ty::BorrowKind, ty::Region),
     Implicit(ty::BorrowKind, ty::Region),     // Implicit deref of a borrowed ptr.
     UnsafePtr(ast::Mutability)
@@ -191,10 +190,6 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
             Some(deref_ptr(BorrowedPtr(ty::ImmBorrow, r)))
         }
 
-        ty::ty_box(..) => {
-            Some(deref_ptr(GcPtr))
-        }
-
         ty::ty_ptr(ref mt) => {
             Some(deref_ptr(UnsafePtr(mt.mutbl)))
         }
@@ -302,9 +297,6 @@ impl MutabilityCategory {
             BorrowedPtr(borrow_kind, _) | Implicit(borrow_kind, _) => {
                 MutabilityCategory::from_borrow_kind(borrow_kind)
             }
-            GcPtr => {
-                McImmutable
-            }
             UnsafePtr(m) => {
                 MutabilityCategory::from_mutbl(m)
             }
@@ -1200,7 +1192,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
                           Implicit(..) => {
                             "dereference (dereference is implicit, due to indexing)".to_string()
                           }
-                          OwnedPtr | GcPtr => format!("dereference of `{}`", ptr_sigil(pk)),
+                          OwnedPtr => format!("dereference of `{}`", ptr_sigil(pk)),
                           _ => format!("dereference of `{}`-pointer", ptr_sigil(pk))
                       }
                   }
@@ -1237,7 +1229,6 @@ pub enum InteriorSafety {
 }
 
 pub enum AliasableReason {
-    AliasableManaged,
     AliasableBorrowed,
     AliasableOther,
     AliasableStatic(InteriorSafety),
@@ -1256,7 +1247,6 @@ impl cmt_ {
             cat_copied_upvar(..) |
             cat_local(..) |
             cat_deref(_, _, UnsafePtr(..)) |
-            cat_deref(_, _, GcPtr(..)) |
             cat_deref(_, _, BorrowedPtr(..)) |
             cat_deref(_, _, Implicit(..)) |
             cat_upvar(..) => {
@@ -1320,10 +1310,6 @@ impl cmt_ {
                 }
             }
 
-            cat_deref(_, _, GcPtr) => {
-                Some(AliasableManaged)
-            }
-
             cat_deref(_, _, BorrowedPtr(ty::ImmBorrow, _)) |
             cat_deref(_, _, Implicit(ty::ImmBorrow, _)) => {
                 Some(AliasableBorrowed)
@@ -1371,7 +1357,6 @@ impl Repr for categorization {
 pub fn ptr_sigil(ptr: PointerKind) -> &'static str {
     match ptr {
         OwnedPtr => "Box",
-        GcPtr => "Gc",
         BorrowedPtr(ty::ImmBorrow, _) |
         Implicit(ty::ImmBorrow, _) => "&",
         BorrowedPtr(ty::MutBorrow, _) |
diff --git a/src/librustc/middle/traits/coherence.rs b/src/librustc/middle/traits/coherence.rs
index 9b179d3e895..080f9ff5bc7 100644
--- a/src/librustc/middle/traits/coherence.rs
+++ b/src/librustc/middle/traits/coherence.rs
@@ -104,11 +104,6 @@ pub fn ty_is_local(tcx: &ty::ctxt,
             krate == Some(ast::LOCAL_CRATE) || ty_is_local(tcx, t)
         }
 
-        ty::ty_box(t) => {
-            let krate = tcx.lang_items.gc().map(|d| d.krate);
-            krate == Some(ast::LOCAL_CRATE) || ty_is_local(tcx, t)
-        }
-
         ty::ty_vec(t, _) |
         ty::ty_ptr(ty::mt { ty: t, .. }) |
         ty::ty_rptr(_, ty::mt { ty: t, .. }) => {
diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs
index 61477fdeed5..b86fabccf93 100644
--- a/src/librustc/middle/traits/select.rs
+++ b/src/librustc/middle/traits/select.rs
@@ -713,23 +713,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 ok(self, Always)
             }
 
-            ty::ty_box(_) => {
-                match bound {
-                    ty::BoundSync |
-                    ty::BoundSend |
-                    ty::BoundCopy => {
-                        // Managed data is not copyable, sendable, nor
-                        // synchronized, regardless of referent.
-                        ok(self, Never)
-                    }
-
-                    ty::BoundSized => {
-                        // But it is sized, regardless of referent.
-                        ok(self, Always)
-                    }
-                }
-            }
-
             ty::ty_uniq(referent_ty) => {  // Box<T>
                 match bound {
                     ty::BoundCopy => {
diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs
index 4d8e0145901..506b12de084 100644
--- a/src/librustc/middle/trans/adt.rs
+++ b/src/librustc/middle/trans/adt.rs
@@ -321,9 +321,6 @@ impl Case {
                     _ => return Some(ThinPointer(i))
                 },
 
-                // Gc<T> is just a pointer
-                ty::ty_box(..) => return Some(ThinPointer(i)),
-
                 // Functions are just pointers
                 ty::ty_bare_fn(..) => return Some(ThinPointer(i)),
 
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 03045777155..f65827753aa 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -397,36 +397,6 @@ pub fn malloc_raw_dyn_proc<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: ty::t) -> Resu
     Result::new(bcx, llbox)
 }
 
-
-pub fn malloc_raw_dyn_managed<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-                                          t: ty::t,
-                                          alloc_fn: LangItem,
-                                          size: ValueRef)
-                                          -> Result<'blk, 'tcx> {
-    let _icx = push_ctxt("malloc_raw_dyn_managed");
-    let ccx = bcx.ccx();
-
-    let langcall = require_alloc_fn(bcx, t, alloc_fn);
-
-    // Grab the TypeRef type of box_ptr_ty.
-    let box_ptr_ty = ty::mk_box(bcx.tcx(), t);
-    let llty = type_of(ccx, box_ptr_ty);
-    let llalign = C_uint(ccx, type_of::align_of(ccx, box_ptr_ty) as uint);
-
-    // Allocate space:
-    let drop_glue = glue::get_drop_glue(ccx, t);
-    let r = callee::trans_lang_call(
-        bcx,
-        langcall,
-        [
-            PointerCast(bcx, drop_glue, Type::glue_fn(ccx, Type::i8p(ccx)).ptr_to()),
-            size,
-            llalign
-        ],
-        None);
-    Result::new(r.bcx, PointerCast(r.bcx, r.val, llty))
-}
-
 // Type descriptor and type glue stuff
 
 pub fn get_tydesc(ccx: &CrateContext, t: ty::t) -> Rc<tydesc_info> {
diff --git a/src/librustc/middle/trans/cleanup.rs b/src/librustc/middle/trans/cleanup.rs
index 35464be0e43..20fd0b0eb3d 100644
--- a/src/librustc/middle/trans/cleanup.rs
+++ b/src/librustc/middle/trans/cleanup.rs
@@ -960,7 +960,6 @@ impl Cleanup for DropValue {
 }
 
 pub enum Heap {
-    HeapManaged,
     HeapExchange
 }
 
@@ -986,9 +985,6 @@ impl Cleanup for FreeValue {
         apply_debug_loc(bcx.fcx, debug_loc);
 
         match self.heap {
-            HeapManaged => {
-                glue::trans_free(bcx, self.ptr)
-            }
             HeapExchange => {
                 glue::trans_exchange_free_ty(bcx, self.ptr, self.content_ty)
             }
@@ -1019,9 +1015,6 @@ impl Cleanup for FreeSlice {
         apply_debug_loc(bcx.fcx, debug_loc);
 
         match self.heap {
-            HeapManaged => {
-                glue::trans_free(bcx, self.ptr)
-            }
             HeapExchange => {
                 glue::trans_exchange_free_dyn(bcx, self.ptr, self.size, self.align)
             }
diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs
index 30f91c82930..7daee22e614 100644
--- a/src/librustc/middle/trans/common.rs
+++ b/src/librustc/middle/trans/common.rs
@@ -71,7 +71,7 @@ pub fn type_is_immediate(ccx: &CrateContext, ty: ty::t) -> bool {
     use middle::trans::type_of::sizing_type_of;
 
     let tcx = ccx.tcx();
-    let simple = ty::type_is_scalar(ty) || ty::type_is_boxed(ty) ||
+    let simple = ty::type_is_scalar(ty) ||
         ty::type_is_unique(ty) || ty::type_is_region_ptr(ty) ||
         type_is_newtype_immediate(ccx, ty) || ty::type_is_bot(ty) ||
         ty::type_is_simd(tcx, ty);
diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs
index 84d9f2cb740..260bde0f07f 100644
--- a/src/librustc/middle/trans/datum.rs
+++ b/src/librustc/middle/trans/datum.rs
@@ -20,7 +20,6 @@ use middle::trans::common::*;
 use middle::trans::cleanup;
 use middle::trans::cleanup::CleanupMethods;
 use middle::trans::expr;
-use middle::trans::glue;
 use middle::trans::tvec;
 use middle::trans::type_of;
 use middle::ty;
@@ -240,14 +239,9 @@ impl KindOps for Lvalue {
          */
 
         if ty::type_needs_drop(bcx.tcx(), ty) {
-            if ty::type_moves_by_default(bcx.tcx(), ty) {
-                // cancel cleanup of affine values by zeroing out
-                let () = zero_mem(bcx, val, ty);
-                bcx
-            } else {
-                // incr. refcount for @T or newtype'd @T
-                glue::take_ty(bcx, val, ty)
-            }
+            // cancel cleanup of affine values by zeroing out
+            let () = zero_mem(bcx, val, ty);
+            bcx
         } else {
             bcx
         }
@@ -567,15 +561,15 @@ impl<K:KindOps> Datum<K> {
          * is moved).
          */
 
-        self.shallow_copy(bcx, dst);
+        self.shallow_copy_raw(bcx, dst);
 
         self.kind.post_store(bcx, self.val, self.ty)
     }
 
-    fn shallow_copy<'blk, 'tcx>(&self,
-                                bcx: Block<'blk, 'tcx>,
-                                dst: ValueRef)
-                                -> Block<'blk, 'tcx> {
+    fn shallow_copy_raw<'blk, 'tcx>(&self,
+                                    bcx: Block<'blk, 'tcx>,
+                                    dst: ValueRef)
+                                    -> Block<'blk, 'tcx> {
         /*!
          * Helper function that performs a shallow copy of this value
          * into `dst`, which should be a pointer to a memory location
@@ -584,10 +578,9 @@ impl<K:KindOps> Datum<K> {
          *
          * This function is private to datums because it leaves memory
          * in an unstable state, where the source value has been
-         * copied but not zeroed. Public methods are `store_to` (if
-         * you no longer need the source value) or
-         * `shallow_copy_and_take` (if you wish the source value to
-         * remain valid).
+         * copied but not zeroed. Public methods are `store_to`
+         * (if you no longer need the source value) or `shallow_copy`
+         * (if you wish the source value to remain valid).
          */
 
         let _icx = push_ctxt("copy_to_no_check");
@@ -605,22 +598,19 @@ impl<K:KindOps> Datum<K> {
         return bcx;
     }
 
-    pub fn shallow_copy_and_take<'blk, 'tcx>(&self,
-                                             bcx: Block<'blk, 'tcx>,
-                                             dst: ValueRef)
-                                             -> Block<'blk, 'tcx> {
+    pub fn shallow_copy<'blk, 'tcx>(&self,
+                                    bcx: Block<'blk, 'tcx>,
+                                    dst: ValueRef)
+                                    -> Block<'blk, 'tcx> {
         /*!
-         * Copies the value into a new location and runs any necessary
-         * take glue on the new location. This function always
+         * Copies the value into a new location. This function always
          * preserves the existing datum as a valid value. Therefore,
          * it does not consume `self` and, also, cannot be applied to
          * affine values (since they must never be duplicated).
          */
 
         assert!(!ty::type_moves_by_default(bcx.tcx(), self.ty));
-        let mut bcx = bcx;
-        bcx = self.shallow_copy(bcx, dst);
-        glue::take_ty(bcx, dst, self.ty)
+        self.shallow_copy_raw(bcx, dst)
     }
 
     #[allow(dead_code)] // useful for debugging
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index dc328833d54..a29fd7f6ceb 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -373,12 +373,6 @@ impl TypeMap {
                     unique_type_id.push_str(component_type_id.as_slice());
                 }
             },
-            ty::ty_box(inner_type) => {
-                unique_type_id.push_char('@');
-                let inner_type_id = self.get_unique_type_id_of_type(cx, inner_type);
-                let inner_type_id = self.get_unique_type_id_as_string(inner_type_id);
-                unique_type_id.push_str(inner_type_id.as_slice());
-            },
             ty::ty_uniq(inner_type) => {
                 unique_type_id.push_char('~');
                 let inner_type_id = self.get_unique_type_id_of_type(cx, inner_type);
@@ -596,18 +590,6 @@ impl TypeMap {
         let interner_key = self.unique_id_interner.intern(Rc::new(enum_variant_type_id));
         UniqueTypeId(interner_key)
     }
-
-    fn get_unique_type_id_of_gc_box(&mut self,
-                                    cx: &CrateContext,
-                                    element_type: ty::t)
-                                 -> UniqueTypeId {
-        let element_type_id = self.get_unique_type_id_of_type(cx, element_type);
-        let gc_box_type_id = format!("{{GC_BOX<{}>}}",
-                                     self.get_unique_type_id_as_string(element_type_id)
-                                         .as_slice());
-        let interner_key = self.unique_id_interner.intern(Rc::new(gc_box_type_id));
-        UniqueTypeId(interner_key)
-    }
 }
 
 // Returns from the enclosing function if the type metadata with the given
@@ -2646,105 +2628,6 @@ fn create_struct_stub(cx: &CrateContext,
     return metadata_stub;
 }
 
-fn at_box_metadata(cx: &CrateContext,
-                   at_pointer_type: ty::t,
-                   content_type: ty::t,
-                   unique_type_id: UniqueTypeId)
-                -> MetadataCreationResult {
-    let content_type_metadata = type_metadata(cx, content_type, codemap::DUMMY_SP);
-
-    return_if_metadata_created_in_meantime!(cx, unique_type_id);
-
-    let content_type_name = compute_debuginfo_type_name(cx, content_type, true);
-    let content_type_name = content_type_name.as_slice();
-    let content_llvm_type = type_of::type_of(cx, content_type);
-
-    let box_type_name = format!("GcBox<{}>", content_type_name);
-    let box_llvm_type = Type::at_box(cx, content_llvm_type);
-    let member_llvm_types = box_llvm_type.field_types();
-    assert!(box_layout_is_correct(cx,
-                                  member_llvm_types.as_slice(),
-                                  content_llvm_type));
-
-    let int_type = ty::mk_int();
-    let nil_pointer_type = ty::mk_nil_ptr(cx.tcx());
-    let nil_pointer_type_metadata = type_metadata(cx,
-                                                  nil_pointer_type,
-                                                  codemap::DUMMY_SP);
-    let member_descriptions = [
-        MemberDescription {
-            name: "refcnt".to_string(),
-            llvm_type: *member_llvm_types.get(0),
-            type_metadata: type_metadata(cx, int_type, codemap::DUMMY_SP),
-            offset: ComputedMemberOffset,
-            flags: FLAGS_ARTIFICAL,
-        },
-        MemberDescription {
-            name: "drop_glue".to_string(),
-            llvm_type: *member_llvm_types.get(1),
-            type_metadata: nil_pointer_type_metadata,
-            offset: ComputedMemberOffset,
-            flags: FLAGS_ARTIFICAL,
-        },
-        MemberDescription {
-            name: "prev".to_string(),
-            llvm_type: *member_llvm_types.get(2),
-            type_metadata: nil_pointer_type_metadata,
-            offset: ComputedMemberOffset,
-            flags: FLAGS_ARTIFICAL,
-        },
-        MemberDescription {
-            name: "next".to_string(),
-            llvm_type: *member_llvm_types.get(3),
-            type_metadata: nil_pointer_type_metadata,
-            offset: ComputedMemberOffset,
-            flags: FLAGS_ARTIFICAL,
-        },
-        MemberDescription {
-            name: "val".to_string(),
-            llvm_type: *member_llvm_types.get(4),
-            type_metadata: content_type_metadata,
-            offset: ComputedMemberOffset,
-            flags: FLAGS_ARTIFICAL,
-        }
-    ];
-
-    let gc_box_unique_id = debug_context(cx).type_map
-                                            .borrow_mut()
-                                            .get_unique_type_id_of_gc_box(cx, content_type);
-
-    let gc_box_metadata = composite_type_metadata(
-        cx,
-        box_llvm_type,
-        box_type_name.as_slice(),
-        gc_box_unique_id,
-        member_descriptions,
-        UNKNOWN_SCOPE_METADATA,
-        UNKNOWN_FILE_METADATA,
-        codemap::DUMMY_SP);
-
-    let gc_pointer_metadata = pointer_type_metadata(cx,
-                                                    at_pointer_type,
-                                                    gc_box_metadata);
-
-    return MetadataCreationResult::new(gc_pointer_metadata, false);
-
-    // Unfortunately, we cannot assert anything but the correct types here---and
-    // not whether the 'next' and 'prev' pointers are in the correct order.
-    fn box_layout_is_correct(cx: &CrateContext,
-                             member_llvm_types: &[Type],
-                             content_llvm_type: Type)
-                          -> bool {
-        member_llvm_types.len() == 5 &&
-        member_llvm_types[0] == cx.int_type() &&
-        member_llvm_types[1] == Type::generic_glue_fn(cx).ptr_to() &&
-        member_llvm_types[2] == Type::i8(cx).ptr_to() &&
-        member_llvm_types[3] == Type::i8(cx).ptr_to() &&
-        member_llvm_types[4] == content_llvm_type
-    }
-}
-
-
 fn fixed_vec_metadata(cx: &CrateContext,
                       unique_type_id: UniqueTypeId,
                       element_type: ty::t,
@@ -2968,9 +2851,6 @@ fn type_metadata(cx: &CrateContext,
         ty::ty_enum(def_id, _) => {
             prepare_enum_metadata(cx, t, def_id, unique_type_id, usage_site_span).finalize(cx)
         }
-        ty::ty_box(pointee_type) => {
-            at_box_metadata(cx, t, pointee_type, unique_type_id)
-        }
         ty::ty_vec(typ, Some(len)) => {
             fixed_vec_metadata(cx, unique_type_id, typ, len, usage_site_span)
         }
@@ -3702,7 +3582,7 @@ fn populate_scope_map(cx: &CrateContext,
             ast::ExprInlineAsm(ast::InlineAsm { inputs: ref inputs,
                                                 outputs: ref outputs,
                                                 .. }) => {
-                // inputs, outputs: ~[(String, Gc<expr>)]
+                // inputs, outputs: Vec<(String, P<Expr>)>
                 for &(_, ref exp) in inputs.iter() {
                     walk_expr(cx, &**exp, scope_stack, scope_map);
                 }
@@ -3777,10 +3657,6 @@ fn push_debuginfo_type_name(cx: &CrateContext,
             push_debuginfo_type_name(cx, inner_type, true, output);
             output.push_char('>');
         },
-        ty::ty_box(inner_type) => {
-            output.push_char('@');
-            push_debuginfo_type_name(cx, inner_type, true, output);
-        },
         ty::ty_ptr(ty::mt { ty: inner_type, mutbl } ) => {
             output.push_char('*');
             match mutbl {
diff --git a/src/librustc/middle/trans/doc.rs b/src/librustc/middle/trans/doc.rs
index 56bf2561338..d6df0d88a76 100644
--- a/src/librustc/middle/trans/doc.rs
+++ b/src/librustc/middle/trans/doc.rs
@@ -65,7 +65,7 @@ Some of the datum methods, however, are designed to work only on
 copyable values such as ints or pointers. Those methods may borrow the
 datum (`&self`) rather than consume it, but they always include
 assertions on the type of the value represented to check that this
-makes sense. An example is `shallow_copy_and_take()`, which duplicates
+makes sense. An example is `shallow_copy()`, which duplicates
 a datum value.
 
 Translating an expression always yields a `Datum<Expr>` result, but
diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs
index 0b47544c562..cd4ad85d094 100644
--- a/src/librustc/middle/trans/expr.rs
+++ b/src/librustc/middle/trans/expr.rs
@@ -38,7 +38,6 @@ use llvm;
 use llvm::{ValueRef};
 use metadata::csearch;
 use middle::def;
-use middle::lang_items::MallocFnLangItem;
 use middle::mem_categorization::Typer;
 use middle::subst;
 use middle::subst::Subst;
@@ -624,18 +623,15 @@ fn trans_datum_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             DatumBlock::new(bcx, scratch.to_expr_datum())
         }
         ast::ExprBox(_, ref contents) => {
-            // Special case for `Box<T>` and `Gc<T>`
+            // Special case for `Box<T>`
             let box_ty = expr_ty(bcx, expr);
             let contents_ty = expr_ty(bcx, &**contents);
             match ty::get(box_ty).sty {
                 ty::ty_uniq(..) => {
                     trans_uniq_expr(bcx, box_ty, &**contents, contents_ty)
                 }
-                ty::ty_box(..) => {
-                    trans_managed_expr(bcx, box_ty, &**contents, contents_ty)
-                }
                 _ => bcx.sess().span_bug(expr.span,
-                                         "expected unique or managed box")
+                                         "expected unique box")
             }
 
         }
@@ -1572,26 +1568,6 @@ fn trans_uniq_expr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     immediate_rvalue_bcx(bcx, val, box_ty).to_expr_datumblock()
 }
 
-fn trans_managed_expr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-                                  box_ty: ty::t,
-                                  contents: &ast::Expr,
-                                  contents_ty: ty::t)
-                                  -> DatumBlock<'blk, 'tcx, Expr> {
-    let _icx = push_ctxt("trans_managed_expr");
-    let fcx = bcx.fcx;
-    let ty = type_of::type_of(bcx.ccx(), contents_ty);
-    let Result {bcx, val: bx} = malloc_raw_dyn_managed(bcx, contents_ty, MallocFnLangItem,
-                                                        llsize_of(bcx.ccx(), ty));
-    let body = GEPi(bcx, bx, [0u, abi::box_field_body]);
-
-    let custom_cleanup_scope = fcx.push_custom_cleanup_scope();
-    fcx.schedule_free_value(cleanup::CustomScope(custom_cleanup_scope),
-                            bx, cleanup::HeapManaged, contents_ty);
-    let bcx = trans_into(bcx, contents, SaveIn(body));
-    fcx.pop_custom_cleanup_scope(custom_cleanup_scope);
-    immediate_rvalue_bcx(bcx, bx, box_ty).to_expr_datumblock()
-}
-
 fn trans_addr_of<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                              expr: &ast::Expr,
                              subexpr: &ast::Expr)
@@ -1924,10 +1900,6 @@ pub fn cast_type_kind(tcx: &ty::ctxt, t: ty::t) -> cast_kind {
 }
 
 fn cast_is_noop(t_in: ty::t, t_out: ty::t) -> bool {
-    if ty::type_is_boxed(t_in) || ty::type_is_boxed(t_out) {
-        return false;
-    }
-
     match (ty::deref(t_in, true), ty::deref(t_out, true)) {
         (Some(ty::mt{ ty: t_in, .. }), Some(ty::mt{ ty: t_out, .. })) => {
             t_in == t_out
@@ -2160,15 +2132,6 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             }
         }
 
-        ty::ty_box(content_ty) => {
-            let datum = unpack_datum!(
-                bcx, datum.to_lvalue_datum(bcx, "deref", expr.id));
-            let llptrref = datum.to_llref();
-            let llptr = Load(bcx, llptrref);
-            let llbody = GEPi(bcx, llptr, [0u, abi::box_field_body]);
-            DatumBlock::new(bcx, Datum::new(llbody, content_ty, LvalueExpr))
-        }
-
         ty::ty_ptr(ty::mt { ty: content_ty, .. }) |
         ty::ty_rptr(_, ty::mt { ty: content_ty, .. }) => {
             if ty::type_is_sized(bcx.tcx(), content_ty) {
diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs
index c8cc89ca66a..33a46c0ba36 100644
--- a/src/librustc/middle/trans/glue.rs
+++ b/src/librustc/middle/trans/glue.rs
@@ -17,7 +17,7 @@ use back::abi;
 use back::link::*;
 use llvm::{ValueRef, True, get_param};
 use llvm;
-use middle::lang_items::{FreeFnLangItem, ExchangeFreeFnLangItem};
+use middle::lang_items::ExchangeFreeFnLangItem;
 use middle::subst;
 use middle::subst::Subst;
 use middle::trans::adt;
@@ -46,15 +46,6 @@ use libc::c_uint;
 use syntax::ast;
 use syntax::parse::token;
 
-pub fn trans_free<'blk, 'tcx>(cx: Block<'blk, 'tcx>, v: ValueRef)
-                              -> Block<'blk, 'tcx> {
-    let _icx = push_ctxt("trans_free");
-    callee::trans_lang_call(cx,
-        langcall(cx, None, "", FreeFnLangItem),
-        [PointerCast(cx, v, Type::i8p(cx.ccx()))],
-        Some(expr::Ignore)).bcx
-}
-
 pub fn trans_exchange_free_dyn<'blk, 'tcx>(cx: Block<'blk, 'tcx>, v: ValueRef,
                                            size: ValueRef, align: ValueRef)
                                            -> Block<'blk, 'tcx> {
@@ -87,20 +78,6 @@ pub fn trans_exchange_free_ty<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ptr: ValueRef,
     }
 }
 
-pub fn take_ty<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v: ValueRef, t: ty::t)
-                           -> Block<'blk, 'tcx> {
-    // NB: v is an *alias* of type t here, not a direct value.
-    let _icx = push_ctxt("take_ty");
-    match ty::get(t).sty {
-        ty::ty_box(_) => incr_refcnt_of_boxed(bcx, v),
-        _ if ty::type_is_structural(t)
-          && ty::type_needs_drop(bcx.tcx(), t) => {
-            iter_structural_ty(bcx, v, t, take_ty)
-        }
-        _ => bcx
-    }
-}
-
 pub fn get_drop_glue_type(ccx: &CrateContext, t: ty::t) -> ty::t {
     let tcx = ccx.tcx();
     // Even if there is no dtor for t, there might be one deeper down and we
@@ -446,9 +423,6 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: ty::t)
     // NB: v0 is an *alias* of type t here, not a direct value.
     let _icx = push_ctxt("make_drop_glue");
     match ty::get(t).sty {
-        ty::ty_box(body_ty) => {
-            decr_refcnt_maybe_free(bcx, v0, body_ty)
-        }
         ty::ty_uniq(content_ty) => {
             match ty::get(content_ty).sty {
                 ty::ty_vec(ty, None) => {
@@ -568,48 +542,6 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: ty::t)
     }
 }
 
-fn decr_refcnt_maybe_free<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-                                      box_ptr_ptr: ValueRef,
-                                      t: ty::t) -> Block<'blk, 'tcx> {
-    let _icx = push_ctxt("decr_refcnt_maybe_free");
-    let fcx = bcx.fcx;
-    let ccx = bcx.ccx();
-
-    let decr_bcx = fcx.new_temp_block("decr");
-    let free_bcx = fcx.new_temp_block("free");
-    let next_bcx = fcx.new_temp_block("next");
-
-    let box_ptr = Load(bcx, box_ptr_ptr);
-    let llnotnull = IsNotNull(bcx, box_ptr);
-    CondBr(bcx, llnotnull, decr_bcx.llbb, next_bcx.llbb);
-
-    let rc_ptr = GEPi(decr_bcx, box_ptr, [0u, abi::box_field_refcnt]);
-    let rc = Sub(decr_bcx, Load(decr_bcx, rc_ptr), C_int(ccx, 1));
-    Store(decr_bcx, rc, rc_ptr);
-    CondBr(decr_bcx, IsNull(decr_bcx, rc), free_bcx.llbb, next_bcx.llbb);
-
-    let v = Load(free_bcx, box_ptr_ptr);
-    let body = GEPi(free_bcx, v, [0u, abi::box_field_body]);
-    let free_bcx = drop_ty(free_bcx, body, t, None);
-    let free_bcx = trans_free(free_bcx, v);
-    Br(free_bcx, next_bcx.llbb);
-
-    next_bcx
-}
-
-fn incr_refcnt_of_boxed<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-                                    box_ptr_ptr: ValueRef) -> Block<'blk, 'tcx> {
-    let _icx = push_ctxt("incr_refcnt_of_boxed");
-    let ccx = bcx.ccx();
-    let box_ptr = Load(bcx, box_ptr_ptr);
-    let rc_ptr = GEPi(bcx, box_ptr, [0u, abi::box_field_refcnt]);
-    let rc = Load(bcx, rc_ptr);
-    let rc = Add(bcx, rc, C_int(ccx, 1));
-    Store(bcx, rc, rc_ptr);
-    bcx
-}
-
-
 // Generates the declaration for (but doesn't emit) a type descriptor.
 pub fn declare_tydesc(ccx: &CrateContext, t: ty::t) -> tydesc_info {
     // If emit_tydescs already ran, then we shouldn't be creating any new
diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs
index 03550299fbd..f004bea23c7 100644
--- a/src/librustc/middle/trans/reflect.rs
+++ b/src/librustc/middle/trans/reflect.rs
@@ -169,14 +169,6 @@ impl<'a, 'blk, 'tcx> Reflector<'a, 'blk, 'tcx> {
               extra.push(self.c_tydesc(ty));
               self.visit("evec_fixed", extra.as_slice())
           }
-          // Should remove mt from box and uniq.
-          ty::ty_box(typ) => {
-              let extra = self.c_mt(&ty::mt {
-                  ty: typ,
-                  mutbl: ast::MutImmutable,
-              });
-              self.visit("box", extra.as_slice())
-          }
           ty::ty_ptr(ref mt) => {
               match ty::get(mt.ty).sty {
                   ty::ty_vec(ty, None) => {
diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs
index 848e59e2a60..fac0ef2014e 100644
--- a/src/librustc/middle/trans/tvec.rs
+++ b/src/librustc/middle/trans/tvec.rs
@@ -325,7 +325,7 @@ pub fn write_content<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 
                     let bcx = iter_vec_loop(bcx, lldest, vt,
                                   C_uint(bcx.ccx(), count), |set_bcx, lleltptr, _| {
-                        elem.shallow_copy_and_take(set_bcx, lleltptr)
+                        elem.shallow_copy(set_bcx, lleltptr)
                     });
 
                     elem.add_clean_if_rvalue(bcx, element.id);
diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs
index 54f24516867..d41cd7ed9e5 100644
--- a/src/librustc/middle/trans/type_of.rs
+++ b/src/librustc/middle/trans/type_of.rs
@@ -174,7 +174,6 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
         ty::ty_uint(t) => Type::uint_from_ty(cx, t),
         ty::ty_float(t) => Type::float_from_ty(cx, t),
 
-        ty::ty_box(..) => Type::i8p(cx),
         ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) | ty::ty_ptr(ty::mt{ty, ..}) => {
             if ty::type_is_sized(cx.tcx(), ty) {
                 Type::i8p(cx)
@@ -299,9 +298,6 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type {
         let name = llvm_type_name(cx, an_unboxed_closure, did, []);
         adt::incomplete_type_of(cx, &*repr, name.as_slice())
       }
-      ty::ty_box(typ) => {
-          Type::at_box(cx, type_of(cx, typ)).ptr_to()
-      }
 
       ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) | ty::ty_ptr(ty::mt{ty, ..}) => {
           match ty::get(ty).sty {
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index b38f362dcf1..edbdf427c0b 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -940,7 +940,6 @@ pub enum sty {
     /// the `ast_ty_to_ty_cache`. This is probably true for `ty_struct` as
     /// well.`
     ty_enum(DefId, Substs),
-    ty_box(t),
     ty_uniq(t),
     ty_str,
     ty_vec(t, Option<uint>), // Second field is length.
@@ -1621,7 +1620,7 @@ pub fn mk_t(cx: &ctxt, st: sty) -> t {
           flags |= sflags(substs);
           flags |= flags_for_bounds(bounds);
       }
-      &ty_box(tt) | &ty_uniq(tt) | &ty_vec(tt, _) | &ty_open(tt) => {
+      &ty_uniq(tt) | &ty_vec(tt, _) | &ty_open(tt) => {
         flags |= get(tt).flags
       }
       &ty_ptr(ref m) => {
@@ -1776,8 +1775,6 @@ pub fn mk_enum(cx: &ctxt, did: ast::DefId, substs: Substs) -> t {
     mk_t(cx, ty_enum(did, substs))
 }
 
-pub fn mk_box(cx: &ctxt, ty: t) -> t { mk_t(cx, ty_box(ty)) }
-
 pub fn mk_uniq(cx: &ctxt, ty: t) -> t { mk_t(cx, ty_uniq(ty)) }
 
 pub fn mk_ptr(cx: &ctxt, tm: mt) -> t { mk_t(cx, ty_ptr(tm)) }
@@ -1901,7 +1898,7 @@ pub fn maybe_walk_ty(ty: t, f: |t| -> bool) {
     match get(ty).sty {
         ty_nil | ty_bot | ty_bool | ty_char | ty_int(_) | ty_uint(_) | ty_float(_) |
         ty_str | ty_infer(_) | ty_param(_) | ty_unboxed_closure(_, _) | ty_err => {}
-        ty_box(ty) | ty_uniq(ty) | ty_vec(ty, _) | ty_open(ty) => maybe_walk_ty(ty, f),
+        ty_uniq(ty) | ty_vec(ty, _) | ty_open(ty) => maybe_walk_ty(ty, f),
         ty_ptr(ref tm) | ty_rptr(_, ref tm) => {
             maybe_walk_ty(tm.ty, f);
         }
@@ -2014,7 +2011,7 @@ pub fn type_is_vec(ty: t) -> bool {
     match get(ty).sty {
         ty_vec(..) => true,
         ty_ptr(mt{ty: t, ..}) | ty_rptr(_, mt{ty: t, ..}) |
-        ty_box(t) | ty_uniq(t) => match get(t).sty {
+        ty_uniq(t) => match get(t).sty {
             ty_vec(_, None) => true,
             _ => false
         },
@@ -2067,13 +2064,6 @@ pub fn simd_size(cx: &ctxt, ty: t) -> uint {
     }
 }
 
-pub fn type_is_boxed(ty: t) -> bool {
-    match get(ty).sty {
-      ty_box(_) => true,
-      _ => false
-    }
-}
-
 pub fn type_is_region_ptr(ty: t) -> bool {
     match get(ty).sty {
         ty_rptr(..) => true,
@@ -2144,29 +2134,22 @@ pub fn type_needs_unwind_cleanup(cx: &ctxt, ty: t) -> bool {
 
     let mut tycache = HashSet::new();
     let needs_unwind_cleanup =
-        type_needs_unwind_cleanup_(cx, ty, &mut tycache, false);
+        type_needs_unwind_cleanup_(cx, ty, &mut tycache);
     cx.needs_unwind_cleanup_cache.borrow_mut().insert(ty, needs_unwind_cleanup);
-    return needs_unwind_cleanup;
+    needs_unwind_cleanup
 }
 
 fn type_needs_unwind_cleanup_(cx: &ctxt, ty: t,
-                              tycache: &mut HashSet<t>,
-                              encountered_box: bool) -> bool {
+                              tycache: &mut HashSet<t>) -> bool {
 
     // Prevent infinite recursion
     if !tycache.insert(ty) {
         return false;
     }
 
-    let mut encountered_box = encountered_box;
     let mut needs_unwind_cleanup = false;
     maybe_walk_ty(ty, |ty| {
-        let old_encountered_box = encountered_box;
         let result = match get(ty).sty {
-          ty_box(_) => {
-            encountered_box = true;
-            true
-          }
           ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
           ty_tup(_) | ty_ptr(_) => {
             true
@@ -2176,33 +2159,21 @@ fn type_needs_unwind_cleanup_(cx: &ctxt, ty: t,
                 for aty in v.args.iter() {
                     let t = aty.subst(cx, substs);
                     needs_unwind_cleanup |=
-                        type_needs_unwind_cleanup_(cx, t, tycache,
-                                                   encountered_box);
+                        type_needs_unwind_cleanup_(cx, t, tycache);
                 }
             }
             !needs_unwind_cleanup
           }
-          ty_uniq(_) => {
-            // Once we're inside a box, the annihilator will find
-            // it and destroy it.
-            if !encountered_box {
-                needs_unwind_cleanup = true;
-                false
-            } else {
-                true
-            }
-          }
           _ => {
             needs_unwind_cleanup = true;
             false
           }
         };
 
-        encountered_box = old_encountered_box;
         result
     });
 
-    return needs_unwind_cleanup;
+    needs_unwind_cleanup
 }
 
 /**
@@ -2460,10 +2431,6 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
                 closure_contents(cx, &**c) | TC::ReachesFfiUnsafe
             }
 
-            ty_box(typ) => {
-                tc_ty(cx, typ, cache).managed_pointer() | TC::ReachesFfiUnsafe
-            }
-
             ty_uniq(typ) => {
                 TC::ReachesFfiUnsafe | match get(typ).sty {
                     ty_str => TC::OwnsOwned,
@@ -2782,7 +2749,7 @@ pub fn is_instantiable(cx: &ctxt, r_ty: t) -> bool {
             ty_vec(_, None) => {
                 false
             }
-            ty_box(typ) | ty_uniq(typ) | ty_open(typ) => {
+            ty_uniq(typ) | ty_open(typ) => {
                 type_requires(cx, seen, r_ty, typ)
             }
             ty_rptr(_, ref mt) => {
@@ -3092,7 +3059,7 @@ pub fn type_is_c_like_enum(cx: &ctxt, ty: t) -> bool {
 // Some types---notably unsafe ptrs---can only be dereferenced explicitly.
 pub fn deref(t: t, explicit: bool) -> Option<mt> {
     match get(t).sty {
-        ty_box(ty) | ty_uniq(ty) => {
+        ty_uniq(ty) => {
             Some(mt {
                 ty: ty,
                 mutbl: ast::MutImmutable,
@@ -3106,9 +3073,7 @@ pub fn deref(t: t, explicit: bool) -> Option<mt> {
 
 pub fn deref_or_dont(t: t) -> t {
     match get(t).sty {
-        ty_box(ty) | ty_uniq(ty) => {
-            ty
-        },
+        ty_uniq(ty) => ty,
         ty_rptr(_, mt) | ty_ptr(mt) => mt.ty,
         _ => t
     }
@@ -3124,7 +3089,7 @@ pub fn close_type(cx: &ctxt, t: t) -> t {
 
 pub fn type_content(t: t) -> t {
     match get(t).sty {
-        ty_box(ty) | ty_uniq(ty) => ty,
+        ty_uniq(ty) => ty,
         ty_rptr(_, mt) |ty_ptr(mt) => mt.ty,
         _ => t
     }
@@ -3695,14 +3660,13 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
         }
 
         ast::ExprBox(ref place, _) => {
-            // Special case `Box<T>`/`Gc<T>` for now:
+            // Special case `Box<T>` for now:
             let definition = match tcx.def_map.borrow().find(&place.id) {
                 Some(&def) => def,
                 None => fail!("no def for place"),
             };
             let def_id = definition.def_id();
-            if tcx.lang_items.exchange_heap() == Some(def_id) ||
-               tcx.lang_items.managed_heap() == Some(def_id) {
+            if tcx.lang_items.exchange_heap() == Some(def_id) {
                 RvalueDatumExpr
             } else {
                 RvalueDpsExpr
@@ -3753,7 +3717,6 @@ pub fn ty_sort_string(cx: &ctxt, t: t) -> String {
         }
 
         ty_enum(id, _) => format!("enum {}", item_path_str(cx, id)),
-        ty_box(_) => "Gc-ptr".to_string(),
         ty_uniq(_) => "box".to_string(),
         ty_vec(_, Some(_)) => "array".to_string(),
         ty_vec(_, None) => "unsized array".to_string(),
@@ -5223,19 +5186,15 @@ pub fn hash_crate_independent(tcx: &ctxt, t: t, svh: &Svh) -> u64 {
                 byte!(8);
                 did(&mut state, d);
             }
-            ty_box(_) => {
+            ty_uniq(_) => {
                 byte!(9);
             }
-            ty_uniq(_) => {
-                byte!(10);
-            }
             ty_vec(_, Some(n)) => {
-                byte!(11);
+                byte!(10);
                 n.hash(&mut state);
             }
             ty_vec(_, None) => {
                 byte!(11);
-                0u8.hash(&mut state);
             }
             ty_ptr(m) => {
                 byte!(12);
@@ -5586,7 +5545,6 @@ pub fn accumulate_lifetimes_in_type(accumulator: &mut Vec<ty::Region>,
             ty_int(_) |
             ty_uint(_) |
             ty_float(_) |
-            ty_box(_) |
             ty_uniq(_) |
             ty_str |
             ty_vec(_, _) |
diff --git a/src/librustc/middle/ty_fold.rs b/src/librustc/middle/ty_fold.rs
index 2e964c457bf..44420ddd7f3 100644
--- a/src/librustc/middle/ty_fold.rs
+++ b/src/librustc/middle/ty_fold.rs
@@ -458,9 +458,6 @@ pub fn super_fold_mt<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
 pub fn super_fold_sty<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
                                                  sty: &ty::sty) -> ty::sty {
     match *sty {
-        ty::ty_box(typ) => {
-            ty::ty_box(typ.fold_with(this))
-        }
         ty::ty_uniq(typ) => {
             ty::ty_uniq(typ.fold_with(this))
         }
diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs
index 72c3c1715e0..4d21090dd2c 100644
--- a/src/librustc/middle/typeck/astconv.rs
+++ b/src/librustc/middle/typeck/astconv.rs
@@ -559,44 +559,6 @@ pub fn ast_ty_to_builtin_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
                               "not enough type parameters supplied to `Box<T>`");
                     Some(ty::mk_err())
                 }
-                def::DefTy(did, _) | def::DefStruct(did)
-                        if Some(did) == this.tcx().lang_items.gc() => {
-                    if path.segments
-                           .iter()
-                           .flat_map(|s| s.types.iter())
-                           .count() > 1 {
-                        span_err!(this.tcx().sess, path.span, E0048,
-                                  "`Gc` has only one type parameter");
-                    }
-
-                    for inner_ast_type in path.segments
-                                              .iter()
-                                              .flat_map(|s| s.types.iter()) {
-                        return Some(mk_pointer(this,
-                                               rscope,
-                                               ast::MutImmutable,
-                                               &**inner_ast_type,
-                                               Box,
-                                               |typ| {
-                            match ty::get(typ).sty {
-                                ty::ty_str => {
-                                    span_err!(this.tcx().sess, path.span, E0114,
-                                              "`Gc<str>` is not a type");
-                                    ty::mk_err()
-                                }
-                                ty::ty_vec(_, None) => {
-                                    span_err!(this.tcx().sess, path.span, E0115,
-                                              "`Gc<[T]>` is not a type");
-                                    ty::mk_err()
-                                }
-                                _ => ty::mk_box(this.tcx(), typ),
-                            }
-                        }))
-                    }
-                    this.tcx().sess.span_bug(path.span,
-                                             "not enough type parameters \
-                                              supplied to `Gc<T>`")
-                }
                 _ => None
             }
         }
@@ -606,7 +568,6 @@ pub fn ast_ty_to_builtin_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
 
 #[deriving(Show)]
 enum PointerTy {
-    Box,
     RPtr(ty::Region),
     Uniq
 }
@@ -614,7 +575,6 @@ enum PointerTy {
 impl PointerTy {
     fn default_region(&self) -> ty::Region {
         match *self {
-            Box => ty::ReStatic,
             Uniq => ty::ReStatic,
             RPtr(r) => r,
         }
@@ -702,14 +662,6 @@ fn mk_pointer<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
                                        r,
                                        ty::mt {mutbl: a_seq_mutbl, ty: tr});
                 }
-                _ => {
-                    tcx.sess.span_err(
-                        a_seq_ty.span,
-                        "~trait or &trait are the only supported \
-                         forms of casting-to-trait");
-                    return ty::mk_err();
-                }
-
             }
         }
         ast::TyPath(ref path, ref opt_bounds, id) => {
@@ -726,11 +678,6 @@ fn mk_pointer<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
                         RPtr(r) => {
                             return ty::mk_str_slice(tcx, r, ast::MutImmutable);
                         }
-                        _ => {
-                            tcx.sess
-                               .span_err(path.span,
-                                         "managed strings are not supported")
-                        }
                     }
                 }
                 Some(&def::DefTrait(trait_def_id)) => {
@@ -767,13 +714,6 @@ fn mk_pointer<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
                         RPtr(r) => {
                             return ty::mk_rptr(tcx, r, ty::mt{mutbl: a_seq_mutbl, ty: tr});
                         }
-                        _ => {
-                            tcx.sess.span_err(
-                                path.span,
-                                "~trait or &trait are the only supported \
-                                 forms of casting-to-trait");
-                            return ty::mk_err();
-                        }
                     };
                 }
                 _ => {}
diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs
index 3d522a7c548..8711f4de512 100644
--- a/src/librustc/middle/typeck/check/method.rs
+++ b/src/librustc/middle/typeck/check/method.rs
@@ -1094,7 +1094,7 @@ impl<'a, 'tcx> LookupContext<'a, 'tcx> {
 
         let tcx = self.tcx();
         match ty::get(self_ty).sty {
-            ty_bare_fn(..) | ty_box(..) | ty_uniq(..) | ty_rptr(..) |
+            ty_bare_fn(..) | ty_uniq(..) | ty_rptr(..) |
             ty_infer(IntVar(_)) |
             ty_infer(FloatVar(_)) |
             ty_param(..) | ty_nil | ty_bot | ty_bool |
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index d8b5185a47a..194c2c35c88 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -3820,12 +3820,6 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
                   if tcx.lang_items.exchange_heap() == Some(def_id) {
                       fcx.write_ty(id, ty::mk_uniq(tcx, referent_ty));
                       checked = true
-                  } else if tcx.lang_items.managed_heap() == Some(def_id) {
-                      fcx.register_region_obligation(infer::Managed(expr.span),
-                                                     referent_ty,
-                                                     ty::ReStatic);
-                      fcx.write_ty(id, ty::mk_box(tcx, referent_ty));
-                      checked = true
                   }
               }
               _ => {}
diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs
index 53edcb303f7..4d19bc16a3e 100644
--- a/src/librustc/middle/typeck/check/regionck.rs
+++ b/src/librustc/middle/typeck/check/regionck.rs
@@ -1466,7 +1466,6 @@ fn link_region(rcx: &Rcx,
 
             mc::cat_discr(cmt_base, _) |
             mc::cat_downcast(cmt_base) |
-            mc::cat_deref(cmt_base, _, mc::GcPtr(..)) |
             mc::cat_deref(cmt_base, _, mc::OwnedPtr) |
             mc::cat_interior(cmt_base, _) => {
                 // Borrowing interior or owned data requires the base
@@ -1699,7 +1698,6 @@ fn adjust_upvar_borrow_kind_for_mut(rcx: &Rcx,
             }
 
             mc::cat_deref(_, _, mc::UnsafePtr(..)) |
-            mc::cat_deref(_, _, mc::GcPtr) |
             mc::cat_static_item |
             mc::cat_rvalue(_) |
             mc::cat_copied_upvar(_) |
@@ -1750,7 +1748,6 @@ fn adjust_upvar_borrow_kind_for_unique(rcx: &Rcx, cmt: mc::cmt) {
             }
 
             mc::cat_deref(_, _, mc::UnsafePtr(..)) |
-            mc::cat_deref(_, _, mc::GcPtr) |
             mc::cat_static_item |
             mc::cat_rvalue(_) |
             mc::cat_copied_upvar(_) |
diff --git a/src/librustc/middle/typeck/check/regionmanip.rs b/src/librustc/middle/typeck/check/regionmanip.rs
index db9877698a3..5d75d590a09 100644
--- a/src/librustc/middle/typeck/check/regionmanip.rs
+++ b/src/librustc/middle/typeck/check/regionmanip.rs
@@ -129,7 +129,6 @@ impl<'a, 'tcx> Wf<'a, 'tcx> {
 
             ty::ty_vec(t, _) |
             ty::ty_ptr(ty::mt { ty: t, .. }) |
-            ty::ty_box(t) |
             ty::ty_uniq(t) => {
                 self.accumulate_from_ty(t)
             }
diff --git a/src/librustc/middle/typeck/check/vtable2.rs b/src/librustc/middle/typeck/check/vtable2.rs
index bdcf4d73c3b..1d765c6c7c6 100644
--- a/src/librustc/middle/typeck/check/vtable2.rs
+++ b/src/librustc/middle/typeck/check/vtable2.rs
@@ -95,7 +95,7 @@ pub fn check_object_cast(fcx: &FnCtxt,
         }
     }
 
-    // Because we currently give unsound lifetimes to the "ty_box", I
+    // Because we currently give unsound lifetimes to the "t_box", I
     // could have written &'static ty::TyTrait here, but it seems
     // gratuitously unsafe.
     fn object_trait<'a>(t: &'a ty::t) -> &'a ty::TyTrait {
diff --git a/src/librustc/middle/typeck/coherence/mod.rs b/src/librustc/middle/typeck/coherence/mod.rs
index cef6e31b937..f6ac0e1666c 100644
--- a/src/librustc/middle/typeck/coherence/mod.rs
+++ b/src/librustc/middle/typeck/coherence/mod.rs
@@ -23,7 +23,7 @@ use middle::subst::{Substs};
 use middle::ty::get;
 use middle::ty::{ImplContainer, ImplOrTraitItemId, MethodTraitItemId};
 use middle::ty::{TypeTraitItemId, lookup_item_type};
-use middle::ty::{t, ty_bool, ty_char, ty_bot, ty_box, ty_enum, ty_err};
+use middle::ty::{t, ty_bool, ty_char, ty_bot, ty_enum, ty_err};
 use middle::ty::{ty_str, ty_vec, ty_float, ty_infer, ty_int, ty_nil, ty_open};
 use middle::ty::{ty_param, Polytype, ty_ptr};
 use middle::ty::{ty_rptr, ty_struct, ty_trait, ty_tup};
@@ -84,8 +84,8 @@ fn get_base_type(inference_context: &InferCtxt,
 
         ty_nil | ty_bot | ty_bool | ty_char | ty_int(..) | ty_uint(..) | ty_float(..) |
         ty_str(..) | ty_vec(..) | ty_bare_fn(..) | ty_closure(..) | ty_tup(..) |
-        ty_infer(..) | ty_param(..) | ty_err | ty_open(..) |
-        ty_box(_) | ty_uniq(_) | ty_ptr(_) | ty_rptr(_, _) => {
+        ty_infer(..) | ty_param(..) | ty_err | ty_open(..) | ty_uniq(_) |
+        ty_ptr(_) | ty_rptr(_, _) => {
             debug!("(getting base type) no base type; found {:?}",
                    get(original_type).sty);
             None
diff --git a/src/librustc/middle/typeck/infer/coercion.rs b/src/librustc/middle/typeck/infer/coercion.rs
index 7f9f569c37e..a0c190c5c81 100644
--- a/src/librustc/middle/typeck/infer/coercion.rs
+++ b/src/librustc/middle/typeck/infer/coercion.rs
@@ -258,7 +258,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
         let r_borrow = self.get_ref().infcx.next_region_var(coercion);
 
         let inner_ty = match *sty_a {
-            ty::ty_box(_) | ty::ty_uniq(_) => return Err(ty::terr_mismatch),
+            ty::ty_uniq(_) => return Err(ty::terr_mismatch),
             ty::ty_rptr(_, mt_a) => mt_a.ty,
             _ => {
                 return self.subtype(a, b);
diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs
index 4412b7d94d4..a742cf45059 100644
--- a/src/librustc/middle/typeck/infer/combine.rs
+++ b/src/librustc/middle/typeck/infer/combine.rs
@@ -495,10 +495,6 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C, a: ty::t, b: ty::t) -> cres<t
           Ok(ty::mk_unboxed_closure(tcx, a_id, region))
       }
 
-      (&ty::ty_box(a_inner), &ty::ty_box(b_inner)) => {
-        this.tys(a_inner, b_inner).and_then(|typ| Ok(ty::mk_box(tcx, typ)))
-      }
-
       (&ty::ty_uniq(a_inner), &ty::ty_uniq(b_inner)) => {
             let typ = try!(this.tys(a_inner, b_inner));
             check_ptr_to_unsized(this, a, b, a_inner, b_inner, ty::mk_uniq(tcx, typ))
diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs
index 0149220fde4..8ff5b3c9024 100644
--- a/src/librustc/middle/typeck/infer/error_reporting.rs
+++ b/src/librustc/middle/typeck/infer/error_reporting.rs
@@ -776,11 +776,6 @@ impl<'a, 'tcx> ErrorReporting for InferCtxt<'a, 'tcx> {
                     sup,
                     "");
             }
-            infer::Managed(span) => {
-                self.tcx.sess.span_err(
-                    span,
-                    format!("cannot put borrowed references into managed memory").as_slice());
-            }
         }
     }
 
@@ -1612,11 +1607,6 @@ impl<'a, 'tcx> ErrorReportingHelpers for InferCtxt<'a, 'tcx> {
                              does not outlive the data it points at",
                             self.ty_to_string(ty)).as_slice());
             }
-            infer::Managed(span) => {
-                self.tcx.sess.span_note(
-                    span,
-                    "...so that the value can be stored in managed memory.");
-            }
             infer::RelateParamBound(span, param_ty, t) => {
                 self.tcx.sess.span_note(
                     span,
diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs
index c36192777f0..44bda134909 100644
--- a/src/librustc/middle/typeck/infer/mod.rs
+++ b/src/librustc/middle/typeck/infer/mod.rs
@@ -216,9 +216,6 @@ pub enum SubregionOrigin {
 
     // An auto-borrow that does not enclose the expr where it occurs
     AutoBorrow(Span),
-
-    // Managed data cannot contain borrowed pointers.
-    Managed(Span),
 }
 
 /// Reasons to create a region inference variable
@@ -1029,7 +1026,6 @@ impl SubregionOrigin {
             CallReturn(a) => a,
             AddrOf(a) => a,
             AutoBorrow(a) => a,
-            Managed(a) => a,
         }
     }
 }
@@ -1102,7 +1098,6 @@ impl Repr for SubregionOrigin {
             CallReturn(a) => format!("CallReturn({})", a.repr(tcx)),
             AddrOf(a) => format!("AddrOf({})", a.repr(tcx)),
             AutoBorrow(a) => format!("AutoBorrow({})", a.repr(tcx)),
-            Managed(a) => format!("Managed({})", a.repr(tcx)),
         }
     }
 }
diff --git a/src/librustc/middle/typeck/infer/skolemize.rs b/src/librustc/middle/typeck/infer/skolemize.rs
index 4002f598449..54ece395be9 100644
--- a/src/librustc/middle/typeck/infer/skolemize.rs
+++ b/src/librustc/middle/typeck/infer/skolemize.rs
@@ -143,7 +143,6 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeSkolemizer<'a, 'tcx> {
             ty::ty_uint(..) |
             ty::ty_float(..) |
             ty::ty_enum(..) |
-            ty::ty_box(..) |
             ty::ty_uniq(..) |
             ty::ty_str |
             ty::ty_err |
diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs
index a6edfcf80fd..9317ba2c7fa 100644
--- a/src/librustc/middle/typeck/variance.rs
+++ b/src/librustc/middle/typeck/variance.rs
@@ -742,7 +742,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
                 self.add_constraints_from_mt(mt, variance);
             }
 
-            ty::ty_uniq(typ) | ty::ty_box(typ) | ty::ty_vec(typ, _) | ty::ty_open(typ) => {
+            ty::ty_uniq(typ) | ty::ty_vec(typ, _) | ty::ty_open(typ) => {
                 self.add_constraints_from_ty(typ, variance);
             }
 
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index 5ca6d08720f..18cf805bccb 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -17,7 +17,7 @@ use middle::ty::{ReEarlyBound, BrFresh, ctxt};
 use middle::ty::{ReFree, ReScope, ReInfer, ReStatic, Region, ReEmpty};
 use middle::ty::{ReSkolemized, ReVar};
 use middle::ty::{mt, t, ParamTy};
-use middle::ty::{ty_bool, ty_char, ty_bot, ty_box, ty_struct, ty_enum};
+use middle::ty::{ty_bool, ty_char, ty_bot, ty_struct, ty_enum};
 use middle::ty::{ty_err, ty_str, ty_vec, ty_float, ty_bare_fn, ty_closure};
 use middle::ty::{ty_nil, ty_param, ty_ptr, ty_rptr, ty_tup, ty_open};
 use middle::ty::{ty_unboxed_closure};
@@ -375,7 +375,6 @@ pub fn ty_to_string(cx: &ctxt, typ: t) -> String {
       ty_int(t) => ast_util::int_ty_to_string(t, None).to_string(),
       ty_uint(t) => ast_util::uint_ty_to_string(t, None).to_string(),
       ty_float(t) => ast_util::float_ty_to_string(t).to_string(),
-      ty_box(typ) => format!("Gc<{}>", ty_to_string(cx, typ)),
       ty_uniq(typ) => format!("Box<{}>", ty_to_string(cx, typ)),
       ty_ptr(ref tm) => {
           format!("*{} {}", match tm.mutbl {