]> git.lizzy.rs Git - rust.git/commitdiff
Removed ty_type (previously used to represent *tydesc).
authorEduard Burtescu <edy.burt@gmail.com>
Tue, 11 Feb 2014 11:48:55 +0000 (13:48 +0200)
committerEduard Burtescu <edy.burt@gmail.com>
Wed, 12 Feb 2014 12:17:06 +0000 (14:17 +0200)
17 files changed:
src/librustc/metadata/tydecode.rs
src/librustc/metadata/tyencode.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/closure.rs
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/reflect.rs
src/librustc/middle/trans/type_of.rs
src/librustc/middle/ty.rs
src/librustc/middle/ty_fold.rs
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/coherence.rs
src/librustc/middle/typeck/variance.rs
src/librustc/util/ppaux.rs
src/libstd/reflect.rs
src/libstd/repr.rs
src/libstd/unstable/intrinsics.rs
src/test/run-pass/reflect-visit-type.rs

index 00e189cdc792d20c482f51935371308efcbd88cd..c1f2a459666fcc82bbcca4a28e38bd84789e307a 100644 (file)
@@ -372,7 +372,6 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
       'F' => {
         return ty::mk_bare_fn(st.tcx, parse_bare_fn_ty(st, |x,y| conv(x,y)));
       }
-      'Y' => return ty::mk_type(st.tcx),
       '#' => {
         let pos = parse_hex(st);
         assert_eq!(next(st), ':');
index 08632b5c9a6e0b3a325a4789a7f4f3060cdf2df1..0f4a1899368946ea1b5182ed02edf18e85739c09 100644 (file)
@@ -328,7 +328,6 @@ fn enc_sty(w: &mut MemWriter, cx: @ctxt, st: &ty::sty) {
         ty::ty_self(did) => {
             mywrite!(w, "s{}|", (cx.ds)(did));
         }
-        ty::ty_type => mywrite!(w, "Y"),
         ty::ty_struct(def, ref substs) => {
             mywrite!(w, "a[{}|", (cx.ds)(def));
             enc_substs(w, cx, substs);
index f8c051404f0319c2679ba21abdf666d56228b46d..0aa627994951b995b419c4c15f516979fb9b09e5 100644 (file)
@@ -598,19 +598,8 @@ pub fn compare_scalar_types<'a>(
         ty::ty_int(_) => rslt(cx, f(signed_int)),
         ty::ty_uint(_) => rslt(cx, f(unsigned_int)),
         ty::ty_float(_) => rslt(cx, f(floating_point)),
-        ty::ty_type => {
-            rslt(
-                controlflow::trans_fail(
-                    cx, None,
-                    InternedString::new("attempt to compare values of type \
-                                         type")),
-                C_nil())
-        }
-        _ => {
             // Should never get here, because t is scalar.
-            cx.sess().bug("non-scalar type passed to \
-                           compare_scalar_types")
-        }
+        _ => cx.sess().bug("non-scalar type passed to compare_scalar_types")
     }
 }
 
index 81c671b495246ade18c43e7d75a6b7e1c2c3b373..6506fe59a5d940aed6808dde035753ffad644c19 100644 (file)
@@ -152,8 +152,12 @@ pub fn mk_closure_tys(tcx: ty::ctxt,
     return cdata_ty;
 }
 
-pub fn allocate_cbox<'a>(
-                     bcx: &'a Block<'a>,
+fn tuplify_box_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
+    let ptr = ty::mk_imm_ptr(tcx, ty::mk_i8());
+    ty::mk_tup(tcx, ~[ty::mk_uint(), ty::mk_nil_ptr(tcx), ptr, ptr, t])
+}
+
+fn allocate_cbox<'a>(bcx: &'a Block<'a>,
                      sigil: ast::Sigil,
                      cdata_ty: ty::t)
                      -> Result<'a> {
index 7dbf159265dd1ccb82543e3f60bf49c7f8b46521..78bee6c7263e38eb4fc1f9cdf9fa761c75cae5f8 100644 (file)
@@ -520,19 +520,6 @@ pub fn val_ty(v: ValueRef) -> Type {
     }
 }
 
