Skip to content

Removed ty_type (previously used to represent *tydesc). #12180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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), ':');
Expand Down
1 change: 0 additions & 1 deletion src/librustc/metadata/tyencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
13 changes: 1 addition & 12 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/librustc/middle/trans/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
13 changes: 0 additions & 13 deletions src/librustc/middle/trans/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional to delete this comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to remove the function completely - it's only used by closure-related functions, the layout is wrong and the comment was a victim. I'll put it back if desired.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right if it was intentional.

Expand Down
3 changes: 1 addition & 2 deletions src/librustc/middle/trans/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ impl<'a> Reflector<'a> {
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")
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/librustc/middle/trans/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..)) => {
Expand Down Expand Up @@ -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)
Expand Down
19 changes: 6 additions & 13 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand Down Expand Up @@ -1181,7 +1180,7 @@ pub fn mk_t(cx: ctxt, st: sty) -> t {
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
Expand Down Expand Up @@ -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 });
}
Expand All @@ -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) |
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -2216,8 +2213,6 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
}
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");
}
Expand Down Expand Up @@ -2401,7 +2396,6 @@ pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
ty_err |
ty_param(_) |
ty_self(_) |
ty_type |
ty_vec(_, _) |
ty_unboxed_vec(_) => {
false
Expand Down Expand Up @@ -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) |
Expand Down Expand Up @@ -3556,7 +3550,7 @@ pub fn occurs_check(tcx: ctxt, sp: Span, vid: TyVid, rt: t) {
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)
}

Expand Down Expand Up @@ -5120,9 +5114,8 @@ pub fn hash_crate_independent(tcx: ctxt, t: t, local_hash: ~str) -> u64 {
}
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);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/middle/ty_fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/check/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ impl<'a> LookupContext<'a> {

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)));
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/typeck/coherence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use middle::ty::{substs, t, ty_bool, ty_char, ty_bot, ty_box, ty_enum, ty_err};
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;
Expand Down Expand Up @@ -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 {:?}",
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/middle/typeck/variance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,7 @@ impl<'a> ConstraintContext<'a> {
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: {}",
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/util/ppaux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use middle::ty::{ReFree, ReScope, ReInfer, ReStatic, Region,
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;
Expand Down Expand Up @@ -454,7 +454,6 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
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(",") + ")"
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
true
}

// NOTE Remove after next snapshot.
#[cfg(stage0)]
fn visit_type(&mut self) -> bool {
if ! self.inner.visit_type() { return false; }
true
Expand Down
3 changes: 3 additions & 0 deletions src/libstd/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,9 @@ impl<'a> TyVisitor for ReprVisitor<'a> {

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

Expand Down
3 changes: 3 additions & 0 deletions src/libstd/unstable/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ pub trait TyVisitor {
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;
}

Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/reflect-visit-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ impl TyVisitor for MyVisitor {
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) {
Expand Down