Skip to content

Commit 4cecb4b

Browse files
committed
---
yaml --- r: 4121 b: refs/heads/master c: f8968d1 h: refs/heads/master i: 4119: c3ee283 v: v3
1 parent a416b47 commit 4cecb4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+192
-265
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: aea537779e01359cf8da6944218362d44bfaee83
2+
refs/heads/master: f8968d1e719ca8e80429e9f26f75941ccef3c346

trunk/src/test/bench/shootout-fasta.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@ obj myrandom(mutable u32 last) {
2121
}
2222
}
2323

24-
type aminoacids = tup(char, u32);
24+
type aminoacids = rec(char ch, u32 prob);
2525

2626
fn make_cumulative(vec[aminoacids] aa) -> vec[aminoacids] {
2727
let u32 cp = 0u32;
2828
let vec[aminoacids] ans = [];
29-
for (aminoacids a in aa) { cp += a._1; ans += [tup(a._0, cp)]; }
29+
for (aminoacids a in aa) { cp += a.prob; ans += [rec(ch=a.ch, prob=cp)]; }
3030
ret ans;
3131
}
3232

3333
fn select_random(u32 r, vec[aminoacids] genelist) -> char {
34-
if (r < genelist.(0)._1) { ret genelist.(0)._0; }
34+
if (r < genelist.(0).prob) { ret genelist.(0).ch; }
3535
fn bisect(vec[aminoacids] v, uint lo, uint hi, u32 target) -> char {
3636
if (hi > lo + 1u) {
3737
let uint mid = lo + (hi - lo) / 2u;
38-
if (target < v.(mid)._1) {
38+
if (target < v.(mid).prob) {
3939
be bisect(v, lo, mid, target);
4040
} else { be bisect(v, mid, hi, target); }
41-
} else { ret v.(hi)._0; }
41+
} else { ret v.(hi).ch; }
4242
}
4343
ret bisect(genelist, 0u, vec::len[aminoacids](genelist) - 1u, r);
4444
}
@@ -65,16 +65,18 @@ fn make_repeat_fasta(str id, str desc, str s, int n) {
6565
if (str::byte_len(op) > 0u) { log op; }
6666
}
6767