-// Let T be the content of a box @T.  tuplify_box_ty(t) returns the
-// representation of @T as a tuple (i.e., the ty::t version of what T_box()
-// returns).
-pub fn tuplify_box_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
-    let ptr = ty::mk_ptr(
-        tcx,
-        ty::mt {ty: ty::mk_i8(), mutbl: ast::MutImmutable}
-    );
-    return ty::mk_tup(tcx, ~[ty::mk_uint(), ty::mk_type(tcx),
-                         ptr, ptr,
-                         t]);
-}
-
 // LLVM constant constructors.
 pub fn C_null(t: Type) -> ValueRef {
     unsafe {
index 1a1ae97bbcdb93451712db86fa76e4428b842bad..89538731626e1d1425d33ed049f99bec9b34b65b 100644 (file)
@@ -368,8 +368,7 @@ pub fn visit_ty(&mut self, t: ty::t) {
               let extra = ~[self.c_uint(p.idx)];
               self.visit("param", extra)
           }
-          ty::ty_self(..) => self.leaf("self"),
-          ty::ty_type => self.leaf("type")
+          ty::ty_self(..) => self.leaf("self")
         }
     }
 
index 00d67a60ac4831cb2a2c4a37b16a7f0e1e0bfd41..3afd490323044633136db32396ac3fa88cd73c80 100644 (file)
@@ -119,8 +119,7 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
         ty::ty_box(..) |
         ty::ty_uniq(..) |
         ty::ty_ptr(..) |
