about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2012-02-01 11:54:14 +0100
committerMarijn Haverbeke <marijnh@gmail.com>2012-02-01 12:23:13 +0100
commit2dbaa05af8f2aeef709712725e103836405fa5f5 (patch)
tree9b60a37a5ee7c9d93910e2e8e8c7589730b23d1f
parent856a544d0c55ba00ddcc8aa821e642796673c40e (diff)
Remove support for native types
Issue #1673
-rw-r--r--src/comp/metadata/decoder.rs1
-rw-r--r--src/comp/metadata/encoder.rs6
-rw-r--r--src/comp/metadata/tydecode.rs1
-rw-r--r--src/comp/metadata/tyencode.rs5
-rw-r--r--src/comp/middle/alias.rs2
-rw-r--r--src/comp/middle/gc.rs2
-rw-r--r--src/comp/middle/resolve.rs6
-rw-r--r--src/comp/middle/shape.rs3
-rw-r--r--src/comp/middle/trans/base.rs18
-rw-r--r--src/comp/middle/ty.rs48
-rw-r--r--src/comp/middle/typeck.rs15
-rw-r--r--src/comp/syntax/ast.rs2
-rw-r--r--src/comp/syntax/ast_util.rs3
-rw-r--r--src/comp/syntax/fold.rs1
-rw-r--r--src/comp/syntax/parse/parser.rs16
-rw-r--r--src/comp/syntax/print/pprust.rs10
-rw-r--r--src/comp/syntax/visit.rs1
-rw-r--r--src/comp/util/ppaux.rs1
18 files changed, 17 insertions, 124 deletions
diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs
index 2ce10e8673c..b26eb52eaf5 100644
--- a/src/comp/metadata/decoder.rs
+++ b/src/comp/metadata/decoder.rs
@@ -198,7 +198,6 @@ fn lookup_def(cnum: ast::crate_num, data: @[u8], did_: ast::def_id) ->
           'f' { ast::def_fn(did, ast::impure_fn) }
           'p' { ast::def_fn(did, ast::pure_fn) }
           'y' { ast::def_ty(did) }
-          'T' { ast::def_native_ty(did) }
           't' { ast::def_ty(did) }
           'm' { ast::def_mod(did) }
           'n' { ast::def_native_mod(did) }
diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs
index d4cdb7587bf..c5823896d9c 100644
--- a/src/comp/metadata/encoder.rs
+++ b/src/comp/metadata/encoder.rs
@@ -423,12 +423,6 @@ fn encode_info_for_native_item(ecx: @encode_ctxt, ebml_w: ebml::writer,
                                nitem: @native_item) {
     ebml::start_tag(ebml_w, tag_items_data_item);
     alt nitem.node {
-      native_item_ty {
-        encode_def_id(ebml_w, local_def(nitem.id));
-        encode_family(ebml_w, 'T' as u8);
-        encode_type(ecx, ebml_w,
-                    ty::mk_native(ecx.ccx.tcx, local_def(nitem.id)));
-      }
       native_item_fn(fn_decl, tps) {
         let letter = alt fn_decl.purity {
           unsafe_fn { 'u' }
diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs
index b7adcfadf12..92e6da125ef 100644
--- a/src/comp/metadata/tydecode.rs
+++ b/src/comp/metadata/tydecode.rs
@@ -255,7 +255,6 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
         ret ty::mk_res(st.tcx, def, inner, params);
       }
       'X' { ret ty::mk_var(st.tcx, parse_int(st)); }
-      'E' { let def = parse_def(st, conv); ret ty::mk_native(st.tcx, def); }
       'Y' { ret ty::mk_type(st.tcx); }
       'y' { ret ty::mk_send_type(st.tcx); }
       'C' {
diff --git a/src/comp/metadata/tyencode.rs b/src/comp/metadata/tyencode.rs
index f116bb7e17f..84f77842a58 100644
--- a/src/comp/metadata/tyencode.rs
+++ b/src/comp/metadata/tyencode.rs
@@ -163,11 +163,6 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
         w.write_char(']');
       }
       ty::ty_var(id) { w.write_char('X'); w.write_str(int::str(id)); }
-      ty::ty_native(def) {
-        w.write_char('E');
-        w.write_str(cx.ds(def));
-        w.write_char('|');
-      }
       ty::ty_param(id, did) {
         w.write_char('p');
         w.write_str(cx.ds(did));
diff --git a/src/comp/middle/alias.rs b/src/comp/middle/alias.rs
index cecdffc35c1..7aa675c9e8d 100644
--- a/src/comp/middle/alias.rs
+++ b/src/comp/middle/alias.rs
@@ -560,7 +560,7 @@ fn copy_is_expensive(tcx: ty::ctxt, ty: ty::t) -> bool {
     fn score_ty(tcx: ty::ctxt, ty: ty::t) -> uint {
         ret alt ty::struct(tcx, ty) {
           ty::ty_nil | ty::ty_bot | ty::ty_bool | ty::ty_int(_) |
-          ty::ty_uint(_) | ty::ty_float(_) | ty::ty_type | ty::ty_native(_) |
+          ty::ty_uint(_) | ty::ty_float(_) | ty::ty_type |
           ty::ty_ptr(_) { 1u }
           ty::ty_box(_) | ty::ty_iface(_, _) { 3u }
           ty::ty_constr(t, _) | ty::ty_res(_, t, _) { score_ty(tcx, t) }
diff --git a/src/comp/middle/gc.rs b/src/comp/middle/gc.rs
index 7560d7b325a..0fe72c5b8f7 100644
--- a/src/comp/middle/gc.rs
+++ b/src/comp/middle/gc.rs
@@ -103,7 +103,7 @@ fn type_is_gc_relevant(cx: ty::ctxt, ty: ty::t) -> bool {
     alt ty::struct(cx, ty) {
       ty::ty_nil | ty::ty_bot | ty::ty_bool | ty::ty_int(_) |
       ty::ty_float(_) | ty::ty_uint(_) | ty::ty_str |
-      ty::ty_type | ty::ty_send_type | ty::ty_ptr(_) | ty::ty_native(_) {
+      ty::ty_type | ty::ty_send_type | ty::ty_ptr(_) {
         ret false;
       }
       ty::ty_rec(fields) {
diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs
index 12895459b75..d708ddf4b42 100644
--- a/src/comp/middle/resolve.rs
+++ b/src/comp/middle/resolve.rs
@@ -1358,11 +1358,6 @@ fn lookup_in_mie(e: env, mie: mod_index_entry, ns: namespace) ->
       }
       mie_native_item(native_item) {
         alt native_item.node {
-          ast::native_item_ty {
-            if ns == ns_type {
-                ret some(ast::def_native_ty(local_def(native_item.id)));
-            }
-          }
           ast::native_item_fn(decl, _) {
             if ns == ns_val(ns_any_value) {
                 ret some(ast::def_fn(local_def(native_item.id),
@@ -1467,7 +1462,6 @@ fn ns_for_def(d: def) -> namespace {
       ast::def_upvar(_, _, _) |  ast::def_self(_) { ns_val(ns_any_value) }
       ast::def_mod(_) | ast::def_native_mod(_) { ns_module }
       ast::def_ty(_) | ast::def_binding(_) | ast::def_use(_) |
-      ast::def_native_ty(_) { ns_type }
       ast::def_ty_param(_, _) { ns_type }
     }
 }
diff --git a/src/comp/middle/shape.rs b/src/comp/middle/shape.rs
index 317cf1515fd..c5746974fe2 100644
--- a/src/comp/middle/shape.rs
+++ b/src/comp/middle/shape.rs
@@ -324,8 +324,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint]) -> [u8] {
       ty::ty_bot { s += [shape_u8]; }
       ty::ty_int(ast::ty_i) { s += [s_int(ccx.tcx)]; }
       ty::ty_float(ast::ty_f) { s += [s_float(ccx.tcx)]; }
-      ty::ty_uint(ast::ty_u) | ty::ty_ptr(_) |
-      ty::ty_native(_) { s += [s_uint(ccx.tcx)]; }
+      ty::ty_uint(ast::ty_u) | ty::ty_ptr(_) { s += [s_uint(ccx.tcx)]; }
       ty::ty_type { s += [s_tydesc(ccx.tcx)]; }
       ty::ty_send_type { s += [s_send_tydesc(ccx.tcx)]; }
       ty::ty_int(ast::ty_i8) { s += [shape_i8]; }
diff --git a/src/comp/middle/trans/base.rs b/src/comp/middle/trans/base.rs
index 7cd6186331d..b681389b12c 100644
--- a/src/comp/middle/trans/base.rs
+++ b/src/comp/middle/trans/base.rs
@@ -125,7 +125,6 @@ fn type_of_inner(cx: @crate_ctxt, t: ty::t)
 
     if cx.lltypes.contains_key(t) { ret cx.lltypes.get(t); }
     let llty = alt ty::struct(cx.tcx, t) {
-      ty::ty_native(_) { T_ptr(T_i8()) }
       ty::ty_nil { T_nil() }
       ty::ty_bot {
         T_nil() /* ...I guess? */
@@ -1421,11 +1420,6 @@ fn compare_scalar_types(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef,
       ty::ty_int(_) { ret rslt(cx, f(signed_int)); }
       ty::ty_uint(_) { ret rslt(cx, f(unsigned_int)); }
       ty::ty_float(_) { ret rslt(cx, f(floating_point)); }
-      ty::ty_native(_) {
-        let cx = trans_fail(cx, none::<span>,
-                            "attempt to compare values of type native");
-        ret rslt(cx, C_nil());
-      }
       ty::ty_type {
         ret rslt(trans_fail(cx, none,
                             "attempt to compare values of type type"),
@@ -1922,7 +1916,7 @@ fn copy_val(cx: @block_ctxt, action: copy_action, dst: ValueRef,
 fn copy_val_no_check(bcx: @block_ctxt, action: copy_action, dst: ValueRef,
                      src: ValueRef, t: ty::t) -> @block_ctxt {
     let ccx = bcx_ccx(bcx), bcx = bcx;
-    if ty::type_is_scalar(ccx.tcx, t) || ty::type_is_native(ccx.tcx, t) {
+    if ty::type_is_scalar(ccx.tcx, t) {
         Store(bcx, src, dst);
         ret bcx;
     }
@@ -1952,7 +1946,7 @@ fn move_val(cx: @block_ctxt, action: copy_action, dst: ValueRef,
             src: lval_result, t: ty::t) -> @block_ctxt {
     let src_val = src.val;
     let tcx = bcx_tcx(cx), cx = cx;
-    if ty::type_is_scalar(tcx, t) || ty::type_is_native(tcx, t) {
+    if ty::type_is_scalar(tcx, t) {
         if src.kind == owned { src_val = Load(cx, src_val); }
         Store(cx, src_val, dst);
         ret cx;
@@ -2905,8 +2899,7 @@ fn trans_cast(cx: @block_ctxt, e: @ast::expr, id: ast::node_id,
     fn t_kind(tcx: ty::ctxt, t: ty::t) -> kind {
         ret if ty::type_is_fp(tcx, t) {
                 float
-            } else if ty::type_is_native(tcx, t) ||
-                      ty::type_is_unsafe_ptr(tcx, t) {
+            } else if ty::type_is_unsafe_ptr(tcx, t) {
                 pointer
             } else if ty::type_is_integral(tcx, t) {
                 integral
@@ -4905,7 +4898,6 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
 
     for native_item in native_mod.items {
       alt native_item.node {
-        ast::native_item_ty {}
         ast::native_item_fn(fn_decl, tps) {
           let id = native_item.id;
           let tys = c_stack_tys(ccx, id);
@@ -5144,10 +5136,6 @@ fn native_fn_ty_param_count(cx: @crate_ctxt, id: ast::node_id) -> uint {
          _ { cx.sess.bug("native_fn_ty_param_count\
                          given a non-native item"); } };
     alt native_item.node {
-      ast::native_item_ty {
-        cx.sess.bug("register_native_fn(): native fn isn't \
-                        actually a fn");
-      }
       ast::native_item_fn(_, tps) {
         count = vec::len::<ast::ty_param>(tps);
       }
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index e2390ab9911..013ffd56867 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -68,7 +68,6 @@ export mk_vec;
 export mk_mach_int;
 export mk_mach_uint;
 export mk_mach_float;
-export mk_native;
 export mk_nil;
 export mk_iface;
 export mk_res;
@@ -116,7 +115,6 @@ export ty_fn_ret_style;
 export ty_int;
 export ty_str;
 export ty_vec;
-export ty_native;
 export ty_nil;
 export ty_iface;
 export ty_res;
@@ -153,7 +151,6 @@ export type_is_fp;
 export type_allows_implicit_copy;
 export type_is_integral;
 export type_is_numeric;
-export type_is_native;
 export type_is_nil;
 export type_is_pod;
 export type_is_scalar;
@@ -270,7 +267,6 @@ enum sty {
 
     ty_type, // type_desc*
     ty_send_type, // type_desc* that has been cloned into exchange heap
-    ty_native(def_id),
     ty_constr(t, [@type_constr]),
     ty_opaque_closure_ptr(closure_kind), // ptr to env for fn, fn@, fn~
     ty_named(t, @str),
@@ -458,10 +454,7 @@ fn mk_raw_ty(cx: ctxt, st: sty) -> @raw_t {
     }
     alt st {
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) |
-      ty_str | ty_type | ty_send_type | ty_native(_) |
-      ty_opaque_closure_ptr(_) {
-        /* no-op */
-      }
+      ty_str | ty_type | ty_send_type | ty_opaque_closure_ptr(_) {}
       ty_param(_, _) { has_params = true; }
       ty_var(_) { has_vars = true; }
       ty_enum(_, tys) | ty_iface(_, tys) {
@@ -607,8 +600,6 @@ fn mk_type(_cx: ctxt) -> t { ret idx_type; }
 
 fn mk_send_type(_cx: ctxt) -> t { ret idx_send_type; }
 
-fn mk_native(cx: ctxt, did: def_id) -> t { ret gen_ty(cx, ty_native(did)); }
-
 fn mk_opaque_closure_ptr(cx: ctxt, ck: closure_kind) -> t {
     ret gen_ty(cx, ty_opaque_closure_ptr(ck));
 }
@@ -658,7 +649,7 @@ pure fn ty_name(cx: ctxt, typ: t) -> option<@str> {
 fn walk_ty(cx: ctxt, ty: t, f: fn(t)) {
     alt struct(cx, ty) {
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
-      ty_str | ty_send_type | ty_type | ty_native(_) |
+      ty_str | ty_send_type | ty_type |
       ty_opaque_closure_ptr(_) | ty_var(_) | ty_param(_, _) {}
       ty_box(tm) | ty_vec(tm) | ty_ptr(tm) { walk_ty(cx, tm.ty, f); }
       ty_enum(_, subtys) | ty_iface(_, subtys) {
@@ -702,10 +693,7 @@ fn fold_ty(cx: ctxt, fld: fold_mode, ty_0: t) -> t {
     }
     alt interner::get(*cx.ts, ty).struct {
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
-      ty_str | ty_type | ty_send_type | ty_native(_) |
-      ty_opaque_closure_ptr(_) {
-        /* no-op */
-      }
+      ty_str | ty_type | ty_send_type | ty_opaque_closure_ptr(_) {}
       ty_box(tm) {
         ty = mk_box(cx, {ty: fold_ty(cx, fld, tm.ty), mut: tm.mut});
       }
@@ -889,7 +877,7 @@ pure fn type_is_unique(cx: ctxt, ty: t) -> bool {
 pure fn type_is_scalar(cx: ctxt, ty: t) -> bool {
     alt struct(cx, ty) {
       ty_nil | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) |
-      ty_send_type | ty_type | ty_native(_) | ty_ptr(_) { true }
+      ty_send_type | ty_type | ty_ptr(_) { true }
       _ { false }
     }
 }
@@ -897,7 +885,7 @@ pure fn type_is_scalar(cx: ctxt, ty: t) -> bool {
 // FIXME maybe inline this for speed?
 fn type_is_immediate(cx: ctxt, ty: t) -> bool {
     ret type_is_scalar(cx, ty) || type_is_boxed(cx, ty) ||
-        type_is_unique(cx, ty) || type_is_native(cx, ty);
+        type_is_unique(cx, ty);
 }
 
 fn type_needs_drop(cx: ctxt, ty: t) -> bool {
@@ -910,7 +898,7 @@ fn type_needs_drop(cx: ctxt, ty: t) -> bool {
     let result = alt struct(cx, ty) {
       // scalar types
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) |
-      ty_type | ty_native(_) | ty_ptr(_) { false }
+      ty_type | ty_ptr(_) { false }
       ty_rec(flds) {
         for f in flds { if type_needs_drop(cx, f.mt.ty) { accum = true; } }
         accum
@@ -993,8 +981,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
     let result = alt struct(cx, ty) {
       // Scalar and unique types are sendable
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
-      ty_native(_) | ty_ptr(_) |
-      ty_send_type | ty_str { kind_sendable }
+      ty_ptr(_) | ty_send_type | ty_str { kind_sendable }
       ty_type { kind_copyable }
       ty_fn(f) { proto_kind(f.proto) }
       ty_opaque_closure_ptr(ck_block) { kind_noncopyable }
@@ -1043,12 +1030,6 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
     ret result;
 }
 
-// FIXME: should we just return true for native types in
-// type_is_scalar?
-fn type_is_native(cx: ctxt, ty: t) -> bool {
-    alt struct(cx, ty) { ty_native(_) { ret true; } _ { ret false; } }
-}
-
 fn type_structurally_contains(cx: ctxt, ty: t, test: fn(sty) -> bool) ->
    bool {
     let sty = struct(cx, ty);
@@ -1168,7 +1149,7 @@ fn type_is_pod(cx: ctxt, ty: t) -> bool {
     alt struct(cx, ty) {
       // Scalar types
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) |
-      ty_send_type | ty_type | ty_native(_) | ty_ptr(_) { result = true; }
+      ty_send_type | ty_type | ty_ptr(_) { result = true; }
       // Boxed types
       ty_str | ty_box(_) | ty_uniq(_) | ty_vec(_) | ty_fn(_) |
       ty_iface(_, _) { result = false; }
@@ -1359,7 +1340,6 @@ fn hash_type_structure(st: sty) -> uint {
       ty_var(v) { ret hash_uint(30u, v as uint); }
       ty_param(pid, _) { ret hash_uint(31u, pid); }
       ty_type { ret 32u; }
-      ty_native(did) { ret hash_def(33u, did); }
       ty_bot { ret 34u; }
       ty_ptr(mt) { ret hash_subty(35u, mt.ty); }
       ty_res(did, sub, tps) {
@@ -2082,16 +2062,6 @@ mod unify {
           ty::ty_str | ty::ty_send_type {
             ret struct_cmp(cx, expected, actual);
           }
-          ty::ty_native(ex_id) {
-            alt struct(cx.tcx, actual) {
-              ty_native(act_id) {
-                if ex_id.crate == act_id.crate && ex_id.node == act_id.node {
-                    ret ures_ok(actual);
-                } else { ret ures_err(terr_mismatch); }
-              }
-              _ { ret ures_err(terr_mismatch); }
-            }
-          }
           ty::ty_param(expected_n, _) {
             alt struct(cx.tcx, actual) {
               ty::ty_param(actual_n, _) if expected_n == actual_n {
@@ -2515,7 +2485,7 @@ fn def_has_ty_params(def: ast::def) -> bool {
       ast::def_mod(_) | ast::def_const(_) |
       ast::def_arg(_, _) | ast::def_local(_, _) | ast::def_upvar(_, _, _) |
       ast::def_ty_param(_, _) | ast::def_binding(_) | ast::def_use(_) |
-      ast::def_native_ty(_) | ast::def_self(_) | ast::def_ty(_) { false }
+      ast::def_self(_) | ast::def_ty(_) { false }
       ast::def_fn(_, _) | ast::def_variant(_, _) { true }
       _ { false } // ????
     }
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index c2f79c6c13e..b7d35128cbf 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -338,7 +338,6 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t {
           some(ast::def_ty(id)) {
             typ = instantiate(tcx, ast_ty.span, mode, id, path.node.types);
           }
-          some(ast::def_native_ty(id)) { typ = getter(tcx, mode, id).ty; }
           some(ast::def_ty_param(id, n)) {
             typ = ty::mk_param(tcx, n, id);
           }
@@ -438,17 +437,6 @@ fn ty_of_native_item(tcx: ty::ctxt, mode: mode, it: @ast::native_item)
         ret ty_of_native_fn_decl(tcx, mode, fn_decl, params,
                                  local_def(it.id));
       }
-      ast::native_item_ty {
-        alt tcx.tcache.find(local_def(it.id)) {
-          some(tpt) { ret tpt; }
-          none { }
-        }
-        let t = ty::mk_native(tcx, local_def(it.id));
-        let t = ty::mk_named(tcx, t, @it.ident);
-        let tpt = {bounds: @[], ty: t};
-        tcx.tcache.insert(local_def(it.id), tpt);
-        ret tpt;
-      }
     }
 }
 fn ty_of_arg(tcx: ty::ctxt, mode: mode, a: ast::arg) -> ty::arg {
@@ -762,9 +750,6 @@ mod collect {
         // table.
         let tpt = ty_of_native_item(cx.tcx, m_collect, i);
         alt i.node {
-          ast::native_item_ty {
-            // FIXME: Native types have no annotation. Should they? --pcw
-          }
           ast::native_item_fn(_, _) {
             write_ty(cx.tcx, i.id, tpt.ty);
           }
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs
index 38986ea9d64..79285c810c9 100644
--- a/src/comp/syntax/ast.rs
+++ b/src/comp/syntax/ast.rs
@@ -45,7 +45,6 @@ enum def {
     def_ty_param(def_id, uint),
     def_binding(def_id),
     def_use(def_id),
-    def_native_ty(def_id),
     def_upvar(def_id, @def, node_id), // node_id == expr_fn or expr_fn_block
 }
 
@@ -477,7 +476,6 @@ type native_item =
      span: span};
 
 enum native_item_ {
-    native_item_ty,
     native_item_fn(fn_decl, [ty_param]),
 }
 
diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs
index 2e6be5d27d9..bdfaee5d4c2 100644
--- a/src/comp/syntax/ast_util.rs
+++ b/src/comp/syntax/ast_util.rs
@@ -30,8 +30,7 @@ fn def_id_of_def(d: def) -> def_id {
       def_fn(id, _) | def_self(id) | def_mod(id) |
       def_native_mod(id) | def_const(id) | def_arg(id, _) | def_local(id, _) |
       def_variant(_, id) | def_ty(id) | def_ty_param(id, _) |
-      def_binding(id) | def_use(id) | def_native_ty(id) |
-      def_upvar(id, _, _) { id }
+      def_binding(id) | def_use(id) | def_upvar(id, _, _) { id }
     }
 }
 
diff --git a/src/comp/syntax/fold.rs b/src/comp/syntax/fold.rs
index a6e10d183c3..42a6dd22b5b 100644
--- a/src/comp/syntax/fold.rs
+++ b/src/comp/syntax/fold.rs
@@ -189,7 +189,6 @@ fn noop_fold_native_item(&&ni: @native_item, fld: ast_fold) -> @native_item {
           attrs: vec::map(ni.attrs, fold_attribute),
           node:
               alt ni.node {
-                native_item_ty { native_item_ty }
                 native_item_fn(fdec, typms) {
                   native_item_fn({inputs: vec::map(fdec.inputs, fold_arg),
                                   output: fld.fold_ty(fdec.output),
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 06f4e78372d..35c0bce9a4b 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -1963,18 +1963,6 @@ fn parse_item_mod(p: parser, attrs: [ast::attribute]) -> @ast::item {
     ret mk_item(p, lo, hi, id, ast::item_mod(m), attrs + inner_attrs.inner);
 }
 
-fn parse_item_native_type(p: parser, attrs: [ast::attribute]) ->
-   @ast::native_item {
-    let t = parse_type_decl(p);
-    let hi = p.span.hi;
-    expect(p, token::SEMI);
-    ret @{ident: t.ident,
-          attrs: attrs,
-          node: ast::native_item_ty,
-          id: p.get_id(),
-          span: ast_util::mk_sp(t.lo, hi)};
-}
-
 fn parse_item_native_fn(p: parser, attrs: [ast::attribute],
                         purity: ast::purity) -> @ast::native_item {
     let lo = p.last_span.lo;
@@ -1991,9 +1979,7 @@ fn parse_item_native_fn(p: parser, attrs: [ast::attribute],
 
 fn parse_native_item(p: parser, attrs: [ast::attribute]) ->
    @ast::native_item {
-    if eat_word(p, "type") {
-        ret parse_item_native_type(p, attrs);
-    } else if eat_word(p, "fn") {
+    if eat_word(p, "fn") {
         ret parse_item_native_fn(p, attrs, ast::impure_fn);
     } else if eat_word(p, "pure") {
         expect_word(p, "fn");
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index 938e86fc74e..cf2f09d50ea 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -380,16 +380,6 @@ fn print_native_item(s: ps, item: @ast::native_item) {
     maybe_print_comment(s, item.span.lo);
     print_outer_attributes(s, item.attrs);
     alt item.node {
-      ast::native_item_ty {
-        ibox(s, indent_unit);
-        ibox(s, 0u);
-        word_nbsp(s, "type");
-        word(s.s, item.ident);
-        end(s); // end the inner ibox
-        word(s.s, ";");
-        end(s); // end the outer ibox
-
-      }
       ast::native_item_fn(decl, typarams) {
         print_fn(s, decl, item.ident, typarams);
         end(s); // end head-ibox
diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs
index de8b53af2c4..8249bd873bf 100644
--- a/src/comp/syntax/visit.rs
+++ b/src/comp/syntax/visit.rs
@@ -211,7 +211,6 @@ fn visit_native_item<E>(ni: @native_item, e: E, v: vt<E>) {
         v.visit_ty_params(tps, e, v);
         visit_fn_decl(fd, e, v);
       }
-      native_item_ty { }
     }
 }
 
diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs
index 6d8af8e3846..4772bbc4fc3 100644
--- a/src/comp/util/ppaux.rs
+++ b/src/comp/util/ppaux.rs
@@ -85,7 +85,6 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
       _ { }
     }
     ret alt struct(cx, typ) {
-      ty_native(_) { "native" }
       ty_nil { "()" }
       ty_bot { "_|_" }
       ty_bool { "bool" }