68+
fn acid(char ch, u32 prob) { ret rec(ch=ch, prob=prob); }
69+
6870
fn main(vec[str] args) {
6971
let vec[aminoacids] iub =
70-
make_cumulative([tup('a', 27u32), tup('c', 12u32), tup('g', 12u32),
71-
tup('t', 27u32), tup('B', 2u32), tup('D', 2u32),
72-
tup('H', 2u32), tup('K', 2u32), tup('M', 2u32),
73-
tup('N', 2u32), tup('R', 2u32), tup('S', 2u32),
74-
tup('V', 2u32), tup('W', 2u32), tup('Y', 2u32)]);
72+
make_cumulative([acid('a', 27u32), acid('c', 12u32), acid('g', 12u32),
73+
acid('t', 27u32), acid('B', 2u32), acid('D', 2u32),
74+
acid('H', 2u32), acid('K', 2u32), acid('M', 2u32),
75+
acid('N', 2u32), acid('R', 2u32), acid('S', 2u32),
76+
acid('V', 2u32), acid('W', 2u32), acid('Y', 2u32)]);
7577
let vec[aminoacids] homosapiens =
76-
make_cumulative([tup('a', 30u32), tup('c', 20u32), tup('g', 20u32),
77-
tup('t', 30u32)]);
78+
make_cumulative([acid('a', 30u32), acid('c', 20u32), acid('g', 20u32),
79+
acid('t', 30u32)]);
7880
let str alu =
7981
"GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" +
8082
"GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" +

trunk/src/test/bench/task-perf-word-count.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,10 @@ mod map_reduce {
134134

135135
map(input, bind emit(intermediates, ctrl, _, _));
136136

137-
for each(@tup(str, chan[reduce_proto]) kv in intermediates.items()) {
137+
for each(@rec(str key, chan[reduce_proto] val) kv
138+
in intermediates.items()) {
138139
// log_err "sending done to reducer for " + kv._0;
139-
kv._1 <| release;
140+
kv.val <| release;
140141
}
141142

142143
ctrl <| mapper_done;
@@ -228,9 +229,10 @@ mod map_reduce {
228229
}
229230
}
230231

231-
for each(@tup(str, chan[reduce_proto]) kv in reducers.items()) {
232+
for each(@rec(str key, chan[reduce_proto] val) kv
233+
in reducers.items()) {
232234
// log_err "sending done to reducer for " + kv._0;
233-
kv._1 <| done;
235+
kv.val <| done;
234236
}
235237

236238
// log_err #fmt("joining %u tasks", ivec::len(tasks));
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// xfail-stage0
2-
// error-pattern:+ cannot be applied to type `tup(bool)`
2+
// error-pattern:+ cannot be applied to type `rec(bool x)`
33

44
fn main() {
5-
auto x = tup(true);
6-
x += tup(false);
5+
auto x = rec(x=true);
6+
x += rec(x=false);
77
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// xfail-stage0
2-
// error-pattern:+ cannot be applied to type `tup(bool)`
2+
// error-pattern:+ cannot be applied to type `rec(bool x)`
33

44
fn main() {
5-
auto x = tup(true) + tup(false);
5+
auto x = rec(x=true) + rec(x=false);
66
}

trunk/src/test/compile-fail/for-loop-decl.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ type var_info = rec(uint a, uint b);
99
fn bitv_to_str(fn_info enclosing, bitv::t v) -> str {
1010
auto s = "";
1111

12-
// error is that the value type in the hash map is var_info, not a tuple
13-
for each (@tup(uint, tup(uint, uint)) p in enclosing.vars.items()) {
14-
if (bitv::get(v, p._1._0)) {
12+
// error is that the value type in the hash map is var_info, not a box
13+
for each (@rec(uint key, @uint val) p
14+
in enclosing.vars.items()) {
15+
if (bitv::get(v, *p.val)) {
1516
s += "foo";
1617
}
1718
}

trunk/src/test/compile-fail/item-name-overload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
mod foo {
66
fn bar[T](T f) -> int { ret 17; }
7-
type bar[U, T] = tup(int, U, T);
7+
type bar[U, T] = rec(int a, U b, T c);
88
}
99

1010
fn main() {}

trunk/src/test/compile-fail/writing-to-immutable-tup.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

trunk/src/test/run-pass/acyclic-unwind.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
// xfail-stage3
55
// -*- rust -*-
66

7-
fn f(chan[int] c)
8-
{
9-
type t = tup(int,int,int);
7+
fn f(chan[int] c) {
8+
type t = rec(int _0, int _1, int _2);
109

1110
// Allocate a box.
12-
let @t x = @tup(1,2,3);
11+
let @t x = @rec(_0=1, _1=2, _2=3);
1312

1413
// Signal parent that we've allocated a box.
1514
c <| 1;

trunk/src/test/run-pass/auto-instantiate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33

44
// -*- rust -*-
5-
fn f[T, U](&T x, &U y) -> tup(T, U) { ret tup(x, y); }
5+
fn f[T, U](&T x, &U y) -> rec(T a, U b) { ret rec(a=x, b=y); }
66

7-
fn main() { log f(tup(3, 4, 5), 4)._0._0; log f(5, 6)._0; }
7+
fn main() { log f(rec(x=3, y=4, z=5), 4).a.x; log f(5, 6).a; }

trunk/src/test/run-pass/autoderef-full-lval.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
// -*- rust -*-
55
type clam = rec(@int x, @int y);
66

7-
type fish = tup(@int);
7+
type fish = rec(@int a);
88

99
fn main() {
1010
let clam a = rec(x=@1, y=@2);
1111
let clam b = rec(x=@10, y=@20);
1212
let int z = a.x + b.y;
1313
log z;
1414
assert (z == 21);
15-
let fish forty = tup(@40);
16-
let fish two = tup(@2);
17-
let int answer = forty._0 + two._0;
15+
let fish forty = rec(a=@40);
16+
let fish two = rec(a=@2);
17+
let int answer = forty.a + two.a;
1818
log answer;
1919
assert (answer == 42);
2020
}

trunk/src/test/run-pass/binops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn test_char() {
5454
fn test_box() {
5555
assert @10 == 10;
5656
assert 0xFF & @0xF0 == 0xF0;
57-
assert tup(1, 3) < @tup(1, 4);
57+
assert rec(a=1, b=3) < @rec(a=1, b=4);
5858
assert @rec(a = 'x') != @rec(a = 'y');
5959
}
6060

trunk/src/test/run-pass/box-in-tup.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

trunk/src/test/run-pass/box-unbox.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22

3-
type box[T] = tup(@T);
3+
type box[T] = rec(@T c);
44

5-
fn unbox[T](&box[T] b) -> T { ret *b._0; }
5+
fn unbox[T](&box[T] b) -> T { ret *b.c; }
66

77
fn main() {
88
let int foo = 17;
9-
let box[int] bfoo = tup(@foo);
9+
let box[int] bfoo = rec(c=@foo);
1010
log "see what's in our box";
1111
assert (unbox[int](bfoo) == foo);
1212
}

trunk/src/test/run-pass/expr-alt-generic.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ fn test_bool() {
1515
test_generic[bool](true, eq);
1616
}
1717

18-
fn test_tup() {
19-
type t = tup(int, int);
18+
fn test_rec() {
19+
type t = rec(int a, int b);
2020

21-
fn compare_tup(&t t1, &t t2) -> bool { ret t1 == t2; }
22-
auto eq = bind compare_tup(_, _);
23-
test_generic[t](tup(1, 2), eq);
21+
fn compare_rec(&t t1, &t t2) -> bool { ret t1 == t2; }
22+
auto eq = bind compare_rec(_, _);
23+
test_generic[t](rec(a=1, b=2), eq);
2424
}
2525

26-
fn main() { test_bool(); test_tup(); }
26+
fn main() { test_bool(); test_rec(); }

trunk/src/test/run-pass/expr-block-generic.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ fn test_bool() {
1717
test_generic[bool](true, eq);
1818
}
1919

20-
fn test_tup() {
21-
type t = tup(int, int);
20+
fn test_rec() {
21+
type t = rec(int a, int b);
2222

23-
fn compare_tup(&t t1, &t t2) -> bool { ret t1 == t2; }
24-
auto eq = bind compare_tup(_, _);
25-
test_generic[t](tup(1, 2), eq);
23+
fn compare_rec(&t t1, &t t2) -> bool { ret t1 == t2; }
24+
auto eq = bind compare_rec(_, _);
25+
test_generic[t](rec(a=1, b=2), eq);
2626
}
2727

28-
fn main() { test_bool(); test_tup(); }
28+
fn main() { test_bool(); test_rec(); }

trunk/src/test/run-pass/expr-block-slot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
// Regression test for issue #377
77
fn main() {
8-
auto a = { auto b = tup(3); b };
9-
assert (a._0 == 3);
8+
auto a = { auto b = rec(a=3); b };
9+
assert (a.a == 3);
1010
auto c = { auto d = rec(v=3); d };
1111
assert (c.v == 3);
1212
}

trunk/src/test/run-pass/expr-if-generic.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ fn test_bool() {
1717
test_generic[bool](true, false, eq);
1818
}
1919

20-
fn test_tup() {
21-
type t = tup(int, int);
20+
fn test_rec() {
21+
type t = rec(int a, int b);
2222

23-
fn compare_tup(&t t1, &t t2) -> bool { ret t1 == t2; }
24-
auto eq = bind compare_tup(_, _);
25-
test_generic[t](tup(1, 2), tup(2, 3), eq);
23+
fn compare_rec(&t t1, &t t2) -> bool { ret t1 == t2; }
24+
auto eq = bind compare_rec(_, _);
25+
test_generic[t](rec(a=1, b=2), rec(a=2, b=3), eq);
2626
}
2727

28-
fn main() { test_bool(); test_tup(); }
28+
fn main() { test_bool(); test_rec(); }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22

33
obj ob[K](K k) {
4-
iter foo() -> @tup(K) { put @tup(k); }
4+
iter foo() -> @rec(K a) { put @rec(a=k); }
55
}
66

7-
fn x(&ob[str] o) { for each (@tup(str) i in o.foo()) { } }
7+
fn x(&ob[str] o) { for each (@rec(str a) i in o.foo()) { } }
88

99
fn main() { auto o = ob[str]("hi" + "there"); x(o); }

trunk/src/test/run-pass/foreach-put-structured.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

22

3-
iter pairs() -> tup(int, int) {
3+
iter pairs() -> rec(int _0, int _1) {
44
let int i = 0;
55
let int j = 0;
6-
while (i < 10) { put tup(i, j); i += 1; j += i; }
6+
while (i < 10) { put rec(_0=i, _1=j); i += 1; j += i; }
77
}
88

99
fn main() {
1010
let int i = 10;
1111
let int j = 0;
12-
for each (tup(int, int) p in pairs()) {
12+
for each (rec(int _0, int _1) p in pairs()) {
1313
log p._0;
1414
log p._1;
1515
assert (p._0 + 10 == i);

trunk/src/test/run-pass/generic-bind-2.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
fn id[T](&T t) -> T { ret t; }
44

55
fn main() {
6-
auto t = tup(1, 2, 3, 4, 5, 6, 7);
7-
assert (t._5 == 6);
8-
auto f0 = bind id[tup(int, int, int, int, int, int, int)](t);
9-
assert (f0()._5 == 6);
6+
auto t = rec(a=1, b=2, c=3, d=4, e=5, f=6, g=7);
7+
assert (t.f == 6);
8+
auto f0 = bind id(t);
9+
assert (f0().f == 6);
1010
}

trunk/src/test/run-pass/generic-bind.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
fn id[T](&T t) -> T { ret t; }
44

55
fn main() {
6-
auto t = tup(1, 2, 3, 4, 5, 6, 7);
6+
auto t = rec(_0=1, _1=2, _2=3, _3=4, _4=5, _5=6, _6=7);
77
assert (t._5 == 6);
8-
auto f1 = bind id[tup(int, int, int, int, int, int, int)](_);
8+
auto f1 = bind id[rec(int _0, int _1, int _2, int _3, int _4,
9+
int _5, int _6)](_);
910
assert (f1(t)._5 == 6);
1011
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22

3-
fn box[T](&tup(T, T, T) x) -> @tup(T, T, T) { ret @x; }
3+
fn box[T](&rec(T x, T y, T z) x) -> @rec(T x, T y, T z) { ret @x; }
44

55
fn main() {
6-
let @tup(int, int, int) x = box[int](tup(1, 2, 3));
7-
assert (x._1 == 2);
6+
let @rec(int x, int y, int z) x = box[int](rec(x=1, y=2, z=3));
7+
assert (x.y == 2);
88
}

trunk/src/test/run-pass/generic-derived-type.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
fn g[X](&X x) -> X { ret x; }
44

5-
fn f[T](&T t) -> tup(T, T) {
6-
type pair = tup(T, T);
5+
fn f[T](&T t) -> rec(T a, T b) {
6+
type pair = rec(T a, T b);
77

8-
let pair x = tup(t, t);
8+
let pair x = rec(a=t, b=t);
99
ret g[pair](x);
1010
}
1111

1212
fn main() {
1313
auto b = f[int](10);
14-
log b._0;
15-
log b._1;
16-
assert (b._0 == 10);
17-
assert (b._1 == 10);
14+
log b.a;
15+
log b.b;
16+
assert (b.a == 10);
17+
assert (b.b == 10);
1818
}

0 commit comments

Comments
 (0)