diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index cfef2f96581..cd422b03a4b 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -415,7 +415,6 @@ fn restricted_keyword_table() -> HashMap<~str, ()> { ~"fail", ~"fn", ~"impl", ~"priv", ~"pub", - ~"struct", ~"unsafe" ]; for keys.each |word| { @@ -438,6 +437,7 @@ fn strict_keyword_table() -> HashMap<~str, ()> { ~"match", ~"mod", ~"move", ~"mut", ~"pure", ~"ref", ~"return", + ~"struct", ~"true", ~"trait", ~"type", ~"unchecked", ~"use", ~"while" diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index 3f21caafb66..ed6835b6f8b 100644 --- a/src/rustc/metadata/decoder.rs +++ b/src/rustc/metadata/decoder.rs @@ -584,7 +584,7 @@ fn get_enum_variants(intr: ident_interner, cdata: cmd, id: ast::node_id, tcx, cdata); let name = item_name(intr, item); let mut arg_tys: ~[ty::t] = ~[]; - match ty::get(ctor_ty).struct { + match ty::get(ctor_ty).sty { ty::ty_fn(f) => { for f.sig.inputs.each |a| { vec::push(arg_tys, a.ty); } } @@ -696,7 +696,7 @@ fn get_trait_methods(intr: ident_interner, cdata: cmd, id: ast::node_id, let bounds = item_ty_param_bounds(mth, tcx, cdata); let name = item_name(intr, mth); let ty = doc_type(mth, tcx, cdata); - let fty = match ty::get(ty).struct { + let fty = match ty::get(ty).sty { ty::ty_fn(f) => f, _ => { tcx.diag.handler().bug( diff --git a/src/rustc/metadata/tyencode.rs b/src/rustc/metadata/tyencode.rs index 3d256367023..175691613a7 100644 --- a/src/rustc/metadata/tyencode.rs +++ b/src/rustc/metadata/tyencode.rs @@ -47,7 +47,7 @@ fn enc_ty(w: io::Writer, cx: @ctxt, t: ty::t) { Some(s) => *s, None => { let buf = io::mem_buffer(); - enc_sty(io::mem_buffer_writer(buf), cx, ty::get(t).struct); + enc_sty(io::mem_buffer_writer(buf), cx, ty::get(t).sty); cx.tcx.short_names_cache.insert(t, @io::mem_buffer_str(buf)); io::mem_buffer_str(buf) } @@ -72,7 +72,7 @@ fn enc_ty(w: io::Writer, cx: @ctxt, t: ty::t) { } _ => {} } - enc_sty(w, cx, ty::get(t).struct); + enc_sty(w, cx, ty::get(t).sty); let end = w.tell(); let len = end - pos; fn estimate_sz(u: uint) -> uint { diff --git a/src/rustc/middle/borrowck/check_loans.rs b/src/rustc/middle/borrowck/check_loans.rs index 974c9b632ca..e2cbb68e95a 100644 --- a/src/rustc/middle/borrowck/check_loans.rs +++ b/src/rustc/middle/borrowck/check_loans.rs @@ -224,7 +224,7 @@ impl check_loan_ctxt { } let callee_ty = ty::node_id_to_type(tcx, callee_id); - match ty::get(callee_ty).struct { + match ty::get(callee_ty).sty { ty::ty_fn(fn_ty) => { match fn_ty.meta.purity { ast::pure_fn => return, // case (c) above diff --git a/src/rustc/middle/check_alt.rs b/src/rustc/middle/check_alt.rs index 1033f2c81c5..79dbcecbec4 100644 --- a/src/rustc/middle/check_alt.rs +++ b/src/rustc/middle/check_alt.rs @@ -39,7 +39,7 @@ fn check_expr(tcx: ty::ctxt, ex: @expr, &&s: (), v: visit::vt<()>) { // If the type *is* empty, it's vacuously exhaustive return; } - match ty::get(pat_ty).struct { + match ty::get(pat_ty).sty { ty_enum(did, _) => { if (*enum_variants(tcx, did)).is_empty() && arms.is_empty() { @@ -85,7 +85,7 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: ~[@pat]) { not_useful => return, // This is good, wildcard pattern isn't reachable useful_ => None, useful(ty, ctor) => { - match ty::get(ty).struct { + match ty::get(ty).sty { ty::ty_bool => { match ctor { val(const_bool(true)) => Some(~"true"), @@ -167,7 +167,7 @@ fn is_useful(tcx: ty::ctxt, m: matrix, v: ~[@pat]) -> useful { None => { match missing_ctor(tcx, m, left_ty) { None => { - match ty::get(left_ty).struct { + match ty::get(left_ty).sty { ty::ty_bool => { match is_useful_specialized(tcx, m, v, val(const_bool(true)), 0u, left_ty){ @@ -257,7 +257,7 @@ fn is_wild(tcx: ty::ctxt, p: @pat) -> bool { } fn missing_ctor(tcx: ty::ctxt, m: matrix, left_ty: ty::t) -> Option { - match ty::get(left_ty).struct { + match ty::get(left_ty).sty { ty::ty_box(_) | ty::ty_uniq(_) | ty::ty_rptr(*) | ty::ty_tup(_) | ty::ty_rec(_) | ty::ty_class(*) => { for m.each |r| { @@ -302,7 +302,7 @@ fn missing_ctor(tcx: ty::ctxt, m: matrix, left_ty: ty::t) -> Option { } fn ctor_arity(tcx: ty::ctxt, ctor: ctor, ty: ty::t) -> uint { - match ty::get(ty).struct { + match ty::get(ty).sty { ty::ty_tup(fs) => fs.len(), ty::ty_rec(fs) => fs.len(), ty::ty_box(_) | ty::ty_uniq(_) | ty::ty_rptr(*) => 1u, @@ -352,7 +352,7 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint, } } pat_rec(flds, _) => { - let ty_flds = match ty::get(left_ty).struct { + let ty_flds = match ty::get(left_ty).sty { ty::ty_rec(flds) => flds, _ => fail ~"bad type for pat_rec" }; @@ -367,7 +367,7 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint, pat_struct(_, flds, _) => { // Grab the class data that we care about. let class_fields, class_id; - match ty::get(left_ty).struct { + match ty::get(left_ty).sty { ty::ty_class(cid, _) => { class_id = cid; class_fields = ty::lookup_class_fields(tcx, class_id); diff --git a/src/rustc/middle/const_eval.rs b/src/rustc/middle/const_eval.rs index d51d07259a3..41bfe9ae026 100644 --- a/src/rustc/middle/const_eval.rs +++ b/src/rustc/middle/const_eval.rs @@ -317,7 +317,7 @@ fn eval_const_expr(tcx: middle::ty::ctxt, e: @expr) -> const_val { expr_cast(base, _) => { let ety = ty::expr_ty(tcx, e); let base = eval_const_expr(tcx, base); - match ty::get(ety).struct { + match ty::get(ety).sty { ty::ty_float(_) => { match base { const_uint(u) => const_float(u as f64), diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs index 4c363a5faf8..4e1d67ea365 100644 --- a/src/rustc/middle/kind.rs +++ b/src/rustc/middle/kind.rs @@ -300,7 +300,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt) { Some(ex) => { // All noncopyable fields must be overridden let t = ty::expr_ty(cx.tcx, ex); - let ty_fields = match ty::get(t).struct { + let ty_fields = match ty::get(t).sty { ty::ty_rec(f) => f, _ => cx.tcx.sess.span_bug(ex.span, ~"bad expr type in record") }; @@ -504,7 +504,7 @@ fn check_send(cx: ctx, ty: ty::t, sp: span) -> bool { // note: also used from middle::typeck::regionck! fn check_owned(tcx: ty::ctxt, ty: ty::t, sp: span) -> bool { if !ty::kind_is_owned(ty::type_kind(tcx, ty)) { - match ty::get(ty).struct { + match ty::get(ty).sty { ty::ty_param(*) => { tcx.sess.span_err(sp, ~"value may contain borrowed \ pointers; use `owned` bound"); @@ -551,7 +551,7 @@ fn check_cast_for_escaping_regions( // Determine what type we are casting to; if it is not an trait, then no // worries. let target_ty = ty::expr_ty(cx.tcx, target); - let target_substs = match ty::get(target_ty).struct { + let target_substs = match ty::get(target_ty).sty { ty::ty_trait(_, substs, _) => {substs} _ => { return; /* not a cast to a trait */ } }; @@ -574,7 +574,7 @@ fn check_cast_for_escaping_regions( let target_params = ty::param_tys_in_type(target_ty); let source_ty = ty::expr_ty(cx.tcx, source); do ty::walk_ty(source_ty) |ty| { - match ty::get(ty).struct { + match ty::get(ty).sty { ty::ty_param(source_param) => { if target_params.contains(source_param) { /* case (2) */ diff --git a/src/rustc/middle/lint.rs b/src/rustc/middle/lint.rs index b41fb004653..255d7a4dd8a 100644 --- a/src/rustc/middle/lint.rs +++ b/src/rustc/middle/lint.rs @@ -498,7 +498,7 @@ fn check_item_heap(cx: ty::ctxt, it: @ast::item) { let mut n_box = 0; let mut n_uniq = 0; ty::fold_ty(cx, ty, |t| { - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_box(_) => n_box += 1, ty::ty_uniq(_) => n_uniq += 1, _ => () @@ -658,7 +658,7 @@ fn check_fn(tcx: ty::ctxt, fk: visit::fn_kind, decl: ast::fn_decl, } let fn_ty = ty::node_id_to_type(tcx, id); - match ty::get(fn_ty).struct { + match ty::get(fn_ty).sty { ty::ty_fn(fn_ty) => { let mut counter = 0; do vec::iter2(fn_ty.sig.inputs, decl.inputs) |arg_ty, arg_ast| { diff --git a/src/rustc/middle/mem_categorization.rs b/src/rustc/middle/mem_categorization.rs index 75868e6300f..c97431eed23 100644 --- a/src/rustc/middle/mem_categorization.rs +++ b/src/rustc/middle/mem_categorization.rs @@ -290,7 +290,7 @@ enum deref_kind {deref_ptr(ptr_kind), deref_comp(comp_kind)} // derefable (we model an index as the combination of a deref and then a // pointer adjustment). fn opt_deref_kind(t: ty::t) -> Option { - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_uniq(*) | ty::ty_evec(_, ty::vstore_uniq) | ty::ty_estr(ty::vstore_uniq) => { @@ -424,7 +424,7 @@ impl &mem_categorization_ctxt { // Any expression can be borrowed (to account for auto-ref on method // receivers), but @, ~, @vec, and ~vec are handled specially. let expr_ty = ty::expr_ty(self.tcx, expr); - match ty::get(expr_ty).struct { + match ty::get(expr_ty).sty { ty::ty_evec(*) | ty::ty_estr(*) => { self.cat_index(expr, expr) } @@ -1013,7 +1013,7 @@ impl &mem_categorization_ctxt { cat_comp(_, comp_tuple) => ~"tuple content", cat_comp(_, comp_variant(_)) => ~"enum content", cat_comp(_, comp_index(t, _)) => { - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_evec(*) => mut_str + ~" vec content", ty::ty_estr(*) => mut_str + ~" str content", _ => mut_str + ~" indexed content" @@ -1034,7 +1034,7 @@ fn field_mutbl(tcx: ty::ctxt, base_ty: ty::t, f_name: ast::ident) -> Option { // Need to refactor so that records/class fields can be treated uniformly. - match ty::get(base_ty).struct { + match ty::get(base_ty).sty { ty::ty_rec(fields) => { for fields.each |f| { if f.ident == f_name { diff --git a/src/rustc/middle/privacy.rs b/src/rustc/middle/privacy.rs index 6f78c884ef0..6b0df4630da 100644 --- a/src/rustc/middle/privacy.rs +++ b/src/rustc/middle/privacy.rs @@ -154,7 +154,7 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) { visit_expr: |expr, method_map: &method_map, visitor| { match expr.node { expr_field(base, ident, _) => { - match ty::get(ty::expr_ty(tcx, base)).struct { + match ty::get(ty::expr_ty(tcx, base)).sty { ty_class(id, _) if id.crate != local_crate || !privileged_items.contains(id.node) => { @@ -175,7 +175,7 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) { } } expr_struct(_, fields, _) => { - match ty::get(ty::expr_ty(tcx, expr)).struct { + match ty::get(ty::expr_ty(tcx, expr)).sty { ty_class(id, _) => { if id.crate != local_crate || !privileged_items.contains(id.node) { @@ -202,7 +202,7 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) { visit_pat: |pattern, method_map, visitor| { match pattern.node { pat_struct(_, fields, _) => { - match ty::get(ty::pat_ty(tcx, pattern)).struct { + match ty::get(ty::pat_ty(tcx, pattern)).sty { ty_class(id, _) => { if id.crate != local_crate || !privileged_items.contains(id.node) { diff --git a/src/rustc/middle/trans/alt.rs b/src/rustc/middle/trans/alt.rs index 557063ca91c..421d7923234 100644 --- a/src/rustc/middle/trans/alt.rs +++ b/src/rustc/middle/trans/alt.rs @@ -293,8 +293,7 @@ fn extract_variant_args(bcx: block, pat_id: ast::node_id, {vals: ~[ValueRef], bcx: block} { let _icx = bcx.insn_ctxt("alt::extract_variant_args"); let ccx = bcx.fcx.ccx; - let enum_ty_substs = match ty::get(node_id_type(bcx, pat_id)) - .struct { + let enum_ty_substs = match ty::get(node_id_type(bcx, pat_id)).sty { ty::ty_enum(id, substs) => { assert id == vdefs.enm; substs.tps } _ => bcx.sess().bug(~"extract_variant_args: pattern has non-enum type") }; @@ -436,7 +435,7 @@ fn compare_values(cx: block, lhs: ValueRef, rhs: ValueRef, rhs_t: ty::t) -> return rslt(rs.bcx, rs.val); } - match ty::get(rhs_t).struct { + match ty::get(rhs_t).sty { ty::ty_estr(ty::vstore_uniq) => { let scratch_result = scratch_datum(cx, ty::mk_bool(cx.tcx()), false); @@ -559,7 +558,7 @@ fn compile_submatch(bcx: block, m: match_, vals: ~[ValueRef], if any_tup_pat(m, col) { let tup_ty = node_id_type(bcx, pat_id); - let n_tup_elts = match ty::get(tup_ty).struct { + let n_tup_elts = match ty::get(tup_ty).sty { ty::ty_tup(elts) => elts.len(), _ => ccx.sess.bug(~"non-tuple type in tuple pattern") }; diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 2f2d0392a7f..226b76831e6 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -422,7 +422,7 @@ fn compare_scalar_types(cx: block, lhs: ValueRef, rhs: ValueRef, t: ty::t, op: ast::binop) -> Result { let f = |a| compare_scalar_values(cx, lhs, rhs, a, op); - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_nil => rslt(cx, f(nil_type)), ty::ty_bool | ty::ty_ptr(_) => rslt(cx, f(unsigned_int)), ty::ty_int(_) => rslt(cx, f(signed_int)), @@ -528,7 +528,7 @@ fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t, let fn_ty = variant.ctor_ty; let ccx = cx.ccx(); let mut cx = cx; - match ty::get(fn_ty).struct { + match ty::get(fn_ty).sty { ty::ty_fn(ref fn_ty) => { let mut j = 0u; let v_id = variant.id; @@ -548,7 +548,7 @@ fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t, Typestate constraint that shows the unimpl case doesn't happen? */ let mut cx = cx; - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_rec(*) | ty::ty_class(*) => { do expr::with_field_tys(cx.tcx(), t) |_has_dtor, field_tys| { for vec::eachi(field_tys) |i, field_ty| { @@ -655,7 +655,7 @@ fn fail_if_zero(cx: block, span: span, divmod: ast::binop, } else { ~"modulo zero" }; - let is_zero = match ty::get(rhs_t).struct { + let is_zero = match ty::get(rhs_t).sty { ty::ty_int(t) => { let zero = C_integral(T_int_ty(cx.ccx(), t), 0u64, False); ICmp(cx, lib::llvm::IntEQ, rhs, zero) @@ -681,7 +681,7 @@ fn null_env_ptr(bcx: block) -> ValueRef { fn trans_external_path(ccx: @crate_ctxt, did: ast::def_id, t: ty::t) -> ValueRef { let name = csearch::get_symbol(ccx.sess.cstore, did); - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_fn(_) => { let llty = type_of_fn_from_ty(ccx, t); return get_extern_fn(ccx.externs, ccx.llmod, name, @@ -1956,7 +1956,7 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef, let main_takes_argv = // invariant! - match ty::get(main_node_type).struct { + match ty::get(main_node_type).sty { ty::ty_fn(ref fn_ty) => fn_ty.sig.inputs.len() != 0u, _ => ccx.sess.span_fatal(sp, ~"main has a non-function type") }; diff --git a/src/rustc/middle/trans/callee.rs b/src/rustc/middle/trans/callee.rs index 1c1654dbf93..0f8d9495801 100644 --- a/src/rustc/middle/trans/callee.rs +++ b/src/rustc/middle/trans/callee.rs @@ -620,7 +620,7 @@ fn adapt_borrowed_value(bcx: block, datum.to_str(bcx.ccx()), bcx.expr_to_str(expr)); - match ty::get(datum.ty).struct { + match ty::get(datum.ty).sty { ty::ty_uniq(_) | ty::ty_box(_) => { let body_datum = datum.box_body(bcx); let rptr_datum = body_datum.to_rptr(bcx); diff --git a/src/rustc/middle/trans/consts.rs b/src/rustc/middle/trans/consts.rs index f877a5a24b2..24fd916823a 100644 --- a/src/rustc/middle/trans/consts.rs +++ b/src/rustc/middle/trans/consts.rs @@ -10,7 +10,7 @@ fn const_lit(cx: @crate_ctxt, e: @ast::expr, lit: ast::lit) ast::lit_uint(u, t) => C_integral(T_uint_ty(cx, t), u, False), ast::lit_int_unsuffixed(i) => { let lit_int_ty = ty::node_id_to_type(cx.tcx, e.id); - match ty::get(lit_int_ty).struct { + match ty::get(lit_int_ty).sty { ty::ty_int(t) => { C_integral(T_int_ty(cx, t), i as u64, True) } @@ -76,7 +76,7 @@ fn const_autoderef(cx: @crate_ctxt, ty: ty::t, v: ValueRef) let mut v1 = v; loop { // Only rptrs can be autoderef'ed in a const context. - match ty::get(ty).struct { + match ty::get(ty).sty { ty::ty_rptr(_, mt) => { t1 = mt.ty; v1 = const_deref(cx, v1); @@ -184,7 +184,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef { ~"index is not an integer-constant \ expression") }; - let (arr, _len) = match ty::get(bt).struct { + let (arr, _len) = match ty::get(bt).sty { ty::ty_evec(_, vstore) | ty::ty_estr(vstore) => match vstore { ty::vstore_fixed(u) => @@ -236,7 +236,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef { // we can get the value (as a number) out of. let len = llvm::LLVMGetArrayLength(val_ty(arr)) as u64; - let len = match ty::get(bt).struct { + let len = match ty::get(bt).sty { ty::ty_estr(*) => {assert len > 0; len - 1}, _ => len }; diff --git a/src/rustc/middle/trans/datum.rs b/src/rustc/middle/trans/datum.rs index b45b4e6bdba..31db9c96bea 100644 --- a/src/rustc/middle/trans/datum.rs +++ b/src/rustc/middle/trans/datum.rs @@ -528,7 +528,7 @@ impl Datum { * This datum must represent an @T or ~T box. Returns a new * by-ref datum of type T, pointing at the contents. */ - let content_ty = match ty::get(self.ty).struct { + let content_ty = match ty::get(self.ty).sty { ty::ty_box(mt) | ty::ty_uniq(mt) => mt.ty, _ => { bcx.tcx().sess.bug(fmt!( @@ -583,7 +583,7 @@ impl Datum { } } - match ty::get(self.ty).struct { + match ty::get(self.ty).sty { ty::ty_box(_) | ty::ty_uniq(_) => { return Some(self.box_body(bcx)); } diff --git a/src/rustc/middle/trans/expr.rs b/src/rustc/middle/trans/expr.rs index ddc2017e16a..1bd62b4f883 100644 --- a/src/rustc/middle/trans/expr.rs +++ b/src/rustc/middle/trans/expr.rs @@ -447,7 +447,7 @@ fn trans_rvalue_dps(bcx: block, expr: @ast::expr, dest: Dest) -> block { } ast::expr_fn_block(decl, body, cap_clause) => { let expr_ty = expr_ty(bcx, expr); - match ty::get(expr_ty).struct { + match ty::get(expr_ty).sty { ty::ty_fn(ref fn_ty) => { debug!("translating fn_block %s with type %s", expr_to_str(expr, tcx.sess.intr()), @@ -464,7 +464,7 @@ fn trans_rvalue_dps(bcx: block, expr: @ast::expr, dest: Dest) -> block { } } ast::expr_loop_body(blk) => { - match ty::get(expr_ty(bcx, expr)).struct { + match ty::get(expr_ty(bcx, expr)).sty { ty::ty_fn(ref fn_ty) => { match blk.node { ast::expr_fn_block(decl, body, cap) => { @@ -774,7 +774,7 @@ fn fn_data_to_datum(bcx: block, fn with_field_tys(tcx: ty::ctxt, ty: ty::t, op: fn(bool, (&[ty::field])) -> R) -> R { - match ty::get(ty).struct { + match ty::get(ty).sty { ty::ty_rec(ref fields) => { op(false, *fields) } @@ -1279,7 +1279,7 @@ impl cast_kind : cmp::Eq { } fn cast_type_kind(t: ty::t) -> cast_kind { - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_float(*) => cast_float, ty::ty_ptr(*) => cast_pointer, ty::ty_rptr(*) => cast_pointer, diff --git a/src/rustc/middle/trans/foreign.rs b/src/rustc/middle/trans/foreign.rs index 74904fdb8ca..75ec925a4f8 100644 --- a/src/rustc/middle/trans/foreign.rs +++ b/src/rustc/middle/trans/foreign.rs @@ -440,7 +440,7 @@ type c_stack_tys = { fn c_arg_and_ret_lltys(ccx: @crate_ctxt, id: ast::node_id) -> (~[TypeRef], TypeRef, ty::t) { - match ty::get(ty::node_id_to_type(ccx.tcx, id)).struct { + match ty::get(ty::node_id_to_type(ccx.tcx, id)).sty { ty::ty_fn(ref fn_ty) => { let llargtys = type_of_explicit_args(ccx, fn_ty.sig.inputs); let llretty = type_of::type_of(ccx, fn_ty.sig.output); diff --git a/src/rustc/middle/trans/glue.rs b/src/rustc/middle/trans/glue.rs index 384f6e71198..282f890ef2a 100644 --- a/src/rustc/middle/trans/glue.rs +++ b/src/rustc/middle/trans/glue.rs @@ -51,7 +51,7 @@ fn drop_ty_root(bcx: block, v: ValueRef, rooted: bool, t: ty::t) -> block { fn drop_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> block { let _icx = bcx.insn_ctxt("drop_ty_immediate"); - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_uniq(_) | ty::ty_evec(_, ty::vstore_uniq) | ty::ty_estr(ty::vstore_uniq) => { @@ -68,7 +68,7 @@ fn drop_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> block { fn take_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> Result { let _icx = bcx.insn_ctxt("take_ty_immediate"); - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_box(_) | ty::ty_opaque_box | ty::ty_evec(_, ty::vstore_box) | ty::ty_estr(ty::vstore_box) => { @@ -97,7 +97,7 @@ fn free_ty(cx: block, v: ValueRef, t: ty::t) -> block { fn free_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> block { let _icx = bcx.insn_ctxt("free_ty_immediate"); - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_uniq(_) | ty::ty_evec(_, ty::vstore_uniq) | ty::ty_estr(ty::vstore_uniq) | @@ -268,7 +268,7 @@ fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) { // NB: v0 is an *alias* of type t here, not a direct value. let _icx = bcx.insn_ctxt("make_free_glue"); let ccx = bcx.ccx(); - let bcx = match ty::get(t).struct { + let bcx = match ty::get(t).sty { ty::ty_box(body_mt) => { let v = Load(bcx, v); let body = GEPi(bcx, v, [0u, abi::box_field_body]); @@ -357,7 +357,7 @@ fn make_drop_glue(bcx: block, v0: ValueRef, t: ty::t) { // NB: v0 is an *alias* of type t here, not a direct value. let _icx = bcx.insn_ctxt("make_drop_glue"); let ccx = bcx.ccx(); - let bcx = match ty::get(t).struct { + let bcx = match ty::get(t).sty { ty::ty_box(_) | ty::ty_opaque_box | ty::ty_estr(ty::vstore_box) | ty::ty_evec(_, ty::vstore_box) => { decr_refcnt_maybe_free(bcx, Load(bcx, v0), t) @@ -418,7 +418,7 @@ fn decr_refcnt_maybe_free(bcx: block, box_ptr: ValueRef, t: ty::t) -> block { fn make_take_glue(bcx: block, v: ValueRef, t: ty::t) { let _icx = bcx.insn_ctxt("make_take_glue"); // NB: v is a *pointer* to type t here, not a direct value. - let bcx = match ty::get(t).struct { + let bcx = match ty::get(t).sty { ty::ty_box(_) | ty::ty_opaque_box | ty::ty_evec(_, ty::vstore_box) | ty::ty_estr(ty::vstore_box) => { incr_refcnt_of_boxed(bcx, Load(bcx, v)); bcx diff --git a/src/rustc/middle/trans/monomorphize.rs b/src/rustc/middle/trans/monomorphize.rs index a0df372173d..90b913b807a 100644 --- a/src/rustc/middle/trans/monomorphize.rs +++ b/src/rustc/middle/trans/monomorphize.rs @@ -198,7 +198,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn normalize_for_monomorphization(tcx: ty::ctxt, ty: ty::t) -> Option { // FIXME[mono] could do this recursively. is that worthwhile? (#2529) - match ty::get(ty).struct { + match ty::get(ty).sty { ty::ty_box(*) => { Some(ty::mk_opaque_box(tcx)) } diff --git a/src/rustc/middle/trans/reflect.rs b/src/rustc/middle/trans/reflect.rs index e29d6956261..9bf710fcbeb 100644 --- a/src/rustc/middle/trans/reflect.rs +++ b/src/rustc/middle/trans/reflect.rs @@ -114,7 +114,7 @@ impl reflector { debug!("reflect::visit_ty %s", ty_to_str(bcx.ccx().tcx, t)); - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_bot => self.leaf(~"bot"), ty::ty_nil => self.leaf(~"nil"), ty::ty_bool => self.leaf(~"bool"), diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs index f60005f072e..f1b6a042053 100644 --- a/src/rustc/middle/trans/shape.rs +++ b/src/rustc/middle/trans/shape.rs @@ -215,7 +215,7 @@ fn add_substr(&dest: ~[u8], src: ~[u8]) { } fn shape_of(ccx: @crate_ctxt, t: ty::t) -> ~[u8] { - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_nil | ty::ty_bool | ty::ty_uint(ast::ty_u8) | ty::ty_bot => ~[shape_u8], ty::ty_int(ast::ty_i) => ~[s_int(ccx.tcx)], @@ -719,7 +719,7 @@ fn llalign_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef { // Computes the size of the data part of an enum. fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint { if cx.enum_sizes.contains_key(t) { return cx.enum_sizes.get(t); } - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_enum(tid, ref substs) => { // Compute max(variant sizes). let mut max_size = 0u; @@ -753,7 +753,7 @@ fn simplify_type(tcx: ty::ctxt, typ: ty::t) -> ty::t { ty::mk_ptr(tcx, {ty: ty::mk_nil(tcx), mutbl: ast::m_imm}) } fn simplifier(tcx: ty::ctxt, typ: ty::t) -> ty::t { - match ty::get(typ).struct { + match ty::get(typ).sty { ty::ty_box(_) | ty::ty_opaque_box | ty::ty_uniq(_) | ty::ty_evec(_, ty::vstore_uniq) | ty::ty_evec(_, ty::vstore_box) | ty::ty_estr(ty::vstore_uniq) | ty::ty_estr(ty::vstore_box) | diff --git a/src/rustc/middle/trans/tvec.rs b/src/rustc/middle/trans/tvec.rs index 7be4f8e645a..c0e695cbee1 100644 --- a/src/rustc/middle/trans/tvec.rs +++ b/src/rustc/middle/trans/tvec.rs @@ -19,7 +19,7 @@ use util::common::indenter; fn expand_boxed_vec_ty(tcx: ty::ctxt, t: ty::t) -> ty::t { let unit_ty = ty::sequence_element_type(tcx, t); let unboxed_vec_ty = ty::mk_mut_unboxed_vec(tcx, unit_ty); - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_estr(ty::vstore_uniq) | ty::ty_evec(_, ty::vstore_uniq) => { ty::mk_imm_uniq(tcx, unboxed_vec_ty) } @@ -431,7 +431,7 @@ fn get_base_and_len(bcx: block, let ccx = bcx.ccx(); let vt = vec_types(bcx, vec_ty); - let vstore = match ty::get(vt.vec_ty).struct { + let vstore = match ty::get(vt.vec_ty).sty { ty::ty_estr(vst) | ty::ty_evec(_, vst) => vst, _ => ty::vstore_uniq }; diff --git a/src/rustc/middle/trans/type_of.rs b/src/rustc/middle/trans/type_of.rs index 1a743ce31d5..8c4f01701f0 100644 --- a/src/rustc/middle/trans/type_of.rs +++ b/src/rustc/middle/trans/type_of.rs @@ -55,7 +55,7 @@ fn type_of_non_gc_box(cx: @crate_ctxt, t: ty::t) -> TypeRef { if t != t_norm { type_of_non_gc_box(cx, t_norm) } else { - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_box(mt) => { T_ptr(T_box(cx, type_of(cx, mt.ty))) } @@ -88,7 +88,7 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef { return llty; } - let llty = match ty::get(t).struct { + let llty = match ty::get(t).sty { ty::ty_nil | ty::ty_bot => T_nil(), ty::ty_bool => T_bool(), ty::ty_int(t) => T_int_ty(cx, t), @@ -178,7 +178,7 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef { cx.lltypes.insert(t, llty); // If this was an enum or class, fill in the type now. - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_enum(did, _) => { fill_type_of_enum(cx, did, t, llty); } diff --git a/src/rustc/middle/trans/type_use.rs b/src/rustc/middle/trans/type_use.rs index 853bb71e84c..7e101e4796e 100644 --- a/src/rustc/middle/trans/type_use.rs +++ b/src/rustc/middle/trans/type_use.rs @@ -45,7 +45,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint) ccx.type_use_cache.insert(fn_id, vec::from_elem(n_tps, 3u)); let cx = {ccx: ccx, uses: vec::to_mut(vec::from_elem(n_tps, 0u))}; - match ty::get(ty::lookup_item_type(cx.ccx.tcx, fn_id).ty).struct { + match ty::get(ty::lookup_item_type(cx.ccx.tcx, fn_id).ty).sty { ty::ty_fn(ref fn_ty) => { for vec::each(fn_ty.sig.inputs) |arg| { if arg.mode == expl(by_val) { type_needs(cx, use_repr, arg.ty); } @@ -130,7 +130,7 @@ fn type_needs_inner(cx: ctx, use_: uint, ty: ty::t, enums_seen: @List) { do ty::maybe_walk_ty(ty) |ty| { if ty::type_has_params(ty) { - match ty::get(ty).struct { + match ty::get(ty).sty { /* This previously included ty_box -- that was wrong because if we cast an @T to an trait (for example) and return @@ -178,7 +178,7 @@ fn mark_for_expr(cx: ctx, e: @expr) { } expr_cast(base, _) => { let result_t = ty::node_id_to_type(cx.ccx.tcx, e.id); - match ty::get(result_t).struct { + match ty::get(result_t).sty { ty::ty_trait(*) => { // When we're casting to an trait, we need the // tydesc for the expr that's being cast. diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index 629be7022ee..2ad5412e758 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -247,18 +247,18 @@ impl creader_cache_key : to_bytes::IterBytes { } } -type intern_key = {struct: sty, o_def_id: Option}; +type intern_key = {sty: sty, o_def_id: Option}; impl intern_key: cmp::Eq { pure fn eq(&&other: intern_key) -> bool { - self.struct == other.struct && self.o_def_id == other.o_def_id + self.sty == other.sty && self.o_def_id == other.o_def_id } pure fn ne(&&other: intern_key) -> bool { !self.eq(other) } } impl intern_key : to_bytes::IterBytes { fn iter_bytes(lsb0: bool, f: to_bytes::Cb) { - to_bytes::iter_bytes_2(&self.struct, &self.o_def_id, lsb0, f); + to_bytes::iter_bytes_2(&self.sty, &self.o_def_id, lsb0, f); } } @@ -356,7 +356,7 @@ enum tbox_flag { needs_subst = 1 | 2 | 8 } -type t_box = @{struct: sty, +type t_box = @{sty: sty, id: uint, flags: uint, o_def_id: Option}; @@ -854,7 +854,7 @@ fn mk_t(cx: ctxt, +st: sty) -> t { mk_t_with_id(cx, st, None) } // Interns a type/name combination, stores the resulting box in cx.interner, // and returns the box as cast to an unsafe ptr (see comments for t above). fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option) -> t { - let key = {struct: st, o_def_id: o_def_id}; + let key = {sty: st, o_def_id: o_def_id}; match cx.interner.find(key) { Some(t) => unsafe { return unsafe::reinterpret_cast(&t); }, _ => () @@ -911,7 +911,7 @@ fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option) -> t { flags |= get(f.sig.output).flags; } } - let t = @{struct: st, id: cx.next_id, flags: flags, o_def_id: o_def_id}; + let t = @{sty: st, id: cx.next_id, flags: flags, o_def_id: o_def_id}; cx.interner.insert(key, t); cx.next_id += 1u; unsafe { unsafe::reinterpret_cast(&t) } @@ -1046,12 +1046,12 @@ fn mk_opaque_closure_ptr(cx: ctxt, ck: closure_kind) -> t { fn mk_opaque_box(cx: ctxt) -> t { mk_t(cx, ty_opaque_box) } fn mk_with_id(cx: ctxt, base: t, def_id: ast::def_id) -> t { - mk_t_with_id(cx, get(base).struct, Some(def_id)) + mk_t_with_id(cx, get(base).sty, Some(def_id)) } // Converts s to its machine type equivalent pure fn mach_sty(cfg: @session::config, t: t) -> sty { - match get(t).struct { + match get(t).sty { ty_int(ast::ty_i) => ty_int(cfg.int_type), ty_uint(ast::ty_u) => ty_uint(cfg.uint_type), ty_float(ast::ty_f) => ty_float(cfg.float_type), @@ -1079,7 +1079,7 @@ fn walk_ty(ty: t, f: fn(t)) { fn maybe_walk_ty(ty: t, f: fn(t) -> bool) { if !f(ty) { return; } - match get(ty).struct { + match get(ty).sty { ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) | ty_estr(_) | ty_type | ty_opaque_box | ty_self | ty_opaque_closure_ptr(_) | ty_infer(_) | ty_param(_) => { @@ -1176,7 +1176,7 @@ fn fold_sty(sty: &sty, fldop: fn(t) -> t) -> sty { // Folds types from the bottom up. fn fold_ty(cx: ctxt, t0: t, fldop: fn(t) -> t) -> t { - let sty = fold_sty(&get(t0).struct, |t| fold_ty(cx, fldop(t), fldop)); + let sty = fold_sty(&get(t0).sty, |t| fold_ty(cx, fldop(t), fldop)); fldop(mk_t(cx, sty)) } @@ -1213,7 +1213,7 @@ fn fold_regions_and_ty( } let tb = ty::get(ty); - match tb.struct { + match tb.sty { ty::ty_rptr(r, mt) => { let m_r = fldr(r); let m_t = fldt(mt.ty); @@ -1288,7 +1288,7 @@ fn fold_region(cx: ctxt, t0: t, fldop: fn(region, bool) -> region) -> t { fldop: fn(region, bool) -> region) -> t { let tb = get(t0); if !tbox_has_flag(tb, has_regions) { return t0; } - match tb.struct { + match tb.sty { ty_rptr(r, {ty: t1, mutbl: m}) => { let m_r = fldop(r, under_r); let m_t1 = do_fold(cx, t1, true, fldop); @@ -1323,7 +1323,7 @@ fn subst_tps(cx: ctxt, tps: &[t], typ: t) -> t { if tps.len() == 0u { return typ; } let tb = ty::get(typ); if !tbox_has_flag(tb, has_params) { return typ; } - match tb.struct { + match tb.sty { ty_param(p) => tps[p.idx], ref sty => fold_sty_to_ty(cx, sty, |t| subst_tps(cx, tps, t)) } @@ -1374,7 +1374,7 @@ fn subst(cx: ctxt, typ: t) -> t { let tb = get(typ); if !tbox_has_flag(tb, needs_subst) { return typ; } - match tb.struct { + match tb.sty { ty_param(p) => substs.tps[p.idx], ty_self => substs.self_ty.get(), _ => { @@ -1393,21 +1393,21 @@ fn subst(cx: ctxt, // Type utilities -fn type_is_nil(ty: t) -> bool { get(ty).struct == ty_nil } +fn type_is_nil(ty: t) -> bool { get(ty).sty == ty_nil } -fn type_is_bot(ty: t) -> bool { get(ty).struct == ty_bot } +fn type_is_bot(ty: t) -> bool { get(ty).sty == ty_bot } fn type_is_ty_var(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_infer(TyVar(_)) => true, _ => false } } -fn type_is_bool(ty: t) -> bool { get(ty).struct == ty_bool } +fn type_is_bool(ty: t) -> bool { get(ty).sty == ty_bool } fn type_is_structural(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_rec(_) | ty_class(*) | ty_tup(_) | ty_enum(*) | ty_fn(_) | ty_trait(*) | ty_evec(_, vstore_fixed(_)) | ty_estr(vstore_fixed(_)) | @@ -1422,21 +1422,21 @@ fn type_is_copyable(cx: ctxt, ty: t) -> bool { } fn type_is_sequence(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_estr(_) | ty_evec(_, _) => true, _ => false } } fn type_is_str(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_estr(_) => true, _ => false } } fn sequence_element_type(cx: ctxt, ty: t) -> t { - match get(ty).struct { + match get(ty).sty { ty_estr(_) => return mk_mach_uint(cx, ast::ty_u8), ty_evec(mt, _) | ty_unboxed_vec(mt) => return mt.ty, _ => cx.sess.bug( @@ -1445,7 +1445,7 @@ fn sequence_element_type(cx: ctxt, ty: t) -> t { } fn get_element_type(ty: t, i: uint) -> t { - match get(ty).struct { + match get(ty).sty { ty_rec(flds) => return flds[i].mt.ty, ty_tup(ts) => return ts[i], _ => fail ~"get_element_type called on invalid type" @@ -1453,14 +1453,14 @@ fn get_element_type(ty: t, i: uint) -> t { } pure fn type_is_box(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_box(_) => return true, _ => return false } } pure fn type_is_boxed(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_box(_) | ty_opaque_box | ty_evec(_, vstore_box) | ty_estr(vstore_box) => true, _ => false @@ -1468,35 +1468,35 @@ pure fn type_is_boxed(ty: t) -> bool { } pure fn type_is_region_ptr(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_rptr(_, _) => true, _ => false } } pure fn type_is_slice(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_evec(_, vstore_slice(_)) | ty_estr(vstore_slice(_)) => true, _ => return false } } pure fn type_is_unique_box(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_uniq(_) => return true, _ => return false } } pure fn type_is_unsafe_ptr(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_ptr(_) => return true, _ => return false } } pure fn type_is_vec(ty: t) -> bool { - return match get(ty).struct { + return match get(ty).sty { ty_evec(_, _) | ty_unboxed_vec(_) => true, ty_estr(_) => true, _ => false @@ -1504,7 +1504,7 @@ pure fn type_is_vec(ty: t) -> bool { } pure fn type_is_unique(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_uniq(_) => return true, ty_evec(_, vstore_uniq) => true, ty_estr(vstore_uniq) => true, @@ -1518,7 +1518,7 @@ pure fn type_is_unique(ty: t) -> bool { contents are abstract to rustc.) */ pure fn type_is_scalar(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_nil | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) | ty_infer(IntVar(_)) | ty_type | ty_ptr(_) => true, _ => false @@ -1537,7 +1537,7 @@ fn type_needs_drop(cx: ctxt, ty: t) -> bool { } let mut accum = false; - let result = match get(ty).struct { + let result = match get(ty).sty { // scalar types ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) | ty_type | ty_ptr(_) | ty_rptr(_, _) | @@ -1620,7 +1620,7 @@ fn type_needs_unwind_cleanup_(cx: ctxt, ty: t, let mut needs_unwind_cleanup = false; do maybe_walk_ty(ty) |ty| { let old_encountered_box = encountered_box; - let result = match get(ty).struct { + let result = match get(ty).sty { ty_box(_) | ty_opaque_box => { encountered_box = true; true @@ -1873,7 +1873,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind { // Insert a default in case we loop back on self recursively. cx.kind_cache.insert(ty, kind_top()); - let mut result = match get(ty).struct { + let mut result = match get(ty).sty { // Scalar and unique types are sendable, constant, and owned ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) | ty_ptr(_) => { @@ -2025,7 +2025,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind { /// gives a rough estimate of how much space it takes to represent /// an instance of `ty`. Used for the mode transition. fn type_size(cx: ctxt, ty: t) -> uint { - match get(ty).struct { + match get(ty).sty { ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) | ty_ptr(_) | ty_box(_) | ty_uniq(_) | ty_estr(vstore_uniq) | ty_trait(*) | ty_rptr(*) | ty_evec(_, vstore_uniq) | @@ -2093,7 +2093,7 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool { ty_to_str(cx, ty)); let r = { - get(r_ty).struct == get(ty).struct || + get(r_ty).sty == get(ty).sty || subtypes_require(cx, seen, r_ty, ty) }; @@ -2110,7 +2110,7 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool { ty_to_str(cx, r_ty), ty_to_str(cx, ty)); - let r = match get(ty).struct { + let r = match get(ty).sty { ty_nil | ty_bot | ty_bool | @@ -2197,7 +2197,7 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool { fn type_structurally_contains(cx: ctxt, ty: t, test: fn(x: &sty) -> bool) -> bool { - let sty = &get(ty).struct; + let sty = &get(ty).sty; debug!("type_structurally_contains: %s", ty_to_str(cx, ty)); if test(sty) { return true; } match *sty { @@ -2251,14 +2251,14 @@ fn type_structurally_contains_uniques(cx: ctxt, ty: t) -> bool { } fn type_is_integral(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_infer(IntVar(_)) | ty_int(_) | ty_uint(_) | ty_bool => true, _ => false } } fn type_is_fp(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_float(_) => true, _ => false } @@ -2269,7 +2269,7 @@ fn type_is_numeric(ty: t) -> bool { } fn type_is_signed(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_int(_) => true, _ => false } @@ -2279,7 +2279,7 @@ fn type_is_signed(ty: t) -> bool { // that the cycle collector might care about. fn type_is_pod(cx: ctxt, ty: t) -> bool { let mut result = true; - match get(ty).struct { + match get(ty).sty { // Scalar types ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) | ty_type | ty_ptr(_) => result = true, @@ -2334,7 +2334,7 @@ fn type_is_pod(cx: ctxt, ty: t) -> bool { } fn type_is_enum(ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_enum(_, _) => return true, _ => return false } @@ -2343,7 +2343,7 @@ fn type_is_enum(ty: t) -> bool { // Whether a type is enum like, that is a enum type with only nullary // constructors fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool { - match get(ty).struct { + match get(ty).sty { ty_enum(did, _) => { let variants = enum_variants(cx, did); let some_n_ary = vec::any(*variants, |v| vec::len(v.args) > 0u); @@ -2354,7 +2354,7 @@ fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool { } fn type_param(ty: t) -> Option { - match get(ty).struct { + match get(ty).sty { ty_param(p) => return Some(p.idx), _ => {/* fall through */ } } @@ -2366,7 +2366,7 @@ fn type_param(ty: t) -> Option { // The parameter `expl` indicates if this is an *explicit* dereference. Some // types---notably unsafe ptrs---can only be dereferenced explicitly. fn deref(cx: ctxt, t: t, expl: bool) -> Option { - deref_sty(cx, &get(t).struct, expl) + deref_sty(cx, &get(t).sty, expl) } fn deref_sty(cx: ctxt, sty: &sty, expl: bool) -> Option { match *sty { @@ -2404,7 +2404,7 @@ fn type_autoderef(cx: ctxt, t: t) -> t { // Returns the type and mutability of t[i] fn index(cx: ctxt, t: t) -> Option { - index_sty(cx, &get(t).struct) + index_sty(cx, &get(t).sty) } fn index_sty(cx: ctxt, sty: &sty) -> Option { @@ -2714,49 +2714,49 @@ fn node_id_has_type_params(cx: ctxt, id: ast::node_id) -> bool { // Type accessors for substructures of types fn ty_fn_args(fty: t) -> ~[arg] { - match get(fty).struct { + match get(fty).sty { ty_fn(ref f) => f.sig.inputs, _ => fail ~"ty_fn_args() called on non-fn type" } } fn ty_fn_proto(fty: t) -> fn_proto { - match get(fty).struct { + match get(fty).sty { ty_fn(ref f) => f.meta.proto, _ => fail ~"ty_fn_proto() called on non-fn type" } } fn ty_fn_purity(fty: t) -> ast::purity { - match get(fty).struct { + match get(fty).sty { ty_fn(ref f) => f.meta.purity, _ => fail ~"ty_fn_purity() called on non-fn type" } } pure fn ty_fn_ret(fty: t) -> t { - match get(fty).struct { + match get(fty).sty { ty_fn(ref f) => f.sig.output, _ => fail ~"ty_fn_ret() called on non-fn type" } } fn ty_fn_ret_style(fty: t) -> ast::ret_style { - match get(fty).struct { + match get(fty).sty { ty_fn(ref f) => f.meta.ret_style, _ => fail ~"ty_fn_ret_style() called on non-fn type" } } fn is_fn_ty(fty: t) -> bool { - match get(fty).struct { + match get(fty).sty { ty_fn(_) => true, _ => false } } fn ty_region(ty: t) -> region { - match get(ty).struct { + match get(ty).sty { ty_rptr(r, _) => r, s => fail fmt!("ty_region() invoked on non-rptr: %?", s) } @@ -2775,14 +2775,14 @@ fn is_pred_ty(fty: t) -> bool { /* fn ty_var_id(typ: t) -> TyVid { - match get(typ).struct { + match get(typ).sty { ty_infer(TyVar(vid)) => return vid, _ => { error!("ty_var_id called on non-var ty"); fail; } } } fn int_var_id(typ: t) -> IntVid { - match get(typ).struct { + match get(typ).sty { ty_infer(IntVar(vid)) => return vid, _ => { error!("ty_var_integral_id called on ty other than \ ty_var_integral"); @@ -3036,7 +3036,7 @@ fn get_field(tcx: ctxt, rec_ty: t, id: ast::ident) -> field { } fn get_fields(rec_ty:t) -> ~[field] { - match get(rec_ty).struct { + match get(rec_ty).sty { ty_rec(fields) => fields, // Can we check at the caller? _ => fail ~"get_fields: not a record type" @@ -3055,7 +3055,7 @@ fn method_idx(id: ast::ident, meths: &[method]) -> Option { fn param_tys_in_type(ty: t) -> ~[param_ty] { let mut rslt = ~[]; do walk_ty(ty) |ty| { - match get(ty).struct { + match get(ty).sty { ty_param(p) => { vec::push(rslt, p); } @@ -3072,7 +3072,7 @@ fn occurs_check(tcx: ctxt, sp: span, vid: TyVid, rt: t) { fn vars_in_type(ty: t) -> ~[TyVid] { let mut rslt = ~[]; do walk_ty(ty) |ty| { - match get(ty).struct { + match get(ty).sty { ty_infer(TyVar(v)) => vec::push(rslt, v), _ => () } @@ -3170,7 +3170,7 @@ fn set_default_mode(cx: ctxt, m: ast::mode, m_def: ast::rmode) { } fn ty_sort_str(cx: ctxt, t: t) -> ~str { - match get(t).struct { + match get(t).sty { ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) | ty_estr(_) | ty_type | ty_opaque_box | ty_opaque_closure_ptr(_) => { @@ -3405,7 +3405,7 @@ fn impl_traits(cx: ctxt, id: ast::def_id) -> ~[t] { } fn ty_to_def_id(ty: t) -> Option { - match get(ty).struct { + match get(ty).sty { ty_trait(id, _, _) | ty_class(id, _) | ty_enum(id, _) => Some(id), _ => None } @@ -3512,7 +3512,7 @@ fn enum_is_univariant(cx: ctxt, id: ast::def_id) -> bool { } fn type_is_empty(cx: ctxt, t: t) -> bool { - match ty::get(t).struct { + match ty::get(t).sty { ty_enum(did, _) => (*enum_variants(cx, did)).is_empty(), _ => false } @@ -3816,7 +3816,7 @@ fn is_binopable(_cx: ctxt, ty: t, op: ast::binop) -> bool { } fn tycat(ty: t) -> int { - match get(ty).struct { + match get(ty).sty { ty_bool => tycat_bool, ty_int(_) | ty_uint(_) | ty_infer(IntVar(_)) => tycat_int, ty_float(_) => tycat_float, @@ -3866,7 +3866,7 @@ fn normalize_ty(cx: ctxt, t: t) -> t { None => () } - let t = match get(t).struct { + let t = match get(t).sty { ty_evec(mt, vstore) => // This type has a vstore. Get rid of it mk_evec(cx, normalize_mt(cx, mt), normalize_vstore(vstore)), @@ -3917,7 +3917,7 @@ fn normalize_ty(cx: ctxt, t: t) -> t { // types, which isn't necessary after #2187 let t = mk_t(cx, mach_sty(cx.sess.targ_cfg, t)); - let sty = fold_sty(&get(t).struct, |t| { normalize_ty(cx, t) }); + let sty = fold_sty(&get(t).sty, |t| { normalize_ty(cx, t) }); let t_norm = mk_t(cx, sty); cx.normalized_cache.insert(t, t_norm); return t_norm; diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs index fe479bdb2a6..439c0052259 100644 --- a/src/rustc/middle/typeck.rs +++ b/src/rustc/middle/typeck.rs @@ -261,10 +261,10 @@ fn require_same_types( } fn arg_is_argv_ty(_tcx: ty::ctxt, a: ty::arg) -> bool { - match ty::get(a.ty).struct { + match ty::get(a.ty).sty { ty::ty_evec(mt, vstore_uniq) => { if mt.mutbl != ast::m_imm { return false; } - match ty::get(mt.ty).struct { + match ty::get(mt.ty).sty { ty::ty_estr(vstore_uniq) => return true, _ => return false } @@ -279,7 +279,7 @@ fn check_main_fn_ty(ccx: @crate_ctxt, let tcx = ccx.tcx; let main_t = ty::node_id_to_type(tcx, main_id); - match ty::get(main_t).struct { + match ty::get(main_t).sty { ty::ty_fn(fn_ty) => { match tcx.items.find(main_id) { Some(ast_map::node_item(it,_)) => { diff --git a/src/rustc/middle/typeck/astconv.rs b/src/rustc/middle/typeck/astconv.rs index 2ac872117e3..79033156d35 100644 --- a/src/rustc/middle/typeck/astconv.rs +++ b/src/rustc/middle/typeck/astconv.rs @@ -185,7 +185,7 @@ fn ast_ty_to_ty( Some(ast::def_ty(type_def_id)) => { let result = ast_path_to_substs_and_ty(self, rscope, type_def_id, path); - match ty::get(result.ty).struct { + match ty::get(result.ty).sty { ty::ty_trait(trait_def_id, substs, _) => { if vst != ty::vstore_box { tcx.sess.span_unimpl(path.span, @@ -419,7 +419,7 @@ fn ty_of_arg( found: a.mode})) } ast::infer(_) => { - match ty::get(ty).struct { + match ty::get(ty).sty { // If the type is not specified, then this must be a fn expr. // Leave the mode as infer(_), it will get inferred based // on constraints elsewhere. diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs index b179a336a4f..de803402a13 100644 --- a/src/rustc/middle/typeck/check.rs +++ b/src/rustc/middle/typeck/check.rs @@ -201,7 +201,7 @@ fn check_bare_fn(ccx: @crate_ctxt, id: ast::node_id, self_info: Option) { let fty = ty::node_id_to_type(ccx.tcx, id); - match ty::get(fty).struct { + match ty::get(fty).sty { ty::ty_fn(ref fn_ty) => { check_fn(ccx, self_info, fn_ty, decl, body, false, None) } @@ -763,7 +763,7 @@ fn do_autoderef(fcx: @fn_ctxt, sp: span, t: ty::t) -> ty::t { match sty { ty::ty_box(inner) | ty::ty_uniq(inner) | ty::ty_rptr(_, inner) => { - match ty::get(t1).struct { + match ty::get(t1).sty { ty::ty_infer(ty::TyVar(v1)) => { ty::occurs_check(fcx.ccx.tcx, sp, v1, ty::mk_box(fcx.ccx.tcx, inner)); @@ -1127,7 +1127,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, } let lhs_t = structurally_resolved_type(fcx, lhs.span, lhs_t); - return match (op, ty::get(lhs_t).struct) { + return match (op, ty::get(lhs_t).sty) { (_, _) if ty::type_is_integral(lhs_t) && ast_util::is_shift_binop(op) => { // Shift is a special case: rhs can be any integral type @@ -1191,7 +1191,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, // If the or operator is used it might be that the user forgot to // supply the do keyword. Let's be more helpful in that situation. if op == ast::or { - match ty::get(lhs_resolved_t).struct { + match ty::get(lhs_resolved_t).sty { ty::ty_fn(_) => { tcx.sess.span_note( ex.span, ~"did you forget the 'do' keyword for the call?"); @@ -1227,7 +1227,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, match expected { Some(t) => { match resolve_type(fcx.infcx(), t, force_tvar) { - Ok(t) => unpack(ty::get(t).struct), + Ok(t) => unpack(ty::get(t).sty), _ => None } } @@ -1500,7 +1500,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, ast::not => { oprnd_t = structurally_resolved_type(fcx, oprnd.span, oprnd_t); if !(ty::type_is_integral(oprnd_t) || - ty::get(oprnd_t).struct == ty::ty_bool) { + ty::get(oprnd_t).sty == ty::ty_bool) { oprnd_t = check_user_unop(fcx, ~"!", ~"not", expr, oprnd, oprnd_t); } @@ -1678,7 +1678,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, } let block_ty = structurally_resolved_type( fcx, expr.span, fcx.node_ty(b.id)); - match ty::get(block_ty).struct { + match ty::get(block_ty).sty { ty::ty_fn(fty) => { fcx.write_ty(expr.id, ty::mk_fn(tcx, FnTyBase { meta: fty.meta, @@ -1714,7 +1714,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, } let block_ty = structurally_resolved_type( fcx, expr.span, fcx.node_ty(b.id)); - match ty::get(block_ty).struct { + match ty::get(block_ty).sty { ty::ty_fn(fty) => { fcx.write_ty(expr.id, ty::mk_fn(tcx, fty)); } @@ -1742,7 +1742,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, debug!("t_1=%s", fcx.infcx().ty_to_str(t_1)); debug!("t_e=%s", fcx.infcx().ty_to_str(t_e)); - match ty::get(t_1).struct { + match ty::get(t_1).sty { // This will be looked up later on ty::ty_trait(*) => (), @@ -2461,7 +2461,7 @@ fn structurally_resolved_type(fcx: @fn_ctxt, sp: span, tp: ty::t) -> ty::t { // Returns the one-level-deep structure of the given type. fn structure_of(fcx: @fn_ctxt, sp: span, typ: ty::t) -> ty::sty { - ty::get(structurally_resolved_type(fcx, sp, typ)).struct + ty::get(structurally_resolved_type(fcx, sp, typ)).sty } fn type_is_integral(fcx: @fn_ctxt, sp: span, typ: ty::t) -> bool { @@ -2511,7 +2511,7 @@ fn check_bounds_are_used(ccx: @crate_ctxt, ccx.tcx, ty, |_r| {}, |t| { - match ty::get(t).struct { + match ty::get(t).sty { ty::ty_param({idx, _}) => { tps_used[idx] = true; } _ => () } diff --git a/src/rustc/middle/typeck/check/method.rs b/src/rustc/middle/typeck/check/method.rs index 6a61f7ae15e..05c182a81bf 100644 --- a/src/rustc/middle/typeck/check/method.rs +++ b/src/rustc/middle/typeck/check/method.rs @@ -114,7 +114,7 @@ impl lookup { debug!("method lookup(m_name=%s, self_ty=%s, %?)", self.fcx.tcx().sess.str_of(self.m_name), self.fcx.infcx().ty_to_str(self.self_ty), - ty::get(self.self_ty).struct); + ty::get(self.self_ty).sty); // Determine if there are any inherent methods we can call. // (An inherent method is one that belongs to no trait, but is @@ -155,7 +155,7 @@ impl lookup { // autoderef. // Try each of the possible matching semantics in turn. for matching_modes.each |mode| { - match ty::get(self.self_ty).struct { + match ty::get(self.self_ty).sty { ty::ty_box(mt) | ty::ty_uniq(mt) | ty::ty_rptr(_, mt) => { self.add_candidates_from_type(mt.ty, mode); } @@ -260,7 +260,7 @@ impl lookup { } fn add_candidates_from_type(inner_ty: ty::t, mode: method_lookup_mode) { - match ty::get(inner_ty).struct { + match ty::get(inner_ty).sty { // First, see whether this is a bounded parameter. ty::ty_param(p) => { self.add_candidates_from_param(inner_ty, mode, p.idx, p.def_id); @@ -304,7 +304,7 @@ impl lookup { loop; /* ok */ } ty::bound_trait(bound_t) => { - match ty::get(bound_t).struct { + match ty::get(bound_t).sty { ty::ty_trait(i, substs, _) => (i, substs), _ => fail ~"add_candidates_from_param: non-trait bound" } @@ -413,7 +413,7 @@ impl lookup { } fn ty_from_did(did: ast::def_id) -> ty::t { - match ty::get(ty::lookup_item_type(self.tcx(), did).ty).struct { + match ty::get(ty::lookup_item_type(self.tcx(), did).ty).sty { ty::ty_fn(ref fty) => { ty::mk_fn(self.tcx(), FnTyBase { meta: FnMeta {proto: ty::proto_vstore(ty::vstore_box), @@ -434,7 +434,7 @@ impl lookup { } } else { match check ty::get(csearch::get_type(self.tcx(), did).ty) - .struct { + .sty { ty::ty_fn(fty) { ty::mk_fn(self.tcx(), {proto: ast::proto_box with fty}) diff --git a/src/rustc/middle/typeck/check/regionck.rs b/src/rustc/middle/typeck/check/regionck.rs index 9a4689506c0..17c29b704f5 100644 --- a/src/rustc/middle/typeck/check/regionck.rs +++ b/src/rustc/middle/typeck/check/regionck.rs @@ -189,7 +189,7 @@ fn visit_expr(e: @ast::expr, &&rcx: @rcx, v: rvt) { match rcx.resolve_node_type(e.id) { result::Err(_) => { return; /* typeck will fail anyhow */ } result::Ok(target_ty) => { - match ty::get(target_ty).struct { + match ty::get(target_ty).sty { ty::ty_trait(_, substs, _) => { let trait_region = match substs.self_r { Some(r) => {r} @@ -215,7 +215,7 @@ fn visit_expr(e: @ast::expr, &&rcx: @rcx, v: rvt) { match rcx.resolve_node_type(e.id) { result::Err(_) => return, // Typechecking will fail anyhow. result::Ok(function_type) => { - match ty::get(function_type).struct { + match ty::get(function_type).sty { ty::ty_fn(ref fn_ty) => { match fn_ty.meta.proto { proto_vstore(vstore_slice(region)) => { diff --git a/src/rustc/middle/typeck/check/regionmanip.rs b/src/rustc/middle/typeck/check/regionmanip.rs index d7cbaa05588..288baec27b5 100644 --- a/src/rustc/middle/typeck/check/regionmanip.rs +++ b/src/rustc/middle/typeck/check/regionmanip.rs @@ -66,7 +66,7 @@ fn replace_bound_regions_in_fn_ty( return {isr: isr, self_info: new_self_info, - fn_ty: match ty::get(t_fn).struct { ty::ty_fn(o) => o, + fn_ty: match ty::get(t_fn).sty { ty::ty_fn(o) => o, _ => tcx.sess.bug(~"replace_bound_regions_in_fn_ty: impossible")}}; diff --git a/src/rustc/middle/typeck/check/vtable.rs b/src/rustc/middle/typeck/check/vtable.rs index d5d162e6b16..276b7eef578 100644 --- a/src/rustc/middle/typeck/check/vtable.rs +++ b/src/rustc/middle/typeck/check/vtable.rs @@ -69,7 +69,7 @@ fn fixup_substs(fcx: @fn_ctxt, expr: @ast::expr, // use a dummy type just to package up the substs that need fixing up let t = ty::mk_trait(tcx, id, substs, ty::vstore_slice(ty::re_static)); do fixup_ty(fcx, expr, t, is_early).map |t_f| { - match ty::get(t_f).struct { + match ty::get(t_f).sty { ty::ty_trait(_, substs_f, _) => substs_f, _ => fail ~"t_f should be a trait" } @@ -99,7 +99,7 @@ fn lookup_vtable(fcx: @fn_ctxt, let _i = indenter(); let tcx = fcx.ccx.tcx; - let (trait_id, trait_substs) = match ty::get(trait_ty).struct { + let (trait_id, trait_substs) = match ty::get(trait_ty).sty { ty::ty_trait(did, substs, _) => (did, substs), _ => tcx.sess.impossible_case(expr.span, "lookup_vtable: \ @@ -117,7 +117,7 @@ fn lookup_vtable(fcx: @fn_ctxt, } }; - match ty::get(ty).struct { + match ty::get(ty).sty { ty::ty_param({idx: n, def_id: did}) => { let mut n_bound = 0; for vec::each(*tcx.ty_param_bounds.get(did.node)) |bound| { @@ -127,7 +127,7 @@ fn lookup_vtable(fcx: @fn_ctxt, /* ignore */ } ty::bound_trait(ity) => { - match ty::get(ity).struct { + match ty::get(ity).sty { ty::ty_trait(idid, _, _) => { if trait_id == idid { debug!("(checking vtable) @0 relating \ @@ -214,7 +214,7 @@ fn lookup_vtable(fcx: @fn_ctxt, // unify it with trait_ty in order to get all // the ty vars sorted out. for vec::each(ty::impl_traits(tcx, im.did)) |of_ty| { - match ty::get(of_ty).struct { + match ty::get(of_ty).sty { ty::ty_trait(id, _, _) => { // Not the trait we're looking for if id != trait_id { loop; } @@ -389,8 +389,8 @@ fn connect_trait_tps(fcx: @fn_ctxt, expr: @ast::expr, impl_tys: ~[ty::t], let ity = ty::impl_traits(tcx, impl_did)[0]; let trait_ty = ty::subst_tps(tcx, impl_tys, ity); debug!("(connect trait tps) trait type is %?, impl did is %?", - ty::get(trait_ty).struct, impl_did); - match ty::get(trait_ty).struct { + ty::get(trait_ty).sty, impl_did); + match ty::get(trait_ty).sty { ty::ty_trait(_, substs, _) => { vec::iter2(substs.tps, trait_tys, |a, b| demand::suptype(fcx, expr.span, a, b)); @@ -450,7 +450,7 @@ fn early_resolve_expr(ex: @ast::expr, &&fcx: @fn_ctxt, is_early: bool) { } ast::expr_cast(src, _) => { let target_ty = fcx.expr_ty(ex); - match ty::get(target_ty).struct { + match ty::get(target_ty).sty { ty::ty_trait(*) => { /* Look up vtables for the type we're casting to, diff --git a/src/rustc/middle/typeck/coherence.rs b/src/rustc/middle/typeck/coherence.rs index 79ca4572e50..1e3e8a3fc14 100644 --- a/src/rustc/middle/typeck/coherence.rs +++ b/src/rustc/middle/typeck/coherence.rs @@ -55,7 +55,7 @@ fn get_base_type(inference_context: infer_ctxt, span: span, original_type: t) } } - match get(resolved_type).struct { + match get(resolved_type).sty { ty_box(base_mutability_and_type) | ty_uniq(base_mutability_and_type) | ty_ptr(base_mutability_and_type) | @@ -76,7 +76,7 @@ fn get_base_type(inference_context: infer_ctxt, span: span, original_type: t) ty_param(*) | ty_self | ty_type | ty_opaque_box | ty_opaque_closure_ptr(*) | ty_unboxed_vec(*) => { debug!("(getting base type) no base type; found %?", - get(original_type).struct); + get(original_type).sty); None } } @@ -93,7 +93,7 @@ fn get_base_type_def_id(inference_context: infer_ctxt, return None; } Some(base_type) => { - match get(base_type).struct { + match get(base_type).sty { ty_enum(def_id, _) | ty_class(def_id, _) | ty_trait(def_id, _, _) => { @@ -694,7 +694,7 @@ impl CoherenceChecker { // Record all the trait methods. for associated_traits.each |trait_type| { - match get(trait_type).struct { + match get(trait_type).sty { ty_trait(trait_id, _, _) => { self.add_trait_method(trait_id, implementation); } diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs index 0a06e554724..cf8ed6315ca 100644 --- a/src/rustc/middle/typeck/collect.rs +++ b/src/rustc/middle/typeck/collect.rs @@ -603,7 +603,7 @@ fn instantiate_trait_ref(ccx: @crate_ctxt, t: @ast::trait_ref, ast::def_ty(t_id) => { let tpt = astconv::ast_path_to_ty(ccx, rscope, t_id, t.path, t.ref_id); - match ty::get(tpt.ty).struct { + match ty::get(tpt.ty).sty { ty::ty_trait(*) => { (t_id, tpt) } @@ -732,7 +732,7 @@ fn compute_bounds(ccx: @crate_ctxt, ast::bound_owned => ~[ty::bound_owned], ast::bound_trait(t) => { let ity = ast_ty_to_ty(ccx, empty_rscope, t); - match ty::get(ity).struct { + match ty::get(ity).sty { ty::ty_trait(*) => { ~[ty::bound_trait(ity)] } diff --git a/src/rustc/middle/typeck/infer/assignment.rs b/src/rustc/middle/typeck/infer/assignment.rs index 42dc90156f9..fdb23c90b10 100644 --- a/src/rustc/middle/typeck/infer/assignment.rs +++ b/src/rustc/middle/typeck/infer/assignment.rs @@ -70,7 +70,7 @@ impl Assign { b.to_str(self.infcx)); let _r = indenter(); - match (ty::get(a).struct, ty::get(b).struct) { + match (ty::get(a).sty, ty::get(b).sty) { (ty::ty_bot, _) => { Ok(None) } @@ -130,7 +130,7 @@ priv impl Assign { (Some(a_bnd), Some(b_bnd)) => { // check for a case where a non-region pointer (@, ~) is // being assigned to a region pointer: - match (ty::get(a_bnd).struct, ty::get(b_bnd).struct) { + match (ty::get(a_bnd).sty, ty::get(b_bnd).sty) { (ty::ty_box(_), ty::ty_rptr(r_b, mt_b)) => { let nr_b = ty::mk_box(self.infcx.tcx, {ty: mt_b.ty, mutbl: m_const}); diff --git a/src/rustc/middle/typeck/infer/combine.rs b/src/rustc/middle/typeck/infer/combine.rs index 5a9393afabc..84791b59b32 100644 --- a/src/rustc/middle/typeck/infer/combine.rs +++ b/src/rustc/middle/typeck/infer/combine.rs @@ -354,7 +354,7 @@ fn super_tys( self: &C, a: ty::t, b: ty::t) -> cres { let tcx = self.infcx().tcx; - match (ty::get(a).struct, ty::get(b).struct) { + match (ty::get(a).sty, ty::get(b).sty) { // The "subtype" ought to be handling cases involving bot or var: (ty::ty_bot, _) | (_, ty::ty_bot) | @@ -383,8 +383,8 @@ fn super_tys( (ty::ty_int(_), _) | (ty::ty_uint(_), _) | (ty::ty_float(_), _) => { - let as_ = ty::get(a).struct; - let bs = ty::get(b).struct; + let as_ = ty::get(a).sty; + let bs = ty::get(b).sty; if as_ == bs { Ok(a) } else { diff --git a/src/rustc/middle/typeck/infer/integral.rs b/src/rustc/middle/typeck/infer/integral.rs index fdab9f6a169..168709596dc 100644 --- a/src/rustc/middle/typeck/infer/integral.rs +++ b/src/rustc/middle/typeck/infer/integral.rs @@ -55,7 +55,7 @@ fn single_type_contained_in(tcx: ty::ctxt, a: int_ty_set) -> fn convert_integral_ty_to_int_ty_set(tcx: ty::ctxt, t: ty::t) -> int_ty_set { - match get(t).struct { + match get(t).sty { ty_int(int_ty) => match int_ty { ast::ty_i8 => int_ty_set(INT_TY_SET_i8), ast::ty_i16 => int_ty_set(INT_TY_SET_i16), diff --git a/src/rustc/middle/typeck/infer/lattice.rs b/src/rustc/middle/typeck/infer/lattice.rs index 49b2e57e2aa..04133cab9d7 100644 --- a/src/rustc/middle/typeck/infer/lattice.rs +++ b/src/rustc/middle/typeck/infer/lattice.rs @@ -42,7 +42,7 @@ fn lattice_tys( b.to_str(self.infcx())); if a == b { return Ok(a); } do indent { - match (ty::get(a).struct, ty::get(b).struct) { + match (ty::get(a).sty, ty::get(b).sty) { (ty::ty_bot, _) => self.ty_bot(b), (_, ty::ty_bot) => self.ty_bot(a), diff --git a/src/rustc/middle/typeck/infer/resolve.rs b/src/rustc/middle/typeck/infer/resolve.rs index e77b5a52aaf..5d748efc332 100644 --- a/src/rustc/middle/typeck/infer/resolve.rs +++ b/src/rustc/middle/typeck/infer/resolve.rs @@ -112,7 +112,7 @@ impl resolve_state { indent(fn&() -> ty::t { if !ty::type_needs_infer(typ) { return typ; } - match ty::get(typ).struct { + match ty::get(typ).sty { ty::ty_infer(TyVar(vid)) => { self.resolve_ty_var(vid) } diff --git a/src/rustc/middle/typeck/infer/sub.rs b/src/rustc/middle/typeck/infer/sub.rs index 1e16ad8b8d5..359b8eea741 100644 --- a/src/rustc/middle/typeck/infer/sub.rs +++ b/src/rustc/middle/typeck/infer/sub.rs @@ -101,7 +101,7 @@ impl Sub: combine { a.to_str(self.infcx), b.to_str(self.infcx)); if a == b { return Ok(a); } do indent { - match (ty::get(a).struct, ty::get(b).struct) { + match (ty::get(a).sty, ty::get(b).sty) { (ty::ty_bot, _) => { Ok(a) } diff --git a/src/rustc/util/ppaux.rs b/src/rustc/util/ppaux.rs index f58ed10a408..a9363f0f1da 100644 --- a/src/rustc/util/ppaux.rs +++ b/src/rustc/util/ppaux.rs @@ -284,7 +284,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> ~str { for inputs.each |a| { vec::push(strs, fn_input_to_str(cx, a)); } s += str::connect(strs, ~", "); s += ~")"; - if ty::get(output).struct != ty_nil { + if ty::get(output).sty != ty_nil { s += ~" -> "; match cf { ast::noreturn => { s += ~"!"; } @@ -310,7 +310,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> ~str { } // pretty print the structural type representation: - return match ty::get(typ).struct { + return match ty::get(typ).sty { ty_nil => ~"()", ty_bot => ~"_|_", ty_bool => ~"bool", diff --git a/src/test/run-pass/alias-uninit-value.rs b/src/test/run-pass/alias-uninit-value.rs index b68789f76ba..486321e155c 100644 --- a/src/test/run-pass/alias-uninit-value.rs +++ b/src/test/run-pass/alias-uninit-value.rs @@ -6,10 +6,10 @@ use option::None; enum sty { ty_nil, } -type raw_t = {struct: sty, cname: Option<~str>, hash: uint}; +type raw_t = {struct_: sty, cname: Option<~str>, hash: uint}; fn mk_raw_ty(st: sty, cname: Option<~str>) -> raw_t { - return {struct: st, cname: cname, hash: 0u}; + return {struct_: st, cname: cname, hash: 0u}; } fn main() { mk_raw_ty(ty_nil, None::<~str>); }