]> git.lizzy.rs Git - rust.git/commitdiff
rustc: "tag" -> "enum"
authorPatrick Walton <pcwalton@mimiga.net>
Thu, 19 Jan 2012 22:24:03 +0000 (14:24 -0800)
committerPatrick Walton <pcwalton@mimiga.net>
Thu, 19 Jan 2012 22:24:03 +0000 (14:24 -0800)
37 files changed:
src/comp/back/link.rs
src/comp/driver/diagnostic.rs
src/comp/driver/driver.rs
src/comp/driver/rustc.rs
src/comp/driver/session.rs
src/comp/lib/llvm.rs
src/comp/metadata/common.rs
src/comp/metadata/cstore.rs
src/comp/metadata/decoder.rs
src/comp/metadata/tyencode.rs
src/comp/middle/alias.rs
src/comp/middle/ast_map.rs
src/comp/middle/capture.rs
src/comp/middle/debuginfo.rs
src/comp/middle/last_use.rs
src/comp/middle/mut.rs
src/comp/middle/resolve.rs
src/comp/middle/shape.rs
src/comp/middle/trans.rs
src/comp/middle/trans_alt.rs
src/comp/middle/trans_closure.rs
src/comp/middle/trans_common.rs
src/comp/middle/tstate/auxiliary.rs
src/comp/middle/tstate/tritv.rs
src/comp/middle/ty.rs
src/comp/middle/typeck.rs
src/comp/syntax/ast.rs
src/comp/syntax/ast_util.rs
src/comp/syntax/codemap.rs
src/comp/syntax/ext/base.rs
src/comp/syntax/ext/simplext.rs
src/comp/syntax/parse/lexer.rs
src/comp/syntax/parse/parser.rs
src/comp/syntax/parse/token.rs
src/comp/syntax/print/pp.rs
src/comp/syntax/print/pprust.rs
src/comp/syntax/visit.rs

index c7a195db90a211eb74f2a1ea076d4212b2f39987..49b6373129145d37e153fd3111e89375d68ca4ad 100644 (file)
@@ -22,7 +22,7 @@
 import lib::llvm::False;
 import util::filesearch;
 
