Skip to content

Commit fb12aeb

Browse files
committed
auto merge of #12180 : eddyb/rust/rm-ty_type, r=nikomatsakis
2 parents e192cd9 + 54760b9 commit fb12aeb

File tree

17 files changed

+29
-57
lines changed

17 files changed

+29
-57
lines changed

src/librustc/metadata/tydecode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
372372
'F' => {
373373
return ty::mk_bare_fn(st.tcx, parse_bare_fn_ty(st, |x,y| conv(x,y)));
374374
}
375-
'Y' => return ty::mk_type(st.tcx),
376375
'#' => {
377376
let pos = parse_hex(st);
378377
assert_eq!(next(st), ':');

src/librustc/metadata/tyencode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ fn enc_sty(w: &mut MemWriter, cx: @ctxt, st: &ty::sty) {
328328
ty::ty_self(did) => {
329329
mywrite!(w, "s{}|", (cx.ds)(did));
330330
}
331-
ty::ty_type => mywrite!(w, "Y"),
332331
ty::ty_struct(def, ref substs) => {
333332
mywrite!(w, "a[{}|", (cx.ds)(def));
334333
enc_substs(w, cx, substs);

src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -598,19 +598,8 @@ pub fn compare_scalar_types<'a>(
598598
ty::ty_int(_) => rslt(cx, f(signed_int)),
599599
ty::ty_uint(_) => rslt(cx, f(unsigned_int)),
600600
ty::ty_float(_) => rslt(cx, f(floating_point)),
601-
ty::ty_type => {
602-
rslt(
603-
controlflow::trans_fail(
604-
cx, None,
605-
InternedString::new("attempt to compare values of type \
606-
type")),
607-
C_nil())
608-
}
609-
_ => {
610601
// Should never get here, because t is scalar.
611-
cx.sess().bug("non-scalar type passed to \
612-
compare_scalar_types")
613-
}
602+
_ => cx.sess().bug("non-scalar type passed to compare_scalar_types")
614603
}
615604
}
616605

src/librustc/middle/trans/closure.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,12 @@ pub fn mk_closure_tys(tcx: ty::ctxt,
152152
return cdata_ty;
153153
}
154154

155-
pub fn allocate_cbox<'a>(
156-
bcx: &'a Block<'a>,
155+
fn tuplify_box_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
156+
let ptr = ty::mk_imm_ptr(tcx, ty::mk_i8());
157+
ty::mk_tup(tcx, ~[ty::mk_uint(), ty::mk_nil_ptr(tcx), ptr, ptr, t])
158+
}
159+
160+
fn allocate_cbox<'a>(bcx: &'a Block<'a>,
157161
sigil: ast::Sigil,
158162
cdata_ty: ty::t)
159163
-> Result<'a> {

src/librustc/middle/trans/common.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -520,19 +520,6 @@ pub fn val_ty(v: ValueRef) -> Type {
520520
}
521521
}
522522

523-
// Let T be the content of a box @T. tuplify_box_ty(t) returns the
524-
// representation of @T as a tuple (i.e., the ty::t version of what T_box()
525-
// returns).
526-
pub fn tuplify_box_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
527-
let ptr = ty::mk_ptr(
528-
tcx,
529-
ty::mt {ty: ty::mk_i8(), mutbl: ast::MutImmutable}
530-
);
531-
return ty::mk_tup(tcx, ~[ty::mk_uint(), ty::mk_type(tcx),
532-
ptr, ptr,
533-
t]);
534-
}
535-
536523
// LLVM constant constructors.
537524
pub fn C_null(t: Type) -> ValueRef {
538525
unsafe {

src/librustc/middle/trans/reflect.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,7 @@ impl<'a> Reflector<'a> {
368368
let extra = ~[self.c_uint(p.idx)];
369369
self.visit("param", extra)
370370
}
371-
ty::ty_self(..) => self.leaf("self"),
372-
ty::ty_type => self.leaf("type")
371+
ty::ty_self(..) => self.leaf("self")
373372
}
374373
}
375374

src/librustc/middle/trans/type_of.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
119119
ty::ty_box(..) |
120120
ty::ty_uniq(..) |
121121
ty::ty_ptr(..) |
122-
ty::ty_rptr(..) |
123-
ty::ty_type => Type::i8p(),
122+
ty::ty_rptr(..) => Type::i8p(),
124123

