'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), ':');
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);
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")
}
}
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> {
}
}
-// 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 {
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")
}
}
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(..)) => {
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)
// on non-useful type error messages)
// "Fake" types, used for trans purposes
- ty_type, // type_desc*
ty_unboxed_vec(mt),
}
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
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 });
}
}
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) |
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
}
}
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");
}
ty_err |
ty_param(_) |
ty_self(_) |
- ty_type |
ty_vec(_, _) |
ty_unboxed_vec(_) => {
false
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) |
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)
}
}
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);
}
}
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()
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)));
}
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;
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 {:?}",
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: {}",
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;
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(",") + ")"
true
}
+ // NOTE Remove after next snapshot.
+ #[cfg(stage0)]
fn visit_type(&mut self) -> bool {
if ! self.inner.visit_type() { return false; }
true
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 }
}
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;
}
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) {