-tag output_type {
+enum output_type {
     output_type_none;
     output_type_bitcode;
     output_type_assembly;
index 6a44c5763de47b67e5ea6f91d05937f16ce0a103..6011f35ab922187b39be64868f82465e82c109b9 100644 (file)
@@ -107,7 +107,7 @@ fn mk_handler(cm: codemap::codemap,
     } as handler
 }
 
-tag level {
+enum level {
     fatal;
     error;
     warning;
index f14d351c4fc320d97e7620e0803d588db1b9f44c..7d0d1741918c3245a0626ddc6127a45a3f288512 100644 (file)
@@ -18,7 +18,7 @@
 import getopts::{optopt, optmulti, optflag, optflagopt, opt_present};
 import back::{x86, x86_64};
 
-tag pp_mode { ppm_normal; ppm_expanded; ppm_typed; ppm_identified; }
+enum pp_mode { ppm_normal; ppm_expanded; ppm_typed; ppm_identified; }
 
 fn default_configuration(sess: session, argv0: str, input: str) ->
    ast::crate_cfg {
index 8ca9a3e6f72b7a363e50fe1a89912ea49ed59006..9e6bb565cadfe10cd8372cd9c675f1797f47e475 100644 (file)
@@ -127,7 +127,7 @@ fn run_compiler(args: [str], demitter: diagnostic::emitter) {
 bug and need to present an error.
 */
 fn monitor(f: fn~(diagnostic::emitter)) {
-    tag monitor_msg {
+    enum monitor_msg {
         fatal;
         done;
     };
index 67a8268f5fdd73bda84e0b38aa0d55b570671541..bef939bb1c8a72e62a9bd994d369c563a64ff608 100644 (file)
 import back::target_strs;
 import middle::lint;
 
-tag os { os_win32; os_macos; os_linux; os_freebsd; }
+enum os { os_win32; os_macos; os_linux; os_freebsd; }
 
-tag arch { arch_x86; arch_x86_64; arch_arm; }
+enum arch { arch_x86; arch_x86_64; arch_arm; }
 
-tag crate_type { bin_crate; lib_crate; unknown_crate; }
+enum crate_type { bin_crate; lib_crate; unknown_crate; }
 
 type config =
     {os: os,
index a164ba1e10880e7ea533ba31c4424bf40d2dca92..1ee0f44297d364898c1fe1f0647f3a22cb4f5034 100644 (file)
@@ -15,7 +15,7 @@
 
 // Consts for the LLVM CallConv type, pre-cast to uint.
 // FIXME: figure out a way to merge these with the native
-// typedef and/or a tag type in the native module below.
+// typedef and/or a enum type in the native module below.
 
 const LLVMCCallConv: uint = 0u;
 const LLVMFastCallConv: uint = 8u;
index b16120d1bec1eb2df4ff8bcb412b58eb92464c51..c4ca48d6b3e2ba7653be919053e316f615762626 100644 (file)
@@ -1,4 +1,4 @@
-// EBML tag definitions and utils shared by the encoder and decoder
+// EBML enum definitions and utils shared by the encoder and decoder
 
 import str;
 
index de56aa236f535a6f0ca7f8d3c39cd9c82fda2d40..6fb9ac4edb4f9e50372449e7de988a467d097425 100644 (file)
                         cnum: ast::crate_num};
 
 // This is a bit of an experiment at encapsulating the data in cstore. By
-// keeping all the data in a non-exported tag variant, it's impossible for
+// keeping all the data in a non-exported enum variant, it's impossible for
 // other modules to access the cstore's private data. This could also be
 // achieved with an obj, but at the expense of a vtable. Not sure if this is a
 // good pattern or not.
-tag cstore { private(cstore_private); }
+enum cstore { private(cstore_private); }
 
 type cstore_private =
     @{metas: map::hashmap<ast::crate_num, crate_metadata>,
index e3790e4b09b3479848a821cc8d85a0ea9459961b..6b573de4c50a49573e9a771ef58dc17c4e2b2eb1 100644 (file)
@@ -252,7 +252,7 @@ fn get_tag_variants(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
           ty::ty_fn(f) {
             for a: ty::arg in f.inputs { arg_tys += [a.ty]; }
           }
-          _ { /* Nullary tag variant. */ }
+          _ { /* Nullary enum variant. */ }
         }
         alt variant_disr_val(item) {
           some(val) { disr_val = val; }
@@ -347,7 +347,7 @@ fn item_family_to_str(fam: u8) -> str {
       't' { ret "type"; }
       'm' { ret "mod"; }
       'n' { ret "native mod"; }
-      'v' { ret "tag"; }
+      'v' { ret "enum"; }
       'i' { ret "impl"; }
       'I' { ret "iface"; }
     }
index d4c562b67f96725f8fa90752bf891087cd16fda7..539d3fad079af1c619f1716774c13b41650d771a 100644 (file)
@@ -25,7 +25,7 @@
 // Whatever format you choose should not contain pipe characters.
 type ty_abbrev = {pos: uint, len: uint, s: @str};
 
-tag abbrev_ctxt { ac_no_abbrevs; ac_use_abbrevs(hashmap<ty::t, ty_abbrev>); }
+enum abbrev_ctxt { ac_no_abbrevs; ac_use_abbrevs(hashmap<ty::t, ty_abbrev>); }
 
 fn cx_uses_abbrevs(cx: @ctxt) -> bool {
     alt cx.abbrevs {
index c799e9956b0a943496765fcbba749b3b7a5c9118..adb08f3e563b76eabcdf40a6cfaa97edbd5aa2c7 100644 (file)
 // getting input from one, to be more precise). It is a pass that checks
 // whether aliases are used in a safe way.
 
-tag copied { not_allowed; copied; not_copied; }
-tag invalid_reason { overwritten; val_taken; }
+enum copied { not_allowed; copied; not_copied; }
+enum invalid_reason { overwritten; val_taken; }
 type invalid = {reason: invalid_reason,
                 node_id: node_id,
                 sp: span, path: @ast::path};
 
-tag unsafe_ty { contains(ty::t); mut_contains(ty::t); }
+enum unsafe_ty { contains(ty::t); mut_contains(ty::t); }
 
 type binding = @{node_id: node_id,
                  span: span,
@@ -46,7 +46,7 @@ fn mk_binding(cx: ctx, id: node_id, span: span, root_var: option::t<node_id>,
           mutable copied: not_copied};
 }
 
-tag local_info { local(uint); }
+enum local_info { local(uint); }
 
 type copy_map = std::map::hashmap<node_id, ()>;
 type ref_map = std::map::hashmap<node_id, node_id>;
index de04da4901412df40a7bdf2bd5b4b95c6801a6c5..eeb44ce3a51201f5df68c1e21244e7dc6c60a2c6 100644 (file)
@@ -4,7 +4,7 @@
 import syntax::ast_util;
 import syntax::{visit, codemap};
 
-tag ast_node {
+enum ast_node {
     node_item(@item);
     node_native_item(@native_item);
     node_method(@method);
index 9fb600d41c7b77be4398352a6fbaf14f030b82d4..7d4bd45256e88606d1210e8a3290a38c8150e76e 100644 (file)
@@ -12,7 +12,7 @@
 export cap_drop;
 export cap_ref;
 
-tag capture_mode {
+enum capture_mode {
     cap_copy; //< Copy the value into the closure.
     cap_move; //< Move the value into the closure.
     cap_drop; //< Drop value after creating closure.
index 096fc2fb99d03f4172ba476f8f52bb9ed571f221..fc56e39b63aaebe784eb56dae9933fc5cb012d62 100644 (file)
@@ -108,7 +108,7 @@ fn update_cache(cache: metadata_cache, mdtag: int, val: debug_metadata) {
 
 type metadata_cache = hashmap<int, [debug_metadata]>;
 
-tag debug_metadata {
+enum debug_metadata {
     file_metadata(@metadata<file_md>);
     compile_unit_metadata(@metadata<compile_unit_md>);
     subprogram_metadata(@metadata<subprogram_md>);
index c5c7c5448317bf8b807aa4153ec6c8b8882949c8..ce860506feb8a385ce231952e4f378bfc8093d6c 100644 (file)
@@ -26,8 +26,8 @@
 // Marks expr_paths that are last uses.
 type last_uses = std::map::hashmap<node_id, ()>;
 
-tag seen { unset; seen(node_id); }
-tag block_type { func; loop; }
+enum seen { unset; seen(node_id); }
+enum block_type { func; loop; }
 
 type set = [{def: node_id, exprs: list<node_id>}];
 type bl = @{type: block_type, mutable second: bool, mutable exits: [set]};
index 0eebf4e1ef9e4df728ab833ac02673bfa542b037..953b430a21b2f8f742e67c9a140b8c9445af99da 100644 (file)
@@ -5,7 +5,7 @@
 import syntax::ast_util;
 import driver::session::session;
 
-tag deref_t { unbox; field; index; }
+enum deref_t { unbox; field; index; }
 
 type deref = @{mut: bool, kind: deref_t, outer_t: ty::t};
 
@@ -121,7 +121,7 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) -> mut_map {
     ret cx.mut_map;
 }
 
-tag msg { msg_assign; msg_move_out; msg_mut_ref; }
+enum msg { msg_assign; msg_move_out; msg_mut_ref; }
 
 fn mk_err(cx: @ctx, span: syntax::codemap::span, msg: msg, name: str) {
     cx.tcx.sess.span_err(span, alt msg {
index 487ea5366884276d9c599c03e09af3d7d4ba4011..0f19721d56e119177d14fc5ea882efa2cbf3e4ab 100644 (file)
@@ -30,7 +30,7 @@
 // locates all names (in expressions, types, and alt patterns) and resolves
 // them, storing the resulting def in the AST nodes.
 
-tag scope {
+enum scope {
     scope_crate;
     scope_item(@ast::item);
     scope_bare_fn(ast::fn_decl, node_id, [ast::ty_param]);
@@ -44,7 +44,7 @@
 
 type scopes = list<scope>;
 
-tag import_state {
+enum import_state {
     todo(ast::node_id, ast::ident, @[ast::ident], codemap::span, scopes);
     is_glob(@[ast::ident], scopes, codemap::span);
     resolving(span);
@@ -56,7 +56,7 @@
              ast::ident, codemap::span);
 }
 
-tag glob_import_state {
+enum glob_import_state {
     glob_resolving(span);
     glob_resolved(option::t<def>,  /* value */
                   option::t<def>,  /* type */
@@ -98,12 +98,12 @@ fn eq(v1: key, v2: key) -> bool {
     ret std::map::mk_hashmap::<key, def>(hash, eq);
 }
 
-tag mod_index_entry {
+enum mod_index_entry {
     mie_view_item(@ast::view_item);
     mie_import_ident(node_id, codemap::span);
     mie_item(@ast::item);
     mie_native_item(@ast::native_item);
-    mie_tag_variant(/* tag item */@ast::item, /* variant index */uint);
+    mie_tag_variant(/* enum item */@ast::item, /* variant index */uint);
 }
 
 type mod_index = hashmap<ident, list<mod_index_entry>>;
@@ -151,14 +151,14 @@ fn eq(v1: key, v2: key) -> bool {
 
 // Used to distinguish between lookups from outside and from inside modules,
 // since export restrictions should only be applied for the former.
-tag dir { inside; outside; }
+enum dir { inside; outside; }
 
-// There are two types of ns_value tag: "definitely a tag";
+// There are two types of ns_value enum: "definitely a enum";
 // and "any value". This is so that lookup can behave differently
 // when looking up a variable name that's not yet in scope to check
-// if it's already bound to a tag.
-tag namespace { ns_val(ns_value_type); ns_type; ns_module; }
-tag ns_value_type { ns_a_tag; ns_any_value; }
+// if it's already bound to a enum.
+enum namespace { ns_val(ns_value_type); ns_type; ns_module; }
+enum ns_value_type { ns_a_tag; ns_any_value; }
 
 fn resolve_crate(sess: session, amap: ast_map::map, crate: @ast::crate) ->
    {def_map: def_map, exp_map: exp_map, impl_map: impl_map} {
@@ -186,7 +186,7 @@ fn resolve_crate(sess: session, amap: ast_map::map, crate: @ast::crate) ->
     resolve_names(e, crate);
     resolve_impls(e, crate);
     // check_for_collisions must happen after resolve_names so we
-    // don't complain if a pattern uses the same nullary tag twice
+    // don't complain if a pattern uses the same nullary enum twice
     check_for_collisions(e, *crate);
     if sess.opts.warn_unused_imports {
         check_unused_imports(e);
@@ -415,13 +415,13 @@ fn walk_pat(e: @env, pat: @ast::pat, sc: scopes, v: vt<scopes>) {
               }
               _ {
                 e.sess.span_err(p.span,
-                                "not a tag variant: " +
+                                "not a enum variant: " +
                                     ast_util::path_name(p));
               }
             }
           }
           /* Here we determine whether a given pat_ident binds a new
-           variable a refers to a nullary tag. */
+           variable a refers to a nullary enum. */
           ast::pat_ident(p, none) {
               let fnd = lookup_in_scope(*e, sc, p.span, path_to_ident(p),
                                     ns_val(ns_a_tag));
@@ -557,13 +557,13 @@ fn visit_expr_with_scope(x: @ast::expr, sc: scopes, v: vt<scopes>) {
 }
 
 // This is only for irrefutable patterns (e.g. ones that appear in a let)
-// So if x occurs, and x is already known to be a tag, that's always an error
+// So if x occurs, and x is already known to be a enum, that's always an error
 fn visit_local_with_scope(e: @env, loc: @local, sc:scopes, v:vt<scopes>) {
-    // Check whether the given local has the same name as a tag that's
+    // Check whether the given local has the same name as a enum that's
     // in scope
     // We disallow this, in order to make alt patterns consisting of
     // a single identifier unambiguous (does the pattern "foo" refer
-    // to tag foo, or is it binding a new name foo?)
+    // to enum foo, or is it binding a new name foo?)
     alt loc.node.pat.node {
       pat_ident(an_ident,_) {
           // Be sure to pass ns_a_tag to lookup_in_scope so that
@@ -571,10 +571,10 @@ fn visit_local_with_scope(e: @env, loc: @local, sc:scopes, v:vt<scopes>) {
           alt lookup_in_scope(*e, sc, loc.span,
                  path_to_ident(an_ident), ns_val(ns_a_tag)) {
               some(ast::def_variant(tag_id,variant_id)) {
-                  // Declaration shadows a tag that's in scope.
+                  // Declaration shadows a enum that's in scope.
                   // That's an error.
                   e.sess.span_err(loc.span,
-                    #fmt("Declaration of %s shadows a tag that's in scope",
+                    #fmt("Declaration of %s shadows a enum that's in scope",
                          path_to_ident(an_ident)));
                   }
               _ {}
@@ -742,14 +742,14 @@ fn ns_name(ns: namespace) -> str {
       ns_val(v) {
           alt (v) {
               ns_any_value { "name" }
-              ns_a_tag     { "tag" }
+              ns_a_tag     { "enum" }
           }
       }
       ns_module { ret "modulename" }
     }
 }
 
-tag ctxt { in_mod(def); in_scope(scopes); }
+enum ctxt { in_mod(def); in_scope(scopes); }
 
 fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) {
     fn find_fn_or_mod_scope(sc: scopes) -> option::t<scope> {
@@ -967,8 +967,8 @@ fn in_scope(e: env, sp: span, name: ident, s: scope, ns: namespace) ->
                       }
                       ns_val(v) {
                           alt(v) {
-                            /* If we were looking for a tag, at this point
-                               we know it's bound to a non-tag value, and
+                            /* If we were looking for a enum, at this point
+                               we know it's bound to a non-enum value, and
                                we can return none instead of failing */
                             ns_a_tag { ret none; }
                             _ { "attempted dynamic environment-capture" }
@@ -1468,7 +1468,7 @@ fn ns_for_def(d: def) -> namespace {
 }
 
 // if we're searching for a value, it's ok if we found
-// a tag
+// a enum
 fn ns_ok(wanted:namespace, actual:namespace) -> bool {
     alt actual {
       ns_val(ns_a_tag) {
index bb3de341df1ed95401774a440031a1415fb35cbe..0f391f4161a6f1a73df1e554bca4889a1f0f5973 100644 (file)
@@ -98,8 +98,8 @@ fn mk_global(ccx: @crate_ctxt, name: str, llval: ValueRef, internal: bool) ->
 }
 
 
-// Computes a set of variants of a tag that are guaranteed to have size and
-// alignment at least as large as any other variant of the tag. This is an
+// Computes a set of variants of a enum that are guaranteed to have size and
+// alignment at least as large as any other variant of the enum. This is an
 // important performance optimization.
 //
 // TODO: Use this in dynamic_size_of() as well.
@@ -180,7 +180,7 @@ fn largest_variants(ccx: @crate_ctxt, tag_id: ast::def_id) -> [uint] {
     ret result;
 }
 
-// Computes the static size of a tag, without using mk_tup(), which is
+// Computes the static size of a enum, without using mk_tup(), which is
 // bad for performance.
 //
 // TODO: Migrate trans over to use this.
@@ -217,8 +217,8 @@ fn compute_static_tag_size(ccx: @crate_ctxt, largest_variants: [uint],
         if max_align < variant_align { max_align = variant_align; }
     }
 
-    // Add space for the tag if applicable.
-    // FIXME (issue #792): This is wrong. If the tag starts with an 8 byte
+    // Add space for the enum if applicable.
+    // FIXME (issue #792): This is wrong. If the enum starts with an 8 byte
     // aligned quantity, we don't align it.
     if vec::len(*variants) > 1u {
         let variant_t = T_tag_variant(ccx);
@@ -230,7 +230,7 @@ fn compute_static_tag_size(ccx: @crate_ctxt, largest_variants: [uint],
     ret {size: max_size, align: max_align};
 }
 
-tag tag_kind { tk_unit; tk_enum; tk_complex; }
+enum tag_kind { tk_unit; tk_enum; tk_complex; }
 
 fn tag_kind(ccx: @crate_ctxt, did: ast::def_id) -> tag_kind {
     let variants = ty::tag_variants(ccx.tcx, did);
@@ -469,7 +469,7 @@ fn shape_of_variant(ccx: @crate_ctxt, v: ty::variant_info,
 //}
 
 fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
-    // Loop over all the tag variants and write their shapes into a data
+    // Loop over all the enum variants and write their shapes into a data
     // buffer. As we do this, it's possible for us to discover new tags, so we
     // must do this first.
     let i = 0u;
@@ -495,7 +495,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
     }
 
     // Now calculate the sizes of the header space (which contains offsets to
-    // info records for each tag) and the info space (which contains offsets
+    // info records for each enum) and the info space (which contains offsets
     // to each variant shape). As we do so, build up the header.
 
     let header = [];
@@ -512,7 +512,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
     }
 
     // Construct the info tables, which contain offsets to the shape of each
-    // variant. Also construct the largest-variant table for each tag, which
+    // variant. Also construct the largest-variant table for each enum, which
     // contains the variants that the size-of operation needs to look at.
 
     let lv_table = [];
@@ -530,7 +530,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
         add_u16(lv_table, vec::len(lv) as u16);
         for v: uint in lv { add_u16(lv_table, v as u16); }
 
-        // Determine whether the tag has dynamic size.
+        // Determine whether the enum has dynamic size.
         let dynamic = false;
         for variant: ty::variant_info in *variants {
             for typ: ty::t in variant.args {
@@ -538,7 +538,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
             }
         }
 
-        // If we can, write in the static size and alignment of the tag.
+        // If we can, write in the static size and alignment of the enum.
         // Otherwise, write a placeholder.
         let size_align;
         if dynamic {
index 92a37ab36d912c76a02375ed46eb6256555ba22f..8b85b78fde10ca1510aa023410819d19a9d022ba 100644 (file)
@@ -498,7 +498,7 @@ fn simplifier(ccx: @crate_ctxt, typ: ty::t) -> ty::t {
 }
 
 
-// Computes the size of the data part of a non-dynamically-sized tag.
+// Computes the size of the data part of a non-dynamically-sized enum.
 fn static_size_of_tag(cx: @crate_ctxt, sp: span, t: ty::t)
     : type_has_static_size(cx, t) -> uint {
     if cx.tag_sizes.contains_key(t) { ret cx.tag_sizes.get(t); }
@@ -526,7 +526,7 @@ fn static_size_of_tag(cx: @crate_ctxt, sp: span, t: ty::t)
         ret max_size;
       }
       _ {
-        cx.tcx.sess.span_fatal(sp, "non-tag passed to static_size_of_tag()");
+        cx.tcx.sess.span_fatal(sp, "non-enum passed to static_size_of_tag()");
       }
     }
 }
@@ -736,9 +736,9 @@ fn compute_off(bcx: @block_ctxt,
 }
 
 
-// Replacement for the LLVM 'GEP' instruction when field indexing into a tag.
+// Replacement for the LLVM 'GEP' instruction when field indexing into a enum.
 // This function uses GEP_tup_like() above and automatically performs casts as
-// appropriate. @llblobptr is the data part of a tag value; its actual type is
+// appropriate. @llblobptr is the data part of a enum value; its actual type is
 // meaningless, as it will be cast away.
 fn GEP_tag(cx: @block_ctxt, llblobptr: ValueRef, tag_id: ast::def_id,
            variant_id: ast::def_id, ty_substs: [ty::t],
@@ -1470,7 +1470,7 @@ fn maybe_name_value(cx: @crate_ctxt, v: ValueRef, s: str) {
 
 
 // Used only for creating scalar comparison glue.
-tag scalar_type { nil_type; signed_int; unsigned_int; floating_point; }
+enum scalar_type { nil_type; signed_int; unsigned_int; floating_point; }
 
 
 fn compare_scalar_types(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef,
@@ -1658,14 +1658,14 @@ fn iter_variant(cx: @block_ctxt, a_tup: ValueRef,
         // NB: we must hit the discriminant first so that structural
         // comparison know not to proceed when the discriminants differ.
         cx = f(cx, lldiscrim_a_ptr, ty::mk_int(bcx_tcx(cx)));
-        let unr_cx = new_sub_block_ctxt(cx, "tag-iter-unr");
+        let unr_cx = new_sub_block_ctxt(cx, "enum-iter-unr");
         Unreachable(unr_cx);
         let llswitch = Switch(cx, lldiscrim_a, unr_cx.llbb, n_variants);
-        let next_cx = new_sub_block_ctxt(cx, "tag-iter-next");
+        let next_cx = new_sub_block_ctxt(cx, "enum-iter-next");
         for variant: ty::variant_info in *variants {
             let variant_cx =
                 new_sub_block_ctxt(cx,
-                                   "tag-iter-variant-" +
+                                   "enum-iter-variant-" +
                                        int::to_str(variant.disr_val, 10u));
             AddCase(llswitch, C_int(ccx, variant.disr_val), variant_cx.llbb);
             variant_cx =
@@ -1938,7 +1938,7 @@ fn memmove_ty(bcx: @block_ctxt, dst: ValueRef, src: ValueRef, t: ty::t) ->
     ret call_memmove(bcx, dst, src, llsz).bcx;
 }
 
-tag copy_action { INIT; DROP_EXISTING; }
+enum copy_action { INIT; DROP_EXISTING; }
 
 // These are the types that are passed by pointer.
 fn type_is_structural_or_param(tcx: ty::ctxt, t: ty::t) -> bool {
@@ -2244,7 +2244,7 @@ fn autoderef(cx: @block_ctxt, v: ValueRef, t: ty::t) -> result_t {
             t1 = mt.ty;
 
             // Since we're changing levels of box indirection, we may have
-            // to cast this pointer, since statically-sized tag types have
+            // to cast this pointer, since statically-sized enum types have
             // different types depending on whether they're behind a box
             // or not.
             if check type_has_static_size(ccx, t1) {
@@ -2330,7 +2330,7 @@ fn trans_binary(cx: @block_ctxt, op: ast::binop, a: @ast::expr, b: @ast::expr,
     }
 }
 
-tag dest {
+enum dest {
     by_val(@mutable ValueRef);
     save_in(ValueRef);
     ignore;
@@ -2495,14 +2495,14 @@ fn trans_do_while(cx: @block_ctxt, body: ast::blk, cond: @ast::expr) ->
     origins: option::t<typeck::dict_res>
 };
 
-tag lval_kind {
+enum lval_kind {
     temporary; //< Temporary value passed by value if of immediate type
     owned;     //< Non-temporary value passed by pointer
     owned_imm; //< Non-temporary value passed by value
 }
 type local_var_result = {val: ValueRef, kind: lval_kind};
 type lval_result = {bcx: @block_ctxt, val: ValueRef, kind: lval_kind};
-tag callee_env {
+enum callee_env {
     null_env;
     is_closure;
     self_env(ValueRef);
@@ -2896,7 +2896,7 @@ fn trans_cast(cx: @block_ctxt, e: @ast::expr, id: ast::node_id,
     check (type_has_static_size(ccx, t_out));
     let ll_t_out = type_of(ccx, e.span, t_out);
 
-    tag kind { pointer; integral; float; tag_; other; }
+    enum kind { pointer; integral; float; tag_; other; }
     fn t_kind(tcx: ty::ctxt, t: ty::t) -> kind {
         ret if ty::type_is_fp(tcx, t) {
                 float
@@ -3540,7 +3540,7 @@ fn trans_expr(bcx: @block_ctxt, e: @ast::expr, dest: dest) -> @block_ctxt {
         ret trans_ret(bcx, ex);
       }
       ast::expr_be(ex) {
-        // Ideally, the expr_be tag would have a precondition
+        // Ideally, the expr_be enum would have a precondition
         // that is_call_expr(ex) -- but we don't support that
         // yet
         // FIXME
@@ -4409,7 +4409,7 @@ fn finish_fn(fcx: @fn_ctxt, lltop: BasicBlockRef) {
     RetVoid(ret_cx);
 }
 
-tag self_arg { impl_self(ty::t); no_self; }
+enum self_arg { impl_self(ty::t); no_self; }
 
 // trans_closure: Builds an LLVM function out of a source function.
 // If the function closes over its environment a closure will be
@@ -4557,7 +4557,7 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id,
     let lltop = bcx.llbb;
     bcx = copy_args_to_allocas(fcx, bcx, fn_args, arg_tys);
 
-    // Cast the tag to a type we can GEP into.
+    // Cast the enum to a type we can GEP into.
     let llblobptr =
         if is_degen {
             fcx.llretptr
@@ -4576,7 +4576,7 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id,
         let rslt = GEP_tag(bcx, llblobptr, t_id, v_id, ty_param_substs, i);
         bcx = rslt.bcx;
         let lldestptr = rslt.val;
-        // If this argument to this function is a tag, it'll have come in to
+        // If this argument to this function is a enum, it'll have come in to
         // this function as an opaque blob due to the way that type_of()
         // works. So we have to cast to the destination's view of the type.
         let llarg = alt fcx.llargs.find(va.id) { some(local_mem(x)) { x } };
@@ -5222,7 +5222,7 @@ fn collect_item(ccx: @crate_ctxt, abi: @mutable option::t<ast::native_abi>,
         for variant in variants {
             if vec::len(variant.node.args) != 0u {
                 register_fn(ccx, i.span, new_pt + [variant.node.name],
-                            "tag", tps, variant.node.id);
+                            "enum", tps, variant.node.id);
             }
         }
       }
index cef43dc25e563b0367cb9b644c3a46b02ddd4c75..dbe46f6e4568a85cd8ffc4e8adfa0cc2e7d7481c 100644 (file)
@@ -16,8 +16,8 @@
 
 import trans_common::*;
 
-// An option identifying a branch (either a literal, a tag variant or a range)
-tag opt {
+// An option identifying a branch (either a literal, a enum variant or a range)
+enum opt {
     lit(@ast::expr);
     var(/* disr val */int, /* variant dids */{tg: def_id, var: def_id});
     range(@ast::expr, @ast::expr);
@@ -34,7 +34,7 @@ fn opt_eq(a: opt, b: opt) -> bool {
     }
 }
 
-tag opt_result {
+enum opt_result {
     single_result(result);
     range_result(result, result);
 }
@@ -284,7 +284,7 @@ fn extract_variant_args(bcx: @block_ctxt, pat_id: ast::node_id,
         let r =
             // invariant needed:
             // how do we know it even makes sense to pass in ty_param_substs
-            // here? What if it's [] and the tag type has variables in it?
+            // here? What if it's [] and the enum type has variables in it?
             trans::GEP_tag(bcx, blobptr, vdefs_tg, vdefs_var, ty_param_substs,
                            i);
         bcx = r.bcx;
@@ -472,7 +472,7 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail,
 
     // Decide what kind of branch we need
     let opts = get_options(ccx, m, col);
-    tag branch_kind { no_branch; single; switch; compare; }
+    enum branch_kind { no_branch; single; switch; compare; }
     let kind = no_branch;
     let test_val = val;
     if vec::len(opts) > 0u {
index 4915a975322f15719a8e89422c637a299a3a00a6..9b864603b0c57481ee791fc4efcb0abf784c7df8 100644 (file)
 //
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-tag environment_value {
+enum environment_value {
     // Evaluate expr and store result in env (used for bind).
     env_expr(@ast::expr);
 
index 0a2045dcb2b144fa870fcbbaf675057f1927b7c3..56a8c7016eb89f080d88907710b2a647aaf37d1b 100644 (file)
@@ -32,7 +32,7 @@ fn new_namegen() -> namegen {
 
 type derived_tydesc_info = {lltydesc: ValueRef, escapes: bool};
 
-tag tydesc_kind {
+enum tydesc_kind {
     tk_static; // Static (monomorphic) type descriptor
     tk_param; // Type parameter.
     tk_derived; // Derived from a typaram or another derived tydesc.
@@ -131,7 +131,7 @@ fn new_namegen() -> namegen {
 // Types used for llself.
 type val_self_pair = {v: ValueRef, t: ty::t};
 
-tag local_val { local_mem(ValueRef); local_imm(ValueRef); }
+enum local_val { local_mem(ValueRef); local_imm(ValueRef); }
 
 type fn_ty_param = {desc: ValueRef, dicts: option::t<[ValueRef]>};
 
@@ -242,7 +242,7 @@ fn new_namegen() -> namegen {
      sp: span,
      lcx: @local_ctxt};
 
-tag cleanup {
+enum cleanup {
     clean(fn@(@block_ctxt) -> @block_ctxt);
     clean_temp(ValueRef, fn@(@block_ctxt) -> @block_ctxt);
 }
@@ -331,7 +331,7 @@ fn get_res_dtor(ccx: @crate_ctxt, sp: span, did: ast::def_id, inner_t: ty::t)
                                                     did), f_t);
 }
 
-tag block_kind {
+enum block_kind {
 
 
     // A scope block is a basic block created by translating a block { ... }
@@ -387,8 +387,8 @@ fn get_res_dtor(ccx: @crate_ctxt, sp: span, did: ast::def_id, inner_t: ty::t)
      fcx: @fn_ctxt};
 
 // FIXME: we should be able to use option::t<@block_parent> here but
-// the infinite-tag check in rustboot gets upset.
-tag block_parent { parent_none; parent_some(@block_ctxt); }
+// the infinite-enum check in rustboot gets upset.
+enum block_parent { parent_none; parent_some(@block_ctxt); }
 
 type result = {bcx: @block_ctxt, val: ValueRef};
 type result_t = {bcx: @block_ctxt, val: ValueRef, ty: ty::t};
@@ -885,7 +885,7 @@ fn C_shape(ccx: @crate_ctxt, bytes: [u8]) -> ValueRef {
 }
 
 // Used to identify cached dictionaries
-tag dict_param {
+enum dict_param {
     dict_param_dict(dict_id);
     dict_param_ty(ty::t);
 }
index 04469cda4eb60a49b746e0960dce64824614039a..e3a85c41692beef614f545d211745c2ffa0af6fb 100644 (file)
@@ -22,7 +22,7 @@
 
 // Used to communicate which operands should be invalidated
 // to helper functions
-tag oper_type {
+enum oper_type {
     oper_move;
     oper_swap;
     oper_assign;
@@ -198,7 +198,7 @@ fn print_idents(&idents: [ident]) {
 // for this local.
 type constr_arg_use = spanned<constr_arg_general_<inst>>;
 
-tag constraint {
+enum constraint {
     cinit(uint, span, ident);
 
     // FIXME: really only want it to be mutable during collect_locals.
@@ -211,7 +211,7 @@ fn print_idents(&idents: [ident]) {
 // predicate need not be local.
 // FIXME: would be nice to give both a def_id field,
 // and give ninit a constraint saying it's local.
-tag tsconstr {
+enum tsconstr {
     ninit(node_id, ident);
     npred(@path, def_id, [@constr_arg_use]);
 }
@@ -780,7 +780,7 @@ fn replace(subst: subst, d: pred_args) -> [constr_arg_general_<inst>] {
     ret rslt;
 }
 
-tag if_ty { if_check; plain_if; }
+enum if_ty { if_check; plain_if; }
 
 fn local_node_id_to_def_id_strict(fcx: fn_ctxt, sp: span, i: node_id) ->
    def_id {
index 6a7504de5c33a3e3ab5f31bb2338a8ec2eac3f5d..6bb471390590d899951c95fb234dc999efe2c99b 100644 (file)
@@ -30,7 +30,7 @@
 */
 
 type t = {uncertain: bitv::t, val: bitv::t, nbits: uint};
-tag trit { ttrue; tfalse; dont_care; }
+enum trit { ttrue; tfalse; dont_care; }
 
 fn create_tritv(len: uint) -> t {
     ret {uncertain: bitv::create(len, true),
index 03802e04d88f4587322dc82858e6c58c3cfb19e7..9a54c58ab0b10338547111388d6b0ddf20cd2ee0 100644 (file)
 
 type t = uint;
 
-tag closure_kind {
+enum closure_kind {
     ck_any;
     ck_block;
     ck_box;
 
 // NB: If you change this, you'll probably want to change the corresponding
 // AST structure in front/ast::rs as well.
-tag sty {
+enum sty {
     ty_nil;
     ty_bot;
     ty_bool;
     ty_tup([t]);
     ty_var(int); // type variable
 
-    ty_param(uint, def_id); // fn/tag type param
+    ty_param(uint, def_id); // fn/enum type param
 
     ty_type; // type_desc*
     ty_send_type; // type_desc* that has been cloned into exchange heap
 type constr = constr_general<uint>;
 
 // Data structures used in type unification
-tag type_err {
+enum type_err {
     terr_mismatch;
     terr_ret_style_mismatch(ast::ret_style, ast::ret_style);
     terr_box_mutability;
     terr_constr_mismatch(@type_constr, @type_constr);
 }
 
-tag param_bound {
+enum param_bound {
     bound_copy;
     bound_send;
     bound_iface(t);
@@ -712,7 +712,7 @@ fn walk_ty(cx: ctxt, walker: ty_walk, ty: t) {
     walker(ty);
 }
 
-tag fold_mode {
+enum fold_mode {
     fm_var(fn@(int) -> t);
     fm_param(fn@(uint, def_id) -> t);
     fm_general(fn@(t) -> t);
@@ -973,7 +973,7 @@ fn type_needs_drop(cx: ctxt, ty: t) -> bool {
     ret result;
 }
 
-tag kind { kind_sendable; kind_copyable; kind_noncopyable; }
+enum kind { kind_sendable; kind_copyable; kind_noncopyable; }
 
 // Using these query functons is preferable to direct comparison or matching
 // against the kind constants, as we may modify the kind hierarchy in the
@@ -1245,7 +1245,7 @@ fn type_is_tag(cx: ctxt, ty: t) -> bool {
     }
 }
 
-// Whether a type is enum like, that is a tag type with only nullary
+// 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 {
     alt struct(cx, ty) {
@@ -1732,16 +1732,16 @@ mod unify {
     export var_bindings;
     export precise, in_bindings;
 
-    tag result { ures_ok(t); ures_err(type_err); }
-    tag union_result { unres_ok; unres_err(type_err); }
-    tag fixup_result {
+    enum result { ures_ok(t); ures_err(type_err); }
+    enum union_result { unres_ok; unres_err(type_err); }
+    enum fixup_result {
         fix_ok(t); // fixup succeeded
         fix_err(int); // fixup failed because a type variable was unresolved
     }
     type var_bindings =
         {sets: ufind::ufind, types: smallintmap::smallintmap<t>};
 
-    tag unify_style {
+    enum unify_style {
         precise;
         in_bindings(@var_bindings);
     }
@@ -2041,7 +2041,7 @@ fn resolve_type_structure(tcx: ty_ctxt, vb: @var_bindings, typ: t) ->
     }
 
     // Specifies the allowable subtyping between expected and actual types
-    tag variance {
+    enum variance {
         // Actual may be a subtype of expected
         covariant;
         // Actual may be a supertype of expected
@@ -2676,7 +2676,7 @@ fn tag_variants(cx: ctxt, id: ast::def_id) -> @[variant_info] {
 }
 
 
-// Returns information about the tag variant with the given ID:
+// Returns information about the enum variant with the given ID:
 fn tag_variant_with_id(cx: ctxt, tag_id: ast::def_id, variant_id: ast::def_id)
    -> variant_info {
     let variants = tag_variants(cx, tag_id);
index d16c0d315dd52a3cba437303c2a4c9cfd6ab6344..15c247bd81b28e613b7c84d5d72c0b9cbf586c7c 100644 (file)
@@ -23,7 +23,7 @@
 export method_map, method_origin, method_static, method_param, method_iface;
 export dict_map, dict_res, dict_origin, dict_static, dict_param, dict_iface;
 
-tag method_origin {
+enum method_origin {
     method_static(ast::def_id);
     // iface id, method num, param num, bound num
     method_param(ast::def_id, uint, uint, uint);
@@ -33,7 +33,7 @@
 
 // Resolutions for bounds of all parameters, left to right, for a given path.
 type dict_res = @[dict_origin];
-tag dict_origin {
+enum dict_origin {
     dict_static(ast::def_id, [ty::t], dict_res);
     // Param number, bound number
     dict_param(uint, uint);
@@ -44,7 +44,7 @@
 type ty_table = hashmap<ast::def_id, ty::t>;
 
 // Used for typechecking the methods of an impl
-tag self_info {
+enum self_info {
     self_impl(ty::t);
 }
 
@@ -231,7 +231,7 @@ fn default_arg_mode_for_ty(tcx: ty::ctxt, m: ast::mode,
     }
 }
 
-tag mode { m_collect; m_check; m_check_tyvar(@fn_ctxt); }
+enum mode { m_collect; m_check; m_check_tyvar(@fn_ctxt); }
 
 fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t {
     fn getter(tcx: ty::ctxt, mode: mode, id: ast::def_id)
@@ -263,7 +263,7 @@ fn ast_arg_to_arg(tcx: ty::ctxt, mode: mode, arg: ast::arg)
       some(none) {
         tcx.sess.span_fatal(ast_ty.span,
                             "illegal recursive type \
-                              insert a tag in the cycle, \
+                              insert a enum in the cycle, \
                               if this is desired)");
       }
       none { }
@@ -650,7 +650,7 @@ fn get_tag_variant_types(cx: @ctxt, tag_ty: ty::t,
         // Create a set of parameter types shared among all the variants.
 
         for variant: ast::variant in variants {
-            // Nullary tag constructors get turned into constants; n-ary tag
+            // Nullary enum constructors get turned into constants; n-ary enum
             // constructors get turned into functions.
 
             let result_ty = if vec::len(variant.node.args) == 0u {
@@ -921,7 +921,7 @@ fn are_compatible(fcx: @fn_ctxt, expected: ty::t, actual: ty::t) -> bool {
 }
 
 
-// Returns the types of the arguments to a tag variant.
+// Returns the types of the arguments to a enum variant.
 fn variant_arg_types(ccx: @crate_ctxt, _sp: span, vid: ast::def_id,
                      tag_ty_params: [ty::t]) -> [ty::t] {
     let result: [ty::t] = [];
@@ -1243,10 +1243,10 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat,
         let tag_tpt = ty::lookup_item_type(fcx.ccx.tcx, v_def_ids.tg);
         let path_tpot = instantiate_path(fcx, path, tag_tpt, pat.span);
 
-        // Take the tag type params out of `expected`.
+        // Take the enum type params out of `expected`.
         alt structure_of(fcx, pat.span, expected) {
           ty::ty_tag(_, expected_tps) {
-            // Unify with the expected tag type.
+            // Unify with the expected enum type.
             let ctor_ty =
                 ty::ty_param_substs_opt_and_ty_to_monotype(fcx.ccx.tcx,
                                                            path_tpot);
@@ -1257,7 +1257,7 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat,
             path_tpot =
                 {substs: some::<[ty::t]>(path_tpt.substs), ty: path_tpt.ty};
 
-            // Get the number of arguments in this tag variant.
+            // Get the number of arguments in this enum variant.
             let arg_types =
                 variant_arg_types(fcx.ccx, pat.span, v_def_ids.var,
                                   expected_tps);
@@ -1267,7 +1267,7 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat,
 
                 let arg_len = vec::len::<ty::t>(arg_types);
                 if arg_len != subpats_len {
-                    // TODO: note definition of tag variant
+                    // TODO: note definition of enum variant
                     // TODO (issue #448): Wrap a #fmt string over multiple
                     // lines...
                     let s =
@@ -1287,7 +1287,7 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat,
                     i += 1u;
                 }
             } else if subpats_len > 0u {
-                // TODO: note definition of tag variant
+                // TODO: note definition of enum variant
                 fcx.ccx.tcx.sess.span_fatal
                     (pat.span,
                      #fmt["this pattern has %u field%s, \
@@ -1305,7 +1305,7 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat,
             // can never tell.
             fcx.ccx.tcx.sess.span_fatal
                 (pat.span,
-                 #fmt["mismatched types: expected `%s` but found tag",
+                 #fmt["mismatched types: expected `%s` but found enum",
                       ty_to_str(fcx.ccx.tcx, expected)]);
           }
         }
index 7449d8a53f82e151679cfc08e1256b2dc8de483c..a8bbf75aaa28409c55453d74ee416305366ddd3c 100644 (file)
@@ -24,7 +24,7 @@
 const local_crate: crate_num = 0;
 const crate_node_id: node_id = 0;
 
-tag ty_param_bound {
+enum ty_param_bound {
     bound_copy;
     bound_send;
     bound_iface(@ty);
@@ -32,7 +32,7 @@
 
 type ty_param = {ident: ident, id: node_id, bounds: @[ty_param_bound]};
 
-tag def {
+enum def {
     def_fn(def_id, purity);
     def_self(def_id);
     def_mod(def_id);
@@ -40,7 +40,7 @@
     def_const(def_id);
     def_arg(def_id, mode);
     def_local(def_id, let_style);
-    def_variant(def_id /* tag */, def_id /* variant */);
+    def_variant(def_id /* enum */, def_id /* variant */);
     def_ty(def_id);
     def_ty_param(def_id, uint);
     def_binding(def_id);
      attrs: [attribute],
      config: crate_cfg};
 
-tag crate_directive_ {
+enum crate_directive_ {
     cdir_src_mod(ident, [attribute]);
     cdir_dir_mod(ident, [@crate_directive], [attribute]);
 
     // NB: cdir_view_item is *not* processed by the rest of the compiler; the
     // attached view_items are sunk into the crate's module during parsing,
-    // and processed (resolved, imported, etc.) there. This tag-variant exists
+    // and processed (resolved, imported, etc.) there. This enum-variant exists
     // only to preserve the view items in order in case we decide to
     // pretty-print crates in the future.
     cdir_view_item(@view_item);
@@ -80,7 +80,7 @@
 
 type meta_item = spanned<meta_item_>;
 
-tag meta_item_ {
+enum meta_item_ {
     meta_word(ident);
     meta_list(ident, [@meta_item]);
     meta_name_value(ident, lit);
 
 type field_pat = {ident: ident, pat: @pat};
 
-tag pat_ {
+enum pat_ {
     pat_wild;
     // A pat_ident may either be a new bound variable,
-    // or a nullary tag (in which case the second field
+    // or a nullary enum (in which case the second field
     // is none).
-    // In the nullary tag case, the parser can't determine
+    // In the nullary enum case, the parser can't determine
     // which it is. The resolver determines this, and
     // records this pattern's node_id in an auxiliary
     // set (of "pat_idents that refer to nullary tags")
     pat_range(@expr, @expr);
 }
 
-tag mutability { mut; imm; maybe_mut; }
+enum mutability { mut; imm; maybe_mut; }
 
-tag proto {
+enum proto {
     proto_bare;    // native fn
     proto_any;     // fn
     proto_uniq;    // fn~
     }
 }
 
-tag binop {
+enum binop {
     add;
     subtract;
     mul;
     gt;
 }
 
-tag unop {
+enum unop {
     box(mutability);
     uniq(mutability);
     deref; not; neg;
 }
 
-tag mode { by_ref; by_val; by_mut_ref; by_move; by_copy; mode_infer; }
+enum mode { by_ref; by_val; by_mut_ref; by_move; by_copy; mode_infer; }
 
 type stmt = spanned<stmt_>;
 
-tag stmt_ {
+enum stmt_ {
     stmt_decl(@decl, node_id);
 
     // expr without trailing semi-colon (must have unit type):
     stmt_semi(@expr, node_id);
 }
 
-tag init_op { init_assign; init_move; }
+enum init_op { init_assign; init_move; }
 
 type initializer = {op: init_op, expr: @expr};
 
 
 type decl = spanned<decl_>;
 
-tag let_style { let_copy; let_ref; }
+enum let_style { let_copy; let_ref; }
 
-tag decl_ { decl_local([(let_style, @local)]); decl_item(@item); }
+enum decl_ { decl_local([(let_style, @local)]); decl_item(@item); }
 
 type arm = {pats: [@pat], guard: option::t<@expr>, body: blk};
 
 
 type field = spanned<field_>;
 
-tag blk_check_mode { default_blk; unchecked_blk; unsafe_blk; }
+enum blk_check_mode { default_blk; unchecked_blk; unsafe_blk; }
 
-tag expr_check_mode { claimed_expr; checked_expr; }
+enum expr_check_mode { claimed_expr; checked_expr; }
 
 type expr = {id: node_id, node: expr_, span: span};
 
-tag expr_ {
+enum expr_ {
     expr_vec([@expr], mutability);
     expr_rec([field], option::t<@expr>);
     expr_call(@expr, [@expr], bool);
 /*
 // Says whether this is a block the user marked as
 // "unchecked"
-tag blk_sort {
+enum blk_sort {
     blk_unchecked; // declared as "exception to effect-checking rules"
     blk_checked; // all typing rules apply
 }
 
 type mac = spanned<mac_>;
 
-tag mac_ {
+enum mac_ {
     mac_invoc(@path, @expr, option::t<str>);
     mac_embed_type(@ty);
     mac_embed_block(blk);
 
 type lit = spanned<lit_>;
 
-tag lit_ {
+enum lit_ {
     lit_str(str);
     lit_int(i64, int_ty);
     lit_uint(u64, uint_ty);
 
 type ty_method = {ident: ident, decl: fn_decl, tps: [ty_param], span: span};
 
-tag int_ty { ty_i; ty_char; ty_i8; ty_i16; ty_i32; ty_i64; }
+enum int_ty { ty_i; ty_char; ty_i8; ty_i16; ty_i32; ty_i64; }
 
-tag uint_ty { ty_u; ty_u8; ty_u16; ty_u32; ty_u64; }
+enum uint_ty { ty_u; ty_u8; ty_u16; ty_u32; ty_u64; }
 
-tag float_ty { ty_f; ty_f32; ty_f64; }
+enum float_ty { ty_f; ty_f32; ty_f64; }
 
 type ty = spanned<ty_>;
 
-tag ty_ {
+enum ty_ {
     ty_nil;
     ty_bot; /* return type of ! functions and type of
              ret/fail/break/cont. there is no syntax
 So, the constr_arg type is parameterized: it's instantiated with uint for
 declarations, and ident for uses.
 */
-tag constr_arg_general_<T> { carg_base; carg_ident(T); carg_lit(@lit); }
+enum constr_arg_general_<T> { carg_base; carg_ident(T); carg_lit(@lit); }
 
 type fn_constr_arg = constr_arg_general_<uint>;
 type sp_constr_arg<T> = spanned<constr_arg_general_<T>>;
      cf: ret_style,
      constraints: [@constr]};
 
-tag purity {
+enum purity {
     pure_fn; // declared with "pure fn"
     unsafe_fn; // declared with "unsafe fn"
     impure_fn; // declared with "fn"
 }
 
-tag ret_style {
+enum ret_style {
     noreturn; // functions with return type _|_ that always
               // raise an error or exit (i.e. never return to the caller)
     return_val; // everything else
 
 type _mod = {view_items: [@view_item], items: [@item]};
 
-tag native_abi {
+enum native_abi {
     native_abi_rust_intrinsic;
     native_abi_cdecl;
     native_abi_stdcall;
 
 type import_ident = spanned<import_ident_>;
 
-tag view_item_ {
+enum view_item_ {
     view_item_use(ident, [@meta_item], node_id);
     view_item_import(ident, @simple_path, node_id);
     view_item_import_glob(@simple_path, node_id);
 // Distinguishes between attributes that decorate items and attributes that
 // are contained as statements within items. These two cases need to be
 // distinguished for pretty-printing.
-tag attr_style { attr_outer; attr_inner; }
+enum attr_style { attr_outer; attr_inner; }
 
 type attribute_ = {style: attr_style, value: meta_item};
 
 type item = {ident: ident, attrs: [attribute],
              id: node_id, node: item_, span: span};
 
-tag item_ {
+enum item_ {
     item_const(@ty, @expr);
     item_fn(fn_decl, [ty_param], blk);
     item_mod(_mod);
      id: node_id,
      span: span};
 
-tag native_item_ {
+enum native_item_ {
     native_item_ty;
     native_item_fn(fn_decl, [ty_param]);
 }
index 6e8de806348ee9698f8514030dd8457077fd034b..b1513b24e242a76429d9f2dcbbe31533d5a3e3a3 100644 (file)
@@ -201,7 +201,7 @@ fn ternary_to_if(e: @expr) -> @expr {
 
 // FIXME this doesn't handle big integer/float literals correctly (nor does
 // the rest of our literal handling)
-tag const_val {
+enum const_val {
     const_float(float);
     const_int(i64);
     const_uint(u64);
index 3bedf018eb711c708d253d6b716e3c82864bbe00..7844e9c197e8c303e74e37a422f75e3dd8fbce87 100644 (file)
@@ -65,7 +65,7 @@ fn lookup_byte_pos(map: codemap, pos: uint) -> loc {
     ret lookup_pos(map, pos, lookup);
 }
 
-tag opt_span {
+enum opt_span {
 
     //hack (as opposed to option::t), to make `span` compile
     os_none;
index 0dee29db0f9f94998963d2bd0b4e45ff06517a21..bead9a5d85b25d292cab0ae17e83d50edab0fdca 100644 (file)
@@ -11,7 +11,7 @@
 type macro_definer =
     fn@(ext_ctxt, span, @ast::expr, option::t<str>) -> macro_def;
 
-tag syntax_extension {
+enum syntax_extension {
     normal(syntax_expander);
     macro_defining(macro_definer);
 }
index a71bb650f3ccfd3b801b59c86f050d282b5b105d..85d6d451810129ed004d982ec519aabb21637f6d 100644 (file)
@@ -25,10 +25,10 @@ fn path_to_ident(pth: @path) -> option::t<ident> {
 type clause = {params: binders, body: @expr};
 
 /* logically, an arb_depth should contain only one kind of matchable */
-tag arb_depth<T> { leaf(T); seq(@[arb_depth<T>], span); }
+enum arb_depth<T> { leaf(T); seq(@[arb_depth<T>], span); }
 
 
-tag matchable {
+enum matchable {
     match_expr(@expr);
     match_path(@path);
     match_ident(ast::spanned<ident>);
index 176e70cc65a9e8669f96c355b384b7ebaec15e00..78cde98a9c5d76ad9172b85866b44b52a8d9149d 100644 (file)
@@ -510,7 +510,7 @@ fn binop(rdr: reader, op: token::binop) -> token::token {
     }
 }
 
-tag cmnt_style {
+enum cmnt_style {
     isolated; // No code on either side of each line of the comment
     trailing; // Code exists to the left of the comment
     mixed; // Code before /* foo */ and after the comment
index a5980465048f478d9315a4d60425d0b9d2b99ae4..373b1f22a4495ba13a948dfeb51486fe32c500a7 100644 (file)
 import lexer::reader;
 import driver::diagnostic;
 
-tag restriction {
+enum restriction {
     UNRESTRICTED;
     RESTRICT_STMT_EXPR;
     RESTRICT_NO_CALL_EXPRS;
     RESTRICT_NO_BAR_OP;
 }
 
-tag file_type { CRATE_FILE; SOURCE_FILE; }
+enum file_type { CRATE_FILE; SOURCE_FILE; }
 
 type parse_sess = @{
     cm: codemap::codemap,
@@ -147,7 +147,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
                  "cont", "ret", "be", "fail", "type", "resource", "check",
                  "assert", "claim", "native", "fn", "pure",
                  "unsafe", "block", "import", "export", "let", "const",
-                 "log", "copy", "sendfn", "impl", "iface", "enum"] {
+                 "log", "copy", "sendfn", "impl", "iface", "tag", "enum"] {
         words.insert(word, ());
     }
     words
@@ -719,9 +719,9 @@ fn mk_lit_u32(p: parser, i: u32) -> @ast::expr {
 // parsing because `(while{...})+3` parses differently from `while{...}+3`.
 //
 // To reflect the fact that the @ast::expr is not a true expr that should be
-// part of the AST, we wrap such expressions in the pexpr tag.  They
+// part of the AST, we wrap such expressions in the pexpr enum.  They
 // can then be converted to true expressions by a call to `to_expr()`.
-tag pexpr {
+enum pexpr {
     pexpr(@ast::expr);
 }
 
@@ -1508,7 +1508,7 @@ fn parse_pat(p: parser) -> @ast::pat {
               }
               _ { args = []; }
             }
-            // at this point, we're not sure whether it's a tag or a bind
+            // at this point, we're not sure whether it's a enum or a bind
             if vec::len(args) == 0u &&
                vec::len(tag_path.node.idents) == 1u {
                 pat = ast::pat_ident(tag_path, none);
@@ -2026,7 +2026,7 @@ fn parse_item_tag(p: parser, attrs: [ast::attribute]) -> @ast::item {
     // Newtype syntax
     if p.token == token::EQ {
         if p.bad_expr_words.contains_key(id) {
-            p.fatal("found " + id + " in tag constructor position");
+            p.fatal("found " + id + " in enum constructor position");
         }
         p.bump();
         let ty = parse_ty(p, false);
index e5dcc8b61f7fc5b5a03147c26a65c29e07d05d65..e1851d831b10d2623b495d5a43d8cafa1734f00a 100644 (file)
@@ -5,7 +5,7 @@
 
 type str_num = uint;
 
-tag binop {
+enum binop {
     PLUS;
     MINUS;
     STAR;
@@ -19,7 +19,7 @@
     ASR;
 }
 
-tag token {
+enum token {
     /* Expression-operator symbols. */
     EQ;
     LT;
index 455e9d916c99f4598edd9d660529d641a1561e7c..4950af7b624ddaf6ef2acc492b9a42b6cb8363d0 100644 (file)
  * line (which it can't) and so naturally place the content on its own line to
  * avoid combining it with other lines and making matters even worse.
  */
-tag breaks { consistent; inconsistent; }
+enum breaks { consistent; inconsistent; }
 
 type break_t = {offset: int, blank_space: int};
 
 type begin_t = {offset: int, breaks: breaks};
 
-tag token { STRING(str, int); BREAK(break_t); BEGIN(begin_t); END; EOF; }
+enum token { STRING(str, int); BREAK(break_t); BEGIN(begin_t); END; EOF; }
 
 fn tok_str(t: token) -> str {
     alt t {
@@ -91,7 +91,7 @@ fn buf_str(toks: [mutable token], szs: [mutable int], left: uint, right: uint,
     ret s;
 }
 
-tag print_stack_break { fits; broken(breaks); }
+enum print_stack_break { fits; broken(breaks); }
 
 type print_stack_elt = {offset: int, pbreak: print_stack_break};
 
index d666e0e3fabb29e34ce5943409ad4ec22fff298b..3717dc8378026578fa9affff523bdbc8d119b943 100644 (file)
@@ -12,8 +12,8 @@
 import driver::diagnostic;
 
 // The ps is stored here to prevent recursive type.
-// FIXME use a nominal tag instead
-tag ann_node {
+// FIXME use a nominal enum instead
+enum ann_node {
     node_block(ps, ast::blk);
     node_item(ps, @ast::item);
     node_expr(ps, @ast::expr);
@@ -565,7 +565,7 @@ fn print_block_with_attrs(s: ps, blk: ast::blk, attrs: [ast::attribute]) {
     print_possibly_embedded_block_(s, blk, block_normal, indent_unit, attrs);
 }
 
-tag embed_type { block_macro; block_block_fn; block_normal; }
+enum embed_type { block_macro; block_block_fn; block_normal; }
 
 fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type,
                                  indented: uint) {
index bf544c099005a181843e116f72088d42a0d24778..8f0f1f6f5587e9cacc16712ebd29932b539f8c11 100644 (file)
 // override the context), or prevent deeper traversal by doing nothing.
 
 // Our typesystem doesn't do circular types, so the visitor record can not
-// hold functions that take visitors. A vt tag is used to break the cycle.
-tag vt<E> { mk_vt(visitor<E>); }
+// hold functions that take visitors. A vt enum is used to break the cycle.
+enum vt<E> { mk_vt(visitor<E>); }
 
-tag fn_kind {
+enum fn_kind {
     fk_item_fn(ident, [ty_param]); //< an item declared with fn()
     fk_method(ident, [ty_param]);
     fk_res(ident, [ty_param]);