Skip to content

Commit 1e0f7c9

Browse files
ericktgraydon
authored andcommitted
---
yaml --- r: 4738 b: refs/heads/master c: 4c9049c h: refs/heads/master v: v3
1 parent 0028664 commit 1e0f7c9

File tree

18 files changed

+145
-145
lines changed

18 files changed

+145
-145
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: 21f46a1655f2a026546792546b07dec9e039ec54
2+
refs/heads/master: 4c9049c50c5c32f556eaefbcc50209ef8ee353d0

trunk/src/lib/box.rs

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

22
export ptr_eq;
33

4-
fn ptr_eq[T](a: &@T, b: &@T) -> bool {
4+
fn ptr_eq<T>(a: &@T, b: &@T) -> bool {
55
let a_ptr: uint = unsafe::reinterpret_cast(a);
66
let b_ptr: uint = unsafe::reinterpret_cast(b);
77
ret a_ptr == b_ptr;
8-
}
8+
}

trunk/src/lib/comm.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ native "rust" mod rustrt {
2020
fn take_chan(ch : *rust_chan);
2121
fn drop_chan(ch : *rust_chan);
2222
fn chan_send(ch: *rust_chan, v : *void);
23-
fn chan_id_send[~T](target_task : task_id, target_port : port_id,
23+
fn chan_id_send<~T>(target_task : task_id, target_port : port_id,
2424
data : -T);
2525

2626
fn new_port(unit_sz : uint) -> *rust_port;
@@ -30,12 +30,12 @@ native "rust" mod rustrt {
3030
}
3131

3232
native "rust-intrinsic" mod rusti {
33-
fn recv[~T](port : *rustrt::rust_port) -> T;
33+
fn recv<~T>(port : *rustrt::rust_port) -> T;
3434
}
3535

3636
type port_id = int;
3737

38-
type _chan[~T] = {
38+
type _chan<~T> = {
3939
task : task_id,
4040
port : port_id
4141
};
@@ -45,9 +45,9 @@ resource port_ptr(po: *rustrt::rust_port) {
4545
rustrt::del_port(po);
4646
}
4747

48-
obj _port[~T](raw_port : @port_ptr) {
48+
obj _port<~T>(raw_port : @port_ptr) {
4949
// FIXME: rename this to chan once chan is not a keyword.
50-
fn mk_chan() -> _chan[T] {
50+
fn mk_chan() -> _chan<T> {
5151
{
5252
task: task::get_task_id(),
5353
port: rustrt::get_port_id(**raw_port)
@@ -59,10 +59,10 @@ obj _port[~T](raw_port : @port_ptr) {
5959
}
6060
}
6161

62-
fn mk_port[~T]() -> _port<T> {
62+
fn mk_port<~T>() -> _port<T> {
6363
_port(@port_ptr(rustrt::new_port(sys::size_of[T]())))
6464
}
6565

66-
fn send[~T](ch : _chan[T], data : -T) {
66+
fn send<~T>(ch : _chan<T>, data : -T) {
6767
rustrt::chan_id_send(ch.task, ch.port, data);
6868
}

trunk/src/lib/dbg.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212
const const_refcount: uint = 0x7bad_face_u;
1313

1414
native "rust" mod rustrt {
15-
fn debug_tydesc[T]();
16-
fn debug_opaque[T](x: &T);
17-
fn debug_box[T](x: @T);
18-
fn debug_tag[T](x: &T);
19-
fn debug_obj[T](x: &T, nmethods: uint, nbytes: uint);
20-
fn debug_fn[T](x: &T);
21-
fn debug_ptrcast[T, U](x: @T) -> @U;
15+
fn debug_tydesc<T>();
16+
fn debug_opaque<T>(x: &T);
17+
fn debug_box<T>(x: @T);
18+
fn debug_tag<T>(x: &T);
19+
fn debug_obj<T>(x: &T, nmethods: uint, nbytes: uint);
20+
fn debug_fn<T>(x: &T);
21+
fn debug_ptrcast<T, U>(x: @T) -> @U;
2222
fn debug_trap(msg: str);
2323
}
2424

2525
fn debug_tydesc[T]() { rustrt::debug_tydesc[T](); }
2626

27-
fn debug_opaque[T](x: &T) { rustrt::debug_opaque[T](x); }
27+
fn debug_opaque<T>(x: &T) { rustrt::debug_opaque[T](x); }
2828

29-
fn debug_box[T](x: @T) { rustrt::debug_box[T](x); }
29+
fn debug_box<T>(x: @T) { rustrt::debug_box[T](x); }
3030

31-
fn debug_tag[T](x: &T) { rustrt::debug_tag[T](x); }
31+
fn debug_tag<T>(x: &T) { rustrt::debug_tag[T](x); }
3232

3333

3434
/**
@@ -40,13 +40,13 @@ fn debug_tag[T](x: &T) { rustrt::debug_tag[T](x); }
4040
* this to at least be 4u, since an implicit captured tydesc pointer sits in
4141
* the front of any obj's data tuple.x
4242
*/
43-
fn debug_obj[T](x: &T, nmethods: uint, nbytes: uint) {
43+
fn debug_obj<T>(x: &T, nmethods: uint, nbytes: uint) {
4444
rustrt::debug_obj[T](x, nmethods, nbytes);
4545
}
4646

47-
fn debug_fn[T](x: &T) { rustrt::debug_fn[T](x); }
47+
fn debug_fn<T>(x: &T) { rustrt::debug_fn[T](x); }
4848

49-
fn ptr_cast[T, U](x: @T) -> @U { ret rustrt::debug_ptrcast[T, U](x); }
49+
fn ptr_cast<T, U>(x: @T) -> @U { ret rustrt::debug_ptrcast[T, U](x); }
5050

5151
fn trap(s: str) { rustrt::debug_trap(s); }
5252
// Local Variables:

trunk/src/lib/deque.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/**
55
* A deque, for fun. Untested as of yet. Likely buggy.
66
*/
7-
type t[T] =
7+
type t<T> =
88
obj {
99
fn size() -> uint ;
1010
fn add_front(&T) ;
@@ -16,8 +16,8 @@ type t[T] =
1616
fn get(int) -> T ;
1717
};
1818

19-
fn create[@T]() -> t<T> {
20-
type cell[T] = option::t<T>;
19+
fn create<@T>() -> t<T> {
20+
type cell<T> = option::t<T>;
2121

2222
let initial_capacity: uint = 32u; // 2^5
2323
/**
@@ -26,7 +26,7 @@ fn create[@T]() -> t<T> {
2626
*/
2727

2828

29-
fn grow[@T](nelts: uint, lo: uint, elts: &[mutable cell<T>]) ->
29+
fn grow<@T>(nelts: uint, lo: uint, elts: &[mutable cell<T>]) ->
3030
[mutable cell<T>] {
3131
assert (nelts == vec::len(elts));
3232
let rv = ~[mutable];
@@ -42,10 +42,10 @@ fn create[@T]() -> t<T> {
4242

4343
ret rv;
4444
}
45-
fn get[@T](elts: &[mutable cell<T>], i: uint) -> T {
45+
fn get<@T>(elts: &[mutable cell<T>], i: uint) -> T {
4646
ret alt elts.(i) { option::some(t) { t } _ { fail } };
4747
}
48-
obj deque[@T](mutable nelts: uint,
48+
obj deque<@T>(mutable nelts: uint,
4949
mutable lo: uint,
5050
mutable hi: uint,
5151
mutable elts: [mutable cell<T>]) {

trunk/src/lib/either.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@ import option;
33
import option::some;
44
import option::none;
55

6-
tag t[T, U] { left(T); right(U); }
6+
tag t<T, U> { left(T); right(U); }
77

8-
fn either[T, U, V](f_left: &block(&T) -> V, f_right: &block(&U) -> V,
8+
fn either<T, U, V>(f_left: &block(&T) -> V, f_right: &block(&U) -> V,
99
value: &t<T, U>) -> V {
1010
alt value { left(l) { f_left(l) } right(r) { f_right(r) } }
1111
}
1212

13-
fn lefts[T, U](eithers: &[t<T, U>]) -> [T] {
13+
fn lefts<T, U>(eithers: &[t<T, U>]) -> [T] {
1414
let result: [T] = ~[];
1515
for elt: t<T, U> in eithers {
1616
alt elt { left(l) { result += ~[l] } _ {/* fallthrough */ } }
1717
}
1818
ret result;
1919
}
2020

21-
fn rights[T, U](eithers: &[t<T, U>]) -> [U] {
21+
fn rights<T, U>(eithers: &[t<T, U>]) -> [U] {
2222
let result: [U] = ~[];
2323
for elt: t<T, U> in eithers {
2424
alt elt { right(r) { result += ~[r] } _ {/* fallthrough */ } }
2525
}
2626
ret result;
2727
}
2828

29-
fn partition[T, U](eithers: &[t<T, U>]) -> {lefts: [T], rights: [U]} {
29+
fn partition<T, U>(eithers: &[t<T, U>]) -> {lefts: [T], rights: [U]} {
3030
let lefts: [T] = ~[];
3131
let rights: [U] = ~[];
3232
for elt: t<T, U> in eithers {

trunk/src/lib/list.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import option::some;
22
import option::none;
33

4-
tag list[T] { cons(T, @list<T>); nil; }
4+
tag list<T> { cons(T, @list<T>); nil; }
55

6-
fn from_vec[@T](v: &[T]) -> list<T> {
6+
fn from_vec<@T>(v: &[T]) -> list<T> {
77
let l = nil[T];
88
// FIXME: This would be faster and more space efficient if it looped over
99
// a reverse vector iterator. Unfortunately generic iterators seem not to
@@ -13,7 +13,7 @@ fn from_vec[@T](v: &[T]) -> list<T> {
1313
ret l;
1414
}
1515

16-
fn foldl[@T, @U](ls_: &list<T>, u: &U, f: &block(&T, &U) -> U ) -> U {
16+
fn foldl<@T, @U>(ls_: &list<T>, u: &U, f: &block(&T, &U) -> U ) -> U {
1717
let accum: U = u;
1818
let ls = ls_;
1919
while true {
@@ -25,7 +25,7 @@ fn foldl[@T, @U](ls_: &list<T>, u: &U, f: &block(&T, &U) -> U ) -> U {
2525
ret accum;
2626
}
2727

28-
fn find[@T, @U](ls_: &list<T>, f: &block(&T) -> option::t<U>)
28+
fn find<@T, @U>(ls_: &list<T>, f: &block(&T) -> option::t<U>)
2929
-> option::t<U> {
3030
let ls = ls_;
3131
while true {
@@ -39,7 +39,7 @@ fn find[@T, @U](ls_: &list<T>, f: &block(&T) -> option::t<U>)
3939
ret none;
4040
}
4141

42-
fn has[@T](ls_: &list<T>, elt: &T) -> bool {
42+
fn has<@T>(ls_: &list<T>, elt: &T) -> bool {
4343
let ls = ls_;
4444
while true {
4545
alt ls {
@@ -50,26 +50,26 @@ fn has[@T](ls_: &list<T>, elt: &T) -> bool {
5050
ret false;
5151
}
5252

53-
fn length[@T](ls: &list<T>) -> uint {
54-
fn count[T](t: &T, u: &uint) -> uint { ret u + 1u; }
53+
fn length<@T>(ls: &list<T>) -> uint {
54+
fn count<T>(t: &T, u: &uint) -> uint { ret u + 1u; }
5555
ret foldl(ls, 0u, count);
5656
}
5757

58-
fn cdr[@T](ls: &list<T>) -> list<T> {
58+
fn cdr<@T>(ls: &list<T>) -> list<T> {
5959
alt ls {
6060
cons(_, tl) { ret *tl; }
6161
nil. { fail "list empty" }
6262
}
6363
}
6464

65-
fn car[@T](ls: &list<T>) -> T {
65+
fn car<@T>(ls: &list<T>) -> T {
6666
alt ls {
6767
cons(hd, _) { ret hd; }
6868
nil. { fail "list empty" }
6969
}
7070
}
7171

72-
fn append[@T](l: &list<T>, m: &list<T>) -> list<T> {
72+
fn append<@T>(l: &list<T>, m: &list<T>) -> list<T> {
7373
alt l {
7474
nil. { ret m; }
7575
cons(x, xs) {

trunk/src/lib/map.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
22
* Hashmap implementation.
33
*/
4-
type hashfn[K] = fn(&K) -> uint ;
4+
type hashfn<K> = fn(&K) -> uint ;
55

6-
type eqfn[K] = fn(&K, &K) -> bool ;
6+
type eqfn<K> = fn(&K, &K) -> bool ;
77

8-
type hashmap[K, V] =
8+
type hashmap<K, V> =
99
obj {
1010
fn size() -> uint ;
1111
fn insert(&K, &V) -> bool ;
@@ -17,16 +17,16 @@ type hashmap[K, V] =
1717
iter items() -> @{key: K, val: V} ;
1818
iter keys() -> K ;
1919
};
20-
type hashset[K] = hashmap<K, ()>;
20+
type hashset<K> = hashmap<K, ()>;
2121

22-
fn set_add[@K](set: hashset<K>, key: &K) -> bool { ret set.insert(key, ()); }
22+
fn set_add<@K>(set: hashset<K>, key: &K) -> bool { ret set.insert(key, ()); }
2323

24-
fn mk_hashmap[@K, @V](hasher: &hashfn<K>, eqer: &eqfn<K>) -> hashmap<K, V> {
24+
fn mk_hashmap<@K, @V>(hasher: &hashfn<K>, eqer: &eqfn<K>) -> hashmap<K, V> {
2525
let initial_capacity: uint = 32u; // 2^5
2626

2727
let load_factor: util::rational = {num: 3, den: 4};
28-
tag bucket[@K, @V] { nil; deleted; some(K, V); }
29-
fn make_buckets[@K, @V](nbkts: uint) -> [mutable (bucket<K, V>)] {
28+
tag bucket<@K, @V> { nil; deleted; some(K, V); }
29+
fn make_buckets<@K, @V>(nbkts: uint) -> [mutable (bucket<K, V>)] {
3030
ret vec::init_elt_mut[bucket<K, V>](nil[K, V], nbkts);
3131
}
3232
// Derive two hash functions from the one given by taking the upper
@@ -53,7 +53,7 @@ fn mk_hashmap[@K, @V](hasher: &hashfn<K>, eqer: &eqfn<K>) -> hashmap<K, V> {
5353
* will fail.
5454
*/
5555

56-
fn insert_common[@K, @V](hasher: &hashfn<K>, eqer: &eqfn<K>,
56+
fn insert_common<@K, @V>(hasher: &hashfn<K>, eqer: &eqfn<K>,
5757
bkts: &[mutable bucket<K, V>], nbkts: uint,
5858
key: &K, val: &V) -> bool {
5959
let i: uint = 0u;
@@ -76,7 +76,7 @@ fn mk_hashmap[@K, @V](hasher: &hashfn<K>, eqer: &eqfn<K>) -> hashmap<K, V> {
7676
}
7777
fail; // full table
7878
}
79-
fn find_common[@K, @V](hasher: &hashfn<K>, eqer: &eqfn<K>,
79+
fn find_common<@K, @V>(hasher: &hashfn<K>, eqer: &eqfn<K>,
8080
bkts: &[mutable bucket<K, V>], nbkts: uint,
8181
key: &K) -> option::t<V> {
8282
let i: uint = 0u;
@@ -97,7 +97,7 @@ fn mk_hashmap[@K, @V](hasher: &hashfn<K>, eqer: &eqfn<K>) -> hashmap<K, V> {
9797
}
9898
ret option::none;
9999
}
100-
fn rehash[@K, @V](hasher: &hashfn<K>, eqer: &eqfn<K>,
100+
fn rehash<@K, @V>(hasher: &hashfn<K>, eqer: &eqfn<K>,
101101
oldbkts: &[mutable bucket<K, V>], noldbkts: uint,
102102
newbkts: &[mutable bucket<K, V>], nnewbkts: uint) {
103103
for b: bucket<K, V> in oldbkts {
@@ -111,7 +111,7 @@ fn mk_hashmap[@K, @V](hasher: &hashfn<K>, eqer: &eqfn<K>) -> hashmap<K, V> {
111111
}
112112
}
113113
}
114-
obj hashmap[@K, @V](hasher: hashfn<K>,
114+
obj hashmap<@K, @V>(hasher: hashfn<K>,
115115
eqer: eqfn<K>,
116116
mutable bkts: [mutable bucket<K, V>],
117117
mutable nbkts: uint,
@@ -193,17 +193,17 @@ fn mk_hashmap[@K, @V](hasher: &hashfn<K>, eqer: &eqfn<K>) -> hashmap<K, V> {
193193

194194
// Hash map constructors for basic types
195195

196-
fn new_str_hash[@V]() -> hashmap<str, V> {
196+
fn new_str_hash<@V>() -> hashmap<str, V> {
197197
ret mk_hashmap(str::hash, str::eq);
198198
}
199199

200-
fn new_int_hash[@V]() -> hashmap<int, V> {
200+
fn new_int_hash<@V>() -> hashmap<int, V> {
201201
fn hash_int(x: &int) -> uint { ret x as uint; }
202202
fn eq_int(a: &int, b: &int) -> bool { ret a == b; }
203203
ret mk_hashmap(hash_int, eq_int);
204204
}
205205

206-
fn new_uint_hash[@V]() -> hashmap<uint, V> {
206+
fn new_uint_hash<@V>() -> hashmap<uint, V> {
207207
fn hash_uint(x: &uint) -> uint { ret x; }
208208
fn eq_uint(a: &uint, b: &uint) -> bool { ret a == b; }
209209
ret mk_hashmap(hash_uint, eq_uint);

0 commit comments

Comments
 (0)