diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index cfef2f96581cbb05e0cc118289674b6bdbe3ab32..cd422b03a4b324a5e57c923a6cb8673c50b8d735 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 3f21caafb666c79a21fa5a1e9308e7ed4f564515..ed6835b6f8bf91d9244c7c06646fc596fd2ad8a6 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 3d2563670239bfee9c3cfd24bcb05b4abc06eb0f..175691613a7b94aa1d1e71823d64a7be61a0f267 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 974c9b632ca855668a03aca8a63c073abec05629..e2cbb68e95a8e0724fb9820fa6525afc2827c4ac 100644 --- a/src/rustc/middle/borrowck/check_loans.rs +++ b/src/rustc/middle/borrowck/check_loans.rs @@ -224,7 +224,7 @@ fn check_pure_callee_or_arg(pc: purity_cause, } 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 1033f2c81c5dfc94cf1dd27265cb41dcc91c3d23..79dbcecbec495384a81c8cbefeb2a3afdccbf1b7 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 d51d07259a3d201cfc22224e62e5a0f19023154c..41bfe9ae026388c97bcdfc1ee41a2a9afa9119c8 100644 --- a/src/rustc/middle/const_eval.rs +++ b/src/rustc/middle/const_eval.rs @@ -317,7 +317,7 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) } 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 4c363a5faf8a6826be36aa46f33544917373444a..4e1d67ea365861dc921129d310c27a194719668f 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 b41fb004653d02412355f76d76ae36ba9f70c65b..255d7a4dd8a819c72fd1642ab56236e0f5a866a8 100644 --- a/src/rustc/middle/lint.rs +++ b/src/rustc/middle/lint.rs @@ -498,7 +498,7 @@ fn check_type_for_lint(cx: ty::ctxt, lint: lint, 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 75868e6300f9d985c3f57580d0d4a8cf1f316484..c97431eed2349905f94e5d53831a49e122b2426d 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 @@ fn cat_borrow_of_expr(expr: @ast::expr) -> cmt { // 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 @@ fn cmt_to_str(cmt: cmt) -> ~str { 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 6f78c884ef06bb0675047f1b2dbe6762c0bf9e6f..6b0df4630da2eccf9ff7bb609621022cf1ad074e 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 557063ca91cfec49dbda88966c4833510a63e9b7..421d7923234fd962b07c76999a961b9ed3746c70 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 2f2d0392a7fa779d01ea06e7299f2be78526a7bc..226b76831e69a66d74336e733d6a0420a0c3a3ec 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_variant(cx: block, a_tup: ValueRef, 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_variant(cx: block, a_tup: ValueRef, 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 1c1654dbf9338f8dd605d6290d93b7561c3194e1..0f8d9495801d03c6450497c25051a75dc062809c 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 f877a5a24b2c3dd1aacc766a816ccb6c10de8e7f..24fd916823a33b44983b88940121cacaaf77d3fb 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 b45b4e6bdbad0797a635e953bcc23e9c29433450..31db9c96beae3e04705686c735242ed6ce12f909 100644 --- a/src/rustc/middle/trans/datum.rs +++ b/src/rustc/middle/trans/datum.rs @@ -528,7 +528,7 @@ fn box_body(bcx: block) -> 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 @@ fn try_deref( } } - 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 ddc2017e16a2da76ea9c0a50bdbe085f72642f61..1bd62b4f88344921ca99a929b554f8603f434df7 100644 --- a/src/rustc/middle/trans/expr.rs +++ b/src/rustc/middle/trans/expr.rs @@ -447,7 +447,7 @@ fn ast_proto_to_proto_simple(ast_proto: ast::proto) } 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 ast_proto_to_proto_simple(ast_proto: ast::proto) } } 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 74904fdb8ca8895aaca0760cf13bfbe4523c0282..75ec925a4f8f5ae8554a1772fdcd70b26ff15746 100644 --- a/src/rustc/middle/trans/foreign.rs +++ b/src/rustc/middle/trans/foreign.rs @@ -440,7 +440,7 @@ fn link_name(ccx: @crate_ctxt, i: @ast::foreign_item) -> ~str { 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 384f6e71198a0387ec0f028195bdd97f9189e0ba..282f890ef2a160c793b7c67ab9ba7506a0495848 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 a0df372173d73852b220aee8ba9e19d036f5593d..90b913b807ac350e07e241a94fde290a33aae739 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 e29d69562613b5267518f6d01acf2d507f09be4e..9bf710fcbeb79763803515d748890e438fb955c2 100644 --- a/src/rustc/middle/trans/reflect.rs +++ b/src/rustc/middle/trans/reflect.rs @@ -114,7 +114,7 @@ fn visit_ty(t: ty::t) { 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 f60005f072eaf0be3cc05c4fb77e89565ce2e38a..f1b6a042053b77cc026399f02c65ae9a065864b2 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 nilptr(tcx: ty::ctxt) -> 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 7be4f8e645a5e59e2b3547ebd24c61bfd2f59bda..c0e695cbee125213fcc56b01bd5a43046f3e7831 100644 --- a/src/rustc/middle/trans/tvec.rs +++ b/src/rustc/middle/trans/tvec.rs @@ -19,7 +19,7 @@ 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 1a743ce31d51c332276a7f2db3ec3900b0284fb9..8c4f01701f02c9e8e92f2b643bb92076b3fa71c6 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 853bb71e84cf73e16b36205768410423c5189720..7e101e4796e4b323f8799731ab88c830b411d273 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 629be7022eec8ebd174f52f3169820ab01aae7a3..2ad5412e758aef8b2c85820f71c1d2bffdfb2d56 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -247,18 +247,18 @@ fn iter_bytes(lsb0: bool, f: to_bytes::Cb) { } } -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 sflags(substs: &substs) -> uint { 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_substs(substs: &substs, fldop: fn(t) -> t) -> substs { // 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_substs( } 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 do_fold(cx: ctxt, t0: t, under_r: bool, 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 do_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 do_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 @@ fn get_element_type(ty: t, i: uint) -> t { } 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 @@ fn get_element_type(ty: t, i: uint) -> t { } 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 @@ fn get_element_type(ty: t, i: uint) -> t { 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 type_requires(cx: ctxt, seen: @mut ~[def_id], 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 subtypes_require(cx: ctxt, seen: @mut ~[def_id], 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 subtypes_require(cx: ctxt, seen: @mut ~[def_id], 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 opcat(op: ast::binop) -> int { } 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_vstore(vstore: vstore) -> vstore { 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_vstore(vstore: vstore) -> vstore { // 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 fe479bdb2a60710746b29033e4dce2ac63da4539..439c005225978f430b1075773f7ab99bab610242 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 2ac872117e3c4318f083e4d5b11c1e0a7a0c1510..79033156d35dca071505284ff2ec41e6e4d8f038 100644 --- a/src/rustc/middle/typeck/astconv.rs +++ b/src/rustc/middle/typeck/astconv.rs @@ -185,7 +185,7 @@ fn mk_maybe_vstore( 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 b179a336a4f721943daa4ac4722e2f80b04b01fe..de803402a13a3452c513f68b22b04d8d7187f235 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_binop(fcx: @fn_ctxt, expr: @ast::expr, } 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_user_binop(fcx: @fn_ctxt, ex: @ast::expr, // 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 unpack_expected(fcx: @fn_ctxt, expected: Option, 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_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool, 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_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool, } 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_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool, } 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_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool, 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 6a61f7ae15e7ee90d81b981eb999c465da733dc6..05c182a81bfed2f18f1a598eaabb16b1b57ec5a9 100644 --- a/src/rustc/middle/typeck/check/method.rs +++ b/src/rustc/middle/typeck/check/method.rs @@ -114,7 +114,7 @@ fn method() -> Option { 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 @@ fn method() -> Option { // 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 @@ fn report_trait_candidate(idx: uint, did: ast::def_id) { } 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 @@ fn add_candidates_from_param(inner_ty: ty::t, mode: method_lookup_mode, 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 @@ fn add_candidates_from_class(inner_ty: ty::t, } 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 @@ fn ty_from_did(did: ast::def_id) -> ty::t { } } 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 9a4689506c0d27e36cc96a0bad8ab1ba681996ba..17c29b704f5f5c847bcc52697d6bc0516a3c4d29 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 d7cbaa055881c20e8e7df841c8ac7daf37dd8830..288baec27b53ec347aa6d6cb1cf542668ef6a2bf 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 d5d162e6b1607afc6100f5add932a31018be1acf..276b7eef57831bb2732c84eb674f1b60eb8c09e0 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 79ca4572e504cebcee2f93600616f5d6ed5a0435..1e3e8a3fc1448207012c20697a22f5a6debf8e1b 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 @@ fn add_impls_for_module(impls_seen: HashMap, // 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 0a06e55472460ed0e7fb73ae7eaf118e2aa21b22..cf8ed6315ca38dd2454b328b5c020f8d2a61e9d1 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 42dc90156f9c4700d483e2b334c765b3c5586a25..fdb23c90b10bc72eb23462cf8aba3c4c3559e71d 100644 --- a/src/rustc/middle/typeck/infer/assignment.rs +++ b/src/rustc/middle/typeck/infer/assignment.rs @@ -70,7 +70,7 @@ fn tys(a: ty::t, b: ty::t) -> ares { 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 @@ fn is_borrowable(v: ty::vstore) -> bool { (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 5a9393afabc069aa4b30e74c095a232b10a7cb22..84791b59b329f0160ff9858aebebb9313a88a7ca 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 fdab9f6a16948a20d19c4cad50639c4cef810af9..168709596dc4361d1829d3ca712563567421c2ef 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 49b2e57e2aa547b9e3e28a3ed22581c6832b5a7c..04133cab9d76cfcd13a1bfe6e8d275de53949c99 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 e77b5a52aafd77bf893c83050955051567c955cc..5d748efc332d61c2c3e76609dc47e8e975efd070 100644 --- a/src/rustc/middle/typeck/infer/resolve.rs +++ b/src/rustc/middle/typeck/infer/resolve.rs @@ -112,7 +112,7 @@ fn resolve_type(typ: ty::t) -> ty::t { 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 1e16ad8b8d53780d632d60140a08f00547cf7eec..359b8eea74169349bad9a29d2bf810da242aa8f6 100644 --- a/src/rustc/middle/typeck/infer/sub.rs +++ b/src/rustc/middle/typeck/infer/sub.rs @@ -101,7 +101,7 @@ fn tys(a: ty::t, b: ty::t) -> cres { 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 f58ed10a4085852114d57ca11bb50fdc9f3126b4..a9363f0f1dabace9962548e89f2193d3f7789ac6 100644 --- a/src/rustc/util/ppaux.rs +++ b/src/rustc/util/ppaux.rs @@ -284,7 +284,7 @@ fn fn_to_str(cx: ctxt, purity: ast::purity, proto: ty::fn_proto, 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 field_to_str(cx: ctxt, f: field) -> ~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 b68789f76baf3572c36cf24411ca4d082edcf346..486321e155c190134dba92b6fdeb0cb082f3c3ac 100644 --- a/src/test/run-pass/alias-uninit-value.rs +++ b/src/test/run-pass/alias-uninit-value.rs @@ -6,10 +6,10 @@ 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>); }