125124
ty::ty_str(ty::vstore_slice(..)) |
126125
ty::ty_vec(_, ty::vstore_slice(..)) => {
@@ -263,7 +262,6 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type {
263262
Type::struct_([fn_ty, Type::i8p()], false)
264263
}
265264
ty::ty_trait(..) => Type::opaque_trait(),
266-
ty::ty_type => cx.tydesc_type.ptr_to(),
267265
ty::ty_tup(..) => {
268266
let repr = adt::represent_type(cx, t);
269267
adt::type_of(cx, repr)

src/librustc/middle/ty.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,6 @@ pub enum sty {
756756
// on non-useful type error messages)
757757

758758
// "Fake" types, used for trans purposes
759-
ty_type, // type_desc*
760759
ty_unboxed_vec(mt),
761760
}
762761

@@ -1181,7 +1180,7 @@ pub fn mk_t(cx: ctxt, st: sty) -> t {
11811180
flags |= get(mt.ty).flags;
11821181
}
11831182
&ty_nil | &ty_bool | &ty_char | &ty_int(_) | &ty_float(_) | &ty_uint(_) |
1184-
&ty_str(_) | &ty_type => {}
1183+
&ty_str(_) => {}
11851184
// You might think that we could just return ty_err for
11861185
// any type containing ty_err as a component, and get
11871186
// 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 {
14441443
mk_t(cx, ty_param(param_ty { idx: n, def_id: k }))
14451444
}
14461445

1447-
pub fn mk_type(cx: ctxt) -> t { mk_t(cx, ty_type) }
1448-
14491446
pub fn walk_ty(ty: t, f: |t|) {
14501447
maybe_walk_ty(ty, |t| { f(t); true });
14511448
}
@@ -1456,7 +1453,7 @@ pub fn maybe_walk_ty(ty: t, f: |t| -> bool) {
14561453
}
14571454
match get(ty).sty {
14581455
ty_nil | ty_bot | ty_bool | ty_char | ty_int(_) | ty_uint(_) | ty_float(_) |
1459-
ty_str(_) | ty_type | ty_self(_) |
1456+
ty_str(_) | ty_self(_) |
14601457
ty_infer(_) | ty_param(_) | ty_err => {}
14611458
ty_box(ty) | ty_uniq(ty) => maybe_walk_ty(ty, f),
14621459
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 {
17301727
pub fn type_is_scalar(ty: t) -> bool {
17311728
match get(ty).sty {
17321729
ty_nil | ty_bool | ty_char | ty_int(_) | ty_float(_) | ty_uint(_) |
1733-
ty_infer(IntVar(_)) | ty_infer(FloatVar(_)) | ty_type |
1730+
ty_infer(IntVar(_)) | ty_infer(FloatVar(_)) |
17341731
ty_bare_fn(..) | ty_ptr(_) => true,
17351732
_ => false
17361733
}
@@ -2216,8 +2213,6 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
22162213
}
22172214
ty_unboxed_vec(mt) => TC::InteriorUnsized | tc_mt(cx, mt, cache),
22182215

2219-
ty_type => TC::None,
2220-
22212216
ty_err => {
22222217
cx.sess.bug("asked to compute contents of error type");
22232218
}
@@ -2401,7 +2396,6 @@ pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
24012396
ty_err |
24022397
ty_param(_) |
24032398
ty_self(_) |
2404-
ty_type |
24052399
ty_vec(_, _) |
24062400
ty_unboxed_vec(_) => {
24072401
false
@@ -2628,7 +2622,7 @@ pub fn type_is_pod(cx: ctxt, ty: t) -> bool {
26282622
match get(ty).sty {
26292623
// Scalar types
26302624
ty_nil | ty_bot | ty_bool | ty_char | ty_int(_) | ty_float(_) | ty_uint(_) |
2631-
ty_type | ty_ptr(_) | ty_bare_fn(_) => result = true,
2625+
ty_ptr(_) | ty_bare_fn(_) => result = true,
26322626
// Boxed types
26332627
ty_box(_) | ty_uniq(_) | ty_closure(_) |
26342628
ty_str(vstore_uniq) |
@@ -3556,7 +3550,7 @@ pub fn occurs_check(tcx: ctxt, sp: Span, vid: TyVid, rt: t) {
35563550
pub fn ty_sort_str(cx: ctxt, t: t) -> ~str {
35573551
match get(t).sty {
35583552
ty_nil | ty_bot | ty_bool | ty_char | ty_int(_) |
3559-
ty_uint(_) | ty_float(_) | ty_str(_) | ty_type => {
3553+
ty_uint(_) | ty_float(_) | ty_str(_) => {
35603554
::util::ppaux::ty_to_str(cx, t)
35613555
}
35623556

@@ -5120,9 +5114,8 @@ pub fn hash_crate_independent(tcx: ctxt, t: t, local_hash: ~str) -> u64 {
51205114
}
51215115
ty_infer(_) => unreachable!(),
51225116
ty_err => hash.input([23]),
5123-
ty_type => hash.input([24]),
51245117
ty_unboxed_vec(m) => {
5125-
hash.input([25]);
5118+
hash.input([24]);
51265119
mt(&mut hash, m);
51275120
}
51285121
}

src/librustc/middle/ty_fold.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ pub fn super_fold_sty<T:TypeFolder>(this: &mut T,
187187
ty::ty_str(this.fold_vstore(vst))
188188
}
189189
ty::ty_nil | ty::ty_bot | ty::ty_bool | ty::ty_char |
190-
ty::ty_int(_) | ty::ty_uint(_) |
191-
ty::ty_float(_) | ty::ty_type |
190+
ty::ty_int(_) | ty::ty_uint(_) | ty::ty_float(_) |
192191
ty::ty_err | ty::ty_infer(_) |
193192
ty::ty_param(..) | ty::ty_self(_) => {
194193
(*sty).clone()

src/librustc/middle/typeck/check/method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ impl<'a> LookupContext<'a> {
788788

789789
ty_err => None,
790790

791-
ty_unboxed_vec(_) | ty_type | ty_infer(TyVar(_)) => {
791+
ty_unboxed_vec(_) | ty_infer(TyVar(_)) => {
792792
self.bug(format!("unexpected type: {}",
793793
self.ty_to_str(self_ty)));
794794
}

0 commit comments

Comments
 (0)