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

-1
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

-1
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

+1-12
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

+6-2
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

-13
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

+1-2
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

+1-3
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

+6-13
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

+1-2
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

+1-1
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
}

src/librustc/middle/typeck/coherence.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use middle::ty::{substs, t, ty_bool, ty_char, ty_bot, ty_box, ty_enum, ty_err};
2323
use middle::ty::{ty_str, ty_vec, ty_float, ty_infer, ty_int, ty_nil};
2424
use middle::ty::{ty_param, ty_param_bounds_and_ty, ty_ptr};
2525
use middle::ty::{ty_rptr, ty_self, ty_struct, ty_trait, ty_tup};
26-
use middle::ty::{ty_type, ty_uint, ty_uniq, ty_bare_fn, ty_closure};
26+
use middle::ty::{ty_uint, ty_uniq, ty_bare_fn, ty_closure};
2727
use middle::ty::{ty_unboxed_vec, type_is_ty_var};
2828
use middle::subst::Subst;
2929
use middle::ty;
@@ -82,7 +82,7 @@ fn get_base_type(inference_context: &InferCtxt,
8282

8383
ty_nil | ty_bot | ty_bool | ty_char | ty_int(..) | ty_uint(..) | ty_float(..) |
8484
ty_str(..) | ty_vec(..) | ty_bare_fn(..) | ty_closure(..) | ty_tup(..) |
85-
ty_infer(..) | ty_param(..) | ty_self(..) | ty_type |
85+
ty_infer(..) | ty_param(..) | ty_self(..) |
8686
ty_unboxed_vec(..) | ty_err | ty_box(_) |
8787
ty_uniq(_) | ty_ptr(_) | ty_rptr(_, _) => {
8888
debug!("(getting base type) no base type; found {:?}",

src/librustc/middle/typeck/variance.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,7 @@ impl<'a> ConstraintContext<'a> {
715715
self.add_constraints_from_sig(sig, variance);
716716
}
717717

718-
ty::ty_infer(..) | ty::ty_err |
719-
ty::ty_type | ty::ty_unboxed_vec(..) => {
718+
ty::ty_infer(..) | ty::ty_err | ty::ty_unboxed_vec(..) => {
720719
self.tcx().sess.bug(
721720
format!("unexpected type encountered in \
722721
variance inference: {}",

src/librustc/util/ppaux.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use middle::ty::{ReFree, ReScope, ReInfer, ReStatic, Region,
1818
ReEmpty};
1919
use middle::ty::{ty_bool, ty_char, ty_bot, ty_box, ty_struct, ty_enum};
2020
use middle::ty::{ty_err, ty_str, ty_vec, ty_float, ty_bare_fn, ty_closure};
21-
use middle::ty::{ty_nil, ty_param, ty_ptr, ty_rptr, ty_self, ty_tup, ty_type};
21+
use middle::ty::{ty_nil, ty_param, ty_ptr, ty_rptr, ty_self, ty_tup};
2222
use middle::ty::{ty_uniq, ty_trait, ty_int, ty_uint, ty_unboxed_vec, ty_infer};
2323
use middle::ty;
2424
use middle::typeck;
@@ -454,7 +454,6 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
454454
region_ptr_to_str(cx, r) + mt_to_str(cx, tm)
455455
}
456456
ty_unboxed_vec(ref tm) => { format!("unboxed_vec<{}>", mt_to_str(cx, tm)) }
457-
ty_type => ~"type",
458457
ty_tup(ref elems) => {
459458
let strs = elems.map(|elem| ty_to_str(cx, *elem));
460459
~"(" + strs.connect(",") + ")"

src/libstd/reflect.rs

+2
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
442442
true
443443
}
444444

445+
// NOTE Remove after next snapshot.
446+
#[cfg(stage0)]
445447
fn visit_type(&mut self) -> bool {
446448
if ! self.inner.visit_type() { return false; }
447449
true

src/libstd/repr.rs

+3
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
601601

602602
fn visit_param(&mut self, _i: uint) -> bool { true }
603603
fn visit_self(&mut self) -> bool { true }
604+
605+
// NOTE Remove after next snapshot.
606+
#[cfg(stage0)]
604607
fn visit_type(&mut self) -> bool { true }
605608
}
606609

src/libstd/unstable/intrinsics.rs

+3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ pub trait TyVisitor {
160160
fn visit_trait(&mut self, name: &str) -> bool;
161161
fn visit_param(&mut self, i: uint) -> bool;
162162
fn visit_self(&mut self) -> bool;
163+
164+
// NOTE Remove after next snapshot.
165+
#[cfg(stage0)]
163166
fn visit_type(&mut self) -> bool;
164167
}
165168

src/test/run-pass/reflect-visit-type.rs

-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ impl TyVisitor for MyVisitor {
138138
fn visit_trait(&mut self, _name: &str) -> bool { true }
139139
fn visit_param(&mut self, _i: uint) -> bool { true }
140140
fn visit_self(&mut self) -> bool { true }
141-
fn visit_type(&mut self) -> bool { true }
142141
}
143142

144143
fn visit_ty<T>(v: &mut MyVisitor) {

0 commit comments

Comments
 (0)