-        ty::ty_rptr(..) |
-        ty::ty_type => Type::i8p(),
+        ty::ty_rptr(..) => Type::i8p(),
 
         ty::ty_str(ty::vstore_slice(..)) |
         ty::ty_vec(_, ty::vstore_slice(..)) => {
@@ -263,7 +262,6 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type {
           Type::struct_([fn_ty, Type::i8p()], false)
       }
       ty::ty_trait(..) => Type::opaque_trait(),
-      ty::ty_type => cx.tydesc_type.ptr_to(),
       ty::ty_tup(..) => {
           let repr = adt::represent_type(cx, t);
           adt::type_of(cx, repr)
index 7c4cb396b3e26176598173393a7bf274170af766..21124a9f741991ddd93d285812916d059ed41f20 100644 (file)
@@ -756,7 +756,6 @@ pub enum sty {
             // on non-useful type error messages)
 
     // "Fake" types, used for trans purposes
-    ty_type, // type_desc*
     ty_unboxed_vec(mt),
 }
 
@@ -1181,7 +1180,7 @@ fn sflags(substs: &substs) -> uint {
         flags |= get(mt.ty).flags;
       }
       &ty_nil | &ty_bool | &ty_char | &ty_int(_) | &ty_float(_) | &ty_uint(_) |
-      &ty_str(_) | &ty_type => {}
+      &ty_str(_) => {}
       // You might think that we could just return ty_err for
       // any type containing ty_err as a component, and get
       // rid of the has_ty_err flag -- likewise for ty_bot (with
@@ -1444,8 +1443,6 @@ pub fn mk_param(cx: ctxt, n: uint, k: DefId) -> t {
     mk_t(cx, ty_param(param_ty { idx: n, def_id: k }))
 }
 
-pub fn mk_type(cx: ctxt) -> t { mk_t(cx, ty_type) }
-
 pub fn walk_ty(ty: t, f: |t|) {
     maybe_walk_ty(ty, |t| { f(t); true });
 }
@@ -1456,7 +1453,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_type | ty_self(_) |
+        ty_str(_) | ty_self(_) |
         ty_infer(_) | ty_param(_) | ty_err => {}
         ty_box(ty) | ty_uniq(ty) => maybe_walk_ty(ty, f),
         ty_vec(ref tm, _) | ty_unboxed_vec(ref tm) | ty_ptr(ref tm) |
@@ -1730,7 +1727,7 @@ pub fn type_is_unique(ty: t) -> bool {
 pub fn type_is_scalar(ty: t) -> bool {
     match get(ty).sty {
       ty_nil | ty_bool | ty_char | ty_int(_) | ty_float(_) | ty_uint(_) |
-      ty_infer(IntVar(_)) | ty_infer(FloatVar(_)) | ty_type |
+      ty_infer(IntVar(_)) | ty_infer(FloatVar(_)) |
       ty_bare_fn(..) | ty_ptr(_) => true,
       _ => false
     }
@@ -2216,8 +2213,6 @@ fn tc_ty(cx: ctxt,
             }
             ty_unboxed_vec(mt) => TC::InteriorUnsized | tc_mt(cx, mt, cache),
 
-            ty_type => TC::None,
-
             ty_err => {
                 cx.sess.bug("asked to compute contents of error type");
             }
@@ -2401,7 +2396,6 @@ fn subtypes_require(cx: ctxt, seen: &mut ~[DefId],
             ty_err |
             ty_param(_) |
             ty_self(_) |
-            ty_type |
             ty_vec(_, _) |
             ty_unboxed_vec(_) => {
                 false
@@ -2628,7 +2622,7 @@ pub fn type_is_pod(cx: ctxt, ty: t) -> bool {
     match get(ty).sty {
       // Scalar types
       ty_nil | ty_bot | ty_bool | ty_char | ty_int(_) | ty_float(_) | ty_uint(_) |
-      ty_type | ty_ptr(_) | ty_bare_fn(_) => result = true,
+      ty_ptr(_) | ty_bare_fn(_) => result = true,
       // Boxed types
       ty_box(_) | ty_uniq(_) | ty_closure(_) |
       ty_str(vstore_uniq) |
@@ -3556,7 +3550,7 @@ fn vars_in_type(ty: t) -> ~[TyVid] {
 pub fn ty_sort_str(cx: ctxt, t: t) -> ~str {
     match get(t).sty {
         ty_nil | ty_bot | ty_bool | ty_char | ty_int(_) |
-        ty_uint(_) | ty_float(_) | ty_str(_) | ty_type => {
+        ty_uint(_) | ty_float(_) | ty_str(_) => {
             ::util::ppaux::ty_to_str(cx, t)
         }
 
@@ -5120,9 +5114,8 @@ fn iter<T: IterBytes>(hash: &mut SipState, t: &T) {
             }
             ty_infer(_) => unreachable!(),
             ty_err => hash.input([23]),
-            ty_type => hash.input([24]),
             ty_unboxed_vec(m) => {
-                hash.input([25]);
+                hash.input([24]);
                 mt(&mut hash, m);
             }
         }
index 9c923077d7d60fda8d519e2d54f1595cd1c03378..c0977d3c43fef22b5853c1529bcc3436b52441a7 100644 (file)
@@ -187,8 +187,7 @@ pub fn super_fold_sty<T:TypeFolder>(this: &mut T,
             ty::ty_str(this.fold_vstore(vst))
         }
         ty::ty_nil | ty::ty_bot | ty::ty_bool | ty::ty_char |
-        ty::ty_int(_) | ty::ty_uint(_) |
-        ty::ty_float(_) | ty::ty_type |
+        ty::ty_int(_) | ty::ty_uint(_) | ty::ty_float(_) |
         ty::ty_err | ty::ty_infer(_) |
         ty::ty_param(..) | ty::ty_self(_) => {
             (*sty).clone()
index f19ca049368d05b5ecdae9e1740500ceaf5ceab1..bdcb418b9f8eb85e32b7a2759c7c739deddf6175 100644 (file)
@@ -788,7 +788,7 @@ fn search_for_autoptrd_method(&self, self_ty: ty::t, autoderefs: uint)
 
             ty_err => None,
 
-            ty_unboxed_vec(_) | ty_type | ty_infer(TyVar(_)) => {
+            ty_unboxed_vec(_) | ty_infer(TyVar(_)) => {
                 self.bug(format!("unexpected type: {}",
                               self.ty_to_str(self_ty)));
             }
index 27d52aade93e608a6eb220c71d0d41196a1fb0a5..3a5f9900e3c32fd7b8980712a31932c1e5d5cd6d 100644 (file)
@@ -23,7 +23,7 @@
 use middle::ty::{ty_str, ty_vec, ty_float, ty_infer, ty_int, ty_nil};
 use middle::ty::{ty_param, ty_param_bounds_and_ty, ty_ptr};
 use middle::ty::{ty_rptr, ty_self, ty_struct, ty_trait, ty_tup};
-use middle::ty::{ty_type, ty_uint, ty_uniq, ty_bare_fn, ty_closure};
+use middle::ty::{ty_uint, ty_uniq, ty_bare_fn, ty_closure};
 use middle::ty::{ty_unboxed_vec, type_is_ty_var};
 use middle::subst::Subst;
 use middle::ty;
@@ -82,7 +82,7 @@ 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_self(..) | ty_type |
+        ty_infer(..) | ty_param(..) | ty_self(..) |
         ty_unboxed_vec(..) | ty_err | ty_box(_) |
         ty_uniq(_) | ty_ptr(_) | ty_rptr(_, _) => {
             debug!("(getting base type) no base type; found {:?}",
index e29add4bc95c1b17cf1dd4c14373d94023b5490b..d0420aba45fd19c55ec90a6920029ea270fe06ac 100644 (file)
@@ -715,8 +715,7 @@ fn add_constraints_from_ty(&mut self,
                 self.add_constraints_from_sig(sig, variance);
             }
 
-            ty::ty_infer(..) | ty::ty_err |
-            ty::ty_type | ty::ty_unboxed_vec(..) => {
+            ty::ty_infer(..) | ty::ty_err | ty::ty_unboxed_vec(..) => {
                 self.tcx().sess.bug(
                     format!("unexpected type encountered in \
                             variance inference: {}",
index afac501835dc72bd170515e244888a16100f4f52..f536e231e158999e9619397decd7d68f5a54e9dc 100644 (file)
@@ -18,7 +18,7 @@
                  ReEmpty};
 use middle::ty::{ty_bool, ty_char, ty_bot, ty_box, 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_self, ty_tup, ty_type};
+use middle::ty::{ty_nil, ty_param, ty_ptr, ty_rptr, ty_self, ty_tup};
 use middle::ty::{ty_uniq, ty_trait, ty_int, ty_uint, ty_unboxed_vec, ty_infer};
 use middle::ty;
 use middle::typeck;
@@ -454,7 +454,6 @@ fn push_sig_to_str(cx: ctxt,
         region_ptr_to_str(cx, r) + mt_to_str(cx, tm)
       }
       ty_unboxed_vec(ref tm) => { format!("unboxed_vec<{}>", mt_to_str(cx, tm)) }
-      ty_type => ~"type",
       ty_tup(ref elems) => {
         let strs = elems.map(|elem| ty_to_str(cx, *elem));
         ~"(" + strs.connect(",") + ")"
index e441ea6ec74ebbc9b8c6a914aea5c98f5c5e2bb6..1c22408592a74f56979d8d62bef3ee1802d728a5 100644 (file)
@@ -442,6 +442,8 @@ fn visit_self(&mut self) -> bool {
         true
     }
 
+    // NOTE Remove after next snapshot.
+    #[cfg(stage0)]
     fn visit_type(&mut self) -> bool {
         if ! self.inner.visit_type() { return false; }
         true
index c0f4efba0d1d6b836fbbf053be78d47d0029c248..4ced74a92b7c04fb8cc568412cadfe97b9e8c165 100644 (file)
@@ -601,6 +601,9 @@ fn visit_trait(&mut self, name: &str) -> bool {
 
     fn visit_param(&mut self, _i: uint) -> bool { true }
     fn visit_self(&mut self) -> bool { true }
+
+    // NOTE Remove after next snapshot.
+    #[cfg(stage0)]
     fn visit_type(&mut self) -> bool { true }
 }
 
index 105236b5f4c732d84bb82d8bb3316ec99e7b2466..b9e9c9d5a436f47b357aee00f2ff00c1aceef758 100644 (file)
@@ -160,6 +160,9 @@ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
     fn visit_trait(&mut self, name: &str) -> bool;
     fn visit_param(&mut self, i: uint) -> bool;
     fn visit_self(&mut self) -> bool;
+
+    // NOTE Remove after next snapshot.
+    #[cfg(stage0)]
     fn visit_type(&mut self) -> bool;
 }
 
index a0d6fc4c157f52e95a6164f0f16f4c23a95ffa38..56db021e2bc29ff4607a72f16a7e7684e0b043fc 100644 (file)
@@ -138,7 +138,6 @@ fn visit_leave_fn(&mut self, _purity: uint, _proto: uint,
     fn visit_trait(&mut self, _name: &str) -> bool { true }
     fn visit_param(&mut self, _i: uint) -> bool { true }
     fn visit_self(&mut self) -> bool { true }
-    fn visit_type(&mut self) -> bool { true }
 }
 
 fn visit_ty<T>(v: &mut MyVisitor) {