Skip to content

Commit c5a407b

Browse files
committed
stdlib: "tag" -> "enum"
1 parent 7e21be5 commit c5a407b

File tree

15 files changed

+39
-39
lines changed

15 files changed

+39
-39
lines changed

src/libstd/c_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ export ptr;
3737
/*
3838
Type: t
3939
40-
The type representing a native chunk of memory. Wrapped in a tag for
40+
The type representing a native chunk of memory. Wrapped in a enum for
4141
opacity; FIXME #818 when it is possible to have truly opaque types, this
4242
should be revisited.
4343
*/
4444

45-
tag t<T> {
45+
enum t<T> {
4646
t({ base: *mutable T, len: uint, rsrc: @dtor_res});
4747
}
4848

src/libstd/deque.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ mod tests {
241241
assert (e(deq.get(3), d));
242242
}
243243

244-
tag taggy { one(int); two(int, int); three(int, int, int); }
244+
enum taggy { one(int); two(int, int); three(int, int, int); }
245245

246-
tag taggypar<T> {
246+
enum taggypar<T> {
247247
onepar(int); twopar(int, int); threepar(int, int, int);
248248
}
249249

src/libstd/ebml.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn get_doc(d: doc, tg: uint) -> doc {
6767
alt maybe_get_doc(d, tg) {
6868
some(d) { ret d; }
6969
none {
70-
#error("failed to find block with tag %u", tg);
70+
#error("failed to find block with enum %u", tg);
7171
fail;
7272
}
7373
}
@@ -155,7 +155,7 @@ fn create_writer(w: io::writer) -> writer {
155155

156156
// TODO: Provide a function to write the standard ebml header.
157157
fn start_tag(w: writer, tag_id: uint) {
158-
// Write the tag ID:
158+
// Write the enum ID:
159159

160160
write_vint(w.writer, tag_id);
161161
// Write a placeholder four-byte size.

src/libstd/extfmt.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ import option::{some, none};
3939

4040
// Functions used by the fmt extension at compile time
4141
mod ct {
42-
tag signedness { signed; unsigned; }
43-
tag caseness { case_upper; case_lower; }
44-
tag ty {
42+
enum signedness { signed; unsigned; }
43+
enum caseness { case_upper; case_lower; }
44+
enum ty {
4545
ty_bool;
4646
ty_str;
4747
ty_char;
@@ -52,14 +52,14 @@ mod ct {
5252
ty_float;
5353
// FIXME: More types
5454
}
55-
tag flag {
55+
enum flag {
5656
flag_left_justify;
5757
flag_left_zero_pad;
5858
flag_space_for_sign;
5959
flag_sign_always;
6060
flag_alternate;
6161
}
62-
tag count {
62+
enum count {
6363
count_is(int);
6464
count_is_param(int);
6565
count_is_next_param;
@@ -76,7 +76,7 @@ mod ct {
7676

7777

7878
// A fragment of the output sequence
79-
tag piece { piece_string(str); piece_conv(conv); }
79+
enum piece { piece_string(str); piece_conv(conv); }
8080
type error_fn = fn@(str) -> ! ;
8181

8282
fn parse_fmt_string(s: str, error: error_fn) -> [piece] {
@@ -260,7 +260,7 @@ mod ct {
260260
// conditions can be evaluated at compile-time. For now though it's cleaner to
261261
// implement it this way, I think.
262262
mod rt {
263-
tag flag {
263+
enum flag {
264264
flag_left_justify;
265265
flag_left_zero_pad;
266266
flag_space_for_sign;
@@ -273,8 +273,8 @@ mod rt {
273273
// comments in front::extfmt::make_flags
274274
flag_none;
275275
}
276-
tag count { count_is(int); count_implied; }
277-
tag ty { ty_default; ty_bits; ty_hex_upper; ty_hex_lower; ty_octal; }
276+
enum count { count_is(int); count_implied; }
277+
enum ty { ty_default; ty_bits; ty_hex_upper; ty_hex_lower; ty_octal; }
278278

279279
// FIXME: May not want to use a vector here for flags;
280280
// instead just use a bool per flag
@@ -384,7 +384,7 @@ mod rt {
384384

385385
ret str::unsafe_from_bytes(svec);
386386
}
387-
tag pad_mode { pad_signed; pad_unsigned; pad_nozero; }
387+
enum pad_mode { pad_signed; pad_unsigned; pad_nozero; }
388388
fn pad(cv: conv, s: str, mode: pad_mode) -> str {
389389
let uwidth;
390390
alt cv.width {

src/libstd/fun_treemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type treemap<K, V> = @tree_node<K, V>;
3131
/*
3232
Tag: tree_node
3333
*/
34-
tag tree_node<K, V> {
34+
enum tree_node<K, V> {
3535
empty;
3636
node(@K, @V, @tree_node<K, V>, @tree_node<K, V>);
3737
}

src/libstd/getopts.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ export opt_strs;
6565
export opt_maybe_str;
6666
export opt_default;
6767

68-
tag name { long(str); short(char); }
68+
enum name { long(str); short(char); }
6969

70-
tag hasarg { yes; no; maybe; }
70+
enum hasarg { yes; no; maybe; }
7171

72-
tag occur { req; optional; multi; }
72+
enum occur { req; optional; multi; }
7373

7474
/*
7575
Type: opt
@@ -130,7 +130,7 @@ fn optmulti(name: str) -> opt {
130130
ret {name: mkname(name), hasarg: yes, occur: multi};
131131
}
132132

133-
tag optval { val(str); given; }
133+
enum optval { val(str); given; }
134134

135135
/*
136136
Type: match
@@ -158,7 +158,7 @@ Type: fail_
158158
The type returned when the command line does not conform to the
159159
expected format. Pass this value to <fail_str> to get an error message.
160160
*/
161-
tag fail_ {
161+
enum fail_ {
162162
argument_missing(str);
163163
unrecognized_option(str);
164164
option_missing(str);
@@ -169,7 +169,7 @@ tag fail_ {
169169
/*
170170
Function: fail_str
171171
172-
Convert a <fail_> tag into an error string
172+
Convert a <fail_> enum into an error string
173173
*/
174174
fn fail_str(f: fail_) -> str {
175175
ret alt f {
@@ -381,7 +381,7 @@ mod tests {
381381
import opt = getopts;
382382
import result::{err, ok};
383383

384-
tag fail_type {
384+
enum fail_type {
385385
argument_missing_;
386386
unrecognized_option_;
387387
option_missing_;

src/libstd/io.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ native mod rustrt {
1717
// Reading
1818

1919
// FIXME This is all buffered. We might need an unbuffered variant as well
20-
tag seek_style { seek_set; seek_end; seek_cur; }
20+
enum seek_style { seek_set; seek_end; seek_cur; }
2121

2222

2323
// The raw underlying reader iface. All readers must implement this.
@@ -264,7 +264,7 @@ fn string_reader(s: str) -> reader {
264264

265265

266266
// Writing
267-
tag fileflag { append; create; truncate; none; }
267+
enum fileflag { append; create; truncate; none; }
268268

269269
// FIXME: Seekable really should be orthogonal.
270270
// FIXME: eventually u64
@@ -495,7 +495,7 @@ fn read_whole_file(file: str) -> result::t<[u8], str> {
495495

496496
mod fsync {
497497

498-
tag level {
498+
enum level {
499499
// whatever fsync does on that platform
500500
fsync;
501501

src/libstd/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Tag: json
2323
2424
Represents a json value.
2525
*/
26-
tag json {
26+
enum json {
2727
/* Variant: num */
2828
num(float);
2929
/* Variant: string */

src/libstd/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import option::{some, none};
1313
/*
1414
Tag: list
1515
*/
16-
tag list<T> {
16+
enum list<T> {
1717
/* Variant: cons */
1818
cons(T, @list<T>);
1919
/* Variant: nil */

src/libstd/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ mod chained {
112112
mutable next: chain<K, V>
113113
};
114114

115-
tag chain<K, V> {
115+
enum chain<K, V> {
116116
present(@entry<K, V>);
117117
absent;
118118
}
@@ -124,7 +124,7 @@ mod chained {
124124
eqer: eqfn<K>
125125
};
126126

127-
tag search_result<K, V> {
127+
enum search_result<K, V> {
128128
not_found;
129129
found_first(uint, @entry<K,V>);
130130
found_after(@entry<K,V>, @entry<K,V>);

src/libstd/net.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Tag: ip_addr
1212
1313
An IP address
1414
*/
15-
tag ip_addr {
15+
enum ip_addr {
1616
/*
1717
Variant: ipv4
1818
@@ -42,7 +42,7 @@ Function: parse_addr
4242
4343
Convert a str to <ip_addr>
4444
45-
Converts a string of the format "x.x.x.x" into an ip_addr tag.
45+
Converts a string of the format "x.x.x.x" into an ip_addr enum.
4646
4747
Failure:
4848

src/libstd/rope.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ mod node {
585585
empty - An empty rope
586586
content - A non-empty rope
587587
*/
588-
tag root {
588+
enum root {
589589
empty;
590590
content(@node);
591591
}
@@ -688,7 +688,7 @@ mod node {
688688
leaf - A leaf consisting in a `str`
689689
concat - The concatenation of two ropes
690690
*/
691-
tag node {
691+
enum node {
692692
leaf(leaf);
693693
concat(concat);
694694
}

src/libstd/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn parse_opts(args: [str]) : vec::is_not_empty(args) -> opt_res {
8484
ret either::left(test_opts);
8585
}
8686

87-
tag test_result { tr_ok; tr_failed; tr_ignored; }
87+
enum test_result { tr_ok; tr_failed; tr_ignored; }
8888

8989
// A simple console test runner
9090
fn run_tests_console(opts: test_opts,
@@ -186,7 +186,7 @@ fn run_tests_console(opts: test_opts,
186186

187187
fn use_color() -> bool { ret get_concurrency() == 1u; }
188188

189-
tag testevent {
189+
enum testevent {
190190
te_filtered([test_desc]);
191191
te_wait(test_desc);
192192
te_result(test_desc, test_result);

src/libstd/treemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type treemap<K, V> = @mutable tree_node<K, V>;
2828
/*
2929
Tag: tree_node
3030
*/
31-
tag tree_node<K, V> { empty; node(@K, @V, treemap<K, V>, treemap<K, V>); }
31+
enum tree_node<K, V> { empty; node(@K, @V, treemap<K, V>, treemap<K, V>); }
3232

3333
/* Section: Operations */
3434

src/libstd/win32_fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn path_is_absolute(p: str) -> bool {
2121
* different semantics for each. Since we build on mingw, we are usually
2222
* dealing with /-separated paths. But the whole interface to splitting and
2323
* joining pathnames needs a bit more abstraction on win32. Possibly a vec or
24-
* tag type.
24+
* enum type.
2525
*/
2626
const path_sep: char = '/';
2727

0 commit comments

Comments
 (0)